]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EMCAL/beamtest07/SetCalibDB.C
add set and getter for neutral energy fraction
[u/mrichter/AliRoot.git] / EMCAL / beamtest07 / SetCalibDB.C
1 // Script to create calibration parameters and store them into CDB 
2 // from gain values determined for 2007 beam test
3 //
4 // JLK 2007-12-04
5 //
6 //
7 #if !defined(__CINT__)
8 #include "AliRun.h"
9 #include "AliEMCALCalibData.h"
10 #include "AliCDBMetaData.h"
11 #include "AliCDBId.h"
12 #include "AliCDBEntry.h"
13 #include "AliCDBManager.h"
14 #include "AliCDBStorage.h"
15 #endif
16
17 void SetCalibDB() {
18
19   Int_t firstRun   =  0; // What is this                                                
20   Int_t lastRun    = 9999999;
21   Int_t beamPeriod =  1;
22   char* objFormat  = "";
23
24   TString DBFolder  ="local://$ALICE_ROOT/OCDB/EMCAL/beamtest07";
25   firstRun  =  0;
26   lastRun   =  999999999;
27   objFormat = "EMCAL beam test 2007 gain factors and pedestals";
28
29   AliEMCALCalibData *calibda=new AliEMCALCalibData("EMCAL");
30
31   Float_t fADCpedestal = 0.009;
32   Float_t fADCchannel  = 0.0153;  // 250 GeV / (16*1024)                               
33   Float_t ped = 0.;
34   Float_t cc = fADCchannel;
35
36   Int_t nSMod  = 12;
37   Int_t nCol   = 48;
38   Int_t nRow   = 24;
39   Int_t nRow2  = 12; //Modules 11 and 12 are half modules                          
40
41   Int_t colOffset = 40;
42   Int_t rowOffset = 8;
43
44   Double_t gain_ratios[8][8] =
45     {
46       15.9289, 16.2141, 16.1204, 15.9118,
47       15.9363, 15.9402, 16.2257, 16.0097,
48       16.058, 16.1116, 16.039, 16.4167,
49       16.2148, 16.1399, 16.1515, 16.2194,
50       15.9082, 16.0776, 16.0496, 16.2353,
51       15.8054, 16.2158, 16.2344, 16.1023,
52       15.8903, 16.2387, 16.13, 16.157,
53       16.0685, 16.172, 16.3495, 16.3887,
54       16.2842, 16.049, 16.4328, 16.3954,
55       16.4226, 15.7254, 16.1634, 16.3182,
56       16.4216, 16.1201, 16.0000, 16.2305,
57       16.0266, 16.3573, 16.1382, 16.237,
58       16.2981, 16.1796, 15.854, 16.4189,
59       15.6425, 16.287, 16.3293, 16.6308,
60       16.2469, 16.0412, 16.252, 16.3367,
61       16.1412, 16.0646, 16.3996, 16.3479
62     };
63
64   
65   Float_t gains[8][8] =
66     {
67       4.43274, 6.7283, 8.23733, 3.59882,
68       4.2717, 2.85658, 4.86389, 2.71961,
69       3.05523, 3.02552, 3.50615, 3.26494,
70       6.69024, 2.51058, 8.42275, 2.83824,
71       8.05074, 5.36051, 4.36794, 4.73468,
72       9.9684, 5.5, 6.42999, 5.6,
73       7.37306, 5.28314, 5.27662, 5.26982,
74       3.29468, 5.23107, 6.40948, 4.06855,
75       4.09685, 5.37323, 5.32816, 5.89487,
76       9.2395, 5.3, 4.77239, 5.0,
77       4.85923, 3.44063, 4.74517, 5.28772,
78       3.80171, 4.84878, 5.12039, 4.59205,
79       2.34745, 3.16971, 3.61231, 3.65195,
80       3.43496, 3.4, 3.65678, 2.9,
81       2.71648, 3.39577, 3.40896, 3.31741,
82       3.24286, 3.51346, 2.61503, 3.44246
83     };
84
85   for(Int_t supermodule=0; supermodule < nSMod; supermodule++) {
86     for(Int_t column=0; column< nCol; column++) {
87       if(supermodule >= 10)
88         nRow = nRow2;
89       for(Int_t row=0; row< nRow; row++) {
90         if(supermodule < 2 && column > 39 && row > 7 && row < 16) {
91           cc = 1./gain_ratios[column-colOffset][row-rowOffset]/gains[column-colOffset][row-rowOffset];
92           cout << "column = " << column << " column - colOffset = " << column-colOffset << " row = " << " row Offset = " << row-rowOffset << endl;
93         }
94         calibda->SetADCchannel(supermodule,column,row,cc);
95         calibda->SetADCpedestal(supermodule,column,row,ped);
96       }
97     }
98   }
99
100   //Store calibration data into database
101   AliCDBMetaData md;
102   md.SetComment(objFormat);
103   md.SetBeamPeriod(beamPeriod);
104   md.SetResponsible("David Silvermyr");
105   AliCDBId id("EMCAL/Calib/Data",firstRun,lastRun); // create in
106                                                     // EMCAL/Calib/Data DBFolder                     
107
108   AliCDBManager* man = AliCDBManager::Instance();
109   AliCDBStorage* loc = man->GetStorage(DBFolder.Data());
110   loc->Put(calibda, id, &md);
111
112 }
113
114
115
116
117
118
119