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