AliPhysics  2c6b7ad (2c6b7ad)
PlotLEDruns.C
Go to the documentation of this file.
1 #include <signal.h>
2 //#include <sys/time.h>
3 #include <stdio.h>
4 #include <vector>
5 #include <iostream>
6 #include <fstream>
7 #include <string>
8 #include <iosfwd>
9 #include <iostream>
10 #include <numeric>
11 #include <queue>
12 #include <set>
13 #include <sstream>
14 
15 #include <map>
16 #include <utility>
17 #include <iterator>
18 
19 
20 #include <TApplication.h>
21 #include <TChain.h>
22 #include <TF1.h>
23 #include <TH1F.h>
24 #include <TH2F.h>
25 #include <TFile.h>
26 #include <TCanvas.h>
27 #include <TFrame.h>
28 #include <TPostScript.h>
29 #include <TLine.h>
30 #include <TGaxis.h>
31 #include <TStyle.h>
32 #include <TGraphErrors.h>
33 #include <TMath.h>
34 #include <TMatrixF.h>
35 #include <TText.h>
36 
37 
38 //#include "/cebaf/faivre/recherche/utilities/defineMyPalette2011.C"
39 
40 
41 namespace std {} using namespace std;
42 
43 
44 bool wled=true;
45 bool ledonly=true;
46 int stripPlot=-1;
47 char RunlistFilename[200]="";
48 
49 
50 const double coefFactorWanted=0.0162;
51 
52 
53 
54 
55 
57 char detTypeString[][100]={"EMCAL","EMCALthird","DCAL","DCALthird"};
58 
59 // voir http://dsilverm.web.cern.ch/dsilverm/fee/addrP2.html
60 char SMP2Name[][100]={"SMA0","SMC0","SMA1","SMC1","SMA2","SMC2","SMA3","SMC3","SMA4","SMC4","SMA5","SMC5","SMA9","SMC9","SMA10","SMC10","SMA11","SMC11","SMA12","SMC12"};
62 
63 
64 
89 
93 void PlotLEDruns(int run1,int run2,int run3,TString ident="")
94 {int i,j,iRun,iSM,iCol,iRow,iColGlob,iRowGlob,tabCol[3],NumRun[3],cmptIntg[3],cmptAmpl[3],cmptEmismatch[3];
95  char name[150],name2[150],fchNameOCDBcoeffsFile[200];
96  double maxloc,ampli0,ampli1,ampli2,paramFactor,E0,E1,E2;
97  TFile *rootFileIn;
98 
99  const int kNbColEMCAL=48;
100  const int kNbRowEMCAL=24;
101  const int kNbSMEMCAL=10;
102  const int kNbColEMCALthird=kNbColEMCAL;
103  const int kNbRowEMCALthird=(int)(kNbRowEMCAL/3);
104  const int kNbSMEMCALthird=2;
105  const int kNbColDCAL=32;
106  const int kNbRowDCAL=kNbRowEMCAL;
107  const int kNbSMDCAL=6;
110  const int kNbSMDCALthird=2;
111  const int kNbSMtot=kNbSMEMCAL+kNbSMEMCALthird+kNbSMDCAL+kNbSMDCALthird;
112  const int kTabNbCol[4]={kNbColEMCAL,kNbColEMCALthird,kNbColDCAL,kNbColDCALthird};
113  const int kTabNbRow[4]={kNbRowEMCAL,kNbRowEMCALthird,kNbRowDCAL,kNbRowDCALthird};
114  const int kTabNbSM[4]={kNbSMEMCAL,kNbSMEMCALthird,kNbSMDCAL,kNbSMDCALthird};
115  const int kNbColMax=kNbColEMCAL;
116  const int kNbRowMax=kNbRowEMCAL;
117 
118  //defineMyPalette2011(30,5);
119 
120  double coeffOCDBbefore[kNbSMtot][kNbColMax][kNbRowMax]={{{0.}}};
121  double coeffOCDBafter[kNbSMtot][kNbColMax][kNbRowMax]={{{0.}}};
122 
123  //CUSTOMIZE customize the runMode and the cut values :
124  int runMode=0; // 0 = compare HV changes ; 1 = compare various runs with the same HV.
125  double cutWarnERatio=0.05;
126  double cutWarnAmpRatio=0.05;
127  double cutMinIntg=5.;
128  double cutMinAmp=20.;
129  double maxIntg=2800.;
130  double maxAmp=1100.;
131  double maxE=20.;
132  double multFactGraphAmp=0.7;
133  double multFactGraphE=0.6;
134 
135  NumRun[0]=run1;
136  NumRun[1]=run2;
137  NumRun[2]=run3;
138 
139  tabCol[0]=kGreen+2;
140  tabCol[1]=kRed;
141  tabCol[2]=kBlue;
142 
143  TH1F *hampHighGainTow[3][kNbSMtot][kNbRowMax][kNbColMax]; //(SM,row,col), sic (not col,row).
144 
145  switch (runMode)
146  {case 0 : printf("\n--> Run mode = compare HV changes (runs have different HVs).\n\n");
147  break;
148  case 1 : printf("\n--> Run mode = compare various runs with the same HV.\n\n");
149  break;
150  default : printf("Unknown run mode %d, exiting.\n",runMode);
151  return;
152  }
153 
154  char fchNameBase[200],fchNameRoot[200],fchNamePs[200],fchNameOut[200];
155  FILE *inFile,*outFile,*OCDBcoeffsFile;
156  if (ident.IsNull()) sprintf(fchNameBase,"output_plotLEDruns_runs%d.%d.%d",run1,run2,run3);
157  else sprintf(fchNameBase,"output_plotLEDruns_%s",ident.Data());
158  sprintf(fchNameRoot,"%s.root",fchNameBase);
159  sprintf(fchNamePs,"%s.ps",fchNameBase);
160  sprintf(fchNameOut,"%s.out",fchNameBase);
161  outFile=fopen(fchNameOut,"w");
162 
163  fprintf(outFile,"\nAnalyzed run numbers : %d %d %d\n",run1,run2,run3);
164  fprintf(outFile,"Chosen run mode : %d\n",runMode);
165 
166  // Load the OCDB factors :
167  //CUSTOMIZE customize every year : old OCDB coeffs :
168  //sprintf(fchNameOCDBcoeffsFile,"/cebaf/faivre/recherche/calibPi0/recalculateEMCAL_HV_Apr2013/OCDBparamsAfterCalib2012_allSMs.txt"); //This is WRONG
169  sprintf(fchNameOCDBcoeffsFile,"/cebaf/cebaf/EMCAL/calibPi0_run2/recalculateHV_4_with2015data/OCDBparamsAfterCalib2015.txt");
170  fprintf(outFile,"Load old OCDB coeffs from : %s\n",fchNameOCDBcoeffsFile);
171  OCDBcoeffsFile = fopen(fchNameOCDBcoeffsFile,"r");
172  if (!OCDBcoeffsFile) {printf("File %s can not be found\n",fchNameOCDBcoeffsFile);exit(-1);}
173  while (fscanf(OCDBcoeffsFile,"%d %d %d %lf",&iSM,&iCol,&iRow,&paramFactor)>0)
174  {coeffOCDBbefore[iSM][iCol][iRow]=paramFactor;
175  }
176  fclose(OCDBcoeffsFile);
177  for (iSM=0;iSM<kNbSMtot;iSM++)
178  {//CUSTOMIZE customize every HV calculation iteration : new OCDB coeffs :
179  //sprintf(fchNameOCDBcoeffsFile,"/cebaf/cebaf/EMCAL/calibPi0_run2/recalculateHV_4_with2015data/output_HVrecalculation_pass2/%s/NewParamFactor.txt",SMP2Name[iSM]);
180  sprintf(fchNameOCDBcoeffsFile,"/cebaf/cebaf/EMCAL/calibPi0_run2/recalculateHV_4_with2015data/output_HVrecalculation_pass2_handMadeFinalCorrections_createSetBiasScripts/%s/NewParamFactor.txt",SMP2Name[iSM]);
181  fprintf(outFile,"Load new OCDB coeffs from : %s\n",fchNameOCDBcoeffsFile);
182  OCDBcoeffsFile = fopen(fchNameOCDBcoeffsFile,"r");
183  if (!OCDBcoeffsFile)
184  {printf("File %s can not be found\nWill use fake coeffs for SM %s !\n",fchNameOCDBcoeffsFile,SMP2Name[iSM]);
185  fprintf(outFile,"File %s can not be found\nWill use fake coeffs for SM %s !\n",fchNameOCDBcoeffsFile,SMP2Name[iSM]);
186  }
187  else
188  {while (fscanf(OCDBcoeffsFile,"%d %d %d %lf",&iSM,&iCol,&iRow,&paramFactor)>0) coeffOCDBafter[iSM][iCol][iRow]=paramFactor;
189  fclose(OCDBcoeffsFile);
190  }
191  }
192 
193  const int cWidth=500;
194  const int cHeight=(int)(500*(30./21.));
195  TCanvas *c1 = new TCanvas("c1","EMCal cosmics analysis",cWidth,cHeight);
196  TPostScript *ps = new TPostScript(fchNamePs,111);
197 
198  /*From http://root.cern.ch/root/HowtoHistogram.html :
199  "Like any other ROOT objects, histograms can be written to a file. Example: hist->Write(). When an histogram is created, a reference to this histogram is added in the list of objects of the current directory in memory. If no file is opened at the time of the creation, the histogram is added to the default list of objects in memory. If a file exists, the histogram is added to the list of memory objects associated to this file."
200  That's the reason why, when I close rootFileIn, I encounter problems as soon as I try to access hampHighGainTow[iRun][iSM][i][j] afterwards.
201  But : if I close rootFileIn after the loop, also the hAllSpace... histoes are defined while rootFileIn is still opened, and thus associated to it, and thus causes problems when we need to manipulate them afterwards (Draw,...). -- although the segm viol doesn't occur systematically (but is reproducable for a given code config).
202  Instanciating the hampHighGainTow[iRun][iSM][i][j]'s before rootFileIn is opened doesn't solve. Cloning works but doesn't solve either.
203  So : I must close nothing...
204  */
205 
206  for (iRun=0;iRun<3;iRun++)
207  {for (iSM=0;iSM<kNbSMtot;iSM++)
208  {sprintf(name,"/cebaf/cebaf/EMCAL/anaLHC/ledana/root4gain/gain_SM%d_%d.root",iSM,NumRun[iRun]);
209  printf("Opening %s\n",name);
210  rootFileIn=new TFile(name,"READONLY");
211  if (rootFileIn->IsZombie()) {exit(-1);}
212 
213  for (iCol=0;iCol<kTabNbCol[SMdetType[iSM]];iCol++)
214  {for (iRow=0;iRow<kTabNbRow[SMdetType[iSM]];iRow++) //Flip from Grenoble/electronic mapping to Alice-offline mapping.
215  {if ((iSM%2) == 0) sprintf(name,"hampHighGain_r%i_c%i",iRow,iCol); //Side A.
216  else sprintf(name,"hampHighGain_r%i_c%i",(kTabNbRow[SMdetType[iSM]]-1)-iRow,(kTabNbCol[SMdetType[iSM]]-1)-iCol); //Side C.
217  hampHighGainTow[iRun][iSM][iRow][iCol]=(TH1F*)rootFileIn->Get(name);
218  if( !(hampHighGainTow[iRun][iSM][iRow][iCol]))
219  {printf("hist %s not found in %s. Aborting\n",name,rootFileIn->GetName());
220  exit(-1);
221  }
222  }
223  }
224  }
225  }
226 
227  TH1F **hDistrIntg;
228  TH1F **hDistrAmp;
229  TH1F **hDistrE;
230  TH1F **hDistrIntgRatio;
231  TH1F **hDistrAmpRatio;
232  TH1F **hDistrERatio;
233  TH1F **hDistrIntgRatioZm;
234  TH1F **hDistrAmpRatioZm;
235  TH1F **hDistrERatioZm;
236  TH2F **hAllSpaceEMCALIntg;
237  TH2F **hAllSpaceEMCALIntgRatio;
238  TH2F **hAllSpaceEMCALAmp;
239  TH2F **hAllSpaceEMCALAmpRatio;
240  TH2F **hAllSpaceEMCALE;
241  TH2F **hAllSpaceEMCALERatio;
242  TH2F **hAllSpaceDCALIntg;
243  TH2F **hAllSpaceDCALIntgRatio;
244  TH2F **hAllSpaceDCALAmp;
245  TH2F **hAllSpaceDCALAmpRatio;
246  TH2F **hAllSpaceDCALE;
247  TH2F **hAllSpaceDCALERatio;
248  TH2F **h2Amp;
249  TH2F **h2E;
250  TH2F **h2RatioVsIntg;
251  TH2F **h2RatioVsAmp;
252  hDistrIntg = new TH1F*[3*(kNbSMtot+1)];
253  hDistrAmp = new TH1F*[3*(kNbSMtot+1)];
254  hDistrE = new TH1F*[3*(kNbSMtot+1)];
255  hDistrIntgRatio = new TH1F*[2*(kNbSMtot+1)];
256  hDistrAmpRatio = new TH1F*[2*(kNbSMtot+1)];
257  hDistrERatio = new TH1F*[2*(kNbSMtot+1)];
258  hDistrIntgRatioZm = new TH1F*[2*(kNbSMtot+1)];
259  hDistrAmpRatioZm = new TH1F*[2*(kNbSMtot+1)];
260  hDistrERatioZm = new TH1F*[2*(kNbSMtot+1)];
261  hAllSpaceEMCALIntg = new TH2F*[3];
262  hAllSpaceEMCALIntgRatio = new TH2F*[2];
263  hAllSpaceEMCALAmp = new TH2F*[3];
264  hAllSpaceEMCALAmpRatio = new TH2F*[2];
265  hAllSpaceEMCALE = new TH2F*[3];
266  hAllSpaceEMCALERatio = new TH2F*[2];
267  hAllSpaceDCALIntg = new TH2F*[3];
268  hAllSpaceDCALIntgRatio = new TH2F*[2];
269  hAllSpaceDCALAmp = new TH2F*[3];
270  hAllSpaceDCALAmpRatio = new TH2F*[2];
271  hAllSpaceDCALE = new TH2F*[3];
272  hAllSpaceDCALERatio = new TH2F*[2];
273  h2Amp = new TH2F*[2*(kNbSMtot+1)];
274  h2E = new TH2F*[2*(kNbSMtot+1)];
275  h2RatioVsIntg = new TH2F*[6*(kNbSMtot+1)];
276  h2RatioVsAmp = new TH2F*[6*(kNbSMtot+1)];
277  //Figure "3" here stands for number of analyzed runs ; "2" for the ratios or comparisons, because run2/run1 and run3/run1.
278  for (j=0;j<3;j++)
279  {hAllSpaceEMCALIntg[j] = new TH2F(Form("hAllSpaceEMCALIntg_%d",j),Form("hAllSpaceEMCALIntg_%d",j),2*kNbColMax,-0.5,2.*kNbColMax-0.5,(int)((kNbSMEMCAL+1)/2)*kNbRowEMCAL+(int)((kNbSMEMCALthird+1)/2)*kNbRowEMCALthird,-0.5,(int)((kNbSMEMCAL+1)/2)*kNbRowEMCAL+(int)((kNbSMEMCALthird+1)/2)*kNbRowEMCALthird-0.5);
280  hAllSpaceEMCALIntg[j]->SetXTitle("Column");
281  hAllSpaceEMCALIntg[j]->SetYTitle("Row");
282  hAllSpaceEMCALIntg[j]->SetStats(0);
283  hAllSpaceEMCALIntg[j]->SetContour(30);
284  hAllSpaceEMCALAmp[j] = new TH2F(Form("hAllSpaceEMCALAmp_%d",j),Form("hAllSpaceEMCALAmp_%d",j),2*kNbColMax,-0.5,2.*kNbColMax-0.5,(int)((kNbSMEMCAL+1)/2)*kNbRowEMCAL+(int)((kNbSMEMCALthird+1)/2)*kNbRowEMCALthird,-0.5,(int)((kNbSMEMCAL+1)/2)*kNbRowEMCAL+(int)((kNbSMEMCALthird+1)/2)*kNbRowEMCALthird-0.5);
285  hAllSpaceEMCALAmp[j]->SetXTitle("Column");
286  hAllSpaceEMCALAmp[j]->SetYTitle("Row");
287  hAllSpaceEMCALAmp[j]->SetStats(0);
288  hAllSpaceEMCALAmp[j]->SetContour(30);
289  hAllSpaceEMCALE[j] = new TH2F(Form("hAllSpaceEMCALE_%d",j),Form("hAllSpaceEMCALE_%d",j),2*kNbColMax,-0.5,2.*kNbColMax-0.5,(int)((kNbSMEMCAL+1)/2)*kNbRowEMCAL+(int)((kNbSMEMCALthird+1)/2)*kNbRowEMCALthird,-0.5,(int)((kNbSMEMCAL+1)/2)*kNbRowEMCAL+(int)((kNbSMEMCALthird+1)/2)*kNbRowEMCALthird-0.5);
290  hAllSpaceEMCALE[j]->SetXTitle("Column");
291  hAllSpaceEMCALE[j]->SetYTitle("Row");
292  hAllSpaceEMCALE[j]->SetStats(0);
293  hAllSpaceEMCALE[j]->SetContour(30);
294  hAllSpaceDCALIntg[j] = new TH2F(Form("hAllSpaceDCALIntg_%d",j),Form("hAllSpaceDCALIntg_%d",j),2*kNbColMax,-0.5,2.*kNbColMax-0.5,(int)((kNbSMDCAL+1)/2)*kNbRowDCAL+(int)((kNbSMDCALthird+1)/2)*kNbRowDCALthird,-0.5,(int)((kNbSMDCAL+1)/2)*kNbRowDCAL+(int)((kNbSMDCALthird+1)/2)*kNbRowDCALthird-0.5);
295  hAllSpaceDCALIntg[j]->SetXTitle("Column");
296  hAllSpaceDCALIntg[j]->SetYTitle("Row");
297  hAllSpaceDCALIntg[j]->SetStats(0);
298  hAllSpaceDCALIntg[j]->SetContour(30);
299  hAllSpaceDCALAmp[j] = new TH2F(Form("hAllSpaceDCALAmp_%d",j),Form("hAllSpaceDCALAmp_%d",j),2*kNbColMax,-0.5,2.*kNbColMax-0.5,(int)((kNbSMDCAL+1)/2)*kNbRowDCAL+(int)((kNbSMDCALthird+1)/2)*kNbRowDCALthird,-0.5,(int)((kNbSMDCAL+1)/2)*kNbRowDCAL+(int)((kNbSMDCALthird+1)/2)*kNbRowDCALthird-0.5);
300  hAllSpaceDCALAmp[j]->SetXTitle("Column");
301  hAllSpaceDCALAmp[j]->SetYTitle("Row");
302  hAllSpaceDCALAmp[j]->SetStats(0);
303  hAllSpaceDCALAmp[j]->SetContour(30);
304  hAllSpaceDCALE[j] = new TH2F(Form("hAllSpaceDCALE_%d",j),Form("hAllSpaceDCALE_%d",j),2*kNbColMax,-0.5,2.*kNbColMax-0.5,(int)((kNbSMDCAL+1)/2)*kNbRowDCAL+(int)((kNbSMDCALthird+1)/2)*kNbRowDCALthird,-0.5,(int)((kNbSMDCAL+1)/2)*kNbRowDCAL+(int)((kNbSMDCALthird+1)/2)*kNbRowDCALthird-0.5);
305  hAllSpaceDCALE[j]->SetXTitle("Column");
306  hAllSpaceDCALE[j]->SetYTitle("Row");
307  hAllSpaceDCALE[j]->SetStats(0);
308  hAllSpaceDCALE[j]->SetContour(30);
309  for (i=0;i<kNbSMtot+1;i++)
310  {hDistrIntg[3*i+j] = new TH1F(Form("hDistrIntg_%d_%d",i,j),Form("hDistrIntg_%d_%d",i,j),100,0.,maxIntg);
311  hDistrIntg[3*i+j]->SetXTitle("Integral");
312  hDistrIntg[3*i+j]->SetYTitle("Counts");
313  hDistrIntg[3*i+j]->SetStats(0);
314  hDistrIntg[3*i+j]->SetLineColor(tabCol[j]);
315  hDistrAmp[3*i+j] = new TH1F(Form("hDistrAmp_%d_%d",i,j),Form("hDistrAmp_%d_%d",i,j),100,0.,maxAmp);
316  hDistrAmp[3*i+j]->SetXTitle("Amplitude");
317  hDistrAmp[3*i+j]->SetYTitle("Counts");
318  hDistrAmp[3*i+j]->SetStats(0);
319  hDistrAmp[3*i+j]->SetLineColor(tabCol[j]);
320  hDistrE[3*i+j] = new TH1F(Form("hDistrE_%d_%d",i,j),Form("hDistrE_%d_%d",i,j),100,0.,maxE);
321  hDistrE[3*i+j]->SetXTitle("Energy");
322  hDistrE[3*i+j]->SetYTitle("Counts");
323  hDistrE[3*i+j]->SetStats(0);
324  hDistrE[3*i+j]->SetLineColor(tabCol[j]);
325  }
326  }
327  for (j=0;j<2;j++)
328  {hAllSpaceEMCALIntgRatio[j] = new TH2F(Form("hAllSpaceEMCALIntgRatio_%d",j),Form("hAllSpaceEMCALIntgRatio_%d",j),2*kNbColMax,-0.5,2.*kNbColMax-0.5,(int)((kNbSMEMCAL+1)/2)*kNbRowEMCAL+(int)((kNbSMEMCALthird+1)/2)*kNbRowEMCALthird,-0.5,(int)((kNbSMEMCAL+1)/2)*kNbRowEMCAL+(int)((kNbSMEMCALthird+1)/2)*kNbRowEMCALthird-0.5);
329  hAllSpaceEMCALIntgRatio[j]->SetXTitle("Column");
330  hAllSpaceEMCALIntgRatio[j]->SetYTitle("Row");
331  hAllSpaceEMCALIntgRatio[j]->SetStats(0);
332  hAllSpaceEMCALIntgRatio[j]->SetContour(30);
333  hAllSpaceEMCALAmpRatio[j] = new TH2F(Form("hAllSpaceEMCALAmpRatio_%d",j),Form("hAllSpaceEMCALAmpRatio_%d",j),2*kNbColMax,-0.5,2.*kNbColMax-0.5,(int)((kNbSMEMCAL+1)/2)*kNbRowEMCAL+(int)((kNbSMEMCALthird+1)/2)*kNbRowEMCALthird,-0.5,(int)((kNbSMEMCAL+1)/2)*kNbRowEMCAL+(int)((kNbSMEMCALthird+1)/2)*kNbRowEMCALthird-0.5);
334  hAllSpaceEMCALAmpRatio[j]->SetXTitle("Column");
335  hAllSpaceEMCALAmpRatio[j]->SetYTitle("Row");
336  hAllSpaceEMCALAmpRatio[j]->SetStats(0);
337  hAllSpaceEMCALAmpRatio[j]->SetContour(30);
338  hAllSpaceEMCALERatio[j] = new TH2F(Form("hAllSpaceEMCALERatio_%d",j),Form("hAllSpaceEMCALERatio_%d",j),2*kNbColMax,-0.5,2.*kNbColMax-0.5,(int)((kNbSMEMCAL+1)/2)*kNbRowEMCAL+(int)((kNbSMEMCALthird+1)/2)*kNbRowEMCALthird,-0.5,(int)((kNbSMEMCAL+1)/2)*kNbRowEMCAL+(int)((kNbSMEMCALthird+1)/2)*kNbRowEMCALthird-0.5);
339  hAllSpaceEMCALERatio[j]->SetXTitle("Column");
340  hAllSpaceEMCALERatio[j]->SetYTitle("Row");
341  hAllSpaceEMCALERatio[j]->SetStats(0);
342  hAllSpaceEMCALERatio[j]->SetContour(30);
343  hAllSpaceDCALIntgRatio[j] = new TH2F(Form("hAllSpaceDCALIntgRatio_%d",j),Form("hAllSpaceDCALIntgRatio_%d",j),2*kNbColMax,-0.5,2.*kNbColMax-0.5,(int)((kNbSMDCAL+1)/2)*kNbRowDCAL+(int)((kNbSMDCALthird+1)/2)*kNbRowDCALthird,-0.5,(int)((kNbSMDCAL+1)/2)*kNbRowDCAL+(int)((kNbSMDCALthird+1)/2)*kNbRowDCALthird-0.5);
344  hAllSpaceDCALIntgRatio[j]->SetXTitle("Column");
345  hAllSpaceDCALIntgRatio[j]->SetYTitle("Row");
346  hAllSpaceDCALIntgRatio[j]->SetStats(0);
347  hAllSpaceDCALIntgRatio[j]->SetContour(30);
348  hAllSpaceDCALAmpRatio[j] = new TH2F(Form("hAllSpaceDCALAmpRatio_%d",j),Form("hAllSpaceDCALAmpRatio_%d",j),2*kNbColMax,-0.5,2.*kNbColMax-0.5,(int)((kNbSMDCAL+1)/2)*kNbRowDCAL+(int)((kNbSMDCALthird+1)/2)*kNbRowDCALthird,-0.5,(int)((kNbSMDCAL+1)/2)*kNbRowDCAL+(int)((kNbSMDCALthird+1)/2)*kNbRowDCALthird-0.5);
349  hAllSpaceDCALAmpRatio[j]->SetXTitle("Column");
350  hAllSpaceDCALAmpRatio[j]->SetYTitle("Row");
351  hAllSpaceDCALAmpRatio[j]->SetStats(0);
352  hAllSpaceDCALAmpRatio[j]->SetContour(30);
353  hAllSpaceDCALERatio[j] = new TH2F(Form("hAllSpaceDCALERatio_%d",j),Form("hAllSpaceDCALERatio_%d",j),2*kNbColMax,-0.5,2.*kNbColMax-0.5,(int)((kNbSMDCAL+1)/2)*kNbRowDCAL+(int)((kNbSMDCALthird+1)/2)*kNbRowDCALthird,-0.5,(int)((kNbSMDCAL+1)/2)*kNbRowDCAL+(int)((kNbSMDCALthird+1)/2)*kNbRowDCALthird-0.5);
354  hAllSpaceDCALERatio[j]->SetXTitle("Column");
355  hAllSpaceDCALERatio[j]->SetYTitle("Row");
356  hAllSpaceDCALERatio[j]->SetStats(0);
357  hAllSpaceDCALERatio[j]->SetContour(30);
358  for (i=0;i<kNbSMtot+1;i++)
359  {hDistrIntgRatio[2*i+j] = new TH1F(Form("hDistrIntgRatio_%d_%d",i,j),Form("hDistrIntgRatio_%d_%d",i,j),100,0.,4.);
360  hDistrIntgRatio[2*i+j]->SetXTitle("Integral ratio");
361  hDistrIntgRatio[2*i+j]->SetYTitle("Counts");
362  hDistrIntgRatio[2*i+j]->SetStats(0);
363  hDistrIntgRatio[2*i+j]->SetLineColor(tabCol[2-j]);
364  hDistrAmpRatio[2*i+j] = new TH1F(Form("hDistrAmpRatio_%d_%d",i,j),Form("hDistrAmpRatio_%d_%d",i,j),100,0.,3.);
365  hDistrAmpRatio[2*i+j]->SetXTitle("Amplitude ratio");
366  hDistrAmpRatio[2*i+j]->SetYTitle("Counts");
367  hDistrAmpRatio[2*i+j]->SetStats(0);
368  hDistrAmpRatio[2*i+j]->SetLineColor(tabCol[2-j]);
369  hDistrERatio[2*i+j] = new TH1F(Form("hDistrERatio_%d_%d",i,j),Form("hDistrERatio_%d_%d",i,j),100,0.,3.);
370  hDistrERatio[2*i+j]->SetXTitle("Energy ratio");
371  hDistrERatio[2*i+j]->SetYTitle("Counts");
372  hDistrERatio[2*i+j]->SetStats(0);
373  hDistrERatio[2*i+j]->SetLineColor(tabCol[2-j]);
374  hDistrIntgRatioZm[2*i+j] = new TH1F(Form("hDistrIntgRatioZm_%d_%d",i,j),Form("hDistrIntgRatioZm_%d_%d",i,j),100,0.,2.0);
375  hDistrIntgRatioZm[2*i+j]->SetXTitle("Integral ratio");
376  hDistrIntgRatioZm[2*i+j]->SetYTitle("Counts");
377  hDistrIntgRatioZm[2*i+j]->SetStats(0);
378  hDistrIntgRatioZm[2*i+j]->SetLineColor(tabCol[2-j]);
379  hDistrAmpRatioZm[2*i+j] = new TH1F(Form("hDistrAmpRatioZm_%d_%d",i,j),Form("hDistrAmpRatioZm_%d_%d",i,j),100,0.7,1.4);
380  hDistrAmpRatioZm[2*i+j]->SetXTitle("Amplitude ratio");
381  hDistrAmpRatioZm[2*i+j]->SetYTitle("Counts");
382  hDistrAmpRatioZm[2*i+j]->SetStats(0);
383  hDistrAmpRatioZm[2*i+j]->SetLineColor(tabCol[2-j]);
384  hDistrERatioZm[2*i+j] = new TH1F(Form("hDistrERatioZm_%d_%d",i,j),Form("hDistrERatioZm_%d_%d",i,j),100,0.7,1.4);
385  hDistrERatioZm[2*i+j]->SetXTitle("Energy ratio");
386  hDistrERatioZm[2*i+j]->SetYTitle("Counts");
387  hDistrERatioZm[2*i+j]->SetStats(0);
388  hDistrERatioZm[2*i+j]->SetLineColor(tabCol[2-j]);
389  h2Amp[2*i+j] = new TH2F(Form("h2Amp%d_%d",i,j),Form("h2Amp%d_%d",i,j),100,0.,multFactGraphAmp*maxAmp,100,0.,multFactGraphAmp*maxAmp);
390  h2Amp[2*i+j]->SetXTitle("Amplitude 1st run");
391  h2Amp[2*i+j]->SetYTitle("Amplitude other run");
392  h2Amp[2*i+j]->SetStats(0);
393  h2Amp[2*i+j]->SetContour(30);
394  h2E[2*i+j] = new TH2F(Form("h2E%d_%d",i,j),Form("h2E%d_%d",i,j),100,0.,multFactGraphE*maxE,100,0.,multFactGraphE*maxE);
395  h2E[2*i+j]->SetXTitle("Energy 1st run");
396  h2E[2*i+j]->SetYTitle("Energy other run");
397  h2E[2*i+j]->SetStats(0);
398  h2E[2*i+j]->SetContour(30);
399  }
400  }
401  for (j=0;j<6;j++)
402  {for (i=0;i<kNbSMtot+1;i++)
403  {h2RatioVsIntg[6*i+j] = new TH2F(Form("h2RatioVsIntg%d_%d",i,j),Form("h2RatioVsIntg%d_%d",i,j),100,0.,maxIntg,100,0.6,1.5);
404  h2RatioVsIntg[6*i+j]->SetXTitle("Integral");
405  if (runMode == 0) h2RatioVsIntg[6*i+j]->SetYTitle("Energy ratio");
406  if (runMode == 1) h2RatioVsIntg[6*i+j]->SetYTitle("Amplitude ratio");
407  h2RatioVsIntg[6*i+j]->SetStats(0);
408  h2RatioVsIntg[6*i+j]->SetContour(30);
409  h2RatioVsAmp[6*i+j] = new TH2F(Form("h2RatioVsAmp%d_%d",i,j),Form("h2RatioVsAmp%d_%d",i,j),100,0.,multFactGraphAmp*maxAmp,100,0.6,1.5);
410  h2RatioVsAmp[6*i+j]->SetXTitle("Amplitude");
411  if (runMode == 0) h2RatioVsAmp[6*i+j]->SetYTitle("Energy ratio");
412  if (runMode == 1) h2RatioVsAmp[6*i+j]->SetYTitle("Amplitude ratio");
413  h2RatioVsAmp[6*i+j]->SetStats(0);
414  h2RatioVsAmp[6*i+j]->SetContour(30);
415  }
416  }
417  TH2F *hAllSpaceEMCALOCDBfactorsBefore = new TH2F("hAllSpaceEMCALOCDBfactorsBefore","hAllSpaceEMCALOCDBfactorsBefore",2*kNbColMax,-0.5,2.*kNbColMax-0.5,(int)((kNbSMEMCAL+1)/2)*kNbRowEMCAL+(int)((kNbSMEMCALthird+1)/2)*kNbRowEMCALthird,-0.5,(int)((kNbSMEMCAL+1)/2)*kNbRowEMCAL+(int)((kNbSMEMCALthird+1)/2)*kNbRowEMCALthird-0.5);
418  TH2F *hAllSpaceEMCALRatioAmpliOCDB = new TH2F("hAllSpaceEMCALRatioAmpliOCDB","hAllSpaceEMCALRatioAmpliOCDB",2*kNbColMax,-0.5,2.*kNbColMax-0.5,(int)((kNbSMEMCAL+1)/2)*kNbRowEMCAL+(int)((kNbSMEMCALthird+1)/2)*kNbRowEMCALthird,-0.5,(int)((kNbSMEMCAL+1)/2)*kNbRowEMCAL+(int)((kNbSMEMCALthird+1)/2)*kNbRowEMCALthird-0.5);
419  TH2F *hAllSpaceEMCALRatioEnergyOCDB = new TH2F("hAllSpaceEMCALRatioEnergyOCDB","hAllSpaceEMCALRatioEnergyOCDB",2*kNbColMax,-0.5,2.*kNbColMax-0.5,(int)((kNbSMEMCAL+1)/2)*kNbRowEMCAL+(int)((kNbSMEMCALthird+1)/2)*kNbRowEMCALthird,-0.5,(int)((kNbSMEMCAL+1)/2)*kNbRowEMCAL+(int)((kNbSMEMCALthird+1)/2)*kNbRowEMCALthird-0.5);
420  TH2F *hAllSpaceDCALOCDBfactorsBefore = new TH2F("hAllSpaceDCALOCDBfactorsBefore","hAllSpaceDCALOCDBfactorsBefore",2*kNbColMax,-0.5,2.*kNbColMax-0.5,(int)((kNbSMDCAL+1)/2)*kNbRowDCAL+(int)((kNbSMDCALthird+1)/2)*kNbRowDCALthird,-0.5,(int)((kNbSMDCAL+1)/2)*kNbRowDCAL+(int)((kNbSMDCALthird+1)/2)*kNbRowDCALthird-0.5);
421  TH2F *hAllSpaceDCALRatioAmpliOCDB = new TH2F("hAllSpaceDCALRatioAmpliOCDB","hAllSpaceDCALRatioAmpliOCDB",2*kNbColMax,-0.5,2.*kNbColMax-0.5,(int)((kNbSMDCAL+1)/2)*kNbRowDCAL+(int)((kNbSMDCALthird+1)/2)*kNbRowDCALthird,-0.5,(int)((kNbSMDCAL+1)/2)*kNbRowDCAL+(int)((kNbSMDCALthird+1)/2)*kNbRowDCALthird-0.5);
422  TH2F *hAllSpaceDCALRatioEnergyOCDB = new TH2F("hAllSpaceDCALRatioEnergyOCDB","hAllSpaceDCALRatioEnergyOCDB",2*kNbColMax,-0.5,2.*kNbColMax-0.5,(int)((kNbSMDCAL+1)/2)*kNbRowDCAL+(int)((kNbSMDCALthird+1)/2)*kNbRowDCALthird,-0.5,(int)((kNbSMDCAL+1)/2)*kNbRowDCAL+(int)((kNbSMDCALthird+1)/2)*kNbRowDCALthird-0.5);
423  TH2F *h2CorrelEnergyOCDB = new TH2F("h2CorrelEnergyOCDB","h2CorrelEnergyOCDB",100,0.3,3.0,100,0.,4.);
424  TH2F *h2CorrelEnergyOCDBZm = new TH2F("h2CorrelEnergyOCDBZm","h2CorrelEnergyOCDBZm",100,0.7,1.4,100,0.7,1.5);
425  TH2F *h2CorrelEnergyOCDBZmZm = new TH2F("h2CorrelEnergyOCDBZmZm","h2CorrelEnergyOCDBZmZm",100,0.9,1.1,100,0.97,1.03);
426  hAllSpaceEMCALOCDBfactorsBefore->SetXTitle("Column");
427  hAllSpaceEMCALOCDBfactorsBefore->SetYTitle("Row");
428  hAllSpaceEMCALOCDBfactorsBefore->SetStats(0);
429  hAllSpaceEMCALOCDBfactorsBefore->SetContour(30);
430  hAllSpaceEMCALRatioAmpliOCDB->SetXTitle("Column");
431  hAllSpaceEMCALRatioAmpliOCDB->SetYTitle("Row");
432  hAllSpaceEMCALRatioAmpliOCDB->SetStats(0);
433  hAllSpaceEMCALRatioAmpliOCDB->SetContour(30);
434  hAllSpaceEMCALRatioEnergyOCDB->SetXTitle("Column");
435  hAllSpaceEMCALRatioEnergyOCDB->SetYTitle("Row");
436  hAllSpaceEMCALRatioEnergyOCDB->SetStats(0);
437  hAllSpaceEMCALRatioEnergyOCDB->SetContour(30);
438  hAllSpaceDCALOCDBfactorsBefore->SetXTitle("Column");
439  hAllSpaceDCALOCDBfactorsBefore->SetYTitle("Row");
440  hAllSpaceDCALOCDBfactorsBefore->SetStats(0);
441  hAllSpaceDCALOCDBfactorsBefore->SetContour(30);
442  hAllSpaceDCALRatioAmpliOCDB->SetXTitle("Column");
443  hAllSpaceDCALRatioAmpliOCDB->SetYTitle("Row");
444  hAllSpaceDCALRatioAmpliOCDB->SetStats(0);
445  hAllSpaceDCALRatioAmpliOCDB->SetContour(30);
446  hAllSpaceDCALRatioEnergyOCDB->SetXTitle("Column");
447  hAllSpaceDCALRatioEnergyOCDB->SetYTitle("Row");
448  hAllSpaceDCALRatioEnergyOCDB->SetStats(0);
449  hAllSpaceDCALRatioEnergyOCDB->SetContour(30);
450  h2CorrelEnergyOCDB->SetXTitle("Old OCDB coeff");
451  h2CorrelEnergyOCDB->SetYTitle("Energy");
452  h2CorrelEnergyOCDB->SetStats(0);
453  h2CorrelEnergyOCDB->SetContour(30);
454  h2CorrelEnergyOCDBZm->SetXTitle("Old OCDB coeff");
455  h2CorrelEnergyOCDBZm->SetYTitle("Energy");
456  h2CorrelEnergyOCDBZm->SetStats(0);
457  h2CorrelEnergyOCDBZm->SetContour(30);
458  h2CorrelEnergyOCDBZmZm->SetXTitle("Old OCDB coeff");
459  h2CorrelEnergyOCDBZmZm->SetYTitle("Energy");
460  h2CorrelEnergyOCDBZmZm->SetStats(0);
461  h2CorrelEnergyOCDBZmZm->SetContour(30);
462 
463  TH1F *h;
464  for (i=0;i<3;i++)
465  {cmptIntg[i]=0;
466  cmptAmpl[i]=0;
467  cmptEmismatch[i]=0;
468  }
469  printf("\nStart reading data. Tower coords given below are in Alice-offline mapping.\n");
470  fprintf(outFile,"\nTower coords given below are in Alice-offline mapping.\n\n");
471  for(iSM=0;iSM<kNbSMtot;iSM++)
472  {printf("Doing SM %d (%s, %s)...\n",iSM,SMP2Name[iSM],detTypeString[SMdetType[iSM]]);
473  for (iCol=0;iCol<kTabNbCol[SMdetType[iSM]];iCol++)
474  {for (iRow=0;iRow<kTabNbRow[SMdetType[iSM]];iRow++)
475  {iColGlob=(iSM%2)*(2*kNbColEMCAL-kTabNbCol[SMdetType[iSM]])+iCol;
476  if ((SMdetType[iSM] == kEMCAL) || (SMdetType[iSM] == kEMCALthird))
477  {iRowGlob=(int)(iSM/2)*kNbRowEMCAL+iRow;
478  if (runMode == 0) hAllSpaceEMCALOCDBfactorsBefore->SetBinContent(iColGlob+1,iRowGlob+1,coeffOCDBbefore[iSM][iCol][iRow]/coefFactorWanted);
479  }
480  else
481  {iRowGlob=(int)((iSM-kNbSMEMCAL-kNbSMEMCALthird)/2)*kNbRowDCAL+iRow;
482  if (runMode == 0) hAllSpaceDCALOCDBfactorsBefore->SetBinContent(iColGlob+1,iRowGlob+1,coeffOCDBbefore[iSM][iCol][iRow]/coefFactorWanted);
483  }
484  //Look at the integrals :
485  for (i=0;i<3;i++)
486  {hDistrIntg[3*iSM+i]->Fill(hampHighGainTow[i][iSM][iRow][iCol]->Integral());
487  hDistrIntg[3*kNbSMtot+i]->Fill(hampHighGainTow[i][iSM][iRow][iCol]->Integral());
488  if ((SMdetType[iSM] == kEMCAL) || (SMdetType[iSM] == kEMCALthird))
489  hAllSpaceEMCALIntg[i]->SetBinContent(iColGlob+1,iRowGlob+1,hampHighGainTow[i][iSM][iRow][iCol]->Integral());
490  else
491  hAllSpaceDCALIntg[i]->SetBinContent(iColGlob+1,iRowGlob+1,hampHighGainTow[i][iSM][iRow][iCol]->Integral());
492  }
493  if (hampHighGainTow[0][iSM][iRow][iCol]->Integral() <= cutMinIntg)
494  {fprintf(outFile,"Too few counts 1 (%d) in tower (SM,col,row) (%d,%d,%d), skip it.\n",(int)hampHighGainTow[0][iSM][iRow][iCol]->Integral(),iSM,iCol,iRow);
495  cmptIntg[0]++;
496  continue;
497  }
498  if (hampHighGainTow[1][iSM][iRow][iCol]->Integral() > cutMinIntg)
499  {if ((SMdetType[iSM] == kEMCAL) || (SMdetType[iSM] == kEMCALthird))
500  hAllSpaceEMCALIntgRatio[1]->SetBinContent(iColGlob+1,iRowGlob+1,hampHighGainTow[1][iSM][iRow][iCol]->Integral()/hampHighGainTow[0][iSM][iRow][iCol]->Integral());
501  else
502  hAllSpaceDCALIntgRatio[1]->SetBinContent(iColGlob+1,iRowGlob+1,hampHighGainTow[1][iSM][iRow][iCol]->Integral()/hampHighGainTow[0][iSM][iRow][iCol]->Integral());
503  hDistrIntgRatio[2*iSM+1]->Fill(hampHighGainTow[1][iSM][iRow][iCol]->Integral()/hampHighGainTow[0][iSM][iRow][iCol]->Integral());
504  hDistrIntgRatio[2*kNbSMtot+1]->Fill(hampHighGainTow[1][iSM][iRow][iCol]->Integral()/hampHighGainTow[0][iSM][iRow][iCol]->Integral());
505  hDistrIntgRatioZm[2*iSM+1]->Fill(hampHighGainTow[1][iSM][iRow][iCol]->Integral()/hampHighGainTow[0][iSM][iRow][iCol]->Integral());
506  hDistrIntgRatioZm[2*kNbSMtot+1]->Fill(hampHighGainTow[1][iSM][iRow][iCol]->Integral()/hampHighGainTow[0][iSM][iRow][iCol]->Integral());
507  }
508  else
509  {fprintf(outFile,"Too few counts 2 (%d) in tower (SM,col,row) (%d,%d,%d) for run 2 while run 1 OK.\n",(int)hampHighGainTow[1][iSM][iRow][iCol]->Integral(),iSM,iCol,iRow);
510  cmptIntg[1]++;
511  }
512  if (hampHighGainTow[2][iSM][iRow][iCol]->Integral() > cutMinIntg)
513  {if ((SMdetType[iSM] == kEMCAL) || (SMdetType[iSM] == kEMCALthird))
514  hAllSpaceEMCALIntgRatio[0]->SetBinContent(iColGlob+1,iRowGlob+1,hampHighGainTow[2][iSM][iRow][iCol]->Integral()/hampHighGainTow[0][iSM][iRow][iCol]->Integral());
515  else
516  hAllSpaceDCALIntgRatio[0]->SetBinContent(iColGlob+1,iRowGlob+1,hampHighGainTow[2][iSM][iRow][iCol]->Integral()/hampHighGainTow[0][iSM][iRow][iCol]->Integral());
517  hDistrIntgRatio[2*iSM+0]->Fill(hampHighGainTow[2][iSM][iRow][iCol]->Integral()/hampHighGainTow[0][iSM][iRow][iCol]->Integral());
518  hDistrIntgRatio[2*kNbSMtot+0]->Fill(hampHighGainTow[2][iSM][iRow][iCol]->Integral()/hampHighGainTow[0][iSM][iRow][iCol]->Integral());
519  hDistrIntgRatioZm[2*iSM+0]->Fill(hampHighGainTow[2][iSM][iRow][iCol]->Integral()/hampHighGainTow[0][iSM][iRow][iCol]->Integral());
520  hDistrIntgRatioZm[2*kNbSMtot+0]->Fill(hampHighGainTow[2][iSM][iRow][iCol]->Integral()/hampHighGainTow[0][iSM][iRow][iCol]->Integral());
521  }
522  else
523  {fprintf(outFile,"Too few counts 3 (%d) in tower (SM,col,row) (%d,%d,%d) for run 3 while run 1 OK.\n",(int)hampHighGainTow[2][iSM][iRow][iCol]->Integral(),iSM,iCol,iRow);
524  cmptIntg[2]++;
525  }
526  //Look at the amplitudes :
527  h=hampHighGainTow[0][iSM][iRow][iCol];
528  maxloc=h->GetBinCenter(h->GetMaximumBin());
529  h->SetAxisRange(maxloc-15.,maxloc+15.);
530  h->SetAxisRange(maxloc-2*h->GetRMS(),maxloc+2*h->GetRMS());
531  ampli0=h->GetMean();
532  hDistrAmp[3*iSM+0]->Fill(ampli0);
533  hDistrAmp[3*kNbSMtot+0]->Fill(ampli0);
534  if ((SMdetType[iSM] == kEMCAL) || (SMdetType[iSM] == kEMCALthird))
535  hAllSpaceEMCALAmp[0]->SetBinContent(iColGlob+1,iRowGlob+1,ampli0);
536  else
537  hAllSpaceDCALAmp[0]->SetBinContent(iColGlob+1,iRowGlob+1,ampli0);
538  if (runMode == 0) E0=ampli0*coeffOCDBbefore[iSM][iCol][iRow];
539  hDistrE[3*iSM+0]->Fill(E0);
540  hDistrE[3*kNbSMtot+0]->Fill(E0);
541  if ((SMdetType[iSM] == kEMCAL) || (SMdetType[iSM] == kEMCALthird))
542  hAllSpaceEMCALE[0]->SetBinContent(iColGlob+1,iRowGlob+1,E0);
543  else
544  hAllSpaceDCALE[0]->SetBinContent(iColGlob+1,iRowGlob+1,E0);
545  if (ampli0 <= cutMinAmp)
546  {fprintf(outFile,"Too low amplitude 1 (%d) in tower (SM,col,row) (%d,%d,%d), skip it.\n",(int)ampli0,iSM,iCol,iRow);
547  cmptAmpl[0]++;
548  continue;
549  }
550  //CUSTOMIZE customize
551  // I don't remember what this does, leave it like this.
553  if (hampHighGainTow[1][iSM][iRow][iCol]->Integral() > cutMinIntg)
554  {h=hampHighGainTow[1][iSM][iRow][iCol];
555  maxloc=h->GetBinCenter(h->GetMaximumBin());
556  h->SetAxisRange(maxloc-15.,maxloc+15.);
557  h->SetAxisRange(maxloc-2*h->GetRMS(),maxloc+2*h->GetRMS());
558  ampli1=h->GetMean();
559  hDistrAmp[3*iSM+1]->Fill(ampli1);
560  hDistrAmp[3*kNbSMtot+1]->Fill(ampli1);
561  if ((SMdetType[iSM] == kEMCAL) || (SMdetType[iSM] == kEMCALthird))
562  hAllSpaceEMCALAmp[1]->SetBinContent(iColGlob+1,iRowGlob+1,ampli1);
563  else
564  hAllSpaceDCALAmp[1]->SetBinContent(iColGlob+1,iRowGlob+1,ampli1);
565  if (runMode == 0) E1=ampli1*coeffOCDBafter[iSM][iCol][iRow];
566  hDistrE[3*iSM+1]->Fill(E1);
567  hDistrE[3*kNbSMtot+1]->Fill(E1);
568  if ((SMdetType[iSM] == kEMCAL) || (SMdetType[iSM] == kEMCALthird))
569  hAllSpaceEMCALE[1]->SetBinContent(iColGlob+1,iRowGlob+1,E1);
570  else
571  hAllSpaceDCALE[1]->SetBinContent(iColGlob+1,iRowGlob+1,E1);
572  if (ampli1 > cutMinAmp)
573  {if ((SMdetType[iSM] == kEMCAL) || (SMdetType[iSM] == kEMCALthird))
574  {hAllSpaceEMCALAmpRatio[1]->SetBinContent(iColGlob+1,iRowGlob+1,ampli1/ampli0);
575  if (runMode == 0) hAllSpaceEMCALRatioAmpliOCDB->SetBinContent(iColGlob+1,iRowGlob+1,(ampli1/ampli0)/(coeffOCDBbefore[iSM][iCol][iRow]/coefFactorWanted));
576  }
577  else
578  {hAllSpaceDCALAmpRatio[1]->SetBinContent(iColGlob+1,iRowGlob+1,ampli1/ampli0);
579  if (runMode == 0) hAllSpaceDCALRatioAmpliOCDB->SetBinContent(iColGlob+1,iRowGlob+1,(ampli1/ampli0)/(coeffOCDBbefore[iSM][iCol][iRow]/coefFactorWanted));
580  }
581  hDistrAmpRatio[2*iSM+1]->Fill(ampli1/ampli0);
582  hDistrAmpRatio[2*kNbSMtot+1]->Fill(ampli1/ampli0);
583  hDistrAmpRatioZm[2*iSM+1]->Fill(ampli1/ampli0);
584  hDistrAmpRatioZm[2*kNbSMtot+1]->Fill(ampli1/ampli0);
585  if ((SMdetType[iSM] == kEMCAL) || (SMdetType[iSM] == kEMCALthird))
586  {hAllSpaceEMCALERatio[1]->SetBinContent(iColGlob+1,iRowGlob+1,E1/E0);
587  if (runMode == 0) hAllSpaceEMCALRatioEnergyOCDB->SetBinContent(iColGlob+1,iRowGlob+1,(E1/E0)/(coeffOCDBbefore[iSM][iCol][iRow]/coefFactorWanted));
588  }
589  else
590  {hAllSpaceDCALERatio[1]->SetBinContent(iColGlob+1,iRowGlob+1,E1/E0);
591  if (runMode == 0) hAllSpaceDCALRatioEnergyOCDB->SetBinContent(iColGlob+1,iRowGlob+1,(E1/E0)/(coeffOCDBbefore[iSM][iCol][iRow]/coefFactorWanted));
592  }
593  if (runMode == 0)
594  {h2CorrelEnergyOCDB->Fill(coeffOCDBbefore[iSM][iCol][iRow]/coefFactorWanted,E1/E0);
595  h2CorrelEnergyOCDBZm->Fill(coeffOCDBbefore[iSM][iCol][iRow]/coefFactorWanted,E1/E0);
596  h2CorrelEnergyOCDBZmZm->Fill(coeffOCDBbefore[iSM][iCol][iRow]/coefFactorWanted,E1/E0);
597  }
598  hDistrERatio[2*iSM+1]->Fill(E1/E0);
599  hDistrERatio[2*kNbSMtot+1]->Fill(E1/E0);
600  hDistrERatioZm[2*iSM+1]->Fill(E1/E0);
601  hDistrERatioZm[2*kNbSMtot+1]->Fill(E1/E0);
602  if (runMode == 0)
603  {if (TMath::Abs(TMath::Log(E1)-TMath::Log(E0)) > TMath::Log(1.+cutWarnERatio))
604  {fprintf(outFile,"== E mismatch for tower (%d,%d,%d), ratio=%f amp1=%f amp2=%f OCDB1=%f OCDB2=%f\n",iSM,iCol,iRow,E1/E0,ampli0,ampli1,coeffOCDBbefore[iSM][iCol][iRow],coeffOCDBafter[iSM][iCol][iRow]);
605  cmptEmismatch[0]++;
606  }
607  }
608  if (runMode == 1)
609  {if (TMath::Abs(TMath::Log(ampli1)-TMath::Log(ampli0)) > TMath::Log(1.+cutWarnAmpRatio))
610  {fprintf(outFile,"== Amplitude mismatch for tower (%d,%d,%d), ratio=%f amp0=%f amp1=%f\n",iSM,iCol,iRow,ampli1/ampli0,ampli0,ampli1);
611  cmptEmismatch[0]++;
612  }
613  }
614  h2Amp[2*iSM+1]->Fill(ampli0,ampli1);
615  h2Amp[2*kNbSMtot+1]->Fill(ampli0,ampli1);
616  h2E[2*iSM+1]->Fill(E0,E1);
617  h2E[2*kNbSMtot+1]->Fill(E0,E1);
618  }
619  else
620  {fprintf(outFile,"Too low amplitude 2 (%d) in tower (SM,col,row) (%d,%d,%d) for run 2 while run 1 OK.\n",(int)ampli1,iSM,iCol,iRow);
621  cmptAmpl[1]++;
622  }
623  }
624  if (runMode == 0)
625  {h2RatioVsIntg[6*iSM+0]->Fill(hampHighGainTow[0][iSM][iRow][iCol]->Integral(),E1/E0);
626  h2RatioVsIntg[6*kNbSMtot+0]->Fill(hampHighGainTow[0][iSM][iRow][iCol]->Integral(),E1/E0);
627  h2RatioVsIntg[6*iSM+2]->Fill(hampHighGainTow[1][iSM][iRow][iCol]->Integral(),E1/E0);
628  h2RatioVsIntg[6*kNbSMtot+2]->Fill(hampHighGainTow[1][iSM][iRow][iCol]->Integral(),E1/E0);
629  h2RatioVsIntg[6*iSM+4]->Fill(TMath::Min(hampHighGainTow[0][iSM][iRow][iCol]->Integral(),hampHighGainTow[1][iSM][iRow][iCol]->Integral()),E1/E0);
630  h2RatioVsIntg[6*kNbSMtot+4]->Fill(TMath::Min(hampHighGainTow[0][iSM][iRow][iCol]->Integral(),hampHighGainTow[1][iSM][iRow][iCol]->Integral()),E1/E0);
631  h2RatioVsAmp[6*iSM+0]->Fill(ampli0,E1/E0);
632  h2RatioVsAmp[6*kNbSMtot+0]->Fill(ampli0,E1/E0);
633  h2RatioVsAmp[6*iSM+2]->Fill(ampli1,E1/E0);
634  h2RatioVsAmp[6*kNbSMtot+2]->Fill(ampli1,E1/E0);
635  h2RatioVsAmp[6*iSM+4]->Fill(TMath::Min(ampli0,ampli1),E1/E0);
636  h2RatioVsAmp[6*kNbSMtot+4]->Fill(TMath::Min(ampli0,ampli1),E1/E0);
637  }
638  if (runMode == 1)
639  {h2RatioVsIntg[6*iSM+0]->Fill(hampHighGainTow[0][iSM][iRow][iCol]->Integral(),ampli1/ampli0);
640  h2RatioVsIntg[6*kNbSMtot+0]->Fill(hampHighGainTow[0][iSM][iRow][iCol]->Integral(),ampli1/ampli0);
641  h2RatioVsIntg[6*iSM+2]->Fill(hampHighGainTow[1][iSM][iRow][iCol]->Integral(),ampli1/ampli0);
642  h2RatioVsIntg[6*kNbSMtot+2]->Fill(hampHighGainTow[1][iSM][iRow][iCol]->Integral(),ampli1/ampli0);
643  h2RatioVsIntg[6*iSM+4]->Fill(TMath::Min(hampHighGainTow[0][iSM][iRow][iCol]->Integral(),hampHighGainTow[1][iSM][iRow][iCol]->Integral()),ampli1/ampli0);
644  h2RatioVsIntg[6*kNbSMtot+4]->Fill(TMath::Min(hampHighGainTow[0][iSM][iRow][iCol]->Integral(),hampHighGainTow[1][iSM][iRow][iCol]->Integral()),ampli1/ampli0);
645  h2RatioVsAmp[6*iSM+0]->Fill(ampli0,ampli1/ampli0);
646  h2RatioVsAmp[6*kNbSMtot+0]->Fill(ampli0,ampli1/ampli0);
647  h2RatioVsAmp[6*iSM+2]->Fill(ampli1,ampli1/ampli0);
648  h2RatioVsAmp[6*kNbSMtot+2]->Fill(ampli1,ampli1/ampli0);
649  h2RatioVsAmp[6*iSM+4]->Fill(TMath::Min(ampli0,ampli1),ampli1/ampli0);
650  h2RatioVsAmp[6*kNbSMtot+4]->Fill(TMath::Min(ampli0,ampli1),ampli1/ampli0);
651  }
652  if (hampHighGainTow[2][iSM][iRow][iCol]->Integral() > cutMinIntg)
653  {h=hampHighGainTow[2][iSM][iRow][iCol];
654  maxloc=h->GetBinCenter(h->GetMaximumBin());
655  h->SetAxisRange(maxloc-15.,maxloc+15.);
656  h->SetAxisRange(maxloc-2*h->GetRMS(),maxloc+2*h->GetRMS());
657  ampli2=h->GetMean();
658  hDistrAmp[3*iSM+2]->Fill(ampli2);
659  hDistrAmp[3*kNbSMtot+2]->Fill(ampli2);
660  if ((SMdetType[iSM] == kEMCAL) || (SMdetType[iSM] == kEMCALthird))
661  hAllSpaceEMCALAmp[2]->SetBinContent(iColGlob+1,iRowGlob+1,ampli2);
662  else
663  hAllSpaceDCALAmp[2]->SetBinContent(iColGlob+1,iRowGlob+1,ampli2);
664  if (runMode == 0) E2=ampli2*coeffOCDBbefore[iSM][iCol][iRow];
665  hDistrE[3*iSM+2]->Fill(E2);
666  hDistrE[3*kNbSMtot+2]->Fill(E2);
667  if ((SMdetType[iSM] == kEMCAL) || (SMdetType[iSM] == kEMCALthird))
668  hAllSpaceEMCALE[2]->SetBinContent(iColGlob+1,iRowGlob+1,E2);
669  else
670  hAllSpaceDCALE[2]->SetBinContent(iColGlob+1,iRowGlob+1,E2);
671  if (ampli2 > cutMinAmp)
672  {if ((SMdetType[iSM] == kEMCAL) || (SMdetType[iSM] == kEMCALthird))
673  hAllSpaceEMCALAmpRatio[0]->SetBinContent(iColGlob+1,iRowGlob+1,ampli2/ampli0);
674  else
675  hAllSpaceDCALAmpRatio[0]->SetBinContent(iColGlob+1,iRowGlob+1,ampli2/ampli0);
676  hDistrAmpRatio[2*iSM+0]->Fill(ampli2/ampli0);
677  hDistrAmpRatio[2*kNbSMtot+0]->Fill(ampli2/ampli0);
678  hDistrAmpRatioZm[2*iSM+0]->Fill(ampli2/ampli0);
679  hDistrAmpRatioZm[2*kNbSMtot+0]->Fill(ampli2/ampli0);
680  if ((SMdetType[iSM] == kEMCAL) || (SMdetType[iSM] == kEMCALthird))
681  hAllSpaceEMCALERatio[0]->SetBinContent(iColGlob+1,iRowGlob+1,E2/E0);
682  else
683  hAllSpaceDCALERatio[0]->SetBinContent(iColGlob+1,iRowGlob+1,E2/E0);
684  hDistrERatio[2*iSM+0]->Fill(E2/E0);
685  hDistrERatio[2*kNbSMtot+0]->Fill(E2/E0);
686  hDistrERatioZm[2*iSM+0]->Fill(E2/E0);
687  hDistrERatioZm[2*kNbSMtot+0]->Fill(E2/E0);
688  if (runMode == 1)
689  {if (TMath::Abs(TMath::Log(ampli2)-TMath::Log(ampli0)) > TMath::Log(1.+cutWarnAmpRatio)) fprintf(outFile,"== Amplitude mismatch for tower (%d,%d,%d), ratio=%f amp0=%f amp2=%f\n",iSM,iCol,iRow,ampli2/ampli0,ampli0,ampli2);
690  }
691  h2Amp[2*iSM+0]->Fill(ampli0,ampli2);
692  h2Amp[2*kNbSMtot+0]->Fill(ampli0,ampli2);
693  h2E[2*iSM+0]->Fill(E0,E2);
694  h2E[2*kNbSMtot+0]->Fill(E0,E2);
695  }
696  else
697  {fprintf(outFile,"Too low amplitude 3 (%d) in tower (SM,col,row) (%d,%d,%d) for run 3 while run 1 OK.\n",(int)ampli2,iSM,iCol,iRow);
698  cmptAmpl[2]++;
699  }
700  }
701  if (runMode == 0)
702  {h2RatioVsIntg[6*iSM+1]->Fill(hampHighGainTow[0][iSM][iRow][iCol]->Integral(),E2/E0);
703  h2RatioVsIntg[6*kNbSMtot+1]->Fill(hampHighGainTow[0][iSM][iRow][iCol]->Integral(),E2/E0);
704  h2RatioVsIntg[6*iSM+3]->Fill(hampHighGainTow[2][iSM][iRow][iCol]->Integral(),E2/E0);
705  h2RatioVsIntg[6*kNbSMtot+3]->Fill(hampHighGainTow[2][iSM][iRow][iCol]->Integral(),E2/E0);
706  h2RatioVsIntg[6*iSM+5]->Fill(TMath::Min(hampHighGainTow[0][iSM][iRow][iCol]->Integral(),hampHighGainTow[2][iSM][iRow][iCol]->Integral()),E2/E0);
707  h2RatioVsIntg[6*kNbSMtot+5]->Fill(TMath::Min(hampHighGainTow[0][iSM][iRow][iCol]->Integral(),hampHighGainTow[2][iSM][iRow][iCol]->Integral()),E2/E0);
708  h2RatioVsAmp[6*iSM+1]->Fill(ampli0,E2/E0);
709  h2RatioVsAmp[6*kNbSMtot+1]->Fill(ampli0,E2/E0);
710  //h2RatioVsAmp[6*iSM+3]->Fill(ampli1,E2/E0);
711  //h2RatioVsAmp[6*kNbSMtot+3]->Fill(ampli1,E2/E0);
712  //Julien, bug corrected June 18, 2015.
713  h2RatioVsAmp[6*iSM+3]->Fill(ampli2,E2/E0);
714  h2RatioVsAmp[6*kNbSMtot+3]->Fill(ampli2,E2/E0);
715  h2RatioVsAmp[6*iSM+5]->Fill(TMath::Min(ampli0,ampli2),E2/E0);
716  h2RatioVsAmp[6*kNbSMtot+5]->Fill(TMath::Min(ampli0,ampli2),E2/E0);
717  }
718  if (runMode == 1)
719  {h2RatioVsIntg[6*iSM+1]->Fill(hampHighGainTow[0][iSM][iRow][iCol]->Integral(),ampli2/ampli0);
720  h2RatioVsIntg[6*kNbSMtot+1]->Fill(hampHighGainTow[0][iSM][iRow][iCol]->Integral(),ampli2/ampli0);
721  h2RatioVsIntg[6*iSM+3]->Fill(hampHighGainTow[2][iSM][iRow][iCol]->Integral(),ampli2/ampli0);
722  h2RatioVsIntg[6*kNbSMtot+3]->Fill(hampHighGainTow[2][iSM][iRow][iCol]->Integral(),ampli2/ampli0);
723  h2RatioVsIntg[6*iSM+5]->Fill(TMath::Min(hampHighGainTow[0][iSM][iRow][iCol]->Integral(),hampHighGainTow[2][iSM][iRow][iCol]->Integral()),ampli2/ampli0);
724  h2RatioVsIntg[6*kNbSMtot+5]->Fill(TMath::Min(hampHighGainTow[0][iSM][iRow][iCol]->Integral(),hampHighGainTow[2][iSM][iRow][iCol]->Integral()),ampli2/ampli0);
725  h2RatioVsAmp[6*iSM+1]->Fill(ampli0,ampli2/ampli0);
726  h2RatioVsAmp[6*kNbSMtot+1]->Fill(ampli0,ampli2/ampli0);
727  //h2RatioVsAmp[6*iSM+3]->Fill(ampli1,ampli2/ampli0);
728  //h2RatioVsAmp[6*kNbSMtot+3]->Fill(ampli1,ampli2/ampli0);
729  //Julien, bug corrected June 18, 2015.
730  h2RatioVsAmp[6*iSM+3]->Fill(ampli2,ampli2/ampli0);
731  h2RatioVsAmp[6*kNbSMtot+3]->Fill(ampli2,ampli2/ampli0);
732  h2RatioVsAmp[6*iSM+5]->Fill(TMath::Min(ampli0,ampli2),ampli2/ampli0);
733  h2RatioVsAmp[6*kNbSMtot+5]->Fill(TMath::Min(ampli0,ampli2),ampli2/ampli0);
734  }
735  }
736  }
737  }
738 
739  //rootFileIn->Close();
740  TFile *rootFileOut = new TFile(fchNameRoot,"RECREATE");
741  //Must be put once rootFileIn is closed, otherwise tries to write in rootFileIn (and fails because not permitted). Not sure why.
742 
743 
744  fprintf(outFile,"\nTotal towers with too few counts in run 1 : %d (cut at %f)\n",cmptIntg[0],cutMinIntg);
745  fprintf(outFile," Among towers OK : %d towers nonetheless have too few counts in run 2,\n %d towers nonetheless have too few counts in run 3.\n",cmptIntg[1],cmptIntg[2]);
746  fprintf(outFile,"Total towers with too low amplitude in run 1 : %d (cut at %f)\n",cmptAmpl[0],cutMinAmp);
747  fprintf(outFile," Among towers OK : %d towers nonetheless have too low amp in run 2,\n %d towers nonetheless have too low amp in run 3.\n",cmptAmpl[1],cmptAmpl[2]);
748  if (runMode == 0) fprintf(outFile,"\nTotal towers with energy mismatch : %d (cut at %f %%)\n\n",cmptEmismatch[0],100*cutWarnERatio);
749  if (runMode == 1) fprintf(outFile,"\nTotal towers with amplitude mismatch : %d (cut at %f %%)\n\n",cmptEmismatch[0],100*cutWarnAmpRatio);
750 
751 
752  printf("Draw histograms.\n");
753 
754  TLine *lineSMborderVEMCAL = new TLine(kNbColEMCAL-0.5,-0.5,kNbColEMCAL-0.5,(int)((kNbSMEMCAL+1)/2)*kNbRowEMCAL+(int)((kNbSMEMCALthird+1)/2)*kNbRowEMCALthird-0.5);
755  TLine *lineSMborderVDCALthird = new TLine(kNbColDCALthird-0.5,(int)((kNbSMDCAL+1)/2)*kNbRowDCAL-0.5,kNbColDCALthird-0.5,(int)((kNbSMDCAL+1)/2)*kNbRowDCAL+(int)((kNbSMDCALthird+1)/2)*kNbRowDCALthird-0.5);
756  TLine *lineSMborderVDCAL1 = new TLine(kNbColDCAL-0.5,-0.5,kNbColDCAL-0.5,(int)((kNbSMDCAL+1)/2)*kNbRowDCAL-0.5);
757  TLine *lineSMborderVDCAL2 = new TLine(2*kNbColEMCAL-kNbColDCAL-0.5,-0.5,2*kNbColEMCAL-kNbColDCAL-0.5,(int)((kNbSMDCAL+1)/2)*kNbRowDCAL-0.5);
758  TLine **lineSMborderHEMCAL,**lineSMborderHDCAL;
759  lineSMborderHEMCAL = new TLine*[(int)((kNbSMEMCAL+1)/2)];
760  lineSMborderHDCAL = new TLine*[(int)((kNbSMDCAL+1)/2)];
761  for (i=0;i<(int)((kNbSMEMCAL+1)/2);i++) lineSMborderHEMCAL[i] = new TLine(-0.5,(i+1)*kNbRowEMCAL-0.5,2.*kNbColEMCAL-0.5,(i+1)*kNbRowEMCAL-0.5);
762  for (i=0;i<(int)((kNbSMDCAL+1)/2);i++) lineSMborderHDCAL[i] = new TLine(-0.5,(i+1)*kNbRowDCAL-0.5,2.*kNbColDCALthird-0.5,(i+1)*kNbRowDCAL-0.5);
763 
764  //Integrals, all SM and spatial :
765  ps->NewPage();
766  c1->Clear();
767  c1->Divide(2,4);
768  c1->cd(1);
769  hDistrIntg[3*kNbSMtot+0]->Draw();
770  hDistrIntg[3*kNbSMtot+1]->Draw("SAME");
771  hDistrIntg[3*kNbSMtot+2]->Draw("SAME");
772  gPad->SetLogy();
773  for (i=0;i<3;i++) hDistrIntg[3*kNbSMtot+i]->Write();
774  for (j=0;j<3;j++)
775  {c1->cd(2*j+3);
776  hAllSpaceEMCALIntg[j]->SetMaximum(maxIntg);
777  hAllSpaceEMCALIntg[j]->Draw("COLZ");
778  lineSMborderVEMCAL->Draw("SAME");
779  for (int jm=0;jm<(int)((kNbSMEMCAL+1)/2);jm++) lineSMborderHEMCAL[jm]->Draw("SAME");
780  hAllSpaceEMCALIntg[j]->Write();
781  }
782  for (j=0;j<3;j++)
783  {c1->cd(2*j+4);
784  hAllSpaceDCALIntg[j]->SetMaximum(maxIntg);
785  hAllSpaceDCALIntg[j]->Draw("COLZ");
786  lineSMborderVDCALthird->Draw("SAME");
787  lineSMborderVDCAL1->Draw("SAME");
788  lineSMborderVDCAL2->Draw("SAME");
789  for (int jm=0;jm<(int)((kNbSMDCAL+1)/2);jm++) lineSMborderHDCAL[jm]->Draw("SAME");
790  hAllSpaceDCALIntg[j]->Write();
791  }
792  c1->Update();
793 
794  //Integrals, for each SM :
795  ps->NewPage();
796  c1->Clear();
797  c1->Divide(2,5);
798  for (j=0;j<kNbSMEMCAL;j++)
799  {c1->cd(j+1);
800  hDistrIntg[3*j+0]->Draw();
801  hDistrIntg[3*j+1]->Draw("SAME");
802  hDistrIntg[3*j+2]->Draw("SAME");
803  gPad->SetLogy();
804  for (i=0;i<3;i++) hDistrIntg[3*j+i]->Write();
805  }
806  c1->Update();
807 
808  ps->NewPage();
809  c1->Clear();
810  c1->Divide(2,5);
811  for (j=kNbSMEMCAL;j<kNbSMtot;j++)
812  {c1->cd(j-kNbSMEMCAL+1);
813  hDistrIntg[3*j+0]->Draw();
814  hDistrIntg[3*j+1]->Draw("SAME");
815  hDistrIntg[3*j+2]->Draw("SAME");
816  gPad->SetLogy();
817  for (i=0;i<3;i++) hDistrIntg[3*j+i]->Write();
818  }
819  c1->Update();
820 
821  //Integral ratios, all SM and spatial :
822  ps->NewPage();
823  c1->Clear();
824  c1->Divide(2,3);
825  c1->cd(1);
826  hDistrIntgRatio[2*kNbSMtot+0]->SetMinimum(0.6);
827  hDistrIntgRatio[2*kNbSMtot+0]->Draw();
828  hDistrIntgRatio[2*kNbSMtot+1]->Draw("SAME");
829  gPad->SetLogy();
830  for (i=0;i<2;i++) hDistrIntgRatio[2*kNbSMtot+i]->Write();
831  c1->cd(2);
832  hDistrIntgRatioZm[2*kNbSMtot+0]->SetMinimum(0.6);
833  hDistrIntgRatioZm[2*kNbSMtot+0]->Draw();
834  hDistrIntgRatioZm[2*kNbSMtot+1]->Draw("SAME");
835  gPad->SetLogy();
836  for (i=0;i<2;i++) hDistrIntgRatioZm[2*kNbSMtot+i]->Write();
837  for (i=0;i<2;i++)
838  {hAllSpaceEMCALIntgRatio[i]->SetMinimum(0.5);
839  hAllSpaceEMCALIntgRatio[i]->SetMaximum(2.0);
840  }
841  c1->cd(5);
842  hAllSpaceEMCALIntgRatio[0]->Draw("COLZ");
843  lineSMborderVEMCAL->Draw("SAME");
844  for (int jm=0;jm<(int)((kNbSMEMCAL+1)/2);jm++) lineSMborderHEMCAL[jm]->Draw("SAME");
845  hAllSpaceEMCALIntgRatio[0]->Write();
846  c1->cd(3);
847  hAllSpaceEMCALIntgRatio[1]->Draw("COLZ");
848  lineSMborderVEMCAL->Draw("SAME");
849  for (int jm=0;jm<(int)((kNbSMEMCAL+1)/2);jm++) lineSMborderHEMCAL[jm]->Draw("SAME");
850  hAllSpaceEMCALIntgRatio[1]->Write();
851  c1->Update();
852  for (i=0;i<2;i++)
853  {hAllSpaceEMCALIntgRatio[i]->SetMinimum(0.9);
854  hAllSpaceEMCALIntgRatio[i]->SetMaximum(1.1);
855  }
856  c1->cd(6);
857  hAllSpaceEMCALIntgRatio[0]->Draw("COLZ");
858  lineSMborderVEMCAL->Draw("SAME");
859  for (int jm=0;jm<(int)((kNbSMEMCAL+1)/2);jm++) lineSMborderHEMCAL[jm]->Draw("SAME");
860  hAllSpaceEMCALIntgRatio[0]->Write();
861  c1->cd(4);
862  hAllSpaceEMCALIntgRatio[1]->Draw("COLZ");
863  lineSMborderVEMCAL->Draw("SAME");
864  for (int jm=0;jm<(int)((kNbSMEMCAL+1)/2);jm++) lineSMborderHEMCAL[jm]->Draw("SAME");
865  hAllSpaceEMCALIntgRatio[1]->Write();
866  c1->Update();
867 
868  ps->NewPage();
869  c1->Clear();
870  c1->Divide(2,3);
871  for (i=0;i<2;i++)
872  {hAllSpaceDCALIntgRatio[i]->SetMinimum(0.5);
873  hAllSpaceDCALIntgRatio[i]->SetMaximum(2.0);
874  }
875  c1->cd(5);
876  hAllSpaceDCALIntgRatio[0]->Draw("COLZ");
877  lineSMborderVDCALthird->Draw("SAME");
878  lineSMborderVDCAL1->Draw("SAME");
879  lineSMborderVDCAL2->Draw("SAME");
880  for (int jm=0;jm<(int)((kNbSMDCAL+1)/2);jm++) lineSMborderHDCAL[jm]->Draw("SAME");
881  hAllSpaceDCALIntgRatio[0]->Write();
882  c1->cd(3);
883  hAllSpaceDCALIntgRatio[1]->Draw("COLZ");
884  lineSMborderVDCALthird->Draw("SAME");
885  lineSMborderVDCAL1->Draw("SAME");
886  lineSMborderVDCAL2->Draw("SAME");
887  for (int jm=0;jm<(int)((kNbSMDCAL+1)/2);jm++) lineSMborderHDCAL[jm]->Draw("SAME");
888  hAllSpaceDCALIntgRatio[1]->Write();
889  c1->Update();
890  for (i=0;i<2;i++)
891  {hAllSpaceDCALIntgRatio[i]->SetMinimum(0.9);
892  hAllSpaceDCALIntgRatio[i]->SetMaximum(1.1);
893  }
894  c1->cd(6);
895  hAllSpaceDCALIntgRatio[0]->Draw("COLZ");
896  lineSMborderVDCALthird->Draw("SAME");
897  lineSMborderVDCAL1->Draw("SAME");
898  lineSMborderVDCAL2->Draw("SAME");
899  for (int jm=0;jm<(int)((kNbSMDCAL+1)/2);jm++) lineSMborderHDCAL[jm]->Draw("SAME");
900  hAllSpaceDCALIntgRatio[0]->Write();
901  c1->cd(4);
902  hAllSpaceDCALIntgRatio[1]->Draw("COLZ");
903  lineSMborderVDCALthird->Draw("SAME");
904  lineSMborderVDCAL1->Draw("SAME");
905  lineSMborderVDCAL2->Draw("SAME");
906  for (int jm=0;jm<(int)((kNbSMDCAL+1)/2);jm++) lineSMborderHDCAL[jm]->Draw("SAME");
907  hAllSpaceDCALIntgRatio[1]->Write();
908  c1->Update();
909 
910  //Integral ratios, for each SM :
911  ps->NewPage();
912  c1->Clear();
913  c1->Divide(2,5);
914  for (j=0;j<kNbSMEMCAL;j++)
915  {c1->cd(j+1);
916  hDistrIntgRatio[2*j+0]->Draw();
917  hDistrIntgRatio[2*j+1]->Draw("SAME");
918  gPad->SetLogy();
919  for (i=0;i<2;i++)
920  {hDistrIntgRatio[2*j+i]->Write();
921  hDistrIntgRatioZm[2*j+i]->Write();
922  }
923  }
924  c1->Update();
925 
926  ps->NewPage();
927  c1->Clear();
928  c1->Divide(2,5);
929  for (j=kNbSMEMCAL;j<kNbSMtot;j++)
930  {c1->cd(j-kNbSMEMCAL+1);
931  hDistrIntgRatio[2*j+0]->Draw();
932  hDistrIntgRatio[2*j+1]->Draw("SAME");
933  gPad->SetLogy();
934  for (i=0;i<2;i++)
935  {hDistrIntgRatio[2*j+i]->Write();
936  hDistrIntgRatioZm[2*j+i]->Write();
937  }
938  }
939  c1->Update();
940 
941  //Amplitudes, all SM and spatial :
942  ps->NewPage();
943  c1->Clear();
944  c1->Divide(2,4);
945  c1->cd(1);
946  hDistrAmp[3*kNbSMtot+0]->Draw();
947  hDistrAmp[3*kNbSMtot+1]->Draw("SAME");
948  hDistrAmp[3*kNbSMtot+2]->Draw("SAME");
949  gPad->SetLogy();
950  for (i=0;i<3;i++) hDistrAmp[3*kNbSMtot+i]->Write();
951  for (j=0;j<3;j++)
952  {c1->cd(2*j+3);
953  hAllSpaceEMCALAmp[j]->SetMaximum(maxAmp);
954  hAllSpaceEMCALAmp[j]->Draw("COLZ");
955  lineSMborderVEMCAL->Draw("SAME");
956  for (int jm=0;jm<(int)((kNbSMEMCAL+1)/2);jm++) lineSMborderHEMCAL[jm]->Draw("SAME");
957  hAllSpaceEMCALAmp[j]->Write();
958  }
959  for (j=0;j<3;j++)
960  {c1->cd(2*j+4);
961  hAllSpaceDCALAmp[j]->SetMaximum(maxAmp);
962  hAllSpaceDCALAmp[j]->Draw("COLZ");
963  lineSMborderVDCALthird->Draw("SAME");
964  lineSMborderVDCAL1->Draw("SAME");
965  lineSMborderVDCAL2->Draw("SAME");
966  for (int jm=0;jm<(int)((kNbSMDCAL+1)/2);jm++) lineSMborderHDCAL[jm]->Draw("SAME");
967  hAllSpaceDCALAmp[j]->Write();
968  }
969  c1->Update();
970 
971  //Amplitudes, for each SM :
972  ps->NewPage();
973  c1->Clear();
974  c1->Divide(2,5);
975  for (j=0;j<kNbSMEMCAL;j++)
976  {c1->cd(j+1);
977  hDistrAmp[3*j+0]->Draw();
978  hDistrAmp[3*j+1]->Draw("SAME");
979  hDistrAmp[3*j+2]->Draw("SAME");
980  gPad->SetLogy();
981  for (i=0;i<3;i++) hDistrAmp[3*j+i]->Write();
982  }
983  c1->Update();
984 
985  ps->NewPage();
986  c1->Clear();
987  c1->Divide(2,5);
988  for (j=kNbSMEMCAL;j<kNbSMtot;j++)
989  {c1->cd(j-kNbSMEMCAL+1);
990  hDistrAmp[3*j+0]->Draw();
991  hDistrAmp[3*j+1]->Draw("SAME");
992  hDistrAmp[3*j+2]->Draw("SAME");
993  gPad->SetLogy();
994  for (i=0;i<3;i++) hDistrAmp[3*j+i]->Write();
995  }
996  c1->Update();
997 
998  //Amplitude ratios, all SM and spatial :
999  ps->NewPage();
1000  c1->Clear();
1001  c1->Divide(2,3);
1002  c1->cd(1);
1003  hDistrAmpRatio[2*kNbSMtot+0]->SetMinimum(0.6);
1004  hDistrAmpRatio[2*kNbSMtot+0]->Draw();
1005  hDistrAmpRatio[2*kNbSMtot+1]->Draw("SAME");
1006  gPad->SetLogy();
1007  for (i=0;i<2;i++) hDistrAmpRatio[2*kNbSMtot+i]->Write();
1008  c1->cd(2);
1009  hDistrAmpRatioZm[2*kNbSMtot+0]->SetMinimum(0.6);
1010  hDistrAmpRatioZm[2*kNbSMtot+0]->Draw();
1011  hDistrAmpRatioZm[2*kNbSMtot+1]->Draw("SAME");
1012  gPad->SetLogy();
1013  for (i=0;i<2;i++) hDistrAmpRatioZm[2*kNbSMtot+i]->Write();
1014  for (i=0;i<2;i++)
1015  {hAllSpaceEMCALAmpRatio[i]->SetMinimum(0.5);
1016  hAllSpaceEMCALAmpRatio[i]->SetMaximum(2.0);
1017  }
1018  c1->cd(5);
1019  hAllSpaceEMCALAmpRatio[0]->Draw("COLZ");
1020  lineSMborderVEMCAL->Draw("SAME");
1021  for (int jm=0;jm<(int)((kNbSMEMCAL+1)/2);jm++) lineSMborderHEMCAL[jm]->Draw("SAME");
1022  hAllSpaceEMCALAmpRatio[0]->Write();
1023  c1->cd(3);
1024  hAllSpaceEMCALAmpRatio[1]->Draw("COLZ");
1025  lineSMborderVEMCAL->Draw("SAME");
1026  for (int jm=0;jm<(int)((kNbSMEMCAL+1)/2);jm++) lineSMborderHEMCAL[jm]->Draw("SAME");
1027  hAllSpaceEMCALAmpRatio[1]->Write();
1028  c1->Update();
1029  for (i=0;i<2;i++)
1030  {hAllSpaceEMCALAmpRatio[i]->SetMinimum(0.9);
1031  hAllSpaceEMCALAmpRatio[i]->SetMaximum(1.1);
1032  }
1033  c1->cd(6);
1034  hAllSpaceEMCALAmpRatio[0]->Draw("COLZ");
1035  lineSMborderVEMCAL->Draw("SAME");
1036  for (int jm=0;jm<(int)((kNbSMEMCAL+1)/2);jm++) lineSMborderHEMCAL[jm]->Draw("SAME");
1037  hAllSpaceEMCALAmpRatio[0]->Write();
1038  c1->cd(4);
1039  hAllSpaceEMCALAmpRatio[1]->Draw("COLZ");
1040  lineSMborderVEMCAL->Draw("SAME");
1041  for (int jm=0;jm<(int)((kNbSMEMCAL+1)/2);jm++) lineSMborderHEMCAL[jm]->Draw("SAME");
1042  hAllSpaceEMCALAmpRatio[1]->Write();
1043  c1->Update();
1044 
1045  ps->NewPage();
1046  c1->Clear();
1047  c1->Divide(2,3);
1048  for (i=0;i<2;i++)
1049  {hAllSpaceDCALAmpRatio[i]->SetMinimum(0.5);
1050  hAllSpaceDCALAmpRatio[i]->SetMaximum(2.0);
1051  }
1052  c1->cd(5);
1053  hAllSpaceDCALAmpRatio[0]->Draw("COLZ");
1054  lineSMborderVDCALthird->Draw("SAME");
1055  lineSMborderVDCAL1->Draw("SAME");
1056  lineSMborderVDCAL2->Draw("SAME");
1057  for (int jm=0;jm<(int)((kNbSMDCAL+1)/2);jm++) lineSMborderHDCAL[jm]->Draw("SAME");
1058  hAllSpaceDCALAmpRatio[0]->Write();
1059  c1->cd(3);
1060  hAllSpaceDCALAmpRatio[1]->Draw("COLZ");
1061  lineSMborderVDCALthird->Draw("SAME");
1062  lineSMborderVDCAL1->Draw("SAME");
1063  lineSMborderVDCAL2->Draw("SAME");
1064  for (int jm=0;jm<(int)((kNbSMDCAL+1)/2);jm++) lineSMborderHDCAL[jm]->Draw("SAME");
1065  hAllSpaceDCALAmpRatio[1]->Write();
1066  c1->Update();
1067  for (i=0;i<2;i++)
1068  {hAllSpaceDCALAmpRatio[i]->SetMinimum(0.9);
1069  hAllSpaceDCALAmpRatio[i]->SetMaximum(1.1);
1070  }
1071  c1->cd(6);
1072  hAllSpaceDCALAmpRatio[0]->Draw("COLZ");
1073  lineSMborderVDCALthird->Draw("SAME");
1074  lineSMborderVDCAL1->Draw("SAME");
1075  lineSMborderVDCAL2->Draw("SAME");
1076  for (int jm=0;jm<(int)((kNbSMDCAL+1)/2);jm++) lineSMborderHDCAL[jm]->Draw("SAME");
1077  hAllSpaceDCALAmpRatio[0]->Write();
1078  c1->cd(4);
1079  hAllSpaceDCALAmpRatio[1]->Draw("COLZ");
1080  lineSMborderVDCALthird->Draw("SAME");
1081  lineSMborderVDCAL1->Draw("SAME");
1082  lineSMborderVDCAL2->Draw("SAME");
1083  for (int jm=0;jm<(int)((kNbSMDCAL+1)/2);jm++) lineSMborderHDCAL[jm]->Draw("SAME");
1084  hAllSpaceDCALAmpRatio[1]->Write();
1085  c1->Update();
1086 
1087  //Amplitude ratios, for each SM :
1088  ps->NewPage();
1089  c1->Clear();
1090  c1->Divide(2,5);
1091  for (j=0;j<kNbSMEMCAL;j++)
1092  {c1->cd(j+1);
1093  hDistrAmpRatio[2*j+0]->Draw();
1094  hDistrAmpRatio[2*j+1]->Draw("SAME");
1095  gPad->SetLogy();
1096  for (i=0;i<3;i++) hDistrAmpRatio[2*j+i]->Write();
1097  for (i=0;i<2;i++) hDistrAmpRatioZm[2*j+i]->Write();
1098  }
1099  c1->Update();
1100 
1101  ps->NewPage();
1102  c1->Clear();
1103  c1->Divide(2,5);
1104  for (j=kNbSMEMCAL;j<kNbSMtot;j++)
1105  {c1->cd(j-kNbSMEMCAL+1);
1106  hDistrAmpRatio[2*j+0]->Draw();
1107  hDistrAmpRatio[2*j+1]->Draw("SAME");
1108  gPad->SetLogy();
1109  for (i=0;i<3;i++) hDistrAmpRatio[2*j+i]->Write();
1110  for (i=0;i<2;i++) hDistrAmpRatioZm[2*j+i]->Write();
1111  }
1112  c1->Update();
1113 
1114  if (runMode == 0)
1115  {//Energies, all SM and spatial :
1116  ps->NewPage();
1117  c1->Clear();
1118  c1->Divide(2,4);
1119  c1->cd(1);
1120  hDistrE[3*kNbSMtot+0]->Draw();
1121  hDistrE[3*kNbSMtot+1]->Draw("SAME");
1122  hDistrE[3*kNbSMtot+2]->Draw("SAME");
1123  gPad->SetLogy();
1124  for (i=0;i<3;i++) hDistrE[3*kNbSMtot+i]->Write();
1125  for (j=0;j<3;j++)
1126  {c1->cd(2*j+3);
1127  hAllSpaceEMCALE[j]->SetMaximum(maxE);
1128  hAllSpaceEMCALE[j]->Draw("COLZ");
1129  lineSMborderVEMCAL->Draw("SAME");
1130  for (int jm=0;jm<(int)((kNbSMEMCAL+1)/2);jm++) lineSMborderHEMCAL[jm]->Draw("SAME");
1131  hAllSpaceEMCALE[j]->Write();
1132  }
1133  for (j=0;j<3;j++)
1134  {c1->cd(2*j+4);
1135  hAllSpaceDCALE[j]->SetMaximum(maxE);
1136  hAllSpaceDCALE[j]->Draw("COLZ");
1137  lineSMborderVDCALthird->Draw("SAME");
1138  lineSMborderVDCAL1->Draw("SAME");
1139  lineSMborderVDCAL2->Draw("SAME");
1140  for (int jm=0;jm<(int)((kNbSMDCAL+1)/2);jm++) lineSMborderHDCAL[jm]->Draw("SAME");
1141  hAllSpaceDCALE[j]->Write();
1142  }
1143  c1->Update();
1144 
1145  //Energies, for each SM :
1146  ps->NewPage();
1147  c1->Clear();
1148  c1->Divide(2,5);
1149  for (j=0;j<kNbSMEMCAL;j++)
1150  {c1->cd(j+1);
1151  hDistrE[3*j+0]->Draw();
1152  hDistrE[3*j+1]->Draw("SAME");
1153  hDistrE[3*j+2]->Draw("SAME");
1154  gPad->SetLogy();
1155  for (i=0;i<3;i++) hDistrE[3*j+i]->Write();
1156  }
1157  c1->Update();
1158 
1159  ps->NewPage();
1160  c1->Clear();
1161  c1->Divide(2,5);
1162  for (j=kNbSMEMCAL;j<kNbSMtot;j++)
1163  {c1->cd(j-kNbSMEMCAL+1);
1164  hDistrE[3*j+0]->Draw();
1165  hDistrE[3*j+1]->Draw("SAME");
1166  hDistrE[3*j+2]->Draw("SAME");
1167  gPad->SetLogy();
1168  for (i=0;i<3;i++) hDistrE[3*j+i]->Write();
1169  }
1170  c1->Update();
1171 
1172  //Energy ratios, all SM and spatial :
1173  ps->NewPage();
1174  c1->Clear();
1175  c1->Divide(2,3);
1176  c1->cd(1);
1177  hDistrERatio[2*kNbSMtot+0]->SetMinimum(0.6);
1178  hDistrERatio[2*kNbSMtot+0]->Draw();
1179  hDistrERatio[2*kNbSMtot+1]->Draw("SAME");
1180  gPad->SetLogy();
1181  for (i=0;i<2;i++) hDistrERatio[2*kNbSMtot+i]->Write();
1182  c1->cd(2);
1183  hDistrERatioZm[2*kNbSMtot+0]->SetMinimum(0.6);
1184  hDistrERatioZm[2*kNbSMtot+0]->Draw();
1185  hDistrERatioZm[2*kNbSMtot+1]->Draw("SAME");
1186  gPad->SetLogy();
1187  for (i=0;i<2;i++) hDistrERatioZm[2*kNbSMtot+i]->Write();
1188  for (i=0;i<2;i++)
1189  {hAllSpaceEMCALERatio[i]->SetMinimum(0.5);
1190  hAllSpaceEMCALERatio[i]->SetMaximum(2.0);
1191  }
1192  c1->cd(5);
1193  hAllSpaceEMCALERatio[0]->Draw("COLZ");
1194  lineSMborderVEMCAL->Draw("SAME");
1195  for (int jm=0;jm<(int)((kNbSMEMCAL+1)/2);jm++) lineSMborderHEMCAL[jm]->Draw("SAME");
1196  hAllSpaceEMCALERatio[0]->Write();
1197  c1->cd(3);
1198  hAllSpaceEMCALERatio[1]->Draw("COLZ");
1199  lineSMborderVEMCAL->Draw("SAME");
1200  for (int jm=0;jm<(int)((kNbSMEMCAL+1)/2);jm++) lineSMborderHEMCAL[jm]->Draw("SAME");
1201  hAllSpaceEMCALERatio[1]->Write();
1202  c1->Update();
1203  for (i=0;i<2;i++)
1204  {hAllSpaceEMCALERatio[i]->SetMinimum(0.9);
1205  hAllSpaceEMCALERatio[i]->SetMaximum(1.1);
1206  }
1207  c1->cd(6);
1208  hAllSpaceEMCALERatio[0]->Draw("COLZ");
1209  lineSMborderVEMCAL->Draw("SAME");
1210  for (int jm=0;jm<(int)((kNbSMEMCAL+1)/2);jm++) lineSMborderHEMCAL[jm]->Draw("SAME");
1211  hAllSpaceEMCALERatio[0]->Write();
1212  c1->cd(4);
1213  hAllSpaceEMCALERatio[1]->Draw("COLZ");
1214  lineSMborderVEMCAL->Draw("SAME");
1215  for (int jm=0;jm<(int)((kNbSMEMCAL+1)/2);jm++) lineSMborderHEMCAL[jm]->Draw("SAME");
1216  hAllSpaceEMCALERatio[1]->Write();
1217  c1->Update();
1218 
1219  ps->NewPage();
1220  c1->Clear();
1221  c1->Divide(2,3);
1222  for (i=0;i<2;i++)
1223  {hAllSpaceDCALERatio[i]->SetMinimum(0.5);
1224  hAllSpaceDCALERatio[i]->SetMaximum(2.0);
1225  }
1226  c1->cd(5);
1227  hAllSpaceDCALERatio[0]->Draw("COLZ");
1228  lineSMborderVDCALthird->Draw("SAME");
1229  lineSMborderVDCAL1->Draw("SAME");
1230  lineSMborderVDCAL2->Draw("SAME");
1231  for (int jm=0;jm<(int)((kNbSMDCAL+1)/2);jm++) lineSMborderHDCAL[jm]->Draw("SAME");
1232  hAllSpaceDCALERatio[0]->Write();
1233  c1->cd(3);
1234  hAllSpaceDCALERatio[1]->Draw("COLZ");
1235  lineSMborderVDCALthird->Draw("SAME");
1236  lineSMborderVDCAL1->Draw("SAME");
1237  lineSMborderVDCAL2->Draw("SAME");
1238  for (int jm=0;jm<(int)((kNbSMDCAL+1)/2);jm++) lineSMborderHDCAL[jm]->Draw("SAME");
1239  hAllSpaceDCALERatio[1]->Write();
1240  c1->Update();
1241  for (i=0;i<2;i++)
1242  {hAllSpaceDCALERatio[i]->SetMinimum(0.9);
1243  hAllSpaceDCALERatio[i]->SetMaximum(1.1);
1244  }
1245  c1->cd(6);
1246  hAllSpaceDCALERatio[0]->Draw("COLZ");
1247  lineSMborderVDCALthird->Draw("SAME");
1248  lineSMborderVDCAL1->Draw("SAME");
1249  lineSMborderVDCAL2->Draw("SAME");
1250  for (int jm=0;jm<(int)((kNbSMDCAL+1)/2);jm++) lineSMborderHDCAL[jm]->Draw("SAME");
1251  hAllSpaceDCALERatio[0]->Write();
1252  c1->cd(4);
1253  hAllSpaceDCALERatio[1]->Draw("COLZ");
1254  lineSMborderVDCALthird->Draw("SAME");
1255  lineSMborderVDCAL1->Draw("SAME");
1256  lineSMborderVDCAL2->Draw("SAME");
1257  for (int jm=0;jm<(int)((kNbSMDCAL+1)/2);jm++) lineSMborderHDCAL[jm]->Draw("SAME");
1258  hAllSpaceDCALERatio[1]->Write();
1259  c1->Update();
1260 
1261  //Energy ratios, for each SM :
1262  ps->NewPage();
1263  c1->Clear();
1264  c1->Divide(2,5);
1265  for (j=0;j<kNbSMEMCAL;j++)
1266  {c1->cd(j+1);
1267  hDistrERatio[2*j+0]->Draw();
1268  hDistrERatio[2*j+1]->Draw("SAME");
1269  gPad->SetLogy();
1270  for (i=0;i<3;i++) hDistrERatio[2*j+i]->Write();
1271  for (i=0;i<2;i++) hDistrERatioZm[2*j+i]->Write();
1272  }
1273  c1->Update();
1274 
1275  ps->NewPage();
1276  c1->Clear();
1277  c1->Divide(2,5);
1278  for (j=kNbSMEMCAL;j<kNbSMtot;j++)
1279  {c1->cd(j-kNbSMEMCAL+1);
1280  hDistrERatio[2*j+0]->Draw();
1281  hDistrERatio[2*j+1]->Draw("SAME");
1282  gPad->SetLogy();
1283  for (i=0;i<3;i++) hDistrERatio[2*j+i]->Write();
1284  for (i=0;i<2;i++) hDistrERatioZm[2*j+i]->Write();
1285  }
1286  c1->Update();
1287  }
1288 
1289  //Relationship between OCDB factors (requested gain change) and amplitude ratio, energy ratio :
1290  if (runMode == 0)
1291  {TLine *ligne1H = new TLine(0.,1.,1.,1.);
1292  TF1 *fInv = new TF1("fInv","1/x",0.,4.); //No correction (?)
1293  TF1 *fInv2 = new TF1("fInv2","1/(x*x)",0.,4.); //Swapped correction
1294  fInv->SetLineWidth(0.5);
1295  fInv->SetLineColor(1);
1296  fInv2->SetLineWidth(0.5);
1297  fInv2->SetLineColor(1);
1298 
1299  ps->NewPage();
1300  c1->Clear();
1301  c1->Divide(2,4);
1302  c1->cd(1);
1303  hAllSpaceEMCALAmpRatio[1]->SetMinimum(0.8);
1304  hAllSpaceEMCALAmpRatio[1]->SetMaximum(1.2);
1305  hAllSpaceEMCALAmpRatio[1]->Draw("COLZ");
1306  lineSMborderVEMCAL->Draw("SAME");
1307  for (int jm=0;jm<(int)((kNbSMEMCAL+1)/2);jm++) lineSMborderHEMCAL[jm]->Draw("SAME");
1308  c1->cd(3);
1309  hAllSpaceEMCALERatio[1]->SetMinimum(0.8);
1310  hAllSpaceEMCALERatio[1]->SetMaximum(1.2);
1311  hAllSpaceEMCALERatio[1]->Draw("COLZ");
1312  lineSMborderVEMCAL->Draw("SAME");
1313  for (int jm=0;jm<(int)((kNbSMEMCAL+1)/2);jm++) lineSMborderHEMCAL[jm]->Draw("SAME");
1314  c1->cd(5);
1315  hAllSpaceEMCALOCDBfactorsBefore->SetMinimum(0.25);
1316  hAllSpaceEMCALOCDBfactorsBefore->SetMaximum(1.8);
1317  hAllSpaceEMCALOCDBfactorsBefore->Draw("COLZ");
1318  hAllSpaceEMCALOCDBfactorsBefore->Write();
1319  lineSMborderVEMCAL->Draw("SAME");
1320  for (int jm=0;jm<(int)((kNbSMEMCAL+1)/2);jm++) lineSMborderHEMCAL[jm]->Draw("SAME");
1321  c1->Update();
1322  c1->cd(6);
1323  hAllSpaceEMCALOCDBfactorsBefore->SetMinimum(0.8);
1324  hAllSpaceEMCALOCDBfactorsBefore->SetMaximum(1.2);
1325  hAllSpaceEMCALOCDBfactorsBefore->Draw("COLZ");
1326  lineSMborderVEMCAL->Draw("SAME");
1327  for (int jm=0;jm<(int)((kNbSMEMCAL+1)/2);jm++) lineSMborderHEMCAL[jm]->Draw("SAME");
1328  c1->cd(2);
1329  hAllSpaceEMCALRatioAmpliOCDB->SetMinimum(0.7);
1330  hAllSpaceEMCALRatioAmpliOCDB->SetMaximum(1.3);
1331  hAllSpaceEMCALRatioAmpliOCDB->Draw("COLZ");
1332  hAllSpaceEMCALRatioAmpliOCDB->Write();
1333  lineSMborderVEMCAL->Draw("SAME");
1334  for (int jm=0;jm<(int)((kNbSMEMCAL+1)/2);jm++) lineSMborderHEMCAL[jm]->Draw("SAME");
1335  c1->cd(4);
1336  hAllSpaceEMCALRatioEnergyOCDB->SetMinimum(0.6);
1337  hAllSpaceEMCALRatioEnergyOCDB->SetMaximum(1.8);
1338  hAllSpaceEMCALRatioEnergyOCDB->Draw("COLZ");
1339  hAllSpaceEMCALRatioEnergyOCDB->Write();
1340  lineSMborderVEMCAL->Draw("SAME");
1341  for (int jm=0;jm<(int)((kNbSMEMCAL+1)/2);jm++) lineSMborderHEMCAL[jm]->Draw("SAME");
1342  c1->Update();
1343 
1344  ps->NewPage();
1345  c1->Clear();
1346  c1->Divide(2,4);
1347  c1->cd(1);
1348  hAllSpaceDCALAmpRatio[1]->SetMinimum(0.8);
1349  hAllSpaceDCALAmpRatio[1]->SetMaximum(1.2);
1350  hAllSpaceDCALAmpRatio[1]->Draw("COLZ");
1351  lineSMborderVDCALthird->Draw("SAME");
1352  lineSMborderVDCAL1->Draw("SAME");
1353  lineSMborderVDCAL2->Draw("SAME");
1354  for (int jm=0;jm<(int)((kNbSMDCAL+1)/2);jm++) lineSMborderHDCAL[jm]->Draw("SAME");
1355  c1->cd(3);
1356  hAllSpaceDCALERatio[1]->SetMinimum(0.8);
1357  hAllSpaceDCALERatio[1]->SetMaximum(1.2);
1358  hAllSpaceDCALERatio[1]->Draw("COLZ");
1359  lineSMborderVDCALthird->Draw("SAME");
1360  lineSMborderVDCAL1->Draw("SAME");
1361  lineSMborderVDCAL2->Draw("SAME");
1362  for (int jm=0;jm<(int)((kNbSMDCAL+1)/2);jm++) lineSMborderHDCAL[jm]->Draw("SAME");
1363  c1->cd(5);
1364  hAllSpaceDCALOCDBfactorsBefore->SetMinimum(0.25);
1365  hAllSpaceDCALOCDBfactorsBefore->SetMaximum(1.8);
1366  hAllSpaceDCALOCDBfactorsBefore->Draw("COLZ");
1367  hAllSpaceDCALOCDBfactorsBefore->Write();
1368  lineSMborderVDCALthird->Draw("SAME");
1369  lineSMborderVDCAL1->Draw("SAME");
1370  lineSMborderVDCAL2->Draw("SAME");
1371  for (int jm=0;jm<(int)((kNbSMDCAL+1)/2);jm++) lineSMborderHDCAL[jm]->Draw("SAME");
1372  c1->Update();
1373  c1->cd(6);
1374  hAllSpaceDCALOCDBfactorsBefore->SetMinimum(0.8);
1375  hAllSpaceDCALOCDBfactorsBefore->SetMaximum(1.2);
1376  hAllSpaceDCALOCDBfactorsBefore->Draw("COLZ");
1377  lineSMborderVDCALthird->Draw("SAME");
1378  lineSMborderVDCAL1->Draw("SAME");
1379  lineSMborderVDCAL2->Draw("SAME");
1380  for (int jm=0;jm<(int)((kNbSMDCAL+1)/2);jm++) lineSMborderHDCAL[jm]->Draw("SAME");
1381  c1->cd(2);
1382  hAllSpaceDCALRatioAmpliOCDB->SetMinimum(0.7);
1383  hAllSpaceDCALRatioAmpliOCDB->SetMaximum(1.3);
1384  hAllSpaceDCALRatioAmpliOCDB->Draw("COLZ");
1385  hAllSpaceDCALRatioAmpliOCDB->Write();
1386  lineSMborderVDCALthird->Draw("SAME");
1387  lineSMborderVDCAL1->Draw("SAME");
1388  lineSMborderVDCAL2->Draw("SAME");
1389  for (int jm=0;jm<(int)((kNbSMDCAL+1)/2);jm++) lineSMborderHDCAL[jm]->Draw("SAME");
1390  c1->cd(4);
1391  hAllSpaceDCALRatioEnergyOCDB->SetMinimum(0.6);
1392  hAllSpaceDCALRatioEnergyOCDB->SetMaximum(1.8);
1393  hAllSpaceDCALRatioEnergyOCDB->Draw("COLZ");
1394  hAllSpaceDCALRatioEnergyOCDB->Write();
1395  lineSMborderVDCALthird->Draw("SAME");
1396  lineSMborderVDCAL1->Draw("SAME");
1397  lineSMborderVDCAL2->Draw("SAME");
1398  for (int jm=0;jm<(int)((kNbSMDCAL+1)/2);jm++) lineSMborderHDCAL[jm]->Draw("SAME");
1399  c1->Update();
1400 
1401  ps->NewPage();
1402  c1->Clear();
1403  c1->Divide(2,3);
1404  c1->cd(1);
1405  h2CorrelEnergyOCDB->Draw("COLZ");
1406  h2CorrelEnergyOCDB->Write();
1407  gPad->SetLogz();
1408  c1->Update();
1409  c1->cd(3);
1410  h2CorrelEnergyOCDBZm->Draw("COLZ");
1411  h2CorrelEnergyOCDBZm->Write();
1412  gPad->SetLogz();
1413  c1->cd(2);
1414  ligne1H->SetX1(h2CorrelEnergyOCDB->GetXaxis()->GetXmin());
1415  ligne1H->SetX2(h2CorrelEnergyOCDB->GetXaxis()->GetXmax());
1416  h2CorrelEnergyOCDB->Draw("COLZ");
1417  ligne1H->Draw("SAME");
1418  fInv->Draw("SAME");
1419  fInv2->Draw("SAME");
1420  c1->Update();
1421  c1->cd(4);
1422  ligne1H->SetX1(h2CorrelEnergyOCDBZm->GetXaxis()->GetXmin());
1423  ligne1H->SetX2(h2CorrelEnergyOCDBZm->GetXaxis()->GetXmax());
1424  h2CorrelEnergyOCDBZm->Draw("COLZ");
1425  ligne1H->Draw("SAME");
1426  fInv->Draw("SAME");
1427  fInv2->Draw("SAME");
1428  c1->Update();
1429  c1->cd(6);
1430  ligne1H->SetX1(h2CorrelEnergyOCDBZmZm->GetXaxis()->GetXmin());
1431  ligne1H->SetX2(h2CorrelEnergyOCDBZmZm->GetXaxis()->GetXmax());
1432  h2CorrelEnergyOCDBZmZm->Draw("COLZ");
1433  ligne1H->Draw("SAME");
1434  fInv->Draw("SAME");
1435  h2CorrelEnergyOCDBZmZm->Write();
1436  c1->Update();
1437  }
1438 
1439  //Correlation plots, all SM :
1440  ps->NewPage();
1441  c1->Clear();
1442  c1->Divide(2,3);
1443  c1->cd(5);
1444  h2Amp[2*kNbSMtot+0]->Draw("COLZ");
1445  c1->cd(6);
1446  if (runMode == 0) h2E[2*kNbSMtot+0]->Draw("COLZ");
1447  c1->cd(3);
1448  h2Amp[2*kNbSMtot+1]->Draw("COLZ");
1449  c1->cd(4);
1450  if (runMode == 0) h2E[2*kNbSMtot+1]->Draw("COLZ");
1451  for (i=0;i<2;i++)
1452  {h2Amp[2*kNbSMtot+i]->Write();
1453  h2E[2*kNbSMtot+i]->Write();
1454  }
1455  c1->Update();
1456 
1457  for (iSM=0;iSM<kNbSMtot;iSM++)
1458  {if ((iSM%4) == 0)
1459  {c1->Update();
1460  ps->NewPage();
1461  c1->Clear();
1462  c1->Divide(2,4);
1463  }
1464  c1->cd(2*(iSM%4)+1);
1465  h2Amp[2*iSM+1]->Draw("COLZ");
1466  h2Amp[2*iSM+1]->Write();
1467  c1->cd(2*(iSM%4)+2);
1468  if (runMode == 0) h2E[2*iSM+1]->Draw("COLZ");
1469  h2E[2*iSM+1]->Write();
1470  }
1471 
1472  for (iSM=0;iSM<kNbSMtot;iSM++)
1473  {if ((iSM%4) == 0)
1474  {c1->Update();
1475  ps->NewPage();
1476  c1->Clear();
1477  c1->Divide(2,4);
1478  }
1479  c1->cd(2*(iSM%4)+1);
1480  h2Amp[2*iSM+0]->Draw("COLZ");
1481  h2Amp[2*iSM+0]->Write();
1482  c1->cd(2*(iSM%4)+2);
1483  if (runMode == 0) h2E[2*iSM+0]->Draw("COLZ");
1484  h2E[2*iSM+0]->Write();
1485  }
1486 
1487  c1->Update();
1488 
1489  //Correlation plots ratios vs intgs, all SM :
1490  ps->NewPage();
1491  c1->Clear();
1492  c1->Divide(2,3);
1493  for (j=0;j<6;j++)
1494  {c1->cd(j+1);
1495  h2RatioVsIntg[6*kNbSMtot+j]->Draw("COLZ");
1496  h2RatioVsIntg[6*kNbSMtot+j]->Write();
1497  if ((j%2) == 0) gPad->SetLogz();
1498  }
1499  c1->Update();
1500 
1501  //Correlation plots ratios vs amplitudes, all SM :
1502  ps->NewPage();
1503  c1->Clear();
1504  c1->Divide(2,3);
1505  for (j=0;j<6;j++)
1506  {c1->cd(j+1);
1507  h2RatioVsAmp[6*kNbSMtot+j]->Draw("COLZ");
1508  h2RatioVsAmp[6*kNbSMtot+j]->Write();
1509  }
1510  c1->Update();
1511 
1512 
1513  printf("Drawing done.\n");
1514 
1515 
1516  ps->Close();
1517  printf("Closed ps file.\n");
1518  rootFileOut->Close();
1519  printf("Closed root file.\n");
1520  fclose(outFile);
1521  printf("Closed txt file, quit root.\n");
1522 
1523  return;
1524  }
1525 
1526 
1527 
1528 
1529 
1530 
1531 
bool ledonly
Definition: PlotLEDruns.C:45
void Draw(const char *filename, const char *title="", const char *others="ALL", const char *options="DEFAULT", const char *outFlg="ALL", UShort_t rebin=5, Float_t eff=0, const char *base="")
Definition: DrawdNdeta.C:3603
const int kNbColEMCALthird
Definition: External.C:236
const int kTabNbCol[4]
bool wled
Definition: PlotLEDruns.C:44
const int kNbRowMax
char SMP2Name[][100]
Definition: PlotLEDruns.C:60
int SMdetType[]
Definition: PlotLEDruns.C:61
const int kNbSMtot
const int kNbSMEMCAL
const int kNbRowEMCAL
char detTypeString[][100]
Definition: PlotLEDruns.C:57
const int kNbRowDCAL
const int kNbRowDCALthird
int stripPlot
Definition: PlotLEDruns.C:46
const int kNbColMax
const int kNbSMEMCALthird
const int kNbColDCAL
const int kTabNbRow[4]
char RunlistFilename[200]
Definition: PlotLEDruns.C:47
const double coefFactorWanted
Definition: PlotLEDruns.C:50
const int kNbColEMCAL
const int kNbSMDCALthird
const int kNbRowEMCALthird
const int kNbSMDCAL
const int kTabNbSM[4]
const int kNbColDCALthird
void PlotLEDruns(int run1, int run2, int run3, TString ident="")
Definition: PlotLEDruns.C:93