AliPhysics  64f4410 (64f4410)
UnderstandDCALthirdShuffle.C
Go to the documentation of this file.
1 
2 
3 #include <TChain.h>
4 #include <TNtuple.h>
5 #include <TObjArray.h>
6 #include <TSystem.h>
7 #include <TString.h>
8 #include <TH1F.h>
9 #include <TVector.h>
10 #include <TRefArray.h>
11 #include <TArrayS.h>
12 #include "TError.h"
13 #include "TTree.h"
14 #include "TClonesArray.h"
15 #include "TGraphErrors.h"
16 #include "TPostScript.h"
17 #include "TLegend.h"
18 #include "TH2I.h"
19 #include "TF1.h"
20 #include "TStyle.h"
21 #include "TCanvas.h"
22 #include "TPolyLine.h"
23 #include "TLine.h"
24 #include "TFile.h"
25 #include "TMath.h"
26 #include "TLeaf.h"
27 #include "TBranch.h"
28 
29 //#include "/cebaf/faivre/recherche/utilities/defineMyPalette2011.C"
30 
42 
47 {int iSM,iCol,iRow,sm,col,row;
48  double coeff,HV;
49  double tabCalibCoeff[48*8],tabHV1[48*8],tabHV2[48*8],tabHVapplied[48*8],tabHVdesired[48*8];
50 
51  TCanvas *c1 = new TCanvas("c1","EMCal",550.,500.);
52  c1->SetBorderMode(0);
53  c1->SetFillColor(10); //Pas kWhite ni 0, sinon fait la bordure rouge dans la frame du plot !
54 
55  //defineMyPalette2011(30,5);
56 
57  TH1F *hCoeff = new TH1F("hCoeff","hCoeff",200,0.5,2.);
58  hCoeff->SetStats(0);
59  hCoeff->SetXTitle("Coeff");
60  hCoeff->SetYTitle("Counts");
61  TH1F *hHV_A = new TH1F("hHV_A","hHV_A",200,210.,400.);
62  hHV_A->SetStats(0);
63  hHV_A->SetXTitle("HV (A)");
64  hHV_A->SetYTitle("Counts");
65  TH1F *hHV_C = new TH1F("hHV_C","hHV_C",200,210.,400.);
66  hHV_C->SetStats(0);
67  hHV_C->SetXTitle("HV (C)");
68  hHV_C->SetYTitle("Counts");
69  TH1F *hHVdiff = new TH1F("hHVdiff","hHVdiff",200,-50.,50.);
70  hHVdiff->SetStats(0);
71  hHVdiff->SetXTitle("HV difference");
72  hHVdiff->SetYTitle("Counts");
73  TH2F *hCoeffVsHVratio = new TH2F("hCoeffVsHVratio","hCoeffVsHVratio",80,0.8,1.2,80,0.5,2.);
74  //TH2F *hCoeffVsHVratio = new TH2F("hCoeffVsHVratio","hCoeffVsHVratio",80,-30.,30.,80,0.5,2.); //To try with HVdiff instead of HVratio.
75  hCoeffVsHVratio->SetStats(0);
76  hCoeffVsHVratio->SetXTitle("HV_A/HV_C");
77  hCoeffVsHVratio->SetYTitle("Coeff");
78  hCoeffVsHVratio->SetContour(30);
79 
80  FILE *fch = new FILE;
81  fch = fopen("/cebaf/cebaf/EMCAL/calibPi0_run2/calibPi0_4_with2015data/output/pass2_DCALandThirdSMsVeryHighTowers/multiplyPi0CalibrationFactors_TextToHisto_forIter3_finalFile4HVcalculation.txt","r");
82  for (int jm=0;jm<(10*48*24+6*32*24+4*48*8);jm++)
83  {fscanf(fch," %d %d %d %lf\n",&sm,&col,&row,&coeff);
84  if (sm != 18) continue;
85  tabCalibCoeff[8*col+row]=coeff;
86  hCoeff->Fill(coeff);
87  //printf("(%d,%d) : %f\n",col,row,coeff);
88  }
89  fclose(fch);
90 
91  FILE *fch2 = new FILE;
92  fch2 = fopen("/cebaf/faivre/recherche/calibPi0/recalculateDCAL_HV_July2015/output_HVrecalculationDCAL2015July_mergedWithEMCalHV_lowerTemperature_createBias/DCal/FinalBias_CN1.txt","r");
93  for (int jm=0;jm<(48*24);jm++)
94  {fscanf(fch," %d %d %lf\n",&col,&row,&HV);
95  if (row<8)
96  {tabHV1[8*col+row]=HV;
97  hHV_A->Fill(HV);
98  }
99  if (row>=16)
100  {tabHV2[8*col+row-16]=HV;
101  hHV_C->Fill(HV);
102  }
103  }
104  fclose(fch2);
105 
106  for (iCol=0;iCol<48;iCol++)
107  {for (iRow=0;iRow<8;iRow++)
108  {tabHVapplied[8*iCol+iRow]=tabHV1[8*iCol+iRow];
109  tabHVdesired[8*iCol+iRow]=tabHV2[8*iCol+iRow]; //Correct
110  //tabHVdesired[8*iCol+iRow]=tabHV1[8*(47-iCol)+(7-iRow)]; //Random-1
111  //tabHVdesired[8*iCol+iRow]=tabHV2[8*(47-iCol)+(7-iRow)]; //Random-2
112  if (tabCalibCoeff[8*iCol+iRow] == 1.) continue;
113  hCoeffVsHVratio->Fill(tabHVapplied[8*iCol+iRow]/tabHVdesired[8*iCol+iRow],tabCalibCoeff[8*iCol+iRow]);
114  //hCoeffVsHVratio->Fill(tabHVapplied[8*iCol+iRow]-tabHVdesired[8*iCol+iRow],tabCalibCoeff[8*iCol+iRow]); //To look at HVdiff instead of HVratio.
115  hHVdiff->Fill(tabHV1[8*iCol+iRow]-tabHV2[8*iCol+iRow]);
116  }
117  }
118 
119  hCoeff->Draw();
120  hHV_A->Draw();
121  hHV_C->Draw();
122 
123  TLine *ligneH = new TLine(hCoeffVsHVratio->GetXaxis()->GetXmin(),1.,hCoeffVsHVratio->GetXaxis()->GetXmax(),1.);
124  TLine *ligneV = new TLine(1.,hCoeffVsHVratio->GetYaxis()->GetXmin(),1.,hCoeffVsHVratio->GetYaxis()->GetXmax());
125  hCoeffVsHVratio->SetMaximum(5.);
126 
127  hCoeffVsHVratio->Draw("COLZ");
128  hCoeffVsHVratio->SetTitle(0);
129  ligneH->Draw();
130  ligneV->Draw();
131 
132  hHVdiff->SetTitle(0);
133  hHVdiff->Rebin(2);
134  hHVdiff->Draw();
135 
136  return;
137  }
138 
139 
140 
141 
142 
143 
void UnderstandDCALthirdShuffle(void)
Definition: External.C:236