]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/TPCLib/AliHLTTPCCalibTimeComponent.cxx
Bugfix: lowercase b should be upper case B for component id: TPCClusterFinder32Bit
[u/mrichter/AliRoot.git] / HLT / TPCLib / AliHLTTPCCalibTimeComponent.cxx
1 // $Id$
2 /**************************************************************************
3  * This file is property of and copyright by the ALICE HLT Project        * 
4  * ALICE Experiment at CERN, All rights reserved.                         *
5  *                                                                        *
6  * Primary Authors: Jochen Thaeder <thaeder@kip.uni-heidelberg.de>        *
7  *                  for The ALICE HLT Project.                            *
8  *                                                                        *
9  * Permission to use, copy, modify and distribute this software and its   *
10  * documentation strictly for non-commercial purposes is hereby granted   *
11  * without fee, provided that the above copyright notice appears in all   *
12  * copies and that both the copyright notice and this permission notice   *
13  * appear in the supporting documentation. The authors make no claims     *
14  * about the suitability of this software for any purpose. It is          *
15  * provided "as is" without express or implied warranty.                  *
16  **************************************************************************/
17
18 /** @file   AliHLTTPCCalibTimeComponent.cxx
19     @author Kalliopi Kanaki
20     @date   2009-07-08
21     @brief  A calibration component for interfacing the offline calculation of TPC drift velocity correction 
22 */
23
24 // see header file for class documentation
25 // or
26 // refer to README to build package
27 // or
28 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt   
29
30 #if __GNUC__>= 3
31 using namespace std;
32 #endif
33
34 #include "AliHLTTPCCalibTimeComponent.h"
35
36 #include "AliHLTTPCDefinitions.h"
37 #include "AliTPCcalibTime.h"
38 #include "AliESDEvent.h"
39
40 #include "TObjArray.h"
41 #include "TString.h"
42
43 #include <cstdlib>
44 #include <cerrno>
45
46
47 ClassImp(AliHLTTPCCalibTimeComponent) // ROOT macro for the implementation of ROOT specific class methods
48
49 AliHLTTPCCalibTimeComponent::AliHLTTPCCalibTimeComponent()
50   :
51   fCalibTime(NULL),
52   fESDEvent(NULL),
53   fSeedArray(NULL),
54   fMinPartition(5),
55   fMaxPartition(0),
56   fMinSlice(35),
57   fMaxSlice(0),
58   fSpecification(0) ,
59   fEnableAnalysis(kTRUE)
60 {
61   // see header file for class documentation
62   // or
63   // refer to README to build package
64   // or
65   // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
66 }
67
68 AliHLTTPCCalibTimeComponent::~AliHLTTPCCalibTimeComponent() {
69 // see header file for class documentation
70 }
71
72
73 const char* AliHLTTPCCalibTimeComponent::GetComponentID() {
74 // see header file for class documentation
75
76   return "TPCCalibTime";
77 }
78
79 void AliHLTTPCCalibTimeComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list) {
80 // see header file for class documentation
81
82   list.clear(); 
83   list.push_back( kAliHLTDataTypeTObjArray ); // output of TPCCalibSeedMaker
84   list.push_back( kAliHLTDataTypeESDObject ); // output of TPCEsdConverter
85 }
86
87 AliHLTComponentDataType AliHLTTPCCalibTimeComponent::GetOutputDataType() {
88 // see header file for class documentation
89
90   return AliHLTTPCDefinitions::fgkCalibCEDataType;
91 }
92
93 void AliHLTTPCCalibTimeComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier ) {
94 // see header file for class documentation
95
96   constBase = 0;
97   inputMultiplier = (2.0); // to be estimated
98 }
99
100 AliHLTComponent* AliHLTTPCCalibTimeComponent::Spawn() {
101 // see header file for class documentation
102
103   return new AliHLTTPCCalibTimeComponent();
104 }  
105
106
107 Int_t AliHLTTPCCalibTimeComponent::ScanArgument( Int_t argc, const char** argv ) {
108 // see header file for class documentation
109
110   Int_t iResult = 0;
111   TString argument = "";
112   TString parameter = "";
113
114   if(!argc) return -EINVAL;
115
116   argument = argv[iResult];
117   
118   if(argument.IsNull()) return -EINVAL;
119
120   if( argument.CompareTo("-enable-analysis") == 0 ){
121     HLTInfo( "Analysis before shipping data to FXS enabled." );
122     fEnableAnalysis = kTRUE;
123   }
124   else {
125     iResult = -EINVAL;
126   }      
127   return iResult;
128 }
129
130 Int_t AliHLTTPCCalibTimeComponent::InitCalibration() {
131 // see header file for class documentation
132     
133   if(fCalibTime) return EINPROGRESS;
134   //fCalibTime = new AliTPCcalibTime();
135
136   fCalibTime = new AliTPCcalibTime("cosmicTime","cosmicTime",0, 1213.9e+06, 1213.96e+06);
137   //AliTPCcalibTime::AliTPCcalibTime(const Text_t *name, const Text_t *title, UInt_t StartTime, UInt_t EndTime, Int_t deltaIntegrationTimeVdrift)
138  
139   return 0;
140 }
141
142 Int_t AliHLTTPCCalibTimeComponent::DeinitCalibration() {
143 // see header file for class documentation
144
145   if(fCalibTime) delete fCalibTime;
146   fCalibTime = NULL;
147
148   return 0;
149 }
150
151 Int_t AliHLTTPCCalibTimeComponent::ProcessCalibration( const AliHLTComponentEventData& /*evtData*/,  AliHLTComponentTriggerData& /*trigData*/ ){
152 // see header file for class documentation
153   
154   if(GetFirstInputBlock( kAliHLTDataTypeSOR ) || GetFirstInputBlock( kAliHLTDataTypeEOR )) return 0;
155
156   TObject *iterESD, *iterSEED = NULL;
157
158   //----------- loop over output of TPCEsdConverter ----------------//
159
160   for(iterESD = (TObject*)GetFirstInputObject(kAliHLTDataTypeESDObject|kAliHLTDataOriginTPC); iterESD != NULL; iterESD = (TObject*)GetNextInputObject()){   
161        
162       if(GetDataType(iterSEED) != (kAliHLTDataTypeESDObject | kAliHLTDataOriginTPC)) continue;
163   
164       AliHLTUInt8_t slice     = AliHLTTPCDefinitions::GetMinSliceNr(GetSpecification(iterESD)); 
165       AliHLTUInt8_t partition = AliHLTTPCDefinitions::GetMinPatchNr(GetSpecification(iterESD));
166       
167       if( partition < fMinPartition ) fMinPartition = partition;
168       if( partition > fMaxPartition ) fMaxPartition = partition;
169       if( slice < fMinSlice ) fMinSlice = slice;
170       if( slice > fMaxSlice ) fMaxSlice = slice;
171       
172       fESDEvent = dynamic_cast<AliESDEvent*>(iterESD);
173       fESDEvent->CreateStdContent();
174   } 
175  
176  
177   //--------------- output over TObjArray of AliTPCseed objects (output of TPCSeedMaker) -------------------//
178   
179   for(iterSEED = (TObject*)GetFirstInputObject(kAliHLTDataTypeTObjArray|kAliHLTDataOriginTPC); iterSEED != NULL; iterSEED = (TObject*)GetNextInputObject()){  
180               
181       if(GetDataType(iterSEED) != (kAliHLTDataTypeTObjArray | kAliHLTDataOriginTPC)) continue;
182        
183       fSeedArray = dynamic_cast<TObjArray*>(iterSEED); 
184   }
185  
186   fCalibTime->Process(fESDEvent);
187  
188  
189  
190   fSpecification = AliHLTTPCDefinitions::EncodeDataSpecification( fMinSlice, fMaxSlice, fMinPartition, fMaxPartition );
191   PushBack( (TObject*)fCalibTime, AliHLTTPCDefinitions::fgkCalibCEDataType, fSpecification);
192   
193   return 0;
194 }
195
196 Int_t AliHLTTPCCalibTimeComponent::ShipDataToFXS( const AliHLTComponentEventData& /*evtData*/,  AliHLTComponentTriggerData& /*trigData*/ ){
197 // see header file for class documentation
198     
199   if(fEnableAnalysis) fCalibTime->Analyze();  
200   PushToFXS( (TObject*)fCalibTime, "TPC", "Time" ) ;
201   
202   return 0;
203
204
205