AliPhysics  c7b8e89 (c7b8e89)
AliAnalysisTaskEMCALTimeCalib.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  * *
4  * Author: The ALICE Off-line Project. *
5  * Contributors are mentioned in the code where appropriate. *
6  * *
7  * Permission to use, copy, modify and distribute this software and its *
8  * documentation strictly for non-commercial purposes 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  **************************************************************************/
15 
16 #include <TChain.h>
17 #include <TTree.h>
18 #include <TFile.h>
19 #include <TF1.h>
20 #include <TH1F.h>
21 #include <TH1D.h>
22 #include <TH2D.h>
23 #include <TH2F.h>
24 #include <TH1C.h>
25 #include <TList.h>
26 #include <TCanvas.h>
27 #include <TGeoManager.h>
28 #include <TRefArray.h>
29 #include <TKey.h>
30 
31 #include "AliLog.h"
32 #include "AliAnalysisTask.h"
33 #include "AliAnalysisManager.h"
34 #include "AliESDEvent.h"
35 #include "AliAODEvent.h"
36 #include "AliVEvent.h"
37 #include "AliESDInputHandler.h"
38 #include "AliAODInputHandler.h"
39 //#include "AliESDpid.h"
40 //#include "AliTOFcalib.h"
41 #include "AliCDBManager.h"
42 #include "AliRunTag.h"
43 
44 //#include "AliTOFT0maker.h"
45 #include "AliVCluster.h"
46 #include "AliESDCaloCluster.h"
47 #include "AliVCaloCells.h"
48 #include "AliESDCaloCells.h"
49 #include "AliAODCaloCluster.h"
50 #include "AliAODCaloCells.h"
51 #include "AliEMCALGeometry.h"
52 #include "AliOADBContainer.h"
53 #include "AliDataFile.h"
54 
56 
60 
61 //using std::cout;
62 //using std::endl;
63 
64 //________________________________________________________________________
67 : AliAnalysisTaskSE(name),
68  fRunNumber(-1),
69  // fTOFmaker(0),
70  fOutputList(0x0),
71  fgeom(0),
72  fGeometryName(),
73  fMinClusterEnergy(0),
74  fMaxClusterEnergy(0),
75  fMinNcells(0),
76  fMaxNcells(0),
77  fMinLambda0(0),
78  fMaxLambda0(0),
79  fMinLambda0LG(0),
80  fMaxLambda0LG(0),
81  fMaxRtrack(0),
82  fMinCellEnergy(0),
83  fReferenceFileName(),
84  fReferenceRunByRunFileName(),
85  fPileupFromSPD(kFALSE),
86  fMinTime(0),
87  fMaxTime(0),
88  fMostEneCellOnly(kFALSE),
89  fRawTimeNbins (0),
90  fRawTimeMin (0),
91  fRawTimeMax (0),
92  fPassTimeNbins(0),
93  fPassTimeMin (0),
94  fPassTimeMax (0),
95  fEnergyNbins (0),
96  fEnergyMin(0),
97  fEnergyMax(0),
98  fEnergyLGNbins (0),
99  fEnergyLGMin(0),
100  fEnergyLGMax(0),
101  fFineNbins(0),
102  fFineTmin(0),
103  fFineTmax(0),
104  fL1PhaseList(0),
105  fBadReco(kFALSE),
106  fFillHeavyHisto(kFALSE),
107  fBadChannelMapArray(),
108  fBadChannelMapSet(kFALSE),
109  fSetBadChannelMapSource(0),
110  fBadChannelFileName(),
111  fhcalcEvtTime(0),
112  fhEvtTimeHeader(0),
113  fhEvtTimeDiff(0),
114  fhEventType(0),
115  fhTOFT0vsEventNumber(0),
116  fhTcellvsTOFT0(0),
117  fhTcellvsTOFT0HD(0),
118  fhTcellvsSM(0),
119  fhEneVsAbsIdHG(0),
120  fhEneVsAbsIdLG(0),
121  fhTimeVsBC(0),
122  fhTimeSumSq(),
123  fhTimeEnt(),
124  fhTimeSum(),
125  fhTimeLGSumSq(),
126  fhTimeLGEnt(),
127  fhTimeLGSum(),
128  fhAllAverageBC(),
129  fhAllAverageLGBC(),
130  fhRefRuns(0),
131  fhTimeDsup(),
132  fhTimeDsupBC(),
133  fhTimeDsupLG(),
134  fhTimeDsupLGBC(),
135  fhRawTimeVsIdBC(),
136  fhRawTimeSumBC(),
137  fhRawTimeEntriesBC(),
138  fhRawTimeSumSqBC(),
139  fhRawTimeVsIdLGBC(),
140  fhRawTimeSumLGBC(),
141  fhRawTimeEntriesLGBC(),
142  fhRawTimeSumSqLGBC(),
143  fhRawCorrTimeVsIdBC(),
144  fhRawCorrTimeVsIdLGBC(),
145  fhTimeVsIdBC(),
146  fhTimeVsIdLGBC()
147 {
148  for(Int_t i = 0; i < kNBCmask; i++)
149  {
150  fhAllAverageBC[i]=0;
151  fhAllAverageLGBC[i]=0;
152 
153  fhTimeSumSq[i]=0;
154  fhTimeEnt[i]=0;
155  fhTimeSum[i]=0;
156 
157  fhTimeLGSumSq[i]=0;
158  fhTimeLGEnt[i]=0;
159  fhTimeLGSum[i]=0;
160 
161  fhRawTimeVsIdBC[i]=0;
162  fhRawTimeSumBC[i]=0;
163  fhRawTimeEntriesBC[i]=0;
164  fhRawTimeSumSqBC[i]=0;
165 
166  fhRawTimeVsIdLGBC[i]=0;
167  fhRawTimeSumLGBC[i]=0;
169  fhRawTimeSumSqLGBC[i]=0;
170  fhRawCorrTimeVsIdBC[i]=0;
172  fhTimeVsIdBC[i]=0;
173  fhTimeVsIdLGBC[i]=0;
174 
175  }
176 
177  //set default cuts for calibration and geometry name
178  SetDefaultCuts();
179 
180  //T0 TOF time
182 
183  // Define input and output slots here
184  // Input slot #0 works with a TChain
185  DefineInput(0, TChain::Class());
186 
187  // Output slot #0 id reserved by the base class for AOD
188  // Output slot #1 writes into a TH1 container
189  DefineOutput(1, TList::Class());
190 
191 } // End ctor
192 
193 //_____________________________________________________________________
199 //void AliAnalysisTaskEMCALTimeCalib::LocalInit()
200 //{
201 // AliDebug(1,"AliAnalysisTaskEMCALTimeCalib::LocalInit()");
202 //}
203 
205 //_____________________________________________________________________
207 {
208  if(fReferenceFileName.Length()!=0){
209  TFile *myFile = TFile::Open(fReferenceFileName.Data());
210  AliInfo(Form("Reference file: %s, pointer %p",fReferenceFileName.Data(),myFile));
211  if(myFile==0x0) {
212  AliFatal("*** NO REFERENCE FILE");
213  } else {
214  AliDebug(1,"*** OK TFILE");
215  // connect ref run here
216  for(Int_t i = 0; i < kNBCmask; i++)
217  {
218  fhAllAverageBC[i]=(TH1F*) myFile->Get(Form("hAllTimeAvBC%d",i));
219  if(fhAllAverageBC[i]==0x0) AliFatal(Form("Reference histogram for BC%d does not exist",i));
220  if(fhAllAverageBC[i]->GetEntries()==0)AliWarning(Form("fhAllAverageLGBC[%d]->GetEntries() = 0",i));
221  fhAllAverageLGBC[i]=(TH1F*) myFile->Get(Form("hAllTimeAvLGBC%d",i));
222  if(fhAllAverageLGBC[i]==0x0) AliFatal(Form("Reference LG histogram for BC%d does not exist",i));
223  if(fhAllAverageLGBC[i]->GetEntries()==0)AliFatal(Form("fhAllAverageLGBC[%d]->GetEntries() = 0",i));
224  }
225 
226  AliDebug(1,Form("hAllAverage entries BC0 %d", (Int_t)fhAllAverageBC[0]->GetEntries() ));
227  AliDebug(1,Form("hAllAverage entries BC2 %d",(Int_t)fhAllAverageBC[2]->GetEntries() ));
228  AliDebug(1,Form("hAllAverageLG entries BC0 %d", (Int_t)fhAllAverageLGBC[0]->GetEntries() ));
229  AliDebug(1,Form("hAllAverageLG entries BC2 %d",(Int_t)fhAllAverageLGBC[2]->GetEntries() ));
230 
231  }
232  } else { //end of reference file is provided
233  AliFatal("You require to load reference histos from file but FILENAME is not provided");
234  }
235 } // End of AliAnalysisTaskEMCALTimeCalib::LoadReferenceHistos()
236 
239 //_____________________________________________________________________
241 {
242  // connect ref run here
243  if(fReferenceRunByRunFileName.Length()!=0){
244  TFile *referenceFile = TFile::Open(fReferenceRunByRunFileName.Data());
245  if(referenceFile==0x0) {
246  AliFatal("*** NO REFERENCE R-B-R FILE");
247  return;
248  } else {
249  AliInfo(Form("Reference R-b-R file: %s, pointer %p",fReferenceRunByRunFileName.Data(),referenceFile));
250 
251  //load L1 phases to memory
252  fL1PhaseList=new TObjArray(referenceFile->GetNkeys());
253  TIter next(referenceFile->GetListOfKeys());
254  TKey *key;
255  while ((key=(TKey*)next())) {
256  fL1PhaseList->AddLast((TH1F*)referenceFile->Get(key->GetName()) );
257  //printf("key: %s points to an object of class: %s at %dn",key->GetName(),key->GetClassName(),key->GetSeekKey());
258  }
259  }
260  } else { //reference file is not provided
261  AliFatal("You require to load reference run-by-run histos from file but FILENAME is not provided");
262  return;
263  }
264 } // End of AliAnalysisTaskEMCALTimeCalib::LoadReferenceRunByRunHistos()
265 
270 {
271  fhRefRuns=NULL;
272  if(!fL1PhaseList) {
273  AliFatal("Array with reference L1 phase histograms do not exist in memory");
274  return;
275  }
276  if(fRunNumber<0) {
277  AliFatal("Negative run number");
278  return;
279  }
280 
281  fhRefRuns=(TH1C*)fL1PhaseList->FindObject(Form("h%d",fRunNumber));
282  if(fhRefRuns==0x0){
283  AliError(Form("Reference histogram for run %d does not exist. Use Default",fRunNumber));
284  fhRefRuns=(TH1C*)fL1PhaseList->FindObject("h0");
285  }
286  if(fhRefRuns==0x0) {
287  AliFatal(Form("No default histogram with L1 phases! Add default histogram to file %s!!!",fReferenceRunByRunFileName.Data()));
288  return;
289  }
290 
291  AliDebug(1,Form("Reference R-b-R histo %p, list %p, run number %d",fhRefRuns,fL1PhaseList,fRunNumber));
292  if(fhRefRuns->GetEntries()==0)AliWarning("fhRefRuns->GetEntries() = 0");
293  AliDebug(1,Form("hRefRuns entries %d", (Int_t)fhRefRuns->GetEntries() ));
294 }
295 
296 //_____________________________________________________________________
297 // Function for Setting L1 Phase reference in case of multiple phases for PAR
298 
300  if(fCurrentPARs.runNumber == 0){
301  AliFatal("fCurrentPARs not properly set! Unable to get PAR information.");
302  return;
303  }
304 
305  //if Reference is set, check if it is for correct PAR region
306  if(fhRefRuns!=0x0){
307  TString refName(fhRefRuns->GetName());
308  TString correctName;
310  correctName = Form("h%d_%llu", fRunNumber, fCurrentPARs.PARGlobalBCs[fCurrentPARIndex]);
311  }else{
312  correctName = Form("h%d", fRunNumber);
313  }
314  if(refName.CompareTo(correctName)==0) return;
315  }
316 
317  fhRefRuns=NULL;
318  if(!fL1PhaseList) {
319  AliFatal("Array with reference L1 phase histograms do not exist in memory");
320  return;
321  }
322  if(fRunNumber<0) {
323  AliFatal("Negative run number");
324  return;
325  }
327  fhRefRuns=(TH1C*)fL1PhaseList->FindObject(Form("h%d_%llu", fRunNumber, fCurrentPARs.PARGlobalBCs[fCurrentPARIndex]));
328  }else{
329  fhRefRuns=(TH1C*)fL1PhaseList->FindObject(Form("h%d", fRunNumber));
330  }
331 
332  if(fhRefRuns==0x0){
333  AliFatal(Form("No Reference R-b-R histo found for run %d PAR %d!", fRunNumber, fCurrentPARIndex));
334  return;
335  }
336  if(fhRefRuns->GetEntries()==0)AliWarning("fhRefRuns->GetEntries() = 0");
337  AliDebug(1,Form("hRefRuns entries %d", (Int_t)fhRefRuns->GetEntries() ));
338 
339 }
340 
341 //_____________________________________________________________________
345 {
346  AliDebug(1,"AnalysisTaskEMCalTimeCalib::NotifyRun()");
347  AliDebug(2,Form("Notify(): EMCal geometry: fgeom = %p, fGeometryName=%s\n ",fgeom,fGeometryName.Data()));
348 
349  if (!InputEvent())
350  {
351  AliFatal("ERROR: InputEvent not set");
352  return;
353  }
354  else AliDebug(1,"Good, InputEvent set");
355 
356  // AliInfo(Form("NotifyRun, fCurrentRunnumber %d",fCurrentRunNumber));
357  fRunNumber = InputEvent()->GetRunNumber();
358  AliDebug(1,Form("RunNumber %d", fRunNumber));
359 
360  // Init EMCAL geometry
361  if (!fgeom) SetEMCalGeometry();
362  //Init EMCAL geometry done
363 
365 
366  //set L1 phases for current run
367  if(fReferenceRunByRunFileName.Length()!=0){
368  if(fIsPARRun){
370  }else{
372  }
373  }
374 
375  // set bad channel map
377 
378  return;
379 }
380 
381 //_____________________________________________________________________
384 {
385  AliDebug(1,"AliAnalysisTaskEMCALTimeCalib::SetEMCalGeometry()");
386  if(fGeometryName.Length()==0){
387  fgeom=AliEMCALGeometry::GetInstanceFromRunNumber(fRunNumber);
388  AliInfo(Form("Get EMCAL geometry name <%s> for run %d",fgeom->GetName(),fRunNumber));
389  } else {
390  fgeom = AliEMCALGeometry::GetInstance(fGeometryName.Data());
391  AliInfo(Form("Set EMCAL geometry name to <%s>",fGeometryName.Data()));
392  }
393 
394  if (!fgeom){
395  AliWarning("Make sure the EMCal geometry is set properly !");
396  } else {
397  AliDebug(1,Form("EMCal geometry properly set: fGeom = %p, fGeometryName=%s",fgeom,fGeometryName.Data()));
398  }
399 
400  return kTRUE;
401 }
402 
403 //_____________________________________________________________________
406 {
407  //method under development
408  AliInfo(Form("<D> -- Run # = %d", fRunNumber));
409  AliInfo("prepare TOFT0maker!!");
410  //cout<<"Run "<< fRunNumber<<" in TOFT0maker"<<endl;
411 
412 
413  AliCDBManager * cdb = AliCDBManager::Instance();
414  cdb->SetDefaultStorage("raw://");
415  cdb->SetRun(fRunNumber);
416 
417 // AliESDpid *extPID=new AliESDpid();
418 //
419 // // Wonder if some have to be declared as private variables??
420 // // AliESDpid *extPID = new AliESDpid();
421 // // AliTOFcalib * tofCalib = new AliTOFcalib();
422 // // tofCalib->SetCalibrateTOFsignal(kTRUE);
423 // // tofCalib->Init();
424 //
425 // fTOFmaker = new AliTOFT0maker(extPID);
426 // fTOFmaker->SetTimeResolution(115.0); // if you want set the TOF res
427 // // fTOFmaker = new AliTOFT0maker(extPID,tofCalib);
428 // // fTOFmaker->SetTimeResolution(130.0);
429 //
430 // //cout<<"extPID "<<extPID<<" fTOFmaker "<<fTOFmaker<<endl;
431 
432 }// End PrepareTOFT0maker
433 
434 //________________________________________________________________________
438 {
439  AliDebug(1,"AliAnalysisTaskEMCALTimeCalib::UserCreateOutputObjects()");
440 
441  const Int_t nChannels = 17664;
442  //book histograms
443  if(fFillHeavyHisto){
444  fhcalcEvtTime = new TH1F("fhcalcEvtTime","calculated event time from T0",fFineNbins, fFineNbins,fFineTmax);
445  fhcalcEvtTime->GetXaxis()->SetTitle("T ");
446  fhcalcEvtTime->GetYaxis()->SetTitle("Counts (a.u.)");
447 
448  fhEvtTimeHeader = new TH1F("fhEvtTimeHeader","event time from header",fFineNbins, fFineNbins,fFineTmax);
449  fhEvtTimeHeader->GetXaxis()->SetTitle("T ");
450  fhEvtTimeHeader->GetYaxis()->SetTitle("Counts (a.u.)");
451 
452  fhEvtTimeDiff = new TH1F("fhEvtTimeDiff","event time difference",fFineNbins, fFineNbins,fFineTmax);
453  fhEvtTimeDiff->GetXaxis()->SetTitle("#Delta T ");
454  fhEvtTimeDiff->GetYaxis()->SetTitle("Counts (a.u.)");
455  }
456 
457  fhEventType = new TH1F("fhEventType","event type",10, 0.,10.);
458  //fhEventType ->GetXaxis()->SetTitle("Type ");
459  fhEventType->GetXaxis()->SetBinLabel(1 ,"1=No ESD");
460  fhEventType->GetXaxis()->SetBinLabel(2 ,"2=Pileup");
461  fhEventType->GetXaxis()->SetBinLabel(3 ,"3=No Trigger");
462  fhEventType->GetXaxis()->SetBinLabel(4 ,"4=Evt Type != 7");
463  fhEventType->GetXaxis()->SetBinLabel(5 ,"5=INT7,8");
464  fhEventType->GetXaxis()->SetBinLabel(6 ,"6=EMC7,8");
465  fhEventType->GetXaxis()->SetBinLabel(7 ,"7=L1 EMCal");
466  fhEventType->GetXaxis()->SetBinLabel(8 ,"8=DMC7,8");
467  fhEventType->GetXaxis()->SetBinLabel(9 ,"9=L1 DCal");
468 
469 
470  fhEventType ->GetYaxis()->SetTitle("Counts (a.u.)");
471  if(fFillHeavyHisto){
472  fhTcellvsTOFT0 = new TH2F("hTcellvsTOFT0", " T_cell vs TOFT0", 500,-600.0,+400.0,fRawTimeNbins,fRawTimeMin,fRawTimeMax);
473  fhTcellvsTOFT0HD = new TH2F("hTcellvsTOFT0HD", " T_cell vs TOFT0,HighEnergy", 500,-600.0,+400.0,4*fRawTimeNbins,fRawTimeMin,fRawTimeMax);
474  }
475  fhTcellvsSM = new TH2F("hTcellvsSM", " T_cell vs SM", (Int_t)kNSM,0,(Double_t)kNSM,(Int_t)(fRawTimeNbins/2),fRawTimeMin,fRawTimeMax);
476 
477  if(fFillHeavyHisto){
478  fhEneVsAbsIdHG = new TH2F("fhEneVsAbsIdHG", "energy vs ID for HG",1000,0,18000,200,0,10);
479  fhEneVsAbsIdLG = new TH2F("fhEneVsAbsIdLG", "energy vs ID for LG",1000,0,18000,200,0,40);
480  }
481 
482  //Set-up Info for PAR histograms
483  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
484  if(!mgr) AliFatal("No Analysis Manager available...\n");
485  Int_t runNum = mgr->GetRunFromPath();
486  if(runNum == 0){
487  runNum = TString(gSystem->Getenv("RUNNO")).Atoi();
488  if(runNum < 200000){
489  AliFatal("Run Number not correctly set in UserCreateOutputObjects()!");
490  }
491  }
492  GetPARInfoForRunNumber(runNum);
493 
494  if(fIsPARRun){
495  for (Int_t iPAR = 0; iPAR <= fCurrentPARs.numPARs; iPAR++){
496  TH2F* fRawTimeSinglePAR;
497  TH2F* fRawTimeLGSinglePAR;
498  std::vector<TH2F*> vecRawTimePAR;
499  std::vector<TH2F*> vecRawTimeLGPAR;
500  for(Int_t iBC = 0; iBC < kNBCmask; iBC++){
501  fRawTimeSinglePAR = new TH2F(Form("RawTimeBeforePAR%dBC%d",iPAR+1, iBC),
502  Form("cell raw time vs ID for high gain BC %d ", iBC),
503  nChannels,0.,(Double_t)nChannels,fRawTimeNbins,fRawTimeMin,fRawTimeMax);
504  fRawTimeLGSinglePAR = new TH2F(Form("RawTimeLGBeforePAR%dBC%d",iPAR+1, iBC),
505  Form("cell raw time vs ID for low gain BC %d ", iBC),
506  nChannels,0.,(Double_t)nChannels,fRawTimeNbins,fRawTimeMin,fRawTimeMax);
507  vecRawTimePAR.push_back(fRawTimeSinglePAR);
508  vecRawTimeLGPAR.push_back(fRawTimeLGSinglePAR);
509  }
510  fhRawTimePARs.push_back(vecRawTimePAR);
511  fhRawTimeLGPARs.push_back(vecRawTimeLGPAR);
512  }
513  }
514 
515  for (Int_t i = 0; i < kNBCmask ; i++)
516  {
517  //already after correction
518  //high gain
519  fhTimeSumSq[i] = new TH1F(Form("hTimeSumSq%d", i),
520  Form("cell Sum Square time HG, BC %d ", i),
521  nChannels,0.,(Double_t)nChannels);
522  fhTimeSumSq[i]->SetYTitle("Sum Sq Time ");
523  fhTimeSumSq[i]->SetXTitle("AbsId");
524 
525  fhTimeSum[i] = new TH1F(Form("hTimeSum%d", i),
526  Form("cell Sum time HG, BC %d ", i),
527  nChannels,0.,(Double_t)nChannels);
528  fhTimeSum[i]->SetYTitle("Sum Time ");
529  fhTimeSum[i]->SetXTitle("AbsId");
530 
531  fhTimeEnt[i] = new TH1F(Form("hTimeEnt%d", i),
532  Form("cell Entries HG, BC %d ", i),
533  nChannels,0.,(Double_t)nChannels);
534  fhTimeEnt[i]->SetYTitle("Entries for Time ");
535  fhTimeEnt[i]->SetXTitle("AbsId");
536 
537  //low gain
538  fhTimeLGSumSq[i] = new TH1F(Form("hTimeLGSumSq%d", i),
539  Form("cell Sum Square time LG, BC %d ", i),
540  nChannels,0.,(Double_t)nChannels);
541  fhTimeLGSumSq[i]->SetYTitle("Sum Sq Time ");
542  fhTimeLGSumSq[i]->SetXTitle("AbsId");
543 
544  fhTimeLGSum[i] = new TH1F(Form("hTimeLGSum%d", i),
545  Form("cell Sum time LG, BC %d ", i),
546  nChannels,0.,(Double_t)nChannels);
547  fhTimeLGSum[i]->SetYTitle("Sum Time ");
548  fhTimeLGSum[i]->SetXTitle("AbsId");
549 
550  fhTimeLGEnt[i] = new TH1F(Form("hTimeLGEnt%d", i),
551  Form("cell Entries LG, BC %d ", i),
552  nChannels,0.,(Double_t)nChannels);
553  fhTimeLGEnt[i]->SetYTitle("Entries for Time ");
554  fhTimeLGEnt[i]->SetXTitle("AbsId");
555 
556  //raw time histograms
557  //high gain
558  if(fFillHeavyHisto){
559  fhRawTimeVsIdBC[i] = new TH2F(Form("RawTimeVsIdBC%d", i),
560  Form("cell raw time vs ID for high gain BC %d ", i),
561  nChannels,0.,(Double_t)nChannels,fRawTimeNbins,fRawTimeMin,fRawTimeMax);
562  fhRawTimeVsIdBC[i]->SetXTitle("AbsId");
563  fhRawTimeVsIdBC[i]->SetYTitle("Time");
564  }
565 
566  fhRawTimeSumBC[i] = new TH1F(Form("RawTimeSumBC%d", i),
567  Form("sum of cell raw time for high gain BC %d ", i),
568  nChannels,0.,(Double_t)nChannels);
569  fhRawTimeSumBC[i]->SetXTitle("AbsId");
570  fhRawTimeSumBC[i]->SetYTitle("Sum Time");
571 
572  fhRawTimeEntriesBC[i] = new TH1F(Form("RawTimeEntriesBC%d", i),
573  Form("No. entries of cells raw time for high gain BC %d ", i),
574  nChannels,0.,(Double_t)nChannels);
575  fhRawTimeEntriesBC[i]->SetXTitle("AbsId");
576  fhRawTimeEntriesBC[i]->SetYTitle("Entries for Time ");
577 
578  fhRawTimeSumSqBC[i] = new TH1F(Form("RawTimeSumSqBC%d", i),
579  Form("sum of (cell raw time)^2 for high gain BC %d ", i),
580  nChannels,0.,(Double_t)nChannels);
581  fhRawTimeSumSqBC[i]->SetXTitle("AbsId");
582  fhRawTimeSumSqBC[i]->SetYTitle("Sum Sq Time");
583 
584  //low gain
585  if(fFillHeavyHisto){
586  fhRawTimeVsIdLGBC[i] = new TH2F(Form("RawTimeVsIdLGBC%d", i),
587  Form("cell raw time vs ID for low gain BC %d ", i),
588  nChannels,0.,(Double_t)nChannels,fRawTimeNbins,fRawTimeMin,fRawTimeMax);
589  fhRawTimeVsIdLGBC[i]->SetXTitle("AbsId");
590  fhRawTimeVsIdLGBC[i]->SetYTitle("Time");
591  }
592 
593  fhRawTimeSumLGBC[i] = new TH1F(Form("RawTimeSumLGBC%d", i),
594  Form("sum of cell raw time for low gain BC %d ", i),
595  nChannels,0.,(Double_t)nChannels);
596  fhRawTimeSumLGBC[i]->SetXTitle("AbsId");
597  fhRawTimeSumLGBC[i]->SetYTitle("Sum Time");
598 
599  fhRawTimeEntriesLGBC[i] = new TH1F(Form("RawTimeEntriesLGBC%d", i),
600  Form("No. entries of cells raw time for low gain BC %d ", i),
601  nChannels,0.,(Double_t)nChannels);
602  fhRawTimeEntriesLGBC[i]->SetXTitle("AbsId");
603  fhRawTimeEntriesLGBC[i]->SetYTitle("Entries for Time ");
604 
605  fhRawTimeSumSqLGBC[i] = new TH1F(Form("RawTimeSumSqLGBC%d", i),
606  Form("sum of (cell raw time)^2 for low gain BC %d ", i),
607  nChannels,0.,(Double_t)nChannels);
608  fhRawTimeSumSqLGBC[i]->SetXTitle("AbsId");
609  fhRawTimeSumSqLGBC[i]->SetYTitle("Sum Sq Time");
610 
611  //histograms with corrected raw time for L1 shift and 100ns
612  if(fBadReco && fFillHeavyHisto){
613  fhRawCorrTimeVsIdBC[i] = new TH2F(Form("RawCorrTimeVsIdBC%d", i),
614  Form("cell L1 shift and 100ns corrected raw time vs ID for high gain BC %d ", i),
615  nChannels,0.,(Double_t)nChannels,fPassTimeNbins,fPassTimeMin,fPassTimeMax);
616  fhRawCorrTimeVsIdBC[i]->SetXTitle("AbsId");
617  fhRawCorrTimeVsIdBC[i]->SetYTitle("Time");
618 
619  fhRawCorrTimeVsIdLGBC[i] = new TH2F(Form("RawCorrTimeVsIdLGBC%d", i),
620  Form("cell L1 shift and 100ns corrected raw time vs ID for low gain BC %d ", i),
621  nChannels,0.,(Double_t)nChannels,fPassTimeNbins,fPassTimeMin,fPassTimeMax);
622  fhRawCorrTimeVsIdLGBC[i]->SetXTitle("AbsId");
623  fhRawCorrTimeVsIdLGBC[i]->SetYTitle("Time");
624  }
625 
626  //histograms with corrected raw time for L1 shift and 100ns + new L1 phase
627  if(fReferenceRunByRunFileName.Length()!=0 && fFillHeavyHisto){
628  fhTimeVsIdBC[i] = new TH2F(Form("TimeVsIdBC%d", i),
629  Form("cell time corrected for L1 shift, 100ns and L1 phase vs ID for high gain BC %d ", i),
630  nChannels,0.,(Double_t)nChannels,fPassTimeNbins,fPassTimeMin,fPassTimeMax);
631  fhTimeVsIdBC[i]->SetXTitle("AbsId");
632  fhTimeVsIdBC[i]->SetYTitle("Time");
633 
634  fhTimeVsIdLGBC[i] = new TH2F(Form("TimeVsIdLGBC%d", i),
635  Form("cell time corrected for L1 shift, 100ns and L1 phase vs ID for low gain BC %d ", i),
636  nChannels,0.,(Double_t)nChannels,fPassTimeNbins,fPassTimeMin,fPassTimeMax);
637  fhTimeVsIdLGBC[i]->SetXTitle("AbsId");
638  fhTimeVsIdLGBC[i]->SetYTitle("Time");
639  }
640 
641  for (Int_t j = 0; j < kNSM ; j++)
642  {
643  //High gain
644  //fhTimeDsupBC[j][i]= new TH2F(Form("SupMod%dBC%d",j,i), Form("SupMod %d time_vs_E BC %d",j,i),500,0.0,20.0,2200,-350.0,750.0);
645  fhTimeDsupBC[j][i]= new TH2F(Form("SupMod%dBC%d",j,i), Form("SupMod %d time_vs_E, high gain, BC %d",j,i),fEnergyNbins,fEnergyMin,fEnergyMax,fPassTimeNbins,fPassTimeMin,fPassTimeMax);
646  fhTimeDsupBC[j][i]->SetYTitle(" Time (ns) ");
647  fhTimeDsupBC[j][i]->SetXTitle(" E (GeV) ");
648 
649  //low gain
650  fhTimeDsupLGBC[j][i]= new TH2F(Form("SupMod%dBC%dLG",j,i), Form("SupMod %d time_vs_E, low gain, BC %d",j,i),fEnergyLGNbins,fEnergyLGMin,fEnergyLGMax,fPassTimeNbins,fPassTimeMin,fPassTimeMax);
651  fhTimeDsupLGBC[j][i]->SetYTitle(" Time (ns) ");
652  fhTimeDsupLGBC[j][i]->SetXTitle(" E (GeV) ");
653  }
654  }
655 
656  for (Int_t jj = 0; jj < kNSM ; jj++)
657  {
658  //high gain
659  fhTimeDsup[jj] = new TH2F(Form("SupMod%d",jj), Form("SupMod %d time_vs_E, high gain",jj),fEnergyNbins,fEnergyMin,fEnergyMax,fPassTimeNbins,fPassTimeMin,fPassTimeMax);
660  fhTimeDsup[jj]->SetYTitle(" Time (ns) ");
661  fhTimeDsup[jj]->SetXTitle(" E (GeV) ");
662 
663  //low gain
664  fhTimeDsupLG[jj] = new TH2F(Form("SupMod%dLG",jj), Form("SupMod %d time_vs_E, low gain ",jj),fEnergyLGNbins,fEnergyLGMin,fEnergyLGMax,fPassTimeNbins,fPassTimeMin,fPassTimeMax);
665  fhTimeDsupLG[jj]->SetYTitle(" Time (ns) ");
666  fhTimeDsupLG[jj]->SetXTitle(" E (GeV) ");
667  }
668 
669  fhTimeVsBC = new TH2F("TimeVsBC"," SupMod time_vs_BC ", 4001,-0.5,4000.5,(Int_t)(fRawTimeNbins/2.),fRawTimeMin,fRawTimeMax);
670 
671 
672  //add histos to list
673  fOutputList = new TList();
674  fOutputList->Add(fhEventType);
675  if(fFillHeavyHisto){
679 
684  }
685  fOutputList->Add(fhTcellvsSM);
686 
687  if(fIsPARRun && fFillHeavyHisto){
688  for (Int_t iPAR = 0; iPAR <= fCurrentPARs.numPARs; iPAR++){
689  for(Int_t iBC = 0; iBC < kNBCmask; iBC++){
690  fOutputList->Add(fhRawTimePARs[iPAR][iBC]);
691  fOutputList->Add(fhRawTimeLGPARs[iPAR][iBC]);
692  }
693  }
694  }
695 
696  for (Int_t i = 0; i < kNBCmask ; i++)
697  {
698  fOutputList->Add(fhTimeSumSq[i]);
699  fOutputList->Add(fhTimeEnt[i]);
700  fOutputList->Add(fhTimeSum[i]);
701 
702  fOutputList->Add(fhTimeLGSumSq[i]);
703  fOutputList->Add(fhTimeLGEnt[i]);
704  fOutputList->Add(fhTimeLGSum[i]);
705 
706  if(fFillHeavyHisto) {
707  fOutputList->Add(fhRawTimeVsIdBC[i]);
709  }
710  fOutputList->Add(fhRawTimeSumBC[i]);
712  fOutputList->Add(fhRawTimeSumSqBC[i]);
713 
714  fOutputList->Add(fhRawTimeSumLGBC[i]);
717 
718  if(fBadReco && fFillHeavyHisto) {
721  }
722  if(fReferenceRunByRunFileName.Length()!=0 && fFillHeavyHisto) {
723  fOutputList->Add(fhTimeVsIdBC[i]);
724  fOutputList->Add(fhTimeVsIdLGBC[i]);
725  }
726 
727  for (Int_t j = 0; j < kNSM ; j++){
728  fOutputList->Add(fhTimeDsupBC[j][i]);
729  fOutputList->Add(fhTimeDsupLGBC[j][i]);
730  }
731  }
732 
733  for (Int_t j = 0; j < kNSM ; j++)
734  {
735  fOutputList->Add(fhTimeDsup[j]);
736  fOutputList->Add(fhTimeDsupLG[j]);
737  }
738 
739  fOutputList->Add(fhTimeVsBC);
740 
741  fOutputList->SetOwner(kTRUE);
742  PostData(1,fOutputList);
743 
744 
745 } // End of AliAnalysisTaskEMCALTimeCalib::UserCreateOuputObjects()
746 
747 //________________________________________________________________________
750 {
751  // Called for each event
752  AliDebug(2,Form("UserExec: EMCal geometry: fgeom = %p fGeometryName %s",fgeom,fGeometryName.Data()));
753  AliVEvent *event = InputEvent();
754  //cout<<"T0TOF "<<event->GetT0TOF()<<endl;//bad idea
755  //cout<< fEvent->GetTOFHeader()->GetDefaultEventTimeVal()<<endl;
756  AliDebug(2,Form("TOF time from header %f ps",event->GetTOFHeader()->GetDefaultEventTimeVal()));
757  if(fFillHeavyHisto) fhEvtTimeHeader->Fill(event->GetTOFHeader()->GetDefaultEventTimeVal());
758 
759  //fEvent = dynamic_cast<AliESDEvent*>(event);
760  if (!event) {
761  AliError("ESD not available, exit");
762  fhEventType->Fill(0.5);
763  return;
764  }
765 
766  if(fPileupFromSPD==kTRUE){
767  if(event->IsPileupFromSPD(3,0.8,3.,2.,5.)){
768  AliDebug(1,"Event: PileUp skip.");
769  fhEventType->Fill(1.5);
770  return;
771  }
772  }
773 
774  TString triggerclasses = event->GetFiredTriggerClasses();
775  if(triggerclasses=="") {
776  fhEventType->Fill(2.5);
777  return;
778  }
779 
780  Int_t eventType = ((AliVHeader*)event->GetHeader())->GetEventType();
781  // physics events eventType=7, select only those
782  AliDebug(1,Form("Triggerclasses %s, eventType %d",triggerclasses.Data(),eventType));
783  if(eventType != 7) {
784  fhEventType->Fill(3.5);
785  return;
786  }
787 
788  // Check trigger
789  Bool_t bMB = kFALSE;
790  Bool_t bL0 = kFALSE;
791  Bool_t bL1G = kFALSE;
792  Bool_t bL1J = kFALSE;
793  Bool_t bDL0 = kFALSE;
794  Bool_t bDL1G = kFALSE;
795  Bool_t bDL1J = kFALSE;
796 
797  if(triggerclasses.Contains("CINT7-B-NOPF-ALLNOTRD") ||
798  triggerclasses.Contains("CINT7-I-NOPF-ALLNOTRD") ||
799  triggerclasses.Contains("CINT1-I-NOPF-ALLNOTRD") ||
800  triggerclasses.Contains("CINT1-B-NOPF-ALLNOTRD") ||
801  triggerclasses.Contains("CINT8") ||
802  triggerclasses.Contains("CINT7") ||
803  triggerclasses.Contains("CPBI2_B1-B-NOPF-ALLNOTRD") ) bMB = kTRUE;
804 
805  if(triggerclasses.Contains("CEMC7-B-NOPF-CENTNOTRD") ||
806  triggerclasses.Contains("CEMC1-B-NOPF-CENTNOTRD") ||
807  triggerclasses.Contains("CEMC7") ||
808  triggerclasses.Contains("CEMC8") ||
809  triggerclasses.Contains("CEMC8-B-NOPF-CENTNOTRD") ) bL0 = kTRUE;
810 
811  if(triggerclasses.Contains("CDMC7-B-NOPF-CENTNOTRD") ||
812  triggerclasses.Contains("CDMC1-B-NOPF-CENTNOTRD") ||
813  triggerclasses.Contains("CDMC7") ||
814  triggerclasses.Contains("CDMC8") ||
815  triggerclasses.Contains("CDMC8-B-NOPF-CENTNOTRD") ) bDL0 = kTRUE;
816 
817  if(triggerclasses.Contains("CEMC7EG1-B-NOPF-CENTNOTRD") ||
818  triggerclasses.Contains("CEMC7EG2-B-NOPF-CENTNOTRD") ||
819  triggerclasses.Contains("CEMC8EG1-B-NOPF-CENTNOTRD") ||
820  triggerclasses.Contains("CEMC8EGA") ||
821  triggerclasses.Contains("CEMC7EGA") ||
822  triggerclasses.Contains("CEMC7EG1-B") ||
823  triggerclasses.Contains("CEMC7EG2-B") ||
824  triggerclasses.Contains("CPBI2EGA") ) bL1G = kTRUE;
825 
826  if(triggerclasses.Contains("CDMC7DG1-B-NOPF-CENTNOTRD") ||
827  triggerclasses.Contains("CDMC7DG2-B-NOPF-CENTNOTRD") ||
828  triggerclasses.Contains("CDMC8DG1-B-NOPF-CENTNOTRD") ||
829  triggerclasses.Contains("CDMC8DGA") ||
830  triggerclasses.Contains("CDMC7DGA") ||
831  triggerclasses.Contains("CDMC7DG1-B") ||
832  triggerclasses.Contains("CDMC7DG2-B") ||
833  triggerclasses.Contains("CPBI2DGA") ) bDL1G = kTRUE;
834 
835  if(triggerclasses.Contains("CEMC7EJ1-B-NOPF-CENTNOTRD") ||
836  triggerclasses.Contains("CEMC7EJ2-B-NOPF-CENTNOTRD") ||
837  triggerclasses.Contains("CEMC8EJ1-B-NOPF-CENTNOTRD") ||
838  triggerclasses.Contains("CEMC7EJE") ||
839  triggerclasses.Contains("CEMC8EJE") ||
840  triggerclasses.Contains("CEMC7EJ1-B") ||
841  triggerclasses.Contains("CEMC7EJ2-B") ||
842  triggerclasses.Contains("CPBI2EJE") ) bL1J = kTRUE;
843 
844  if(triggerclasses.Contains("CDMC7DJ1-B-NOPF-CENTNOTRD") ||
845  triggerclasses.Contains("CDMC7DJ2-B-NOPF-CENTNOTRD") ||
846  triggerclasses.Contains("CDMC8DJ1-B-NOPF-CENTNOTRD") ||
847  triggerclasses.Contains("CDMC7DJE") ||
848  triggerclasses.Contains("CDMC8DJE") ||
849  triggerclasses.Contains("CDMC7DJ1-B") ||
850  triggerclasses.Contains("CDMC7DJ2-B") ||
851  triggerclasses.Contains("CPBI2DJE") ) bDL1J = kTRUE;
852 
853  if( bMB ){ fhEventType->Fill(4.5);}//INT7,8
854  if( bL0 ){ fhEventType->Fill(5.5);}//EMC7,EMC8
855  if( bL1G || bL1J ){ fhEventType->Fill(6.5);}//L1 EMCal
856  if( bDL0 ){ fhEventType->Fill(7.5);}//DMC7,DMC8
857  if( bDL1G || bDL1J ){ fhEventType->Fill(8.5);}//L1 DCal
858 
859  // if(bL1G || bL1J || bL0){
860 
861 // Prepare TOFT0 maker at the beginning of a run
862 // if (event->GetRunNumber() != fRunNumber){
863 // AliInfo(Form("Runno per event %d",event->GetRunNumber()));
864 // fRunNumber = event->GetRunNumber();
865 // // PrepareTOFT0maker();
866 // // cout<<"tofT0maker per run"<<fRunNumber<<endl;
867 // }// fi Check if run number has changed
868 
869 // // --- Use of AliTOFT0maker
870 // Double_t calcolot0=0.0;
871 // if(!AODEvent()){
872 // Double_t* timeTOFtable;
873 // timeTOFtable=fTOFmaker->ComputeT0TOF(dynamic_cast<AliESDEvent*>(event));
874 // AliDebug(2,Form("TOF time %f ps, resolution %f ps, tracks at TOF %f/used %f",timeTOFtable[0],timeTOFtable[1],timeTOFtable[3],timeTOFtable[7]));
875 // //cout<<"event time "<<timeTOFtable[0]<<" resolution "<<timeTOFtable[1]<<"ps av. ev. time "<<timeTOFtable[2]<<" trks at TOF "<<timeTOFtable[3]<<" calc evnt time "<<timeTOFtable[4]<<" resolution "<<timeTOFtable[5]<<" tracks used "<<timeTOFtable[7]<<endl;
876 // calcolot0=timeTOFtable[0];
877 // }
878 
879 // if(fFillHeavyHisto) {
880 // fhcalcEvtTime->Fill(calcolot0);
881 // if(calcolot0 != 0 && event->GetTOFHeader()->GetDefaultEventTimeVal() != 0 )
882 // fhEvtTimeDiff->Fill(calcolot0-event->GetTOFHeader()->GetDefaultEventTimeVal());
883 // }
884 
885  TRefArray* caloClusters = new TRefArray();
886  event->GetEMCALClusters(caloClusters);
887  // cout << " ###########Bunch Cross nb = " << event->GetBunchCrossNumber() << endl;
888 
889  Int_t BunchCrossNumber =event->GetBunchCrossNumber();
890 
891  Float_t offset=0.;
892  Float_t offsetPerSM=0.;
893  Int_t L1phaseshift=0;
894  Int_t L1phase=0;
895  Int_t L1shiftOffset=0;
896 
897  Int_t nBC = 0;
898  nBC = BunchCrossNumber%4;
899  //Int_t nTriggerMask =event->GetTriggerMask();
900  // cout << " nBC " << nBC << " nTriggerMask " << nTriggerMask<< endl;
901  Float_t timeBCoffset = 0.; //manual offset
902  // if( nBC%4 ==0 || nBC%4==1) timeBCoffset = 100.; // correction was for LHC11 when BC was not corrected
903 
904  Int_t nclus = caloClusters->GetEntries();
905  AliDebug(1,Form("###########Bunch Cross nb = %d nclus = %d",nBC,nclus ));
906  //cout << " ###########Bunch Cross nb = " << nBC <<" nclus= "<< nclus<< endl;
907  //Int_t ntracks = event-> GetNumberOfTracks() ;
908 
909  AliVCaloCells &cells= *(event->GetEMCALCells());//it is cluster independent
910  //Variables used plenty in loops
911  Int_t nSupMod=-1, nModule=-1;
912  Int_t iphi=-1, ieta=-1, nIphi=-1, nIeta=-1;
913  Int_t absId=-1;
914  Float_t hkdtime=0.0;
915  Float_t amp=0.0;
916  Bool_t isHighGain=kTRUE;
917  Int_t mostEneId=-1;
918  Float_t mostEneEn=0.;
919 
920  fCurrentPARIndex = 0;
921  if(fIsPARRun){
922  ULong64_t eventBC = (ULong64_t)event->GetBunchCrossNumber();
923  ULong64_t eventOrbit = ((ULong64_t)(3564))*((ULong64_t)event->GetOrbitNumber());
924  ULong64_t eventPeriod = ((ULong64_t)(59793994260))*((ULong64_t)(event->GetPeriodNumber()));
925  //ULong64_t globalBC = event->GetBunchCrossNumber() + 3564*event->GetOrbitNumber() + 59793994260*event->GetPeriodNumber();
926  ULong64_t globalBC = eventBC + eventOrbit + eventPeriod;
927  for(int ipar = 0; ipar < fCurrentPARs.numPARs; ipar++){
928  if(globalBC >= fCurrentPARs.PARGlobalBCs[ipar]){
929  fCurrentPARIndex ++;
930  }
931  }
932  }
933  if(fReferenceRunByRunFileName.Length()!=0 && fIsPARRun){
935  }
936  for (Int_t icl = 0; icl < nclus; icl++) {
937  //ESD and AOD CaloCells carries the same information
938  AliVCluster* clus = (AliVCluster*)caloClusters->At(icl);
939  if(!AcceptCluster(clus)) continue;
940 
941  //cout<<"nCells="<< clus->GetNCells();<<endl;
942 
943  UShort_t * index = clus->GetCellsAbsId() ;
944 
945  // find index of the most energetic cell in cluster
946  mostEneEn=0.;
947  mostEneId=-1;
948  if(fMostEneCellOnly) {
949  for(Int_t i = 0; i < clus->GetNCells() ; i++) {
950  absId = index[i];
951  amp = cells.GetCellAmplitude(absId) ;
952  if(amp > mostEneEn){
953  mostEneEn = amp;
954  mostEneId = absId;
955  }
956  }
957  }//works only for fMostEneCellOnly=kTRUE
958 
959  for(Int_t i = 0; i < clus->GetNCells() ; i++) {
960  absId = index[i]; // or clus->GetCellNumber(i) ;
961  if(fMostEneCellOnly && absId != mostEneId) {
962  //printf("tr.%s.cl.%d.cell.%d.rejected\n",triggerclasses.Data(),icl,i);
963  continue;
964  }
965  //printf("tr.%s.cl.%d.cell.%d.accepted\n",triggerclasses.Data(),icl,i);
966  hkdtime = cells.GetCellTime(absId) * 1.0e09; // to get ns
967  amp = cells.GetCellAmplitude(absId) ;
968  isHighGain = cells.GetCellHighGain(absId);
969  //cout<<"cell absID: "<<absId<<" cellTime: "<<hkdtime<<" cellaplit: "<< amp<<endl;
970  // GEOMETRY tranformations
971  fgeom->GetCellIndex(absId, nSupMod, nModule, nIphi, nIeta);
972  fgeom->GetCellPhiEtaIndexInSModule(nSupMod,nModule,nIphi,nIeta, iphi,ieta);
973 
974  //bad channel check. 0: good channel, 1-5: bad channel
976  if(GetEMCALChannelStatus(nSupMod,ieta,iphi)) continue;//printf("bad\n");
977  } else if(fSetBadChannelMapSource==2){
978  if(GetEMCALChannelStatus(absId)) continue;//printf("bad\n");
979  }
980 
981  //main histograms with raw time information
982  if(amp>fMinCellEnergy){
983 
984  if(isHighGain){
985  if(fFillHeavyHisto){
986  fhRawTimeVsIdBC[nBC]->Fill(absId,hkdtime);
987  if(fIsPARRun){
988  if(fhRawTimePARs[fCurrentPARIndex][nBC]==0x0)AliFatal(Form("No Histogram for PAR number %d! Problem with Create Output Objects", fCurrentPARIndex));
989  fhRawTimePARs[fCurrentPARIndex][nBC]->Fill(absId, hkdtime);
990  }
991  }
992  fhRawTimeSumBC[nBC]->Fill(absId,hkdtime);
993  fhRawTimeEntriesBC[nBC]->Fill(absId,1.);
994  fhRawTimeSumSqBC[nBC]->Fill(absId,hkdtime*hkdtime);
995  }else{
996  if(fFillHeavyHisto){
997  fhRawTimeVsIdLGBC[nBC]->Fill(absId,hkdtime);
998  if(fIsPARRun){
999  fhRawTimeLGPARs[fCurrentPARIndex][nBC]->Fill(absId, hkdtime);
1000  }
1001  }
1002  fhRawTimeSumLGBC[nBC]->Fill(absId,hkdtime);
1003  fhRawTimeEntriesLGBC[nBC]->Fill(absId,1.);
1004  fhRawTimeSumSqLGBC[nBC]->Fill(absId,hkdtime*hkdtime);
1005  }
1006  }
1007  //fgeom->PrintCellIndexes(absId);
1008  //fgeom->PrintCellIndexes(absId,1);
1009 
1010  // other histograms for cross-check
1011  CheckCellRCU(nSupMod,ieta,iphi);//SM, column, row
1012 
1013  fhTcellvsSM->Fill(nSupMod,hkdtime);
1014  if(fFillHeavyHisto) {
1015  if(isHighGain==kTRUE) {fhEneVsAbsIdHG->Fill(absId,amp);}
1016  else {fhEneVsAbsIdLG->Fill(absId,amp);}
1017  }
1018  fhTimeVsBC->Fill(1.*BunchCrossNumber,hkdtime-timeBCoffset);
1019  //important remark: We use 'Underflow bin' for absid=0 in OADB for time calibration
1020  if(isHighGain==kTRUE){
1021  if(fhAllAverageBC[nBC]!=0) {//comming from file after the first iteration
1022  offset = (Float_t)(fhAllAverageBC[nBC]->GetBinContent(absId));//channel absId=0 has histogram bin=0
1023  } else if(fReferenceFileName.Length()!=0){//protection against missing reference histogram
1024  AliFatal(Form("Reference histogram for BC%d not properly loaded",nBC));
1025  }
1026  } else {
1027  if(fhAllAverageLGBC[nBC]!=0) {//comming from file after the first iteration
1028  offset = (Float_t)(fhAllAverageLGBC[nBC]->GetBinContent(absId));//channel absId=0 has histogram bin=0
1029  } else if(fReferenceFileName.Length()!=0){//protection against missing reference histogram
1030  AliFatal(Form("Reference LG histogram for BC%d not properly loaded",nBC));
1031  }
1032  }
1033  //if(offset==0)cout<<"offset 0 in SM "<<nSupMod<<endl;
1034 
1035  // Solution for 2015 data where L1 phase and L1 shift is not correct in data. We need to calibrate run by run.
1036  // The shift and phase are done per SM (0-19).
1037  // L1 phase is necessary in run 2.
1038  // L1 shift is necessary only for bad reconstructed runs (muon_calo_pass1 lhc15f-m)
1039  if(fhRefRuns!=0) {//comming from file after the first iteration
1040  L1phaseshift = (Int_t)(fhRefRuns->GetBinContent(nSupMod));//SM0 = bin0
1041 
1042  // to correct for L1 phase
1043  // this part works for both: muon_calo_pass1 of LHC15n (pp@2.76) and later reconstructions
1044  // wrong reconstruction done before in run2
1045  L1phase = L1phaseshift & 3; //bit operation
1046  if(nBC >= L1phase)
1047  offsetPerSM = (nBC - L1phase)*25;
1048  else
1049  offsetPerSM = (nBC - L1phase + 4)*25;
1050 
1051  // to correct for L1 shift
1052  // this part is only for wrongly reconstructed runs before LHC15n in run2
1053  if(fBadReco){
1054  L1shiftOffset = L1phaseshift>>2; //bit operation
1055  L1shiftOffset*=25;
1056  //(we subtract it here because we subtract the whole wrong offset later --=+)
1057  if(nBC==0 || nBC==1) L1shiftOffset-=100.;//additional shift for muon_calo_pass1 up to lhc15f-m
1058  }
1059  } else if(fReferenceRunByRunFileName.Length()!=0){//protection against missing reference histogram
1060  AliFatal("Reference histogram run-by-run not properly loaded");
1061  }
1062  //end of load additional offset
1063 
1064  //fill the raw time with L1 shift correction and 100ns
1065  if(fBadReco && fFillHeavyHisto && amp>fMinCellEnergy){
1066  if(isHighGain){
1067  fhRawCorrTimeVsIdBC[nBC]->Fill(absId,hkdtime-L1shiftOffset);
1068  }else{
1069  fhRawCorrTimeVsIdLGBC[nBC]->Fill(absId,hkdtime-L1shiftOffset);
1070  }
1071  }
1072 
1073  //fill time after L1 shift correction and 100ns and new L1 phase
1074  if(fReferenceRunByRunFileName.Length()!=0 && fFillHeavyHisto && amp>fMinCellEnergy){
1075  if(isHighGain){
1076  fhTimeVsIdBC[nBC]->Fill(absId,hkdtime-L1shiftOffset-offsetPerSM);
1077  }else{
1078  fhTimeVsIdLGBC[nBC]->Fill(absId,hkdtime-L1shiftOffset-offsetPerSM);
1079  }
1080  }
1081 
1082  //other control histograms
1083  if(amp>0.5) {
1084  if(isHighGain){
1085  fhTimeDsup[nSupMod]->Fill(amp,hkdtime-offset-offsetPerSM-L1shiftOffset);
1086  fhTimeDsupBC[nSupMod][nBC]->Fill(amp,hkdtime-offset-offsetPerSM-L1shiftOffset);
1087  }else{
1088  fhTimeDsupLG[nSupMod]->Fill(amp,hkdtime-offset-offsetPerSM-L1shiftOffset);
1089  fhTimeDsupLGBC[nSupMod][nBC]->Fill(amp,hkdtime-offset-offsetPerSM-L1shiftOffset);
1090  }
1091  }
1092 
1093 // if(fFillHeavyHisto) {
1094 // if(amp>0.9) {
1095 // fhTcellvsTOFT0HD->Fill(calcolot0, hkdtime);
1096 // }
1097 // fhTcellvsTOFT0->Fill(calcolot0, hkdtime-offset-offsetPerSM-L1shiftOffset);
1098 // }
1099 
1100  hkdtime = hkdtime-timeBCoffset;//time corrected by manual offset (default=0)
1101  Float_t hkdtimecorr;
1102  hkdtimecorr= hkdtime-offset-offsetPerSM-L1shiftOffset;//time after first iteration
1103 
1104  //main histograms after the first itereation for calibration constants
1105  //if(hkdtimecorr>=-20. && hkdtimecorr<=20. && amp>0.9 ) {
1106  if(hkdtimecorr>=fMinTime && hkdtimecorr<=fMaxTime && amp>fMinCellEnergy ) {
1107  // per cell
1108 // Float_t entriesTime=fhTimeEnt[nBC]->GetBinContent(absId)+1;
1109 // Float_t sumTimeSq=(fhTimeSumSq[nBC]->GetBinContent(absId)+(hkdtime*hkdtime));
1110 // Float_t sumTime=(fhTimeSum[nBC]->GetBinContent(absId)+hkdtime);
1111 //
1112 // fhTimeEnt[nBC]->SetBinContent(absId,entriesTime);
1113 // fhTimeSumSq[nBC]->SetBinContent(absId,sumTimeSq);
1114 // fhTimeSum[nBC]->SetBinContent(absId,sumTime);
1115 
1116  //correction in 2015 for wrong L1 phase and L1 shift
1117  hkdtime = hkdtime - offsetPerSM - L1shiftOffset;
1118 
1119  if(isHighGain){
1120  fhTimeEnt[nBC]->Fill(absId,1.);
1121  fhTimeSumSq[nBC]->Fill(absId,hkdtime*hkdtime);
1122  fhTimeSum[nBC]->Fill(absId,hkdtime);
1123  }else{
1124  fhTimeLGEnt[nBC]->Fill(absId,1.);
1125  fhTimeLGSumSq[nBC]->Fill(absId,hkdtime*hkdtime);
1126  fhTimeLGSum[nBC]->Fill(absId,hkdtime);
1127  }
1128 
1129 
1130  } // hkdtime:[-20;20]
1131  } // end icell
1132  } //end cluster
1133 
1134 
1135  // Post output data.
1136  //cout<<"Post data and delete caloClusters"<<endl;
1137  caloClusters->Delete();
1138  delete caloClusters;
1139 // } // end if trigger type
1140 
1141  PostData(1, fOutputList);
1142 } // End of AliAnalysisTaskEMCALTimeCalib::UserExec()
1143 
1144 //________________________________________________________________________
1148 {
1149  fOutputList = dynamic_cast<TList*> (GetOutputData(1));
1150 
1151  // if(fTOFmaker) delete fTOFmaker;
1152 
1153  if(fL1PhaseList) {
1154  fL1PhaseList->SetOwner();
1155  fL1PhaseList->Clear();
1156  delete fL1PhaseList;
1157  }
1158 
1159  if (fBadChannelMapArray) {
1160  fBadChannelMapArray->Clear();
1161  delete fBadChannelMapArray;
1162  }
1163 
1164  if (!fOutputList)
1165  {
1166  AliDebug(1,"ERROR: Output list not available");
1167  return;
1168  }
1169 } // End of AliAnalysisTaskEMCALTimeCalib::Terminate
1170 
1171 //________________________________________________________________________
1174 {
1175  //fix with noisy EMCAL fee card
1176  Int_t nCells = clus->GetNCells();
1177 
1178  if(clus->IsEMCAL())
1179  {
1180  if ((clus->E() > fMaxClusterEnergy && nCells > fMaxNcells ) || nCells > fMaxNcells){
1181  AliDebug(1,"very big cluster with enormous energy - cluster rejected");
1182  return kFALSE;
1183  }
1184  }
1185 
1186  // remove other than photonlike
1187  Double_t lambda0=clus->GetM02();
1188  if (lambda0>fMaxLambda0LG || lambda0<fMinLambda0LG){
1189  AliDebug(1,"lambda0 loose cut failed - cluster rejected");
1190  return kFALSE;
1191  }
1192 
1193  // remove matched clusters
1194  Double_t Dx=clus->GetTrackDx();
1195  Double_t Dz=clus->GetTrackDz();
1196  Double_t Rtrack = TMath::Sqrt(Dx*Dx+Dz*Dz);
1197  if (Rtrack <fMaxRtrack)
1198  {
1199  AliDebug(1,"track matched - cluster rejected");
1200  return kFALSE;
1201  }
1202 
1203  if (nCells<fMinNcells)
1204  {
1205  AliDebug(1,"single cell cluster - cluster rejected");
1206  return kFALSE;
1207  }
1208 
1209  if(clus->E()<fMinClusterEnergy)
1210  {
1211  AliDebug(1,"cluster energy < 1 GeV- cluster rejected");
1212  return kFALSE;
1213  }
1214 
1215 
1216  if(!IsLowGainCellInCluster(clus)) {//no low gain cell in cluster
1217  //apply more strict lambda0^2 cut
1218  if (lambda0>fMaxLambda0 || lambda0<fMinLambda0){
1219  AliDebug(1,"lambda0 strict cut failed - cluster rejected");
1220  return kFALSE;
1221  }
1222  }
1223 
1224 
1225 
1226 
1227  return kTRUE;
1228 }//End AliAnalysisTaskEMCALTimeCalib::AcceptCluster
1229 
1230 //________________________________________________________________________
1233  UShort_t * index = clus->GetCellsAbsId() ;
1234  AliVCaloCells &cells= *(InputEvent()->GetEMCALCells());
1235  for(Int_t i = 0; i < clus->GetNCells() ; i++) {
1236  if(cells.GetCellHighGain(index[i])==kFALSE) return kTRUE;//low gain cell
1237  }
1238  return kFALSE;
1239 
1240 }
1241 
1242 //________________________________________________________________________
1245 {
1246  Int_t iRCU;
1247  if(nSupMod < 10 || (nSupMod >= 12 && nSupMod <18) )
1248  {
1249  if (0<=irow&&irow<8) iRCU=0; // first cable row
1250  else if (8<=irow&&irow<16 && 0<=icol&&icol<24) iRCU=0; // first half;
1251  //second cable row
1252  //RCU1
1253  else if (8<=irow&&irow<16 && 24<=icol&&icol<48) iRCU=1; // second half;
1254  //second cable row
1255  else if (16<=irow&&irow<24) iRCU=1; // third cable row
1256 
1257  if (nSupMod%2==1) iRCU = 1 - iRCU; // swap for odd=C side, to allow us to cable both sides the same
1258  }
1259  else
1260  {
1261  // Last 2 SM have one single SRU, just assign RCU 0
1262  iRCU = 0 ;
1263  }
1264 
1265  //cout<<"RCU:"<<iRCU<<endl;
1266  if (iRCU<0)
1267  AliFatal(Form("Wrong EMCAL/DCAL RCU number = %d\n", iRCU));
1268 
1269  return kTRUE;
1270 }//End AliAnalysisTaskEMCALTimeCalib::CheckCellRCU
1271 
1272 //________________________________________________________________________
1275 {
1276  fMinClusterEnergy=1.0;//0.5//0.7
1277  fMaxClusterEnergy=500;
1278  fMinNcells=2;
1279  fMaxNcells=200;
1280  fMinLambda0=0.1;
1281  fMaxLambda0=0.4;
1282  fMinLambda0LG=0.1;
1283  fMaxLambda0LG=4.0;
1284  fMaxRtrack=0.025;
1285  fMinCellEnergy=0.4;//0.1//0.4
1286  fReferenceFileName="";//Reference.root
1288  fBadReco=kFALSE;
1289  fFillHeavyHisto=kFALSE;
1290  fGeometryName="";//EMCAL_COMPLETE12SMV1_DCAL_8SM
1291  fPileupFromSPD=kFALSE;
1292  fMinTime=-20.;
1293  fMaxTime=20.;
1294  fMostEneCellOnly=kFALSE;
1295 
1296  fBadChannelMapSet=kFALSE;
1299 
1300  //histograms
1301  fRawTimeNbins = 400; // Raw time settings should be like that all the time
1302  fRawTimeMin = 400.; // importent in pass1
1303  fRawTimeMax = 800.;
1304  fPassTimeNbins = 1000; // in pass2 should be (400,400,800)
1305  fPassTimeMin = -250.;// in pass3 should be (1000,-250,250)
1306  fPassTimeMax = 250.;
1307  fEnergyNbins = 100; // default settings was 500
1308  fEnergyMin = 0.;
1309  fEnergyMax = 20.;
1310  fEnergyLGNbins = 200; // default settings
1311  fEnergyLGMin = 0.;
1312  fEnergyLGMax = 100.;
1313  fFineNbins = 90; //was 4500 for T0 time studies
1314  fFineTmin = -500;
1315  fFineTmax = 400;
1316 }
1317 
1318 //________________________________________________________________________
1324 {
1325  TFile *file =new TFile(inputFile.Data());
1326  if(file==0x0) {
1327  //AliWarning("Input file does not exist!");
1328  return;
1329  }
1330 
1331  TList *list=(TList*)file->Get("chistolist");
1332  if(list==0x0)
1333  {
1334  //AliWarning("List chistolist does not exist in file!");
1335  return;
1336  }
1337 
1338  Int_t numPARs = 0;
1339  Int_t counter = 0;
1340  if(isPAR){
1341  TIter next(list);
1342  TObject* obj;
1343  while((obj = next())){
1344  TString name(obj->GetName());
1345  if(name.BeginsWith("RawTimeBeforePAR")) counter++;
1346  }
1347  }
1348  numPARs = Int_t(counter/4) - 1;
1349  printf("number of PARs found to be %d!\n", numPARs);
1350 
1351  if(numPARs == -1) isPAR = kFALSE;
1352 
1353  //high gain
1354  TH1F *h1[4];
1355  TH1F *h2[4];
1356  TH1F *h3[4];
1357  TH1F *hAllTimeAvBC[4];
1358  TH1F *hAllTimeRMSBC[4];
1359 
1360  //low gain
1361  TH1F *h4[4];
1362  TH1F *h5[4];
1363  TH1F *h6[4];
1364  TH1F *hAllTimeAvLGBC[4];
1365  TH1F *hAllTimeRMSLGBC[4];
1366 
1367  //PAR histos
1368  TH1F *h1PAR[numPARs+1][4];
1369  TH1F *h2PAR[numPARs+1][4];
1370  //TH1F *h3PAR[numPARs+1][4];
1371  TH1F *hAllTimeAvBCPAR[numPARs+1][4];
1372  TH1F *hAllTimeRMSBCPAR[numPARs+1][4];
1373 
1374  TH1F *h4PAR[numPARs+1][4];
1375  TH1F *h5PAR[numPARs+1][4];
1376  //TH1F *h6PAR[numPARs+1][4];
1377  TH1F *hAllTimeAvLGBCPAR[numPARs+1][4];
1378  TH1F *hAllTimeRMSLGBCPAR[numPARs+1][4];
1379 
1380  TH2D* raw2D[4];
1381  TH2D* rawLG2D[4];
1382 
1383  if(isFinal==kFALSE){//first itereation
1384  for(Int_t i=0;i<4;i++){
1385  h1[i]=(TH1F *)list->FindObject(Form("RawTimeSumBC%d",i));
1386  h2[i]=(TH1F *)list->FindObject(Form("RawTimeEntriesBC%d",i));
1387  h3[i]=(TH1F *)list->FindObject(Form("RawTimeSumSqBC%d",i));
1388 
1389  h4[i]=(TH1F *)list->FindObject(Form("RawTimeSumLGBC%d",i));
1390  h5[i]=(TH1F *)list->FindObject(Form("RawTimeEntriesLGBC%d",i));
1391  h6[i]=(TH1F *)list->FindObject(Form("RawTimeSumSqLGBC%d",i));
1392 
1393  if(isPAR){ //set-up histograms for different PAR time regions
1394  for(Int_t iPAR = 0; iPAR <= numPARs; iPAR++){
1395  raw2D[i] = (TH2D*)list->FindObject(Form("RawTimeBeforePAR%dBC%d", iPAR+1, i));
1396  rawLG2D[i] = (TH2D*)list->FindObject(Form("RawTimeLGBeforePAR%dBC%d", iPAR+1, i));
1397  h1PAR[iPAR][i] = new TH1F(Form("hAllTimeSumPAR%dBC%d",iPAR, i), Form("hAlltimeSumPAR%dBC%d",iPAR, i), raw2D[i]->GetXaxis()->GetNbins(), raw2D[i]->GetXaxis()->GetXmin(), raw2D[i]->GetXaxis()->GetXmax());
1398  hAllTimeAvBCPAR[iPAR][i] = new TH1F(Form("hAllTimeAvPAR%dBC%d",iPAR, i), Form("hAlltimeAvPAR%dBC%d",iPAR, i), raw2D[i]->GetXaxis()->GetNbins(), raw2D[i]->GetXaxis()->GetXmin(), raw2D[i]->GetXaxis()->GetXmax());
1399  h2PAR[iPAR][i] = (TH1F*)raw2D[i]->ProjectionX(Form("hAllTimeEntriesPAR%dBC%d",iPAR, i), 0, raw2D[i]->GetYaxis()->GetNbins());
1400 
1401  h4PAR[iPAR][i] = new TH1F(Form("hAllTimeSumLGPAR%dBC%d",iPAR, i), Form("hAllTimeSumLGPAR%dBC%d",iPAR, i), raw2D[i]->GetXaxis()->GetNbins(), raw2D[i]->GetXaxis()->GetXmin(), raw2D[i]->GetXaxis()->GetXmax());
1402  hAllTimeAvLGBCPAR[iPAR][i] = new TH1F(Form("hAllTimeAvLGPAR%dBC%d",iPAR, i), Form("hAlltimeAvLGPAR%dBC%d",iPAR, i), raw2D[i]->GetXaxis()->GetNbins(), raw2D[i]->GetXaxis()->GetXmin(), raw2D[i]->GetXaxis()->GetXmax());
1403  h5PAR[iPAR][i] = (TH1F*)raw2D[i]->ProjectionX(Form("hAllTimeEntriesPAR%dLGBC%d",iPAR, i), 0, raw2D[i]->GetYaxis()->GetNbins());
1404  for(int ixbin = 0; ixbin < raw2D[i]->GetXaxis()->GetNbins(); ixbin++){
1405  float sumtime = 0.0;
1406  float sumLGtime = 0.0;
1407  for(int iybin = 0; iybin < raw2D[i]->GetYaxis()->GetNbins(); iybin++){
1408  sumtime += raw2D[i]->GetBinContent(ixbin, iybin)*raw2D[i]->GetYaxis()->GetBinCenter(iybin);
1409  sumLGtime += rawLG2D[i]->GetBinContent(ixbin, iybin)*rawLG2D[i]->GetYaxis()->GetBinCenter(iybin);
1410  }
1411  h1PAR[iPAR][i]->SetBinContent(ixbin, sumtime);
1412  h4PAR[iPAR][i]->SetBinContent(ixbin, sumLGtime);
1413  if(h2PAR[iPAR][i]->GetBinContent(ixbin) ==0){
1414  hAllTimeAvBCPAR[iPAR][i]->SetBinContent(ixbin, 0);
1415  }else{
1416  hAllTimeAvBCPAR[iPAR][i]->SetBinContent(ixbin, h1PAR[iPAR][i]->GetBinContent(ixbin)/h2PAR[iPAR][i]->GetBinContent(ixbin));
1417  }
1418 
1419  if(h5PAR[iPAR][i]->GetBinContent(ixbin) ==0){
1420  hAllTimeAvLGBCPAR[iPAR][i]->SetBinContent(ixbin, 0);
1421  }else{
1422  hAllTimeAvLGBCPAR[iPAR][i]->SetBinContent(ixbin, h4PAR[iPAR][i]->GetBinContent(ixbin)/h5PAR[iPAR][i]->GetBinContent(ixbin));
1423  }
1424  }
1425 
1426  }
1427  }
1428  }
1429  } else {//final iteration
1430  for(Int_t i=0;i<4;i++){
1431  h1[i]=(TH1F *)list->FindObject(Form("hTimeSum%d",i));
1432  h2[i]=(TH1F *)list->FindObject(Form("hTimeEnt%d",i));
1433  h3[i]=(TH1F *)list->FindObject(Form("hTimeSumSq%d",i));
1434 
1435  h4[i]=(TH1F *)list->FindObject(Form("hTimeLGSum%d",i));
1436  h5[i]=(TH1F *)list->FindObject(Form("hTimeLGEnt%d",i));
1437  h6[i]=(TH1F *)list->FindObject(Form("hTimeLGSumSq%d",i));
1438  }
1439  }
1440  //AliWarning("Input histograms read.");
1441 
1442  for(Int_t i=0;i<4;i++){
1443  hAllTimeAvBC[i]=new TH1F(Form("hAllTimeAvBC%d",i),Form("hAllTimeAvBC%d",i),h1[i]->GetNbinsX(),h1[i]->GetXaxis()->GetXmin(),h1[i]->GetXaxis()->GetXmax());
1444  hAllTimeRMSBC[i]=new TH1F(Form("hAllTimeRMSBC%d",i),Form("hAllTimeRMSBC%d",i),h3[i]->GetNbinsX(),h3[i]->GetXaxis()->GetXmin(),h3[i]->GetXaxis()->GetXmax());
1445 
1446  hAllTimeAvLGBC[i]=new TH1F(Form("hAllTimeAvLGBC%d",i),Form("hAllTimeAvLGBC%d",i),h4[i]->GetNbinsX(),h4[i]->GetXaxis()->GetXmin(),h4[i]->GetXaxis()->GetXmax());
1447  hAllTimeRMSLGBC[i]=new TH1F(Form("hAllTimeRMSLGBC%d",i),Form("hAllTimeRMSLGBC%d",i),h6[i]->GetNbinsX(),h6[i]->GetXaxis()->GetXmin(),h6[i]->GetXaxis()->GetXmax());
1448  }
1449 
1450  //AliWarning("New histograms booked.");
1451 
1452  //important remark: we use 'underflow bin' for absid=0 in OADB . That's why there is j-1 below.
1453  for(Int_t i=0;i<4;i++){
1454  for(Int_t j=1;j<=h1[i]->GetNbinsX();j++){
1455  //high gain
1456  if(h2[i]->GetBinContent(j)!=0){
1457  hAllTimeAvBC[i]->SetBinContent(j-1,h1[i]->GetBinContent(j)/h2[i]->GetBinContent(j));
1458  hAllTimeRMSBC[i]->SetBinContent(j-1,TMath::Sqrt(h3[i]->GetBinContent(j)/h2[i]->GetBinContent(j)) );
1459  } else {
1460  hAllTimeAvBC[i]->SetBinContent(j-1,0.);
1461  hAllTimeRMSBC[i]->SetBinContent(j-1,0.);
1462  }
1463  //low gain
1464  if(h5[i]->GetBinContent(j)!=0){
1465  hAllTimeAvLGBC[i]->SetBinContent(j-1,h4[i]->GetBinContent(j)/h5[i]->GetBinContent(j));
1466  hAllTimeRMSLGBC[i]->SetBinContent(j-1,TMath::Sqrt(h6[i]->GetBinContent(j)/h5[i]->GetBinContent(j)) );
1467  } else {
1468  hAllTimeAvLGBC[i]->SetBinContent(j-1,0.);
1469  hAllTimeRMSLGBC[i]->SetBinContent(j-1,0.);
1470  }
1471 
1472  }
1473  }
1474 
1475  //AliWarning("Average and rms calculated.");
1476  TFile *fileNew=new TFile(outputFile.Data(),"recreate");
1477  for(Int_t i=0;i<4;i++){
1478  if(isPAR){
1479  for(Int_t iPAR = 0; iPAR <= numPARs; iPAR++){
1480  hAllTimeAvBCPAR[iPAR][i]->Write();
1481  //hAllTimeRMSBCPAR[iPAR][i]->Write();
1482  hAllTimeAvLGBCPAR[iPAR][i]->Write();
1483  //hAllTimeRMSLGBCPAR[iPAR][i]->Write();
1484  }
1485  }else{
1486  hAllTimeAvBC[i]->Write();
1487  hAllTimeRMSBC[i]->Write();
1488  hAllTimeAvLGBC[i]->Write();
1489  hAllTimeRMSLGBC[i]->Write();
1490  }
1491  }
1492 
1493  //AliWarning(Form("Histograms saved in %s file.",outputFile.Data()));
1494 
1495  fileNew->Close();
1496  delete fileNew;
1497 
1498  for(Int_t i=0;i<4;i++){
1499  delete hAllTimeAvBC[i];
1500  delete hAllTimeRMSBC[i];
1501  delete hAllTimeAvLGBC[i];
1502  delete hAllTimeRMSLGBC[i];
1503 
1504  delete h1[i];
1505  delete h2[i];
1506  delete h3[i];
1507  delete h4[i];
1508  delete h5[i];
1509  delete h6[i];
1510  }
1511 
1512  file->Close();
1513  delete file;
1514 
1515  //AliWarning("Pointers deleted. Memory cleaned.");
1516 }
1517 
1518 //________________________________________________________________________
1522 void AliAnalysisTaskEMCALTimeCalib::ProduceOffsetForSMsV2(Int_t runNumber,TString inputFile,TString outputFile, Bool_t offset100, Bool_t justL1phase, TString PARFilename){
1523 
1524 const Double_t lowerLimit[]={
1525  0,
1526  1152,
1527  2304,
1528  3456,
1529  4608,
1530  5760,
1531  6912,
1532  8064,
1533  9216,
1534  10368,
1535  11520,
1536  11904,
1537  12288,
1538  13056,
1539  13824,
1540  14592,
1541  15360,
1542  16128,
1543  16896,
1544  17280};
1545 
1546 const Double_t upperLimit[]={
1547  1151 ,
1548  2303 ,
1549  3455 ,
1550  4607 ,
1551  5759 ,
1552  6911 ,
1553  8063 ,
1554  9215 ,
1555  10367,
1556  11519,
1557  11903,
1558  12287,
1559  13055,
1560  13823,
1561  14591,
1562  15359,
1563  16127,
1564  16895,
1565  17279,
1566  17663};
1567 
1568  PARInfo info;
1569  info.numPARs = 0;
1570  Bool_t isPAR = kFALSE;
1571  if(PARFilename.Length() != 0){
1572  std::ifstream input;
1573  int inputrunnumber = 0, numPARs = 0;
1574  ULong64_t PAR = 0;
1575  input.open(PARFilename.Data());
1576  if(!input.good()){
1577  printf("PAR info file not accessable: %s\n", PARFilename.Data());
1578  return;
1579  }
1580  while(input.good()){
1581  input >> inputrunnumber >> numPARs;
1582  if(!input.good()) break;
1583  info.runNumber = inputrunnumber;
1584  info.numPARs = numPARs;
1585  //printf("\n\n!!!!\n\n from file: runnumber = %d, numPars = %d\n\n", info.runNumber, info.numPARs);
1586  if(numPARs <= 0 || numPARs > 10){
1587  printf("Number of PARS incorrectly found to be %d!\n", numPARs);
1588  return;
1589  }
1590  for(int iPAR = 0; iPAR < numPARs; iPAR++){
1591  input >> PAR;
1592  if(info.runNumber == runNumber){
1593  info.PARGlobalBCs.push_back(PAR);
1594  }
1595  }
1596  if(info.runNumber == runNumber) break;
1597  }
1598  input.close();
1599 
1600  if(info.runNumber != runNumber){
1601  isPAR = kFALSE;
1602  info.numPARs = 0;
1603  }else{
1604  isPAR = kTRUE;
1605  printf("info.runNumber = %d\n", info.runNumber);
1606  printf("info.numPARs = %d\n", info.numPARs);
1607  for(int i = 0; i < info.numPARs; i++){
1608  printf("info.PARGlobalBCs[%d] = %llu\n", i, info.PARGlobalBCs[i]);
1609  }
1610  }
1611  }
1612 
1613  TFile *file =new TFile(inputFile.Data());
1614  if(file==0x0) return;
1615 
1616  TH1F *ccBC[4];
1617  Bool_t shouldBeEmpty[4];
1618  TH1F *ccBCPAR[info.numPARs+1][4];
1619  Int_t emptyCounter;
1620  Bool_t shouldBeEmptyPAR[info.numPARs+1][4];
1621 
1622  for(Int_t i = 0; i < kNBCmask; i++){
1623  if(isPAR){
1624  for(Int_t iPAR = 0; iPAR <= info.numPARs; iPAR++){
1625  ccBCPAR[iPAR][i] = (TH1F*)file->Get(Form("hAllTimeAvPAR%dBC%d", iPAR, i));
1626  shouldBeEmptyPAR[iPAR][i]=kFALSE;
1627  emptyCounter=0;
1628  for(Int_t j=0;j<upperLimit[19];j++){
1629  if(ccBCPAR[iPAR][i]->GetBinContent(j)>0.) emptyCounter++;
1630  }
1631  if(emptyCounter<1500) shouldBeEmptyPAR[iPAR][i]=kTRUE;
1632  printf("Non-zero channels %d BC %d should be empty: %d \n",emptyCounter,i,shouldBeEmptyPAR[iPAR][i]);
1633 
1634  }
1635  }else{
1636  ccBC[i]=(TH1F*) file->Get(Form("hAllTimeAvBC%d",i));
1637  shouldBeEmpty[i]=kFALSE;
1638  emptyCounter=0;
1639  for(Int_t j=0;j<upperLimit[19];j++){
1640  if(ccBC[i]->GetBinContent(j)>0.) emptyCounter++;
1641  }
1642  if(emptyCounter<1500) shouldBeEmpty[i]=kTRUE;
1643  printf("Non-zero channels %d BC %d should be empty: %d \n",emptyCounter,i,shouldBeEmpty[i]);
1644  }
1645  }
1646 
1647 
1648  TH1C *hRun=new TH1C(Form("h%d",runNumber),Form("h%d",runNumber),19,0,19);
1649  TH1C *hPARRun[info.numPARs+1];
1650  Int_t fitResult=0;
1651  Double_t minimumValue=10000.;
1652  Int_t minimumIndex=-1;
1653  Double_t meanBC[4];
1654 
1655  Double_t fitParameter=0;
1656  TF1 *f1=new TF1("f1","pol0",0,17664);
1657  Bool_t orderTest=kTRUE;
1658  Int_t iorder=0;//order index
1659  Int_t j=0;//BC index
1660  Int_t L1shift=0;
1661  Int_t totalValue=0;
1662 
1663  for(Int_t iPAR = 0; iPAR <= info.numPARs; iPAR++){
1664  if(iPAR != info.numPARs){
1665  hPARRun[iPAR] =new TH1C(Form("h%d_%llu", runNumber, info.PARGlobalBCs[iPAR]), Form("h%d_%llu", runNumber, info.PARGlobalBCs[iPAR]),19,0,19);
1666  }else{
1667  hPARRun[iPAR] =new TH1C(Form("h%d", runNumber), Form("h%d", runNumber),19,0,19);
1668  }
1669  for(Int_t i=0;i<20;i++){
1670  minimumValue=10000;
1671  for(j=0;j<kNBCmask;j++){
1672  if(isPAR){
1673  if(shouldBeEmptyPAR[iPAR][j]){
1674  meanBC[j]=-1;
1675  continue;
1676  }
1677  }else{
1678  if(shouldBeEmpty[j]) {
1679  meanBC[j]=-1;
1680  continue;
1681  }
1682  }
1683  if(isPAR){
1684  fitResult=ccBCPAR[iPAR][j]->Fit("f1", "CQ", "", lowerLimit[i],upperLimit[i]);
1685  }else{
1686  fitResult=ccBC[j]->Fit("f1","CQ","",lowerLimit[i],upperLimit[i]);
1687  }
1688  if(fitResult<0){
1689  //hRun->SetBinContent(i,0);//correct it please
1690  meanBC[j]=-1;
1691  if(isPAR){
1692  printf("Fit failed for SM %d BC%d, integral %f\n",i,j,ccBCPAR[iPAR][j]->Integral(lowerLimit[i],upperLimit[i]));
1693  }else{
1694  printf("Fit failed for SM %d BC%d, integral %f\n",i,j,ccBC[j]->Integral(lowerLimit[i],upperLimit[i]));
1695  }
1696  continue;
1697  } else {
1698  fitParameter = f1->GetParameter(0);
1699  }
1700  if(offset100 && (j==0 || j==1)) {
1701  //the 100 ns offset was removed in LHC15n muon_calo_pass1 and further reconstructions
1702  fitParameter+=100;
1703  }
1704  meanBC[j]=fitParameter;
1705 
1706  if(fitParameter>0 && fitParameter<minimumValue){
1707  minimumValue = fitParameter;
1708  minimumIndex = j;
1709  }
1710  }
1711 
1712  if( minimumValue/25-(Int_t)(minimumValue/25)>0.5 ) {
1713  L1shift=(Int_t)(minimumValue/25.)+1;
1714  } else {
1715  L1shift=(Int_t)(minimumValue/25.);
1716  }
1717 
1718  if(TMath::Abs(minimumValue/25-(Int_t)(minimumValue/25)-0.5)<0.05)
1719  printf("Run %d, SM %d, min %f, next_min %f, next+1_min %f, next+2_min %f, min/25 %f, min%%25 %d, next_min/25 %f, next+1_min/25 %f, next+2_min/25 %f, SMmin %d\n",runNumber,i,minimumValue,meanBC[(minimumIndex+1)%4],meanBC[(minimumIndex+2)%4],meanBC[(minimumIndex+3)%4],minimumValue/25., (Int_t)((Int_t)minimumValue%25), meanBC[(minimumIndex+1)%4]/25., meanBC[(minimumIndex+2)%4]/25., meanBC[(minimumIndex+3)%4]/25., L1shift*25);
1720 
1721  if(justL1phase) totalValue = minimumIndex;
1722  else totalValue = L1shift<<2 | minimumIndex ;
1723  //printf("L1 phase %d, L1 shift %d *25ns= %d, L1p+L1s %d, total %d, L1pback %d, L1sback %d\n",minimumIndex,L1shift,L1shift*25,minimumIndex+L1shift,totalValue,totalValue&3,totalValue>>2);
1724 
1725  if(isPAR){
1726  hPARRun[iPAR]->SetBinContent(i,totalValue);
1727  }else{
1728  hRun->SetBinContent(i,totalValue);
1729  }
1730  orderTest=kTRUE;
1731  for(iorder=minimumIndex;iorder<minimumIndex+4-1;iorder++){
1732  if( meanBC[(iorder+1)%4] <= meanBC[iorder%4] ) orderTest=kFALSE;
1733  }
1734  if(!orderTest)
1735  printf("run %d, SM %d, min index %d meanBC %f %f %f %f, order ok? %d\n",runNumber,i,minimumIndex,meanBC[0],meanBC[1],meanBC[2],meanBC[3],orderTest);
1736 
1737  //patch for runs with not filled one, two or three BCs
1738  //manual patch for LHC16q - pPb@5TeV - only BC0 is filled and phase rotate
1739  if(shouldBeEmpty[0] || shouldBeEmpty[1] || shouldBeEmpty[2] || shouldBeEmpty[3]){
1740  Double_t newMean = meanBC[minimumIndex]-600;
1741  if(newMean<=12.5){
1742  if(isPAR){
1743  hPARRun[iPAR]->SetBinContent(i,minimumIndex);
1744  }else{
1745  hRun->SetBinContent(i,minimumIndex);
1746  }
1747  } else {
1748  Int_t minIndexTmp=-1;
1749  if(newMean/25. - (Int_t)(newMean/25.) <0.5)
1750  minIndexTmp = (Int_t)(newMean/25.);
1751  else
1752  minIndexTmp = 1+(Int_t)(newMean/25.);
1753 
1754  if(isPAR){
1755  hPARRun[iPAR]->SetBinContent(i,(4-minIndexTmp+minimumIndex)%4);
1756  }else{
1757  hRun->SetBinContent(i,(4-minIndexTmp+minimumIndex)%4);
1758  }
1759  //cout<<newMean/25.<<" int "<<(Int_t)(newMean/25.)<<" dif "<< newMean/25.-(Int_t)(newMean/25.)<<endl;
1760  }
1761  if(isPAR){
1762  printf("run with missing BC; new L1 phase set to %d\n",(Int_t)hPARRun[iPAR]->GetBinContent(i));
1763  }else{
1764  printf("run with missing BC; new L1 phase set to %d\n",(Int_t)hRun->GetBinContent(i));
1765  }
1766  }//end of patch for LHC16q and other runs with not filled BCs
1767  }//end of loop over SM
1768  }//end of loop over PARs
1769 
1770  delete f1;
1771  TFile *fileNew=new TFile(outputFile.Data(),"update");
1772  if(isPAR){
1773  for(Int_t iPAR = 0; iPAR <= info.numPARs; iPAR++){
1774  hPARRun[iPAR]->Write();
1775  }
1776  }else{
1777  hRun->Write();
1778  }
1779  fileNew->Close();
1780  delete fileNew;
1781 
1782  file->Close();
1783  delete file;
1784 }
1785 
1786 //____________________________________________________
1788 {
1789  if(fBadChannelMapSet) return;
1790  AliOADBContainer *contBC=new AliOADBContainer("");
1791  contBC->InitFromFile(AliDataFile::GetFileNameOADB("EMCAL/EMCALBadChannels.root").data(),"AliEMCALBadChannels");
1792  printf("contBC %p, ent %d\n",contBC,contBC->GetNumberOfEntries());
1793  TObjArray *arrayBC=(TObjArray*)contBC->GetObject(fRunNumber);
1794  if(arrayBC) {
1795  AliInfo("Remove EMCAL bad cells");
1797  for (Int_t i=0; i<kNSM; ++i) {
1798  TH2I *hbm = (TH2I*)arrayBC->FindObject(Form("EMCALBadChannelMap_Mod%d",i));
1799  if (!hbm) {
1800  AliError(Form("Can not get EMCALBadChannelMap_Mod%d",i));
1801  continue;
1802  }
1803  hbm->SetDirectory(0);
1804  fBadChannelMapArray->AddAt(hbm,i);
1805 
1806  } // loop over SMs
1807  } else AliInfo("Do NOT remove EMCAL bad channels\n"); // run array
1808 
1809  delete contBC;
1810  fBadChannelMapSet = kFALSE;//BC map is not fixed at the beginning but can change r-by-r
1811 } // Bad channel map loaded
1812 
1813 //____________________________________________________
1815 {
1816  if(fBadChannelMapSet) return;
1817 
1818  TFile *referenceFile = TFile::Open(fBadChannelFileName.Data());
1819  if(referenceFile==0x0) {
1820  AliFatal("*** NO bad channel map FILE");
1821  }
1822 
1823  TH1F *hbm = (TH1F*)referenceFile->Get("h1");
1824  if (!hbm) {
1825  AliError("Can not get EMCALBadChannelMap");
1826  }
1827  fBadChannelMapArray = new TObjArray(1);
1828  fBadChannelMapArray->AddAt(hbm,0);
1829  fBadChannelMapSet=kTRUE;//BC map is fixed at the beginning for whole dataset
1830 } // Bad channel map loaded
1831 
1832 
1833 //_____________________________________________________________________
1838 }
1839 
1840 //_____________________________________________________________________
1841 // Load PAR info from text file
1843  std::ifstream input;
1844  int runnumber = 0, numPARs = 0, numRuns=0;
1845  ULong64_t PAR = 0;
1846  gSystem->ExpandPathName(PARFileName);
1847  //handle case of PAR file in Alien location, needs to be copied to working directory before ifstream can open.
1848  if(PARFileName.Contains("alien://")){
1849  TString localFileName(gSystem->BaseName(PARFileName.Data()));
1850  TFile::Cp(PARFileName.Data(), localFileName.Data());
1851  PARFileName = localFileName;
1852  }
1853  input.open(PARFileName.Data());
1854  if(!input.good()){
1855  AliFatal(Form("PAR info file not accessable: %s", PARFileName.Data()));
1856  }
1857  while(input.good()){
1858  input >> runnumber >> numPARs;
1859  if(!input.good()) break;
1860  PARInfo info;
1861  info.runNumber = runnumber;
1862  info.numPARs = numPARs;
1863  //printf("\n\n!!!!\n\n from file: runnumber = %d, numPars = %d\n\n", info.runNumber, info.numPARs);
1864  if(numPARs <= 0 || numPARs > 10){
1865  AliFatal(Form("Number of PARS incorrectly found to be %d!", numPARs));
1866  }
1867  for(int iPAR = 0; iPAR < numPARs; iPAR++){
1868  input >> PAR;
1869  info.PARGlobalBCs.push_back(PAR);
1870  }
1871  fPARvec.push_back(info);
1872  numRuns++;
1873  }
1874  printf("number of runs processed in PAR file: %d\n", numRuns);
1875  input.close();
1876 }
1877 
1878 //_______________________________________________________________________
1879 // Get Par info for the current run number, set-up PAR info variables
1881  if(runnum < 200000) AliFatal(Form("Bad Run Number %d passed to GetPARInfo!", runnum));
1882  if(fRunNumber!=runnum) fRunNumber = runnum;
1883  fIsPARRun = kFALSE;
1885  for(int iPARrun = 0; iPARrun < fPARvec.size(); iPARrun++){
1886  //printf("from stored vectors: %d %d", fPARvec[iPARrun].runNumber, fPARvec[iPARrun].numPARs);
1887  //for(int i = 0; i < fPARvec[iPARrun].numPARs; i++){
1888  // printf(" %llu", fPARvec[iPARrun].PARGlobalBCs[i]);
1889  //}
1890  //printf("\n");
1891  if (fRunNumber==fPARvec[iPARrun].runNumber){
1892  //set PAR flag & setup copy of specific PAR info
1893  fIsPARRun = kTRUE;
1895  fCurrentPARs.numPARs = fPARvec[iPARrun].numPARs;
1896  for(int ipar = 0; ipar < fPARvec[iPARrun].numPARs; ipar++){
1897  fCurrentPARs.PARGlobalBCs.push_back(fPARvec[iPARrun].PARGlobalBCs[ipar]);
1898  }
1899  }
1900  }
1901 }
Bool_t SetEMCalGeometry()
Set the EMCal Geometry.
TH1F * fhRawTimeEntriesLGBC[kNBCmask]
! 4 BCmask LG
Double_t fPassTimeMax
upper range of histo with time in passX
TH2F * fhEneVsAbsIdHG
! energy of each cell for high gain cells with strange time
TH1F * fhRawTimeSumLGBC[kNBCmask]
! 4 BCmask LG
Bool_t AcceptCluster(AliVCluster *clus)
Selection criteria of good cluster are set here.
TH2F * fhRawTimeVsIdBC[kNBCmask]
! 4 BCmask HG
double Double_t
Definition: External.C:58
Int_t fFineNbins
number of bins of histo with T0 time
Definition: External.C:236
TH1F * fhRawTimeSumSqBC[kNBCmask]
! 4 BCmask HG
Double_t fMinLambda0
minimum cluster lambda0
Int_t fCurrentPARIndex
Par Info for current Run Number.
Int_t fEnergyLGNbins
number of bins of histo with energy LG
Int_t GetEMCALChannelStatus(Int_t iSM, Int_t iCol, Int_t iRow) const
TH1F * fhcalcEvtTime
! spectrum calcolot0[0]
Bool_t fBadReco
flag to apply 100ns shift and L1 shift
Double_t fEnergyMin
lower range of histo with energy HG
TString fReferenceRunByRunFileName
name of reference file (run-by-run)
TObjArray * fL1PhaseList
array with phases for set of runs
std::vector< std::vector< TH2F * > > fhRawTimeLGPARs
!
TSystem * gSystem
Double_t fMinTime
minimum cluster time after correction
Double_t fFineTmax
upper range of histo with T0 time
void SetDefaultCuts()
Set default cuts for calibration.
Int_t fSetBadChannelMapSource
switch to load BC map 0-no BC,1-OADB,2-file
void LoadBadChannelMap()
Load Bad Channel Map from different source.
Double_t fRawTimeMin
lower range of histo with raw time
TH2F * fhTimeDsupLG[kNSM]
! 20 SM low gain
TH1F * fhRawTimeSumSqLGBC[kNBCmask]
! 4 BCmask LG
Double_t fMaxRtrack
maximum cluster track distance
Double_t fMaxLambda0
maximum cluster lambda0
AliEMCALGeometry * fgeom
pointer to EMCal geometry
Double_t fRawTimeMax
upper range of histo with raw time
TH2F * fhTcellvsTOFT0HD
! time of cell vs TOF T0 time for higher energy threshold
TH2F * fhRawCorrTimeVsIdBC[kNBCmask]
! 4 BCmask HG
Bool_t fMostEneCellOnly
flag to use calibration on most energetic cell in cluster only
TH2F * fhRawCorrTimeVsIdLGBC[kNBCmask]
! 4 BCmask LG
Bool_t IsLowGainCellInCluster(AliVCluster *clus)
Check if low gain cell is in a cluster.
Double_t fMaxTime
maximum cluster time after correction
int Int_t
Definition: External.C:63
std::vector< std::vector< TH2F * > > fhRawTimePARs
!
Double_t fEnergyMax
upper range of histo with energy HG
Double_t fMinClusterEnergy
minimum cluster energy
float Float_t
Definition: External.C:68
TObjArray * fBadChannelMapArray
bad channel map array
static void ProduceCalibConsts(TString inputFile="time186319testWOL0.root", TString outputFile="Reference.root", Bool_t isFinal=kFALSE, Bool_t isPAR=kFALSE)
Double_t fEnergyLGMax
upper range of histo with energy LG
Double_t fFineTmin
lower range of histo with T0 time
TString fReferenceFileName
! name of reference file (for one period)
Int_t fMaxNcells
maximum number of cells in cluster
std::vector< PARInfo > fPARvec
vector of PAR info for all runs
Definition: External.C:228
virtual void UserExec(Option_t *option)
Main loop executed for each event.
virtual void PrepareTOFT0maker()
Get T0 time from TOF.
Bool_t fPileupFromSPD
flag to set PileupFromSPD
TH1F * fhRawTimeSumBC[kNBCmask]
! 4 BCmask HG
Double_t fMinCellEnergy
minimum cell energy
Int_t fMinNcells
minimum number of cells in cluster
Double_t fEnergyLGMin
lower range of histo with energy LG
Task to work on Time Calibration for EMCal/DCal.
Double_t fMinLambda0LG
minimum cluster lambda0 Low Gain
Double_t fMaxClusterEnergy
maximum cluster energy
Bool_t fBadChannelMapSet
flag whether bad channel map is set
TH1F * fhEvtTimeHeader
! spectrum time from header
TH1F * fhEvtTimeDiff
! spectrum time difference
TH2F * fhTcellvsTOFT0
! time of cell vs TOF T0 time
Double_t fPassTimeMin
lower range of histo with time in passX
Double_t fMaxLambda0LG
maximum cluster lambda0 Low Gain
static void ProduceOffsetForSMsV2(Int_t runNumber, TString inputFile="Reference.root", TString outputFile="ReferenceSM.root", Bool_t offset100=kTRUE, Bool_t justL1phase=kTRUE, TString PARfilename="")
TH2F * fhEneVsAbsIdLG
! energy of each cell for low gain cells with strange time
Int_t fPassTimeNbins
number of bins of histo with time in passX
TList * fOutputList
pointer to output list
TH1F * fhRawTimeEntriesBC[kNBCmask]
! 4 BCmask HG
Bool_t fIsPARRun
Which PAR the currnt event is after.
TH2F * fhTimeVsIdBC[kNBCmask]
! 4 BCmask HG
TFile * file
TList with histograms for a given trigger.
TH2F * fhTimeVsIdLGBC[kNBCmask]
! 4 BCmask LG
unsigned short UShort_t
Definition: External.C:28
const char Option_t
Definition: External.C:48
Bool_t CheckCellRCU(Int_t nSupMod, Int_t icol, Int_t irow)
Check RCU for cell given by Super Module, column index, row index.
TH2F * fhRawTimeVsIdLGBC[kNBCmask]
! 4 BCmask LG
void LoadReferenceHistos()
Load reference Histograms (for one period) from file.
bool Bool_t
Definition: External.C:53
TString fBadChannelFileName
name of file with bad channels
TH1F * fhAllAverageLGBC[kNBCmask]
4 BCmask High gain
Bool_t fFillHeavyHisto
flag to fill heavy histograms
Int_t fEnergyNbins
number of bins of histo with energy HG
Int_t fRawTimeNbins
number of bins of histo with raw time
TH2F * fhTimeDsup[kNSM]
! 20 SM high gain
void GetPARInfoForRunNumber(Int_t runnum)
Does current run have PAR info?
TH2F * fhTimeDsupBC[kNSM][kNBCmask]
! 20 x 4 high gain
TH2F * fhTimeDsupLGBC[kNSM][kNBCmask]
! 20 x 4 low gain