1 #if !defined(__CINT__) || defined(__MAKECINT__) 2 #include <AliEMCALGeometry.h> 3 #include <AliOADBContainer.h> 5 #include <TClonesArray.h> 41 TCalSM() :
fSM(0), fAvgT(0), fT1(0), fT2(0), fT3(0), fT4(0), fT5(0), fT6(0), fT7(0), fFracLed(0), fFracMon(0) {;}
60 TCalInfo() : fRunNo(0), fAvTime(0), fFirstTime(0), fLastTime(0), fMinT(0), fMaxT(0), fFracS(0), fSMs(
"TCalSM"), fCells(
"TCalCell") {}
76 const char *ofile =
"treeout.root",
79 TString badpath =
"$ALICE_ROOT/OADB/EMCAL",
80 Int_t referenceRun = 286313
88 cout <<
"INFO: will be using bad channel map from: " << badpath.Data() << endl;
93 cerr <<
"No time objects for period " << period << endl;
98 cerr <<
"No led objects for period " << period << endl;
102 const Int_t rns=la->GetEntries();
103 cout <<
"Working on period " << period <<
" with " << rns <<
" runs" << endl;
105 AliEMCALGeometry *g= AliEMCALGeometry::GetInstanceFromRunNumber(referenceRun);
106 const Int_t kSM=g->GetNumberOfSuperModules();
107 const Int_t kNcells=g->GetNCells();
108 const Int_t gain = 1;
111 TFile *out = TFile::Open(ofile,
"recreate");
112 out->SetCompressionLevel(9);
113 TTree* fTree =
new TTree(
"tcal",
"Temp calibration tree");
114 fTree->SetDirectory(out);
115 fTree->Branch(
"event", &info, 32000, 99);
117 TClonesArray &carr = info->
fCells;
118 TClonesArray &cSMarr = info->
fSMs;
126 for (
Int_t i=0;i<kSM;++i)
129 for (
Int_t i=0;i<rns;++i) {
132 LInfo *linfo =
dynamic_cast<LInfo*
>(la->At(l));
134 cout <<
"skipping due to missing info in LED tree!" << endl;
138 TInfo *tinfo =
dynamic_cast<TInfo*
>(ta->At(t));
140 cout <<
"skipping due to missing info in temp tree!" << endl;
152 cout <<
" Run numbers differ, skipping " << runl <<
" " << runt << endl;
155 cout <<
"Working on run " << runl << endl;
166 cSMarr.ExpandCreate(kSM);
167 for (
Int_t sm=0; sm<kSM; sm++) {
168 cout <<
"SM "<< sm <<
":\t"<< tinfo->
AvgTempSM(sm) << endl;
172 smInfo->
fT1 = tinfo->
T(sm*8,3);
173 smInfo->
fT2 = tinfo->
T(sm*8+1,3);
174 smInfo->
fT3 = tinfo->
T(sm*8+2,3);
175 smInfo->
fT4 = tinfo->
T(sm*8+3,3);
176 smInfo->
fT5 = tinfo->
T(sm*8+4,3);
177 smInfo->
fT6 = tinfo->
T(sm*8+5,3);
178 smInfo->
fT7 = tinfo->
T(sm*8+6,3);
179 smInfo->
fT8 = tinfo->
T(sm*8+7,3);
185 carr.ExpandCreate(kNcells);
188 for (
Int_t sm=0; sm<kSM; ++sm) {
192 if (runt!=runno && appBC) {
194 AliOADBContainer *contBC =
new AliOADBContainer(
"");
195 contBC->InitFromFile(Form(
"%s/EMCALBadChannels.root",badpath.Data()),
"AliEMCALBadChannels");
197 cerr <<
"Could not load bc map for run " << runno << endl;
199 Int_t idxCurr =contBC->GetIndexForRun(runno);
200 if ( idx != idxCurr ){
201 cout <<
"INFO: need to switch bad channel map" << endl;
204 cout <<
"WARNING: missing bad channel map for run: " << runno <<
" Will continue without using bad channel map!"<< endl;
206 for (
Int_t i=0; i<kSM; ++i) {
211 badmaps[i] = (TH2I*)arrayBC->FindObject(Form(
"EMCALBadChannelMap_Mod%d",i));
212 badmaps[i]->SetDirectory(0);
221 for (
Int_t sm=0; sm<kSM; ++sm) {
222 Int_t nrow = g->GetNumberOfCellsInPhiDirection(sm);
223 Int_t ncol = g->GetNumberOfCellsInEtaDirection(sm);
230 for (
Int_t col=0; col<ncol; ++col) {
231 for (
Int_t row=0; row<nrow; ++row) {
232 Int_t id = g->GetAbsCellIdFromCellIndexes(sm,row,col);
236 if (appBC && badmaps[sm])
237 badcell = badmaps[sm]->GetBinContent(col,row);
241 cell->
fBad = badcell;
246 g->ShiftOfflineToOnlineCellIndexes(sm, orow, ocol);
248 cell->
fLedM = hledm->GetBinContent(hledm->FindBin(ocol,orow));
249 cell->
fLedR = hledm->GetBinError(hledm->FindBin(ocol,orow));
250 cell->
fMonM = hmonm->GetBinContent(hmonm->FindBin(ocol/2));
251 cell->
fMonR = hmonm->GetBinError(hmonm->FindBin(ocol/2));
252 cell->
fLocT = tinfo->
T(ns,3);
253 cell->
fSMT = avg[sm];
Double_t FracLeds(Int_t sm, Int_t gain=1) const
UInt_t GetLastTime() const
UInt_t GetAverageTime() const
Float_t AbsMaxT(Int_t t=2) const
TProfile * GetLedMonRmsHist(Int_t sm, Int_t gain=1) const
TProfile2D * GetLedRmsHist(Int_t sm, Int_t gain=1) const
void createTree(const char *period, const char *ofile="treeout.root", Bool_t doprint=0, Bool_t appBC=kFALSE, TString badpath="$ALICE_ROOT/OADB/EMCAL", Int_t referenceRun=286313)
Double_t FracStrips(Int_t sm, Int_t gain=1) const
TProfile * GetLedMonHist(Int_t sm, Int_t gain=1) const
UInt_t GetFirstTime() const
Float_t AvgTempSM(Int_t sm, Int_t type=3) const
TProfile2D * GetLedHist(Int_t sm, Int_t gain=1) const
static Int_t SensId(Int_t sm, Int_t row, Int_t col)
Float_t T(Int_t ns, Int_t t) const
Float_t AbsMinT(Int_t t=1) const
Double_t Fraction() const