1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
17 //________________________________________________________________________
19 // A help class for monitoring and calibration tools: MOOD, AMORE etc.,
20 // It can be created and used a la (ctor):
22 //Create the object for making the histograms
23 fPedestals = new AliCaloCalibPedestal( fDetType );
24 // AliCaloCalibPedestal knows how many modules we have for PHOS or EMCAL
25 fNumModules = fPedestals->GetModules();
28 // fPedestals->ProcessEvent(fCaloRawStream);
29 // asked to draw histograms:
30 // fPedestals->GetDeadMap(i)->Draw("col");
32 // fPedestals->GetPeakProfileHighGainRatio((i < fNumModules) ? i : fVisibleModule)->Draw("colz");
34 // The pseudo-code examples above were from the first implementation in MOOD (summer 2007).
35 //________________________________________________________________________
43 #include "AliCaloRawStreamV3.h"
46 #include "AliCaloCalibPedestal.h"
48 ClassImp(AliCaloCalibPedestal)
52 // ctor; initialize everything in order to avoid compiler warnings
53 AliCaloCalibPedestal::AliCaloCalibPedestal(kDetType detectorType) :
57 fPedestalRMSLowGain(),
58 fPedestalRMSHighGain(),
59 fPeakMinusPedLowGain(),
60 fPeakMinusPedHighGain(),
61 fPedestalLowGainDiff(),
62 fPedestalHighGainDiff(),
63 fPeakMinusPedLowGainDiff(),
64 fPeakMinusPedHighGainDiff(),
65 fPedestalLowGainRatio(),
66 fPedestalHighGainRatio(),
67 fPeakMinusPedLowGainRatio(),
68 fPeakMinusPedHighGainRatio(),
74 fResurrectedTowers(0),
86 fSelectPedestalSamples(kTRUE),
87 fFirstPedestalSample(0),
88 fLastPedestalSample(15)
90 //Default constructor. First we set the detector-type related constants.
91 if (detectorType == kPhos) {
92 fColumns = fgkPhosCols;
94 fModules = fgkPhosModules;
101 //We'll just trust the enum to keep everything in line, so that if detectorType
102 //isn't kPhos then it is kEmCal. Note, however, that this is not necessarily the
103 //case, if someone intentionally gives another number
104 fColumns = AliEMCALGeoParams::fgkEMCALCols;
105 fRows = AliEMCALGeoParams::fgkEMCALRows;
106 fModules = AliEMCALGeoParams::fgkEMCALModules;
107 fCaloString = "EMCAL";
112 fDetType = detectorType;
114 //Then, loop for the requested number of modules
116 for (int i = 0; i < fModules; i++) {
117 //Pedestals, low gain
118 name = "hPedlowgain";
120 title = "Pedestals, low gain, module ";
122 fPedestalLowGain.Add(new TProfile2D(name, title,
123 fColumns, 0.0, fColumns,
124 fRows, fRowMin, fRowMax,"s"));
126 //Pedestals, high gain
127 name = "hPedhighgain";
129 title = "Pedestals, high gain, module ";
131 fPedestalHighGain.Add(new TProfile2D(name, title,
132 fColumns, 0.0, fColumns,
133 fRows, fRowMin, fRowMax,"s"));
134 //All Samples, low gain
135 name = "hPedestalRMSlowgain";
137 title = "Pedestal RMS, low gain, module ";
139 fPedestalRMSLowGain.Add(new TProfile2D(name, title,
140 fColumns, 0.0, fColumns,
141 fRows, fRowMin, fRowMax,"s"));
143 //All Samples, high gain
144 name = "hPedestalRMShighgain";
146 title = "Pedestal RMS, high gain, module ";
148 fPedestalRMSHighGain.Add(new TProfile2D(name, title,
149 fColumns, 0.0, fColumns,
150 fRows, fRowMin, fRowMax,"s"));
152 //Peak-Pedestals, low gain
153 name = "hPeakMinusPedlowgain";
155 title = "Peak-Pedestal, low gain, module ";
157 fPeakMinusPedLowGain.Add(new TProfile2D(name, title,
158 fColumns, 0.0, fColumns,
159 fRows, fRowMin, fRowMax,"s"));
161 //Peak-Pedestals, high gain
162 name = "hPeakMinusPedhighgain";
164 title = "Peak-Pedestal, high gain, module ";
166 fPeakMinusPedHighGain.Add(new TProfile2D(name, title,
167 fColumns, 0.0, fColumns,
168 fRows, fRowMin, fRowMax,"s"));
172 title = "Dead map, module ";
174 fDeadMap.Add(new TH2D(name, title, fColumns, 0.0, fColumns,
175 fRows, fRowMin, fRowMax));
177 }//end for nModules create the histograms
179 //Compress the arrays, in order to remove the empty objects (a 16 slot array is created by default)
180 fPedestalLowGain.Compress();
181 fPedestalHighGain.Compress();
182 fPedestalRMSLowGain.Compress();
183 fPedestalRMSHighGain.Compress();
184 fPeakMinusPedLowGain.Compress();
185 fPeakMinusPedHighGain.Compress();
187 //Make them the owners of the profiles, so we don't need to care about deleting them
188 //fPedestalLowGain.SetOwner();
189 //fPedestalHighGain.SetOwner();
190 //fPeakMinusPedLowGain.SetOwner();
191 //fPeakMinusPedHighGain.SetOwner();
196 //_____________________________________________________________________
197 AliCaloCalibPedestal::~AliCaloCalibPedestal()
199 if (fReference) delete fReference;//Delete the reference object, if it has been loaded
200 //TObjArray will delete the histos/profiles when it is deleted.
204 //_____________________________________________________________________
205 AliCaloCalibPedestal::AliCaloCalibPedestal(const AliCaloCalibPedestal &ped) :
209 fPedestalRMSLowGain(),
210 fPedestalRMSHighGain(),
211 fPeakMinusPedLowGain(),
212 fPeakMinusPedHighGain(),
213 fPedestalLowGainDiff(),
214 fPedestalHighGainDiff(),
215 fPeakMinusPedLowGainDiff(),
216 fPeakMinusPedHighGainDiff(),
217 fPedestalLowGainRatio(),
218 fPedestalHighGainRatio(),
219 fPeakMinusPedLowGainRatio(),
220 fPeakMinusPedHighGainRatio(),
222 fNEvents(ped.GetNEvents()),
223 fNChanFills(ped.GetNChanFills()),
224 fDeadTowers(ped.GetDeadTowerCount()),
225 fNewDeadTowers(ped.GetDeadTowerNew()),
226 fResurrectedTowers(ped.GetDeadTowerResurrected()),
227 fReference( 0 ), //! note that we do not try to copy the reference info here
228 fDetType(ped.GetDetectorType()),
229 fColumns(ped.GetColumns()),
230 fRows(ped.GetRows()),
231 fModules(ped.GetModules()),
232 fRowMin(ped.GetRowMin()),
233 fRowMax(ped.GetRowMax()),
234 fRowMultiplier(ped.GetRowMultiplier()),
235 fCaloString(ped.GetCaloString()),
236 fMapping(NULL), //! note that we are not copying the map info
237 fRunNumber(ped.GetRunNumber()),
238 fSelectPedestalSamples(ped.GetSelectPedestalSamples()),
239 fFirstPedestalSample(ped.GetFirstPedestalSample()),
240 fLastPedestalSample(ped.GetLastPedestalSample())
242 // Then the ObjArray ones; we add the histograms rather than trying TObjArray = assignment
243 //DS: this has not really been tested yet..
244 for (int i = 0; i < fModules; i++) {
245 fPedestalLowGain.Add( ped.GetPedProfileLowGain(i) );
246 fPedestalHighGain.Add( ped.GetPedProfileHighGain(i) );
247 fPedestalRMSLowGain.Add( ped.GetPedRMSProfileLowGain(i) );
248 fPedestalRMSHighGain.Add( ped.GetPedRMSProfileHighGain(i) );
249 fPeakMinusPedLowGain.Add( ped.GetPeakProfileLowGain(i) );
250 fPeakMinusPedHighGain.Add( ped.GetPeakProfileHighGain(i) );
252 fDeadMap.Add( ped.GetDeadMap(i) );
255 //Compress the arrays, in order to remove the empty objects (a 16 slot array is created by default)
256 fPedestalLowGain.Compress();
257 fPedestalHighGain.Compress();
258 fPedestalRMSLowGain.Compress();
259 fPedestalRMSHighGain.Compress();
260 fPeakMinusPedLowGain.Compress();
261 fPeakMinusPedHighGain.Compress();
265 // assignment operator; use copy ctor to make life easy..
266 //_____________________________________________________________________
267 AliCaloCalibPedestal& AliCaloCalibPedestal::operator = (const AliCaloCalibPedestal &source)
269 // assignment operator; use copy ctor
270 if (&source == this) return *this;
272 new (this) AliCaloCalibPedestal(source);
276 //_____________________________________________________________________
277 void AliCaloCalibPedestal::Reset()
279 // Reset all arrays/histograms
280 for (int i = 0; i < fModules; i++) {
281 GetPedProfileLowGain(i)->Reset();
282 GetPedProfileHighGain(i)->Reset();
283 GetPeakProfileLowGain(i)->Reset();
284 GetPeakProfileHighGain(i)->Reset();
285 GetDeadMap(i)->Reset();
287 if (!fPedestalLowGainDiff.IsEmpty()) {
288 //This means that the comparison profiles have been created.
290 GetPedProfileLowGainDiff(i)->Reset();
291 GetPedProfileHighGainDiff(i)->Reset();
292 GetPeakProfileLowGainDiff(i)->Reset();
293 GetPeakProfileHighGainDiff(i)->Reset();
295 GetPedProfileLowGainRatio(i)->Reset();
296 GetPedProfileHighGainRatio(i)->Reset();
297 GetPeakProfileLowGainRatio(i)->Reset();
298 GetPeakProfileHighGainRatio(i)->Reset();
305 fResurrectedTowers = 0;
307 //To think about: should fReference be deleted too?... let's not do it this time, at least...
310 //_____________________________________________________________________
311 Bool_t AliCaloCalibPedestal::AddInfo(const AliCaloCalibPedestal *ped)
313 // just do this for the basic histograms/profiles that get filled in ProcessEvent
314 // may not have data for all modules, but let's just Add everything..
315 for (int i = 0; i < fModules; i++) {
316 GetPedProfileLowGain(i)->Add( ped->GetPedProfileLowGain(i) );
317 GetPedProfileHighGain(i)->Add( ped->GetPedProfileHighGain(i) );
318 GetPeakProfileLowGain(i)->Add( ped->GetPeakProfileLowGain(i) );
319 GetPeakProfileHighGain(i)->Add( ped->GetPeakProfileHighGain(i) );
322 // DeadMap; Diff profiles etc would need to be redone after this operation
324 return kTRUE;//We succesfully added info from the supplied object
327 //_____________________________________________________________________
328 Bool_t AliCaloCalibPedestal::ProcessEvent(AliRawReader *rawReader)
330 // if fMapping is NULL the rawstream will crate its own mapping
331 AliCaloRawStreamV3 rawStream(rawReader, fCaloString, (AliAltroMapping**)fMapping);
332 return ProcessEvent(&rawStream);
335 //_____________________________________________________________________
336 Bool_t AliCaloCalibPedestal::ProcessEvent(AliCaloRawStreamV3 *in)
338 // Method to process=analyze one event in the data stream
339 if (!in) return kFALSE; //Return right away if there's a null pointer
340 fNEvents++; // one more event
342 // indices for the reading
346 int i = 0; // sample counter
349 // start loop over input stream
350 while (in->NextDDL()) {
351 while (in->NextChannel()) {
354 int max = AliEMCALGeoParams::fgkSampleMin, min = AliEMCALGeoParams::fgkSampleMax; // min and max sample values
356 // for the pedestal calculation
357 int sampleSum = 0; // sum of samples
358 int squaredSampleSum = 0; // sum of samples squared
359 int nSum = 0; // number of samples in sum
361 double mean = 0, squaredMean = 0, rms = 0;
363 while (in->NextBunch()) {
364 const UShort_t *sig = in->GetSignals();
365 startBin = in->GetStartTimeBin();
366 for (i = 0; i < in->GetBunchLength(); i++) {
370 // check if it's a min or max value
371 if (sample < min) min = sample;
372 if (sample > max) max = sample;
374 // should we add it for the pedestal calculation?
375 if ( (fFirstPedestalSample<=time && time<=fLastPedestalSample) || // sample time in range
376 !fSelectPedestalSamples ) { // or we don't restrict the sample range.. - then we'll take all
378 squaredSampleSum += sample*sample;
382 } // loop over samples in bunch
383 } // loop over bunches
385 // calculate pedesstal estimate: mean of possibly selected samples
387 mean = sampleSum / (1.0 * nSum);
388 squaredMean = squaredSampleSum / (1.0 * nSum);
389 // The variance (rms squared) is equal to the mean of the squares minus the square of the mean..
390 rms = sqrt(squaredMean - mean*mean);
398 // we're done with the calc. for this channel; let's prepare to fill histo
399 gain = -1; // init to not valid value
400 if ( in->IsLowGain() ) {
403 else if ( in->IsHighGain() ) {
407 // it should be enough to check the SuperModule info for each DDL really, but let's keep it here for now
408 int arrayPos = in->GetModule(); //The modules are numbered starting from 0
409 if (arrayPos >= fModules) {
410 //TODO: return an error message, if appopriate (perhaps if debug>0?)
414 if (arrayPos < 0 || arrayPos >= fModules) {
415 printf("Oh no: arrayPos = %i.\n", arrayPos);
418 fNChanFills++; // one more channel found, and profile to be filled
419 //NOTE: coordinates are (column, row) for the profiles
421 //fill the low gain histograms
422 ((TProfile2D*)fPeakMinusPedLowGain[arrayPos])->Fill(in->GetColumn(), fRowMultiplier*in->GetRow(), max - min);
423 if (nSum>0) { // only fill pedestal info in case it could be calculated
424 ((TProfile2D*)fPedestalLowGain[arrayPos])->Fill(in->GetColumn(), fRowMultiplier*in->GetRow(), mean);
425 ((TProfile2D*)fPedestalRMSLowGain[arrayPos])->Fill(in->GetColumn(), fRowMultiplier*in->GetRow(), rms);
428 else if (gain == 1) {
429 //fill the high gain ones
430 ((TProfile2D*)fPeakMinusPedHighGain[arrayPos])->Fill(in->GetColumn(), fRowMultiplier*in->GetRow(), max - min);
431 if (nSum>0) { // only fill pedestal info in case it could be calculated
432 ((TProfile2D*)fPedestalHighGain[arrayPos])->Fill(in->GetColumn(), fRowMultiplier*in->GetRow(), mean);
433 ((TProfile2D*)fPedestalRMSHighGain[arrayPos])->Fill(in->GetColumn(), fRowMultiplier*in->GetRow(), rms);
438 }// end while over channel
439 }//end while over DDL's, of input stream
441 in->Reset(); // just in case the next customer forgets to check if the stream was reset..
446 //_____________________________________________________________________
447 Bool_t AliCaloCalibPedestal::SaveHistograms(TString fileName, Bool_t saveEmptyHistos)
449 //Saves all the histograms (or profiles, to be accurate) to the designated file
451 TFile destFile(fileName, "recreate");
453 if (destFile.IsZombie()) {
459 for (int i = 0; i < fModules; i++) {
460 if( ((TProfile2D *)fPeakMinusPedLowGain[i])->GetEntries() || saveEmptyHistos) {
461 fPeakMinusPedLowGain[i]->Write();
463 if( ((TProfile2D *)fPeakMinusPedHighGain[i])->GetEntries() || saveEmptyHistos) {
464 fPeakMinusPedHighGain[i]->Write();
466 if( ((TProfile2D *)fPedestalLowGain[i])->GetEntries() || saveEmptyHistos) {
467 fPedestalLowGain[i]->Write();
469 if( ((TProfile2D *)fPedestalHighGain[i])->GetEntries() || saveEmptyHistos) {
470 fPedestalHighGain[i]->Write();
471 Printf("save %d", i);
473 if( ((TProfile2D *)fPedestalRMSLowGain[i])->GetEntries() || saveEmptyHistos) {
474 fPedestalRMSLowGain[i]->Write();
476 if( ((TProfile2D *)fPedestalRMSHighGain[i])->GetEntries() || saveEmptyHistos) {
477 fPedestalRMSHighGain[i]->Write();
486 //_____________________________________________________________________
487 Bool_t AliCaloCalibPedestal::LoadReferenceCalib(TString fileName, TString objectName)
490 //Make sure that the histograms created when loading the object are not destroyed as the file object is destroyed
491 TH1::AddDirectory(kFALSE);
493 TFile *sourceFile = new TFile(fileName);
494 if (sourceFile->IsZombie()) {
495 return kFALSE;//We couldn't load the reference
498 if (fReference) delete fReference;//Delete the reference object, if it already exists
501 fReference = (AliCaloCalibPedestal*)sourceFile->Get(objectName);
503 if (!fReference || !(fReference->InheritsFrom(AliCaloCalibPedestal::Class())) || (fReference->GetDetectorType() != fDetType)) {
504 if (fReference) delete fReference;//Delete the object, in case we had an object of the wrong type
511 //Reset the histogram ownership behaviour. NOTE: a better workaround would be good, since this may accidentally set AddDirectory to true, even
512 //if we are called by someone who has set it to false...
513 TH1::AddDirectory(kTRUE);
515 return kTRUE;//We succesfully loaded the object
518 //_____________________________________________________________________
519 void AliCaloCalibPedestal::ValidateComparisonProfiles()
521 //Make sure the comparison histos exist
522 if (!fPedestalLowGainDiff.IsEmpty()) return; //The profiles already exist. We just check one, because they're all created at
526 //Then, loop for the requested number of modules
528 for (int i = 0; i < fModules; i++) {
529 //Pedestals, low gain
530 name = "hPedlowgainDiff";
532 title = "Pedestals difference, low gain, module ";
534 fPedestalLowGainDiff.Add(new TProfile2D(name, title,
535 fColumns, 0.0, fColumns,
536 fRows, fRowMin, fRowMax,"s"));
538 //Pedestals, high gain
539 name = "hPedhighgainDiff";
541 title = "Pedestals difference, high gain, module ";
543 fPedestalHighGainDiff.Add(new TProfile2D(name, title,
544 fColumns, 0.0, fColumns,
545 fRows, fRowMin, fRowMax,"s"));
547 //Peak-Pedestals, high gain
548 name = "hPeakMinusPedhighgainDiff";
550 title = "Peak-Pedestal difference, high gain, module ";
552 fPeakMinusPedHighGainDiff.Add(new TProfile2D(name, title,
553 fColumns, 0.0, fColumns,
554 fRows, fRowMin, fRowMax,"s"));
556 //Pedestals, low gain
557 name = "hPedlowgainRatio";
559 title = "Pedestals ratio, low gain, module ";
561 fPedestalLowGainRatio.Add(new TProfile2D(name, title,
562 fColumns, 0.0, fColumns,
563 fRows, fRowMin, fRowMax,"s"));
565 //Pedestals, high gain
566 name = "hPedhighgainRatio";
568 title = "Pedestals ratio, high gain, module ";
570 fPedestalHighGainRatio.Add(new TProfile2D(name, title,
571 fColumns, 0.0, fColumns,
572 fRows, fRowMin, fRowMax,"s"));
574 //Peak-Pedestals, low gain
575 name = "hPeakMinusPedlowgainRatio";
577 title = "Peak-Pedestal ratio, low gain, module ";
579 fPeakMinusPedLowGainRatio.Add(new TProfile2D(name, title,
580 fColumns, 0.0, fColumns,
581 fRows, fRowMin, fRowMax,"s"));
583 //Peak-Pedestals, high gain
584 name = "hPeakMinusPedhighgainRatio";
586 title = "Peak-Pedestal ratio, high gain, module ";
588 fPeakMinusPedHighGainRatio.Add(new TProfile2D(name, title,
589 fColumns, 0.0, fColumns,
590 fRows, fRowMin, fRowMax,"s"));
592 }//end for nModules create the histograms
595 //_____________________________________________________________________
596 void AliCaloCalibPedestal::ComputeDiffAndRatio()
598 // calculate differences and ratios relative to a reference
599 ValidateComparisonProfiles();//Make sure the comparison histos exist
602 return;//Return if the reference object isn't loaded
605 for (int i = 0; i < fModules; i++) {
606 //Compute the ratio of the histograms
608 ((TProfile2D*)fPedestalLowGainRatio[i])->Divide(GetPedProfileLowGain(i), fReference->GetPedProfileLowGain(i), 1.0, 1.0);
609 ((TProfile2D*)fPedestalHighGainRatio[i])->Divide(GetPedProfileHighGain(i), fReference->GetPedProfileHighGain(i), 1.0, 1.0);
610 ((TProfile2D*)fPeakMinusPedLowGainRatio[i])->Divide(GetPeakProfileLowGain(i), fReference->GetPeakProfileLowGain(i), 1.0, 1.0);
611 ((TProfile2D*)fPeakMinusPedHighGainRatio[i])->Divide(GetPeakProfileHighGain(i), fReference->GetPeakProfileHighGain(i), 1.0, 1.0);
613 //For computing the difference, we cannot simply do TProfile2D->Add(), because that subtracts the sum of all entries,
614 //which means that the mean of the new profile will not be the difference of the means. So do it by hand:
615 for (int j = 0; j <= fColumns; j++) {
616 for (int k = 0; k <= fRows; k++) {
617 int bin = ((TProfile2D*)fPeakMinusPedHighGainDiff[i])->GetBin(j+1, k+1);//Note that we assume here that all histos have the same structure...
618 double diff = fReference->GetPeakProfileHighGain(i)->GetBinContent(bin) - GetPeakProfileHighGain(i)->GetBinContent(bin);
619 ((TProfile2D*)fPeakMinusPedHighGainDiff[i])->SetBinContent(j+1, k+1, diff);
620 ((TProfile2D*)fPeakMinusPedHighGainDiff[i])->SetBinEntries(bin, 1);
622 diff = fReference->GetPeakProfileLowGain(i)->GetBinContent(bin) - GetPeakProfileLowGain(i)->GetBinContent(bin);
623 ((TProfile2D*)fPeakMinusPedLowGainDiff[i])->SetBinContent(j+1, k+1, diff);
624 ((TProfile2D*)fPeakMinusPedLowGainDiff[i])->SetBinEntries(bin, 1);
626 diff = fReference->GetPedProfileHighGain(i)->GetBinContent(bin) - GetPedProfileHighGain(i)->GetBinContent(bin);
627 ((TProfile2D*)fPedestalHighGainDiff[i])->SetBinContent(j+1, k+1, diff);
628 ((TProfile2D*)fPedestalHighGainDiff[i])->SetBinEntries(bin, 1);
630 diff = fReference->GetPedProfileLowGain(i)->GetBinContent(bin) - GetPedProfileLowGain(i)->GetBinContent(bin);
631 ((TProfile2D*)fPedestalLowGainDiff[i])->SetBinContent(j+1, k+1, diff);
632 ((TProfile2D*)fPedestalLowGainDiff[i])->SetBinEntries(bin, 1);
641 //_____________________________________________________________________
642 void AliCaloCalibPedestal::ComputeDeadTowers(int threshold, const char * deadMapFile)
644 //Computes the number of dead towers etc etc into memory, after this you can call the GetDead... -functions
650 char name[512];//Quite a long temp buffer, just in case the filename includes a path
653 snprintf(name, 512, "%s.txt", deadMapFile);
654 fout = new ofstream(name);
655 snprintf(name, 512, "%sdiff.txt", deadMapFile);
656 diff = new ofstream(name);
657 if (!fout->is_open()) {
659 fout = 0;//Set the pointer to empty if the file was not opened
661 if (!diff->is_open()) {
663 fout = 0;//Set the pointer to empty if the file was not opened
667 for (int i = 0; i < fModules; i++) {
668 if (GetPeakProfileHighGain(i)->GetEntries() > 0) { //don't care about empty histos
669 for (int j = 1; j <= fColumns; j++) {
670 for (int k = 1; k <= fRows; k++) {
672 if (GetPeakProfileHighGain(i)->GetBinContent(j, k) < threshold) {//It's dead
673 countTot++;//One more dead total
676 << (fRows - k) << " "
679 << "0" << endl;//Write the status to the deadmap file, if the file is open.
682 if (fReference && fReference->GetPeakProfileHighGain(i)->GetBinContent(j, k) >= threshold) {
683 ((TH2D*)fDeadMap[i])->SetBinContent(j, k, kRecentlyDeceased);
684 countNew++;//This tower wasn't dead before!
687 << (fRows - k) << " "
690 << "0" << endl;//Write the status to the deadmap difference file, if the file is open.
694 ((TH2D*)fDeadMap[i])->SetBinContent(j, k, kDead);//This has been dead before. Nothing new
697 else { //It's ALIVE!!
698 //Don't bother with writing the live ones.
700 // (*fout) << i << " "
701 // << (fRows - k) << " "
704 // << "1" << endl;//Write the status to the deadmap file, if the file is open.
705 if (fReference && fReference->GetPeakProfileHighGain(i)->GetBinContent(j, k) < threshold) {
706 ((TH2D*)fDeadMap[i])->SetBinContent(j, k, kResurrected);
707 countRes++; //This tower was dead before => it's a miracle! :P
710 << (fRows - k) << " "
713 << "1" << endl;//Write the status to the deadmap difference file, if the file is open.
717 ((TH2D*)fDeadMap[i])->SetBinContent(j, k, kAlive);
723 }//end if GetEntries >= 0
732 fDeadTowers = countTot;
733 fNewDeadTowers = countNew;
734 fResurrectedTowers = countRes;