]>
Commit | Line | Data |
---|---|---|
9b99ccf1 | 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: Kalliopi Kanaki <Kalliopi.Kanaki@ift.uib.no> * | |
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 AliHLTTPCCalibrationComponent.cxx | |
19 | @author Kalliopi Kanaki | |
20 | @date | |
21 | @brief | |
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 | ||
9b99ccf1 | 30 | #include "AliHLTTPCCalibrationComponent.h" |
31 | #include "AliHLTTPCDefinitions.h" | |
32 | #include "AliHLTTPCAnalysisTaskcalib.h" | |
8d53dca2 | 33 | #include "AliHLTReadoutList.h" |
9b99ccf1 | 34 | |
35 | #include "AliAnalysisManager.h" | |
1151db47 | 36 | #include "AliESDEvent.h" |
37 | //#include "AliESDInputHandler.h" | |
9b99ccf1 | 38 | |
39 | #include "AliTPCcalibTime.h" | |
40 | #include "AliTPCcalibTimeGain.h" | |
1151db47 | 41 | #include "AliTPCseed.h" |
9b99ccf1 | 42 | |
43 | #include "TString.h" | |
44 | #include "TObjArray.h" | |
45 | #include "TTimeStamp.h" | |
46 | ||
1151db47 | 47 | #include <cstdlib> |
48 | #include <cerrno> | |
49 | ||
d5cf9283 | 50 | using namespace std; |
51 | ||
9b99ccf1 | 52 | ClassImp(AliHLTTPCCalibrationComponent) // ROOT macro for the implementation of ROOT specific class methods |
53 | ||
54 | AliHLTTPCCalibrationComponent::AliHLTTPCCalibrationComponent() | |
55 | : | |
56 | fCalibTask(NULL), | |
57 | fCalibTime(NULL), | |
58 | fCalibTimeGain(NULL), | |
59 | fESDEvent(NULL), | |
60 | fSeedArray(NULL), | |
61 | fMinPartition(5), | |
62 | fMaxPartition(0), | |
63 | fMinSlice(35), | |
64 | fMaxSlice(0), | |
65 | fSpecification(0) , | |
66 | fEnableAnalysis(kTRUE) | |
67 | { | |
68 | // see header file for class documentation | |
69 | // or | |
70 | // refer to README to build package | |
71 | // or | |
72 | // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt | |
73 | } | |
74 | ||
75 | AliHLTTPCCalibrationComponent::~AliHLTTPCCalibrationComponent() { | |
76 | // see header file for class documentation | |
77 | } | |
78 | ||
79 | const char* AliHLTTPCCalibrationComponent::GetComponentID() { | |
80 | // see header file for class documentation | |
81 | ||
82 | return "TPCCalibration"; | |
83 | } | |
84 | ||
85 | void AliHLTTPCCalibrationComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list) { | |
86 | // see header file for class documentation | |
87 | ||
4a406311 | 88 | list.clear(); |
89 | list.push_back( kAliHLTDataTypeTObjArray|kAliHLTDataOriginTPC ); // output of TPCCalibSeedMaker | |
90 | list.push_back( kAliHLTDataTypeESDObject|kAliHLTDataOriginOut ); // output of global esd converter | |
91 | ||
9b99ccf1 | 92 | } |
93 | ||
94 | AliHLTComponentDataType AliHLTTPCCalibrationComponent::GetOutputDataType() { | |
95 | // see header file for class documentation | |
96 | ||
37250d7e | 97 | return AliHLTTPCDefinitions::CalibCEDataType(); |
9b99ccf1 | 98 | } |
99 | ||
100 | void AliHLTTPCCalibrationComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier ) { | |
101 | // see header file for class documentation | |
102 | ||
103 | constBase = 0; | |
104 | inputMultiplier = (2.0); // to be estimated | |
105 | } | |
106 | ||
107 | AliHLTComponent* AliHLTTPCCalibrationComponent::Spawn() { | |
108 | // see header file for class documentation | |
109 | ||
110 | return new AliHLTTPCCalibrationComponent(); | |
111 | } | |
112 | ||
113 | ||
114 | Int_t AliHLTTPCCalibrationComponent::ScanArgument( Int_t argc, const char** argv ) { | |
115 | // see header file for class documentation | |
116 | ||
117 | Int_t iResult = 0; | |
118 | TString argument = ""; | |
119 | TString parameter = ""; | |
120 | ||
121 | if(!argc) return -EINVAL; | |
122 | ||
123 | argument = argv[iResult]; | |
124 | ||
125 | if(argument.IsNull()) return -EINVAL; | |
126 | ||
127 | if( argument.CompareTo("-enable-analysis") == 0 ){ | |
128 | HLTInfo( "Analysis before shipping data to FXS enabled." ); | |
129 | fEnableAnalysis = kTRUE; | |
130 | } | |
131 | else { | |
132 | iResult = -EINVAL; | |
133 | } | |
134 | ||
135 | return iResult; | |
136 | } | |
137 | ||
138 | Int_t AliHLTTPCCalibrationComponent::InitCalibration() { | |
139 | // see header file for class documentation | |
9b99ccf1 | 140 | |
9b99ccf1 | 141 | if(fCalibTask) return EINPROGRESS; |
142 | fCalibTask = new AliHLTTPCAnalysisTaskcalib("TPC Calibration Task"); | |
143 | ||
144 | if(fCalibTime) return EINPROGRESS; | |
1151db47 | 145 | //fCalibTime = new AliTPCcalibTime(); |
146 | fCalibTime = new AliTPCcalibTime("calibTime","time dependent Vdrift calibration",-2, 2, 1); | |
9b99ccf1 | 147 | |
148 | fCalibTime->SetDebugLevel(20); | |
149 | fCalibTime->SetStreamLevel(10); | |
150 | fCalibTime->SetTriggerMask(-1,-1,kFALSE); //accept everything | |
151 | ||
152 | if(fCalibTimeGain) return EINPROGRESS; | |
f6c3210f | 153 | fCalibTimeGain = new AliTPCcalibTimeGain("calibTimeGain","time dependent gain calibration",-2, 2, 1); |
9b99ccf1 | 154 | |
155 | fCalibTask->AddJob(fCalibTime); | |
156 | fCalibTask->AddJob(fCalibTimeGain); | |
157 | fCalibTask->GetJobs(); | |
158 | ||
159 | return 0; | |
160 | } | |
161 | ||
162 | Int_t AliHLTTPCCalibrationComponent::DeinitCalibration() { | |
163 | // see header file for class documentation | |
164 | ||
165 | if(fCalibTask) delete fCalibTask; fCalibTask = NULL; | |
166 | if(fCalibTime) delete fCalibTime; fCalibTime = NULL; | |
167 | if(fCalibTimeGain) delete fCalibTimeGain; fCalibTimeGain = NULL; | |
168 | ||
169 | return 0; | |
170 | } | |
171 | ||
172 | Int_t AliHLTTPCCalibrationComponent::ProcessCalibration( const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& /*trigData*/ ){ | |
173 | // see header file for class documentation | |
174 | ||
175 | if(GetFirstInputBlock( kAliHLTDataTypeSOR ) || GetFirstInputBlock( kAliHLTDataTypeEOR )) return 0; | |
176 | ||
1151db47 | 177 | TObject *iter = NULL; |
9b99ccf1 | 178 | |
1151db47 | 179 | //--------------- output over TObjArray of AliTPCseed objects (output of TPCSeedMaker) -------------------// |
180 | ||
181 | for(iter = (TObject*)GetFirstInputObject(kAliHLTDataTypeTObjArray|kAliHLTDataOriginTPC); iter != NULL; iter = (TObject*)GetNextInputObject()){ | |
182 | ||
183 | if(GetDataType(iter) != (kAliHLTDataTypeTObjArray | kAliHLTDataOriginTPC)) continue; | |
184 | fSeedArray = dynamic_cast<TObjArray*>(iter); | |
185 | } | |
186 | ||
187 | //----------- loop over output of global esd converter ----------------// | |
9b99ccf1 | 188 | |
1151db47 | 189 | for(iter = (TObject*)GetFirstInputObject(kAliHLTDataTypeESDObject | kAliHLTDataOriginOut); iter != NULL; iter = (TObject*)GetNextInputObject()){ |
190 | ||
191 | if(GetDataType(iter) != (kAliHLTDataTypeESDObject | kAliHLTDataOriginOut)) continue; | |
9b99ccf1 | 192 | |
1151db47 | 193 | AliHLTUInt8_t slice = AliHLTTPCDefinitions::GetMinSliceNr(GetSpecification(iter)); |
194 | AliHLTUInt8_t partition = AliHLTTPCDefinitions::GetMinPatchNr(GetSpecification(iter)); | |
9b99ccf1 | 195 | |
196 | if( partition < fMinPartition ) fMinPartition = partition; | |
197 | if( partition > fMaxPartition ) fMaxPartition = partition; | |
198 | if( slice < fMinSlice ) fMinSlice = slice; | |
199 | if( slice > fMaxSlice ) fMaxSlice = slice; | |
200 | ||
1151db47 | 201 | fESDEvent = dynamic_cast<AliESDEvent*>(iter); |
9b99ccf1 | 202 | fESDEvent->CreateStdContent(); |
1151db47 | 203 | |
204 | HLTDebug("# Seeds: %i\n", fSeedArray->GetEntriesFast()); | |
205 | ||
206 | for(Int_t i=0; i<fSeedArray->GetEntriesFast(); i++){ | |
207 | ||
208 | AliTPCseed *seed = (AliTPCseed*)fSeedArray->UncheckedAt(i); | |
209 | if(!seed) continue; | |
210 | AliESDtrack *esd = fESDEvent->GetTrack(i); | |
211 | AliTPCseed *seedCopy = new AliTPCseed(*seed, kTRUE); | |
212 | esd->AddCalibObject(seedCopy); | |
213 | } | |
214 | } | |
9b99ccf1 | 215 | |
216 | fCalibTask->Process(fESDEvent); | |
217 | ||
218 | fSpecification = AliHLTTPCDefinitions::EncodeDataSpecification( fMinSlice, fMaxSlice, fMinPartition, fMaxPartition ); | |
37250d7e | 219 | PushBack( (TObject*) fCalibTask, AliHLTTPCDefinitions::CalibCEDataType() | kAliHLTDataOriginOut, fSpecification); |
9b99ccf1 | 220 | |
221 | return 0; | |
222 | } | |
223 | ||
224 | Int_t AliHLTTPCCalibrationComponent::ShipDataToFXS( const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& /*trigData*/ ){ | |
225 | // see header file for class documentation | |
226 | ||
227 | if(fEnableAnalysis) fCalibTask->Analyze(); | |
8d53dca2 | 228 | static AliHLTReadoutList rdList(AliHLTReadoutList::kTPC); |
89413559 | 229 | PushToFXS( (TObject*) fCalibTask, "TPC", "CALIB", &rdList ) ; |
9b99ccf1 | 230 | |
231 | return 0; | |
232 | } | |
233 | ||
234 |