AliPhysics  9b6b435 (9b6b435)
MakeDataMCComparisonPerSMClusterEbinAndChi2.C
Go to the documentation of this file.
1 
18 
19 #if !defined(__CINT__) || defined(__MAKECINT__)
20 
21 #include <TFile.h>
22 #include <TDirectoryFile.h>
23 #include <TList.h>
24 #include <TString.h>
25 #include <TROOT.h>
26 #include <TStyle.h>
27 #include <TH1D.h>
28 #include <TH2F.h>
29 #include <TH3F.h>
30 #include <TCanvas.h>
31 #include <TPad.h>
32 #include <TLegend.h>
33 #include <TObject.h>
34 #include <TAxis.h>
35 #include <TGaxis.h>
36 #include <TLine.h>
37 #include <TF1.h>
38 #include <TMath.h>
39 #include <TArrayD.h>
40 #include <TGraphErrors.h>
41 
44 
45 #endif
46 
47 //------------------------------------------------------------------------------
53 //------------------------------------------------------------------------------
55 (
56  TString titleMC = "JJDecLow", // "JJDecHigh", "JJDecLow"
57  TString titleData= "LHC11cd_EMC7",
58  Bool_t debug = kFALSE
59 )
60 {
61  // Energy bins
62  const Int_t nEBins = 5;//5;
63  TArrayD binE; binE.Set(nEBins+1);
64  Double_t binEErr[] = { 1, 1, 1, 1, 1, 1, 1};
65 
66  TString daLeg = "pp@7 TeV, LHC11c+d EMC7";
67  if(titleData == "LHC11cd_EMC7")
68  daLeg = "pp@7 TeV, LHC11c+d EMC7";
69  if(titleData == "LHC11cd_INT7")
70  daLeg = "pp@7 TeV, LHC11c+d INT7";
71 
72  TString mcDir = "JJ_Dec_GJ";
73  TString mcLeg = "MC: #gammaJ+JJ({p^{EMCal}_{T,#gamma}>3.5 GeV/#it{c})";
74  Int_t nProdParam = 29;
75  TArrayD prodParam;
76 
77  if ( titleMC.Contains("Low") )
78  {
79  // JJDecLow
80  Double_t energyBins[] = { 8, 10, 12, 14, 16, 18, 20 };
81  for(Int_t ie = 0; ie < nEBins+1; ie++) binE[ie] = energyBins[ie];
82  mcDir = "JJ_Dec_GJ";
83  mcLeg = "#gammaJ+JJ(p^{EMCal}_{T,#gamma}>3.5 GeV/#it{c})";
84 
85  // Production per induced fraction bins
86  Double_t prodParamArr[] =
87  {0,0.10,0.20,0.30,0.40,0.50,0.60,0.70,0.80,0.90,1.00,1.050,1.100,1.125,
88  1.150,1.175,1.200,1.225,1.250,1.275,1.300,1.325,1.350,1.375,1.400,1.450,1.50,1.60};
89  nProdParam = 29; // make sure it is the same number as the hand made array below
90  prodParam.Set(nProdParam-1);
91  for(Int_t iprod = 0; iprod < nProdParam-1; iprod++)
92  prodParam[iprod] = prodParamArr[iprod];
93  }
94  else if ( titleMC.Contains("High") )
95  {
96  // JJDecHigh
97  Double_t energyBins[] = { 18, 20, 25, 30, 35, 40, 50 };
98  for(Int_t ie = 0; ie < nEBins+1; ie++) binE[ie] = energyBins[ie];
99  mcDir = "JJ_Dec_High_GJ";
100  mcLeg = "#gammaJ+JJ(p^{EMCal}_{T,#gamma}>7 GeV/#it{c})}";
101  // Production per induced fraction bins
102  Double_t prodParamArr[] =
103  {0,0.050,0.100,0.150,0.200,0.250,0.300,0.350,0.400,0.450,0.500,0.550,
104  0.600,0.650,0.700,0.750,0.800,0.850,0.900,0.950,
105  1.000,1.050,1.100,1.150,1.200,1.250,1.300,1.350,1.400,1.450};
106  nProdParam = 31; // make sure it is the same number as the hand made array below
107  prodParam.Set(nProdParam-1);
108  for(Int_t iprod = 0; iprod < nProdParam-1; iprod++)
109  prodParam[iprod] = prodParamArr[iprod];
110  }
111 
112  const Int_t nProd = nProdParam;
113  TString prod [nProd];
115 
116  if ( debug ) printf("N prod %d\n",nProd);
117 
118  // Here we have the files for each production done for a different fraction
119  // of induced energy mu1
120  Int_t nproditer = 0;
121  if ( titleMC.Contains("Low") )
122  {
123  prod [nproditer++] = "data/LHC11cd_EMC7";
124  prodLeg[nproditer-1] = "Data";
125  prod [nproditer++] = "simu/mimic/pp_7TeV_JJ_Dec_GJ/default/sumw2on";
126  prodLeg[nproditer-1] = "MC, Default";
127  prod [nproditer++] = "simu/mimic/pp_7TeV_JJ_Dec_GJ/TCard_C_79/sumw2on"; // 0.1%
128  prodLeg[nproditer-1] = "MC, mimic #mu_{1}=0.1%";
129  prod [nproditer++] = "simu/mimic/pp_7TeV_JJ_Dec_GJ/TCard_C_78/sumw2on"; // 0.2%
130  prodLeg[nproditer-1] = "MC, mimic #mu_{1}=0.2%";
131  prod [nproditer++] = "simu/mimic/pp_7TeV_JJ_Dec_GJ/TCard_C_71/sumw2on"; // 0.3%
132  prodLeg[nproditer-1] = "MC, mimic #mu_{1}=0.3%";
133  prod [nproditer++] = "simu/mimic/pp_7TeV_JJ_Dec_GJ/TCard_C_77/sumw2on"; // 0.4%
134  prodLeg[nproditer-1] = "MC, mimic #mu_{1}=0.4%";
135  prod [nproditer++] = "simu/mimic/pp_7TeV_JJ_Dec_GJ/TCard_C_70/sumw2on"; // 0.5%
136  prodLeg[nproditer-1] = "MC, mimic #mu_{1}=0.5%";
137  prod [nproditer++] = "simu/mimic/pp_7TeV_JJ_Dec_GJ/TCard_C_76/sumw2on"; // 0.6%
138  prodLeg[nproditer-1] = "MC, mimic #mu_{1}=0.6%";
139  prod [nproditer++] = "simu/mimic/pp_7TeV_JJ_Dec_GJ/TCard_C_75/sumw2on"; // 0.7%
140  prodLeg[nproditer-1] = "MC, mimic #mu_{1}=0.7%";
141  prod [nproditer++] = "simu/mimic/pp_7TeV_JJ_Dec_GJ/TCard_C_69/sumw2on"; // 0.8%
142  prodLeg[nproditer-1] = "MC, mimic #mu_{1}=0.8%";
143  prod [nproditer++] = "simu/mimic/pp_7TeV_JJ_Dec_GJ/TCard_C_74/sumw2on"; // 0.9%
144  prodLeg[nproditer-1] = "MC, mimic #mu_{1}=0.9%";
145  prod [nproditer++] = "simu/mimic/pp_7TeV_JJ_Dec_GJ/TCard_C_68/sumw2on"; // 1.0%
146  prodLeg[nproditer-1] = "MC, mimic #mu_{1}=1.0%";
147  prod [nproditer++] = "simu/mimic/pp_7TeV_JJ_Dec_GJ/TCard_C_89/sumw2on"; // 1.05%
148  prodLeg[nproditer-1] = "MC, mimic #mu_{1}=1.05%";
149  prod [nproditer++] = "simu/mimic/pp_7TeV_JJ_Dec_GJ/TCard_C_73/sumw2on"; // 1.1%
150  prodLeg[nproditer-1] = "MC, mimic #mu_{1}=1.1%";
151  prod [nproditer++] = "simu/mimic/pp_7TeV_JJ_Dec_GJ/TCard_C_95/sumw2on"; // 1.125%
152  prodLeg[nproditer-1] = "MC, mimic #mu_{1}=1.125%";
153  prod [nproditer++] = "simu/mimic/pp_7TeV_JJ_Dec_GJ/TCard_C_85/sumw2on"; // 1.15%
154  prodLeg[nproditer-1] = "MC, mimic #mu_{1}=1.15%";
155  prod [nproditer++] = "simu/mimic/pp_7TeV_JJ_Dec_GJ/TCard_C_90/sumw2on"; // 1.175%
156  prodLeg[nproditer-1] = "MC, mimic #mu_{1}=1.175%";
157  prod [nproditer++] = "simu/mimic/pp_7TeV_JJ_Dec_GJ/TCard_C_67/sumw2on"; // 1.2%
158  prodLeg[nproditer-1] = "MC, mimic #mu_{1}=1.2%";
159  prod [nproditer++] = "simu/mimic/pp_7TeV_JJ_Dec_GJ/TCard_C_91/sumw2on"; // 1.225%
160  prodLeg[nproditer-1] = "MC, mimic #mu_{1}=1.225%";
161  prod [nproditer++] = "simu/mimic/pp_7TeV_JJ_Dec_GJ/TCard_C_86/sumw2on"; // 1.25%
162  prodLeg[nproditer-1] = "MC, mimic #mu_{1}=1.25%";
163  prod [nproditer++] = "simu/mimic/pp_7TeV_JJ_Dec_GJ/TCard_C_92/sumw2on"; // 1.275%
164  prodLeg[nproditer-1] = "MC, mimic #mu_{1}=1.275%";
165  prod [nproditer++] = "simu/mimic/pp_7TeV_JJ_Dec_GJ/TCard_C_66/sumw2on"; // 1.3%
166  prodLeg[nproditer-1] = "MC, mimic #mu_{1}=1.3%";
167  prod [nproditer++] = "simu/mimic/pp_7TeV_JJ_Dec_GJ/TCard_C_93/sumw2on"; // 1.325%
168  prodLeg[nproditer-1] = "MC, mimic #mu_{1}=1.325%";
169  prod [nproditer++] = "simu/mimic/pp_7TeV_JJ_Dec_GJ/TCard_C_87/sumw2on"; // 1.35%
170  prodLeg[nproditer-1] = "MC, mimic #mu_{1}=1.35%";
171  prod [nproditer++] = "simu/mimic/pp_7TeV_JJ_Dec_GJ/TCard_C_94/sumw2on"; // 1.375%
172  prodLeg[nproditer-1] = "MC, mimic #mu_{1}=1.375%";
173  prod [nproditer++] = "simu/mimic/pp_7TeV_JJ_Dec_GJ/TCard_C_65/sumw2on"; // 1.4%
174  prodLeg[nproditer-1] = "MC, mimic #mu_{1}=1.4%";
175  prod [nproditer++] = "simu/mimic/pp_7TeV_JJ_Dec_GJ/TCard_C_88/sumw2on"; // 1.45%
176  prodLeg[nproditer-1] = "MC, mimic #mu_{1}=1.45%";
177  prod [nproditer++] = "simu/mimic/pp_7TeV_JJ_Dec_GJ/TCard_C_64/sumw2on"; // 1.5%
178  prodLeg[nproditer-1] = "MC, mimic #mu_{1}=1.5%";
179  prod [nproditer++] = "simu/mimic/pp_7TeV_JJ_Dec_GJ/TCard_C_72/sumw2on"; // 1.6%
180  prodLeg[nproditer-1] = "MC, mimic #mu_{1}=1.6%";
181  }
182  else if ( titleMC.Contains("High") )
183  {
184  prod [nproditer++] = "data/higherE/LHC11cd_EMC7";
185  prodLeg[nproditer-1] = "Data";
186  prod [nproditer++] = "simu/mimic/pp_7TeV_JJ_Dec_High_GJ/param/ScaledMerged_V1_Ecell100_Eseed500_Cell_IndEFrac_0.000PerCent.root" ;
187  prodLeg[nproditer-1] = "MC, Default";
188  prod [nproditer++] = "simu/mimic/pp_7TeV_JJ_Dec_High_GJ/param/ScaledMerged_V1_Ecell100_Eseed500_Cell_IndEFrac_0.050PerCent.root" ;
189  prodLeg[nproditer-1] = "MC, mimic #mu_{1}=0.05%";
190  prod [nproditer++] = "simu/mimic/pp_7TeV_JJ_Dec_High_GJ/param/ScaledMerged_V1_Ecell100_Eseed500_Cell_IndEFrac_0.100PerCent.root" ;
191  prodLeg[nproditer-1] = "MC, mimic #mu_{1}=0.1%";
192  prod [nproditer++] = "simu/mimic/pp_7TeV_JJ_Dec_High_GJ/param/ScaledMerged_V1_Ecell100_Eseed500_Cell_IndEFrac_0.150PerCent.root" ;
193  prodLeg[nproditer-1] = "MC, mimic #mu_{1}=0.15%";
194  prod [nproditer++] = "simu/mimic/pp_7TeV_JJ_Dec_High_GJ/param/ScaledMerged_V1_Ecell100_Eseed500_Cell_IndEFrac_0.200PerCent.root" ;
195  prodLeg[nproditer-1] = "MC, mimic #mu_{1}=0.2%";
196  prod [nproditer++] = "simu/mimic/pp_7TeV_JJ_Dec_High_GJ/param/ScaledMerged_V1_Ecell100_Eseed500_Cell_IndEFrac_0.250PerCent.root" ;
197  prodLeg[nproditer-1] = "MC, mimic #mu_{1}=0.25%";
198  prod [nproditer++] = "simu/mimic/pp_7TeV_JJ_Dec_High_GJ/param/ScaledMerged_V1_Ecell100_Eseed500_Cell_IndEFrac_0.300PerCent.root" ;
199  prodLeg[nproditer-1] = "MC, mimic #mu_{1}=0.3%";
200  prod [nproditer++] = "simu/mimic/pp_7TeV_JJ_Dec_High_GJ/param/ScaledMerged_V1_Ecell100_Eseed500_Cell_IndEFrac_0.350PerCent.root" ;
201  prodLeg[nproditer-1] = "MC, mimic #mu_{1}=0.35%";
202  prod [nproditer++] = "simu/mimic/pp_7TeV_JJ_Dec_High_GJ/param/ScaledMerged_V1_Ecell100_Eseed500_Cell_IndEFrac_0.400PerCent.root" ;
203  prodLeg[nproditer-1] = "MC, mimic #mu_{1}=0.4%";
204  prod [nproditer++] = "simu/mimic/pp_7TeV_JJ_Dec_High_GJ/param/ScaledMerged_V1_Ecell100_Eseed500_Cell_IndEFrac_0.450PerCent.root" ;
205  prodLeg[nproditer-1] = "MC, mimic #mu_{1}=0.45%";
206  prod [nproditer++] = "simu/mimic/pp_7TeV_JJ_Dec_High_GJ/param/ScaledMerged_V1_Ecell100_Eseed500_Cell_IndEFrac_0.500PerCent.root" ;
207  prodLeg[nproditer-1] = "MC, mimic #mu_{1}=0.5%";
208  prod [nproditer++] = "simu/mimic/pp_7TeV_JJ_Dec_High_GJ/param/ScaledMerged_V1_Ecell100_Eseed500_Cell_IndEFrac_0.550PerCent.root" ;
209  prodLeg[nproditer-1] = "MC, mimic #mu_{1}=0.55%";
210  prod [nproditer++] = "simu/mimic/pp_7TeV_JJ_Dec_High_GJ/param/ScaledMerged_V1_Ecell100_Eseed500_Cell_IndEFrac_0.600PerCent.root" ;
211  prodLeg[nproditer-1] = "MC, mimic #mu_{1}=0.6%";
212  prod [nproditer++] = "simu/mimic/pp_7TeV_JJ_Dec_High_GJ/param/ScaledMerged_V1_Ecell100_Eseed500_Cell_IndEFrac_0.650PerCent.root" ;
213  prodLeg[nproditer-1] = "MC, mimic #mu_{1}=0.65%";
214  prod [nproditer++] = "simu/mimic/pp_7TeV_JJ_Dec_High_GJ/param/ScaledMerged_V1_Ecell100_Eseed500_Cell_IndEFrac_0.700PerCent.root" ;
215  prodLeg[nproditer-1] = "MC, mimic #mu_{1}=0.7%";
216  prod [nproditer++] = "simu/mimic/pp_7TeV_JJ_Dec_High_GJ/param/ScaledMerged_V1_Ecell100_Eseed500_Cell_IndEFrac_0.750PerCent.root" ;
217  prodLeg[nproditer-1] = "MC, mimic #mu_{1}=0.75%";
218  prod [nproditer++] = "simu/mimic/pp_7TeV_JJ_Dec_High_GJ/param/ScaledMerged_V1_Ecell100_Eseed500_Cell_IndEFrac_0.800PerCent.root" ;
219  prodLeg[nproditer-1] = "MC, mimic #mu_{1}=0.8%";
220  prod [nproditer++] = "simu/mimic/pp_7TeV_JJ_Dec_High_GJ/param/ScaledMerged_V1_Ecell100_Eseed500_Cell_IndEFrac_0.850PerCent.root" ;
221  prodLeg[nproditer-1] = "MC, mimic #mu_{1}=0.85%";
222  prod [nproditer++] = "simu/mimic/pp_7TeV_JJ_Dec_High_GJ/param/ScaledMerged_V1_Ecell100_Eseed500_Cell_IndEFrac_0.900PerCent.root" ;
223  prodLeg[nproditer-1] = "MC, mimic #mu_{1}=0.9%";
224  prod [nproditer++] = "simu/mimic/pp_7TeV_JJ_Dec_High_GJ/param/ScaledMerged_V1_Ecell100_Eseed500_Cell_IndEFrac_0.950PerCent.root" ;
225  prodLeg[nproditer-1] = "MC, mimic #mu_{1}=0.95%";
226  prod [nproditer++] = "simu/mimic/pp_7TeV_JJ_Dec_High_GJ/param/ScaledMerged_V1_Ecell100_Eseed500_Cell_IndEFrac_1.000PerCent.root" ;
227  prodLeg[nproditer-1] = "MC, mimic #mu_{1}=1.0%";
228  prod [nproditer++] = "simu/mimic/pp_7TeV_JJ_Dec_High_GJ/param/ScaledMerged_V1_Ecell100_Eseed500_Cell_IndEFrac_1.050PerCent.root" ;
229  prodLeg[nproditer-1] = "MC, mimic #mu_{1}=1.05%";
230  prod [nproditer++] = "simu/mimic/pp_7TeV_JJ_Dec_High_GJ/param/ScaledMerged_V1_Ecell100_Eseed500_Cell_IndEFrac_1.100PerCent.root" ;
231  prodLeg[nproditer-1] = "MC, mimic #mu_{1}=1.1%";
232  prod [nproditer++] = "simu/mimic/pp_7TeV_JJ_Dec_High_GJ/param/ScaledMerged_V1_Ecell100_Eseed500_Cell_IndEFrac_1.150PerCent.root" ;
233  prodLeg[nproditer-1] = "MC, mimic #mu_{1}=1.15%";
234  prod [nproditer++] = "simu/mimic/pp_7TeV_JJ_Dec_High_GJ/param/ScaledMerged_V1_Ecell100_Eseed500_Cell_IndEFrac_1.200PerCent.root" ;
235  prodLeg[nproditer-1] = "MC, mimic #mu_{1}=1.2%";
236  prod [nproditer++] = "simu/mimic/pp_7TeV_JJ_Dec_High_GJ/param/ScaledMerged_V1_Ecell100_Eseed500_Cell_IndEFrac_1.250PerCent.root" ;
237  prodLeg[nproditer-1] = "MC, mimic #mu_{1}=1.25%";
238  prod [nproditer++] = "simu/mimic/pp_7TeV_JJ_Dec_High_GJ/param/ScaledMerged_V1_Ecell100_Eseed500_Cell_IndEFrac_1.300PerCent.root" ;
239  prodLeg[nproditer-1] = "MC, mimic #mu_{1}=1.3%";
240  prod [nproditer++] = "simu/mimic/pp_7TeV_JJ_Dec_High_GJ/param/ScaledMerged_V1_Ecell100_Eseed500_Cell_IndEFrac_1.350PerCent.root" ;
241  prodLeg[nproditer-1] = "MC, mimic #mu_{1}=1.35%";
242  prod [nproditer++] = "simu/mimic/pp_7TeV_JJ_Dec_High_GJ/param/ScaledMerged_V1_Ecell100_Eseed500_Cell_IndEFrac_1.400PerCent.root" ;
243  prodLeg[nproditer-1] = "MC, mimic #mu_{1}=1.4%";
244  prod [nproditer++] = "simu/mimic/pp_7TeV_JJ_Dec_High_GJ/param/ScaledMerged_V1_Ecell100_Eseed500_Cell_IndEFrac_1.450PerCent.root" ;
245  prodLeg[nproditer-1] = "MC, mimic #mu_{1}=1.45%";
246  }
247 
248  if ( debug )
249  {
250  for(Int_t iprod = 0; iprod < nProd; iprod++)
251  {
252  printf("iprod %d,\n \t file: %s,\n \t legend: %s\n",
253  iprod,prod[iprod].Data(),prodLeg[iprod].Data());
254  }
255  }
256 
257  Int_t nHisto = 7;
258  TString histoName[] =
259  {
260  "SMM02NoCut","SMM02",
261  "SMM20LowM02NoCut","SMM20LowM02",
262  "SMM20HighM02NoCut","SMM20HighM02",
263  "SMNCell"
264  }; // This was done with an old version of the code with few TH3 defined,
265  // if exercise repited now, more histogranms could be used.
266 
267  // Different options selecing the file or histogram name
268  TString clusterization = "_V1_Ecell100_Eseed500";
269  TString tm = "_TMDep";//"TMFix",
270  TString pid = "_Neutral";//"_Electron", "_Hadron","Neutral"
271 
272  Bool_t plotRatio = kFALSE;
273  Bool_t saveHisto = kTRUE;
274  Int_t firstSM = 0;
275  Int_t lastSM = 9;
276  Int_t firstMC = 1;
277  TString outputFileName = "";
278 
279  for(Int_t ihisto = 0; ihisto < nHisto; ihisto++)
280  {
281  printf("histogram %d %s\n",ihisto,histoName[ihisto].Data());
283  (outputFileName,
284  histoName[ihisto], nProd, prod, prodLeg,
285  clusterization,tm,pid,
286  titleMC , mcLeg,
287  titleData, daLeg,
288  firstSM , lastSM,
289  binE , firstMC,
290  plotRatio, saveHisto,
291  "ForChi2", debug);
292 
293  if(saveHisto)
294  {
295  printf("inputFile %s\n",outputFileName.Data());
297  (histoName[ihisto],
298  outputFileName,
299  0, // dataProd index
300  firstSM, lastSM,
301  binE, prodParam,
302  1, // extra rebin
303  debug);
304  }
305  } // histo loop
306 
307 }
308 
309 
double Double_t
Definition: External.C:58
Calculate Chi2 distributions for different cluster parameters.
int lastSM
void CalculateParamChi2MCxTalkDataPerSM(TString histoName="SMM02NoCut", TString inputFileName="", Int_t dataProd=0, Int_t firstSM=0, Int_t lastSM=9, TArrayD binE=0, TArrayD prodParam=0, Int_t rebin=1, Bool_t debug=kFALSE)
int Int_t
Definition: External.C:63
const Int_t nProd
Compare a cluster parameter (shower shape) between different productions.
void MakeDataMCComparisonPerSMClusterEbinAndChi2(TString titleMC="JJDecLow", TString titleData="LHC11cd_EMC7", Bool_t debug=kFALSE)
TString prodLeg[]
Bool_t Data(TH1F *h, Double_t *rangefit, Bool_t writefit, Double_t &sgn, Double_t &errsgn, Double_t &bkg, Double_t &errbkg, Double_t &sgnf, Double_t &errsgnf, Double_t &sigmafit, Int_t &status)
void CompareTH3DataAndMCProd(TString &outputFileName, TString histoName="SMM02NoCut", const Int_t nProd=3, TString *prod=0x0, TString *prodLeg=0x0, TString clusterization="", TString tm="_TMDep", TString pid="_Neutral", TString titleMC="JJDecLow", TString mcLeg="MC: #gammaJ+JJ({p^{EMCal}_{T,#gamma}>3.5 GeV/#it{c})", TString titleData="LHC11cd_EMC7", TString daLeg="pp@7 TeV, LHC11c+d EMC7", Int_t firstP=0, Int_t lastP=9, TArrayD binE=0, Int_t firstMC=1, Bool_t plotRatio=kFALSE, Bool_t saveHisto=kFALSE, TString opt="", Bool_t debug=kFALSE)
bool Bool_t
Definition: External.C:53
TString prod[]
productions to be compared, directory name