]>
Commit | Line | Data |
---|---|---|
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 AliHLTTPCHistogramHandlerComponent.cxx | |
19 | @author Kalliopi Kanaki | |
20 | @date | |
21 | @brief The Histogram Handler component | |
22 | */ | |
23 | ||
24 | #if __GNUC__>= 3 | |
25 | using namespace std; | |
26 | #endif | |
27 | #include "AliHLTTPCHistogramHandlerComponent.h" | |
28 | #include "AliHLTTPCDefinitions.h" | |
29 | #include "AliCDBEntry.h" | |
30 | #include "AliCDBManager.h" | |
31 | #include "AliHLTTPCTransform.h" | |
32 | ||
33 | #include <cstdlib> | |
34 | #include <cerrno> | |
35 | #include "TString.h" | |
36 | #include "TFile.h" | |
37 | #include "TObjArray.h" | |
38 | #include "TObjString.h" | |
39 | #include <sys/time.h> | |
40 | #include "TH1.h" | |
41 | #include "TH2.h" | |
42 | #include "TLine.h" | |
43 | #include "TMath.h" | |
44 | ||
45 | ClassImp(AliHLTTPCHistogramHandlerComponent) //ROOT macro for the implementation of ROOT specific class methods | |
46 | ||
47 | AliHLTTPCHistogramHandlerComponent::AliHLTTPCHistogramHandlerComponent() | |
48 | : | |
49 | fSpecification(0), | |
50 | fNoiseHistograms(0), | |
51 | fKryptonHistograms(0), | |
52 | fUseGeneral(kFALSE), | |
53 | fIgnoreSpecification(kFALSE), | |
54 | fSlice(-99), | |
55 | ||
56 | fHistTH1Tmp(NULL), | |
57 | fTotalClusterChargeIROCAll(NULL), | |
58 | fTotalClusterChargeOROCAll(NULL), | |
59 | fQMaxPartitionAll(NULL), | |
60 | fPlotQmaxROCAll(NULL), | |
61 | fNumberOfClusters(NULL), | |
62 | ||
63 | fHistTH2Tmp(NULL), | |
64 | fHistTPCSideAmax(NULL), | |
65 | fHistTPCSideCmax(NULL), | |
66 | fHistTPCSideAtot(NULL), | |
67 | fHistTPCSideCtot(NULL), | |
68 | fHistTPCSideArms(NULL), | |
69 | fHistTPCSideCrms(NULL), | |
70 | ||
71 | fHistogramData() | |
72 | { | |
73 | // see header file for class documentation | |
74 | // or | |
75 | // refer to README to build package | |
76 | // or | |
77 | // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt | |
78 | } | |
79 | ||
80 | AliHLTTPCHistogramHandlerComponent::~AliHLTTPCHistogramHandlerComponent() { | |
81 | // see header file for class documentation | |
82 | ||
83 | } | |
84 | ||
85 | // Public functions to implement AliHLTComponent's interface. | |
86 | // These functions are required for the registration process | |
87 | ||
88 | const char* AliHLTTPCHistogramHandlerComponent::GetComponentID() { | |
89 | // see header file for class documentation | |
90 | ||
91 | return "TPCHistogramHandler"; | |
92 | } | |
93 | ||
94 | void AliHLTTPCHistogramHandlerComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list) { | |
95 | // see header file for class documentation | |
96 | ||
97 | list.clear(); | |
98 | list.push_back( kAliHLTDataTypeHistogram ); | |
99 | } | |
100 | ||
101 | AliHLTComponentDataType AliHLTTPCHistogramHandlerComponent::GetOutputDataType() { | |
102 | // see header file for class documentation | |
103 | ||
104 | return kAliHLTDataTypeHistogram; | |
105 | } | |
106 | ||
107 | int AliHLTTPCHistogramHandlerComponent::GetOutputDataTypes(AliHLTComponentDataTypeList& tgtList) { | |
108 | // see header file for class documentation | |
109 | ||
110 | tgtList.clear(); | |
111 | tgtList.push_back(kAliHLTDataTypeHistogram); | |
112 | return tgtList.size(); | |
113 | } | |
114 | ||
115 | void AliHLTTPCHistogramHandlerComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier ) { | |
116 | // see header file for class documentation | |
117 | ||
118 | constBase=0; | |
119 | inputMultiplier=2.0; | |
120 | } | |
121 | ||
122 | AliHLTComponent* AliHLTTPCHistogramHandlerComponent::Spawn() { | |
123 | // see header file for class documentation | |
124 | ||
125 | return new AliHLTTPCHistogramHandlerComponent(); | |
126 | } | |
127 | ||
128 | int AliHLTTPCHistogramHandlerComponent::DoInit( int argc, const char** argv ) { | |
129 | // see header file for class documentation | |
130 | ||
131 | //Int_t i = 0; | |
132 | //Char_t* cpErr; | |
133 | ||
134 | int iResult=0; | |
135 | ||
136 | TString configuration=""; | |
137 | TString argument=""; | |
138 | for (int j=0; j<argc && iResult>=0; j++) { | |
139 | ||
140 | argument=argv[j]; | |
141 | if (!configuration.IsNull()) configuration+=" "; | |
142 | configuration+=argument; | |
143 | } | |
144 | ||
145 | if (!configuration.IsNull()) { | |
146 | iResult=Configure(configuration.Data()); | |
147 | } else { | |
148 | iResult=Reconfigure(NULL, NULL); | |
149 | } | |
150 | ||
151 | if(fUseGeneral == kFALSE){ | |
152 | fHistTPCSideAmax = new TH2F("fHistTPCSideAmax","TPC side A (max signal)",250,-250,250,250,-250,250); | |
153 | fHistTPCSideAmax->SetXTitle("global X (cm)"); fHistTPCSideAmax->SetYTitle("global Y (cm)"); | |
154 | fHistTPCSideCmax = new TH2F("fHistTPCSideCmax","TPC side C (max signal)",250,-250,250,250,-250,250); | |
155 | fHistTPCSideCmax->SetXTitle("global X (cm)"); fHistTPCSideCmax->SetYTitle("global Y (cm)"); | |
156 | ||
157 | fHistTPCSideAtot = new TH2F("fHistTPCSideAtot","TPC side A (total signal)",250,-250,250,250,-250,250); | |
158 | fHistTPCSideAtot->SetXTitle("global X (cm)"); fHistTPCSideAtot->SetYTitle("global Y (cm)"); | |
159 | fHistTPCSideCtot = new TH2F("fHistTPCSideCtot","TPC side C (total signal)",250,-250,250,250,-250,250); | |
160 | fHistTPCSideCtot->SetXTitle("global X (cm)"); fHistTPCSideCtot->SetYTitle("global Y (cm)"); | |
161 | ||
162 | fHistTPCSideArms = new TH2F("fHistTPCSideArms","TPC side A (baseline RMS)",250,-250,250,250,-250,250); | |
163 | fHistTPCSideArms->SetXTitle("global X (cm)"); fHistTPCSideArms->SetYTitle("global Y (cm)"); | |
164 | fHistTPCSideCrms = new TH2F("fHistTPCSideCrms","TPC side C (baseline RMS)",250,-250,250,250,-250,250); | |
165 | fHistTPCSideCrms->SetXTitle("global X (cm)"); fHistTPCSideCrms->SetYTitle("global Y (cm)"); | |
166 | } | |
167 | return 0; | |
168 | } // end DoInit() | |
169 | ||
170 | int AliHLTTPCHistogramHandlerComponent::DoDeinit() { | |
171 | // see header file for class documentation | |
172 | ||
173 | if(fHistTPCSideAmax){ delete fHistTPCSideAmax; fHistTPCSideAmax=NULL; } | |
174 | if(fHistTPCSideCmax){ delete fHistTPCSideCmax; fHistTPCSideCmax=NULL; } | |
175 | ||
176 | if(fHistTPCSideAtot){ delete fHistTPCSideAtot; fHistTPCSideAtot=NULL; } | |
177 | if(fHistTPCSideCtot){ delete fHistTPCSideCtot; fHistTPCSideCtot=NULL; } | |
178 | ||
179 | if(fHistTPCSideArms){ delete fHistTPCSideArms; fHistTPCSideArms=NULL; } | |
180 | if(fHistTPCSideCrms){ delete fHistTPCSideCrms; fHistTPCSideCrms=NULL; } | |
181 | ||
182 | return 0; | |
183 | } | |
184 | ||
185 | int AliHLTTPCHistogramHandlerComponent::DoEvent(const AliHLTComponentEventData&/* evtData*/, AliHLTComponentTriggerData& /*trigData*/){ | |
186 | // see header file for class documentation | |
187 | ||
188 | //HLTInfo("--- Entering DoEvent() in TPCHistogramHandler ---"); | |
189 | ||
190 | if(GetFirstInputBlock( kAliHLTDataTypeSOR ) || GetFirstInputBlock( kAliHLTDataTypeEOR )) return 0; | |
191 | ||
192 | if(fUseGeneral == kFALSE){ | |
193 | fTotalClusterChargeIROCAll = new TH1F("fTotalClusterChargeIROCAll","Total Charge of clusters in all IROC",4000,0,4000); | |
194 | fTotalClusterChargeOROCAll = new TH1F("fTotalClusterChargeOROCAll","Total Charge of clusters in all OROC",4000,0,4000); | |
195 | fQMaxPartitionAll = new TH1F("fQMaxPartitionAll", "QMax for All Partitions", 216,0,216); | |
196 | fPlotQmaxROCAll = new TH1F("fQMaxROCAll", "QMax for All ROC", 72,0,72); | |
197 | fNumberOfClusters = new TH1F("fNumberOfClusters", "Total Number of Clusters", 1,0,1); | |
198 | } | |
199 | ||
200 | const TObject *iter = NULL; | |
201 | for(iter = GetFirstInputObject(kAliHLTDataTypeHistogram|kAliHLTDataOriginTPC); iter != NULL; iter = GetNextInputObject()){ | |
202 | ||
203 | // HLTInfo("Event 0x%08LX (%Lu) received datatype: %s - required datatype: %s", | |
204 | // evtData.fEventID, evtData.fEventID, | |
205 | // DataType2Text(GetDataType(iter)).c_str(), | |
206 | // DataType2Text(kAliHLTDataTypeHistogram | kAliHLTDataOriginTPC).c_str()); | |
207 | ||
208 | // if (GetDataType(iter) == (kAliHLTDataTypeHistogram | kAliHLTDataOriginTPC) && GetEventCount()<2){ | |
209 | // HLTWarning("data type %s is depricated, use %s (kAliHLTDataTypeHistogram)!", | |
210 | // DataType2Text(kAliHLTDataTypeHistogram).c_str(), | |
211 | // DataType2Text(kAliHLTDataTypeHistogram | kAliHLTDataOriginTPC).c_str()); | |
212 | // } | |
213 | ||
214 | if (GetDataType(iter) != (kAliHLTDataTypeHistogram | kAliHLTDataOriginTPC)) continue; | |
215 | ||
216 | // Summing the output histograms of the AliHLTTPCNoiseMapComponent (from partition to TPC sides) | |
217 | ||
218 | if(fUseGeneral == kFALSE){ | |
219 | if(fNoiseHistograms == kTRUE){ | |
220 | ||
221 | fHistTH2Tmp = (TH2F*)iter; | |
222 | TString histName = fHistTH2Tmp->GetName(); | |
223 | ||
224 | UInt_t minSlice = AliHLTTPCDefinitions::GetMinSliceNr(GetSpecification(iter)); | |
225 | UInt_t maxSlice = AliHLTTPCDefinitions::GetMaxSliceNr(GetSpecification(iter)); | |
226 | UInt_t minPartition = AliHLTTPCDefinitions::GetMinPatchNr(GetSpecification(iter)); | |
227 | UInt_t maxPartition = AliHLTTPCDefinitions::GetMaxPatchNr(GetSpecification(iter)); | |
228 | ||
229 | if((minSlice!=maxSlice) || (minPartition!=maxPartition)){ | |
230 | HLTWarning("TPCHistogramHandler::The Noise Map component is not running on partition level!"); | |
231 | } | |
232 | ||
233 | // minSlice=maxSlice, when the Noise Map component runs on partition level (as it should) | |
234 | ||
235 | if (histName.Contains("fHistSideAMaxSignal")) fHistTPCSideAmax->Add(fHistTH2Tmp,1); | |
236 | else if(histName.Contains("fHistSideATotSignal")) fHistTPCSideAtot->Add(fHistTH2Tmp,1); | |
237 | else if(histName.Contains("fHistSideAPadRMS")) fHistTPCSideArms->Add(fHistTH2Tmp,1); | |
238 | else if(histName.Contains("fHistSideCMaxSignal")) fHistTPCSideCmax->Add(fHistTH2Tmp,1); | |
239 | else if(histName.Contains("fHistSideCTotSignal")) fHistTPCSideCtot->Add(fHistTH2Tmp,1); | |
240 | else if(histName.Contains("fHistSideCPadRMS")) fHistTPCSideCrms->Add(fHistTH2Tmp,1); | |
241 | else continue; | |
242 | ||
243 | } // endif fNoiseHistograms==kTRUE | |
244 | ||
245 | // Summing the output of AliHLTTPCClusterHistoComponent | |
246 | if(fKryptonHistograms){ | |
247 | Int_t thisrow=-1,thissector=-1,row=-1; | |
248 | ||
249 | AliHLTUInt8_t slice = AliHLTTPCDefinitions::GetMinSliceNr(GetSpecification(iter)); | |
250 | AliHLTUInt8_t patch = AliHLTTPCDefinitions::GetMinPatchNr(GetSpecification(iter)); | |
251 | row = AliHLTTPCTransform::GetFirstRow(patch); | |
252 | AliHLTTPCTransform::Slice2Sector(slice,row,thissector,thisrow); | |
253 | ||
254 | fHistTH1Tmp = (TH1F*)iter; | |
255 | TString name = fHistTH1Tmp->GetName(); | |
256 | ||
257 | if(name=="fTotalClusterChargeIROCAll"){ | |
258 | fTotalClusterChargeIROCAll->Add(fTotalClusterChargeIROCAll,fHistTH1Tmp,1,1); | |
259 | } | |
260 | else if(name=="fTotalClusterChargeOROCAll"){ | |
261 | fTotalClusterChargeOROCAll->Add(fTotalClusterChargeOROCAll,fHistTH1Tmp,1,1); | |
262 | } | |
263 | else if(name=="fQMaxPartitionAll"){ | |
264 | for(Int_t t=0;t<216;t++){ | |
265 | if(fHistTH1Tmp->GetBinContent(t)>fQMaxPartitionAll->GetBinContent(t)){ | |
266 | fQMaxPartitionAll->SetBinContent(t,fHistTH1Tmp->GetBinContent(t)); | |
267 | } | |
268 | } | |
269 | } | |
270 | else if(name=="fQMaxROCAll"){ | |
271 | for(Int_t t=0;t<72;t++){ | |
272 | if(fHistTH1Tmp->GetBinContent(t)>fPlotQmaxROCAll->GetBinContent(t)){ | |
273 | fPlotQmaxROCAll->SetBinContent(t,fHistTH1Tmp->GetBinContent(t)); | |
274 | } | |
275 | } | |
276 | } | |
277 | else if(name=="fNumberOfClusters"){ | |
278 | fNumberOfClusters->Add(fNumberOfClusters,fHistTH1Tmp,1,1); | |
279 | } | |
280 | else{ | |
281 | HLTWarning("No histogram names match. %s",name.Data()); | |
282 | continue; | |
283 | } | |
284 | } //endif fKryptonHistograms==kTRUE | |
285 | } | |
286 | ||
287 | else { // means fUseGeneral ==kTRUE | |
288 | ||
289 | TH1 * tmp = (TH1*)iter; | |
290 | TString histName = tmp->GetName(); | |
291 | UInt_t minSlice = AliHLTTPCDefinitions::GetMinSliceNr(GetSpecification(iter)); | |
292 | UInt_t maxSlice = AliHLTTPCDefinitions::GetMaxSliceNr(GetSpecification(iter)); | |
293 | UInt_t minPartition = AliHLTTPCDefinitions::GetMinPatchNr(GetSpecification(iter)); | |
294 | UInt_t maxPartition = AliHLTTPCDefinitions::GetMaxPatchNr(GetSpecification(iter)); | |
295 | ||
296 | Bool_t histogramNotAdded = kTRUE; | |
297 | ||
298 | for(UInt_t i=0;i<fHistogramData.size();i++){ | |
299 | if(fIgnoreSpecification == kTRUE){ | |
300 | ||
301 | /* | |
302 | if(histName.Contains(Form("_Slice_%.2d%.2d_Partition_%.2d%.2d", minSlice, maxSlice, minPartition, maxPartition))){ | |
303 | cout << "HistogramContains the given string." << endl; | |
304 | } | |
305 | */ | |
306 | histName.ReplaceAll(Form("_Slice_%.2d%.2d_Partition_%.2d%.2d", minSlice, maxSlice, minPartition, maxPartition),""); | |
307 | } | |
308 | ||
309 | if(histName.CompareTo(fHistogramData.at(i).fHistogram->GetName())==0){ | |
310 | if((minSlice==fHistogramData.at(i).fMinSlice && maxSlice == fHistogramData.at(i).fMaxSlice) || fIgnoreSpecification == kTRUE){ | |
311 | if((minPartition==fHistogramData.at(i).fMinPartition && maxPartition == fHistogramData.at(i).fMaxPartition) || fIgnoreSpecification == kTRUE){ | |
312 | fHistogramData.at(i).fHistogram->Add(tmp); | |
313 | histogramNotAdded = kFALSE; | |
314 | break; | |
315 | } | |
316 | else{ | |
317 | HLTWarning("Histogram with same name does not have the same partition specification"); | |
318 | } | |
319 | } | |
320 | else{ | |
321 | HLTWarning("Histogram with same name does not have the same slice specification"); | |
322 | } | |
323 | } | |
324 | } | |
325 | ||
326 | if(fHistogramData.size()==0){ | |
327 | if(fIgnoreSpecification == kTRUE){ | |
328 | if(histName.Contains(Form("_Slice_%.2d%.2d_Partition_%.2d%.2d", minSlice, maxSlice, minPartition, maxPartition))){ | |
329 | cout << "HistogramContains the given string." << endl; | |
330 | } | |
331 | histName.ReplaceAll(Form("_Slice_%.2d%.2d_Partition_%.2d%.2d", minSlice, maxSlice, minPartition, maxPartition),""); | |
332 | } | |
333 | } | |
334 | ||
335 | if(histogramNotAdded == kTRUE){ | |
336 | tmp->SetName(histName); | |
337 | AliHLTHistogramData histogramData; | |
338 | histogramData.fHistogram = tmp; | |
339 | histogramData.fMinSlice = minSlice; | |
340 | histogramData.fMaxSlice = maxSlice; | |
341 | histogramData.fMinPartition = minPartition; | |
342 | histogramData.fMaxPartition = maxPartition; | |
343 | fHistogramData.push_back(histogramData); | |
344 | } | |
345 | } | |
346 | } // end for loop over histogram blocks | |
347 | ||
348 | MakeHistosPublic(); | |
349 | return 0; | |
350 | } // end DoEvent() | |
351 | ||
352 | void AliHLTTPCHistogramHandlerComponent::MakeHistosPublic() { | |
353 | // see header file for class documentation | |
354 | ||
355 | if(fUseGeneral == kFALSE){ | |
356 | if(fNoiseHistograms){ | |
357 | PushBack((TObject*)fHistTPCSideAmax,kAliHLTDataTypeHistogram,AliHLTTPCDefinitions::EncodeDataSpecification( 0,17,0,5)); | |
358 | PushBack((TObject*)fHistTPCSideCmax,kAliHLTDataTypeHistogram,AliHLTTPCDefinitions::EncodeDataSpecification(18,35,0,5)); | |
359 | ||
360 | PushBack((TObject*)fHistTPCSideAtot,kAliHLTDataTypeHistogram,AliHLTTPCDefinitions::EncodeDataSpecification( 0,17,0,5)); | |
361 | PushBack((TObject*)fHistTPCSideCtot,kAliHLTDataTypeHistogram,AliHLTTPCDefinitions::EncodeDataSpecification(18,35,0,5)); | |
362 | ||
363 | PushBack((TObject*)fHistTPCSideArms,kAliHLTDataTypeHistogram,AliHLTTPCDefinitions::EncodeDataSpecification( 0,17,0,5)); | |
364 | PushBack((TObject*)fHistTPCSideCrms,kAliHLTDataTypeHistogram,AliHLTTPCDefinitions::EncodeDataSpecification(18,35,0,5)); | |
365 | ||
366 | //if(fHistTH2Tmp) { delete fHistTH2Tmp; fHistTH2Tmp=NULL; } | |
367 | // if(fHistTPCSideA){ delete fHistTPCSideA; fHistTPCSideA=NULL; } | |
368 | // if(fHistTPCSideC){ delete fHistTPCSideC; fHistTPCSideC=NULL; } | |
369 | } | |
370 | ||
371 | if(fKryptonHistograms){ | |
372 | PushBack((TObject*)fTotalClusterChargeIROCAll,kAliHLTDataTypeHistogram,AliHLTTPCDefinitions::EncodeDataSpecification(0,17,0,1)); | |
373 | PushBack((TObject*)fTotalClusterChargeOROCAll,kAliHLTDataTypeHistogram,AliHLTTPCDefinitions::EncodeDataSpecification(0,17,2,5)); | |
374 | PushBack((TObject*)fQMaxPartitionAll, kAliHLTDataTypeHistogram,AliHLTTPCDefinitions::EncodeDataSpecification(0,35,0,5)); | |
375 | PushBack((TObject*)fPlotQmaxROCAll, kAliHLTDataTypeHistogram,AliHLTTPCDefinitions::EncodeDataSpecification(0,35,0,5)); | |
376 | PushBack((TObject*)fNumberOfClusters, kAliHLTDataTypeHistogram,AliHLTTPCDefinitions::EncodeDataSpecification(0,35,0,5)); | |
377 | ||
378 | if(fTotalClusterChargeIROCAll){ delete fTotalClusterChargeIROCAll; fTotalClusterChargeIROCAll=NULL; } | |
379 | if(fTotalClusterChargeOROCAll){ delete fTotalClusterChargeOROCAll; fTotalClusterChargeOROCAll=NULL; } | |
380 | if(fQMaxPartitionAll) { delete fQMaxPartitionAll; fQMaxPartitionAll=NULL; } | |
381 | if(fPlotQmaxROCAll) { delete fPlotQmaxROCAll; fPlotQmaxROCAll=NULL; } | |
382 | if(fNumberOfClusters) { delete fNumberOfClusters; fNumberOfClusters=NULL; } | |
383 | if(fHistTH1Tmp) { delete fHistTH1Tmp; fHistTH1Tmp=NULL; } | |
384 | } | |
385 | } | |
386 | else{ // means fUseGeneral == kTRUE | |
387 | for(UInt_t i=0;i<fHistogramData.size();i++){ | |
388 | PushBack((TObject*)fHistogramData.at(i).fHistogram,kAliHLTDataTypeHistogram,AliHLTTPCDefinitions::EncodeDataSpecification( | |
389 | fHistogramData.at(i).fMinSlice,fHistogramData.at(i).fMaxSlice,fHistogramData.at(i).fMinPartition,fHistogramData.at(i).fMaxPartition)); | |
390 | } | |
391 | fHistogramData.clear(); | |
392 | } | |
393 | // TObjArray histos; | |
394 | ||
395 | // if(fPlotSideA) histos.Add(fHistSideA); | |
396 | // if(fPlotSideC) histos.Add(fHistSideC); | |
397 | // if(fApplyNoiseMap) histos.Add(fHistCDBMap); | |
398 | // | |
399 | // TIter iterator(&histos); | |
400 | // while(TObject *pObj=iterator.Next()){ | |
401 | // | |
402 | // PushBack(pObj, kAliHLTDataTypeHistogram|kAliHLTDataOriginTPC, fSpecification); | |
403 | // } | |
404 | // | |
405 | // | |
406 | // //PushBack( (TObject*) &histos, kAliHLTDataTypeHistogram, fSpecification); | |
407 | } | |
408 | ||
409 | int AliHLTTPCHistogramHandlerComponent::Configure(const char* arguments) { | |
410 | // see header file for class documentation | |
411 | ||
412 | int iResult=0; | |
413 | if (!arguments) return iResult; | |
414 | HLTInfo("parsing configuration string \'%s\'", arguments); | |
415 | ||
416 | TString allArgs=arguments; | |
417 | TString argument; | |
418 | int bMissingParam=0; | |
419 | ||
420 | TObjArray* pTokens=allArgs.Tokenize(" "); | |
421 | if (pTokens) { | |
422 | for (int i=0; i<pTokens->GetEntries() && iResult>=0; i++) { | |
423 | argument=((TObjString*)pTokens->At(i))->GetString(); | |
424 | if (argument.IsNull()) continue; | |
425 | ||
426 | if (argument.CompareTo("-sum-noise-histograms")==0) { | |
427 | fNoiseHistograms = kTRUE; | |
428 | HLTInfo("got \'-sum-noise-histograms\': %s", ((TObjString*)pTokens->At(i))->GetString().Data()); | |
429 | ||
430 | } else if (argument.CompareTo("-sum-krypton-histograms")==0) { | |
431 | fKryptonHistograms = kTRUE; | |
432 | HLTInfo("got \'-sum-krypton-histograms\': %s", ((TObjString*)pTokens->At(i))->GetString().Data()); | |
433 | ||
434 | } else if (argument.CompareTo("-use-general")==0) { | |
435 | fUseGeneral = kTRUE; | |
436 | HLTInfo("got \'-use-general\': %s", ((TObjString*)pTokens->At(i))->GetString().Data()); | |
437 | ||
438 | } else if (argument.CompareTo("-ignore-specification")==0) { | |
439 | fIgnoreSpecification = kTRUE; | |
440 | HLTInfo("got \'-ignore-specification\': %s", ((TObjString*)pTokens->At(i))->GetString().Data()); | |
441 | } | |
442 | else { | |
443 | HLTError("unknown argument %s", argument.Data()); | |
444 | iResult=-EINVAL; | |
445 | break; | |
446 | } | |
447 | } // end for | |
448 | ||
449 | /*for (int i=0; i<pTokens->GetEntries() && iResult>=0; i++) { | |
450 | argument=((TObjString*)pTokens->At(i))->GetString(); | |
451 | if (argument.IsNull()) continue; | |
452 | ||
453 | if (argument.CompareTo("-sum-noise-histograms")==0) { | |
454 | if ((bMissingParam=(++i>=pTokens->GetEntries()))) break; | |
455 | HLTInfo("got \'-sum-noise-histograms\': %s", ((TObjString*)pTokens->At(i))->GetString().Data()); | |
456 | ||
457 | } else if (argument.CompareTo("-sum-krypton-histograms")==0) { | |
458 | if ((bMissingParam=(++i>=pTokens->GetEntries()))) break; | |
459 | HLTInfo("got \'-sum-krypton-histograms\': %s", ((TObjString*)pTokens->At(i))->GetString().Data()); | |
460 | ||
461 | } else if (argument.CompareTo("-use-general")==0) { | |
462 | fUseGeneral = kTRUE; | |
463 | HLTInfo("got \'-use-general\': %s", ((TObjString*)pTokens->At(i))->GetString().Data()); | |
464 | ||
465 | } else if (argument.CompareTo("-ignore-specification")==0) { | |
466 | fIgnoreSpecification = kTRUE; | |
467 | HLTInfo("got \'-ignore-specification\': %s", ((TObjString*)pTokens->At(i))->GetString().Data()); | |
468 | } | |
469 | else { | |
470 | HLTError("unknown argument %s", argument.Data()); | |
471 | iResult=-EINVAL; | |
472 | break; | |
473 | } | |
474 | } // end for*/ | |
475 | ||
476 | delete pTokens; | |
477 | ||
478 | } // end if pTokens | |
479 | ||
480 | if (bMissingParam) { | |
481 | HLTError("missing parameter for argument %s", argument.Data()); | |
482 | iResult=-EINVAL; | |
483 | } | |
484 | return iResult; | |
485 | } | |
486 | ||
487 | int AliHLTTPCHistogramHandlerComponent::Reconfigure(const char* cdbEntry, const char* chainId) { | |
488 | // see header file for class documentation | |
489 | ||
490 | int iResult=0; | |
491 | const char* path="HLT/ConfigTPC/TPCHistogramHandlerComponent"; | |
492 | const char* defaultNotify=""; | |
493 | if (cdbEntry) { | |
494 | path=cdbEntry; | |
495 | defaultNotify=" (default)"; | |
496 | } | |
497 | ||
498 | if (path) { | |
499 | HLTInfo("reconfigure from entry %s%s, chain id %s", path, defaultNotify,(chainId!=NULL && chainId[0]!=0)?chainId:"<none>"); | |
500 | AliCDBEntry *pEntry = AliCDBManager::Instance()->Get(path/*,GetRunNo()*/); | |
501 | if (pEntry) { | |
502 | TObjString* pString=dynamic_cast<TObjString*>(pEntry->GetObject()); | |
503 | if (pString) { | |
504 | HLTInfo("received configuration object string: \'%s\'", pString->GetString().Data()); | |
505 | iResult=Configure(pString->GetString().Data()); | |
506 | } else { | |
507 | HLTError("configuration object \"%s\" has wrong type, required TObjString", path); | |
508 | } | |
509 | } else { | |
510 | HLTError("cannot fetch object \"%s\" from CDB", path); | |
511 | } | |
512 | } | |
513 | return iResult; | |
514 | } |