AliPhysics  d565ceb (d565ceb)
SetCDB.C
Go to the documentation of this file.
1 
2 
3  char SMP2Name[][100]={
4  "SMA0","SMC0","SMA1","SMC1","SMA2","SMC2","SMA3","SMC3",
5  "SMA4","SMC4","SMA5","SMC5","SMA9","SMC9","SMA10","SMC10",
6  "SMA11","SMC11","SMA12","SMC12"};
7  char SMnumber[][100]={
8  "0","1","2","3","4","5","6","7","8",
9  "9","10","11","12","13","14","15",
10  "16","17","18","19"};
11 
14  char detTypeString[][100]={"EMCAL","EMCALthird","DCAL","DCALthird"};
15  int SMdetType[]={
19  const int kNbColEMCAL=48;
20  const int kNbRowEMCAL=24;
21  const int kNbSMEMCAL=10;
23  const int kNbRowEMCALthird=(int)(kNbRowEMCAL/3);
24  const int kNbSMEMCALthird=2;
25  const int kNbColDCAL=32;
27  const int kNbSMDCAL=6;
30  const int kNbSMDCALthird=2;
31  const int kNbSMtot=kNbSMEMCAL+kNbSMEMCALthird+kNbSMDCAL+kNbSMDCALthird;
32  const int kTabNbCol[4]={kNbColEMCAL,kNbColEMCALthird,kNbColDCAL,kNbColDCALthird};
33  const int kTabNbRow[4]={kNbRowEMCAL,kNbRowEMCALthird,kNbRowDCAL,kNbRowDCALthird};
34  const int kTabNbSM[4]={kNbSMEMCAL,kNbSMEMCALthird,kNbSMDCAL,kNbSMDCALthird};
38 
39 
40 
41 
42 
60 
61 
62 
63 
71 void SetCDB(void)
72 {
73  // Julien : this is the OCDB file with the coeffs that have been used to process the data used for the calibration :
74  TFile * forg = new TFile("/cebaf/cebaf/EMCAL/calibPi0_run2/createOCDB_4_with2015data/Run0_999999999_v1_s0_OCDBcoeffsLHC15ij_EMCALnotValid.root","READ");
75 
76  AliCDBEntry * cdborg = (AliCDBEntry*) forg->Get("AliCDBEntry");
77  AliEMCALCalibData * cparamorg = cdborg->GetObject();
78 
79  //New OCDB container
80  AliEMCALCalibData *cparamnew=new AliEMCALCalibData("EMCAL");
81 
82  //Get the file with the recalibration factors
83  //CUSTOMIZE customize :
84  TFile * frecal = new TFile("/cebaf/cebaf/EMCAL/calibPi0_run2/createOCDB_4_with2015data/multiplyPi0CalibrationFactors_TextToHisto_Final.root","READ");
85  //File with all coeffs at 1.0, for tests :
86  //TFile * frecal = new TFile("/cebaf/cebaf/EMCAL/calibPi0/RecalibrationFactors_allOneForTests_final.root","READ");
87 
88  //cout<<"============== "<<cparamorg->GetName()<<" ==============="<<endl;
89 
90  //cparam->Print("gain");
91  //cparam->Print("ped");
92  // Go tower by tower, get the old calibration value and multiply by the recalibration factor
93  // Add the new calibration factor to new OCDB
94  for(Int_t m = 0; m < kNbSMtot; m++)
95  {
96  TH2F* h = frecal->Get(Form("EMCALRecalFactors_SM%d",m));
97  for (Int_t c = 0; c < kTabNbCol[SMdetType[m]]; c++){
98  for (Int_t r = 0; r < kTabNbRow[SMdetType[m]]; r++){
99  Float_t adcorg=cparamorg->GetADCchannel(m,c,r);
100  Float_t recal = h->GetBinContent(c,r);
101  Float_t newadc = adcorg*recal;
102  //printf("m %d, c %d, r %d: org %1.4f, recal %1.4f, new %1.4f\n",m,c,r,adcorg, recal, newadc);
103  //printf("m %d, c %d, r %d: org %1.4f\n",m,c,r,newadc);
104  //if(recal ==1) printf("m %d, c %d, r %d: org %1.4f, recal %1.4f, new %1.4f\n",m,c,r,adcorg, recal, newadc);
105  cparamnew->SetADCchannel(m,c,r,newadc);
106  }
107  }
108 
109  }
110 
111 
112  //Create OCDB File
113  AliCDBMetaData md;
114  //CUSTOMIZE customize :
115  md.SetComment("bbbb");
116  md.SetBeamPeriod(0);
117  md.SetResponsible("aaaa");
118  md.SetAliRootVersion(gSystem->Getenv("ARVERSION"));
119 
120  // Careful, select here the first run where this calibration is valid
121  //CUSTOMIZE customize :
122  // First run in 2012 : 176326, last run in 2011 : 170593
123  // for 2012 calibration, from LHC12a 172439
124  AliCDBId id("EMCAL/Calib/Data",172439,AliCDBRunRange::Infinity()); // create in EMCAL/Calib/Data DBFolder
125 
126  AliCDBManager* man = AliCDBManager::Instance();
127  AliCDBStorage* loc = man->GetStorage("local://$ALICE_ROOT/OCDB/");
128  loc->Put(cparamnew, id, &md);
129 
130  printf("Done.\n");
131  return;
132  }
133 
Definition: SetCDB.C:12
const int kNbRowEMCAL
Definition: SetCDB.C:20
const int kNbRowDCALthird
Definition: SetCDB.C:29
char detTypeString[][100]
Definition: SetCDB.C:14
const int kNbSMEMCAL
Definition: SetCDB.C:21
Definition: External.C:236
const int kNbSMDCAL
Definition: SetCDB.C:27
const int kTabNbCol[4]
Definition: SetCDB.C:32
TSystem * gSystem
TCanvas * c
Definition: TestFitELoss.C:172
int SMdetType[]
Definition: SetCDB.C:15
const int kNbColEMCALthird
Definition: SetCDB.C:22
const int kNbRowMax
Definition: SetCDB.C:36
void SetCDB(void)
Definition: SetCDB.C:71
const int kNbColEMCAL
Definition: SetCDB.C:19
const int kNbColMax
Definition: SetCDB.C:35
const int kNbColDCAL
Definition: SetCDB.C:25
const int kNbSMEMCALthird
Definition: SetCDB.C:24
int Int_t
Definition: External.C:63
float Float_t
Definition: External.C:68
char SMP2Name[][100]
Definition: SetCDB.C:3
const int kNbSMtot
Definition: SetCDB.C:31
const int kNbColOffsetDCAL
Definition: SetCDB.C:37
const int kNbSMDCALthird
Definition: SetCDB.C:30
const int kNbRowEMCALthird
Definition: SetCDB.C:23
const int kTabNbSM[4]
Definition: SetCDB.C:34
const int kNbRowDCAL
Definition: SetCDB.C:26
char SMnumber[][100]
Definition: SetCDB.C:7
int detTypeType[]
Definition: SetCDB.C:13
const int kNbColDCALthird
Definition: SetCDB.C:28
const int kTabNbRow[4]
Definition: SetCDB.C:33
Definition: SetCDB.C:12