27 #include <TGeoManager.h> 28 #include <TRefArray.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" 41 #include "AliCDBManager.h" 42 #include "AliRunTag.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" 84 fReferenceRunByRunFileName(),
85 fPileupFromSPD(kFALSE),
88 fMostEneCellOnly(kFALSE),
106 fFillHeavyHisto(kFALSE),
107 fBadChannelMapArray(),
108 fBadChannelMapSet(kFALSE),
109 fSetBadChannelMapSource(0),
110 fBadChannelFileName(),
115 fhTOFT0vsEventNumber(0),
137 fhRawTimeEntriesBC(),
141 fhRawTimeEntriesLGBC(),
142 fhRawTimeSumSqLGBC(),
143 fhRawCorrTimeVsIdBC(),
144 fhRawCorrTimeVsIdLGBC(),
185 DefineInput(0, TChain::Class());
189 DefineOutput(1, TList::Class());
212 AliFatal(
"*** NO REFERENCE FILE");
214 AliDebug(1,
"*** OK TFILE");
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));
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));
233 AliFatal(
"You require to load reference histos from file but FILENAME is not provided");
245 if(referenceFile==0x0) {
246 AliFatal(
"*** NO REFERENCE R-B-R FILE");
253 TIter next(referenceFile->GetListOfKeys());
255 while ((key=(TKey*)next())) {
256 fL1PhaseList->AddLast((TH1F*)referenceFile->Get(key->GetName()) );
261 AliFatal(
"You require to load reference run-by-run histos from file but FILENAME is not provided");
273 AliFatal(
"Array with reference L1 phase histograms do not exist in memory");
277 AliFatal(
"Negative run number");
283 AliError(Form(
"Reference histogram for run %d does not exist. Use Default",
fRunNumber));
292 if(
fhRefRuns->GetEntries()==0)AliWarning(
"fhRefRuns->GetEntries() = 0");
293 AliDebug(1,Form(
"hRefRuns entries %d", (
Int_t)
fhRefRuns->GetEntries() ));
301 AliDebug(1,
"AnalysisTaskEMCalTimeCalib::NotifyRun()");
302 AliDebug(2,Form(
"Notify(): EMCal geometry: fgeom = %p, fGeometryName=%s\n ",
fgeom,
fGeometryName.Data()));
306 AliFatal(
"ERROR: InputEvent not set");
309 else AliDebug(1,
"Good, InputEvent set");
333 AliDebug(1,
"AliAnalysisTaskEMCALTimeCalib::SetEMCalGeometry()");
336 AliInfo(Form(
"Get EMCAL geometry name <%s> for run %d",
fgeom->GetName(),
fRunNumber));
339 AliInfo(Form(
"Set EMCAL geometry name to <%s>",
fGeometryName.Data()));
343 AliWarning(
"Make sure the EMCal geometry is set properly !");
345 AliDebug(1,Form(
"EMCal geometry properly set: fGeom = %p, fGeometryName=%s",
fgeom,
fGeometryName.Data()));
356 AliInfo(Form(
"<D> -- Run # = %d",
fRunNumber));
357 AliInfo(
"prepare TOFT0maker!!");
361 AliCDBManager * cdb = AliCDBManager::Instance();
362 cdb->SetDefaultStorage(
"raw://");
387 AliDebug(1,
"AliAnalysisTaskEMCALTimeCalib::UserCreateOutputObjects()");
389 const Int_t nChannels = 17664;
405 fhEventType =
new TH1F(
"fhEventType",
"event type",10, 0.,10.);
407 fhEventType->GetXaxis()->SetBinLabel(1 ,
"1=No ESD");
408 fhEventType->GetXaxis()->SetBinLabel(2 ,
"2=Pileup");
409 fhEventType->GetXaxis()->SetBinLabel(3 ,
"3=No Trigger");
410 fhEventType->GetXaxis()->SetBinLabel(4 ,
"4=Evt Type != 7");
411 fhEventType->GetXaxis()->SetBinLabel(5 ,
"5=INT7,8");
412 fhEventType->GetXaxis()->SetBinLabel(6 ,
"6=EMC7,8");
413 fhEventType->GetXaxis()->SetBinLabel(7 ,
"7=L1 EMCal");
414 fhEventType->GetXaxis()->SetBinLabel(8 ,
"8=DMC7,8");
415 fhEventType->GetXaxis()->SetBinLabel(9 ,
"9=L1 DCal");
418 fhEventType ->GetYaxis()->SetTitle(
"Counts (a.u.)");
426 fhEneVsAbsIdHG =
new TH2F(
"fhEneVsAbsIdHG",
"energy vs ID for HG",1000,0,18000,200,0,10);
427 fhEneVsAbsIdLG =
new TH2F(
"fhEneVsAbsIdLG",
"energy vs ID for LG",1000,0,18000,200,0,40);
435 Form(
"cell Sum Square time HG, BC %d ", i),
440 fhTimeSum[i] =
new TH1F(Form(
"hTimeSum%d", i),
441 Form(
"cell Sum time HG, BC %d ", i),
446 fhTimeEnt[i] =
new TH1F(Form(
"hTimeEnt%d", i),
447 Form(
"cell Entries HG, BC %d ", i),
449 fhTimeEnt[i]->SetYTitle(
"Entries for Time ");
454 Form(
"cell Sum Square time LG, BC %d ", i),
460 Form(
"cell Sum time LG, BC %d ", i),
466 Form(
"cell Entries LG, BC %d ", i),
475 Form(
"cell raw time vs ID for high gain BC %d ", i),
482 Form(
"sum of cell raw time for high gain BC %d ", i),
488 Form(
"No. entries of cells raw time for high gain BC %d ", i),
494 Form(
"sum of (cell raw time)^2 for high gain BC %d ", i),
502 Form(
"cell raw time vs ID for low gain BC %d ", i),
509 Form(
"sum of cell raw time for low gain BC %d ", i),
515 Form(
"No. entries of cells raw time for low gain BC %d ", i),
521 Form(
"sum of (cell raw time)^2 for low gain BC %d ", i),
529 Form(
"cell L1 shift and 100ns corrected raw time vs ID for high gain BC %d ", i),
535 Form(
"cell L1 shift and 100ns corrected raw time vs ID for low gain BC %d ", i),
544 Form(
"cell time corrected for L1 shift, 100ns and L1 phase vs ID for high gain BC %d ", i),
550 Form(
"cell time corrected for L1 shift, 100ns and L1 phase vs ID for low gain BC %d ", i),
560 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);
565 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);
574 fhTimeDsup[jj] =
new TH2F(Form(
"SupMod%d",jj), Form(
"SupMod %d time_vs_E, high gain",jj),
fEnergyNbins,
fEnergyMin,
fEnergyMax,
fPassTimeNbins,
fPassTimeMin,
fPassTimeMax);
579 fhTimeDsupLG[jj] =
new TH2F(Form(
"SupMod%dLG",jj), Form(
"SupMod %d time_vs_E, low gain ",jj),
fEnergyLGNbins,
fEnergyLGMin,
fEnergyLGMax,
fPassTimeNbins,
fPassTimeMin,
fPassTimeMax);
659 AliDebug(2,Form(
"UserExec: EMCal geometry: fgeom = %p fGeometryName %s",
fgeom,
fGeometryName.Data()));
660 AliVEvent *
event = InputEvent();
663 AliDebug(2,Form(
"TOF time from header %f ps",event->GetTOFHeader()->GetDefaultEventTimeVal()));
668 AliError(
"ESD not available, exit");
674 if(event->IsPileupFromSPD(3,0.8,3.,2.,5.)){
675 AliDebug(1,
"Event: PileUp skip.");
681 TString triggerclasses =
event->GetFiredTriggerClasses();
682 if(triggerclasses==
"") {
687 Int_t eventType = ((AliVHeader*)event->GetHeader())->GetEventType();
689 AliDebug(1,Form(
"Triggerclasses %s, eventType %d",triggerclasses.Data(),eventType));
704 if(triggerclasses.Contains(
"CINT7-B-NOPF-ALLNOTRD") ||
705 triggerclasses.Contains(
"CINT7-I-NOPF-ALLNOTRD") ||
706 triggerclasses.Contains(
"CINT1-I-NOPF-ALLNOTRD") ||
707 triggerclasses.Contains(
"CINT1-B-NOPF-ALLNOTRD") ||
708 triggerclasses.Contains(
"CINT8") ||
709 triggerclasses.Contains(
"CINT7") ||
710 triggerclasses.Contains(
"CPBI2_B1-B-NOPF-ALLNOTRD") ) bMB = kTRUE;
712 if(triggerclasses.Contains(
"CEMC7-B-NOPF-CENTNOTRD") ||
713 triggerclasses.Contains(
"CEMC1-B-NOPF-CENTNOTRD") ||
714 triggerclasses.Contains(
"CEMC7") ||
715 triggerclasses.Contains(
"CEMC8") ||
716 triggerclasses.Contains(
"CEMC8-B-NOPF-CENTNOTRD") ) bL0 = kTRUE;
718 if(triggerclasses.Contains(
"CDMC7-B-NOPF-CENTNOTRD") ||
719 triggerclasses.Contains(
"CDMC1-B-NOPF-CENTNOTRD") ||
720 triggerclasses.Contains(
"CDMC7") ||
721 triggerclasses.Contains(
"CDMC8") ||
722 triggerclasses.Contains(
"CDMC8-B-NOPF-CENTNOTRD") ) bDL0 = kTRUE;
724 if(triggerclasses.Contains(
"CEMC7EG1-B-NOPF-CENTNOTRD") ||
725 triggerclasses.Contains(
"CEMC7EG2-B-NOPF-CENTNOTRD") ||
726 triggerclasses.Contains(
"CEMC8EG1-B-NOPF-CENTNOTRD") ||
727 triggerclasses.Contains(
"CEMC8EGA") ||
728 triggerclasses.Contains(
"CEMC7EGA") ||
729 triggerclasses.Contains(
"CEMC7EG1-B") ||
730 triggerclasses.Contains(
"CEMC7EG2-B") ||
731 triggerclasses.Contains(
"CPBI2EGA") ) bL1G = kTRUE;
733 if(triggerclasses.Contains(
"CDMC7DG1-B-NOPF-CENTNOTRD") ||
734 triggerclasses.Contains(
"CDMC7DG2-B-NOPF-CENTNOTRD") ||
735 triggerclasses.Contains(
"CDMC8DG1-B-NOPF-CENTNOTRD") ||
736 triggerclasses.Contains(
"CDMC8DGA") ||
737 triggerclasses.Contains(
"CDMC7DGA") ||
738 triggerclasses.Contains(
"CDMC7DG1-B") ||
739 triggerclasses.Contains(
"CDMC7DG2-B") ||
740 triggerclasses.Contains(
"CPBI2DGA") ) bDL1G = kTRUE;
742 if(triggerclasses.Contains(
"CEMC7EJ1-B-NOPF-CENTNOTRD") ||
743 triggerclasses.Contains(
"CEMC7EJ2-B-NOPF-CENTNOTRD") ||
744 triggerclasses.Contains(
"CEMC8EJ1-B-NOPF-CENTNOTRD") ||
745 triggerclasses.Contains(
"CEMC7EJE") ||
746 triggerclasses.Contains(
"CEMC8EJE") ||
747 triggerclasses.Contains(
"CEMC7EJ1-B") ||
748 triggerclasses.Contains(
"CEMC7EJ2-B") ||
749 triggerclasses.Contains(
"CPBI2EJE") ) bL1J = kTRUE;
751 if(triggerclasses.Contains(
"CDMC7DJ1-B-NOPF-CENTNOTRD") ||
752 triggerclasses.Contains(
"CDMC7DJ2-B-NOPF-CENTNOTRD") ||
753 triggerclasses.Contains(
"CDMC8DJ1-B-NOPF-CENTNOTRD") ||
754 triggerclasses.Contains(
"CDMC7DJE") ||
755 triggerclasses.Contains(
"CDMC8DJE") ||
756 triggerclasses.Contains(
"CDMC7DJ1-B") ||
757 triggerclasses.Contains(
"CDMC7DJ2-B") ||
758 triggerclasses.Contains(
"CPBI2DJE") ) bDL1J = kTRUE;
792 TRefArray* caloClusters =
new TRefArray();
793 event->GetEMCALClusters(caloClusters);
796 Int_t BunchCrossNumber =
event->GetBunchCrossNumber();
800 Int_t L1phaseshift=0;
802 Int_t L1shiftOffset=0;
805 nBC = BunchCrossNumber%4;
811 Int_t nclus = caloClusters->GetEntries();
812 AliDebug(1,Form(
"###########Bunch Cross nb = %d nclus = %d",nBC,nclus ));
816 AliVCaloCells &cells= *(
event->GetEMCALCells());
818 Int_t nSupMod=-1, nModule=-1;
819 Int_t iphi=-1, ieta=-1, nIphi=-1, nIeta=-1;
827 for (
Int_t icl = 0; icl < nclus; icl++) {
829 AliVCluster* clus = (AliVCluster*)caloClusters->At(icl);
834 UShort_t * index = clus->GetCellsAbsId() ;
840 for(
Int_t i = 0; i < clus->GetNCells() ; i++) {
842 amp = cells.GetCellAmplitude(absId) ;
850 for(
Int_t i = 0; i < clus->GetNCells() ; i++) {
857 hkdtime = cells.GetCellTime(absId) * 1.0e09;
858 amp = cells.GetCellAmplitude(absId) ;
859 isHighGain = cells.GetCellHighGain(absId);
862 fgeom->GetCellIndex(absId, nSupMod, nModule, nIphi, nIeta);
863 fgeom->GetCellPhiEtaIndexInSModule(nSupMod,nModule,nIphi,nIeta, iphi,ieta);
897 fhTimeVsBC->Fill(1.*BunchCrossNumber,hkdtime-timeBCoffset);
899 if(isHighGain==kTRUE){
903 AliFatal(Form(
"Reference histogram for BC%d not properly loaded",nBC));
909 AliFatal(Form(
"Reference LG histogram for BC%d not properly loaded",nBC));
924 L1phase = L1phaseshift & 3;
926 offsetPerSM = (nBC - L1phase)*25;
928 offsetPerSM = (nBC - L1phase + 4)*25;
933 L1shiftOffset = L1phaseshift>>2;
936 if(nBC==0 || nBC==1) L1shiftOffset-=100.;
939 AliFatal(
"Reference histogram run-by-run not properly loaded");
955 fhTimeVsIdBC[nBC]->Fill(absId,hkdtime-L1shiftOffset-offsetPerSM);
957 fhTimeVsIdLGBC[nBC]->Fill(absId,hkdtime-L1shiftOffset-offsetPerSM);
964 fhTimeDsup[nSupMod]->Fill(amp,hkdtime-offset-offsetPerSM-L1shiftOffset);
965 fhTimeDsupBC[nSupMod][nBC]->Fill(amp,hkdtime-offset-offsetPerSM-L1shiftOffset);
967 fhTimeDsupLG[nSupMod]->Fill(amp,hkdtime-offset-offsetPerSM-L1shiftOffset);
968 fhTimeDsupLGBC[nSupMod][nBC]->Fill(amp,hkdtime-offset-offsetPerSM-L1shiftOffset);
979 hkdtime = hkdtime-timeBCoffset;
981 hkdtimecorr= hkdtime-offset-offsetPerSM-L1shiftOffset;
996 hkdtime = hkdtime - offsetPerSM - L1shiftOffset;
1016 caloClusters->Delete();
1017 delete caloClusters;
1045 AliDebug(1,
"ERROR: Output list not available");
1055 Int_t nCells = clus->GetNCells();
1060 AliDebug(1,
"very big cluster with enormous energy - cluster rejected");
1068 AliDebug(1,
"lambda0 loose cut failed - cluster rejected");
1075 Double_t Rtrack = TMath::Sqrt(Dx*Dx+Dz*Dz);
1078 AliDebug(1,
"track matched - cluster rejected");
1084 AliDebug(1,
"single cell cluster - cluster rejected");
1090 AliDebug(1,
"cluster energy < 1 GeV- cluster rejected");
1098 AliDebug(1,
"lambda0 strict cut failed - cluster rejected");
1112 UShort_t * index = clus->GetCellsAbsId() ;
1113 AliVCaloCells &cells= *(InputEvent()->GetEMCALCells());
1114 for(
Int_t i = 0; i < clus->GetNCells() ; i++) {
1115 if(cells.GetCellHighGain(index[i])==kFALSE)
return kTRUE;
1126 if(nSupMod < 10 || (nSupMod >= 12 && nSupMod <18) )
1128 if (0<=irow&&irow<8) iRCU=0;
1129 else if (8<=irow&&irow<16 && 0<=icol&&icol<24) iRCU=0;
1132 else if (8<=irow&&irow<16 && 24<=icol&&icol<48) iRCU=1;
1134 else if (16<=irow&&irow<24) iRCU=1;
1136 if (nSupMod%2==1) iRCU = 1 - iRCU;
1146 AliFatal(Form(
"Wrong EMCAL/DCAL RCU number = %d\n", iRCU));
1204 TFile *
file =
new TFile(inputFile.Data());
1221 TH1F *hAllTimeAvBC[4];
1222 TH1F *hAllTimeRMSBC[4];
1228 TH1F *hAllTimeAvLGBC[4];
1229 TH1F *hAllTimeRMSLGBC[4];
1231 if(isFinal==kFALSE){
1232 for(
Int_t i=0;i<4;i++){
1233 h1[i]=(TH1F *)list->FindObject(Form(
"RawTimeSumBC%d",i));
1234 h2[i]=(TH1F *)list->FindObject(Form(
"RawTimeEntriesBC%d",i));
1235 h3[i]=(TH1F *)list->FindObject(Form(
"RawTimeSumSqBC%d",i));
1237 h4[i]=(TH1F *)list->FindObject(Form(
"RawTimeSumLGBC%d",i));
1238 h5[i]=(TH1F *)list->FindObject(Form(
"RawTimeEntriesLGBC%d",i));
1239 h6[i]=(TH1F *)list->FindObject(Form(
"RawTimeSumSqLGBC%d",i));
1242 for(
Int_t i=0;i<4;i++){
1243 h1[i]=(TH1F *)list->FindObject(Form(
"hTimeSum%d",i));
1244 h2[i]=(TH1F *)list->FindObject(Form(
"hTimeEnt%d",i));
1245 h3[i]=(TH1F *)list->FindObject(Form(
"hTimeSumSq%d",i));
1247 h4[i]=(TH1F *)list->FindObject(Form(
"hTimeLGSum%d",i));
1248 h5[i]=(TH1F *)list->FindObject(Form(
"hTimeLGEnt%d",i));
1249 h6[i]=(TH1F *)list->FindObject(Form(
"hTimeLGSumSq%d",i));
1254 for(
Int_t i=0;i<4;i++){
1255 hAllTimeAvBC[i]=
new TH1F(Form(
"hAllTimeAvBC%d",i),Form(
"hAllTimeAvBC%d",i),h1[i]->GetNbinsX(),h1[i]->GetXaxis()->GetXmin(),h1[i]->GetXaxis()->GetXmax());
1256 hAllTimeRMSBC[i]=
new TH1F(Form(
"hAllTimeRMSBC%d",i),Form(
"hAllTimeRMSBC%d",i),h3[i]->GetNbinsX(),h3[i]->GetXaxis()->GetXmin(),h3[i]->GetXaxis()->GetXmax());
1258 hAllTimeAvLGBC[i]=
new TH1F(Form(
"hAllTimeAvLGBC%d",i),Form(
"hAllTimeAvLGBC%d",i),h4[i]->GetNbinsX(),h4[i]->GetXaxis()->GetXmin(),h4[i]->GetXaxis()->GetXmax());
1259 hAllTimeRMSLGBC[i]=
new TH1F(Form(
"hAllTimeRMSLGBC%d",i),Form(
"hAllTimeRMSLGBC%d",i),h6[i]->GetNbinsX(),h6[i]->GetXaxis()->GetXmin(),h6[i]->GetXaxis()->GetXmax());
1265 for(
Int_t i=0;i<4;i++){
1266 for(
Int_t j=1;j<=h1[i]->GetNbinsX();j++){
1268 if(h2[i]->GetBinContent(j)!=0){
1269 hAllTimeAvBC[i]->SetBinContent(j-1,h1[i]->GetBinContent(j)/h2[i]->GetBinContent(j));
1270 hAllTimeRMSBC[i]->SetBinContent(j-1,TMath::Sqrt(h3[i]->GetBinContent(j)/h2[i]->GetBinContent(j)) );
1272 hAllTimeAvBC[i]->SetBinContent(j-1,0.);
1273 hAllTimeRMSBC[i]->SetBinContent(j-1,0.);
1276 if(h5[i]->GetBinContent(j)!=0){
1277 hAllTimeAvLGBC[i]->SetBinContent(j-1,h4[i]->GetBinContent(j)/h5[i]->GetBinContent(j));
1278 hAllTimeRMSLGBC[i]->SetBinContent(j-1,TMath::Sqrt(h6[i]->GetBinContent(j)/h5[i]->GetBinContent(j)) );
1280 hAllTimeAvLGBC[i]->SetBinContent(j-1,0.);
1281 hAllTimeRMSLGBC[i]->SetBinContent(j-1,0.);
1288 TFile *fileNew=
new TFile(outputFile.Data(),
"recreate");
1289 for(
Int_t i=0;i<4;i++){
1290 hAllTimeAvBC[i]->Write();
1291 hAllTimeRMSBC[i]->Write();
1292 hAllTimeAvLGBC[i]->Write();
1293 hAllTimeRMSLGBC[i]->Write();
1301 for(
Int_t i=0;i<4;i++){
1302 delete hAllTimeAvBC[i];
1303 delete hAllTimeRMSBC[i];
1304 delete hAllTimeAvLGBC[i];
1305 delete hAllTimeRMSLGBC[i];
1371 TFile *
file =
new TFile(inputFile.Data());
1372 if(file==0x0)
return;
1378 ccBC[i]=(TH1F*) file->Get(Form(
"hAllTimeAvBC%d",i));
1379 shouldBeEmpty[i]=kFALSE;
1381 for(
Int_t j=0;j<upperLimit[19];j++){
1382 if(ccBC[i]->GetBinContent(j)>0.) emptyCounter++;
1384 if(emptyCounter<1500) shouldBeEmpty[i]=kTRUE;
1385 printf(
"Non-zero channels %d BC %d should be empty: %d \n",emptyCounter,i,shouldBeEmpty[i]);
1388 TH1C *hRun=
new TH1C(Form(
"h%d",runNumber),Form(
"h%d",runNumber),19,0,19);
1391 Int_t minimumIndex=-1;
1395 TF1 *f1=
new TF1(
"f1",
"pol0",0,17664);
1402 for(
Int_t i=0;i<20;i++){
1405 if(shouldBeEmpty[j]) {
1409 fitResult=ccBC[j]->Fit(
"f1",
"CQ",
"",lowerLimit[i],upperLimit[i]);
1413 printf(
"Fit failed for SM %d BC%d, integral %f\n",i,j,ccBC[j]->Integral(lowerLimit[i],upperLimit[i]));
1416 fitParameter = f1->GetParameter(0);
1418 if(offset100 && (j==0 || j==1)) {
1422 meanBC[j]=fitParameter;
1424 if(fitParameter>0 && fitParameter<minimumValue){
1425 minimumValue = fitParameter;
1430 if( minimumValue/25-(
Int_t)(minimumValue/25)>0.5 ) {
1431 L1shift=(
Int_t)(minimumValue/25.)+1;
1433 L1shift=(
Int_t)(minimumValue/25.);
1436 if(TMath::Abs(minimumValue/25-(
Int_t)(minimumValue/25)-0.5)<0.05)
1437 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);
1439 if(justL1phase) totalValue = minimumIndex;
1440 else totalValue = L1shift<<2 | minimumIndex ;
1443 hRun->SetBinContent(i,totalValue);
1445 for(iorder=minimumIndex;iorder<minimumIndex+4-1;iorder++){
1446 if( meanBC[(iorder+1)%4] <= meanBC[iorder%4] ) orderTest=kFALSE;
1449 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);
1453 if(shouldBeEmpty[0] || shouldBeEmpty[1] || shouldBeEmpty[2] || shouldBeEmpty[3]){
1454 Double_t newMean = meanBC[minimumIndex]-600;
1455 if(newMean<=12.5) hRun->SetBinContent(i,minimumIndex);
1457 Int_t minIndexTmp=-1;
1458 if(newMean/25. - (
Int_t)(newMean/25.) <0.5)
1459 minIndexTmp = (
Int_t)(newMean/25.);
1461 minIndexTmp = 1+(
Int_t)(newMean/25.);
1463 hRun->SetBinContent(i,(4-minIndexTmp+minimumIndex)%4);
1466 printf(
"run with missing BC; new L1 phase set to %d\n",(
Int_t)hRun->GetBinContent(i));
1471 TFile *fileNew=
new TFile(outputFile.Data(),
"update");
1484 AliOADBContainer *contBC=
new AliOADBContainer(
"");
1485 contBC->InitFromFile(AliDataFile::GetFileNameOADB(
"EMCAL/EMCALBadChannels.root").data(),
"AliEMCALBadChannels");
1486 printf(
"contBC %p, ent %d\n",contBC,contBC->GetNumberOfEntries());
1489 AliInfo(
"Remove EMCAL bad cells");
1492 TH2I *hbm = (TH2I*)arrayBC->FindObject(Form(
"EMCALBadChannelMap_Mod%d",i));
1494 AliError(Form(
"Can not get EMCALBadChannelMap_Mod%d",i));
1497 hbm->SetDirectory(0);
1501 }
else AliInfo(
"Do NOT remove EMCAL bad channels\n");
1513 if(referenceFile==0x0) {
1514 AliFatal(
"*** NO bad channel map FILE");
1517 TH1F *hbm = (TH1F*)referenceFile->Get(
"h1");
1519 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
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
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
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
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
Double_t fEnergyMax
upper range of histo with energy HG
Double_t fMinClusterEnergy
minimum cluster energy
void LoadReferenceRunByRunHistos()
static void ProduceOffsetForSMsV2(Int_t runNumber, TString inputFile="Reference.root", TString outputFile="ReferenceSM.root", Bool_t offset100=kTRUE, Bool_t justL1phase=kTRUE)
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
TFile * file
TList with histograms for a given trigger.
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