AliPhysics  9c66e61 (9c66e61)
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 *treeLed = emcCalibSignal->GetTreeAvgAmpVsTime();
62  Int_t tea = treeLed->GetEntries();
63  TTree *treeMon = emcCalibSignal->GetTreeLEDAvgAmpVsTime();
64  Int_t tem = treeMon->GetEntries();
65  if (debug) {
66  cout << " LED tree entries " << tea << endl;
67  treeLed->Print();
68  cout << " LEDMon entries " << tem << endl;
69  treeMon->Print();
70  }
71 
72  Int_t mod = 0;
73  Int_t col = 0;
74  Int_t row = 0;
75  Int_t gain = 0;
76  Int_t strip = 0;
77 
78  // associate variables for LEDMON
79  Int_t fRefMon = 0;
80  Double_t fAmpMon = 0;
81  Double_t fRMSMon = 0;
82  Double_t fHourMon = 0;
83  treeMon->SetBranchAddress("fRefNum",&fRefMon);
84  treeMon->SetBranchAddress("fAvgAmp",&fAmpMon);
85  treeMon->SetBranchAddress("fRMS",&fRMSMon);
86  treeMon->SetBranchAddress("fHour",&fHourMon);
87  for (Int_t i=0; i<tem; ++i) {
88  treeMon->GetEntry(i);
89  emcCalibSignal->DecodeRefNum(fRefMon, &mod, &strip, &gain);
90  if (debug)
91  Printf("fRefNum=%d, mod= %d, strip=%d, amp=%.3f, rms=%.3f, gain=%d", fRefMon, mod, strip, fAmpMon, fRMSMon, gain);
92  ret->FillStrip(mod, gain, strip, fAmpMon, fRMSMon);
93  }
94 
95  // associate variables for LED
96  Int_t fChanLed = 0;
97  Double_t fAmpLed = 0;
98  Double_t fRMSLed = 0;
99  Double_t fHourLed = 0;
100  treeLed->SetBranchAddress("fChannelNum",&fChanLed);
101  treeLed->SetBranchAddress("fHour",&fHourLed);
102  treeLed->SetBranchAddress("fAvgAmp",&fAmpLed);
103  treeLed->SetBranchAddress("fRMS",&fRMSLed);
104  for (Int_t i=0; i<tea; ++i) {
105  treeLed->GetEntry(i);
106  emcCalibSignal->DecodeChannelNum(fChanLed, &mod, &col, &row, &gain);
107  if (debug)
108  Printf("fChannelNum=%d, mod=%d, col=%d, row=%d, amp=%.3f, rms=%.3f, gain=%d", fChanLed, mod, col, row, fAmpLed, fRMSLed, gain);
109  ret->FillLed(mod,gain,col, row, fAmpLed, fRMSLed);
110  }
111 
112  return ret;
113 }
114 
115 void testOCDB_LED(Int_t runNb)
116 {
117  LInfo *i = readOCDB_LED(runNb,1);
118  i->Print();
119  return;
120 }
121 #endif
double Double_t
Definition: External.C:58
void testOCDB_LED(Int_t runNb=286350)
Definition: readOCDB_LED.C:115
void Print(Option_t *option="") const
Definition: LInfo.cxx:272
Definition: LInfo.h:11
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:134
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:210
bool Bool_t
Definition: External.C:53