AliPhysics  754e963 (754e963)
readOCDB_LED.C
Go to the documentation of this file.
1 #if !defined( __CINT__) || defined(__MAKECINT__)
2 #include <AliCDBEntry.h>
3 #include <AliCDBEntry.h>
4 #include <AliCDBManager.h>
5 #include <AliCDBMetaData.h>
6 #include <AliCaloCalibSignal.h>
7 #include <AliDCSValue.h>
8 #include <AliEMCALPreprocessor.h>
9 #include <AliEMCALSensorTempArray.h>
10 #include <AliEMCALTriggerDCSConfig.h>
11 #include <AliEMCALTriggerSTUDCSConfig.h>
12 #include <AliEMCALTriggerTRUDCSConfig.h>
13 #include <Riostream.h>
14 #include <TCanvas.h>
15 #include <TDatime.h>
16 #include <TF1.h>
17 #include <TFile.h>
18 #include <TGrid.h>
19 #include <TH1F.h>
20 #include <TH2F.h>
21 #include <TMap.h>
22 #include <TMath.h>
23 #include <TNtuple.h>
24 #include <TTree.h>
25 #include "LInfo.h"
26 
27 LInfo *readOCDB_LED(Int_t runNb = 286350, Bool_t debug=1);
28 void testOCDB_LED(Int_t runNb = 286350);
29 #endif
30 
31 #ifndef _ledfuncs_
32 #define _ledfuncs_
34 {
35  if (!gGrid)
36  TGrid::Connect("alien://");
37 
38  AliCDBManager* cdb = AliCDBManager::Instance();
39  if (cdb->GetDefaultStorage()==0)
40  cdb->SetDefaultStorage("raw://");
41  cdb->SetRun(runNb);
42 
43  AliCDBEntry *en = 0;
44  try {
45  en=cdb->Get("EMCAL/Calib/LED/");
46  } catch (...) { ; }
47  if (!en) {
48  printf("no entry found for run %d!\n", runNb);
49  return 0;
50  }
51 
52  AliCaloCalibSignal *emcCalibSignal=dynamic_cast<AliCaloCalibSignal*>(en->GetObject());
53  if (!emcCalibSignal) {
54  printf("can not cast to calib signal!\n");
55  return 0;
56  }
57  //emcCalibSignal->Print();
58 
59  LInfo *ret = new LInfo(runNb);
60 
61  TTree *treeAmp = emcCalibSignal->GetTreeAvgAmpVsTime();
62  TTree *treeLEDAmp = emcCalibSignal->GetTreeLEDAvgAmpVsTime();
63  Int_t tea = treeAmp->GetEntries();
64  Int_t tem = treeLEDAmp->GetEntries();
65  if (debug) {
66  cout << " Tree entries " << tea << endl;
67  cout << " TreeLEDMon entries " << tem << endl;
68  }
69 
70  Int_t fNum = 0;
71  Double_t fAvgAmp = 0;
72  Double_t fHour = 0;
73  Double_t fRMS = 0;
74  treeAmp->SetBranchAddress("fChannelNum",&fNum);
75  treeAmp->SetBranchAddress("fHour",&fHour);
76  treeAmp->SetBranchAddress("fAvgAmp",&fAvgAmp);
77  treeAmp->SetBranchAddress("fRMS",&fRMS);
78 
79  // associate variables also for LED
80  treeLEDAmp->SetBranchAddress("fRefNum",&fNum);
81  treeLEDAmp->SetBranchAddress("fHour",&fHour);
82  treeLEDAmp->SetBranchAddress("fAvgAmp",&fAvgAmp);
83  treeLEDAmp->SetBranchAddress("fRMS",&fRMS);
84 
85  Int_t mod = 0;
86  Int_t col = 0;
87  Int_t row = 0;
88  Int_t gain = 0;
89  Int_t strip = 0;
90 
91  for (Int_t i=0; i<tem; ++i) {
92  treeLEDAmp->GetEntry(i);
93  emcCalibSignal->DecodeRefNum(fNum, &mod, &strip, &gain);
94  if (debug)
95  Printf("fRefNum = %d, mod = %d, strip = %d, amp = %f, gain = %d", fNum, mod, strip, fAvgAmp, gain);
96  ret->FillStrip(mod,gain,strip, fAvgAmp, fRMS);
97  }
98 
99  for (Int_t i=0; i<tea; ++i) {
100  treeAmp->GetEntry(i);
101  emcCalibSignal->DecodeChannelNum(fNum, &mod, &col, &row, &gain);
102  if (debug)
103  Printf("fChannelNum = %d, mod = %d, col = %d, amp = %f, gain = %d", fNum, mod, col, fAvgAmp, gain);
104  ret->FillLed(mod,gain,col, row, fAvgAmp, fRMS);
105  }
106 
107  return ret;
108 }
109 
110 void testOCDB_LED(Int_t runNb)
111 {
112  LInfo *i = readOCDB_LED(runNb,1);
113  i->Print();
114  return;
115 }
116 #endif
double Double_t
Definition: External.C:58
void testOCDB_LED(Int_t runNb=286350)
Definition: readOCDB_LED.C:110
void Print(Option_t *option="") const
Definition: LInfo.cxx:247
Definition: LInfo.h:13
int Int_t
Definition: External.C:63
void FillLed(Int_t mod, Int_t gain, Int_t col, Int_t row, Double_t amp, Double_t rms)
Definition: LInfo.cxx:122
LInfo * readOCDB_LED(Int_t runNb=286350, Bool_t debug=1)
Definition: readOCDB_LED.C:33
void FillStrip(Int_t mod, Int_t gain, Int_t strip, Double_t amp, Double_t rms)
Definition: LInfo.cxx:193
bool Bool_t
Definition: External.C:53