]>
Commit | Line | Data |
---|---|---|
6d17f6d5 | 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 | //************************************************************************** | |
c12197a2 | 18 | |
19 | /** @file AliHLTTPCNoiseMapComponent.cxx | |
20 | @author Kalliopi Kanaki | |
21 | @date | |
22 | @brief The TPC Noise Map component | |
23 | */ | |
24 | ||
c12197a2 | 25 | #if __GNUC__>= 3 |
26 | using namespace std; | |
27 | #endif | |
21f63108 | 28 | |
c12197a2 | 29 | #include "AliHLTTPCNoiseMapComponent.h" |
30 | #include "AliHLTTPCDigitReaderDecoder.h" | |
c12197a2 | 31 | #include "AliHLTTPCTransform.h" |
32 | #include "AliHLTTPCDefinitions.h" | |
21f63108 | 33 | |
c12197a2 | 34 | #include "AliCDBEntry.h" |
35 | #include "AliCDBManager.h" | |
b1d702f1 | 36 | #include "AliCDBStorage.h" |
3a3550fa | 37 | #include "AliHLTTPCNoiseMap.h" |
21f63108 | 38 | |
deeb9f12 | 39 | #include "AliTPCCalPad.h" |
21f63108 | 40 | #include "AliTPCROC.h" |
41 | #include "AliTPCCalROC.h" | |
42 | ||
c12197a2 | 43 | #include <cstdlib> |
44 | #include <cerrno> | |
45 | #include "TString.h" | |
46 | #include "TFile.h" | |
47 | #include "TObjArray.h" | |
48 | #include "TObjString.h" | |
49 | #include <sys/time.h> | |
6d17f6d5 | 50 | #include "TH2.h" |
163d018f | 51 | #include "TH3.h" |
c12197a2 | 52 | |
c12197a2 | 53 | ClassImp(AliHLTTPCNoiseMapComponent) //ROOT macro for the implementation of ROOT specific class methods |
54 | ||
55 | AliHLTTPCNoiseMapComponent::AliHLTTPCNoiseMapComponent() | |
6d17f6d5 | 56 | : |
deeb9f12 | 57 | fSpecification(0), |
3f0fd8f1 | 58 | fReadNoiseMap(0), |
21f63108 | 59 | fResetHistograms(0), |
3f0fd8f1 | 60 | fInitHist(kTRUE), |
21f63108 | 61 | fCurrentRow(-99), |
3a3550fa | 62 | fHistSignal(NULL), |
3f0fd8f1 | 63 | fHistSideAMaxSignal(NULL), |
64 | fHistSideATotSignal(NULL), | |
65 | fHistSideAPadRMS(NULL), | |
66 | fHistSideCMaxSignal(NULL), | |
67 | fHistSideCTotSignal(NULL), | |
68 | fHistSideCPadRMS(NULL), | |
69 | fHistCDBMap(NULL) | |
c12197a2 | 70 | { |
71 | // see header file for class documentation | |
72 | // or | |
73 | // refer to README to build package | |
74 | // or | |
75 | // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt | |
76 | } | |
77 | ||
6d17f6d5 | 78 | AliHLTTPCNoiseMapComponent::~AliHLTTPCNoiseMapComponent() { |
79 | // see header file for class documentation | |
c12197a2 | 80 | |
81 | } | |
82 | ||
c12197a2 | 83 | // Public functions to implement AliHLTComponent's interface. |
84 | // These functions are required for the registration process | |
85 | ||
6d17f6d5 | 86 | const char* AliHLTTPCNoiseMapComponent::GetComponentID() { |
87 | // see header file for class documentation | |
c12197a2 | 88 | |
89 | return "TPCNoiseMap"; | |
90 | } | |
91 | ||
6d17f6d5 | 92 | void AliHLTTPCNoiseMapComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list) { |
93 | // see header file for class documentation | |
c12197a2 | 94 | |
95 | list.clear(); | |
96 | list.push_back( kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC ); | |
97 | } | |
98 | ||
6d17f6d5 | 99 | AliHLTComponentDataType AliHLTTPCNoiseMapComponent::GetOutputDataType() { |
100 | // see header file for class documentation | |
c12197a2 | 101 | |
deeb9f12 | 102 | return kAliHLTDataTypeHistogram; |
c12197a2 | 103 | } |
104 | ||
6d17f6d5 | 105 | int AliHLTTPCNoiseMapComponent::GetOutputDataTypes(AliHLTComponentDataTypeList& tgtList) { |
106 | // see header file for class documentation | |
c12197a2 | 107 | |
108 | tgtList.clear(); | |
deeb9f12 | 109 | tgtList.push_back(kAliHLTDataTypeHistogram); |
c12197a2 | 110 | return tgtList.size(); |
111 | } | |
112 | ||
6d17f6d5 | 113 | void AliHLTTPCNoiseMapComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier ) { |
114 | // see header file for class documentation | |
c12197a2 | 115 | |
0e588049 | 116 | constBase=800000; |
117 | inputMultiplier=0.0; | |
c12197a2 | 118 | } |
119 | ||
6d17f6d5 | 120 | AliHLTComponent* AliHLTTPCNoiseMapComponent::Spawn() { |
121 | // see header file for class documentation | |
c12197a2 | 122 | |
123 | return new AliHLTTPCNoiseMapComponent(); | |
124 | } | |
125 | ||
6d17f6d5 | 126 | int AliHLTTPCNoiseMapComponent::DoInit( int argc, const char** argv ) { |
127 | // see header file for class documentation | |
21f63108 | 128 | |
3f0fd8f1 | 129 | //Int_t i = 0; |
130 | //Char_t* cpErr; | |
c12197a2 | 131 | |
132 | int iResult=0; | |
133 | ||
134 | TString configuration=""; | |
135 | TString argument=""; | |
0e588049 | 136 | for (int j=0; j<argc && iResult>=0; j++) { |
c12197a2 | 137 | |
0e588049 | 138 | argument=argv[j]; |
c12197a2 | 139 | if (!configuration.IsNull()) configuration+=" "; |
21f63108 | 140 | configuration+=argument; |
c12197a2 | 141 | } |
142 | ||
143 | if (!configuration.IsNull()) { | |
144 | iResult=Configure(configuration.Data()); | |
145 | } else { | |
3f0fd8f1 | 146 | // iResult=Reconfigure(NULL, NULL); |
c12197a2 | 147 | } |
148 | ||
149 | ||
3f0fd8f1 | 150 | // while ( i < argc ) { |
151 | // if (!strcmp( argv[i], "-read-noisemap")) { | |
152 | // fApplyNoiseMap = strtoul( argv[i+1], &cpErr ,0); | |
153 | // | |
154 | // if ( *cpErr ) { | |
155 | // HLTError("Cannot convert apply-noisemap specifier '%s'.", argv[i+1]); | |
156 | // return EINVAL; | |
157 | // } | |
158 | // i+=2; | |
159 | // continue; | |
160 | // } | |
161 | // | |
162 | // if (!strcmp( argv[i], "-reset-histograms")) { | |
163 | // fResetHistograms = strtoul( argv[i+1], &cpErr ,0); | |
164 | // | |
165 | // if ( *cpErr ) { | |
166 | // HLTError("Cannot convert reset-histograms specifier '%s'.", argv[i+1]); | |
167 | // return EINVAL; | |
168 | // } | |
169 | // i+=2; | |
170 | // continue; | |
171 | // } | |
172 | // | |
173 | // Logging(kHLTLogError, "HLT::TPCNoiseMap::DoInit", "Unknown Option", "Unknown option '%s'", argv[i] ); | |
174 | // return EINVAL; | |
175 | // | |
176 | // } // end while | |
c12197a2 | 177 | |
3f0fd8f1 | 178 | if(fReadNoiseMap){ |
3a3550fa | 179 | AliHLTTPCNoiseMap *nm = AliHLTTPCNoiseMap::Instance(); |
b1d702f1 | 180 | if(!nm) { |
181 | HLTWarning("AliHLTTPCNoiseMap instance not existent."); | |
182 | } | |
183 | else { | |
184 | AliTPCCalPad *noisePad = nm->ReadNoiseMap(GetRunNo()); | |
185 | if(noisePad) { | |
186 | fHistCDBMap = noisePad->MakeHisto2D(1); | |
187 | ||
188 | } | |
189 | } | |
3a3550fa | 190 | } |
c12197a2 | 191 | |
21f63108 | 192 | // if(fApplyNoiseMap){ |
193 | // //TFile *f = TFile::Open("/scratch/noiseComp/Run3398_4000_v0_s72.root"); | |
194 | // TFile *f = TFile::Open("/home/kanaki/noiseComp/Run3398_4000_v0_s72.root"); | |
195 | // AliCDBEntry *pEntry = (AliCDBEntry*)f->Get("AliCDBEntry"); | |
196 | // noisePad = (AliTPCCalPad*)pEntry->GetObject(); | |
197 | // //fHistCDBMap = noisePad->MakeHisto2D(1); //side C | |
198 | // } | |
199 | ||
21f63108 | 200 | // HLTDebug("using AliHLTTPCDigitReaderDecoder"); |
201 | // pDigitReader = new AliHLTTPCDigitReaderDecoder(); // double-loop | |
202 | // pDigitReader = new AliHLTTPCDigitReaderPacked(); | |
203 | ||
c12197a2 | 204 | return 0; |
21f63108 | 205 | |
c12197a2 | 206 | } // end DoInit() |
207 | ||
6d17f6d5 | 208 | int AliHLTTPCNoiseMapComponent::DoDeinit() { |
a912b63b | 209 | // see header file for class documentation |
b1d702f1 | 210 | |
3f0fd8f1 | 211 | if(fHistSideAMaxSignal) delete fHistSideAMaxSignal; fHistSideAMaxSignal = NULL; |
212 | if(fHistSideATotSignal) delete fHistSideATotSignal; fHistSideATotSignal = NULL; | |
213 | if(fHistSideAPadRMS) delete fHistSideAPadRMS; fHistSideAPadRMS = NULL; | |
214 | ||
215 | if(fHistSideCMaxSignal) delete fHistSideCMaxSignal; fHistSideCMaxSignal = NULL; | |
216 | if(fHistSideCTotSignal) delete fHistSideCTotSignal; fHistSideCTotSignal = NULL; | |
217 | if(fHistSideCPadRMS) delete fHistSideCPadRMS; fHistSideCPadRMS = NULL; | |
218 | ||
b1d702f1 | 219 | return 0; |
c12197a2 | 220 | } |
221 | ||
3f0fd8f1 | 222 | void AliHLTTPCNoiseMapComponent::InitializeHistograms(UInt_t minSlice, UInt_t maxSlice, UInt_t minPartition, UInt_t maxPartition){ |
223 | // see header file for class documentation | |
224 | ||
225 | Char_t name1[50], name2[50], name3[50]; | |
226 | ||
227 | if(minSlice<18){ | |
228 | sprintf(name1, "fHistSideAMaxSignal_Slice_%.2d%.2d_Partition_%.2d%.2d", minSlice, maxSlice, minPartition, maxPartition); | |
229 | sprintf(name2, "fHistSideATotSignal_Slice_%.2d%.2d_Partition_%.2d%.2d", minSlice, maxSlice, minPartition, maxPartition); | |
230 | sprintf(name3, "fHistSideAPadRMS_Slice_%.2d%.2d_Partition_%.2d%.2d", minSlice, maxSlice, minPartition, maxPartition); | |
231 | fHistSideAMaxSignal = new TH2F(name1,name1,250,-250,250,250,-250,250); | |
232 | fHistSideATotSignal = new TH2F(name2,name2,250,-250,250,250,-250,250); | |
233 | fHistSideAPadRMS = new TH2F(name3,name3,250,-250,250,250,-250,250); | |
b69ccd54 | 234 | fHistSideAMaxSignal->SetXTitle("x [cm]"); |
235 | fHistSideATotSignal->SetXTitle("x [cm]"); | |
236 | fHistSideAPadRMS->SetXTitle("x [cm]"); | |
237 | fHistSideAMaxSignal->SetYTitle("y [cm]"); | |
238 | fHistSideATotSignal->SetYTitle("y [cm]"); | |
239 | fHistSideAPadRMS->SetYTitle("y [cm]"); | |
3f0fd8f1 | 240 | |
241 | } else { | |
242 | sprintf(name1, "fHistSideCMaxSignal_Slice_%.2d%.2d_Partition_%.2d%.2d", minSlice, maxSlice, minPartition, maxPartition); | |
243 | sprintf(name2, "fHistSideCTotSignal_Slice_%.2d%.2d_Partition_%.2d%.2d", minSlice, maxSlice, minPartition, maxPartition); | |
244 | sprintf(name3, "fHistSideCPadRMS_Slice_%.2d%.2d_Partition_%.2d%.2d", minSlice, maxSlice, minPartition, maxPartition); | |
245 | fHistSideCMaxSignal = new TH2F(name1,name1,250,-250,250,250,-250,250); | |
246 | fHistSideCTotSignal = new TH2F(name2,name2,250,-250,250,250,-250,250); | |
247 | fHistSideCPadRMS = new TH2F(name3,name3,250,-250,250,250,-250,250); | |
b69ccd54 | 248 | fHistSideCMaxSignal->SetXTitle("x [cm]"); |
249 | fHistSideCTotSignal->SetXTitle("x [cm]"); | |
250 | fHistSideCPadRMS->SetXTitle("x [cm]"); | |
251 | fHistSideCMaxSignal->SetYTitle("y [cm]"); | |
252 | fHistSideCTotSignal->SetYTitle("y [cm]"); | |
253 | fHistSideCPadRMS->SetYTitle("y [cm]"); | |
254 | } | |
3f0fd8f1 | 255 | |
256 | fInitHist=kFALSE; | |
257 | ||
258 | } | |
259 | ||
bb7774d6 | 260 | int AliHLTTPCNoiseMapComponent::DoEvent(const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& /*trigData*/){ |
a912b63b | 261 | // see header file for class documentation |
c12197a2 | 262 | |
21f63108 | 263 | |
deeb9f12 | 264 | if(GetFirstInputBlock( kAliHLTDataTypeSOR ) || GetFirstInputBlock( kAliHLTDataTypeEOR )) return 0; |
3f0fd8f1 | 265 | //HLTInfo("--- Entering DoEvent() in TPCNoiseMap ---"); |
b1d702f1 | 266 | |
21f63108 | 267 | const AliHLTComponentBlockData *iter = NULL; |
268 | ||
c12197a2 | 269 | Float_t xyz[3]; |
270 | Int_t thissector, thisrow; | |
163d018f | 271 | |
b69ccd54 | 272 | /*if(fInitHist==kFALSE) { |
273 | fHistSideAMaxSignal->Reset(); | |
274 | fHistSideCMaxSignal->Reset(); | |
275 | }*/ | |
276 | ||
277 | ||
21f63108 | 278 | for(iter = GetFirstInputBlock(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginTPC); iter != NULL; iter = GetNextInputBlock()){ |
279 | ||
3f0fd8f1 | 280 | // HLTInfo("Event 0x%08LX (%Lu) received datatype: %s - required datatype: %s", |
281 | // evtData.fEventID, evtData.fEventID, | |
282 | // DataType2Text(iter->fDataType).c_str(), | |
283 | // DataType2Text(kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC).c_str()); | |
284 | // | |
285 | // if (iter->fDataType == AliHLTTPCDefinitions::fgkDDLPackedRawDataType && GetEventCount()<2){ | |
286 | // HLTWarning("data type %s is depricated, use %s (kAliHLTDataTypeDDLRaw)!", | |
287 | // DataType2Text(AliHLTTPCDefinitions::fgkDDLPackedRawDataType).c_str(), | |
288 | // DataType2Text(kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC).c_str()); | |
289 | // } | |
deeb9f12 | 290 | |
a912b63b | 291 | if (iter->fDataType != (kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC)) continue; |
c12197a2 | 292 | |
3f0fd8f1 | 293 | UInt_t minSlice = AliHLTTPCDefinitions::GetMinSliceNr(*iter); |
294 | UInt_t minPartition = AliHLTTPCDefinitions::GetMinPatchNr(*iter); | |
295 | UInt_t maxSlice = AliHLTTPCDefinitions::GetMaxSliceNr(*iter); | |
296 | UInt_t maxPartition = AliHLTTPCDefinitions::GetMaxPatchNr(*iter); | |
297 | ||
298 | if(fInitHist==kTRUE) InitializeHistograms(minSlice, maxSlice, minPartition, maxPartition); | |
a912b63b | 299 | fSpecification = iter->fSpecification; |
deeb9f12 | 300 | |
a912b63b | 301 | AliHLTTPCDigitReader *pDigitReader = new AliHLTTPCDigitReaderDecoder; |
deeb9f12 | 302 | |
3f0fd8f1 | 303 | pDigitReader->InitBlock(iter->fPtr,iter->fSize,minPartition,minSlice); |
a912b63b | 304 | if(!pDigitReader) break; |
3f0fd8f1 | 305 | |
a912b63b | 306 | // while(pDigitReader->Next()){ |
307 | ||
a912b63b | 308 | Float_t maxSignal = 0.; |
309 | Float_t totalSignal = 0.; | |
310 | Float_t squaredSignal = 0.; | |
311 | Float_t rms = 0.; | |
312 | ||
3f0fd8f1 | 313 | while(pDigitReader->NextChannel()) { // pad loop |
c12197a2 | 314 | |
deeb9f12 | 315 | fCurrentRow = pDigitReader->GetRow(); |
b69ccd54 | 316 | fCurrentRow += pDigitReader->GetRowOffset(); |
6d17f6d5 | 317 | |
3f0fd8f1 | 318 | AliHLTTPCTransform::Slice2Sector(minSlice,fCurrentRow,thissector,thisrow); |
3a3550fa | 319 | AliHLTTPCTransform::Raw2Local(xyz,thissector,thisrow,pDigitReader->GetPad(),0); |
3f0fd8f1 | 320 | |
321 | if(minSlice>17) xyz[1] = (-1.0)*xyz[1]; | |
3a3550fa | 322 | |
3f0fd8f1 | 323 | AliHLTTPCTransform::Local2Global(xyz,minSlice); |
3a3550fa | 324 | // temporarily the transformation Raw2Global will be broken down to 2 steps, |
325 | // as there is a correction necessary at the y coordinate of the local xyz. | |
326 | ||
21f63108 | 327 | //AliHLTTPCTransform::Raw2Global(xyz,thissector,thisrow,pDigitReader->GetPad(),0); |
3a3550fa | 328 | // transformation from pad-row coordinates to global ones |
329 | // time info is not taken into account | |
21f63108 | 330 | |
a912b63b | 331 | // AliTPCCalROC *calRoc = noisePad->GetCalROC(thissector); |
332 | // calRoc->GetValue(thisrow,pDigitReader->GetPad()); | |
333 | ||
3f0fd8f1 | 334 | while(pDigitReader->NextBunch()) { |
deeb9f12 | 335 | |
a912b63b | 336 | const UInt_t *bunchData = pDigitReader->GetSignals(); |
3f0fd8f1 | 337 | //Int_t time = pDigitReader->GetTime(); |
163d018f | 338 | |
a912b63b | 339 | for(Int_t i=0;i<pDigitReader->GetBunchSize();i++){ |
deeb9f12 | 340 | |
3a3550fa | 341 | if((Float_t)(bunchData[i])>maxSignal){ maxSignal = (Float_t)(bunchData[i]); } |
3f0fd8f1 | 342 | totalSignal += (Float_t)bunchData[i]; |
163d018f | 343 | squaredSignal += (Float_t)bunchData[i]*(Float_t)bunchData[i]; |
344 | //fHistSignal->Fill(time+i, bunchData[i]); | |
3f0fd8f1 | 345 | } // end for loop |
346 | ||
a912b63b | 347 | rms = TMath::Sqrt(squaredSignal/pDigitReader->GetBunchSize()); |
163d018f | 348 | |
3f0fd8f1 | 349 | } // end of inner while loop |
163d018f | 350 | |
a912b63b | 351 | |
3f0fd8f1 | 352 | if(minSlice<18){ |
b69ccd54 | 353 | if(maxSignal>0) fHistSideAMaxSignal->Fill(xyz[0],xyz[1],maxSignal); |
354 | if(totalSignal>0) fHistSideATotSignal->Fill(xyz[0],xyz[1],totalSignal); | |
355 | if(rms>0) fHistSideAPadRMS->Fill(xyz[0],xyz[1],rms); | |
3f0fd8f1 | 356 | } else if(minSlice>17){ |
b69ccd54 | 357 | if(maxSignal>0) fHistSideCMaxSignal->Fill(xyz[0],xyz[1],maxSignal); |
358 | if(totalSignal>0) fHistSideCTotSignal->Fill(xyz[0],xyz[1],totalSignal); | |
359 | if(rms>0) fHistSideCPadRMS->Fill(xyz[0],xyz[1],rms); | |
3f0fd8f1 | 360 | } else continue; |
a912b63b | 361 | |
3f0fd8f1 | 362 | maxSignal = 0.; |
363 | totalSignal = 0.; | |
364 | squaredSignal = 0.; | |
365 | rms = 0.; | |
366 | } // end of while loop over pads | |
a912b63b | 367 | |
a912b63b | 368 | pDigitReader->Reset(); |
369 | delete pDigitReader; | |
deeb9f12 | 370 | } // end of for loop over data blocks |
b69ccd54 | 371 | |
372 | //HLTImportant("fHistSideAMaxSignal entries at the end of event: %d", fHistSideAMaxSignal->GetEntries()); | |
373 | ||
3f0fd8f1 | 374 | if(fResetHistograms) ResetHistograms(); fResetHistograms = kFALSE; |
deeb9f12 | 375 | MakeHistosPublic(); |
3f0fd8f1 | 376 | |
deeb9f12 | 377 | return 0; |
c12197a2 | 378 | } // end DoEvent() |
379 | ||
3a3550fa | 380 | |
deeb9f12 | 381 | void AliHLTTPCNoiseMapComponent::MakeHistosPublic() { |
6d17f6d5 | 382 | // see header file for class documentation |
b1d702f1 | 383 | |
deeb9f12 | 384 | // TFile *outputfile = new TFile("test.root","RECREATE"); |
55f2c86a | 385 | // fHistSignal->Write(); |
deeb9f12 | 386 | // outputfile->Save(); |
387 | // outputfile->Close(); | |
3a3550fa | 388 | |
deeb9f12 | 389 | TObjArray histos; |
3f0fd8f1 | 390 | histos.Add(fHistSideAMaxSignal); |
391 | histos.Add(fHistSideATotSignal); | |
392 | histos.Add(fHistSideAPadRMS); | |
393 | ||
394 | histos.Add(fHistSideCMaxSignal); | |
395 | histos.Add(fHistSideCTotSignal); | |
396 | histos.Add(fHistSideCPadRMS); | |
397 | ||
3a3550fa | 398 | histos.Add(fHistCDBMap); |
163d018f | 399 | //histos.Add(fHistSignal); |
21f63108 | 400 | |
401 | TIter iterator(&histos); | |
3a3550fa | 402 | while(TObject *pObj=iterator.Next()){ PushBack(pObj, kAliHLTDataTypeHistogram|kAliHLTDataOriginTPC, fSpecification); } |
21f63108 | 403 | |
404 | //PushBack( (TObject*) &histos, kAliHLTDataTypeHistogram, fSpecification); | |
c12197a2 | 405 | } |
406 | ||
21f63108 | 407 | void AliHLTTPCNoiseMapComponent::ResetHistograms(){ |
408 | // see header file for class documentation | |
409 | ||
3f0fd8f1 | 410 | if(fHistSideAMaxSignal) fHistSideAMaxSignal->Reset(); |
411 | if(fHistSideATotSignal) fHistSideATotSignal->Reset(); | |
412 | if(fHistSideAPadRMS) fHistSideAPadRMS->Reset(); | |
413 | ||
414 | if(fHistSideCMaxSignal) fHistSideCMaxSignal->Reset(); | |
415 | if(fHistSideCTotSignal) fHistSideCTotSignal->Reset(); | |
416 | if(fHistSideCPadRMS) fHistSideCPadRMS->Reset(); | |
21f63108 | 417 | } |
418 | ||
6d17f6d5 | 419 | int AliHLTTPCNoiseMapComponent::Configure(const char* arguments) { |
420 | // see header file for class documentation | |
c12197a2 | 421 | |
422 | int iResult=0; | |
423 | if (!arguments) return iResult; | |
424 | HLTInfo("parsing configuration string \'%s\'", arguments); | |
425 | ||
426 | TString allArgs=arguments; | |
427 | TString argument; | |
428 | int bMissingParam=0; | |
429 | ||
430 | TObjArray* pTokens=allArgs.Tokenize(" "); | |
431 | if (pTokens) { | |
432 | for (int i=0; i<pTokens->GetEntries() && iResult>=0; i++) { | |
433 | argument=((TObjString*)pTokens->At(i))->GetString(); | |
434 | if (argument.IsNull()) continue; | |
435 | ||
3f0fd8f1 | 436 | if (argument.CompareTo("-read-noisemap")==0) { |
437 | //if ((bMissingParam=(++i>=pTokens->GetEntries()))) break; | |
438 | fReadNoiseMap = kTRUE; | |
439 | HLTInfo("got \'-read-noisemap\': %s", ((TObjString*)pTokens->At(i))->GetString().Data()); | |
deeb9f12 | 440 | |
441 | } | |
3a3550fa | 442 | else if(argument.CompareTo("-reset-histograms")==0){ |
3f0fd8f1 | 443 | //if ((bMissingParam=(++i>=pTokens->GetEntries()))) break; |
444 | fResetHistograms = kTRUE; | |
445 | HLTInfo("got \'-reset-histograms\': %s", ((TObjString*)pTokens->At(i))->GetString().Data()); | |
c12197a2 | 446 | } |
447 | else { | |
448 | HLTError("unknown argument %s", argument.Data()); | |
449 | iResult=-EINVAL; | |
450 | break; | |
451 | } | |
deeb9f12 | 452 | } // end for |
453 | ||
c12197a2 | 454 | delete pTokens; |
deeb9f12 | 455 | |
456 | } // end if pTokens | |
457 | ||
c12197a2 | 458 | if (bMissingParam) { |
459 | HLTError("missing parameter for argument %s", argument.Data()); | |
460 | iResult=-EINVAL; | |
461 | } | |
21f63108 | 462 | return iResult; |
c12197a2 | 463 | } |
464 | ||
6d17f6d5 | 465 | int AliHLTTPCNoiseMapComponent::Reconfigure(const char* cdbEntry, const char* chainId) { |
466 | // see header file for class documentation | |
3f0fd8f1 | 467 | |
468 | int iResult = 0; | |
469 | const char* path = "HLT/ConfigTPC/TPCNoiseMapComponent"; | |
470 | const char* defaultNotify = ""; | |
b1d702f1 | 471 | if(cdbEntry){ |
472 | path = cdbEntry; | |
473 | defaultNotify = "(manual operator entry)"; | |
c12197a2 | 474 | } |
deeb9f12 | 475 | |
b1d702f1 | 476 | if(path){ |
477 | HLTInfo("reconfigure from entry %s%s, chain id %s", path, defaultNotify,(chainId!=NULL && chainId[0]!=0)?chainId:"<none>" ); | |
478 | ||
479 | AliCDBPath argumentPath(path); | |
480 | AliCDBStorage *stor = AliCDBManager::Instance()->GetDefaultStorage(); | |
481 | ||
482 | if(stor){ | |
483 | Int_t version = stor->GetLatestVersion(path, GetRunNo()); | |
484 | Int_t subVersion = stor->GetLatestSubVersion(path, GetRunNo(), version); | |
485 | AliCDBEntry *pEntry = stor->Get(argumentPath,GetRunNo(), version, subVersion); | |
486 | ||
487 | if(pEntry){ | |
488 | TObjString* pString = dynamic_cast<TObjString*>(pEntry->GetObject()); | |
489 | if(pString){ | |
490 | HLTInfo("received configuration object string: \'%s\'", pString->GetString().Data()); | |
491 | iResult = Configure(pString->GetString().Data()); | |
492 | } // if pString is valid | |
493 | else { | |
494 | HLTError("configuration object \"%s\" has wrong type, required TObjString", path); | |
495 | } | |
496 | } // if pEntry is valid | |
497 | else { | |
498 | HLTError("cannot fetch object \"%s\" from CDB", path); | |
499 | } | |
3f0fd8f1 | 500 | } // end if stor is valid |
501 | } // end if path is valid | |
c12197a2 | 502 | |
503 | return iResult; | |
b1d702f1 | 504 | |
505 | ||
c12197a2 | 506 | } |