]>
Commit | Line | Data |
---|---|---|
cbab66dd | 1 | /************************************************************************** |
99388135 | 2 | * This file is property of and copyright by the Experimental Nuclear * |
3 | * Physics Group, Dep. of Physics * | |
4 | * University of Oslo, Norway, 2007 * | |
5 | * * | |
6 | * Author: Per Thomas Hille <perthi@fys.uio.no> for the ALICE HLT Project.* | |
cbab66dd | 7 | * Contributors are mentioned in the code where appropriate. * |
99388135 | 8 | * Please report bugs to perthi@fys.uio.no * |
cbab66dd | 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 | ||
2b7cf4fb | 19 | #include "AliHLTPHOSRawAnalyzer.h" |
cbab66dd | 20 | #include "AliHLTPHOSRawAnalyzerComponent.h" |
bde48b84 | 21 | #include "AliHLTPHOSRcuCellEnergyDataStruct.h" |
e086ee30 | 22 | #include "AliHLTPHOSMapper.h" |
dbd79fad | 23 | #include "AliHLTPHOSSanityInspector.h" |
24 | #include "AliHLTPHOSBaseline.h" | |
25b7f84c | 25 | #include "AliHLTPHOSDigitContainerDataStruct.h" |
26 | #include "AliHLTPHOSDigitMaker.h" | |
dbd79fad | 27 | #include "TFile.h" |
28 | #include "TTree.h" | |
29 | #include "TClonesArray.h" | |
25b7f84c | 30 | #include "TH2F.h" |
939c67e7 | 31 | #include "AliAltroDecoder.h" // decoder for altro payload |
32 | #include "AliAltroData.h" // container for altro payload | |
33 | #include "AliAltroBunch.h" // container for altro bunches | |
34 | ||
35 | ||
36 | AliHLTPHOSRawAnalyzerComponent::AliHLTPHOSRawAnalyzerComponent():AliHLTPHOSRcuProcessor(), | |
8efbf5fe | 37 | fAnalyzerPtr(0), |
38 | fSendChannelData(kFALSE), | |
39 | fOutPtr(0), | |
40 | fMapperPtr(0), | |
41 | fSanityInspectorPtr(0), | |
42 | fUseBaselineSubtraction(false), | |
43 | fDecoderPtr(0), | |
44 | fAltroDataPtr(0), | |
45 | fAltroBunchPtr(0), | |
46 | fDoPushCellEnergies(true), | |
47 | fDoMakeDigits(false), | |
48 | fDigitMakerPtr(0), | |
49 | fDigitContainerPtr(0), | |
50 | fDoSelectiveReadOut(false), | |
51 | fSelectedChannelsList(0), | |
04751caa | 52 | fDoCheckDataSize(false), |
53 | fNCorruptedBlocks(0), | |
54 | fNOKBlocks(0) | |
8efbf5fe | 55 | //fRawMemoryReader(0), fPHOSRawStream(0) |
cbab66dd | 56 | { |
ab38011b | 57 | //comment |
8efbf5fe | 58 | // fMapperPtr = new AliHLTPHOSMapper(); |
939c67e7 | 59 | fAltroDataPtr = new AliAltroData(); |
60 | fAltroBunchPtr = new AliAltroBunch(); | |
61 | fDecoderPtr = new AliAltroDecoder(); | |
62 | fSanityInspectorPtr = new AliHLTPHOSSanityInspector(); | |
25b7f84c | 63 | fSelectedChannelsList = new AliHLTUInt16_t[N_XCOLUMNS_RCU*N_ZROWS_RCU*N_GAINS]; |
939c67e7 | 64 | } |
cbab66dd | 65 | AliHLTPHOSRawAnalyzerComponent::~AliHLTPHOSRawAnalyzerComponent() |
66 | { | |
04751caa | 67 | |
ab38011b | 68 | //comment |
d949e02e | 69 | if(fMapperPtr) |
70 | { | |
71 | delete fMapperPtr; | |
72 | fMapperPtr = 0; | |
73 | } | |
74 | if(fAltroDataPtr) | |
75 | { | |
76 | delete fAltroDataPtr; | |
77 | fAltroDataPtr = 0; | |
78 | } | |
79 | if(fAltroBunchPtr) | |
80 | { | |
81 | delete fAltroBunchPtr; | |
82 | fAltroBunchPtr = 0; | |
83 | } | |
84 | if(fDecoderPtr) | |
85 | { | |
86 | delete fDecoderPtr; | |
87 | fDecoderPtr = 0; | |
88 | } | |
cbab66dd | 89 | } |
90 | ||
2ef3c547 | 91 | |
8efbf5fe | 92 | |
cbab66dd | 93 | int |
d2a0b488 | 94 | AliHLTPHOSRawAnalyzerComponent::Deinit() |
cbab66dd | 95 | { |
ab38011b | 96 | //comment |
d949e02e | 97 | if(fMapperPtr) |
98 | { | |
99 | delete fMapperPtr; | |
100 | fMapperPtr = 0; | |
101 | } | |
102 | if(fAltroDataPtr) | |
103 | { | |
104 | delete fAltroDataPtr; | |
105 | fAltroDataPtr = 0; | |
106 | } | |
107 | if(fAltroBunchPtr) | |
108 | { | |
109 | delete fAltroBunchPtr; | |
110 | fAltroBunchPtr = 0; | |
111 | } | |
112 | if(fDecoderPtr) | |
113 | { | |
114 | delete fDecoderPtr; | |
115 | fDecoderPtr = 0; | |
116 | } | |
d2a0b488 | 117 | Logging(kHLTLogInfo, "HLT", "PHOS", ",AliHLTPHOSRawAnalyzerComponen Deinit"); |
d2a0b488 | 118 | return 0; |
cbab66dd | 119 | } |
120 | ||
2ef3c547 | 121 | |
8efbf5fe | 122 | |
9dfd64cf | 123 | const char* |
124 | AliHLTPHOSRawAnalyzerComponent::GetComponentID() | |
125 | { | |
ab38011b | 126 | //comment |
9dfd64cf | 127 | return "AliPhosTestRaw"; |
128 | } | |
ee7849e6 | 129 | |
cbab66dd | 130 | void |
ee7849e6 | 131 | AliHLTPHOSRawAnalyzerComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list) |
cbab66dd | 132 | { |
ab38011b | 133 | //comment |
146c463a | 134 | const AliHLTComponentDataType* pType=fgkInputDataTypes; |
ee7849e6 | 135 | while (pType->fID!=0) { |
136 | list.push_back(*pType); | |
137 | pType++; | |
138 | } | |
cbab66dd | 139 | } |
140 | ||
141 | AliHLTComponentDataType | |
142 | AliHLTPHOSRawAnalyzerComponent::GetOutputDataType() | |
143 | { | |
ab38011b | 144 | //comment |
25b7f84c | 145 | return kAliHLTMultipleDataType; |
146 | // return AliHLTPHOSDefinitions::fgkDigitDataType; | |
cbab66dd | 147 | } |
148 | ||
25b7f84c | 149 | int |
150 | AliHLTPHOSRawAnalyzerComponent::GetOutputDataTypes(AliHLTComponentDataTypeList& tgtList) | |
151 | { | |
152 | // Added by OD | |
153 | // see header file for class documentation | |
154 | tgtList.clear(); | |
155 | tgtList.push_back(AliHLTPHOSDefinitions::fgkCellEnergyDataType); | |
156 | tgtList.push_back(AliHLTPHOSDefinitions::fgkDigitDataType); | |
157 | tgtList.push_back(kAliHLTDataTypeHwAddr16); | |
158 | return tgtList.size(); | |
159 | } | |
d504c864 | 160 | |
cbab66dd | 161 | void |
9dfd64cf | 162 | AliHLTPHOSRawAnalyzerComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier ) |
cbab66dd | 163 | { |
ab38011b | 164 | //comment |
ef408bb3 | 165 | constBase = 30; |
dbd79fad | 166 | inputMultiplier = 1.2; |
cbab66dd | 167 | } |
168 | ||
2ef3c547 | 169 | |
939c67e7 | 170 | |
d504c864 | 171 | int |
1804b020 | 172 | AliHLTPHOSRawAnalyzerComponent::DoEvent( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks, AliHLTComponentTriggerData& /*trigData*/, |
dbd79fad | 173 | AliHLTUInt8_t* outputPtr, AliHLTUInt32_t& size, vector<AliHLTComponentBlockData>& outputBlocks ) |
cbab66dd | 174 | { |
ab38011b | 175 | //comment |
04751caa | 176 | |
14ff16ed | 177 | UInt_t offset = 0; |
178 | UInt_t mysize = 0; | |
179 | UInt_t tSize = 0; | |
180 | Float_t baseline = 0; | |
25b7f84c | 181 | UInt_t digitCount = 0; |
53740333 | 182 | AliHLTUInt8_t* outBPtr; |
53740333 | 183 | outBPtr = outputPtr; |
0a211711 | 184 | const AliHLTComponentBlockData* iter = NULL; |
185 | unsigned long ndx; | |
14ff16ed | 186 | Int_t *rawDataBufferPos = (Int_t *)outputPtr; |
d949e02e | 187 | AliHLTPHOSValidCellDataStruct *validCellPtr = 0; |
b444d727 | 188 | Int_t nSamples = 0; |
25b7f84c | 189 | UInt_t nSelected = 0; |
d949e02e | 190 | UInt_t specification = 0; |
04751caa | 191 | |
192 | ||
dbd79fad | 193 | for( ndx = 0; ndx < evtData.fBlockCnt; ndx++ ) |
194 | { | |
939c67e7 | 195 | Int_t tmpChannelCnt = 0; |
0a211711 | 196 | iter = blocks+ndx; |
53740333 | 197 | mysize = 0; |
198 | offset = tSize; | |
dbd79fad | 199 | Int_t crazyness = 0; |
14ff16ed | 200 | mysize += sizeof(AliHLTPHOSRcuCellEnergyDataStruct); |
d949e02e | 201 | |
d504c864 | 202 | if ( iter->fDataType != AliHLTPHOSDefinitions::fgkDDLPackedRawDataType ) |
0a211711 | 203 | { |
dbd79fad | 204 | continue; |
dbd79fad | 205 | } |
04751caa | 206 | specification = specification|iter->fSpecification; |
207 | ||
208 | fDecoderPtr->SetMemory(reinterpret_cast<UChar_t*>( iter->fPtr ), iter->fSize); | |
209 | // fDecoderPtr->SetMemory(reinterpret_cast<char*>( iter->fPtr ), iter->fSize); | |
d949e02e | 210 | |
e086ee30 | 211 | fDecoderPtr->Decode(); |
e086ee30 | 212 | fOutPtr = (AliHLTPHOSRcuCellEnergyDataStruct*)outBPtr; |
0d7c9b63 | 213 | fOutPtr->fRcuX = fRcuX; |
214 | fOutPtr->fRcuZ = fRcuZ; | |
d2b84453 | 215 | fOutPtr->fModuleID =fModuleID; |
d949e02e | 216 | Reset(fOutPtr); |
14ff16ed | 217 | rawDataBufferPos += (mysize)/sizeof(Int_t); |
04751caa | 218 | |
e086ee30 | 219 | while( fDecoderPtr->NextChannel(fAltroDataPtr) == true ) |
220 | { | |
d949e02e | 221 | nSamples = fAltroDataPtr->GetDataSize() - 2; |
04751caa | 222 | |
25b7f84c | 223 | if(fDoCheckDataSize) |
2374af72 | 224 | { |
25b7f84c | 225 | if(nSamples != fNTotalSamples) |
226 | { | |
04751caa | 227 | cout <<"processing event " << fPhosEventCount << endl;; |
228 | cout << "Wrong number of samples Expected "<< fNTotalSamples << " samples (assuming non zero supressed data) but recieved " << nSamples << endl; | |
8efbf5fe | 229 | Logging( kHLTLogError, __FILE__ , "Wrong number of samples", "Expected %lu samples (assuming non zero supressed data) but recieved %lu", fNTotalSamples, nSamples); |
04751caa | 230 | fNCorruptedBlocks ++; |
231 | continue; | |
25b7f84c | 232 | } |
2374af72 | 233 | } |
14ff16ed | 234 | |
04751caa | 235 | fNOKBlocks ++; |
236 | ||
237 | if((fPhosEventCount%10 ==0) && fPhosEventCount !=0) | |
238 | { | |
47f7b25e | 239 | // float percent = ((float)(100*fNCorruptedBlocks))/((float)(fNOKBlocks + fNCorruptedBlocks) ); |
04751caa | 240 | } |
241 | ||
242 | crazyness = fSanityInspectorPtr->CheckInsanity((const UInt_t*)fAltroDataPtr->GetData(), (const Int_t)(fAltroDataPtr->GetDataSize() - 2)); | |
243 | ||
244 | fAnalyzerPtr->SetData(fAltroDataPtr->GetData(), fAltroDataPtr->GetDataSize() -2); | |
245 | ||
246 | fAnalyzerPtr->Evaluate(0, fAltroDataPtr->GetDataSize() -2); | |
25b7f84c | 247 | Int_t x = fMapperPtr->fHw2geomapPtr[fAltroDataPtr->GetHadd()].fXCol; |
248 | Int_t z = fMapperPtr->fHw2geomapPtr[fAltroDataPtr->GetHadd()].fZRow; | |
249 | Int_t gain = fMapperPtr->fHw2geomapPtr[fAltroDataPtr->GetHadd()].fGain; | |
04751caa | 250 | |
25b7f84c | 251 | validCellPtr = &(fOutPtr->fValidData[x][z][gain]); |
04751caa | 252 | |
25b7f84c | 253 | validCellPtr->fX = x; |
254 | validCellPtr->fZ = z; | |
255 | validCellPtr->fGain = gain; | |
939c67e7 | 256 | |
dbd79fad | 257 | if(fUseBaselineSubtraction) |
939c67e7 | 258 | { |
d949e02e | 259 | baseline = fBaselines[validCellPtr->fX][validCellPtr->fZ][ validCellPtr->fGain]; |
939c67e7 | 260 | } |
04751caa | 261 | |
d949e02e | 262 | baseline = 0; |
04751caa | 263 | |
d949e02e | 264 | validCellPtr->fEnergy = (float)fAnalyzerPtr->GetEnergy() - baseline; |
265 | validCellPtr->fTime = (float)fAnalyzerPtr->GetTiming(); | |
266 | validCellPtr->fCrazyness = (int)crazyness; | |
267 | validCellPtr->fNSamples = nSamples; | |
268 | validCellPtr->fID = tmpChannelCnt; | |
04751caa | 269 | |
47f7b25e | 270 | // validCellPtr->fData = rawDataBufferPos; |
271 | // validCellPtr->fDataOffset = rawDataBufferPos; | |
272 | ||
939c67e7 | 273 | const UInt_t *tmpData = fAltroDataPtr->GetData(); |
04751caa | 274 | // const int *tmpData = fAltroDataPtr->GetData(); |
25b7f84c | 275 | |
276 | if(fDoPushCellEnergies) | |
277 | { | |
b444d727 | 278 | for(int sample = 0; sample < nSamples; sample++) |
25b7f84c | 279 | { |
280 | (validCellPtr->fData)[sample] = tmpData[sample] - (int)baseline; | |
47f7b25e | 281 | //(validCellPtr->fDataOffset)[sample] = tmpData[sample] - (int)baseline; |
25b7f84c | 282 | } |
283 | } | |
284 | if(fDoSelectiveReadOut) | |
dbd79fad | 285 | { |
25b7f84c | 286 | if(validCellPtr->fEnergy > fSelectiveReadOutThresholds[x][z][gain]) |
287 | { | |
288 | fSelectedChannelsList[nSelected] = (AliHLTUInt16_t)(fAltroDataPtr->GetHadd()); | |
289 | nSelected++; | |
290 | } | |
dbd79fad | 291 | } |
14ff16ed | 292 | |
d949e02e | 293 | UInt_t tmpSize = sizeof(Int_t)*(validCellPtr->fNSamples); |
14ff16ed | 294 | mysize += tmpSize; |
295 | rawDataBufferPos += tmpSize/sizeof(Int_t); | |
e086ee30 | 296 | tmpChannelCnt ++; |
e086ee30 | 297 | } |
14ff16ed | 298 | |
25b7f84c | 299 | fOutPtr->fCnt = tmpChannelCnt; |
14ff16ed | 300 | fOutPtr->fSize = mysize; |
25b7f84c | 301 | |
302 | if(fDoPushCellEnergies) | |
303 | { | |
304 | AliHLTComponentBlockData bdCellEnergy; | |
305 | FillBlockData( bdCellEnergy ); | |
306 | bdCellEnergy.fOffset = offset; | |
307 | bdCellEnergy.fSize = mysize; | |
308 | bdCellEnergy.fDataType = AliHLTPHOSDefinitions::fgkCellEnergyDataType; | |
309 | bdCellEnergy.fSpecification = specification; | |
310 | outputBlocks.push_back( bdCellEnergy ); | |
311 | ||
312 | tSize += mysize; | |
313 | outBPtr += mysize; | |
314 | } | |
315 | ||
316 | //Making Digits | |
317 | if(fDoMakeDigits) | |
318 | { | |
319 | Int_t digitSize = 0; | |
320 | fDigitMakerPtr->SetDigitContainerStruct((AliHLTPHOSDigitContainerDataStruct*)outBPtr); | |
321 | digitCount = fDigitMakerPtr->MakeDigits(fOutPtr); | |
322 | offset = tSize; | |
323 | digitSize += sizeof(AliHLTPHOSDigitContainerDataStruct); | |
324 | ||
325 | AliHLTComponentBlockData bdDigits; | |
326 | FillBlockData(bdDigits); | |
327 | bdDigits.fOffset = offset; | |
328 | bdDigits.fSize = mysize; | |
329 | bdDigits.fDataType = AliHLTPHOSDefinitions::fgkDigitDataType; | |
330 | bdDigits.fSpecification = specification; | |
331 | outputBlocks.push_back( bdDigits ); | |
332 | ||
333 | tSize += digitSize; | |
334 | outBPtr += digitSize; | |
335 | fDigitMakerPtr->Reset(); | |
336 | } | |
337 | ||
338 | //Pushing selected channel addresses | |
339 | if(fDoSelectiveReadOut) | |
340 | { | |
341 | UInt_t hwAddSize = sizeof(AliHLTUInt16_t); | |
342 | offset = tSize; | |
343 | for(UInt_t n = 0; n < nSelected; n++) | |
344 | { | |
345 | ((AliHLTUInt16_t*)outBPtr)[n] = fSelectedChannelsList[n]; | |
346 | } | |
347 | mysize = nSelected*hwAddSize; | |
348 | AliHLTComponentBlockData bdHwAdd; | |
349 | FillBlockData(bdHwAdd); | |
350 | bdHwAdd.fOffset = offset; | |
351 | bdHwAdd.fSize = mysize; | |
352 | bdHwAdd.fDataType = kAliHLTDataTypeHwAddr16; | |
353 | bdHwAdd.fSpecification = specification; | |
354 | outputBlocks.push_back( bdHwAdd ); | |
8efbf5fe | 355 | |
25b7f84c | 356 | |
357 | tSize += mysize; | |
358 | outBPtr += mysize; | |
359 | } | |
04751caa | 360 | |
361 | ||
e086ee30 | 362 | if( tSize > size ) |
363 | { | |
e086ee30 | 364 | Logging( kHLTLogFatal, "HLT::AliHLTPHOSRawAnalyzerComponent::DoEvent", "Too much data", |
365 | "Data written over allowed buffer. Amount written: %lu, allowed amount: %lu." | |
366 | , tSize, size ); | |
367 | return EMSGSIZE; | |
368 | } | |
04751caa | 369 | |
e086ee30 | 370 | } |
e086ee30 | 371 | |
d2a0b488 | 372 | fPhosEventCount++; |
2b7cf4fb | 373 | |
04751caa | 374 | |
375 | ||
2b7cf4fb | 376 | if(fPrintInfo == kTRUE) |
377 | { | |
04751caa | 378 | |
14ff16ed | 379 | if(fPhosEventCount%fPrintInfoFrequncy == 0) |
2b7cf4fb | 380 | { |
8efbf5fe | 381 | Logging(kHLTLogBenchmark, __FILE__ , IntToChar( __LINE__ ) , "Analyzing event %lu", fPhosEventCount); |
2b7cf4fb | 382 | } |
04751caa | 383 | |
384 | ||
385 | } | |
e086ee30 | 386 | |
2947a32c | 387 | return 0; |
388 | }//end DoEvent | |
e086ee30 | 389 | |
0a211711 | 390 | |
14ff16ed | 391 | |
0a211711 | 392 | int |
393 | AliHLTPHOSRawAnalyzerComponent::DoInit( int argc, const char** argv ) | |
8efbf5fe | 394 | { |
04751caa | 395 | //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
396 | // fAnalyzerPtr->SetCorrectBaselineUsingFirstFiveSamples(); | |
397 | //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
398 | ||
399 | ||
939c67e7 | 400 | //See base class for documentation |
2b7cf4fb | 401 | fSendChannelData = kFALSE; |
402 | fPrintInfo = kFALSE; | |
2b7cf4fb | 403 | int iResult=0; |
404 | TString argument=""; | |
8efbf5fe | 405 | fMapperPtr = new AliHLTPHOSMapper(); |
406 | ||
407 | if(fMapperPtr->GetIsInitializedMapping() == false) | |
408 | { | |
409 | Logging(kHLTLogFatal, __FILE__ , IntToChar( __LINE__ ) , "AliHLTPHOSMapper::Could not initial mapping from file %s, aborting", fMapperPtr->GetFilePath()); | |
410 | return -4; | |
411 | } | |
412 | ||
d2a0b488 | 413 | iResult = ScanArguments(argc, argv); |
2b7cf4fb | 414 | |
25b7f84c | 415 | int nSigmas = 3; |
416 | ||
417 | fDigitMakerPtr = new AliHLTPHOSDigitMaker(); | |
418 | ||
dbd79fad | 419 | for(int i = 0; i < argc; i++) |
420 | { | |
25b7f84c | 421 | if(!strcmp("-rmsfilepath", argv[i])) |
422 | { | |
423 | fDigitMakerPtr->SetDigitThresholds(argv[i+1], nSigmas); | |
424 | SetSelectiveReadOutThresholds(argv[i+1], nSigmas); | |
425 | } | |
04751caa | 426 | |
dbd79fad | 427 | if(!strcmp("-baselinefile", argv[i])) |
428 | { | |
dbd79fad | 429 | SetBaselines(argv[i+1]); |
430 | } | |
25b7f84c | 431 | if(!strcmp("-lowgainfactor", argv[i])) |
432 | { | |
433 | fDigitMakerPtr->SetGlobalLowGainFactor(atof(argv[i+1])); | |
434 | } | |
435 | if(!strcmp("-highgainfactor", argv[i])) | |
436 | { | |
437 | fDigitMakerPtr->SetGlobalHighGainFactor(atof(argv[i+1])); | |
438 | } | |
439 | if(!strcmp("-selectivereadout", argv[i])) | |
440 | { | |
441 | fDoSelectiveReadOut = true; | |
442 | } | |
443 | if(!strcmp("-makedigits", argv[i])) | |
444 | { | |
445 | fDoMakeDigits = true; | |
446 | } | |
447 | if(!strcmp("-pushcellenergies", argv[i])) | |
448 | { | |
449 | fDoPushCellEnergies = true; | |
450 | } | |
451 | if(!strcmp("-checkdatasize", argv[i])) | |
452 | { | |
453 | fDoCheckDataSize = true; | |
454 | } | |
dbd79fad | 455 | } |
dbd79fad | 456 | |
d2a0b488 | 457 | if(fIsSetEquippmentID == kFALSE) |
2b7cf4fb | 458 | { |
8efbf5fe | 459 | Logging( kHLTLogFatal, __FILE__, "Missing argument", |
2b7cf4fb | 460 | "The argument equippmentID is not set: set it with a component argumet like this: -equippmentID <number>"); |
e086ee30 | 461 | iResult = -3; |
2b7cf4fb | 462 | } |
d2a0b488 | 463 | else |
464 | { | |
2ef3c547 | 465 | iResult = 0; |
d2a0b488 | 466 | } |
939c67e7 | 467 | |
d2a0b488 | 468 | return iResult; |
0a211711 | 469 | } |
9dfd64cf | 470 | |
9dfd64cf | 471 | |
2947a32c | 472 | void |
d949e02e | 473 | AliHLTPHOSRawAnalyzerComponent::Reset(AliHLTPHOSRcuCellEnergyDataStruct* cellDataPtr) |
2947a32c | 474 | { |
ab38011b | 475 | //comment |
d949e02e | 476 | // for(unsigned int mod = 0; mod < N_MODULES; mod ++) |
477 | //{ | |
b444d727 | 478 | for(int x = 0; x < N_XCOLUMNS_RCU; x ++) |
9dfd64cf | 479 | { |
8efbf5fe | 480 | |
b444d727 | 481 | for(int z = 0; z < N_ZROWS_RCU; z ++) |
2947a32c | 482 | { |
b444d727 | 483 | for(int gain = 0; gain < N_GAINS; gain ++ ) |
2947a32c | 484 | { |
d949e02e | 485 | //fMaxValues[mod][row][col][gain] = 0; |
486 | cellDataPtr->fValidData[x][z][gain].fEnergy = 0; | |
487 | cellDataPtr->fValidData[x][z][gain].fID = -1; | |
2947a32c | 488 | } |
489 | } | |
490 | } | |
dbd79fad | 491 | |
2b7cf4fb | 492 | ResetDataPtr(0, ALTRO_MAX_SAMPLES); |
432edd34 | 493 | |
494 | } // end Reset | |
495 | ||
e086ee30 | 496 | |
2947a32c | 497 | void |
432edd34 | 498 | AliHLTPHOSRawAnalyzerComponent::ResetDataPtr(int startindex, int sampleCnt) |
2947a32c | 499 | { |
ab38011b | 500 | //comment |
432edd34 | 501 | for(int i = startindex ; i< sampleCnt; i++) |
2947a32c | 502 | { |
503 | fTmpChannelData[i] = 0; | |
504 | } | |
cbab66dd | 505 | } |
ef408bb3 | 506 | |
14ff16ed | 507 | |
dbd79fad | 508 | void |
509 | AliHLTPHOSRawAnalyzerComponent::SetBaselines(const char* file) | |
510 | { | |
ab38011b | 511 | //comment |
dbd79fad | 512 | fUseBaselineSubtraction = true; |
513 | AliHLTPHOSBaseline *baseline = 0; | |
514 | TFile *baselineFile = TFile::Open(file); | |
515 | TTree *baselineTree = (TTree*)baselineFile->Get("baselineTree"); | |
516 | TClonesArray *baselineArray = new TClonesArray("AliHLTPHOSBaseline", 7168); | |
517 | baselineTree->SetBranchAddress("Baselines", &baselineArray); | |
518 | baselineTree->GetEntry(0); | |
519 | for(Int_t i = 0; i < baselineArray->GetEntriesFast(); i++) | |
520 | { | |
521 | baseline = (AliHLTPHOSBaseline*)baselineArray->At(i); | |
1804b020 | 522 | if((baseline->GetX() < (Int_t)((fRcuX + 1)*N_XCOLUMNS_RCU)) && (baseline->GetX() >= (Int_t)(fRcuX*N_XCOLUMNS_RCU))) |
dbd79fad | 523 | { |
1804b020 | 524 | if((baseline->GetZ() < (Int_t)((fRcuZ + 1)*N_ZROWS_RCU)) && (baseline->GetZ() >= (Int_t)(fRcuZ*N_ZROWS_RCU))) |
dbd79fad | 525 | { |
526 | fBaselines[baseline->GetX() - fRcuX*N_XCOLUMNS_RCU][baseline->GetZ() - fRcuZ*N_ZROWS_RCU][baseline->GetGain()] = baseline->GetBaseline(); | |
dbd79fad | 527 | } |
528 | } | |
529 | } | |
530 | baselineFile->Close(); | |
531 | delete baselineFile; | |
532 | baselineFile = 0; | |
533 | } | |
25b7f84c | 534 | |
535 | void | |
536 | AliHLTPHOSRawAnalyzerComponent::SetSelectiveReadOutThresholds(const char* filepath, Int_t nSigmas) | |
537 | { | |
538 | //See header file for documentation | |
25b7f84c | 539 | TFile *histFile = new TFile(filepath); |
25b7f84c | 540 | TH2F *lgHist = (TH2F*)histFile->Get("RMSLGMapHist"); |
541 | TH2F *hgHist = (TH2F*)histFile->Get("RMSHGMapHist"); | |
542 | ||
b444d727 | 543 | for(int x = 0; x < N_XCOLUMNS_MOD; x++) |
25b7f84c | 544 | { |
b444d727 | 545 | for(int z = 0; z < N_ZROWS_MOD; z++) |
25b7f84c | 546 | { |
547 | fSelectiveReadOutThresholds[x][z][LOW_GAIN] = lgHist->GetBinContent(x, z) * nSigmas; | |
548 | fSelectiveReadOutThresholds[x][z][HIGH_GAIN] = hgHist->GetBinContent(x, z) * nSigmas; | |
549 | } | |
550 | } | |
551 | } |