26 #include <TGeoManager.h>
27 #include <TRefArray.h>
31 #include "AliAnalysisTask.h"
32 #include "AliAnalysisManager.h"
33 #include "AliESDEvent.h"
34 #include "AliAODEvent.h"
35 #include "AliVEvent.h"
36 #include "AliESDInputHandler.h"
37 #include "AliAODInputHandler.h"
38 #include "AliESDpid.h"
39 #include "AliTOFcalib.h"
40 #include "AliCDBManager.h"
41 #include "AliRunTag.h"
43 #include "AliTOFT0maker.h"
44 #include "AliVCluster.h"
45 #include "AliESDCaloCluster.h"
46 #include "AliVCaloCells.h"
47 #include "AliESDCaloCells.h"
48 #include "AliAODCaloCluster.h"
49 #include "AliAODCaloCells.h"
50 #include "AliEMCALGeometry.h"
51 #include "AliOADBContainer.h"
65 : AliAnalysisTaskSE(name),
82 fReferenceRunByRunFileName(),
83 fPileupFromSPD(kFALSE),
103 fFillHeavyHisto(kFALSE),
104 fBadChannelMapArray(),
105 fBadChannelMapSet(kFALSE),
106 fSetBadChannelMapSource(0),
107 fBadChannelFileName(),
112 fhTOFT0vsEventNumber(0),
134 fhRawTimeEntriesBC(),
138 fhRawTimeEntriesLGBC(),
139 fhRawTimeSumSqLGBC(),
140 fhRawCorrTimeVsIdBC(),
141 fhRawCorrTimeVsIdLGBC(),
182 DefineInput(0, TChain::Class());
186 DefineOutput(1, TList::Class());
209 AliFatal(
"*** NO REFERENCE FILE");
211 AliDebug(1,
"*** OK TFILE");
216 if(
fhAllAverageBC[i]==0x0) AliFatal(Form(
"Reference histogram for BC%d does not exist",i));
217 if(
fhAllAverageBC[i]->GetEntries()==0)AliWarning(Form(
"fhAllAverageLGBC[%d]->GetEntries() = 0",i));
219 if(
fhAllAverageLGBC[i]==0x0) AliFatal(Form(
"Reference LG histogram for BC%d does not exist",i));
220 if(
fhAllAverageLGBC[i]->GetEntries()==0)AliFatal(Form(
"fhAllAverageLGBC[%d]->GetEntries() = 0",i));
223 AliDebug(1,Form(
"hAllAverage entries BC0 %d", (Int_t)
fhAllAverageBC[0]->GetEntries() ));
224 AliDebug(1,Form(
"hAllAverage entries BC2 %d",(Int_t)
fhAllAverageBC[2]->GetEntries() ));
225 AliDebug(1,Form(
"hAllAverageLG entries BC0 %d", (Int_t)
fhAllAverageLGBC[0]->GetEntries() ));
226 AliDebug(1,Form(
"hAllAverageLG entries BC2 %d",(Int_t)
fhAllAverageLGBC[2]->GetEntries() ));
230 AliFatal(
"You require to load reference histos from file but FILENAME is not provided");
242 if(referenceFile==0x0) {
243 AliFatal(
"*** NO REFERENCE R-B-R FILE");
250 TIter next(referenceFile->GetListOfKeys());
252 while ((key=(TKey*)next())) {
253 fL1PhaseList->AddLast((TH1F*)referenceFile->Get(key->GetName()) );
258 AliFatal(
"You require to load reference run-by-run histos from file but FILENAME is not provided");
270 AliFatal(
"Array with reference L1 phase histograms do not exist in memory");
274 AliFatal(
"Negative run number");
280 AliError(Form(
"Reference histogram for run %d does not exist. Use Default",
fRunNumber));
289 if(
fhRefRuns->GetEntries()==0)AliWarning(
"fhRefRuns->GetEntries() = 0");
290 AliDebug(1,Form(
"hRefRuns entries %d", (Int_t)
fhRefRuns->GetEntries() ));
298 AliDebug(1,
"AnalysisTaskEMCalTimeCalib::NotifyRun()");
299 AliDebug(2,Form(
"Notify(): EMCal geometry: fgeom = %p, fGeometryName=%s\n ",
fgeom,
fGeometryName.Data()));
303 AliFatal(
"ERROR: InputEvent not set");
306 else AliDebug(1,
"Good, InputEvent set");
330 AliDebug(1,
"AliAnalysisTaskEMCALTimeCalib::SetEMCalGeometry()");
333 AliInfo(Form(
"Get EMCAL geometry name <%s> for run %d",
fgeom->GetName(),
fRunNumber));
336 AliInfo(Form(
"Set EMCAL geometry name to <%s>",
fGeometryName.Data()));
340 AliWarning(
"Make sure the EMCal geometry is set properly !");
342 AliDebug(1,Form(
"EMCal geometry properly set: fGeom = %p, fGeometryName=%s",
fgeom,
fGeometryName.Data()));
353 AliInfo(Form(
"<D> -- Run # = %d",
fRunNumber));
354 AliInfo(
"prepare TOFT0maker!!");
358 AliCDBManager * cdb = AliCDBManager::Instance();
359 cdb->SetDefaultStorage(
"raw://");
362 AliESDpid *extPID=
new AliESDpid();
384 AliDebug(1,
"AliAnalysisTaskEMCALTimeCalib::UserCreateOutputObjects()");
386 const Int_t nChannels = 17664;
402 fhEventType =
new TH1F(
"fhEventType",
"event type",10, 0.,10.);
404 fhEventType ->GetYaxis()->SetTitle(
"Counts (a.u.)");
412 fhEneVsAbsIdHG =
new TH2F(
"fhEneVsAbsIdHG",
"energy vs ID for HG",1000,0,18000,200,0,10);
413 fhEneVsAbsIdLG =
new TH2F(
"fhEneVsAbsIdLG",
"energy vs ID for LG",1000,0,18000,200,0,40);
416 for (Int_t i = 0; i <
kNBCmask ; i++)
421 Form(
"cell Sum Square time HG, BC %d ", i),
422 nChannels,0.,(Double_t)nChannels);
426 fhTimeSum[i] =
new TH1F(Form(
"hTimeSum%d", i),
427 Form(
"cell Sum time HG, BC %d ", i),
428 nChannels,0.,(Double_t)nChannels);
432 fhTimeEnt[i] =
new TH1F(Form(
"hTimeEnt%d", i),
433 Form(
"cell Entries HG, BC %d ", i),
434 nChannels,0.,(Double_t)nChannels);
435 fhTimeEnt[i]->SetYTitle(
"Entries for Time ");
440 Form(
"cell Sum Square time LG, BC %d ", i),
441 nChannels,0.,(Double_t)nChannels);
446 Form(
"cell Sum time LG, BC %d ", i),
447 nChannels,0.,(Double_t)nChannels);
452 Form(
"cell Entries LG, BC %d ", i),
453 nChannels,0.,(Double_t)nChannels);
461 Form(
"cell raw time vs ID for high gain BC %d ", i),
468 Form(
"sum of cell raw time for high gain BC %d ", i),
469 nChannels,0.,(Double_t)nChannels);
474 Form(
"No. entries of cells raw time for high gain BC %d ", i),
475 nChannels,0.,(Double_t)nChannels);
480 Form(
"sum of (cell raw time)^2 for high gain BC %d ", i),
481 nChannels,0.,(Double_t)nChannels);
488 Form(
"cell raw time vs ID for low gain BC %d ", i),
495 Form(
"sum of cell raw time for low gain BC %d ", i),
496 nChannels,0.,(Double_t)nChannels);
501 Form(
"No. entries of cells raw time for low gain BC %d ", i),
502 nChannels,0.,(Double_t)nChannels);
507 Form(
"sum of (cell raw time)^2 for low gain BC %d ", i),
508 nChannels,0.,(Double_t)nChannels);
515 Form(
"cell L1 shift and 100ns corrected raw time vs ID for high gain BC %d ", i),
521 Form(
"cell L1 shift and 100ns corrected raw time vs ID for low gain BC %d ", i),
530 Form(
"cell time corrected for L1 shift, 100ns and L1 phase vs ID for high gain BC %d ", i),
536 Form(
"cell time corrected for L1 shift, 100ns and L1 phase vs ID for low gain BC %d ", i),
542 for (Int_t j = 0; j <
kNSM ; j++)
546 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);
551 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);
557 for (Int_t jj = 0; jj <
kNSM ; jj++)
560 fhTimeDsup[jj] =
new TH2F(Form(
"SupMod%d",jj), Form(
"SupMod %d time_vs_E, high gain",jj),
fEnergyNbins,
fEnergyMin,
fEnergyMax,
fPassTimeNbins,
fPassTimeMin,
fPassTimeMax);
565 fhTimeDsupLG[jj] =
new TH2F(Form(
"SupMod%dLG",jj), Form(
"SupMod %d time_vs_E, low gain ",jj),
fEnergyLGNbins,
fEnergyLGMin,
fEnergyLGMax,
fPassTimeNbins,
fPassTimeMin,
fPassTimeMax);
588 for (Int_t i = 0; i <
kNBCmask ; i++)
620 for (Int_t j = 0; j <
kNSM ; j++){
626 for (Int_t j = 0; j <
kNSM ; j++)
645 AliDebug(2,Form(
"UserExec: EMCal geometry: fgeom = %p fGeometryName %s",
fgeom,
fGeometryName.Data()));
646 AliVEvent *
event = InputEvent();
649 AliDebug(2,Form(
"TOF time from header %f ps",event->GetTOFHeader()->GetDefaultEventTimeVal()));
654 AliError(
"ESD not available, exit");
660 if(event->IsPileupFromSPD(3,0.8,3.,2.,5.)){
661 AliDebug(1,
"Event: PileUp skip.");
667 TString triggerclasses =
event->GetFiredTriggerClasses();
668 if(triggerclasses==
"") {
673 Int_t eventType = ((AliVHeader*)event->GetHeader())->GetEventType();
675 AliDebug(1,Form(
"Triggerclasses %s, eventType %d",triggerclasses.Data(),eventType));
684 Bool_t bL1G = kFALSE;
685 Bool_t bL1J = kFALSE;
687 if(triggerclasses.Contains(
"CINT7-B-NOPF-ALLNOTRD") ||
688 triggerclasses.Contains(
"CINT7-I-NOPF-ALLNOTRD") ||
689 triggerclasses.Contains(
"CINT1-I-NOPF-ALLNOTRD") ||
690 triggerclasses.Contains(
"CINT1-B-NOPF-ALLNOTRD") ||
691 triggerclasses.Contains(
"CINT8") ||
692 triggerclasses.Contains(
"CINT7") ||
693 triggerclasses.Contains(
"CPBI2_B1-B-NOPF-ALLNOTRD") ) bMB = kTRUE;
695 if(triggerclasses.Contains(
"CEMC7-B-NOPF-CENTNOTRD") ||
696 triggerclasses.Contains(
"CEMC1-B-NOPF-CENTNOTRD") ||
697 triggerclasses.Contains(
"CEMC7") ||
698 triggerclasses.Contains(
"CEMC8") ||
699 triggerclasses.Contains(
"CEMC8-B-NOPF-CENTNOTRD") ) bL0 = kTRUE;
701 if(triggerclasses.Contains(
"CEMC7EG1-B-NOPF-CENTNOTRD") ||
702 triggerclasses.Contains(
"CEMC7EG2-B-NOPF-CENTNOTRD") ||
703 triggerclasses.Contains(
"CEMC8EG1-B-NOPF-CENTNOTRD") ||
704 triggerclasses.Contains(
"CEMC8EGA") ||
705 triggerclasses.Contains(
"CEMC7EGA") ||
706 triggerclasses.Contains(
"CPBI2EGA") ) bL1G = kTRUE;
709 if(triggerclasses.Contains(
"CEMC7EJ1-B-NOPF-CENTNOTRD") ||
710 triggerclasses.Contains(
"CEMC7EJ2-B-NOPF-CENTNOTRD") ||
711 triggerclasses.Contains(
"CEMC8EJ1-B-NOPF-CENTNOTRD") ||
712 triggerclasses.Contains(
"CEMC7EJE") ||
713 triggerclasses.Contains(
"CEMC8EJE") ||
714 triggerclasses.Contains(
"CPBI2EJE") ) bL1J = kTRUE;
716 if( bL1G || bL1J || bL0 ){
fhEventType->Fill(4.5);}
731 Double_t calcolot0=0.0;
733 Double_t* timeTOFtable;
734 timeTOFtable=
fTOFmaker->ComputeT0TOF(dynamic_cast<AliESDEvent*>(event));
735 AliDebug(2,Form(
"TOF time %f ps, resolution %f ps, tracks at TOF %f/used %f",timeTOFtable[0],timeTOFtable[1],timeTOFtable[3],timeTOFtable[7]));
737 calcolot0=timeTOFtable[0];
742 if(calcolot0 != 0 && event->GetTOFHeader()->GetDefaultEventTimeVal() != 0 )
743 fhEvtTimeDiff->Fill(calcolot0-event->GetTOFHeader()->GetDefaultEventTimeVal());
746 TRefArray* caloClusters =
new TRefArray();
747 event->GetEMCALClusters(caloClusters);
750 Int_t BunchCrossNumber =
event->GetBunchCrossNumber();
753 Float_t offsetPerSM=0.;
754 Int_t L1phaseshift=0;
756 Int_t L1shiftOffset=0;
759 nBC = BunchCrossNumber%4;
762 Float_t timeBCoffset = 0.;
765 Int_t nclus = caloClusters->GetEntries();
766 AliDebug(1,Form(
"###########Bunch Cross nb = %d nclus = %d",nBC,nclus ));
770 AliVCaloCells &cells= *(
event->GetEMCALCells());
772 Int_t nSupMod=-1, nModule=-1;
773 Int_t iphi=-1, ieta=-1, nIphi=-1, nIeta=-1;
777 Bool_t isHighGain=kTRUE;
779 for (Int_t icl = 0; icl < nclus; icl++) {
781 AliVCluster* clus = (AliVCluster*)caloClusters->At(icl);
786 UShort_t * index = clus->GetCellsAbsId() ;
788 for(Int_t i = 0; i < clus->GetNCells() ; i++) {
790 hkdtime = cells.GetCellTime(absId) * 1.0e09;
791 amp = cells.GetCellAmplitude(absId) ;
792 isHighGain = cells.GetCellHighGain(absId);
795 fgeom->GetCellIndex(absId, nSupMod, nModule, nIphi, nIeta);
796 fgeom->GetCellPhiEtaIndexInSModule(nSupMod,nModule,nIphi,nIeta, iphi,ieta);
830 fhTimeVsBC->Fill(1.*BunchCrossNumber,hkdtime-timeBCoffset);
832 if(isHighGain==kTRUE){
836 AliFatal(Form(
"Reference histogram for BC%d not properly loaded",nBC));
842 AliFatal(Form(
"Reference LG histogram for BC%d not properly loaded",nBC));
852 L1phaseshift = (Int_t)(
fhRefRuns->GetBinContent(nSupMod));
857 L1phase = L1phaseshift & 3;
859 offsetPerSM = (nBC - L1phase)*25;
861 offsetPerSM = (nBC - L1phase + 4)*25;
866 L1shiftOffset = L1phaseshift>>2;
869 if(nBC==0 || nBC==1) L1shiftOffset-=100.;
872 AliFatal(
"Reference histogram run-by-run not properly loaded");
888 fhTimeVsIdBC[nBC]->Fill(absId,hkdtime-L1shiftOffset-offsetPerSM);
890 fhTimeVsIdLGBC[nBC]->Fill(absId,hkdtime-L1shiftOffset-offsetPerSM);
897 fhTimeDsup[nSupMod]->Fill(amp,hkdtime-offset-offsetPerSM-L1shiftOffset);
898 fhTimeDsupBC[nSupMod][nBC]->Fill(amp,hkdtime-offset-offsetPerSM-L1shiftOffset);
900 fhTimeDsupLG[nSupMod]->Fill(amp,hkdtime-offset-offsetPerSM-L1shiftOffset);
901 fhTimeDsupLGBC[nSupMod][nBC]->Fill(amp,hkdtime-offset-offsetPerSM-L1shiftOffset);
909 fhTcellvsTOFT0->Fill(calcolot0, hkdtime-offset-offsetPerSM-L1shiftOffset);
912 hkdtime = hkdtime-timeBCoffset;
914 hkdtimecorr= hkdtime-offset-offsetPerSM-L1shiftOffset;
929 hkdtime = hkdtime - offsetPerSM - L1shiftOffset;
949 caloClusters->Delete();
961 fOutputList =
dynamic_cast<TList*
> (GetOutputData(1));
978 AliDebug(1,
"ERROR: Output list not available");
988 Int_t nCells = clus->GetNCells();
993 AliDebug(1,
"very big cluster with enormous energy - cluster rejected");
999 Double_t lambda0=clus->GetM02();
1001 AliDebug(1,
"lambda0 loose cut failed - cluster rejected");
1006 Double_t Dx=clus->GetTrackDx();
1007 Double_t Dz=clus->GetTrackDz();
1008 Double_t Rtrack = TMath::Sqrt(Dx*Dx+Dz*Dz);
1011 AliDebug(1,
"track matched - cluster rejected");
1017 AliDebug(1,
"single cell cluster - cluster rejected");
1023 AliDebug(1,
"cluster energy < 1 GeV- cluster rejected");
1031 AliDebug(1,
"lambda0 strict cut failed - cluster rejected");
1045 UShort_t * index = clus->GetCellsAbsId() ;
1046 AliVCaloCells &cells= *(InputEvent()->GetEMCALCells());
1047 for(Int_t i = 0; i < clus->GetNCells() ; i++) {
1048 if(cells.GetCellHighGain(index[i])==kFALSE)
return kTRUE;
1059 if(nSupMod < 10 || (nSupMod >= 12 && nSupMod <18) )
1061 if (0<=irow&&irow<8) iRCU=0;
1062 else if (8<=irow&&irow<16 && 0<=icol&&icol<24) iRCU=0;
1065 else if (8<=irow&&irow<16 && 24<=icol&&icol<48) iRCU=1;
1067 else if (16<=irow&&irow<24) iRCU=1;
1069 if (nSupMod%2==1) iRCU = 1 - iRCU;
1079 AliFatal(Form(
"Wrong EMCAL/DCAL RCU number = %d\n", iRCU));
1136 TFile *
file =
new TFile(inputFile.Data());
1142 TList *
list=(TList*)file->Get(
"chistolist");
1153 TH1F *hAllTimeAvBC[4];
1154 TH1F *hAllTimeRMSBC[4];
1160 TH1F *hAllTimeAvLGBC[4];
1161 TH1F *hAllTimeRMSLGBC[4];
1163 if(isFinal==kFALSE){
1164 for(Int_t i=0;i<4;i++){
1165 h1[i]=(TH1F *)list->FindObject(Form(
"RawTimeSumBC%d",i));
1166 h2[i]=(TH1F *)list->FindObject(Form(
"RawTimeEntriesBC%d",i));
1167 h3[i]=(TH1F *)list->FindObject(Form(
"RawTimeSumSqBC%d",i));
1169 h4[i]=(TH1F *)list->FindObject(Form(
"RawTimeSumLGBC%d",i));
1170 h5[i]=(TH1F *)list->FindObject(Form(
"RawTimeEntriesLGBC%d",i));
1171 h6[i]=(TH1F *)list->FindObject(Form(
"RawTimeSumSqLGBC%d",i));
1174 for(Int_t i=0;i<4;i++){
1175 h1[i]=(TH1F *)list->FindObject(Form(
"hTimeSum%d",i));
1176 h2[i]=(TH1F *)list->FindObject(Form(
"hTimeEnt%d",i));
1177 h3[i]=(TH1F *)list->FindObject(Form(
"hTimeSumSq%d",i));
1179 h4[i]=(TH1F *)list->FindObject(Form(
"hTimeLGSum%d",i));
1180 h5[i]=(TH1F *)list->FindObject(Form(
"hTimeLGEnt%d",i));
1181 h6[i]=(TH1F *)list->FindObject(Form(
"hTimeLGSumSq%d",i));
1186 for(Int_t i=0;i<4;i++){
1187 hAllTimeAvBC[i]=
new TH1F(Form(
"hAllTimeAvBC%d",i),Form(
"hAllTimeAvBC%d",i),h1[i]->GetNbinsX(),h1[i]->GetXaxis()->GetXmin(),h1[i]->GetXaxis()->GetXmax());
1188 hAllTimeRMSBC[i]=
new TH1F(Form(
"hAllTimeRMSBC%d",i),Form(
"hAllTimeRMSBC%d",i),h3[i]->GetNbinsX(),h3[i]->GetXaxis()->GetXmin(),h3[i]->GetXaxis()->GetXmax());
1190 hAllTimeAvLGBC[i]=
new TH1F(Form(
"hAllTimeAvLGBC%d",i),Form(
"hAllTimeAvLGBC%d",i),h4[i]->GetNbinsX(),h4[i]->GetXaxis()->GetXmin(),h4[i]->GetXaxis()->GetXmax());
1191 hAllTimeRMSLGBC[i]=
new TH1F(Form(
"hAllTimeRMSLGBC%d",i),Form(
"hAllTimeRMSLGBC%d",i),h6[i]->GetNbinsX(),h6[i]->GetXaxis()->GetXmin(),h6[i]->GetXaxis()->GetXmax());
1197 for(Int_t i=0;i<4;i++){
1198 for(Int_t j=1;j<=h1[i]->GetNbinsX();j++){
1200 if(h2[i]->GetBinContent(j)!=0){
1201 hAllTimeAvBC[i]->SetBinContent(j-1,h1[i]->GetBinContent(j)/h2[i]->GetBinContent(j));
1202 hAllTimeRMSBC[i]->SetBinContent(j-1,TMath::Sqrt(h3[i]->GetBinContent(j)/h2[i]->GetBinContent(j)) );
1204 hAllTimeAvBC[i]->SetBinContent(j-1,0.);
1205 hAllTimeRMSBC[i]->SetBinContent(j-1,0.);
1208 if(h5[i]->GetBinContent(j)!=0){
1209 hAllTimeAvLGBC[i]->SetBinContent(j-1,h4[i]->GetBinContent(j)/h5[i]->GetBinContent(j));
1210 hAllTimeRMSLGBC[i]->SetBinContent(j-1,TMath::Sqrt(h6[i]->GetBinContent(j)/h5[i]->GetBinContent(j)) );
1212 hAllTimeAvLGBC[i]->SetBinContent(j-1,0.);
1213 hAllTimeRMSLGBC[i]->SetBinContent(j-1,0.);
1220 TFile *fileNew=
new TFile(outputFile.Data(),
"recreate");
1221 for(Int_t i=0;i<4;i++){
1222 hAllTimeAvBC[i]->Write();
1223 hAllTimeRMSBC[i]->Write();
1224 hAllTimeAvLGBC[i]->Write();
1225 hAllTimeRMSLGBC[i]->Write();
1233 for(Int_t i=0;i<4;i++){
1234 delete hAllTimeAvBC[i];
1235 delete hAllTimeRMSBC[i];
1236 delete hAllTimeAvLGBC[i];
1237 delete hAllTimeRMSLGBC[i];
1259 const Double_t lowerLimit[]={
1281 const Double_t upperLimit[]={
1303 TFile *
file =
new TFile(inputFile.Data());
1304 if(file==0x0)
return;
1307 for(Int_t i = 0; i <
kNBCmask; i++){
1308 ccBC[i]=(TH1F*) file->Get(Form(
"hAllTimeAvBC%d",i));
1311 TH1C *hRun=
new TH1C(Form(
"h%d",runNumber),Form(
"h%d",runNumber),19,0,19);
1313 Double_t minimumValue=10000.;
1314 Int_t minimumIndex=-1;
1317 Double_t fitParameter=0;
1318 TF1 *f1=
new TF1(
"f1",
"pol0",0,17664);
1319 Bool_t orderTest=kTRUE;
1325 for(Int_t i=0;i<20;i++){
1328 fitResult=ccBC[j]->Fit(
"f1",
"CQ",
"",lowerLimit[i],upperLimit[i]);
1332 printf(
"Fit failed for SM %d BC%d, integral %f\n",i,j,ccBC[j]->Integral(lowerLimit[i],upperLimit[i]));
1335 fitParameter = f1->GetParameter(0);
1337 if(offset100 && (j==0 || j==1)) {
1341 meanBC[j]=fitParameter;
1343 if(fitParameter>0 && fitParameter<minimumValue){
1344 minimumValue = fitParameter;
1349 if( minimumValue/25-(Int_t)(minimumValue/25)>0.5 ) {
1350 L1shift=(Int_t)(minimumValue/25.)+1;
1352 L1shift=(Int_t)(minimumValue/25.);
1355 if(TMath::Abs(minimumValue/25-(Int_t)(minimumValue/25)-0.5)<0.05)
1356 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);
1358 totalValue = L1shift<<2 | minimumIndex ;
1361 hRun->SetBinContent(i,totalValue);
1363 for(iorder=minimumIndex;iorder<minimumIndex+4-1;iorder++){
1364 if( meanBC[(iorder+1)%4] <= meanBC[iorder%4] ) orderTest=kFALSE;
1367 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);
1370 TFile *fileNew=
new TFile(outputFile.Data(),
"update");
1383 AliOADBContainer *contBC=
new AliOADBContainer(
"");
1384 contBC->InitFromFile(Form(
"%s/EMCALBadChannels.root",
"alien://$ALICE_PHYSICS/OADB/EMCAL"),
"AliEMCALBadChannels");
1385 printf(
"contBC %p, ent %d\n",contBC,contBC->GetNumberOfEntries());
1386 TObjArray *arrayBC=(TObjArray*)contBC->GetObject(
fRunNumber);
1388 AliInfo(
"Remove EMCAL bad cells");
1390 for (Int_t i=0; i<
kNSM; ++i) {
1391 TH2I *hbm = (TH2I*)arrayBC->FindObject(Form(
"EMCALBadChannelMap_Mod%d",i));
1393 AliError(Form(
"Can not get EMCALBadChannelMap_Mod%d",i));
1396 hbm->SetDirectory(0);
1400 }
else AliInfo(
"Do NOT remove EMCAL bad channels\n");
1412 if(referenceFile==0x0) {
1413 AliFatal(
"*** NO bad channel map FILE");
1416 TH1F *hbm = (TH1F*)referenceFile->Get(
"h1");
1418 AliError(
"Can not get EMCALBadChannelMap");
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
ClassImp(AliAnalysisTaskTriggerRates) AliAnalysisTaskTriggerRates
virtual void UserCreateOutputObjects()
Bool_t AcceptCluster(AliVCluster *clus)
Selection criteria of good cluster are set here.
TH2F * fhRawTimeVsIdBC[kNBCmask]
! 4 BCmask HG
Int_t fFineNbins
number of bins of histo with T0 time
TH1F * fhRawTimeSumSqBC[kNBCmask]
! 4 BCmask HG
TString fGeometryName
geometry name
TH1F * fhTimeEnt[kNBCmask]
! 4
Double_t fMinLambda0
minimum cluster lambda0
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
TH2F * fhTimeVsBC
!cell time vs BC
Double_t fMinTime
minimum cluster time after correction
AliTOFT0maker * fTOFmaker
pointer to get T0 from TOF
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
AliAnalysisTaskEMCALTimeCalib()
void LoadBadChannelMap()
Load Bad Channel Map from different source.
Double_t fRawTimeMin
lower range of histo with raw time
TH2F * fhTcellvsSM
! cell time vs SM
TH2F * fhTimeDsupLG[kNSM]
! 20 SM low gain
TH1F * fhRawTimeSumSqLGBC[kNBCmask]
! 4 BCmask LG
static void ProduceOffsetForSMsV2(Int_t runNumber, TString inputFile="Reference.root", TString outputFile="ReferenceSM.root", Bool_t offset100=kTRUE)
Double_t fMaxRtrack
maximum cluster track distance
void LoadBadChannelMapOADB()
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
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
Double_t fEnergyMax
upper range of histo with energy HG
Double_t fMinClusterEnergy
minimum cluster energy
void LoadReferenceRunByRunHistos()
TH1F * fhTimeLGEnt[kNBCmask]
! 4
TObjArray * fBadChannelMapArray
bad channel map array
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
virtual void UserExec(Option_t *option)
Main loop executed for each event.
virtual void PrepareTOFT0maker()
Get T0 time from TOF.
TH1F * fhTimeSumSq[kNBCmask]
! 4
Bool_t fPileupFromSPD
flag to set PileupFromSPD
TH1F * fhTimeLGSumSq[kNBCmask]
! 4
TH1F * fhRawTimeSumBC[kNBCmask]
! 4 BCmask HG
Double_t fMinCellEnergy
minimum cell energy
void LoadBadChannelMapFile()
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
TH1F * fhAllAverageBC[kNBCmask]
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 ProduceCalibConsts(TString inputFile="time186319testWOL0.root", TString outputFile="Reference.root", Bool_t isFinal=kFALSE)
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
TH2F * fhTimeVsIdBC[kNBCmask]
! 4 BCmask HG
TH1C * fhRefRuns
4 BCmask Low gain
TH2F * fhTimeVsIdLGBC[kNBCmask]
! 4 BCmask LG
TH1F * fhEventType
! event type
void SetL1PhaseReferenceForGivenRun()
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.
TH1F * fhTimeSum[kNBCmask]
! 4
TString fBadChannelFileName
! name of file with bad channels
virtual void Terminate(Option_t *)
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 fRunNumber
! run number
Int_t fRawTimeNbins
number of bins of histo with raw time
TH2F * fhTimeDsup[kNSM]
! 20 SM high gain
TH1F * fhTimeLGSum[kNBCmask]
! 4
TH2F * fhTimeDsupBC[kNSM][kNBCmask]
! 20 x 4 high gain
TH2F * fhTimeDsupLGBC[kNSM][kNBCmask]
! 20 x 4 low gain