2 void ConfigureEMCALRecoUtils(
3 AliEMCALRecoUtils* reco,
5 TGeoHMatrix* matrix[12],
8 TString pass = "pass2",
11 Bool_t bRecalT= kFALSE
15 // Configure RecoUtils with OADB objects
17 printf("**** Configure AliEMCALRecoUtils, LOAD AODB ***\n");
18 printf("\t run %d, pass %s\n",run,pass.Data());
21 // Exotic cells removal
23 reco->SwitchOnRejectExoticCell() ;
24 reco->SetExoticCellDiffTimeCut(10000); // Open
25 reco->SetExoticCellFractionCut(0.95); // 1-Ecross/Ecell > 0.95 -> out
26 reco->SetExoticCellMinAmplitudeCut(0.75); // 750 MeV
28 gSystem->Load("libOADB");
30 // Geometry settings, matrices
32 // Instantiate EMCAL geometry for the first time
34 AliEMCALGeometry* geom = 0;
35 if (run < 140000) geom = AliEMCALGeometry::GetInstance("EMCAL_FIRSTYEARV1");
36 else if(run < 171000) geom = AliEMCALGeometry::GetInstance("EMCAL_COMPLETEV1");
37 else geom = AliEMCALGeometry::GetInstance("EMCAL_COMPLETE12SMV1");
39 Int_t nSM = geom->GetNumberOfSuperModules();
43 TString fileName="$ALICE_ROOT/OADB/EMCAL/EMCALlocal2master.root";
44 if(path!="") fileName=path+"EMCALlocal2master.root";
46 AliOADBContainer EMCALgeoCont("AliEMCALgeo");
47 EMCALgeoCont.InitFromFile((char*)fileName.Data(),"AliEMCALgeo");
48 TObjArray *mobj=(TObjArray*)EMCALgeoCont.GetObject(run,"EmcalMatrices");
49 for (Int_t mod=0;mod<nSM;mod++)
51 matrix[mod] = (TGeoHMatrix*) mobj->At(mod);
52 //matrix[mod]->Print();
55 reco->SetPositionAlgorithm(AliEMCALRecoUtils::kPosTowerGlobal);
58 // *** Energy recalibration settings ***
69 //Recalibration factors
72 fileName="$ALICE_ROOT/OADB/EMCAL/EMCALRecalib.root";
73 if(path!="") fileName=path+"EMCALRecalib.root";
75 AliOADBContainer *contRF=new AliOADBContainer("");
76 contRF->InitFromFile((char*)fileName.Data(),"AliEMCALRecalib");
78 TObjArray *recal=(TObjArray*)contRF->GetObject(run);
80 TObjArray *recalpass=(TObjArray*)recal->FindObject(pass);
82 TObjArray *recalib=(TObjArray*)recalpass->FindObject("Recalib");
84 reco->SwitchOnRecalibration();
85 printf("AliEMCALRecoUtils - RECALIBRATE \n");
86 for (Int_t i=0; i<nSM; ++i) {
87 TH2F *h = reco->GetEMCALChannelRecalibrationFactors(i);
90 h = (TH2F*)recalib->FindObject(Form("EMCALRecalFactors_SM%d",i));
92 AliError(Form("Could not load EMCALRecalFactors_SM%d",i));
96 reco->SetEMCALChannelRecalibrationFactors(i,h);
98 }else printf("AliEMCALRecoUtils ---Do NOT recalibrate 1\n");
99 }else printf("AliEMCALRecoUtils ---Do NOT recalibrate 2\n");
100 }else printf("AliEMCALRecoUtils ---Do NOT recalibrate 3\n");
102 //TFile * f = new TFile("RecalibrationFactors.root","read");
103 //for(Int_t i =0; i< 12; i++) reco->SetEMCALChannelRecalibrationFactors( i, (TH2F*) f->Get(Form("EMCALRecalFactors_SM%d",i)));
104 // // reco->SwitchOnTimeDepCorrection();
105 // // //char cmd[200] ;
106 // // //sprintf(cmd, ".!tar xvfz CorrectionFiles.tgz") ;
107 // // //gROOT->ProcessLine(cmd) ;
110 } else printf("AliEMCALRecoUtils ---Do NOT recalibrate\n");
112 // *** Remove EMCAL hot channels ***
116 fileName="$ALICE_ROOT/OADB/EMCAL/EMCALBadChannels.root";
117 if(path!="") fileName=path+"EMCALBadChannels.root";
119 AliOADBContainer *contBC=new AliOADBContainer("");
120 contBC->InitFromFile((char*)fileName.Data(),"AliEMCALBadChannels");
121 TObjArray *arrayBC=(TObjArray*)contBC->GetObject(run);
123 TObjArray *arrayBCpass=(TObjArray*)arrayBC->FindObject(pass);
126 reco->SwitchOnBadChannelsRemoval();
127 reco->SwitchOnDistToBadChannelRecalculation();
128 printf("AliEMCALRecoUtils - REMOVE bad cells \n");
130 for (Int_t i=0; i<nSM; ++i) {
131 TH2I *hbm = reco->GetEMCALChannelStatusMap(i);
134 hbm=(TH2I*)arrayBCpass->FindObject(Form("EMCALBadChannelMap_Mod%d",i));
137 AliError(Form("Can not get EMCALBadChannelMap_Mod%d",i));
141 hbm->SetDirectory(0);
142 reco->SetEMCALChannelStatusMap(i,hbm);
144 } else printf("AliEMCALRecoUtils ---Do NOT remove bad channels 1\n");
145 } else printf("AliEMCALRecoUtils ---Do NOT remove bad channels 2\n");
146 } else printf("AliEMCALRecoUtils ---Do NOT remove bad channels 3 \n");
149 Int_t iCol = -1, iRow = -1, iSM =-1, iMod = -1,iIphi =-1,iIeta = -1;
150 Int_t badAbsID[]={74, 103};
152 for(Int_t i=0;i < sizeof(badAbsID)/sizeof(Int_t); i++){
153 geom->GetCellIndex(badAbsID[i],iSM,iMod,iIphi,iIeta);
154 // Gives SuperModule and Tower numbers
155 geom->GetCellPhiEtaIndexInSModule(iSM,iMod,
156 iIphi, iIeta,iRow,iCol);
157 //printf("bad ID %d, col %d, row %d, sm %d\n",badAbsID[i],iCol,iRow,iSM);
158 reco->SetEMCALChannelStatus(iSM , iCol, iRow,1);
164 // *** Time recalibration settings ***
168 reco->SwitchOnTimeRecalibration();
170 //Waiting for OADB, meanwhile
174 //TString path = "alien:///alice/cern.ch/user/g/germain/RecalDB/Time";
175 //TGrid::Connect("alien://");
177 if (run > 140000 && run < 146500 )
178 ftime = TFile::Open(Form("%s/RefLHC11apass1-7TeV.root",path.Data()));
179 else if(run > 146500 && run <= 146860 )
180 ftime = TFile::Open(Form("%s/RefLHC11apass3-2.76TeV.root",path.Data()));
181 else if(run > 146860 && run < 156477 )
182 ftime = TFile::Open(Form("%s/RefLHC11cpass1-7TeV.root",path.Data()));
183 else if(run >= 156477)
184 ftime = TFile::Open(Form("%s/RefLHC11dpass1-7TeV.root",path.Data()));
185 else if(run < 140000 && run > 136850)
186 ftime = TFile::Open(Form("%s/RefLHC10hpass2PbPb2.76TeV.root",path.Data()));
187 else if(run < 136850)
188 ftime = TFile::Open(Form("%s/RefLHC10dpass2-7TeV.root",path.Data()));
189 else printf("Run %d, not considered for time calibration\n",run);
192 printf("AliEMCALRecoUtils - Time recalibration ON\n");
194 for(Int_t i =0; i< 4; i++) reco->SetEMCALChannelTimeRecalibrationFactors( i, (TH1F*) ftime->Get(Form("hAllTimeAvBC%d",i)));
196 else printf("AliEMCALRecoUtils --- Time recalibration OFF\n");
198 } else printf("AliEMCALRecoUtils --- Time recalibration OFF 2\n");