AliPhysics  b752f14 (b752f14)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliAnaPi0.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  * *
4  * Author: The ALICE Off-line Project. *
5  * Contributors are mentioned in the code where appropriate. *
6  * *
7  * Permission to use, copy, modify and distribute this software and its *
8  * documentation strictly for non-commercial purposes is hereby granted *
9  * without fee, provided that the above copyright notice appears in all *
10  * copies and that both the copyright notice and this permission notice *
11  * appear in the supporting documentation. The authors make no claims *
12  * about the suitability of this software for any purpose. It is *
13  * provided "as is" without express or implied warranty. *
14  **************************************************************************/
15 
16 // --- ROOT system ---
17 #include "TH3.h"
18 #include "TH2F.h"
19 //#include "Riostream.h"
20 #include "TCanvas.h"
21 #include "TPad.h"
22 #include "TROOT.h"
23 #include "TClonesArray.h"
24 #include "TObjString.h"
25 #include "TDatabasePDG.h"
26 
27 //---- AliRoot system ----
28 #include "AliAnaPi0.h"
29 #include "AliCaloTrackReader.h"
30 #include "AliCaloPID.h"
31 #include "AliMCEvent.h"
32 #include "AliFiducialCut.h"
33 #include "AliVEvent.h"
34 #include "AliESDCaloCluster.h"
35 #include "AliESDEvent.h"
36 #include "AliAODEvent.h"
38 #include "AliMixedEvent.h"
39 #include "AliVParticle.h"
40 #include "AliMCEvent.h"
41 
42 // --- Detectors ---
43 #include "AliPHOSGeoUtils.h"
44 #include "AliEMCALGeometry.h"
45 
49 
50 //______________________________________________________
52 //______________________________________________________
54 fEventsList(0x0),
55 fUseAngleCut(kFALSE), fUseAngleEDepCut(kFALSE), fAngleCut(0), fAngleMaxCut(0.),
56 fMultiCutAna(kFALSE), fMultiCutAnaSim(kFALSE), fMultiCutAnaAcc(kFALSE),
57 fNPtCuts(0), fNAsymCuts(0), fNCellNCuts(0), fNPIDBits(0), fNAngleCutBins(0),
58 fMakeInvPtPlots(kFALSE), fSameSM(kFALSE),
59 fFillSMCombinations(kFALSE), fCheckConversion(kFALSE),
60 fFillBadDistHisto(kFALSE), fFillSSCombinations(kFALSE),
61 fFillAngleHisto(kFALSE), fFillAsymmetryHisto(kFALSE), fFillOriginHisto(0),
62 fFillArmenterosThetaStar(0), fFillOnlyMCAcceptanceHisto(0),
63 fFillSecondaryCellTiming(0), fFillOpAngleCutHisto(0), fCheckAccInSector(0),
64 fPairWithOtherDetector(0), fOtherDetectorInputName(""),
65 fPhotonMom1(), fPhotonMom1Boost(), fPhotonMom2(), fMCPrimMesonMom(),
66 fMCProdVertex(),
67 
68 // Histograms
69 fhReMod(0x0), fhReSameSideEMCALMod(0x0), fhReSameSectorEMCALMod(0x0), fhReDiffPHOSMod(0x0),
70 fhReSameSectorDCALPHOSMod(0),fhReDiffSectorDCALPHOSMod(0),
71 fhMiMod(0x0), fhMiSameSideEMCALMod(0x0), fhMiSameSectorEMCALMod(0x0), fhMiDiffPHOSMod(0x0),
72 fhMiSameSectorDCALPHOSMod(0),fhMiDiffSectorDCALPHOSMod(0),
73 fhReConv(0x0), fhMiConv(0x0), fhReConv2(0x0), fhMiConv2(0x0),
74 fhRe1(0x0), fhMi1(0x0), fhRe2(0x0), fhMi2(0x0),
75 fhRe3(0x0), fhMi3(0x0), fhReInvPt1(0x0), fhMiInvPt1(0x0),
76 fhReInvPt2(0x0), fhMiInvPt2(0x0), fhReInvPt3(0x0), fhMiInvPt3(0x0),
77 fhRePtNCellAsymCuts(0x0), fhMiPtNCellAsymCuts(0x0), fhRePtNCellAsymCutsSM(),
78 fhRePtNCellAsymCutsOpAngle(0x0), fhMiPtNCellAsymCutsOpAngle(0x0),
79 fhRePtAsym(0x0), fhRePtAsymPi0(0x0), fhRePtAsymEta(0x0),
80 fhMiPtAsym(0x0), fhMiPtAsymPi0(0x0), fhMiPtAsymEta(0x0),
81 fhEventBin(0), fhEventMixBin(0),
82 fhCentrality(0x0), fhCentralityNoPair(0x0),
83 fhEventPlaneResolution(0x0),
84 fhRealOpeningAngle(0x0), fhRealCosOpeningAngle(0x0), fhMixedOpeningAngle(0x0), fhMixedCosOpeningAngle(0x0),
85 // MC histograms
86 fhPrimPi0E(0x0), fhPrimPi0Pt(0x0), fhPrimPi0PtInCalo(0x0),
87 fhPrimPi0AccE(0x0), fhPrimPi0AccPt(0x0), fhPrimPi0AccPtPhotonCuts(0x0),
88 fhPrimPi0Y(0x0), fhPrimPi0AccY(0x0),
89 fhPrimPi0Yeta(0x0), fhPrimPi0YetaYcut(0x0), fhPrimPi0AccYeta(0x0),
90 fhPrimPi0Phi(0x0), fhPrimPi0AccPhi(0x0),
91 fhPrimPi0OpeningAngle(0x0), fhPrimPi0OpeningAnglePhotonCuts(0x0),
92 fhPrimPi0OpeningAngleAsym(0x0),fhPrimPi0CosOpeningAngle(0x0),
93 fhPrimPi0PtCentrality(0), fhPrimPi0PtEventPlane(0),
94 fhPrimPi0AccPtCentrality(0), fhPrimPi0AccPtEventPlane(0),
95 fhPrimEtaE(0x0), fhPrimEtaPt(0x0), fhPrimEtaPtInCalo(0x0),
96 fhPrimEtaAccE(0x0), fhPrimEtaAccPt(0x0), fhPrimEtaAccPtPhotonCuts(0x0),
97 fhPrimEtaY(0x0), fhPrimEtaAccY(0x0),
98 fhPrimEtaYeta(0x0), fhPrimEtaYetaYcut(0x0), fhPrimEtaAccYeta(0x0),
99 fhPrimEtaPhi(0x0), fhPrimEtaAccPhi(0x0),
100 fhPrimEtaOpeningAngle(0x0), fhPrimEtaOpeningAnglePhotonCuts(0x0),
101 fhPrimEtaOpeningAngleAsym(0x0),fhPrimEtaCosOpeningAngle(0x0),
102 fhPrimEtaPtCentrality(0), fhPrimEtaPtEventPlane(0),
103 fhPrimEtaAccPtCentrality(0), fhPrimEtaAccPtEventPlane(0),
104 fhPrimPi0PtOrigin(0x0), fhPrimEtaPtOrigin(0x0),
105 fhPrimNotResonancePi0PtOrigin(0x0), fhPrimPi0PtStatus(0x0),
106 fhMCPi0MassPtRec(0x0), fhMCPi0MassPtTrue(0x0),
107 fhMCPi0PtTruePtRec(0x0), fhMCPi0PtTruePtRecMassCut(0x0),
108 fhMCEtaMassPtRec(0x0), fhMCEtaMassPtTrue(0x0),
109 fhMCEtaPtTruePtRec(0x0), fhMCEtaPtTruePtRecMassCut(0x0),
110 fhMCPi0PerCentrality(0), fhMCPi0PerCentralityMassCut(0),
111 fhMCEtaPerCentrality(0), fhMCEtaPerCentralityMassCut(0),
112 fhMCPi0PtTruePtRecRat(0), fhMCPi0PtTruePtRecDif(0), fhMCPi0PtRecOpenAngle(0),
113 fhMCEtaPtTruePtRecRat(0), fhMCEtaPtTruePtRecDif(0), fhMCEtaPtRecOpenAngle(0),
114 fhMCPi0PtTruePtRecRatMassCut(0), fhMCPi0PtTruePtRecDifMassCut(0), fhMCPi0PtRecOpenAngleMassCut(0),
115 fhMCEtaPtTruePtRecRatMassCut(0), fhMCEtaPtTruePtRecDifMassCut(0), fhMCEtaPtRecOpenAngleMassCut(0),
116 fhMCPi0PtOrigin(0), fhMCEtaPtOrigin(0),
117 fhMCNotResonancePi0PtOrigin(0),fhMCPi0PtStatus(0x0),
118 fhMCPi0ProdVertex(0), fhMCEtaProdVertex(0),
119 fhPrimPi0ProdVertex(0), fhPrimEtaProdVertex(0),
120 fhReMCFromConversion(0), fhReMCFromNotConversion(0), fhReMCFromMixConversion(0),
121 fhCosThStarPrimPi0(0), fhCosThStarPrimEta(0),
122 fhEPairDiffTime(0),
123 fhReSecondaryCellInTimeWindow(0), fhMiSecondaryCellInTimeWindow(0),
124 fhReSecondaryCellOutTimeWindow(0), fhMiSecondaryCellOutTimeWindow(0)
125 
126 {
127  InitParameters();
128 
129  for(Int_t i = 0; i < 4; i++)
130  {
131  fhArmPrimEta[i] = 0;
132  fhArmPrimPi0[i] = 0;
133  }
134 
135  for(Int_t ism = 0; ism < 20; ism++)
136  {
137  fhRealOpeningAnglePerSM [ism] = 0;
138  fhMixedOpeningAnglePerSM[ism] = 0;
139  }
140 
141  for(Int_t icut = 0; icut < 10; icut++)
142  {
143  fhReOpAngleBinMinClusterEtaPhi [icut] = 0;
144  fhReOpAngleBinMaxClusterEtaPhi [icut] = 0;
145  fhReOpAngleBinMinClusterColRow [icut] = 0;
146  fhReOpAngleBinMaxClusterColRow [icut] = 0;
147  fhReOpAngleBinMinClusterEPerSM [icut] = 0;
148  fhReOpAngleBinMaxClusterEPerSM [icut] = 0;
154  fhReOpAngleBinPairClusterMass [icut] = 0;
156 // fhReOpAngleBinPairClusterAbsIdMaxCell[icut] = 0;
157 
160  fhPrimEtaAccPtOpAngCuts [icut] = 0;
161  fhPrimPi0AccPtOpAngCuts [icut] = 0;
162 
163  fhMiOpAngleBinMinClusterEtaPhi [icut] = 0;
164  fhMiOpAngleBinMaxClusterEtaPhi [icut] = 0;
165 // fhMiColRowClusterMinOpAngleBin [icut] = 0;
166 // fhMiOpAngleBinMaxClusterColRow [icut] = 0;
167  fhMiOpAngleBinMinClusterEPerSM [icut] = 0;
168  fhMiOpAngleBinMaxClusterEPerSM [icut] = 0;
174  fhMiOpAngleBinPairClusterMass [icut] = 0;
176 // fhMiOpAngleBinPairClusterAbsIdMaxCell[icut] = 0;
177 
178  fhPtBinClusterEtaPhi [icut] = 0;
179  fhPtBinClusterColRow [icut] = 0;
180  }
181 
182  fhReSS[0] = 0; fhReSS[1] = 0; fhReSS[2] = 0;
183 
184  for(Int_t igen = 0; igen < 10; igen++)
185  {
186  for(Int_t itag = 0; itag < 10; itag++)
187  {
188  fhPairGeneratorsBkgMass [igen][itag] = 0;
189  fhPairGeneratorsBkgMassMCPi0 [igen][itag] = 0;
190  fhPairGeneratorsBkgCentMCPi0 [igen][itag] = 0;
191  fhPairGeneratorsBkgCentMCPi0MassCut [igen][itag] = 0;
193  fhPairGeneratorsBkgEPrimRecoDiffMCPi0 [igen][itag] = 0;
194  fhPairGeneratorsBkgMassMCEta [igen][itag] = 0;
195  fhPairGeneratorsBkgCentMCEta [igen][itag] = 0;
196  fhPairGeneratorsBkgCentMCEtaMassCut [igen][itag] = 0;
198  fhPairGeneratorsBkgEPrimRecoDiffMCEta [igen][itag] = 0;
203 
204  }
205 
206  fhPrimPi0PtPerGenerator [igen] = 0;
208  fhPrimPi0AccPtPerGenerator[igen] = 0;
210  fhPrimPi0PhiPerGenerator [igen] = 0;
211  fhPrimPi0YPerGenerator [igen] = 0;
212 
213  fhPrimEtaPtPerGenerator [igen] = 0;
215  fhPrimEtaAccPtPerGenerator[igen] = 0;
217  fhPrimEtaPhiPerGenerator [igen] = 0;
218  fhPrimEtaYPerGenerator [igen] = 0;
219  }
220 
221  for(Int_t i=0;i<10;i++){
222  fhMCPi0Radius [i] = 0;
223  }
224  for(Int_t i=0;i<6;i++){
225  fhMCEtaRadius [i] = 0;
226  }
227 
228 }
229 
230 //_____________________
232 //_____________________
234 {
235  // Remove event containers
236 
237  if(DoOwnMix() && fEventsList)
238  {
239  for(Int_t ic=0; ic<GetNCentrBin(); ic++)
240  {
241  for(Int_t iz=0; iz<GetNZvertBin(); iz++)
242  {
243  for(Int_t irp=0; irp<GetNRPBin(); irp++)
244  {
245  Int_t bin = GetEventMixBin(ic,iz,irp);
246  fEventsList[bin]->Delete() ;
247  delete fEventsList[bin] ;
248  }
249  }
250  }
251  delete[] fEventsList;
252  }
253 }
254 
255 //______________________________
258 //______________________________
260 {
261  SetInputAODName("PWG4Particle");
262 
263  AddToHistogramsName("AnaPi0_");
264 
265  fUseAngleEDepCut = kFALSE;
266 
267  fUseAngleCut = kTRUE;
268  fAngleCut = 0.;
269  fAngleMaxCut = DegToRad(80.); // 80 degrees cut, avoid EMCal/DCal combinations
270 
271  fMultiCutAna = kFALSE;
272  fMultiCutAnaAcc = kFALSE;
273  fMultiCutAnaSim = kFALSE;
274 
275  fNPtCuts = 3;
276  fPtCuts[0] = 0.; fPtCuts[1] = 0.3; fPtCuts[2] = 0.5;
277  for(Int_t i = fNPtCuts; i < 10; i++) fPtCuts[i] = 0.;
278  for(Int_t i = 0 ; i < 10; i++) fPtCutsMax[i] = 20.;
279 
280  fNAsymCuts = 2;
281  fAsymCuts[0] = 1.; fAsymCuts[1] = 0.7; //fAsymCuts[2] = 0.6; // fAsymCuts[3] = 0.1;
282  for(Int_t i = fNAsymCuts; i < 10; i++)fAsymCuts[i] = 0.;
283 
284  fNCellNCuts = 3;
285  fCellNCuts[0] = 0; fCellNCuts[1] = 1; fCellNCuts[2] = 2;
286  for(Int_t i = fNCellNCuts; i < 10; i++)fCellNCuts[i] = 0;
287 
288  fNPIDBits = 2;
289  fPIDBits[0] = 0; fPIDBits[1] = 2; // fPIDBits[2] = 4; fPIDBits[3] = 6;// check, no cut, dispersion, neutral, dispersion&&neutral
290  for(Int_t i = fNPIDBits; i < 10; i++)fPIDBits[i] = 0;
291 
292 // fNAngleCutBins = 7;
293 // fAngleCutBinsArray[0] = 0.014; fAngleCutBinsArray[1] = 0.035; fAngleCutBinsArray[2] = 0.07; fAngleCutBinsArray[3] = 0.5;
294 // fAngleCutBinsArray[4] = 0.95 ; fAngleCutBinsArray[5] = 1.03 ; fAngleCutBinsArray[6] = 1.1 ; fAngleCutBinsArray[7] = 1.4 ;
295 // for(Int_t i = fNAngleCutBins+1; i < 11; i++)fAngleCutBinsArray[i] = 1000;
296  fNAngleCutBins = 10;
297  Float_t cellsize = 0.0143;
298  fAngleCutBinsArray[0] = 0; fAngleCutBinsArray[1] = 1*cellsize; fAngleCutBinsArray[2] = 0.02; // 1.5*cellsize
299  fAngleCutBinsArray[3] = 2*cellsize; fAngleCutBinsArray[4] = 3*cellsize; fAngleCutBinsArray[5] = 6*cellsize;
300  fAngleCutBinsArray[6] = 12*cellsize; fAngleCutBinsArray[7] = 24*cellsize; fAngleCutBinsArray[8] = 48*cellsize;
301  fAngleCutBinsArray[9] = 96*cellsize; fAngleCutBinsArray[10]= 128*cellsize;
302 
303  fPi0MassWindow[0] = 0.10; fPi0MassWindow[1] = 0.25;
304  fEtaMassWindow[0] = 0.45; fEtaMassWindow[1] = 0.65;
305 
306 }
307 
308 //_______________________________________
310 //_______________________________________
312 {
313  TString parList ; //this will be list of parameters used for this analysis.
314  const Int_t buffersize = 255;
315  char onePar[buffersize] ;
316  snprintf(onePar,buffersize,"--- AliAnaPi0 ---:") ;
317  parList+=onePar ;
318  snprintf(onePar,buffersize,"Number of bins in Centrality: %d;",GetNCentrBin()) ;
319  parList+=onePar ;
320  snprintf(onePar,buffersize,"Number of bins in Z vert. pos: %d;",GetNZvertBin()) ;
321  parList+=onePar ;
322  snprintf(onePar,buffersize,"Number of bins in Reac. Plain: %d;",GetNRPBin()) ;
323  parList+=onePar ;
324  snprintf(onePar,buffersize,"Depth of event buffer: %d;",GetNMaxEvMix()) ;
325  parList+=onePar ;
326  snprintf(onePar,buffersize,"Select pairs with their angle: %d, edep %d, min angle %2.3f, max angle %2.3f;",fUseAngleCut, fUseAngleEDepCut,fAngleCut,fAngleMaxCut) ;
327  parList+=onePar ;
328  snprintf(onePar,buffersize," Asymmetry cuts: n = %d, asymmetry < ",fNAsymCuts) ;
329  for(Int_t i = 0; i < fNAsymCuts; i++) snprintf(onePar,buffersize,"%s %2.2f;",onePar,fAsymCuts[i]);
330  parList+=onePar ;
331  snprintf(onePar,buffersize," PID selection bits: n = %d, PID bit =",fNPIDBits) ;
332  for(Int_t i = 0; i < fNPIDBits; i++) snprintf(onePar,buffersize,"%s %d;",onePar,fPIDBits[i]);
333  parList+=onePar ;
334  snprintf(onePar,buffersize,"Cuts:") ;
335  parList+=onePar ;
336  snprintf(onePar,buffersize,"Z vertex position: -%f < z < %f;",GetZvertexCut(),GetZvertexCut()) ;
337  parList+=onePar ;
338  snprintf(onePar,buffersize,"Calorimeter: %s;",GetCalorimeterString().Data()) ;
339  parList+=onePar ;
341  {
342  snprintf(onePar, buffersize," pT cuts: n = %d, pt > ",fNPtCuts) ;
343  for(Int_t i = 0; i < fNPtCuts; i++) snprintf(onePar,buffersize,"%s %2.2f;",onePar,fPtCuts[i]);
344  parList+=onePar ;
345  snprintf(onePar,buffersize, " N cell in cluster cuts: n = %d, nCell > ",fNCellNCuts) ;
346  for(Int_t i = 0; i < fNCellNCuts; i++) snprintf(onePar,buffersize,"%s %d;",onePar,fCellNCuts[i]);
347  parList+=onePar ;
348  }
349 
350  return new TObjString(parList) ;
351 }
352 
353 //_________________________________________
356 //_________________________________________
358 {
359  TList * outputContainer = new TList() ;
360  outputContainer->SetName(GetName());
361 
362  // Set sizes and ranges
363  const Int_t buffersize = 255;
364  char key[buffersize] ;
365  char title[buffersize] ;
366 
368  Int_t nphibins = GetHistogramRanges()->GetHistoPhiBins();
369  Int_t netabins = GetHistogramRanges()->GetHistoEtaBins();
376 
377  Int_t nmassbins = GetHistogramRanges()->GetHistoMassBins();
383 // Int_t ntrmbins = GetHistogramRanges()->GetHistoTrackMultiplicityBins();
384 // Int_t ntrmmax = GetHistogramRanges()->GetHistoTrackMultiplicityMax();
385 // Int_t ntrmmin = GetHistogramRanges()->GetHistoTrackMultiplicityMin();
389  Int_t ntimebins = GetHistogramRanges()->GetHistoTimeBins();
392 
396 
400 
404 
405  Int_t netabinsopen = TMath::Nint(netabins*4/(etamax-etamin));
406  Int_t nphibinsopen = TMath::Nint(nphibins*TMath::TwoPi()/(phimax-phimin));
407 
408  // Init the number of modules, set in the class AliCalorimeterUtils
409  //
410  InitCaloParameters(); // See AliCaloTrackCorrBaseClass
411 
412  //Int_t totalSM = fLastModule-fFirstModule+1;
413  //printf("N SM %d, first SM %d, last SM %d, total %d\n",fNModules,fFirstModule,fLastModule, totalSM);
414 
415  // Cell column-row histograms, see base class for data members setting
416  //fNMaxColsFull+2,-1.5,fNMaxColsFull+0.5, fNMaxRowsFull+2,-1.5,fNMaxRowsFull+0.5
417  Int_t ncolcell = fNMaxColsFull+2;
418  Float_t colcellmin = -1.5;
419  Float_t colcellmax = fNMaxColsFull+0.5;
420 
422  Float_t rowcellmin = fNMaxRowsFullMin-1.5;
423  Float_t rowcellmax = fNMaxRowsFullMax+0.5;
424 
425  // Start with pure MC kinematics histograms
426  // In case other tasks just need this info like AliAnaPi0EbE
427  if(IsDataMC())
428  {
429  // Pi0
430 
431  fhPrimPi0E = new TH1F("hPrimPi0E","Primary #pi^{0} E, |#it{Y}|<1",
432  nptbins,ptmin,ptmax) ;
433  fhPrimPi0E ->SetXTitle("#it{E} (GeV)");
434  outputContainer->Add(fhPrimPi0E) ;
435 
436  fhPrimPi0Pt = new TH1F("hPrimPi0Pt","Primary #pi^{0} #it{p}_{T} , |#it{Y}|<1",
437  nptbins,ptmin,ptmax) ;
438  fhPrimPi0Pt ->SetXTitle("#it{p}_{T} (GeV/#it{c})");
439  outputContainer->Add(fhPrimPi0Pt) ;
440 
441  fhPrimPi0Y = new TH2F("hPrimPi0Rapidity","Rapidity of primary #pi^{0}",
442  nptbins,ptmin,ptmax,netabinsopen,-2, 2) ;
443  fhPrimPi0Y ->SetYTitle("#it{Rapidity}");
444  fhPrimPi0Y ->SetXTitle("#it{p}_{T} (GeV/#it{c})");
445  outputContainer->Add(fhPrimPi0Y) ;
446 
447  fhPrimPi0Yeta = new TH2F("hPrimPi0PseudoRapidity","PseudoRapidity of primary #pi^{0}",
448  nptbins,ptmin,ptmax,netabinsopen,-2, 2) ;
449  fhPrimPi0Yeta ->SetYTitle("#eta");
450  fhPrimPi0Yeta ->SetXTitle("#it{p}_{T} (GeV/#it{c})");
451  outputContainer->Add(fhPrimPi0Yeta) ;
452 
453  fhPrimPi0YetaYcut = new TH2F("hPrimPi0PseudoRapidityYcut","PseudoRapidity of primary #pi^{0}, |#it{Y}|<1",
454  nptbins,ptmin,ptmax,netabinsopen,-2, 2) ;
455  fhPrimPi0YetaYcut ->SetYTitle("#eta");
456  fhPrimPi0YetaYcut ->SetXTitle("#it{p}_{T} (GeV/#it{c})");
457  outputContainer->Add(fhPrimPi0YetaYcut) ;
458 
459  fhPrimPi0Phi = new TH2F("hPrimPi0Phi","#varphi of primary #pi^{0}, |#it{Y}|<1",
460  nptbins,ptmin,ptmax,nphibinsopen,0,360) ;
461  fhPrimPi0Phi->SetYTitle("#varphi (deg)");
462  fhPrimPi0Phi->SetXTitle("#it{p}_{T} (GeV/#it{c})");
463  outputContainer->Add(fhPrimPi0Phi) ;
464 
466  {
467  fhPrimPi0PtInCalo = new TH1F("hPrimPi0PtInCalo","Primary #pi^{0} #it{p}_{T} , in calorimeter acceptance",
468  nptbins,ptmin,ptmax) ;
469  fhPrimPi0PtInCalo ->SetXTitle("#it{p}_{T} (GeV/#it{c})");
470  outputContainer->Add(fhPrimPi0PtInCalo) ;
471 
472  fhPrimPi0AccE = new TH1F("hPrimPi0AccE","Primary #pi^{0} #it{E} with both photons in acceptance",
473  nptbins,ptmin,ptmax) ;
474  fhPrimPi0AccE->SetXTitle("#it{E} (GeV)");
475  outputContainer->Add(fhPrimPi0AccE) ;
476 
477  fhPrimPi0AccPt = new TH1F("hPrimPi0AccPt","Primary #pi^{0} #it{p}_{T} with both photons in acceptance",
478  nptbins,ptmin,ptmax) ;
479  fhPrimPi0AccPt->SetXTitle("#it{p}_{T} (GeV/#it{c})");
480  outputContainer->Add(fhPrimPi0AccPt) ;
481 
482  fhPrimPi0AccPtPhotonCuts = new TH1F("hPrimPi0AccPtPhotonCuts","Primary #pi^{0} #it{p}_{T} with both photons in acceptance",
483  nptbins,ptmin,ptmax) ;
484  fhPrimPi0AccPtPhotonCuts->SetXTitle("#it{p}_{T} (GeV/#it{c})");
485  outputContainer->Add(fhPrimPi0AccPtPhotonCuts) ;
486 
487  fhPrimPi0AccY = new TH2F("hPrimPi0AccRapidity","Rapidity of primary #pi^{0} with accepted daughters",
488  nptbins,ptmin,ptmax,netabins,etamin,etamax) ;
489  fhPrimPi0AccY->SetYTitle("Rapidity");
490  fhPrimPi0AccY->SetXTitle("#it{p}_{T} (GeV/#it{c})");
491  outputContainer->Add(fhPrimPi0AccY) ;
492 
493  fhPrimPi0AccYeta = new TH2F("hPrimPi0AccPseudoRapidity","PseudoRapidity of primary #pi^{0} with accepted daughters",
494  nptbins,ptmin,ptmax,netabins,etamin,etamax) ;
495  fhPrimPi0AccYeta ->SetYTitle("#eta");
496  fhPrimPi0AccYeta ->SetXTitle("#it{p}_{T} (GeV/#it{c})");
497  outputContainer->Add(fhPrimPi0AccYeta) ;
498 
499  fhPrimPi0AccPhi = new TH2F("hPrimPi0AccPhi","#varphi of primary #pi^{0} with accepted daughters",
500  nptbins,ptmin,ptmax,
501  nphibins,phimin*TMath::RadToDeg(),phimax*TMath::RadToDeg()) ;
502  fhPrimPi0AccPhi->SetYTitle("#varphi (deg)");
503  fhPrimPi0AccPhi->SetXTitle("#it{p}_{T} (GeV/#it{c})");
504  outputContainer->Add(fhPrimPi0AccPhi) ;
505  }
506 
507  // Eta
508 
509  fhPrimEtaE = new TH1F("hPrimEtaE","Primary eta E",
510  nptbins,ptmin,ptmax) ;
511  fhPrimEtaE ->SetXTitle("#it{E} (GeV)");
512  outputContainer->Add(fhPrimEtaAccE) ;
513 
514  fhPrimEtaPt = new TH1F("hPrimEtaPt","Primary #eta #it{p}_{T}",
515  nptbins,ptmin,ptmax) ;
516  fhPrimEtaPt ->SetXTitle("#it{p}_{T} (GeV/#it{c})");
517  outputContainer->Add(fhPrimEtaPt) ;
518 
519  fhPrimEtaY = new TH2F("hPrimEtaRapidity","Rapidity of primary #eta",
520  nptbins,ptmin,ptmax,netabinsopen,-2, 2) ;
521  fhPrimEtaY->SetYTitle("#it{Rapidity}");
522  fhPrimEtaY->SetXTitle("#it{p}_{T} (GeV/#it{c})");
523  outputContainer->Add(fhPrimEtaY) ;
524 
525  fhPrimEtaYeta = new TH2F("hPrimEtaPseudoRapidityEta","PseudoRapidity of primary #eta",
526  nptbins,ptmin,ptmax,netabinsopen,-2, 2) ;
527  fhPrimEtaYeta->SetYTitle("#it{Rapidity}");
528  fhPrimEtaYeta->SetXTitle("#it{p}_{T} (GeV/#it{c})");
529  outputContainer->Add(fhPrimEtaYeta) ;
530 
531  fhPrimEtaYetaYcut = new TH2F("hPrimEtaPseudoRapidityEtaYcut","PseudoRapidity of primary #eta, |#it{Y}|<1",
532  nptbins,ptmin,ptmax,netabinsopen,-2, 2) ;
533  fhPrimEtaYetaYcut->SetYTitle("#it{Pseudorapidity}");
534  fhPrimEtaYetaYcut->SetXTitle("#it{p}_{T} (GeV/#it{c})");
535  outputContainer->Add(fhPrimEtaYetaYcut) ;
536 
537  fhPrimEtaPhi = new TH2F("hPrimEtaPhi","Azimuthal of primary #eta",
538  nptbins,ptmin,ptmax, nphibinsopen,0,360) ;
539  fhPrimEtaPhi->SetYTitle("#varphi (deg)");
540  fhPrimEtaPhi->SetXTitle("#it{p}_{T} (GeV/#it{c})");
541  outputContainer->Add(fhPrimEtaPhi) ;
542 
544  {
545  fhPrimEtaPtInCalo = new TH1F("hPrimEtaPtInCalo","Primary #eta #it{p}_{T}, in calorimeter acceptance",
546  nptbins,ptmin,ptmax) ;
547  fhPrimEtaPtInCalo ->SetXTitle("#it{p}_{T} (GeV/#it{c})");
548  outputContainer->Add(fhPrimEtaPtInCalo) ;
549 
550  fhPrimEtaAccE = new TH1F("hPrimEtaAccE","Primary #eta #it{E} with both photons in acceptance",
551  nptbins,ptmin,ptmax) ;
552  fhPrimEtaAccE->SetXTitle("#it{E} (GeV)");
553  outputContainer->Add(fhPrimEtaE) ;
554 
555  fhPrimEtaAccPt = new TH1F("hPrimEtaAccPt","Primary eta #it{p}_{T} with both photons in acceptance",
556  nptbins,ptmin,ptmax) ;
557  fhPrimEtaAccPt->SetXTitle("#it{p}_{T} (GeV/#it{c})");
558  outputContainer->Add(fhPrimEtaAccPt) ;
559 
560  fhPrimEtaAccPtPhotonCuts = new TH1F("hPrimEtaAccPtPhotonCuts","Primary eta #it{p}_{T} with both photons in acceptance",
561  nptbins,ptmin,ptmax) ;
562  fhPrimEtaAccPtPhotonCuts->SetXTitle("#it{p}_{T} (GeV/#it{c})");
563  outputContainer->Add(fhPrimEtaAccPtPhotonCuts) ;
564 
565  fhPrimEtaAccPhi = new TH2F("hPrimEtaAccPhi","Azimuthal of primary #eta with accepted daughters",
566  nptbins,ptmin,ptmax, nphibins,phimin*TMath::RadToDeg(),phimax*TMath::RadToDeg()) ;
567  fhPrimEtaAccPhi->SetYTitle("#varphi (deg)");
568  fhPrimEtaAccPhi->SetXTitle("#it{p}_{T} (GeV/#it{c})");
569  outputContainer->Add(fhPrimEtaAccPhi) ;
570 
571  fhPrimEtaAccY = new TH2F("hPrimEtaAccRapidity","Rapidity of primary #eta",
572  nptbins,ptmin,ptmax, netabins,etamin,etamax) ;
573  fhPrimEtaAccY->SetYTitle("#it{Rapidity}");
574  fhPrimEtaAccY->SetXTitle("#it{p}_{T} (GeV/#it{c})");
575  outputContainer->Add(fhPrimEtaAccY) ;
576 
577  fhPrimEtaAccYeta = new TH2F("hPrimEtaAccPseudoRapidity","PseudoRapidity of primary #eta",
578  nptbins,ptmin,ptmax, netabins,etamin,etamax) ;
579  fhPrimEtaAccYeta->SetYTitle("#it{Pseudorapidity}");
580  fhPrimEtaAccYeta->SetXTitle("#it{p}_{T} (GeV/#it{c})");
581  outputContainer->Add(fhPrimEtaAccYeta) ;
582  }
583 
584  // Create histograms only for PbPb or high multiplicity analysis analysis
586  {
587  fhPrimPi0PtCentrality = new TH2F("hPrimPi0PtCentrality","Primary #pi^{0} #it{p}_{T} vs reco centrality, |#it{Y}|<1",
588  nptbins,ptmin,ptmax, 100, 0, 100) ;
589  fhPrimPi0PtCentrality ->SetXTitle("#it{p}_{T} (GeV/#it{c})");
590  fhPrimPi0PtCentrality ->SetYTitle("Centrality");
591  outputContainer->Add(fhPrimPi0PtCentrality) ;
592 
593  fhPrimEtaPtCentrality = new TH2F("hPrimEtaPtCentrality","Primary #eta #it{p}_{T} vs reco centrality, |#it{Y}|<1",
594  nptbins,ptmin,ptmax, 100, 0, 100) ;
595  fhPrimEtaPtCentrality ->SetXTitle("#it{p}_{T} (GeV/#it{c})");
596  fhPrimEtaPtCentrality ->SetYTitle("Centrality");
597  outputContainer->Add(fhPrimEtaPtCentrality) ;
598 
599 
600  fhPrimPi0PtEventPlane = new TH2F("hPrimPi0PtEventPlane","Primary #pi^{0} #it{p}_{T} vs reco event plane angle, |#it{Y}|<1",
601  nptbins,ptmin,ptmax, 100, 0, TMath::Pi()) ;
602  fhPrimPi0PtEventPlane ->SetXTitle("#it{p}_{T} (GeV/#it{c})");
603  fhPrimPi0PtEventPlane ->SetYTitle("Event Plane Angle (rad)");
604  outputContainer->Add(fhPrimPi0PtEventPlane) ;
605 
606 
607  fhPrimEtaPtEventPlane = new TH2F("hPrimEtaPtEventPlane","Primary #eta #it{p}_{T} vs reco event plane angle, |#it{Y}|<1",
608  nptbins,ptmin,ptmax, 100, 0, TMath::Pi()) ;
609  fhPrimEtaPtEventPlane ->SetXTitle("#it{p}_{T} (GeV/#it{c})");
610  fhPrimEtaPtEventPlane ->SetYTitle("Event Plane Angle (rad)");
611  outputContainer->Add(fhPrimEtaPtEventPlane) ;
612 
614  {
615  fhPrimPi0AccPtCentrality = new TH2F("hPrimPi0AccPtCentrality","Primary #pi^{0} with both photons in acceptance #it{p}_{T} vs reco centrality",
616  nptbins,ptmin,ptmax, 100, 0, 100) ;
617  fhPrimPi0AccPtCentrality->SetXTitle("#it{p}_{T} (GeV/#it{c})");
618  fhPrimPi0AccPtCentrality->SetYTitle("Centrality");
619  outputContainer->Add(fhPrimPi0AccPtCentrality) ;
620 
621  fhPrimEtaAccPtCentrality = new TH2F("hPrimEtaAccPtCentrality","Primary #eta with both photons in acceptance #it{p}_{T} vs reco centrality",
622  nptbins,ptmin,ptmax, 100, 0, 100) ;
623  fhPrimEtaAccPtCentrality->SetXTitle("#it{p}_{T} (GeV/#it{c})");
624  fhPrimEtaAccPtCentrality->SetYTitle("Centrality");
625  outputContainer->Add(fhPrimEtaAccPtCentrality) ;
626 
627  fhPrimPi0AccPtEventPlane = new TH2F("hPrimPi0AccPtEventPlane","Primary #pi^{0} with both photons in acceptance #it{p}_{T} vs reco event plane angle",
628  nptbins,ptmin,ptmax, 100, 0, TMath::Pi()) ;
629  fhPrimPi0AccPtEventPlane->SetXTitle("#it{p}_{T} (GeV/#it{c})");
630  fhPrimPi0AccPtEventPlane->SetYTitle("Event Plane Angle (rad)");
631  outputContainer->Add(fhPrimPi0AccPtEventPlane) ;
632 
633  fhPrimEtaAccPtEventPlane = new TH2F("hPrimEtaAccPtEventPlane","Primary #eta with both #gamma_{decay} in acceptance #it{p}_{T} vs reco event plane angle",
634  nptbins,ptmin,ptmax, 100, 0, TMath::Pi()) ;
635  fhPrimEtaAccPtEventPlane->SetXTitle("#it{p}_{T} (GeV/#it{c})");
636  fhPrimEtaAccPtEventPlane->SetYTitle("Event Plane Angle (rad)");
637  outputContainer->Add(fhPrimEtaAccPtEventPlane) ;
638  }
639  }
640 
642  {
644  ("hPrimPi0OpeningAngle","Angle between all primary #gamma pair vs E_{#pi^{0}}, in acceptance",
645  nptbins,ptmin,ptmax,nopanbins,opanmin,opanmax);
646  fhPrimPi0OpeningAngle->SetYTitle("#theta(rad)");
647  fhPrimPi0OpeningAngle->SetXTitle("E_{ #pi^{0}} (GeV)");
648  outputContainer->Add(fhPrimPi0OpeningAngle) ;
649 
651  ("hPrimPi0OpeningAnglePhotonCuts","Angle between all primary #gamma pair vs E_{#pi^{0}} in acceptance",
652  nptbins,ptmin,ptmax,nopanbins,opanmin,opanmax);
653  fhPrimPi0OpeningAnglePhotonCuts->SetYTitle("#theta(rad)");
654  fhPrimPi0OpeningAnglePhotonCuts->SetXTitle("E_{ #pi^{0}} (GeV)");
655  outputContainer->Add(fhPrimPi0OpeningAnglePhotonCuts) ;
656 
658  ("hPrimPi0OpeningAngleAsym","Angle between all primary #gamma pair vs #it{Asymmetry}, in acceptance, #it{p}_{T}>5 GeV/#it{c}",
659  100,0,1,nopanbins,opanmin,opanmax);
660  fhPrimPi0OpeningAngleAsym->SetXTitle("|A|=| (E_{1}-E_{2}) / (E_{1}+E_{2}) |");
661  fhPrimPi0OpeningAngleAsym->SetYTitle("#theta(rad)");
662  outputContainer->Add(fhPrimPi0OpeningAngleAsym) ;
663 
665  ("hPrimPi0CosOpeningAngle","Cosinus of angle between all primary #gamma pair vs E_{#pi^{0}}, in acceptance",
666  nptbins,ptmin,ptmax,100,-1,1);
667  fhPrimPi0CosOpeningAngle->SetYTitle("cos (#theta) ");
668  fhPrimPi0CosOpeningAngle->SetXTitle("E_{ #pi^{0}} (GeV)");
669  outputContainer->Add(fhPrimPi0CosOpeningAngle) ;
670 
672  ("hPrimEtaOpeningAngle","Angle between all primary #gamma pair vs E_{#eta}, in acceptance",
673  nptbins,ptmin,ptmax,nopanbins,opanmin,opanmax);
674  fhPrimEtaOpeningAngle->SetYTitle("#theta(rad)");
675  fhPrimEtaOpeningAngle->SetXTitle("E_{#eta} (GeV)");
676  outputContainer->Add(fhPrimEtaOpeningAngle) ;
677 
679  ("hPrimEtaOpeningAnglePhotonCuts","Angle between all primary #gamma pair vs E_{#eta}, in acceptance",
680  nptbins,ptmin,ptmax,nopanbins,opanmin,opanmax);
681  fhPrimEtaOpeningAnglePhotonCuts->SetYTitle("#theta(rad)");
682  fhPrimEtaOpeningAnglePhotonCuts->SetXTitle("E_{#eta} (GeV)");
683  outputContainer->Add(fhPrimEtaOpeningAnglePhotonCuts) ;
684 
686  ("hPrimEtaOpeningAngleAsym","Angle between all primary #gamma pair vs #it{Asymmetry}, #it{p}_{T}>5 GeV/#it{c}, in acceptance",
687  100,0,1,nopanbins,opanmin,opanmax);
688  fhPrimEtaOpeningAngleAsym->SetXTitle("|#it{A}|=| (#it{E}_{1}-#it{E}_{2}) / (#it{E}_{1}+#it{E}_{2}) |");
689  fhPrimEtaOpeningAngleAsym->SetYTitle("#theta(rad)");
690  outputContainer->Add(fhPrimEtaOpeningAngleAsym) ;
691 
693  ("hPrimEtaCosOpeningAngle","Cosinus of angle between all primary #gamma pair vs E_{#eta}, in acceptance",
694  nptbins,ptmin,ptmax,100,-1,1);
695  fhPrimEtaCosOpeningAngle->SetYTitle("cos (#theta) ");
696  fhPrimEtaCosOpeningAngle->SetXTitle("#it{E}_{ #eta} (GeV)");
697  outputContainer->Add(fhPrimEtaCosOpeningAngle) ;
698  }
699 
700  // Primary origin
701  if(fFillOriginHisto)
702  {
703  // Pi0
704  fhPrimPi0PtOrigin = new TH2F("hPrimPi0PtOrigin","Primary #pi^{0} #it{p}_{T} vs origin",nptbins,ptmin,ptmax,11,0,11) ;
705  fhPrimPi0PtOrigin->SetXTitle("#it{p}_{T} (GeV/#it{c})");
706  fhPrimPi0PtOrigin->SetYTitle("Origin");
707  fhPrimPi0PtOrigin->GetYaxis()->SetBinLabel(1 ,"Status 21");
708  fhPrimPi0PtOrigin->GetYaxis()->SetBinLabel(2 ,"Quark");
709  fhPrimPi0PtOrigin->GetYaxis()->SetBinLabel(3 ,"qq Resonances ");
710  fhPrimPi0PtOrigin->GetYaxis()->SetBinLabel(4 ,"Resonances");
711  fhPrimPi0PtOrigin->GetYaxis()->SetBinLabel(5 ,"#rho");
712  fhPrimPi0PtOrigin->GetYaxis()->SetBinLabel(6 ,"#omega");
713  fhPrimPi0PtOrigin->GetYaxis()->SetBinLabel(7 ,"K");
714  fhPrimPi0PtOrigin->GetYaxis()->SetBinLabel(8 ,"Other");
715  fhPrimPi0PtOrigin->GetYaxis()->SetBinLabel(9 ,"#eta");
716  fhPrimPi0PtOrigin->GetYaxis()->SetBinLabel(10 ,"#eta prime");
717  outputContainer->Add(fhPrimPi0PtOrigin) ;
718 
719  fhPrimNotResonancePi0PtOrigin = new TH2F("hPrimNotResonancePi0PtOrigin","Primary #pi^{0} #it{p}_{T} vs origin",nptbins,ptmin,ptmax,11,0,11) ;
720  fhPrimNotResonancePi0PtOrigin->SetXTitle("#it{p}_{T} (GeV/#it{c})");
721  fhPrimNotResonancePi0PtOrigin->SetYTitle("Origin");
722  fhPrimNotResonancePi0PtOrigin->GetYaxis()->SetBinLabel(1 ,"Status 21");
723  fhPrimNotResonancePi0PtOrigin->GetYaxis()->SetBinLabel(2 ,"Quark");
724  fhPrimNotResonancePi0PtOrigin->GetYaxis()->SetBinLabel(3 ,"qq Resonances");
725  fhPrimNotResonancePi0PtOrigin->GetYaxis()->SetBinLabel(4 ,"Resonances");
726  fhPrimNotResonancePi0PtOrigin->GetYaxis()->SetBinLabel(5 ,"#rho");
727  fhPrimNotResonancePi0PtOrigin->GetYaxis()->SetBinLabel(6 ,"#omega");
728  fhPrimNotResonancePi0PtOrigin->GetYaxis()->SetBinLabel(7 ,"K");
729  fhPrimNotResonancePi0PtOrigin->GetYaxis()->SetBinLabel(8 ,"Other");
730  fhPrimNotResonancePi0PtOrigin->GetYaxis()->SetBinLabel(9 ,"#eta");
731  fhPrimNotResonancePi0PtOrigin->GetYaxis()->SetBinLabel(10 ,"#eta prime");
732  outputContainer->Add(fhPrimNotResonancePi0PtOrigin) ;
733 
734  fhPrimPi0PtStatus = new TH2F("hPrimPi0PtStatus","Primary #pi^{0} #it{p}_{T} vs status",nptbins,ptmin,ptmax,101,-50,50) ;
735  fhPrimPi0PtStatus->SetXTitle("#it{p}_{T} (GeV/#it{c})");
736  fhPrimPi0PtStatus->SetYTitle("Status");
737  outputContainer->Add(fhPrimPi0PtStatus) ;
738 
739  // Eta
740  fhPrimEtaPtOrigin = new TH2F("hPrimEtaPtOrigin","Primary #pi^{0} #it{p}_{T} vs origin",nptbins,ptmin,ptmax,7,0,7) ;
741  fhPrimEtaPtOrigin->SetXTitle("#it{p}_{T} (GeV/#it{c})");
742  fhPrimEtaPtOrigin->SetYTitle("Origin");
743  fhPrimEtaPtOrigin->GetYaxis()->SetBinLabel(1 ,"Status 21");
744  fhPrimEtaPtOrigin->GetYaxis()->SetBinLabel(2 ,"Quark");
745  fhPrimEtaPtOrigin->GetYaxis()->SetBinLabel(3 ,"qq Resonances");
746  fhPrimEtaPtOrigin->GetYaxis()->SetBinLabel(4 ,"Resonances");
747  fhPrimEtaPtOrigin->GetYaxis()->SetBinLabel(5 ,"Other");
748  fhPrimEtaPtOrigin->GetYaxis()->SetBinLabel(6 ,"#eta prime ");
749  outputContainer->Add(fhPrimEtaPtOrigin) ;
750 
751  // Production vertex
752  fhPrimPi0ProdVertex = new TH2F("hPrimPi0ProdVertex","generated #pi^{0} #it{p}_{T} vs production vertex",
753  200,0.,20.,5000,0,500) ;
754  fhPrimPi0ProdVertex->SetXTitle("#it{p}_{T} (GeV/#it{c})");
755  fhPrimPi0ProdVertex->SetYTitle("#it{R} (cm)");
756  outputContainer->Add(fhPrimPi0ProdVertex) ;
757 
758  fhPrimEtaProdVertex = new TH2F("hPrimEtaProdVertex","generated #eta #it{p}_{T} vs production vertex",
759  200,0.,20.,5000,0,500) ;
760  fhPrimEtaProdVertex->SetXTitle("#it{p}_{T} (GeV/#it{c})");
761  fhPrimEtaProdVertex->SetYTitle("#it{R} (cm)");
762  outputContainer->Add(fhPrimEtaProdVertex) ;
763  }
764 
766  {
767  TString ebin[] = {"8 < E < 12 GeV","12 < E < 16 GeV", "16 < E < 20 GeV", "E > 20 GeV" };
768  Int_t narmbins = 400;
769  Float_t armmin = 0;
770  Float_t armmax = 0.4;
771 
772  for(Int_t i = 0; i < 4; i++)
773  {
774  fhArmPrimPi0[i] = new TH2F(Form("hArmenterosPrimPi0EBin%d",i),
775  Form("Armenteros of primary #pi^{0}, %s",ebin[i].Data()),
776  200, -1, 1, narmbins,armmin,armmax);
777  fhArmPrimPi0[i]->SetYTitle("#it{p}_{T}^{Arm}");
778  fhArmPrimPi0[i]->SetXTitle("#alpha^{Arm}");
779  outputContainer->Add(fhArmPrimPi0[i]) ;
780 
781  fhArmPrimEta[i] = new TH2F(Form("hArmenterosPrimEtaEBin%d",i),
782  Form("Armenteros of primary #eta, %s",ebin[i].Data()),
783  200, -1, 1, narmbins,armmin,armmax);
784  fhArmPrimEta[i]->SetYTitle("#it{p}_{T}^{Arm}");
785  fhArmPrimEta[i]->SetXTitle("#alpha^{Arm}");
786  outputContainer->Add(fhArmPrimEta[i]) ;
787  }
788 
789  // Same as asymmetry ...
791  ("hCosThStarPrimPi0","cos(#theta *) for primary #pi^{0}",nptbins,ptmin,ptmax,200,-1,1);
792  fhCosThStarPrimPi0->SetYTitle("cos(#theta *)");
793  fhCosThStarPrimPi0->SetXTitle("E_{ #pi^{0}} (GeV)");
794  outputContainer->Add(fhCosThStarPrimPi0) ;
795 
797  ("hCosThStarPrimEta","cos(#theta *) for primary #eta",nptbins,ptmin,ptmax,200,-1,1);
798  fhCosThStarPrimEta->SetYTitle("cos(#theta *)");
799  fhCosThStarPrimEta->SetXTitle("E_{ #eta} (GeV)");
800  outputContainer->Add(fhCosThStarPrimEta) ;
801  }
802 
803  if(fFillOnlyMCAcceptanceHisto) return outputContainer;
804  }
805 
806  //
807  // Create mixed event containers
808  //
810 
811  for(Int_t ic=0; ic<GetNCentrBin(); ic++)
812  {
813  for(Int_t iz=0; iz<GetNZvertBin(); iz++)
814  {
815  for(Int_t irp=0; irp<GetNRPBin(); irp++)
816  {
817  Int_t bin = GetEventMixBin(ic,iz,irp);
818  fEventsList[bin] = new TList() ;
819  fEventsList[bin]->SetOwner(kFALSE);
820  }
821  }
822  }
823 
826  if ( fFillBadDistHisto )
827  {
832  }
833 
834  if ( fMakeInvPtPlots )
835  {
838 
840  {
845  }
846  }
847 
848  for(Int_t ic=0; ic<GetNCentrBin(); ic++)
849  {
850  for(Int_t ipid=0; ipid<fNPIDBits; ipid++)
851  {
852  for(Int_t iasym=0; iasym<fNAsymCuts; iasym++)
853  {
854  Int_t index = ((ic*fNPIDBits)+ipid)*fNAsymCuts + iasym;
855  //printf("cen %d, pid %d, asy %d, Index %d\n",ic,ipid,iasym,index);
856  //Distance to bad module 1
857  snprintf(key, buffersize,"hRe_cen%d_pidbit%d_asy%d_dist1",ic,ipid,iasym) ;
858  snprintf(title, buffersize,"Real #it{M}_{#gamma#gamma} distr. for centrality=%d, PID bit=%d and asymmetry %1.2f, dist bad 1",
859  ic,fPIDBits[ipid], fAsymCuts[iasym]) ;
860  fhRe1[index] = new TH2F(key,title,nptbins,ptmin,ptmax,nmassbins,massmin,massmax) ;
861  fhRe1[index]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
862  fhRe1[index]->SetYTitle("#it{M}_{#gamma,#gamma} (GeV/#it{c}^{2})");
863  //printf("name: %s\n ",fhRe1[index]->GetName());
864  outputContainer->Add(fhRe1[index]) ;
865 
867  {
868  //Distance to bad module 2
869  snprintf(key, buffersize,"hRe_cen%d_pidbit%d_asy%d_dist2",ic,ipid,iasym) ;
870  snprintf(title, buffersize,"Real #it{M}_{#gamma#gamma} distr. for centrality=%d, PID bit=%d and asymmetry %1.2f, dist bad 2",
871  ic,fPIDBits[ipid], fAsymCuts[iasym]) ;
872  fhRe2[index] = new TH2F(key,title,nptbins,ptmin,ptmax,nmassbins,massmin,massmax) ;
873  fhRe2[index]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
874  fhRe2[index]->SetYTitle("#it{M}_{#gamma,#gamma} (GeV/#it{c}^{2})");
875  outputContainer->Add(fhRe2[index]) ;
876 
877  //Distance to bad module 3
878  snprintf(key, buffersize,"hRe_cen%d_pidbit%d_asy%d_dist3",ic,ipid,iasym) ;
879  snprintf(title, buffersize,"Real #it{M}_{#gamma#gamma} distr. for centrality=%d, PID bit=%d and asymmetry %1.2f, dist bad 3",
880  ic,fPIDBits[ipid], fAsymCuts[iasym]) ;
881  fhRe3[index] = new TH2F(key,title,nptbins,ptmin,ptmax,nmassbins,massmin,massmax) ;
882  fhRe3[index]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
883  fhRe3[index]->SetYTitle("#it{M}_{#gamma,#gamma} (GeV/#it{c}^{2})");
884  outputContainer->Add(fhRe3[index]) ;
885  }
886 
887  //Inverse pT
888  if(fMakeInvPtPlots)
889  {
890  //Distance to bad module 1
891  snprintf(key, buffersize,"hReInvPt_cen%d_pidbit%d_asy%d_dist1",ic,ipid,iasym) ;
892  snprintf(title, buffersize,"Real #it{M}_{#gamma#gamma} distr. for centrality=%d, PID bit=%d and asymmetry %1.2f, dist bad 1",
893  ic,fPIDBits[ipid], fAsymCuts[iasym]) ;
894  fhReInvPt1[index] = new TH2F(key,title,nptbins,ptmin,ptmax,nmassbins,massmin,massmax) ;
895  fhReInvPt1[index]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
896  fhReInvPt1[index]->SetYTitle("#it{M}_{#gamma,#gamma} (GeV/#it{c}^{2})");
897  outputContainer->Add(fhReInvPt1[index]) ;
898 
899  if(fFillBadDistHisto){
900  //Distance to bad module 2
901  snprintf(key, buffersize,"hReInvPt_cen%d_pidbit%d_asy%d_dist2",ic,ipid,iasym) ;
902  snprintf(title, buffersize,"Real #it{M}_{#gamma#gamma} distr. for centrality=%d, PID bit=%d and asymmetry %1.2f, dist bad 2",
903  ic,fPIDBits[ipid], fAsymCuts[iasym]) ;
904  fhReInvPt2[index] = new TH2F(key,title,nptbins,ptmin,ptmax,nmassbins,massmin,massmax) ;
905  fhReInvPt2[index]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
906  fhReInvPt2[index]->SetYTitle("#it{M}_{#gamma,#gamma} (GeV/#it{c}^{2})");
907  outputContainer->Add(fhReInvPt2[index]) ;
908 
909  //Distance to bad module 3
910  snprintf(key, buffersize,"hReInvPt_cen%d_pidbit%d_asy%d_dist3",ic,ipid,iasym) ;
911  snprintf(title, buffersize,"Real #it{M}_{#gamma#gamma} distr. for centrality=%d, PID bit=%d and asymmetry %1.2f, dist bad 3",
912  ic,fPIDBits[ipid], fAsymCuts[iasym]) ;
913  fhReInvPt3[index] = new TH2F(key,title,nptbins,ptmin,ptmax,nmassbins,massmin,massmax) ;
914  fhReInvPt3[index]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
915  fhReInvPt3[index]->SetYTitle("#it{M}_{#gamma,#gamma} (GeV/#it{c}^{2})");
916  outputContainer->Add(fhReInvPt3[index]) ;
917  }
918  }
919 
920  if(DoOwnMix())
921  {
922  //Distance to bad module 1
923  snprintf(key, buffersize,"hMi_cen%d_pidbit%d_asy%d_dist1",ic,ipid,iasym) ;
924  snprintf(title, buffersize,"Mixed #it{M}_{#gamma#gamma} distr. for centrality=%d, PID bit=%d and asymmetry %1.2f, dist bad 1",
925  ic,fPIDBits[ipid], fAsymCuts[iasym]) ;
926  fhMi1[index] = new TH2F(key,title,nptbins,ptmin,ptmax,nmassbins,massmin,massmax) ;
927  fhMi1[index]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
928  fhMi1[index]->SetYTitle("#it{M}_{#gamma,#gamma} (GeV/#it{c}^{2})");
929  outputContainer->Add(fhMi1[index]) ;
930  if(fFillBadDistHisto){
931  //Distance to bad module 2
932  snprintf(key, buffersize,"hMi_cen%d_pidbit%d_asy%d_dist2",ic,ipid,iasym) ;
933  snprintf(title, buffersize,"Mixed #it{M}_{#gamma#gamma} distr. for centrality=%d, PID bit=%d and asymmetry %1.2f, dist bad 2",
934  ic,fPIDBits[ipid], fAsymCuts[iasym]) ;
935  fhMi2[index] = new TH2F(key,title,nptbins,ptmin,ptmax,nmassbins,massmin,massmax) ;
936  fhMi2[index]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
937  fhMi2[index]->SetYTitle("#it{M}_{#gamma,#gamma} (GeV/#it{c}^{2})");
938  outputContainer->Add(fhMi2[index]) ;
939 
940  //Distance to bad module 3
941  snprintf(key, buffersize,"hMi_cen%d_pidbit%d_asy%d_dist3",ic,ipid,iasym) ;
942  snprintf(title, buffersize,"Mixed #it{M}_{#gamma#gamma} distr. for centrality=%d, PID bit=%d and asymmetry %1.2f, dist bad 3",
943  ic,fPIDBits[ipid], fAsymCuts[iasym]) ;
944  fhMi3[index] = new TH2F(key,title,nptbins,ptmin,ptmax,nmassbins,massmin,massmax) ;
945  fhMi3[index]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
946  fhMi3[index]->SetYTitle("#it{M}_{#gamma,#gamma} (GeV/#it{c}^{2})");
947  outputContainer->Add(fhMi3[index]) ;
948  }
949 
950  // Inverse pT
951  if(fMakeInvPtPlots)
952  {
953  // Distance to bad module 1
954  snprintf(key, buffersize,"hMiInvPt_cen%d_pidbit%d_asy%d_dist1",ic,ipid,iasym) ;
955  snprintf(title, buffersize,"Mixed #it{M}_{#gamma#gamma} distr. for centrality=%d, PID bit=%d and asymmetry %1.2f, dist bad 1",
956  ic,fPIDBits[ipid], fAsymCuts[iasym]) ;
957  fhMiInvPt1[index] = new TH2F(key,title,nptbins,ptmin,ptmax,nmassbins,massmin,massmax) ;
958  fhMiInvPt1[index]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
959  fhMiInvPt1[index]->SetYTitle("#it{M}_{#gamma,#gamma} (GeV/#it{c}^{2})");
960  outputContainer->Add(fhMiInvPt1[index]) ;
961  if(fFillBadDistHisto){
962  // Distance to bad module 2
963  snprintf(key, buffersize,"hMiInvPt_cen%d_pidbit%d_asy%d_dist2",ic,ipid,iasym) ;
964  snprintf(title, buffersize,"Mixed #it{M}_{#gamma#gamma} distr. for centrality=%d, PID bit=%d and asymmetry %1.2f, dist bad 2",
965  ic,fPIDBits[ipid], fAsymCuts[iasym]) ;
966  fhMiInvPt2[index] = new TH2F(key,title,nptbins,ptmin,ptmax,nmassbins,massmin,massmax) ;
967  fhMiInvPt2[index]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
968  fhMiInvPt2[index]->SetYTitle("#it{M}_{#gamma,#gamma} (GeV/#it{c}^{2})");
969  outputContainer->Add(fhMiInvPt2[index]) ;
970 
971  // Distance to bad module 3
972  snprintf(key, buffersize,"hMiInvPt_cen%d_pidbit%d_asy%d_dist3",ic,ipid,iasym) ;
973  snprintf(title, buffersize,"Mixed #it{M}_{#gamma#gamma} distr. for centrality=%d, PID bit=%d and asymmetry %1.2f,dist bad 3",
974  ic,fPIDBits[ipid], fAsymCuts[iasym]) ;
975  fhMiInvPt3[index] = new TH2F(key,title,nptbins,ptmin,ptmax,nmassbins,massmin,massmax) ;
976  fhMiInvPt3[index]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
977  fhMiInvPt3[index]->SetYTitle("#it{M}_{#gamma,#gamma} (GeV/#it{c}^{2})");
978  outputContainer->Add(fhMiInvPt3[index]) ;
979  }
980  }
981  }
982  }
983  }
984  }
985 
986  fhEPairDiffTime = new TH2F("hEPairDiffTime","cluster pair time difference vs #it{p}_{T}",nptbins,ptmin,ptmax, tdbins,tdmin,tdmax);
987  fhEPairDiffTime->SetXTitle("#it{p}_{T,pair} (GeV/#it{c})");
988  fhEPairDiffTime->SetYTitle("#Delta t (ns)");
989  outputContainer->Add(fhEPairDiffTime);
990 
992  {
993  fhReSecondaryCellInTimeWindow = new TH2F("hReSecondaryCellInTimeWindow","Real Pair, it{t}_{cell} < 50 ns, w_{cell} > 0",
994  nptbins,ptmin,ptmax,nmassbins,massmin,massmax) ;
995  fhReSecondaryCellInTimeWindow->SetXTitle("#it{p}_{T} (GeV/#it{c})");
996  fhReSecondaryCellInTimeWindow->SetYTitle("#it{M}_{#gamma,#gamma} (GeV/#it{c}^{2})");
997  outputContainer->Add(fhReSecondaryCellInTimeWindow) ;
998 
999  fhReSecondaryCellOutTimeWindow = new TH2F("hReSecondaryCellOutTimeWindow","Real Pair, it{t}_{cell} < 50 ns, w_{cell} > 0",
1000  nptbins,ptmin,ptmax,nmassbins,massmin,massmax) ;
1001  fhReSecondaryCellOutTimeWindow->SetXTitle("#it{p}_{T} (GeV/#it{c})");
1002  fhReSecondaryCellOutTimeWindow->SetYTitle("#it{M}_{#gamma,#gamma} (GeV/#it{c}^{2})");
1003  outputContainer->Add(fhReSecondaryCellOutTimeWindow) ;
1004 
1005  if ( DoOwnMix() )
1006  {
1007  fhMiSecondaryCellInTimeWindow = new TH2F("hMiSecondaryCellInTimeWindow","Real Pair, it{t}_{cell} < 50 ns, w_{cell} > 0",
1008  nptbins,ptmin,ptmax,nmassbins,massmin,massmax) ;
1009  fhMiSecondaryCellInTimeWindow->SetXTitle("#it{p}_{T} (GeV/#it{c})");
1010  fhMiSecondaryCellInTimeWindow->SetYTitle("#it{M}_{#gamma,#gamma} (GeV/#it{c}^{2})");
1011  outputContainer->Add(fhMiSecondaryCellInTimeWindow) ;
1012 
1013  fhMiSecondaryCellOutTimeWindow = new TH2F("hMiSecondaryCellOutTimeWindow","Real Pair, it{t}_{cell} < 50 ns, w_{cell} > 0",
1014  nptbins,ptmin,ptmax,nmassbins,massmin,massmax) ;
1015  fhMiSecondaryCellOutTimeWindow->SetXTitle("#it{p}_{T} (GeV/#it{c})");
1016  fhMiSecondaryCellOutTimeWindow->SetYTitle("#it{M}_{#gamma,#gamma} (GeV/#it{c}^{2})");
1017  outputContainer->Add(fhMiSecondaryCellOutTimeWindow) ;
1018 
1019  }
1020  }
1021 
1022  if ( fCheckConversion )
1023  {
1024  fhReConv = new TH2F("hReConv","Real Pair with one recombined conversion ",nptbins,ptmin,ptmax,nmassbins,massmin,massmax) ;
1025  fhReConv->SetXTitle("#it{p}_{T} (GeV/#it{c})");
1026  fhReConv->SetYTitle("#it{M}_{#gamma,#gamma} (GeV/#it{c}^{2})");
1027  outputContainer->Add(fhReConv) ;
1028 
1029  fhReConv2 = new TH2F("hReConv2","Real Pair with 2 recombined conversion ",nptbins,ptmin,ptmax,nmassbins,massmin,massmax) ;
1030  fhReConv2->SetXTitle("#it{p}_{T} (GeV/#it{c})");
1031  fhReConv2->SetYTitle("#it{M}_{#gamma,#gamma} (GeV/#it{c}^{2})");
1032  outputContainer->Add(fhReConv2) ;
1033 
1034  if ( DoOwnMix() )
1035  {
1036  fhMiConv = new TH2F("hMiConv","Mixed Pair with one recombined conversion ",nptbins,ptmin,ptmax,nmassbins,massmin,massmax) ;
1037  fhMiConv->SetXTitle("#it{p}_{T} (GeV/#it{c})");
1038  fhMiConv->SetYTitle("#it{M}_{#gamma,#gamma} (GeV/#it{c}^{2})");
1039  outputContainer->Add(fhMiConv) ;
1040 
1041  fhMiConv2 = new TH2F("hMiConv2","Mixed Pair with 2 recombined conversion ",nptbins,ptmin,ptmax,nmassbins,massmin,massmax) ;
1042  fhMiConv2->SetXTitle("#it{p}_{T} (GeV/#it{c})");
1043  fhMiConv2->SetYTitle("#it{M}_{#gamma,#gamma} (GeV/#it{c}^{2})");
1044  outputContainer->Add(fhMiConv2) ;
1045  }
1046  }
1047 
1048  if ( fFillAsymmetryHisto )
1049  {
1050  fhRePtAsym = new TH2F("hRePtAsym","#it{Asymmetry} vs #it{p}_{T}, for pairs",
1051  nptbins,ptmin,ptmax,nasymbins,asymmin,asymmax) ;
1052  fhRePtAsym->SetXTitle("#it{p}_{T} (GeV/#it{c})");
1053  fhRePtAsym->SetYTitle("#it{Asymmetry}");
1054  outputContainer->Add(fhRePtAsym);
1055 
1056  fhRePtAsymPi0 = new TH2F("hRePtAsymPi0",Form("#it{Asymmetry} vs #it{p}_{T}, for pairs %2.2f<M<%2.2f MeV/#it{c}^{2}",
1058  nptbins,ptmin,ptmax,nasymbins,asymmin,asymmax) ;
1059  fhRePtAsymPi0->SetXTitle("#it{p}_{T} (GeV/#it{c})");
1060  fhRePtAsymPi0->SetYTitle("Asymmetry");
1061  outputContainer->Add(fhRePtAsymPi0);
1062 
1063  fhRePtAsymEta = new TH2F("hRePtAsymEta",Form("#it{Asymmetry} vs #it{p}_{T}, for pairs %2.2f<M<%2.2f MeV/#it{c}^{2}",
1065  nptbins,ptmin,ptmax,nasymbins,asymmin,asymmax) ;
1066  fhRePtAsymEta->SetXTitle("#it{p}_{T} (GeV/#it{c})");
1067  fhRePtAsymEta->SetYTitle("#it{Asymmetry}");
1068  outputContainer->Add(fhRePtAsymEta);
1069 
1070  if(DoOwnMix())
1071  {
1072  fhMiPtAsym = new TH2F("hMiPtAsym","#it{Asymmetry} vs #it{p}_{T}, for mixed pairs",nptbins,ptmin,ptmax,nasymbins,asymmin,asymmax) ;
1073  fhMiPtAsym->SetXTitle("#it{p}_{T} (GeV/#it{c})");
1074  fhMiPtAsym->SetYTitle("#it{Asymmetry}");
1075  outputContainer->Add(fhMiPtAsym);
1076 
1077  fhMiPtAsymPi0 = new TH2F("hMiPtAsymPi0",Form("#it{Asymmetry} vs #it{p}_{T}, for mixed pairs %2.2f<M<%2.2f MeV/#it{c}^{2}",
1079  nptbins,ptmin,ptmax,nasymbins,asymmin,asymmax) ;
1080  fhMiPtAsymPi0->SetXTitle("#it{p}_{T} (GeV/#it{c})");
1081  fhMiPtAsymPi0->SetYTitle("Asymmetry");
1082  outputContainer->Add(fhMiPtAsymPi0);
1083 
1084  fhMiPtAsymEta = new TH2F("hMiPtAsymEta",
1085  Form("#it{Asymmetry} vs #it{p}_{T}, for mixed pairs %2.2f<M<%2.2f MeV/#it{c}^{2}",
1087  nptbins,ptmin,ptmax,nasymbins,asymmin,asymmax) ;
1088  fhMiPtAsymEta->SetXTitle("#it{p}_{T} (GeV/#it{c})");
1089  fhMiPtAsymEta->SetYTitle("#it{Asymmetry}");
1090  outputContainer->Add(fhMiPtAsymEta);
1091  }
1092  }
1093 
1094  if ( fMultiCutAnaAcc )
1095  {
1096  for(Int_t ipt=0; ipt<fNPtCuts; ipt++)
1097  {
1098  fhPtBinClusterEtaPhi[ipt] = new TH2F
1099  (Form("hPtBin%d_Cluster_EtaPhi",ipt),
1100  Form("#eta vs #varphi, %2.2f<#it{p}_{T}<%2.2f GeV/#it{c}",fPtCuts[ipt],fPtCuts[ipt+1]),
1101  netabins,etamin,etamax,nphibins,phimin,phimax);
1102  fhPtBinClusterEtaPhi[ipt]->SetYTitle("#varphi (rad)");
1103  fhPtBinClusterEtaPhi[ipt]->SetXTitle("#eta");
1104  outputContainer->Add(fhPtBinClusterEtaPhi[ipt]) ;
1105 
1106  fhPtBinClusterColRow[ipt] = new TH2F
1107  (Form("hPtBin%d_Cluster_ColRow",ipt),
1108  Form("column vs row, %2.2f<#it{p}_{T}<%2.2f GeV/#it{c}",fPtCuts[ipt],fPtCuts[ipt+1]),
1109  ncolcell,colcellmin,colcellmax,nrowcell,rowcellmin,rowcellmax);
1110  fhPtBinClusterColRow[ipt]->SetYTitle("row");
1111  fhPtBinClusterColRow[ipt]->SetXTitle("column");
1112  outputContainer->Add(fhPtBinClusterColRow[ipt]) ;
1113  }
1114  }
1115 
1116  if ( fMultiCutAna )
1117  {
1120 
1121  if(fFillAngleHisto)
1122  {
1125  }
1126 
1128  {
1129  for(Int_t iSM = 0; iSM < fNModules; iSM++)
1130  {
1131  if ( iSM < fFirstModule || iSM > fLastModule )
1132  {
1133  fhRePtNCellAsymCutsSM[iSM] = 0x0;
1134  if ( fFillAngleHisto )
1135  fhRePtNCellAsymCutsSMOpAngle[iSM] = 0x0;
1136  continue;
1137  }
1138 
1141  }
1142  }
1143 
1144  for(Int_t ipt=0; ipt<fNPtCuts; ipt++)
1145  {
1146  for(Int_t icell=0; icell<fNCellNCuts; icell++)
1147  {
1148  for(Int_t iasym=0; iasym<fNAsymCuts; iasym++)
1149  {
1150  snprintf(key, buffersize,"hRe_pt%d_cell%d_asym%d",ipt,icell,iasym) ;
1151  snprintf(title, buffersize,"Real #it{M}_{#gamma#gamma} distr. for %1.1f< #it{p}_{T} < %1.1f, ncell>%d and asym<%1.2f ",
1152  fPtCuts[ipt],fPtCutsMax[ipt],fCellNCuts[icell], fAsymCuts[iasym]) ;
1153 
1154  Int_t index = ((ipt*fNCellNCuts)+icell)*fNAsymCuts + iasym;
1155  //printf("ipt %d, icell %d, iassym %d, index %d\n",ipt, icell, iasym, index);
1156 
1157  fhRePtNCellAsymCuts[index] = new TH2F(key,title,nptbins,ptmin,ptmax,nmassbins,massmin,massmax) ;
1158  fhRePtNCellAsymCuts[index]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
1159  fhRePtNCellAsymCuts[index]->SetYTitle("#it{M}_{#gamma,#gamma} (GeV/#it{c}^{2})");
1160  outputContainer->Add(fhRePtNCellAsymCuts[index]) ;
1161 
1162  if(DoOwnMix())
1163  {
1164  snprintf(key, buffersize,"hMi_pt%d_cell%d_asym%d",ipt,icell,iasym) ;
1165  snprintf(title, buffersize,"Mixed #it{M}_{#gamma#gamma} distr. for %1.1f< #it{p}_{T} < %1.1f, ncell>%d and asym<%1.2f",
1166  fPtCuts[ipt],fPtCutsMax[ipt],fCellNCuts[icell], fAsymCuts[iasym]) ;
1167  fhMiPtNCellAsymCuts[index] = new TH2F(key,title,nptbins,ptmin,ptmax,nmassbins,massmin,massmax) ;
1168  fhMiPtNCellAsymCuts[index]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
1169  fhMiPtNCellAsymCuts[index]->SetYTitle("#it{M}_{#gamma,#gamma} (GeV/#it{c}^{2})");
1170  outputContainer->Add(fhMiPtNCellAsymCuts[index]) ;
1171  }
1172 
1173  if ( fFillSMCombinations )
1174  {
1175  for(Int_t iSM = 0; iSM < fNModules; iSM++)
1176  {
1177  //printf("\t sm %d\n",iSM);
1178  if ( iSM < fFirstModule || iSM > fLastModule )
1179  {
1180  fhRePtNCellAsymCutsSM[iSM][index] = 0x0;
1181  continue;
1182  }
1183 
1184  snprintf(key, buffersize,"hRe_pt%d_cell%d_asym%d_SM%d",ipt,icell,iasym,iSM) ;
1185  snprintf(title, buffersize,"Real #it{M}_{#gamma#gamma} distr. for %1.1f< #it{p}_{T} < %1.1f, ncell>%d and asym<%1.2f, SM %d ",
1186  fPtCuts[ipt],fPtCutsMax[ipt],fCellNCuts[icell], fAsymCuts[iasym],iSM) ;
1187  fhRePtNCellAsymCutsSM[iSM][index] = new TH2F(key,title,nptbins,ptmin,ptmax,nmassbins,massmin,massmax) ;
1188  fhRePtNCellAsymCutsSM[iSM][index]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
1189  fhRePtNCellAsymCutsSM[iSM][index]->SetYTitle("#it{M}_{#gamma,#gamma} (GeV/#it{c}^{2})");
1190  outputContainer->Add(fhRePtNCellAsymCutsSM[iSM][index]) ;
1191  }
1192 
1193  if ( fFillAngleHisto )
1194  {
1195  snprintf(key, buffersize,"hReOpAngle_pt%d_cell%d_asym%d",ipt,icell,iasym) ;
1196  snprintf(title, buffersize,"Real #theta_{#gamma#gamma} distr. for %1.1f< #it{p}_{T} < %1.1f, ncell>%d and asym<%1.2f ",
1197  fPtCuts[ipt],fPtCutsMax[ipt],fCellNCuts[icell], fAsymCuts[iasym]) ;
1198 
1199  Int_t index = ((ipt*fNCellNCuts)+icell)*fNAsymCuts + iasym;
1200  //printf("Angle ipt %d, icell %d, iassym %d, index %d, %s, %s\n",ipt, icell, iasym, index, key, title);
1201 
1202  fhRePtNCellAsymCutsOpAngle[index] = new TH2F(key,title,nptbins,ptmin,ptmax,280,0,1.4) ;
1203  fhRePtNCellAsymCutsOpAngle[index]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
1204  fhRePtNCellAsymCutsOpAngle[index]->SetYTitle("#theta_{#gamma,#gamma} (rad)");
1205  outputContainer->Add(fhRePtNCellAsymCutsOpAngle[index]) ;
1206 
1207  if ( DoOwnMix() )
1208  {
1209  snprintf(key, buffersize,"hMiOpAngle_pt%d_cell%d_asym%d",ipt,icell,iasym) ;
1210  snprintf(title, buffersize,"Mixed #theta_{#gamma#gamma} distr. for %1.1f< #it{p}_{T} < %1.1f, ncell>%d and asym<%1.2f",
1211  fPtCuts[ipt],fPtCutsMax[ipt],fCellNCuts[icell], fAsymCuts[iasym]) ;
1212  fhMiPtNCellAsymCutsOpAngle[index] = new TH2F(key,title,nptbins,ptmin,ptmax,280,0,1.4) ;
1213  fhMiPtNCellAsymCutsOpAngle[index]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
1214  fhMiPtNCellAsymCutsOpAngle[index]->SetYTitle("#theta_{#gamma,#gamma} (rad)");
1215  outputContainer->Add(fhMiPtNCellAsymCutsOpAngle[index]) ;
1216  }
1217 
1218  if ( fFillSMCombinations )
1219  {
1220  for(Int_t iSM = 0; iSM < fNModules; iSM++)
1221  {
1222  if ( iSM < fFirstModule || iSM > fLastModule )
1223  {
1224  fhRePtNCellAsymCutsSMOpAngle[iSM][index] = 0x0;
1225  continue;
1226  }
1227 
1228  snprintf(key, buffersize,"hReOpAngle_pt%d_cell%d_asym%d_SM%d",ipt,icell,iasym,iSM) ;
1229  snprintf(title, buffersize,"Real #it{M}_{#gamma#gamma} distr. for %1.1f< #it{p}_{T} < %1.1f, ncell>%d and asym<%1.2f, SM %d ",
1230  fPtCuts[ipt],fPtCutsMax[ipt],fCellNCuts[icell], fAsymCuts[iasym],iSM) ;
1231  fhRePtNCellAsymCutsSMOpAngle[iSM][index] = new TH2F(key,title,nptbins,ptmin,ptmax,280,0,1.4) ;
1232  fhRePtNCellAsymCutsSMOpAngle[iSM][index]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
1233  fhRePtNCellAsymCutsSMOpAngle[iSM][index]->SetYTitle("#theta_{#gamma,#gamma} (rad)");
1234  outputContainer->Add(fhRePtNCellAsymCutsSMOpAngle[iSM][index]) ;
1235  }
1236  }
1237  }
1238  }
1239  }
1240  }
1241  }
1242 
1243  } // multi cuts analysis
1244 
1245  if ( fFillSSCombinations )
1246  {
1247  fhReSS[0] = new TH2F("hRe_SS_Tight"," 0.01 < #lambda_{0}^{2} < 0.4",
1248  nptbins,ptmin,ptmax,nmassbins,massmin,massmax);
1249  fhReSS[0]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
1250  fhReSS[0]->SetYTitle("#it{M}_{#gamma,#gamma} (GeV/#it{c}^{2})");
1251  outputContainer->Add(fhReSS[0]) ;
1252 
1253 
1254  fhReSS[1] = new TH2F("hRe_SS_Loose"," #lambda_{0}^{2} > 0.4",
1255  nptbins,ptmin,ptmax,nmassbins,massmin,massmax);
1256  fhReSS[1]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
1257  fhReSS[1]->SetYTitle("#it{M}_{#gamma,#gamma} (GeV/#it{c}^{2})");
1258  outputContainer->Add(fhReSS[1]) ;
1259 
1260 
1261  fhReSS[2] = new TH2F("hRe_SS_Both"," cluster_{1} #lambda_{0}^{2} > 0.4; cluster_{2} 0.01 < #lambda_{0}^{2} < 0.4",
1262  nptbins,ptmin,ptmax,nmassbins,massmin,massmax);
1263  fhReSS[2]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
1264  fhReSS[2]->SetYTitle("#it{M}_{#gamma,#gamma} (GeV/#it{c}^{2})");
1265  outputContainer->Add(fhReSS[2]) ;
1266  }
1267 
1268  if ( DoOwnMix() )
1269  {
1270  fhEventBin=new TH1I("hEventBin","Number of real pairs per bin(cen,vz,rp)",
1273  fhEventBin->SetXTitle("bin");
1274  outputContainer->Add(fhEventBin) ;
1275 
1276 
1277  fhEventMixBin=new TH1I("hEventMixBin","Number of mixed pairs per bin(cen,vz,rp)",
1280  fhEventMixBin->SetXTitle("bin");
1281  outputContainer->Add(fhEventMixBin) ;
1282  }
1283 
1285  {
1286  fhCentrality=new TH1F("hCentralityBin","Number of events in centrality bin",GetNCentrBin(),0.,1.*GetNCentrBin()) ;
1287  fhCentrality->SetXTitle("Centrality bin");
1288  outputContainer->Add(fhCentrality) ;
1289 
1290  fhCentralityNoPair=new TH1F("hCentralityBinNoPair","Number of events in centrality bin, with no cluster pairs",GetNCentrBin(),0.,1.*GetNCentrBin()) ;
1291  fhCentralityNoPair->SetXTitle("Centrality bin");
1292  outputContainer->Add(fhCentralityNoPair) ;
1293 
1294  fhEventPlaneResolution=new TH2F("hEventPlaneResolution","Event plane resolution",GetNCentrBin(),0,GetNCentrBin(),100,0.,TMath::TwoPi()) ;
1295  fhEventPlaneResolution->SetYTitle("Resolution");
1296  fhEventPlaneResolution->SetXTitle("Centrality Bin");
1297  outputContainer->Add(fhEventPlaneResolution) ;
1298  }
1299 
1300  if ( fFillAngleHisto )
1301  {
1302  fhRealOpeningAngle = new TH2F
1303  ("hRealOpeningAngle","Angle between all #gamma pair vs E_{#pi^{0}}",nptbins,ptmin,ptmax,nopanbins,opanmin,opanmax);
1304  fhRealOpeningAngle->SetYTitle("#theta(rad)");
1305  fhRealOpeningAngle->SetXTitle("E_{ #pi^{0}} (GeV)");
1306  outputContainer->Add(fhRealOpeningAngle) ;
1307 
1309  ("hRealCosOpeningAngle","Cosinus of angle between all #gamma pair vs E_{#pi^{0}}",nptbins,ptmin,ptmax,100,0,1);
1310  fhRealCosOpeningAngle->SetYTitle("cos (#theta) ");
1311  fhRealCosOpeningAngle->SetXTitle("E_{ #pi^{0}} (GeV)");
1312  outputContainer->Add(fhRealCosOpeningAngle) ;
1313 
1314  if(DoOwnMix())
1315  {
1317  ("hMixedOpeningAngle","Angle between all #gamma pair vs E_{#pi^{0}}, Mixed pairs",nptbins,ptmin,ptmax,nopanbins,opanmin,opanmax);
1318  fhMixedOpeningAngle->SetYTitle("#theta(rad)");
1319  fhMixedOpeningAngle->SetXTitle("E_{ #pi^{0}} (GeV)");
1320  outputContainer->Add(fhMixedOpeningAngle) ;
1321 
1323  ("hMixedCosOpeningAngle","Cosinus of angle between all #gamma pair vs E_{#pi^{0}}, Mixed pairs",nptbins,ptmin,ptmax,100,0,1);
1324  fhMixedCosOpeningAngle->SetYTitle("cos (#theta) ");
1325  fhMixedCosOpeningAngle->SetXTitle("E_{ #pi^{0}} (GeV)");
1326  outputContainer->Add(fhMixedCosOpeningAngle) ;
1327  }
1328 
1330  {
1331  for(Int_t ism = 0; ism < 20; ism++)
1332  {
1333  fhRealOpeningAnglePerSM[ism] = new TH2F
1334  (Form("hRealOpeningAngleMod_%d",ism),
1335  Form("Angle between all #gamma pair vs E_{#pi^{0}}, SM %d",ism),
1336  nptbins,ptmin,ptmax,nopanbins,opanmin,opanmax);
1337  fhRealOpeningAnglePerSM[ism]->SetYTitle("#theta(rad)");
1338  fhRealOpeningAnglePerSM[ism]->SetXTitle("E_{ #pi^{0}} (GeV)");
1339  outputContainer->Add(fhRealOpeningAnglePerSM[ism]) ;
1340 
1341  if(DoOwnMix())
1342  {
1343  fhMixedOpeningAnglePerSM[ism] = new TH2F
1344  (Form("hMixedOpeningAngleMod_%d",ism),
1345  Form("Angle between all #gamma pair vs E_{#pi^{0}}, Mixed pairs, SM %d",ism),
1346  nptbins,ptmin,ptmax,nopanbins,opanmin,opanmax);
1347  fhMixedOpeningAnglePerSM[ism]->SetYTitle("#theta(rad)");
1348  fhMixedOpeningAnglePerSM[ism]->SetXTitle("E_{ #pi^{0}} (GeV)");
1349  outputContainer->Add(fhMixedOpeningAnglePerSM[ism]) ;
1350  }
1351  }
1352  }
1353  }
1354 
1355  // Histograms filled only if MC data is requested
1356  if ( IsDataMC() )
1357  {
1358  fhReMCFromConversion = new TH2F("hReMCFromConversion","Invariant mass of 2 clusters originated in conversions",
1359  nptbins,ptmin,ptmax,nmassbins,massmin,massmax);
1360  fhReMCFromConversion->SetXTitle("#it{p}_{T} (GeV/#it{c})");
1361  fhReMCFromConversion->SetYTitle("#it{M}_{#gamma,#gamma} (GeV/#it{c}^{2})");
1362  outputContainer->Add(fhReMCFromConversion) ;
1363 
1364  fhReMCFromNotConversion = new TH2F("hReMCNotFromConversion","Invariant mass of 2 clusters not originated in conversions",
1365  nptbins,ptmin,ptmax,nmassbins,massmin,massmax);
1366  fhReMCFromNotConversion->SetXTitle("#it{p}_{T} (GeV/#it{c})");
1367  fhReMCFromNotConversion->SetYTitle("#it{M}_{#gamma,#gamma} (GeV/#it{c}^{2})");
1368  outputContainer->Add(fhReMCFromNotConversion) ;
1369 
1370  fhReMCFromMixConversion = new TH2F("hReMCFromMixConversion","Invariant mass of 2 clusters one from conversion and the other not",
1371  nptbins,ptmin,ptmax,nmassbins,massmin,massmax);
1372  fhReMCFromMixConversion->SetXTitle("#it{p}_{T} (GeV/#it{c})");
1373  fhReMCFromMixConversion->SetYTitle("#it{M}_{#gamma,#gamma} (GeV/#it{c}^{2})");
1374  outputContainer->Add(fhReMCFromMixConversion) ;
1375 
1376  if(fFillOriginHisto)
1377  {
1378  fhMCPi0PtOrigin = new TH2F("hMCPi0PtOrigin","Reconstructed pair from generated #pi^{0} #it{p}_{T} vs origin",nptbins,ptmin,ptmax,11,0,11) ;
1379  fhMCPi0PtOrigin->SetXTitle("#it{p}_{T} (GeV/#it{c})");
1380  fhMCPi0PtOrigin->SetYTitle("Origin");
1381  fhMCPi0PtOrigin->GetYaxis()->SetBinLabel(1 ,"Status 21");
1382  fhMCPi0PtOrigin->GetYaxis()->SetBinLabel(2 ,"Quark");
1383  fhMCPi0PtOrigin->GetYaxis()->SetBinLabel(3 ,"qq Resonances");
1384  fhMCPi0PtOrigin->GetYaxis()->SetBinLabel(4 ,"Resonances");
1385  fhMCPi0PtOrigin->GetYaxis()->SetBinLabel(5 ,"#rho");
1386  fhMCPi0PtOrigin->GetYaxis()->SetBinLabel(6 ,"#omega");
1387  fhMCPi0PtOrigin->GetYaxis()->SetBinLabel(7 ,"K");
1388  fhMCPi0PtOrigin->GetYaxis()->SetBinLabel(8 ,"Other");
1389  fhMCPi0PtOrigin->GetYaxis()->SetBinLabel(9 ,"#eta");
1390  fhMCPi0PtOrigin->GetYaxis()->SetBinLabel(10 ,"#eta prime");
1391  outputContainer->Add(fhMCPi0PtOrigin) ;
1392 
1393  fhMCNotResonancePi0PtOrigin = new TH2F("hMCNotResonancePi0PtOrigin","Reconstructed pair from generated #pi^{0} #it{p}_{T} vs origin",nptbins,ptmin,ptmax,11,0,11) ;
1394  fhMCNotResonancePi0PtOrigin->SetXTitle("#it{p}_{T} (GeV/#it{c})");
1395  fhMCNotResonancePi0PtOrigin->SetYTitle("Origin");
1396  fhMCNotResonancePi0PtOrigin->GetYaxis()->SetBinLabel(1 ,"Status 21");
1397  fhMCNotResonancePi0PtOrigin->GetYaxis()->SetBinLabel(2 ,"Quark");
1398  fhMCNotResonancePi0PtOrigin->GetYaxis()->SetBinLabel(3 ,"qq Resonances");
1399  fhMCNotResonancePi0PtOrigin->GetYaxis()->SetBinLabel(4 ,"Resonances");
1400  fhMCNotResonancePi0PtOrigin->GetYaxis()->SetBinLabel(5 ,"#rho");
1401  fhMCNotResonancePi0PtOrigin->GetYaxis()->SetBinLabel(6 ,"#omega");
1402  fhMCNotResonancePi0PtOrigin->GetYaxis()->SetBinLabel(7 ,"K");
1403  fhMCNotResonancePi0PtOrigin->GetYaxis()->SetBinLabel(8 ,"Other");
1404  fhMCNotResonancePi0PtOrigin->GetYaxis()->SetBinLabel(9 ,"#eta");
1405  fhMCNotResonancePi0PtOrigin->GetYaxis()->SetBinLabel(10 ,"#eta prime");
1406  outputContainer->Add(fhMCNotResonancePi0PtOrigin) ;
1407 
1408  fhMCPi0PtStatus = new TH2F("hMCPi0PtStatus","Reconstructed pair from generated #pi^{0} #it{p}_{T} vs status",nptbins,ptmin,ptmax,101,-50,50) ;
1409  fhMCPi0PtStatus->SetXTitle("#it{p}_{T} (GeV/#it{c})");
1410  fhMCPi0PtStatus->SetYTitle("Status");
1411  outputContainer->Add(fhMCPi0PtStatus) ;
1412 
1413  // Eta
1414 
1415  fhMCEtaPtOrigin = new TH2F("hMCEtaPtOrigin","Reconstructed pair from generated #pi^{0} #it{p}_{T} vs origin",nptbins,ptmin,ptmax,7,0,7) ;
1416  fhMCEtaPtOrigin->SetXTitle("#it{p}_{T} (GeV/#it{c})");
1417  fhMCEtaPtOrigin->SetYTitle("Origin");
1418  fhMCEtaPtOrigin->GetYaxis()->SetBinLabel(1 ,"Status 21");
1419  fhMCEtaPtOrigin->GetYaxis()->SetBinLabel(2 ,"Quark");
1420  fhMCEtaPtOrigin->GetYaxis()->SetBinLabel(3 ,"qq Resonances");
1421  fhMCEtaPtOrigin->GetYaxis()->SetBinLabel(4 ,"Resonances");
1422  fhMCEtaPtOrigin->GetYaxis()->SetBinLabel(5 ,"Other");
1423  fhMCEtaPtOrigin->GetYaxis()->SetBinLabel(6 ,"#eta prime");
1424  outputContainer->Add(fhMCEtaPtOrigin) ;
1425 
1426  fhMCPi0ProdVertex = new TH2F("hMCPi0ProdVertex","Selected reco pair from generated #pi^{0} #it{p}_{T} vs production vertex",
1427  200,0.,20.,5000,0,500) ;
1428  fhMCPi0ProdVertex->SetXTitle("#it{p}_{T} (GeV/#it{c})");
1429  fhMCPi0ProdVertex->SetYTitle("#it{R} (cm)");
1430  outputContainer->Add(fhMCPi0ProdVertex) ;
1431 
1432  fhMCEtaProdVertex = new TH2F("hMCEtaProdVertex","Selected reco pair from generated #eta #it{p}_{T} vs production vertex",
1433  200,0.,20.,5000,0,500) ;
1434  fhMCEtaProdVertex->SetXTitle("#it{p}_{T} (GeV/#it{c})");
1435  fhMCEtaProdVertex->SetYTitle("#it{R} (cm)");
1436  outputContainer->Add(fhMCEtaProdVertex) ;
1437 
1438  //Production vertex of reconstructed mesons for mother origin
1439  TString originTitlePi0[] = {"Status 21","Quark","qq Resonances","Resonances","#rho","#omega","K","Other","#eta","#eta prime"};
1440  for (Int_t iorg=0;iorg<10;iorg++) {
1441  fhMCPi0Radius[iorg] = new TH2F
1442  (Form("hPrimPi0Radius_%d",iorg),
1443  Form("Production radius of reconstructed pair from generated #pi^{0}, origin %s",originTitlePi0[iorg].Data()),
1444  200,0,20,1000,0,500) ;
1445  fhMCPi0Radius[iorg]->SetYTitle("#it{R} (cm)");
1446  fhMCPi0Radius[iorg]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
1447  outputContainer->Add(fhMCPi0Radius[iorg]) ;
1448  }
1449  TString originTitleEta[] = {"Status 21","Quark","qq Resonances","Resonances","Other","#eta prime"};
1450  for (Int_t iorg=0;iorg<6;iorg++) {
1451  fhMCEtaRadius[iorg] = new TH2F
1452  (Form("hPrimEtaRadius_%d",iorg),
1453  Form("Production radius of reconstructed pair from generated #eta, origin %s",originTitleEta[iorg].Data()),
1454  200,0,20,1000,0,500) ;
1455  fhMCEtaRadius[iorg]->SetYTitle("#it{R} (cm)");
1456  fhMCEtaRadius[iorg]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
1457  outputContainer->Add(fhMCEtaRadius[iorg]) ;
1458  }
1459 
1460  // Name of found ancestors of the cluster pairs. Check definitions in FillMCVsRecDataHistograms
1461  TString ancestorTitle[] = {"Photon","Electron","Pi0","Eta","AntiProton","AntiNeutron","Muon & converted stable particles",
1462  "Resonances","Strings","Initial state interaction","Final state radiations","Colliding protons","not found"};
1463 
1464  for(Int_t i = 0; i<13; i++)
1465  {
1466  fhMCOrgMass[i] = new TH2F(Form("hMCOrgMass_%d",i),Form("#it{M} vs #it{p}_{T}, ancestor %s",ancestorTitle[i].Data()),
1467  nptbins,ptmin,ptmax,nmassbins,massmin,massmax) ;
1468  fhMCOrgMass[i]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
1469  fhMCOrgMass[i]->SetYTitle("#it{M}_{#gamma,#gamma} (GeV/#it{c}^{2})");
1470  outputContainer->Add(fhMCOrgMass[i]) ;
1471 
1472  fhMCOrgAsym[i]= new TH2F(Form("hMCOrgAsym_%d",i),Form("#it{Asymmetry} vs #it{p}_{T}, ancestor %s",ancestorTitle[i].Data()),
1473  nptbins,ptmin,ptmax,nasymbins,asymmin,asymmax) ;
1474  fhMCOrgAsym[i]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
1475  fhMCOrgAsym[i]->SetYTitle("A");
1476  outputContainer->Add(fhMCOrgAsym[i]) ;
1477 
1478  fhMCOrgDeltaEta[i] = new TH2F(Form("hMCOrgDeltaEta_%d",i),Form("#Delta #eta of pair vs #it{p}_{T}, ancestor %s",ancestorTitle[i].Data()),
1479  nptbins,ptmin,ptmax,netabins,-1.4,1.4) ;
1480  fhMCOrgDeltaEta[i]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
1481  fhMCOrgDeltaEta[i]->SetYTitle("#Delta #eta");
1482  outputContainer->Add(fhMCOrgDeltaEta[i]) ;
1483 
1484  fhMCOrgDeltaPhi[i]= new TH2F(Form("hMCOrgDeltaPhi_%d",i),Form("#Delta #varphi of pair vs #it{p}_{T}, ancestor %s",ancestorTitle[i].Data()),
1485  nptbins,ptmin,ptmax,nphibins,-0.7,0.7) ;
1486  fhMCOrgDeltaPhi[i]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
1487  fhMCOrgDeltaPhi[i]->SetYTitle("#Delta #varphi (rad)");
1488  outputContainer->Add(fhMCOrgDeltaPhi[i]) ;
1489  }
1490 
1491  if(fMultiCutAnaSim)
1492  {
1499 
1502 
1503  for(Int_t ipt=0; ipt<fNPtCuts; ipt++)
1504  {
1505  for(Int_t icell=0; icell<fNCellNCuts; icell++)
1506  {
1507  for(Int_t iasym=0; iasym<fNAsymCuts; iasym++)
1508  {
1509  Int_t index = ((ipt*fNCellNCuts)+icell)*fNAsymCuts + iasym;
1510 
1511  fhMCPi0MassPtRec[index] = new TH2F(Form("hMCPi0MassPtRec_pt%d_cell%d_asym%d",ipt,icell,iasym),
1512  Form("Reconstructed #it{M} vs reconstructed #it{p}_{T} of true #pi^{0} cluster pairs for %1.1f<#it{p}_{T}<%1.1f, #it{N}^{cluster}_{cell}>%d and |#it{A}|<%1.2f",
1513  fPtCuts[ipt],fPtCutsMax[ipt],fCellNCuts[icell], fAsymCuts[iasym]),
1514  nptbins,ptmin,ptmax,nmassbins,massmin,massmax) ;
1515  fhMCPi0MassPtRec[index]->SetXTitle("#it{p}_{T, reconstructed} (GeV/#it{c})");
1516  fhMCPi0MassPtRec[index]->SetYTitle("#it{M}_{#gamma,#gamma} (GeV/#it{c}^{2})");
1517  outputContainer->Add(fhMCPi0MassPtRec[index]) ;
1518 
1519  fhMCPi0MassPtTrue[index] = new TH2F(Form("hMCPi0MassPtTrue_pt%d_cell%d_asym%d",ipt,icell,iasym),
1520  Form("Reconstructed #it{M} vs generated #it{p}_{T} of true #pi^{0} cluster pairs for %1.1f<#it{p}_{T}<%1.1f, #it{N}^{cluster}_{cell}>%d and |#it{A}|<%1.2f",
1521  fPtCuts[ipt],fPtCutsMax[ipt],fCellNCuts[icell], fAsymCuts[iasym]),
1522  nptbins,ptmin,ptmax,nmassbins,massmin,massmax) ;
1523  fhMCPi0MassPtTrue[index]->SetXTitle("#it{p}_{T, generated} (GeV/#it{c})");
1524  fhMCPi0MassPtTrue[index]->SetYTitle("#it{M}_{#gamma,#gamma} (GeV/#it{c}^{2})");
1525  outputContainer->Add(fhMCPi0MassPtTrue[index]) ;
1526 
1527  fhMCPi0PtTruePtRec[index] = new TH2F(Form("hMCPi0PtTruePtRec_pt%d_cell%d_asym%d",ipt,icell,iasym),
1528  Form("Generated vs reconstructed #it{p}_{T} of true #pi^{0} cluster pairs for %1.1f<#it{p}_{T}<%1.1f, #it{N}^{cluster}_{cell}>%d and |#it{A}|>%1.2f",
1529  fPtCuts[ipt],fPtCutsMax[ipt],fCellNCuts[icell], fAsymCuts[iasym]),
1530  nptbins,ptmin,ptmax,nptbins,ptmin,ptmax) ;
1531  fhMCPi0PtTruePtRec[index]->SetXTitle("#it{p}_{T, generated} (GeV/#it{c})");
1532  fhMCPi0PtTruePtRec[index]->SetYTitle("#it{p}_{T, reconstructed} (GeV/#it{c})");
1533  outputContainer->Add(fhMCPi0PtTruePtRec[index]) ;
1534 
1535  fhMCPi0PtTruePtRecMassCut[index] = new TH2F(Form("hMCPi0PtTruePtRecMassCut_pt%d_cell%d_asym%d",ipt,icell,iasym),
1536  Form("Generated vs reconstructed #it{p}_{T} of true #pi^{0} cluster pairs, %2.2f < rec. mass < %2.2f MeV/#it{c}^{2} for %1.1f<#it{p}_{T}<%1.1f, #it{N}^{cluster}_{cell}>%d and |#it{A}|>%1.2f",
1537  fPi0MassWindow[0],fPi0MassWindow[1],fPtCuts[ipt],fPtCutsMax[ipt],fCellNCuts[icell], fAsymCuts[iasym]),
1538  nptbins,ptmin,ptmax,nptbins,ptmin,ptmax) ;
1539  fhMCPi0PtTruePtRecMassCut[index]->SetXTitle("#it{p}_{T, generated} (GeV/#it{c})");
1540  fhMCPi0PtTruePtRecMassCut[index]->SetYTitle("#it{p}_{T, reconstructed} (GeV/#it{c})");
1541  outputContainer->Add(fhMCPi0PtTruePtRecMassCut[index]) ;
1542 
1543  fhMCEtaMassPtRec[index] = new TH2F(Form("hMCEtaMassPtRec_pt%d_cell%d_asym%d",ipt,icell,iasym),
1544  Form("Reconstructed #it{M} vs reconstructed #it{p}_{T} of true #eta cluster pairs for %1.1f<#it{p}_{T}<%1.1f, #it{N}^{cluster}_{cell}>%d and |#it{A}|<%1.2f",
1545  fPtCuts[ipt],fPtCutsMax[ipt],fCellNCuts[icell], fAsymCuts[iasym]),
1546  nptbins,ptmin,ptmax,nmassbins,massmin,massmax) ;
1547  fhMCEtaMassPtRec[index]->SetXTitle("#it{p}_{T, generated} (GeV/#it{c})");
1548  fhMCEtaMassPtRec[index]->SetYTitle("#it{M}_{#gamma,#gamma} (GeV/#it{c}^{2})");
1549  outputContainer->Add(fhMCEtaMassPtRec[index]) ;
1550 
1551  fhMCEtaMassPtTrue[index] = new TH2F(Form("hMCEtaMassPtTrue_pt%d_cell%d_asym%d",ipt,icell,iasym),
1552  Form("Reconstructed #it{M} vs generated #it{p}_{T} of true #eta cluster pairs for %1.1f<#it{p}_{T}<%1.1f, #it{N}^{cluster}_{cell}>%d and |#it{A}|<%1.2f",
1553  fPtCuts[ipt],fPtCutsMax[ipt],fCellNCuts[icell], fAsymCuts[iasym]),
1554  nptbins,ptmin,ptmax,nmassbins,massmin,massmax) ;
1555  fhMCEtaMassPtTrue[index]->SetXTitle("#it{p}_{T, generated} (GeV/#it{c})");
1556  fhMCEtaMassPtTrue[index]->SetYTitle("#it{M}_{#gamma,#gamma} (GeV/#it{c}^{2})");
1557  outputContainer->Add(fhMCEtaMassPtTrue[index]) ;
1558 
1559  fhMCEtaPtTruePtRec[index] = new TH2F(Form("hMCEtaPtTruePtRec_pt%d_cell%d_asym%d",ipt,icell,iasym),
1560  Form("Generated vs reconstructed #it{p}_{T} of true #eta cluster pairs for %1.1f<#it{p}_{T}<%1.1f, ncell>%d and asym<%1.2f",
1561  fPtCuts[ipt],fPtCutsMax[ipt],fCellNCuts[icell], fAsymCuts[iasym]),
1562  nptbins,ptmin,ptmax,nptbins,ptmin,ptmax) ;
1563  fhMCEtaPtTruePtRec[index]->SetXTitle("#it{p}_{T, generated} (GeV/#it{c})");
1564  fhMCEtaPtTruePtRec[index]->SetYTitle("#it{p}_{T, reconstructed} (GeV/#it{c})");
1565  outputContainer->Add(fhMCEtaPtTruePtRec[index]) ;
1566 
1567 
1568  fhMCEtaPtTruePtRecMassCut[index] = new TH2F(Form("hMCEtaPtTruePtRecMassCut_pt%d_cell%d_asym%d",ipt,icell,iasym),
1569  Form("Generated vs reconstructed #it{p}_{T} of true #eta cluster pairs, %2.2f < rec. mass < %2.2f MeV/#it{c}^{2} for %1.1f<#it{p}_{T}<%1.1f, ncell>%d and asym<%1.2f",
1570  fEtaMassWindow[0],fEtaMassWindow[1],fPtCuts[ipt],fPtCutsMax[ipt],fCellNCuts[icell], fAsymCuts[iasym]),
1571  nptbins,ptmin,ptmax,nptbins,ptmin,ptmax) ;
1572  fhMCEtaPtTruePtRecMassCut[index]->SetXTitle("#it{p}_{T, generated} (GeV/#it{c})");
1573  fhMCEtaPtTruePtRecMassCut[index]->SetYTitle("#it{p}_{T, reconstructed} (GeV/#it{c})");
1574  outputContainer->Add(fhMCEtaPtTruePtRecMassCut[index]) ;
1575  }
1576  }
1577  }
1578  }//multi cut ana
1579  else
1580  {
1581  fhMCPi0MassPtTrue = new TH2F*[1];
1582  fhMCPi0MassPtRec = new TH2F*[1];
1583  fhMCPi0PtTruePtRec = new TH2F*[1];
1584  fhMCEtaMassPtTrue = new TH2F*[1];
1585  fhMCEtaMassPtRec = new TH2F*[1];
1586  fhMCEtaPtTruePtRec = new TH2F*[1];
1587 
1588  fhMCPi0PtTruePtRecMassCut = new TH2F*[1];
1589  fhMCEtaPtTruePtRecMassCut = new TH2F*[1];
1590 
1591  fhMCPi0MassPtTrue[0] = new TH2F("hMCPi0MassPtTrue","Reconstructed Mass vs generated #it{p}_{T} of true #pi^{0} cluster pairs",
1592  nptbins,ptmin,ptmax,nmassbins,massmin,massmax) ;
1593  fhMCPi0MassPtTrue[0]->SetXTitle("#it{p}_{T, generated} (GeV/#it{c})");
1594  fhMCPi0MassPtTrue[0]->SetYTitle("#it{M}_{#gamma,#gamma} (GeV/#it{c}^{2})");
1595  outputContainer->Add(fhMCPi0MassPtTrue[0]) ;
1596 
1597  fhMCPi0MassPtRec[0] = new TH2F("hMCPi0MassPtRec","Reconstructed Mass vs reconstructed #it{p}_{T} of true #pi^{0} cluster pairs",
1598  nptbins,ptmin,ptmax,nmassbins,massmin,massmax) ;
1599  fhMCPi0MassPtRec[0]->SetXTitle("#it{p}_{T, reco} (GeV/#it{c})");
1600  fhMCPi0MassPtRec[0]->SetYTitle("#it{M}_{#gamma,#gamma} (GeV/#it{c}^{2})");
1601  outputContainer->Add(fhMCPi0MassPtRec[0]) ;
1602 
1603  fhMCPi0PtTruePtRec[0]= new TH2F("hMCPi0PtTruePtRec","Generated vs reconstructed #it{p}_{T} of true #pi^{0} cluster pairs",
1604  nptbins,ptmin,ptmax,nptbins,ptmin,ptmax) ;
1605  fhMCPi0PtTruePtRec[0]->SetXTitle("#it{p}_{T, generated} (GeV/#it{c})");
1606  fhMCPi0PtTruePtRec[0]->SetYTitle("#it{p}_{T, reconstructed} (GeV/#it{c})");
1607  outputContainer->Add(fhMCPi0PtTruePtRec[0]) ;
1608 
1609  fhMCPi0PtTruePtRecMassCut[0]= new TH2F("hMCPi0PtTruePtRecMassCut",
1610  Form("Generated vs reconstructed #it{p}_{T} of true #pi^{0} cluster pairs, %2.2f < rec. mass < %2.2f MeV/#it{c}^{2}",fPi0MassWindow[0],fPi0MassWindow[1]),
1611  nptbins,ptmin,ptmax,nptbins,ptmin,ptmax) ;
1612  fhMCPi0PtTruePtRecMassCut[0]->SetXTitle("#it{p}_{T, generated} (GeV/#it{c})");
1613  fhMCPi0PtTruePtRecMassCut[0]->SetYTitle("#it{p}_{T, reconstructed} (GeV/#it{c})");
1614  outputContainer->Add(fhMCPi0PtTruePtRecMassCut[0]) ;
1615 
1616  fhMCEtaMassPtTrue[0] = new TH2F("hMCEtaMassPtTrue","Reconstructed Mass vs generated #it{p}_{T} of true #eta cluster pairs",
1617  nptbins,ptmin,ptmax,nmassbins,massmin,massmax) ;
1618  fhMCEtaMassPtTrue[0]->SetXTitle("#it{p}_{T, generated} (GeV/#it{c})");
1619  fhMCEtaMassPtTrue[0]->SetYTitle("#it{M}_{#gamma,#gamma} (GeV/#it{c}^{2})");
1620  outputContainer->Add(fhMCEtaMassPtTrue[0]) ;
1621 
1622  fhMCEtaMassPtRec[0] = new TH2F("hMCEtaMassPtRec","Reconstructed Mass vs reconstructed #it{p}_{T} of true #eta cluster pairs",
1623  nptbins,ptmin,ptmax,nmassbins,massmin,massmax) ;
1624  fhMCEtaMassPtRec[0]->SetXTitle("#it{p}_{T, reco} (GeV/#it{c})");
1625  fhMCEtaMassPtRec[0]->SetYTitle("#it{M}_{#gamma,#gamma} (GeV/#it{c}^{2})");
1626  outputContainer->Add(fhMCEtaMassPtRec[0]) ;
1627 
1628  fhMCEtaPtTruePtRec[0]= new TH2F("hMCEtaPtTruePtRec","Generated vs reconstructed #it{p}_{T} of true #eta cluster pairs",
1629  nptbins,ptmin,ptmax,nptbins,ptmin,ptmax) ;
1630  fhMCEtaPtTruePtRec[0]->SetXTitle("#it{p}_{T, generated} (GeV/#it{c})");
1631  fhMCEtaPtTruePtRec[0]->SetYTitle("#it{p}_{T, reconstructed} (GeV/#it{c})");
1632  outputContainer->Add(fhMCEtaPtTruePtRec[0]) ;
1633 
1634  fhMCEtaPtTruePtRecMassCut[0]= new TH2F("hMCEtaPtTruePtRecMassCut",
1635  Form("Generated vs reconstructed #it{p}_{T} of true #eta cluster pairs, %2.2f < rec. mass < %2.2f MeV/#it{c}^{2}",
1637  nptbins,ptmin,ptmax,nptbins,ptmin,ptmax) ;
1638  fhMCEtaPtTruePtRecMassCut[0]->SetXTitle("#it{p}_{T, generated} (GeV/#it{c})");
1639  fhMCEtaPtTruePtRecMassCut[0]->SetYTitle("#it{p}_{T, reconstructed} (GeV/#it{c})");
1640  outputContainer->Add(fhMCEtaPtTruePtRecMassCut[0]) ;
1641  }
1642 
1643  fhMCPi0PtTruePtRecRat = new TH2F("hMCPi0PtTruePtRecRat","Reconstructed / generated #it{p}_{T} of true #pi^{0} cluster pairs",
1644  nptbins,ptmin,ptmax,nratbins,ratmin,ratmax) ;
1645  fhMCPi0PtTruePtRecRat->SetXTitle("#it{p}_{T, reco} (GeV/#it{c})");
1646  fhMCPi0PtTruePtRecRat->SetYTitle("#it{p}_{T, reco} / #it{p}_{T, gener}");
1647  outputContainer->Add(fhMCPi0PtTruePtRecRat) ;
1648 
1649  fhMCPi0PtTruePtRecRatMassCut = new TH2F("hMCPi0PtTruePtRecRatCutMassCut",
1650  Form("Reconstructed / generated #it{p}_{T} of true #pi^{0} cluster pairs, %2.2f < rec. mass < %2.2f MeV/#it{c}^{2}",
1652  nptbins,ptmin,ptmax,nratbins,ratmin,ratmax) ;
1653  fhMCPi0PtTruePtRecRatMassCut->SetXTitle("#it{p}_{T, reco} (GeV/#it{c})");
1654  fhMCPi0PtTruePtRecRatMassCut->SetYTitle("#it{p}_{T, reco} / #it{p}_{T, gener}");
1655  outputContainer->Add(fhMCPi0PtTruePtRecRatMassCut) ;
1656 
1657  fhMCEtaPtTruePtRecRat = new TH2F("hMCEtaPtTruePtRecRat","Reconstructed / generated #it{p}_{T} of true #eta cluster pairs",
1658  nptbins,ptmin,ptmax,nratbins,ratmin,ratmax) ;
1659  fhMCEtaPtTruePtRecRat->SetXTitle("#it{p}_{T, reco} (GeV/#it{c})");
1660  fhMCEtaPtTruePtRecRat->SetYTitle("#it{p}_{T, reco} / #it{p}_{T, gener}");
1661  outputContainer->Add(fhMCEtaPtTruePtRecRat) ;
1662 
1663  fhMCEtaPtTruePtRecRatMassCut = new TH2F("hMCEtaPtTruePtRecRatCutMassCut",
1664  Form("Reconstructed / generated #it{p}_{T} of true #eta cluster pairs, %2.2f < rec. mass < %2.2f MeV/#it{c}^{2}",
1666  nptbins,ptmin,ptmax,nratbins,ratmin,ratmax) ;
1667  fhMCEtaPtTruePtRecRatMassCut->SetXTitle("#it{p}_{T, reco} (GeV/#it{c})");
1668  fhMCEtaPtTruePtRecRatMassCut->SetYTitle("#it{p}_{T, reco} / #it{p}_{T, gener}");
1669  outputContainer->Add(fhMCEtaPtTruePtRecRatMassCut) ;
1670 
1671  fhMCPi0PtTruePtRecDif = new TH2F("hMCPi0PtTruePtRecDif","Generated - reconstructed #it{p}_{T} of true #pi^{0} cluster pairs",
1672  nptbins,ptmin,ptmax,ndifbins,difmin,difmax) ;
1673  fhMCPi0PtTruePtRecDif->SetXTitle("#it{p}_{T, reco} (GeV/#it{c})");
1674  fhMCPi0PtTruePtRecDif->SetYTitle("#it{p}_{T, gener} - #it{p}_{T, reco}");
1675  outputContainer->Add(fhMCPi0PtTruePtRecDif) ;
1676 
1677  fhMCPi0PtTruePtRecDifMassCut = new TH2F("hMCPi0PtTruePtRecDifCutMassCut",
1678  Form("Generated - reconstructed #it{p}_{T} of true #pi^{0} cluster pairs, %2.2f < rec. mass < %2.2f MeV/#it{c}^{2}",
1680  nptbins,ptmin,ptmax,ndifbins,difmin,difmax) ;
1681  fhMCPi0PtTruePtRecDifMassCut->SetXTitle("#it{p}_{T, reco} (GeV/#it{c})");
1682  fhMCPi0PtTruePtRecDifMassCut->SetYTitle("#it{p}_{T, gener} - #it{p}_{T, reco}");
1683  outputContainer->Add(fhMCPi0PtTruePtRecDifMassCut) ;
1684 
1685  fhMCEtaPtTruePtRecDif = new TH2F("hMCEtaPtTruePtRecDif","Generated - reconstructed #it{p}_{T} of true #eta cluster pairs",
1686  nptbins,ptmin,ptmax,ndifbins,difmin,difmax) ;
1687  fhMCEtaPtTruePtRecDif->SetXTitle("#it{p}_{T, reco} (GeV/#it{c})");
1688  fhMCEtaPtTruePtRecDif->SetYTitle("#it{p}_{T, gener} - #it{p}_{T, reco}");
1689  outputContainer->Add(fhMCEtaPtTruePtRecDif) ;
1690 
1691  fhMCEtaPtTruePtRecDifMassCut = new TH2F("hMCEtaPtTruePtRecDifCutMassCut",
1692  Form("Generated - reconstructed #it{p}_{T} of true #eta cluster pairs, %2.2f < rec. mass < %2.2f MeV/#it{c}^{2}",
1694  nptbins,ptmin,ptmax,ndifbins,difmin,difmax) ;
1695  fhMCEtaPtTruePtRecDifMassCut->SetXTitle("#it{p}_{T, reco} (GeV/#it{c})");
1696  fhMCEtaPtTruePtRecDifMassCut->SetYTitle("#it{p}_{T, gener} - #it{p}_{T, reco}");
1697  outputContainer->Add(fhMCEtaPtTruePtRecDifMassCut) ;
1698 
1699  fhMCPi0PtRecOpenAngle = new TH2F("hMCPi0PtRecOpenAngle","Opening angle of true #pi^{0} cluster pairs",
1700  nptbins,ptmin,ptmax,nopanbins,opanmin,opanmax) ;
1701  fhMCPi0PtRecOpenAngle->SetXTitle("#it{p}_{T, reco} (GeV/#it{c})");
1702  fhMCPi0PtRecOpenAngle->SetYTitle("#theta(rad)");
1703  outputContainer->Add(fhMCPi0PtRecOpenAngle) ;
1704 
1705  fhMCPi0PtRecOpenAngleMassCut = new TH2F("hMCPi0PtRecOpenAngleCutMassCut",
1706  Form("Opening angle of true #pi^{0} cluster pairs, %2.2f < rec. mass < %2.2f MeV/#it{c}^{2}",
1708  nptbins,ptmin,ptmax,nopanbins,opanmin,opanmax) ;
1709  fhMCPi0PtRecOpenAngleMassCut->SetXTitle("#it{p}_{T, reco} (GeV/#it{c})");
1710  fhMCPi0PtRecOpenAngleMassCut->SetYTitle("#theta(rad)");
1711  outputContainer->Add(fhMCPi0PtRecOpenAngleMassCut) ;
1712 
1713  fhMCEtaPtRecOpenAngle = new TH2F("hMCEtaPtRecOpenAngle","Opening angle of true #eta cluster pairs",
1714  nptbins,ptmin,ptmax,nopanbins,opanmin,opanmax) ;
1715  fhMCEtaPtRecOpenAngle->SetXTitle("#it{p}_{T, reco} (GeV/#it{c})");
1716  fhMCEtaPtRecOpenAngle->SetYTitle("#theta(rad)");
1717  outputContainer->Add(fhMCEtaPtRecOpenAngle) ;
1718 
1719  fhMCEtaPtRecOpenAngleMassCut = new TH2F("hMCEtaPtRecOpenAngleCutMassCut",
1720  Form("Opening angle of true #eta cluster pairs, %2.2f < rec. mass < %2.2f MeV/#it{c}^{2}",
1722  nptbins,ptmin,ptmax,nopanbins,opanmin,opanmax) ;
1723  fhMCEtaPtRecOpenAngleMassCut->SetXTitle("#it{p}_{T, reco} (GeV/#it{c})");
1724  fhMCEtaPtRecOpenAngleMassCut->SetYTitle("#theta(rad)");
1725  outputContainer->Add(fhMCEtaPtRecOpenAngleMassCut) ;
1726 
1728  {
1730  ("hMCPi0PerCentrality",
1731  "Reconstructed #it{p}_{T} vs centrality of true #pi^{0} cluster pairs",
1732  nptbins,ptmin,ptmax,100,0,100) ;
1733  fhMCPi0PerCentrality->SetXTitle("#it{p}_{T, reco} (GeV/#it{c})");
1734  fhMCPi0PerCentrality->SetYTitle("Centrality");
1735  outputContainer->Add(fhMCPi0PerCentrality) ;
1736 
1738  ("hMCPi0PerCentralityMassCut",
1739  Form("Reconstructed #it{p}_{T} vs centrality of true #pi^{0} cluster pairs, %2.2f < rec. mass < %2.2f MeV/#it{c}^{2}",
1741  nptbins,ptmin,ptmax,100,0,100) ;
1742  fhMCPi0PerCentralityMassCut->SetXTitle("#it{p}_{T, reco} (GeV/#it{c})");
1743  fhMCPi0PerCentralityMassCut->SetYTitle("Centrality");
1744  outputContainer->Add(fhMCPi0PerCentralityMassCut) ;
1745 
1747  ("hMCEtaPerCentrality",
1748  "Reconstructed #it{p}_{T} vs centrality of true #pi^{0} cluster pairs",
1749  nptbins,ptmin,ptmax,100,0,100) ;
1750  fhMCEtaPerCentrality->SetXTitle("#it{p}_{T, reco} (GeV/#it{c})");
1751  fhMCEtaPerCentrality->SetYTitle("Centrality");
1752  outputContainer->Add(fhMCEtaPerCentrality) ;
1753 
1755  ("hMCEtaPerCentralityMassCut",
1756  Form("Reconstructed #it{p}_{T} vs centrality of true #pi^{0} cluster pairs, %2.2f < rec. mass < %2.2f MeV/#it{c}^{2}",
1758  nptbins,ptmin,ptmax,100,0,100) ;
1759  fhMCEtaPerCentralityMassCut->SetXTitle("#it{p}_{T, reco} (GeV/#it{c})");
1760  fhMCEtaPerCentralityMassCut->SetYTitle("Centrality");
1761  outputContainer->Add(fhMCEtaPerCentralityMassCut) ;
1762  }
1763  }
1764  }
1765 
1766 
1767  if ( fFillSMCombinations )
1768  {
1769  AliDebug(1,Form("*** NMod = %d first %d last %d\n",fNModules, fFirstModule, fLastModule));
1770  if(fLastModule >= fNModules)
1771  AliError(Form("Last module number <%d> is larger than total SM number <%d>, please check configuration \n",fLastModule,fNModules));
1772 
1774  {
1775  // Init the number of modules, set in the class AliCalorimeterUtils
1776  fhReMod = new TH2F*[fNModules] ;
1777 
1778  if(GetCalorimeter() == kPHOS)
1779  {
1780  fhReDiffPHOSMod = new TH2F*[fNModules] ;
1781  }
1782  else
1783  {
1785  fhReSameSideEMCALMod = new TH2F*[fNModules-2] ;
1786  }
1787 
1788  if(DoOwnMix())
1789  {
1790  fhMiMod = new TH2F*[fNModules] ;
1791  if(GetCalorimeter() == kPHOS)
1792  {
1793  fhMiDiffPHOSMod = new TH2F*[fNModules] ;
1794  }
1795  else
1796  {
1798  fhMiSameSideEMCALMod = new TH2F*[fNModules-2] ;
1799  }
1800  }
1801 
1802  // Single super modules
1803  //
1804  for(Int_t imod=0; imod<fNModules; imod++)
1805  {
1806  if ( imod < fFirstModule || imod > fLastModule )
1807  {
1808  fhReMod[imod] = 0x0;
1809  if ( DoOwnMix() )
1810  fhMiMod[imod] = 0x0;
1811  continue;
1812  }
1813  // Module dependent invariant mass
1814  snprintf(key, buffersize,"hReMod_%d",imod) ;
1815  snprintf(title, buffersize,"Real #it{M}_{#gamma#gamma} distr. for Module %d",imod) ;
1816  fhReMod[imod] = new TH2F(key,title,nptbins,ptmin,ptmax,nmassbins,massmin,massmax) ;
1817  fhReMod[imod]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
1818  fhReMod[imod]->SetYTitle("#it{M}_{#gamma,#gamma} (GeV/#it{c}^{2})");
1819  outputContainer->Add(fhReMod[imod]) ;
1820  if(DoOwnMix())
1821  {
1822  snprintf(key, buffersize,"hMiMod_%d",imod) ;
1823  snprintf(title, buffersize,"Mixed #it{M}_{#gamma#gamma} distr. for Module %d",imod) ;
1824  fhMiMod[imod] = new TH2F(key,title,nptbins,ptmin,ptmax,nmassbins,massmin,massmax) ;
1825  fhMiMod[imod]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
1826  fhMiMod[imod]->SetYTitle("#it{M}_{#gamma,#gamma} (GeV/#it{c}^{2})");
1827  outputContainer->Add(fhMiMod[imod]) ;
1828  }
1829  }
1830 
1831  // Super modules combinations
1832  //
1833  if(GetCalorimeter()==kPHOS)
1834  {
1835  TString pairnamePHOS[] = {"(0-1)","(0-2)","(1-2)","(0-3)","(1-3)","(2-3)","(0-4)","(1-4)","(2-4)","(3-4)"};
1836 
1837  for(Int_t imod=0; imod<10; imod++)
1838  {
1839  if ( (fNModules == 3 && imod > 2) || (fNModules == 4 && imod > 5) )
1840  {
1841  fhReDiffPHOSMod[imod] = 0x0;
1842  if ( DoOwnMix() )
1843  fhMiDiffPHOSMod[imod] = 0x0;
1844  continue;
1845  }
1846 
1847  snprintf(key, buffersize,"hReDiffPHOSMod_%d",imod) ;
1848  snprintf(title, buffersize,"Real pairs PHOS, clusters in different Modules: %s",(pairnamePHOS[imod]).Data()) ;
1849  fhReDiffPHOSMod[imod] = new TH2F(key,title,nptbins,ptmin,ptmax,nmassbins,massmin,massmax) ;
1850  fhReDiffPHOSMod[imod]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
1851  fhReDiffPHOSMod[imod]->SetYTitle("#it{M}_{#gamma,#gamma} (GeV/#it{c}^{2})");
1852  outputContainer->Add(fhReDiffPHOSMod[imod]) ;
1853 
1854  if(DoOwnMix())
1855  {
1856  snprintf(key, buffersize,"hMiDiffPHOSMod_%d",imod) ;
1857  snprintf(title, buffersize,"Mixed pairs PHOS, clusters in different Modules: %s",(pairnamePHOS[imod]).Data()) ;
1858  fhMiDiffPHOSMod[imod] = new TH2F(key,title,nptbins,ptmin,ptmax,nmassbins,massmin,massmax) ;
1859  fhMiDiffPHOSMod[imod]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
1860  fhMiDiffPHOSMod[imod]->SetYTitle("#it{M}_{#gamma,#gamma} (GeV/#it{c}^{2})");
1861  outputContainer->Add(fhMiDiffPHOSMod[imod]) ;
1862  }
1863  }
1864  }
1865  else
1866  {
1867  // EMCAL
1868 
1869  // Sectors
1870  //
1871  Int_t maxSector = (Int_t) fLastModule /2 ;
1872  Int_t minSector = (Int_t) fFirstModule/2 ;
1873  for(Int_t isector=minSector; isector<=maxSector; isector++)
1874  {
1875  snprintf(key, buffersize,"hReSameSectorEMCALMod_%d",isector) ;
1876  snprintf(title, buffersize,"Real pairs EMCAL, clusters in same sector, SM(%d,%d)",isector*2,isector*2+1) ;
1877  fhReSameSectorEMCALMod[isector] = new TH2F(key,title,nptbins,ptmin,ptmax,nmassbins,massmin,massmax) ;
1878  fhReSameSectorEMCALMod[isector]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
1879  fhReSameSectorEMCALMod[isector]->SetYTitle("#it{M}_{#gamma,#gamma} (GeV/#it{c}^{2})");
1880  outputContainer->Add(fhReSameSectorEMCALMod[isector]) ;
1881 
1882  if(DoOwnMix())
1883  {
1884  snprintf(key, buffersize,"hMiSameSectorEMCALMod_%d",isector) ;
1885  snprintf(title, buffersize,"Mixed pairs EMCAL, clusters in same sector, SM(%d,%d)",isector*2,isector*2+1) ;
1886  fhMiSameSectorEMCALMod[isector] = new TH2F(key,title,nptbins,ptmin,ptmax,nmassbins,massmin,massmax) ;
1887  fhMiSameSectorEMCALMod[isector]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
1888  fhMiSameSectorEMCALMod[isector]->SetYTitle("#it{M}_{#gamma,#gamma} (GeV/#it{c}^{2})");
1889  outputContainer->Add(fhMiSameSectorEMCALMod[isector]) ;
1890  }
1891  }// sectors
1892 
1893  // Sides
1894  //
1895  Int_t minSide = 0;
1896  Int_t maxSide = fNModules-2;
1897 
1898  if(fLastModule > 11)
1899  maxSide = fNModules-4;
1900  else
1901  maxSide = fLastModule-1;
1902 
1903  if(fFirstModule > 11)
1904  minSide = 10;
1905  //printf("** Last %d, First %d, min %d, max %d\n",fLastModule,fFirstModule,minSide,maxSide);
1906  for(Int_t iside=minSide; iside<maxSide; iside++)
1907  {
1908  Int_t ism1 = iside;
1909  Int_t ism2 = iside+2;
1910  if(iside > 9) // skip EMCal-DCal combination
1911  {
1912  ism1 = iside+2;
1913  ism2 = iside+4;
1914  }
1915 
1916  //printf("iside %d, sm1 %d, sm2 %d\n",iside,ism1,ism2);
1917 
1918  snprintf(key, buffersize,"hReSameSideEMCALMod_%d",iside) ;
1919  snprintf(title, buffersize,"Real pairs EMCAL, clusters in same side SM(%d,%d)",ism1, ism2) ;
1920  fhReSameSideEMCALMod[iside] = new TH2F(key,title,nptbins,ptmin,ptmax,nmassbins,massmin,massmax) ;
1921  fhReSameSideEMCALMod[iside]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
1922  fhReSameSideEMCALMod[iside]->SetYTitle("#it{M}_{#gamma,#gamma} (GeV/#it{c}^{2})");
1923  outputContainer->Add(fhReSameSideEMCALMod[iside]) ;
1924 
1925  if(DoOwnMix())
1926  {
1927  snprintf(key, buffersize,"hMiSameSideEMCALMod_%d",iside) ;
1928  snprintf(title, buffersize,"Mixed pairs EMCAL, clusters in same side SM(%d,%d)",ism1, ism2) ;
1929  fhMiSameSideEMCALMod[iside] = new TH2F(key,title,nptbins,ptmin,ptmax,nmassbins,massmin,massmax) ;
1930  fhMiSameSideEMCALMod[iside]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
1931  fhMiSameSideEMCALMod[iside]->SetYTitle("#it{M}_{#gamma,#gamma} (GeV/#it{c}^{2})");
1932  outputContainer->Add(fhMiSameSideEMCALMod[iside]) ;
1933  } // mix
1934  } // sides
1935 
1936  }//EMCAL
1937  } // Not pair of detectors
1938  else
1939  {
1940  fhReSameSectorDCALPHOSMod = new TH2F*[6] ;
1941  fhReDiffSectorDCALPHOSMod = new TH2F*[8] ;
1942  fhMiSameSectorDCALPHOSMod = new TH2F*[6] ;
1943  fhMiDiffSectorDCALPHOSMod = new TH2F*[8] ;
1944 
1945  Int_t dcSameSM[6] = {12,13,14,15,16,17}; // Check eta order
1946  Int_t phSameSM[6] = {3, 3, 2, 2, 1, 1};
1947 
1948  Int_t dcDiffSM[8] = {12,13,14,15,16,17,0,0};
1949  Int_t phDiffSM[8] = {2, 2, 1, 1, 3, 3,0,0};
1950 
1951  for(Int_t icombi = 0; icombi < 8; icombi++)
1952  {
1953  snprintf(key, buffersize,"hReDiffSectorDCALPHOS_%d",icombi) ;
1954  snprintf(title, buffersize,"Real pairs DCAL-PHOS, clusters in different sector, SM(%d,%d)",dcDiffSM[icombi],phDiffSM[icombi]) ;
1955  fhReDiffSectorDCALPHOSMod[icombi] = new TH2F(key,title,nptbins,ptmin,ptmax,nmassbins,massmin,massmax) ;
1956  fhReDiffSectorDCALPHOSMod[icombi]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
1957  fhReDiffSectorDCALPHOSMod[icombi]->SetYTitle("#it{M}_{#gamma,#gamma} (GeV/#it{c}^{2})");
1958  outputContainer->Add(fhReDiffSectorDCALPHOSMod[icombi]) ;
1959  if(DoOwnMix())
1960  {
1961  snprintf(key, buffersize,"hMiDiffSectorDCALPHOS_%d",icombi) ;
1962  snprintf(title, buffersize,"Mixed pairs DCAL-PHOS, clusters in different sector, SM(%d,%d)",dcDiffSM[icombi],phDiffSM[icombi]) ;
1963  fhMiDiffSectorDCALPHOSMod[icombi] = new TH2F(key,title,nptbins,ptmin,ptmax,nmassbins,massmin,massmax) ;
1964  fhMiDiffSectorDCALPHOSMod[icombi]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
1965  fhMiDiffSectorDCALPHOSMod[icombi]->SetYTitle("#it{M}_{#gamma,#gamma} (GeV/#it{c}^{2})");
1966  outputContainer->Add(fhMiDiffSectorDCALPHOSMod[icombi]) ;
1967  }
1968 
1969  if ( icombi > 5 ) continue ;
1970 
1971  snprintf(key, buffersize,"hReSameSectorDCALPHOS_%d",icombi) ;
1972  snprintf(title, buffersize,"Real pairs DCAL-PHOS, clusters in same sector, SM(%d,%d)",dcSameSM[icombi],phSameSM[icombi]) ;
1973  fhReSameSectorDCALPHOSMod[icombi] = new TH2F(key,title,nptbins,ptmin,ptmax,nmassbins,massmin,massmax) ;
1974  fhReSameSectorDCALPHOSMod[icombi]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
1975  fhReSameSectorDCALPHOSMod[icombi]->SetYTitle("#it{M}_{#gamma,#gamma} (GeV/#it{c}^{2})");
1976  outputContainer->Add(fhReSameSectorDCALPHOSMod[icombi]) ;
1977  if(DoOwnMix())
1978  {
1979  snprintf(key, buffersize,"hMiSameSectorDCALPHOS_%d",icombi) ;
1980  snprintf(title, buffersize,"Mixed pairs DCAL-PHOS, clusters in same sector, SM(%d,%d)",dcSameSM[icombi],phSameSM[icombi]) ;
1981  fhMiSameSectorDCALPHOSMod[icombi] = new TH2F(key,title,nptbins,ptmin,ptmax,nmassbins,massmin,massmax) ;
1982  fhMiSameSectorDCALPHOSMod[icombi]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
1983  fhMiSameSectorDCALPHOSMod[icombi]->SetYTitle("#it{M}_{#gamma,#gamma} (GeV/#it{c}^{2})");
1984  outputContainer->Add(fhMiSameSectorDCALPHOSMod[icombi]) ;
1985  }
1986  }
1987 
1988  }
1989  } // SM combinations
1990 
1991  //
1992  if ( fFillOpAngleCutHisto )
1993  {
1994  for(Int_t icut = 0; icut < fNAngleCutBins; icut++)
1995  {
1997  (Form("hReOpAngleBin%d_ClusterMin_EtaPhi",icut),
1998  Form("#eta vs #varphi, cluster pair lower #it{E}, pair %1.4f<#theta<%1.4f",fAngleCutBinsArray[icut],fAngleCutBinsArray[icut+1]),
1999  netabins,etamin,etamax,nphibins,phimin,phimax);
2000  fhReOpAngleBinMinClusterEtaPhi[icut]->SetYTitle("#varphi (rad)");
2001  fhReOpAngleBinMinClusterEtaPhi[icut]->SetXTitle("#eta");
2002  outputContainer->Add(fhReOpAngleBinMinClusterEtaPhi[icut]) ;
2003 
2005  (Form("hReOpAngleBin%d_ClusterMax_EtaPhi",icut),
2006  Form("#eta vs #varphi, cluster pair higher #it{E}, pair %1.4f<#theta<%1.4f",fAngleCutBinsArray[icut],fAngleCutBinsArray[icut+1]),
2007  netabins,etamin,etamax,nphibins,phimin,phimax);
2008  fhReOpAngleBinMaxClusterEtaPhi[icut]->SetYTitle("#varphi (rad)");
2009  fhReOpAngleBinMaxClusterEtaPhi[icut]->SetXTitle("#eta");
2010  outputContainer->Add(fhReOpAngleBinMaxClusterEtaPhi[icut]) ;
2011 
2013  (Form("hReOpAngleBin%d_ClusterMin_ColRow",icut),
2014  Form("highest #it{E} cell, column vs row, cluster pair lower #it{E}, pair %1.4f<#theta<%1.4f",fAngleCutBinsArray[icut],fAngleCutBinsArray[icut+1]),
2015  ncolcell,colcellmin,colcellmax,nrowcell,rowcellmin,rowcellmax);
2016  fhReOpAngleBinMinClusterColRow[icut]->SetYTitle("row");
2017  fhReOpAngleBinMinClusterColRow[icut]->SetXTitle("column");
2018  outputContainer->Add(fhReOpAngleBinMinClusterColRow[icut]) ;
2019 
2021  (Form("hReOpAngleBin%d_ClusterMax_ColRow",icut),
2022  Form("highest #it{E} cell, column vs row, cluster pair higher #it{E}, pair %1.4f<#theta<%1.4f",fAngleCutBinsArray[icut],fAngleCutBinsArray[icut+1]),
2023  ncolcell,colcellmin,colcellmax,nrowcell,rowcellmin,rowcellmax);
2024  fhReOpAngleBinMaxClusterColRow[icut]->SetYTitle("row");
2025  fhReOpAngleBinMaxClusterColRow[icut]->SetXTitle("column");
2026  outputContainer->Add(fhReOpAngleBinMaxClusterColRow[icut]) ;
2027 
2029  (Form("hReOpAngleBin%d_ClusterMin_EPerSM",icut),
2030  Form("cluster pair lower #it{E}, pair %1.4f<#theta<%1.4f",fAngleCutBinsArray[icut],fAngleCutBinsArray[icut+1]),
2031  nptbins,ptmin,ptmax,20,0,20);
2032  fhReOpAngleBinMinClusterEPerSM[icut]->SetYTitle("SM");
2033  fhReOpAngleBinMinClusterEPerSM[icut]->SetXTitle("#it{E} (GeV/#it{c})");
2034  outputContainer->Add(fhReOpAngleBinMinClusterEPerSM[icut]) ;
2035 
2037  (Form("hReOpAngleBin%d_ClusterMax_EPerSM",icut),
2038  Form("cluster pair higher #it{E}, pair %1.4f<#theta<%1.4f",fAngleCutBinsArray[icut],fAngleCutBinsArray[icut+1]),
2039  nptbins,ptmin,ptmax,20,0,20);
2040  fhReOpAngleBinMaxClusterEPerSM[icut]->SetYTitle("SM");
2041  fhReOpAngleBinMaxClusterEPerSM[icut]->SetXTitle("#it{E} (GeV/#it{c})");
2042  outputContainer->Add(fhReOpAngleBinMaxClusterEPerSM[icut]) ;
2043 
2045  (Form("hReOpAngleBin%d_ClusterMin_TimePerSM",icut),
2046  Form("cluster pair lower #it{E}, pair %1.4f<#theta<%1.4f",fAngleCutBinsArray[icut],fAngleCutBinsArray[icut+1]),
2047  ntimebins,timemin,timemax,20,0,20);
2048  fhReOpAngleBinMinClusterTimePerSM[icut]->SetYTitle("SM");
2049  fhReOpAngleBinMinClusterTimePerSM[icut]->SetXTitle("#it{t} (ns)");
2050  outputContainer->Add(fhReOpAngleBinMinClusterTimePerSM[icut]) ;
2051 
2053  (Form("hReOpAngleBin%d_ClusterMax_TimePerSM",icut),
2054  Form("cluster pair higher #it{E}, pair %1.4f<#theta<%1.4f",fAngleCutBinsArray[icut],fAngleCutBinsArray[icut+1]),
2055  ntimebins,timemin,timemax,20,0,20);
2056  fhReOpAngleBinMaxClusterTimePerSM[icut]->SetYTitle("SM");
2057  fhReOpAngleBinMaxClusterTimePerSM[icut]->SetXTitle("#it{t} (ns)");
2058  outputContainer->Add(fhReOpAngleBinMaxClusterTimePerSM[icut]) ;
2059 
2061  (Form("hReOpAngleBin%d_ClusterMin_NCellPerSM",icut),
2062  Form("cluster pair lower #it{E}, pair %1.4f<#theta<%1.4f",fAngleCutBinsArray[icut],fAngleCutBinsArray[icut+1]),
2063  30,0,30,20,0,20);
2064  fhReOpAngleBinMinClusterNCellPerSM[icut]->SetYTitle("SM");
2065  fhReOpAngleBinMinClusterNCellPerSM[icut]->SetXTitle("# cells");
2066  outputContainer->Add(fhReOpAngleBinMinClusterNCellPerSM[icut]) ;
2067 
2069  (Form("hReOpAngleBin%d_ClusterMax_NCellPerSM",icut),
2070  Form("cluster pair higher #it{E}, pair %1.4f<#theta<%1.4f",fAngleCutBinsArray[icut],fAngleCutBinsArray[icut+1]),
2071  30,0,30,20,0,20);
2072  fhReOpAngleBinMaxClusterNCellPerSM[icut]->SetYTitle("SM");
2073  fhReOpAngleBinMaxClusterNCellPerSM[icut]->SetXTitle("# cells");
2074  outputContainer->Add(fhReOpAngleBinMaxClusterNCellPerSM[icut]) ;
2075 
2077  (Form("hReOpAngleBin%d_PairCluster_RatioPerSM",icut),
2078  Form("cluster pair #it{E}_{high}/ #it{E}_{low}, pair %1.4f<#theta<%1.4f",fAngleCutBinsArray[icut],fAngleCutBinsArray[icut+1]),
2079  100,0,1,20,0,20);
2080  fhReOpAngleBinPairClusterRatioPerSM[icut]->SetYTitle("SM");
2081  fhReOpAngleBinPairClusterRatioPerSM[icut]->SetXTitle("#it{E}_{low}/ #it{E}_{high}");
2082  outputContainer->Add(fhReOpAngleBinPairClusterRatioPerSM[icut]) ;
2083 
2085  (Form("hReOpAngleBin%d_PairCluster_MassPerSM",icut),
2086  Form("cluster pair #it{M}, pair %1.4f<#theta<%1.4f",fAngleCutBinsArray[icut],fAngleCutBinsArray[icut+1]),
2087  nmassbins,massmin,massmax,20,0,20);
2088  fhReOpAngleBinPairClusterMassPerSM[icut]->SetXTitle("#it{M} (GeV/#it{c}^2)");
2089  fhReOpAngleBinPairClusterMassPerSM[icut]->SetYTitle("SM");
2090  outputContainer->Add(fhReOpAngleBinPairClusterMassPerSM[icut]) ;
2091 
2093  (Form("hReOpAngleBin%d_PairCluster_Mass",icut),
2094  Form("cluster pair #it{M}, pair %1.4f<#theta<%1.4f",fAngleCutBinsArray[icut],fAngleCutBinsArray[icut+1]),
2095  nptbins,ptmin,ptmax,nmassbins,massmin,massmax);
2096  fhReOpAngleBinPairClusterMass[icut]->SetYTitle("#it{M} (GeV/#it{c}^2)");
2097  fhReOpAngleBinPairClusterMass[icut]->SetXTitle("#it{p}_{T} GeV/#it{c}");
2098  outputContainer->Add(fhReOpAngleBinPairClusterMass[icut]) ;
2099 
2100  if(IsDataMC())
2101  {
2102  if(fFillOriginHisto)
2103  {
2105  (Form("hReOpAngleBin%d_PairCluster_MassMCTruePi0",icut),
2106  Form("cluster pair #it{M}, pair %1.4f<#theta<%1.4f, true mc #pi^{0}",fAngleCutBinsArray[icut],fAngleCutBinsArray[icut+1]),
2107  nptbins,ptmin,ptmax,nmassbins,massmin,massmax);
2108  fhReOpAngleBinPairClusterMassMCTruePi0[icut]->SetYTitle("#it{M} (GeV/#it{c}^2)");
2109  fhReOpAngleBinPairClusterMassMCTruePi0[icut]->SetXTitle("#it{p}_{T} GeV/#it{c}");
2110  outputContainer->Add(fhReOpAngleBinPairClusterMassMCTruePi0[icut]) ;
2111 
2113  (Form("hReOpAngleBin%d_PairCluster_MassMCTrueEta",icut),
2114  Form("cluster pair #it{M}, pair %1.4f<#theta<%1.4f, true mc #eta",fAngleCutBinsArray[icut],fAngleCutBinsArray[icut+1]),
2115  nptbins,ptmin,ptmax,nmassbins,massmin,massmax);
2116  fhReOpAngleBinPairClusterMassMCTrueEta[icut]->SetYTitle("#it{M} (GeV/#it{c}^2)");
2117  fhReOpAngleBinPairClusterMassMCTrueEta[icut]->SetXTitle("#it{p}_{T} GeV/#it{c}");
2118  outputContainer->Add(fhReOpAngleBinPairClusterMassMCTrueEta[icut]) ;
2119  }
2120 
2121  fhPrimPi0AccPtOpAngCuts[icut] = new TH1F
2122  (Form("hPrimPi0AccPt_OpAngleBin%d",icut),
2123  Form("Primary #pi^{0} #it{p}_{T} with both photons in acceptance, pair %1.4f<#theta<%1.4f",fAngleCutBinsArray[icut],fAngleCutBinsArray[icut+1]),
2124  nptbins,ptmin,ptmax) ;
2125  fhPrimPi0AccPtOpAngCuts[icut]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
2126  outputContainer->Add(fhPrimPi0AccPtOpAngCuts[icut]) ;
2127 
2128  fhPrimEtaAccPtOpAngCuts[icut] = new TH1F
2129  (Form("hPrimEtaAccPt_OpAngleBin%d",icut),
2130  Form("Primary #eta #it{p}_{T} with both photons in acceptance, pair %1.4f<#theta<%1.4f",fAngleCutBinsArray[icut],fAngleCutBinsArray[icut+1]),
2131  nptbins,ptmin,ptmax) ;
2132  fhPrimEtaAccPtOpAngCuts[icut]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
2133  outputContainer->Add(fhPrimEtaAccPtOpAngCuts[icut]) ;
2134  }
2135 
2136 // fhReOpAngleBinPairClusterAbsIdMaxCell[icut] = new TH2F
2137 // (Form("hReOpAngleBin%d_PairCluster_AbsIdCell",icut),
2138 // Form("cluster pair Abs Cell ID low #it{E} vs high #it{E}, pair %1.4f<#theta<%1.4f",fAngleCutBinsArray[icut],fAngleCutBinsArray[icut+1]),
2139 // //17664,0,17664,17664,0,17664);
2140 // 1689,0,16896,1689,0,16896);
2141 // fhReOpAngleBinPairClusterAbsIdMaxCell[icut]->SetYTitle("AbsId-higher");
2142 // fhReOpAngleBinPairClusterAbsIdMaxCell[icut]->SetXTitle("AbsId-lower");
2143 // outputContainer->Add(fhReOpAngleBinPairClusterAbsIdMaxCell[icut]) ;
2144 
2145  if( DoOwnMix() )
2146  {
2148  (Form("hMiOpAngleBin%d_ClusterMin_EtaPhi",icut),
2149  Form("#eta vs #varphi, mixed cluster pair lower #it{E}, pair %1.4f<#theta<%1.4f",fAngleCutBinsArray[icut],fAngleCutBinsArray[icut+1]),
2150  netabins,etamin,etamax,nphibins,phimin,phimax);
2151  fhMiOpAngleBinMinClusterEtaPhi[icut]->SetYTitle("#varphi (rad)");
2152  fhMiOpAngleBinMinClusterEtaPhi[icut]->SetXTitle("#eta");
2153  outputContainer->Add(fhMiOpAngleBinMinClusterEtaPhi[icut]) ;
2154 
2156  (Form("hMiOpAngleBin%d_ClusterMax_EtaPhi",icut),
2157  Form("#eta vs #varphi, mixed cluster pair higher #it{E}, pair %1.4f<#theta<%1.4f",fAngleCutBinsArray[icut],fAngleCutBinsArray[icut+1]),
2158  netabins,etamin,etamax,nphibins,phimin,phimax);
2159  fhMiOpAngleBinMaxClusterEtaPhi[icut]->SetYTitle("#varphi (rad)");
2160  fhMiOpAngleBinMaxClusterEtaPhi[icut]->SetXTitle("#eta");
2161  outputContainer->Add(fhMiOpAngleBinMaxClusterEtaPhi[icut]) ;
2162 
2163 // fhMiOpAngleBinMinClusterColRow[icut] = new TH2F
2164 // (Form("hMiOpAngleBin%d_ClusterMin_ColRow",icut),
2165 // Form("highest #it{E} cell, column vs row, mixed cluster pair lower #it{E}, pair %1.4f<#theta<%1.4f",fAngleCutBinsArray[icut],fAngleCutBinsArray[icut+1]),
2166 // ncolcell,colcellmin,colcellmax,nrowcell,rowcellmin,rowcellmax);
2167 // fhMiOpAngleBinMinClusterColRow[icut]->SetYTitle("row");
2168 // fhMiOpAngleBinMinClusterColRow[icut]->SetXTitle("column");
2169 // outputContainer->Add(fhMiOpAngleBinMinClusterColRow[icut]) ;
2170 //
2171 // fhMiOpAngleBinMaxClusterColRow[icut] = new TH2F
2172 // (Form("hMiOpAngleBin%d_ClusterMax_ColRow",icut),
2173 // Form("highest #it{E} cell, column vs row, mixed cluster pair higher #it{E}, pair %1.4f<#theta<%1.4f",fAngleCutBinsArray[icut],fAngleCutBinsArray[icut+1]),
2174 // ncolcell,colcellmin,colcellmax,nrowcell,rowcellmin,rowcellmax);
2175 // fhMiOpAngleBinMaxClusterColRow[icut]->SetYTitle("row");
2176 // fhMiOpAngleBinMaxClusterColRow[icut]->SetXTitle("column");
2177 // outputContainer->Add(fhMiOpAngleBinMaxClusterColRow[icut]) ;
2178 
2180  (Form("hMiOpAngleBin%d_ClusterMin_EPerSM",icut),
2181  Form("mixed cluster pair lower #it{E}, pair %1.4f<#theta<%1.4f",fAngleCutBinsArray[icut],fAngleCutBinsArray[icut+1]),
2182  nptbins,ptmin,ptmax,20,0,20);
2183  fhMiOpAngleBinMinClusterEPerSM[icut]->SetYTitle("SM");
2184  fhMiOpAngleBinMinClusterEPerSM[icut]->SetXTitle("#it{E} (GeV/#it{c})");
2185  outputContainer->Add(fhMiOpAngleBinMinClusterEPerSM[icut]) ;
2186 
2188  (Form("hMiOpAngleBin%d_ClusterMax_EPerSM",icut),
2189  Form("mixed cluster pair higher #it{E}, pair %1.4f<#theta<%1.4f",fAngleCutBinsArray[icut],fAngleCutBinsArray[icut+1]),
2190  nptbins,ptmin,ptmax,20,0,20);
2191  fhMiOpAngleBinMaxClusterEPerSM[icut]->SetYTitle("SM");
2192  fhMiOpAngleBinMaxClusterEPerSM[icut]->SetXTitle("#it{E} (GeV/#it{c})");
2193  outputContainer->Add(fhMiOpAngleBinMaxClusterEPerSM[icut]) ;
2194 
2196  (Form("hMiOpAngleBin%d_ClusterMin_TimePerSM",icut),
2197  Form("mixed cluster pair lower #it{E}, pair %1.4f<#theta<%1.4f",fAngleCutBinsArray[icut],fAngleCutBinsArray[icut+1]),
2198  ntimebins,timemin,timemax,20,0,20);
2199  fhMiOpAngleBinMinClusterTimePerSM[icut]->SetYTitle("SM");
2200  fhMiOpAngleBinMinClusterTimePerSM[icut]->SetXTitle("#it{t} (ns)");
2201  outputContainer->Add(fhMiOpAngleBinMinClusterTimePerSM[icut]) ;
2202 
2204  (Form("hMiOpAngleBin%d_ClusterMax_TimePerSM",icut),
2205  Form("mixed cluster pair higher #it{E}, pair %1.4f<#theta<%1.4f",fAngleCutBinsArray[icut],fAngleCutBinsArray[icut+1]),
2206  ntimebins,timemin,timemax,20,0,20);
2207  fhMiOpAngleBinMaxClusterTimePerSM[icut]->SetYTitle("SM");
2208  fhMiOpAngleBinMaxClusterTimePerSM[icut]->SetXTitle("#it{t} (ns)");
2209  outputContainer->Add(fhMiOpAngleBinMaxClusterTimePerSM[icut]) ;
2210 
2212  (Form("hMiOpAngleBin%d_ClusterMin_NCellPerSM",icut),
2213  Form("mixed cluster pair lower #it{E}, pair %1.4f<#theta<%1.4f",fAngleCutBinsArray[icut],fAngleCutBinsArray[icut+1]),
2214  30,0,30,20,0,20);
2215  fhMiOpAngleBinMinClusterNCellPerSM[icut]->SetYTitle("SM");
2216  fhMiOpAngleBinMinClusterNCellPerSM[icut]->SetXTitle("# cells");
2217  outputContainer->Add(fhMiOpAngleBinMinClusterNCellPerSM[icut]) ;
2218 
2220  (Form("hMiOpAngleBin%d_ClusterMax_NCellPerSM",icut),
2221  Form("mixed cluster pair higher #it{E}, pair %1.4f<#theta<%1.4f",fAngleCutBinsArray[icut],fAngleCutBinsArray[icut+1]),
2222  30,0,30,20,0,20);
2223  fhMiOpAngleBinMaxClusterNCellPerSM[icut]->SetYTitle("SM");
2224  fhMiOpAngleBinMaxClusterNCellPerSM[icut]->SetXTitle("# cells");
2225  outputContainer->Add(fhMiOpAngleBinMaxClusterNCellPerSM[icut]) ;
2226 
2228  (Form("hMiOpAngleBin%d_PairCluster_RatioPerSM",icut),
2229  Form("mixed cluster pair #it{E}_{high}/ #it{E}_{low}, pair %1.4f<#theta<%1.4f",fAngleCutBinsArray[icut],fAngleCutBinsArray[icut+1]),
2230  100,0,1,20,0,20);
2231  fhMiOpAngleBinPairClusterRatioPerSM[icut]->SetYTitle("SM");
2232  fhMiOpAngleBinPairClusterRatioPerSM[icut]->SetXTitle("#it{E}_{low}/ #it{E}_{high}");
2233  outputContainer->Add(fhMiOpAngleBinPairClusterRatioPerSM[icut]) ;
2234 
2236  (Form("hMiOpAngleBin%d_PairCluster_MassPerSM",icut),
2237  Form("cluster pair #it{M}, pair %1.4f<#theta<%1.4f",fAngleCutBinsArray[icut],fAngleCutBinsArray[icut+1]),
2238  nmassbins,massmin,massmax,20,0,20);
2239  fhMiOpAngleBinPairClusterMassPerSM[icut]->SetXTitle("#it{M} (GeV/#it{c}^2)");
2240  fhMiOpAngleBinPairClusterMassPerSM[icut]->SetYTitle("SM");
2241  outputContainer->Add(fhMiOpAngleBinPairClusterMassPerSM[icut]) ;
2242 
2244  (Form("hMiOpAngleBin%d_PairCluster_Mass",icut),
2245  Form("cluster pair #it{M}, pair %1.4f<#theta<%1.4f",fAngleCutBinsArray[icut],fAngleCutBinsArray[icut+1]),
2246  nptbins,ptmin,ptmax,nmassbins,massmin,massmax);
2247  fhMiOpAngleBinPairClusterMass[icut]->SetYTitle("#it{M} (GeV/#it{c}^2)");
2248  fhMiOpAngleBinPairClusterMass[icut]->SetXTitle("#it{p}_{T} GeV/#it{c}");
2249  outputContainer->Add(fhMiOpAngleBinPairClusterMass[icut]) ;
2250 
2251 // fhMiOpAngleBinPairClusterAbsIdMaxCell[icut] = new TH2F
2252 // (Form("hMiOpAngleBin%d_PairCluster_AbsIdCell",icut),
2253 // Form("mixed cluster pair Abs Cell ID low #it{E} vs high #it{E}, pair %1.4f<#theta<%1.4f",fAngleCutBinsArray[icut],fAngleCutBinsArray[icut+1]),
2254 // ntimebins,timemin,timemax,20,0,20);
2255 // fhMiOpAngleBinPairClusterRatioPerSM[icut]->SetYTitle("AbsId-higher");
2256 // fhMiOpAngleBinPairClusterRatioPerSM[icut]->SetXTitle("AbsId-lower");
2257 // outputContainer->Add(fhMiOpAngleBinPairClusterRatioPerSM[icut]) ;
2258  }
2259  } // angle bin
2260  }
2261 
2263  {
2264  TString mcGenNames[] = {"","_MC_Pi0Merged","_MC_Pi0Decay","_MC_EtaDecay","_MC_PhotonOther","_MC_Electron","_MC_Other"};
2265  TString mcGenTitle[] = {"",",MC Pi0-Merged",",MC Pi0-Decay",", MC Eta-Decay",", MC Photon other sources",", MC Electron",", MC other sources"};
2266 
2267  TString tagBkgNames[] = {
2268  "Clean", "HijingBkg", "NotHijingBkg", "HijingAndOtherBkg",
2269  "Clean_HijingBkg", "Clean_NotHijingBkg", "Clean_HijingAndOtherBkg",
2270  "HijingBkg_NotHijingBkg", "HijingBkg_HijingAndOtherBkg", "NotHijingBkg_HijingAndOtherBkg" } ;
2271  TString tagBkgTitle[] = {
2272  "no overlap", "pair Hijing Bkg", "pair not Hijing bkg", "pair Hijing and other bkg",
2273  "no overlap and hijing overlap", "no overlap and generator overlap", "no overlap and multiple overlap",
2274  "hijing overlap and gener overlap", "hijing overlap and multiple overlap", "gener overlap and multiple overlap" } ;
2275 
2276  for(Int_t igen = 0; igen < GetNCocktailGenNamesToCheck(); igen++)
2277  {
2278  TString add = "_MainGener_";
2279  if(igen==0)
2280  add = "";
2281  else
2282  {
2283  fhPrimPi0PtPerGenerator[igen-1] = new TH1F
2284  (Form("hPrimPi0Pt%s%s",add.Data(),GetCocktailGenNameToCheck(igen).Data()),
2285  Form("Primary #pi^{0} #it{p}_{T}, |#it{Y}| < 1, generator %s",GetCocktailGenNameToCheck(igen).Data()),
2286  nptbins,ptmin,ptmax) ;
2287  fhPrimPi0PtPerGenerator[igen-1] ->SetXTitle("#it{p}_{T} (GeV/#it{c})");
2288  outputContainer->Add(fhPrimPi0PtPerGenerator[igen-1]) ;
2289 
2290  fhPrimPi0YPerGenerator[igen-1] = new TH2F
2291  (Form("hPrimPi0Rapidity%s%s",add.Data(),GetCocktailGenNameToCheck(igen).Data()),
2292  Form("Rapidity of primary #pi^{0}, generator %s",GetCocktailGenNameToCheck(igen).Data()),
2293  nptbins,ptmin,ptmax,netabinsopen,-2, 2) ;
2294  fhPrimPi0YPerGenerator[igen-1] ->SetYTitle("#it{Rapidity}");
2295  fhPrimPi0YPerGenerator[igen-1] ->SetXTitle("#it{p}_{T} (GeV/#it{c})");
2296  outputContainer->Add(fhPrimPi0YPerGenerator[igen-1]) ;
2297 
2298  fhPrimPi0PhiPerGenerator[igen-1] = new TH2F
2299  (Form("hPrimPi0Phi%s%s",add.Data(),GetCocktailGenNameToCheck(igen).Data()),
2300  Form("#varphi of primary #pi^{0}, |#it{Y}|<1, generator %s",GetCocktailGenNameToCheck(igen).Data()),
2301  nptbins,ptmin,ptmax,nphibinsopen,0,360) ;
2302  fhPrimPi0PhiPerGenerator[igen-1]->SetYTitle("#varphi (deg)");
2303  fhPrimPi0PhiPerGenerator[igen-1]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
2304  outputContainer->Add(fhPrimPi0PhiPerGenerator[igen-1]) ;
2305 
2307  {
2308  fhPrimPi0PtInCaloPerGenerator[igen-1] = new TH1F
2309  (Form("hPrimPi0PtInCalo%s%s",add.Data(),GetCocktailGenNameToCheck(igen).Data()),
2310  Form("Primary #pi^{0} #it{p}_{T}, in calorimeter acc. %s",GetCocktailGenNameToCheck(igen).Data()),
2311  nptbins,ptmin,ptmax) ;
2312  fhPrimPi0PtInCaloPerGenerator[igen-1] ->SetXTitle("#it{p}_{T} (GeV/#it{c})");
2313  outputContainer->Add(fhPrimPi0PtInCaloPerGenerator[igen-1]) ;
2314 
2315  fhPrimPi0AccPtPerGenerator[igen-1] = new TH1F
2316  (Form("hPrimPi0AccPt%s%s",add.Data(),GetCocktailGenNameToCheck(igen).Data()),
2317  Form("Primary #pi^{0} #it{p}_{T} with both photons in acceptance, generator %s",GetCocktailGenNameToCheck(igen).Data()),
2318  nptbins,ptmin,ptmax) ;
2319  fhPrimPi0AccPtPerGenerator[igen-1]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
2320  outputContainer->Add(fhPrimPi0AccPtPerGenerator[igen-1]) ;
2321 
2322  fhPrimPi0AccPtPhotonCutsPerGenerator[igen-1] = new TH1F
2323  (Form("hPrimPi0AccPtPhotonCuts%s%s",add.Data(),GetCocktailGenNameToCheck(igen).Data()),
2324  Form("Primary #pi^{0} #it{p}_{T} with both photons in acceptance, generator %s",GetCocktailGenNameToCheck(igen).Data()),
2325  nptbins,ptmin,ptmax) ;
2326  fhPrimPi0AccPtPhotonCutsPerGenerator[igen-1]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
2327  outputContainer->Add(fhPrimPi0AccPtPhotonCutsPerGenerator[igen-1]) ;
2328  }
2329 
2330  //
2331 
2332  fhPrimEtaPtPerGenerator[igen-1] = new TH1F
2333  (Form("hPrimEtaPt%s%s",add.Data(),GetCocktailGenNameToCheck(igen).Data()),
2334  Form("Primary #eta #it{p}_{T}, |#it{Y}| < 1, generator %s",GetCocktailGenNameToCheck(igen).Data()),
2335  nptbins,ptmin,ptmax) ;
2336  fhPrimEtaPtPerGenerator[igen-1] ->SetXTitle("#it{p}_{T} (GeV/#it{c})");
2337  outputContainer->Add(fhPrimEtaPtPerGenerator[igen-1]) ;
2338 
2339  Int_t netabinsopen = TMath::Nint(netabins*4/(etamax-etamin));
2340  fhPrimEtaYPerGenerator[igen-1] = new TH2F
2341  (Form("hPrimEtaRapidity%s%s",add.Data(),GetCocktailGenNameToCheck(igen).Data()),
2342  Form("Rapidity of primary #eta, generator %s",GetCocktailGenNameToCheck(igen).Data()),
2343  nptbins,ptmin,ptmax,netabinsopen,-2, 2) ;
2344  fhPrimEtaYPerGenerator[igen-1] ->SetYTitle("#it{Rapidity}");
2345  fhPrimEtaYPerGenerator[igen-1] ->SetXTitle("#it{p}_{T} (GeV/#it{c})");
2346  outputContainer->Add(fhPrimEtaYPerGenerator[igen-1]) ;
2347 
2348  fhPrimEtaPhiPerGenerator[igen-1] = new TH2F
2349  (Form("hPrimEtaPhi%s%s",add.Data(),GetCocktailGenNameToCheck(igen).Data()),
2350  Form("#varphi of primary #eta, |#it{Y}|<1, generator %s",GetCocktailGenNameToCheck(igen).Data()),
2351  nptbins,ptmin,ptmax,nphibinsopen,0,360) ;
2352  fhPrimEtaPhiPerGenerator[igen-1]->SetYTitle("#varphi (deg)");
2353  fhPrimEtaPhiPerGenerator[igen-1]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
2354  outputContainer->Add(fhPrimEtaPhiPerGenerator[igen-1]) ;
2355 
2357  {
2358  fhPrimEtaPtInCaloPerGenerator[igen-1] = new TH1F
2359  (Form("hPrimEtaPtInCalo%s%s",add.Data(),GetCocktailGenNameToCheck(igen).Data()),
2360  Form("Primary #eta #it{p}_{T}, in calorimeter acceptance %s",GetCocktailGenNameToCheck(igen).Data()),
2361  nptbins,ptmin,ptmax) ;
2362  fhPrimEtaPtInCaloPerGenerator[igen-1] ->SetXTitle("#it{p}_{T} (GeV/#it{c})");
2363  outputContainer->Add(fhPrimEtaPtInCaloPerGenerator[igen-1]) ;
2364 
2365  fhPrimEtaAccPtPerGenerator[igen-1] = new TH1F
2366  (Form("hPrimEtaAccPt%s%s",add.Data(),GetCocktailGenNameToCheck(igen).Data()),
2367  Form("Primary #eta #it{p}_{T} with both photons in acceptance, generator %s",GetCocktailGenNameToCheck(igen).Data()),
2368  nptbins,ptmin,ptmax) ;
2369  fhPrimEtaAccPtPerGenerator[igen-1]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
2370  outputContainer->Add(fhPrimEtaAccPtPerGenerator[igen-1]) ;
2371 
2372  fhPrimEtaAccPtPhotonCutsPerGenerator[igen-1] = new TH1F
2373  (Form("hPrimEtaAccPtPhotonCuts%s%s",add.Data(),GetCocktailGenNameToCheck(igen).Data()),
2374  Form("Primary #eta #it{p}_{T} with both photons in acceptance, generator %s",GetCocktailGenNameToCheck(igen).Data()),
2375  nptbins,ptmin,ptmax) ;
2376  fhPrimEtaAccPtPhotonCutsPerGenerator[igen-1]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
2377  outputContainer->Add(fhPrimEtaAccPtPhotonCutsPerGenerator[igen-1]) ;
2378  }
2379 
2380  }
2381 
2382  for(Int_t itag = 0; itag < 10; itag++)
2383  {
2384  fhPairGeneratorsBkgMass[igen][itag] = new TH2F
2385  (Form("h%sGeneratorPairMass%s%s",
2386  tagBkgNames[itag].Data(),add.Data(),GetCocktailGenNameToCheck(igen).Data()),
2387  Form("Pair Mass with generator%s, %s ",
2388  GetCocktailGenNameToCheck(igen).Data(),tagBkgTitle[itag].Data()),
2389  nptbins,ptmin,ptmax,nmassbins,massmin,massmax);
2390  fhPairGeneratorsBkgMass[igen][itag]->SetYTitle("#it{M} (MeV/#it{c}^{2})");
2391  fhPairGeneratorsBkgMass[igen][itag]->SetXTitle("#it{E}_{reco} (GeV)");
2392  outputContainer->Add(fhPairGeneratorsBkgMass[igen][itag]) ;
2393 
2394  fhPairGeneratorsBkgMassMCPi0[igen][itag] = new TH2F
2395  (Form("h%sGeneratorPairMass%s%s_MCPi0",
2396  tagBkgNames[itag].Data(),add.Data(),GetCocktailGenNameToCheck(igen).Data()),
2397  Form("Pair Mass with contribution of true #pi^{0} generator%s, %s ",
2398  GetCocktailGenNameToCheck(igen).Data(),tagBkgTitle[itag].Data()),
2399  nptbins,ptmin,ptmax,nmassbins,massmin,massmax);
2400  fhPairGeneratorsBkgMassMCPi0[igen][itag]->SetYTitle("#it{M} (MeV/#it{c}^{2})");
2401  fhPairGeneratorsBkgMassMCPi0[igen][itag]->SetXTitle("#it{E}_{reco} (GeV)");
2402  outputContainer->Add(fhPairGeneratorsBkgMassMCPi0[igen][itag]) ;
2403 
2404  fhPairGeneratorsBkgMassMCEta[igen][itag] = new TH2F
2405  (Form("h%sGeneratorPairMass%s%s_MCEta",
2406  tagBkgNames[itag].Data(),add.Data(),GetCocktailGenNameToCheck(igen).Data()),
2407  Form("Pair Mass with contribution of true #eta generator%s, %s ",
2408  GetCocktailGenNameToCheck(igen).Data(),tagBkgTitle[itag].Data()),
2409  nptbins,ptmin,ptmax,nmassbins,massmin,massmax);
2410  fhPairGeneratorsBkgMassMCEta[igen][itag]->SetYTitle("#it{M} (MeV/#it{c}^{2})");
2411  fhPairGeneratorsBkgMassMCEta[igen][itag]->SetXTitle("#it{E}_{reco} (GeV)");
2412  outputContainer->Add(fhPairGeneratorsBkgMassMCEta[igen][itag]) ;
2413 
2415  {
2416  fhPairGeneratorsBkgCentMCPi0[igen][itag] = new TH2F
2417  (Form("h%sGeneratorPairCent%s%s_MCPi0",
2418  tagBkgNames[itag].Data(),add.Data(),GetCocktailGenNameToCheck(igen).Data()),
2419  Form("Pair Mass with contribution of true #pi^{0} generator%s, %s ",
2420  GetCocktailGenNameToCheck(igen).Data(),tagBkgTitle[itag].Data()),
2421  nptbins,ptmin,ptmax,100,0,100);
2422  fhPairGeneratorsBkgCentMCPi0[igen][itag]->SetYTitle("Centrality");
2423  fhPairGeneratorsBkgCentMCPi0[igen][itag]->SetXTitle("#it{E}_{reco} (GeV)");
2424  outputContainer->Add(fhPairGeneratorsBkgCentMCPi0[igen][itag]) ;
2425 
2426  fhPairGeneratorsBkgCentMCPi0MassCut[igen][itag] = new TH2F
2427  (Form("h%sGeneratorPairCent%s%s_MCPi0_MassCut",
2428  tagBkgNames[itag].Data(),add.Data(),GetCocktailGenNameToCheck(igen).Data()),
2429  Form("Pair Mass with contribution of true #pi^{0} generator%s, %s, %2.2f<M<%2.2f",
2430  GetCocktailGenNameToCheck(igen).Data(),tagBkgTitle[itag].Data(),fPi0MassWindow[0],fPi0MassWindow[1]),
2431  nptbins,ptmin,ptmax,100,0,100);
2432  fhPairGeneratorsBkgCentMCPi0MassCut[igen][itag]->SetYTitle("Centrality");
2433  fhPairGeneratorsBkgCentMCPi0MassCut[igen][itag]->SetXTitle("#it{E}_{reco} (GeV)");
2434  outputContainer->Add(fhPairGeneratorsBkgCentMCPi0MassCut[igen][itag]) ;
2435 
2436  fhPairGeneratorsBkgCentMCEta[igen][itag] = new TH2F
2437  (Form("h%sGeneratorPairCent%s%s_MCEta",
2438  tagBkgNames[itag].Data(),add.Data(),GetCocktailGenNameToCheck(igen).Data()),
2439  Form("Pair Mass with contribution of true #eta generator%s, %s ",
2440  GetCocktailGenNameToCheck(igen).Data(),tagBkgTitle[itag].Data()),
2441  nptbins,ptmin,ptmax,100,0,100);
2442  fhPairGeneratorsBkgCentMCEta[igen][itag]->SetYTitle("Centrality");
2443  fhPairGeneratorsBkgCentMCEta[igen][itag]->SetXTitle("#it{E}_{reco} (GeV)");
2444  outputContainer->Add(fhPairGeneratorsBkgCentMCEta[igen][itag]) ;
2445 
2446  fhPairGeneratorsBkgCentMCEtaMassCut[igen][itag] = new TH2F
2447  (Form("h%sGeneratorPairCent%s%s_MCEta_MassCut",
2448  tagBkgNames[itag].Data(),add.Data(),GetCocktailGenNameToCheck(igen).Data()),
2449  Form("Pair Mass with contribution of true #eta generator%s, %s, %2.2f<M<%2.2f",
2450  GetCocktailGenNameToCheck(igen).Data(),tagBkgTitle[itag].Data(),fEtaMassWindow[0],fEtaMassWindow[1]),
2451  nptbins,ptmin,ptmax,100,0,100);
2452  fhPairGeneratorsBkgCentMCEtaMassCut[igen][itag]->SetYTitle("Centrality");
2453  fhPairGeneratorsBkgCentMCEtaMassCut[igen][itag]->SetXTitle("#it{E}_{reco} (GeV)");
2454  outputContainer->Add(fhPairGeneratorsBkgCentMCEtaMassCut[igen][itag]) ;
2455  }
2456 
2458  (Form("h%sGeneratorPairEPrimRecoRatio%s%s_MCPi0",
2459  tagBkgNames[itag].Data(),add.Data(),GetCocktailGenNameToCheck(igen).Data()),
2460  Form("#it{E}_{reco}/#it{E}_{gen} pair with contribution of true #pi^{0} generator%s, %s ",
2461  GetCocktailGenNameToCheck(igen).Data(),tagBkgTitle[itag].Data()),
2462  nptbins,ptmin,ptmax,nratbins,ratmin,ratmax);
2463  fhPairGeneratorsBkgEPrimRecoRatioMCPi0[igen][itag]->SetYTitle("#it{E}_{reco}/#it{E}_{gen}");
2464  fhPairGeneratorsBkgEPrimRecoRatioMCPi0[igen][itag]->SetXTitle("#it{E}_{reco} (GeV)");
2465  outputContainer->Add(fhPairGeneratorsBkgEPrimRecoRatioMCPi0[igen][itag]) ;
2466 
2468  (Form("h%sGeneratorPairEPrimRecoRatio%s%s_MCEta",
2469  tagBkgNames[itag].Data(),add.Data(),GetCocktailGenNameToCheck(igen).Data()),
2470  Form("#it{E}_{reco}/#it{E}_{gen} pair with contribution of true #eta generator%s, %s ",
2471  GetCocktailGenNameToCheck(igen).Data(),tagBkgTitle[itag].Data()),
2472  nptbins,ptmin,ptmax,nratbins,ratmin,ratmax);
2473  fhPairGeneratorsBkgEPrimRecoRatioMCEta[igen][itag]->SetYTitle("#it{E}_{reco}/#it{E}_{gen}");
2474  fhPairGeneratorsBkgEPrimRecoRatioMCEta[igen][itag]->SetXTitle("#it{E}_{reco} (GeV)");
2475  outputContainer->Add(fhPairGeneratorsBkgEPrimRecoRatioMCEta[igen][itag]) ;
2476 
2478  (Form("h%sGeneratorPairEPrimRecoDiff%s%s_MCPi0",
2479  tagBkgNames[itag].Data(),add.Data(),GetCocktailGenNameToCheck(igen).Data()),
2480  Form("#it{E}_{reco}-#it{E}_{gen} pair with contribution of true #pi^{0} generator%s, %s ",
2481  GetCocktailGenNameToCheck(igen).Data(),tagBkgTitle[itag].Data()),
2482  nptbins,ptmin,ptmax,ndifbins,difmin,difmax);
2483  fhPairGeneratorsBkgEPrimRecoDiffMCPi0[igen][itag]->SetYTitle("#it{E}_{reco}-#it{E}_{gen} (GeV)");
2484  fhPairGeneratorsBkgEPrimRecoDiffMCPi0[igen][itag]->SetXTitle("#it{E}_{reco} (GeV)");
2485  outputContainer->Add(fhPairGeneratorsBkgEPrimRecoDiffMCPi0[igen][itag]) ;
2486 
2488  (Form("h%sGeneratorPairEPrimRecoDiff%s%s_MCEta",
2489  tagBkgNames[itag].Data(),add.Data(),GetCocktailGenNameToCheck(igen).Data()),
2490  Form("#it{E}_{reco}-#it{E}_{gen} pair with contribution of true #eta generator%s, %s ",
2491  GetCocktailGenNameToCheck(igen).Data(),tagBkgTitle[itag].Data()),
2492  nptbins,ptmin,ptmax,ndifbins,difmin,difmax);
2493  fhPairGeneratorsBkgEPrimRecoDiffMCEta[igen][itag]->SetYTitle("#it{E}_{reco}-#it{E}_{gen} (GeV)");
2494  fhPairGeneratorsBkgEPrimRecoDiffMCEta[igen][itag]->SetXTitle("#it{E}_{reco} (GeV)");
2495  outputContainer->Add(fhPairGeneratorsBkgEPrimRecoDiffMCEta[igen][itag]) ;
2496 
2498  (Form("h%sGeneratorPairEPrimRecoRatio%s%s_MCPi0MassCut",
2499  tagBkgNames[itag].Data(),add.Data(),GetCocktailGenNameToCheck(igen).Data()),
2500  Form("#it{E}_{reco}/#it{E}_{gen} pair with contribution of true #pi^{0} generator%s, %s ",
2501  GetCocktailGenNameToCheck(igen).Data(),tagBkgTitle[itag].Data()),
2502  nptbins,ptmin,ptmax,nratbins,ratmin,ratmax);
2503  fhPairGeneratorsBkgEPrimRecoRatioMCPi0MassCut[igen][itag]->SetYTitle("#it{E}_{reco}/#it{E}_{gen}");
2504  fhPairGeneratorsBkgEPrimRecoRatioMCPi0MassCut[igen][itag]->SetXTitle("#it{E}_{reco} (GeV)");
2505  outputContainer->Add(fhPairGeneratorsBkgEPrimRecoRatioMCPi0MassCut[igen][itag]) ;
2506 
2508  (Form("h%sGeneratorPairEPrimRecoRatio%s%s_MCEtaMassCut",
2509  tagBkgNames[itag].Data(),add.Data(),GetCocktailGenNameToCheck(igen).Data()),
2510  Form("#it{E}_{reco}/#it{E}_{gen} pair with contribution of true #eta generator%s, %s ",
2511  GetCocktailGenNameToCheck(igen).Data(),tagBkgTitle[itag].Data()),
2512  nptbins,ptmin,ptmax,nratbins,ratmin,ratmax);
2513  fhPairGeneratorsBkgEPrimRecoRatioMCEtaMassCut[igen][itag]->SetYTitle("#it{E}_{reco}/#it{E}_{gen}");
2514  fhPairGeneratorsBkgEPrimRecoRatioMCEtaMassCut[igen][itag]->SetXTitle("#it{E}_{reco} (GeV)");
2515  outputContainer->Add(fhPairGeneratorsBkgEPrimRecoRatioMCEtaMassCut[igen][itag]) ;
2516 
2518  (Form("h%sGeneratorPairEPrimRecoDiff%s%s_MCPi0MassCut",
2519  tagBkgNames[itag].Data(),add.Data(),GetCocktailGenNameToCheck(igen).Data()),
2520  Form("#it{E}_{reco}-#it{E}_{gen} pair with contribution of true #pi^{0} generator%s, %s ",
2521  GetCocktailGenNameToCheck(igen).Data(),tagBkgTitle[itag].Data()),
2522  nptbins,ptmin,ptmax,ndifbins,difmin,difmax);
2523  fhPairGeneratorsBkgEPrimRecoDiffMCPi0MassCut[igen][itag]->SetYTitle("#it{E}_{reco}-#it{E}_{gen} (GeV)");
2524  fhPairGeneratorsBkgEPrimRecoDiffMCPi0MassCut[igen][itag]->SetXTitle("#it{E}_{reco} (GeV)");
2525  outputContainer->Add(fhPairGeneratorsBkgEPrimRecoDiffMCPi0MassCut[igen][itag]) ;
2526 
2528  (Form("h%sGeneratorPairEPrimRecoDiff%s%s_MCEtaMassCut",
2529  tagBkgNames[itag].Data(),add.Data(),GetCocktailGenNameToCheck(igen).Data()),
2530  Form("#it{E}_{reco}-#it{E}_{gen} pair with contribution of true #eta generator%s, %s ",
2531  GetCocktailGenNameToCheck(igen).Data(),tagBkgTitle[itag].Data()),
2532  nptbins,ptmin,ptmax,ndifbins,difmin,difmax);
2533  fhPairGeneratorsBkgEPrimRecoDiffMCEtaMassCut[igen][itag]->SetYTitle("#it{E}_{reco}-#it{E}_{gen} (GeV)");
2534  fhPairGeneratorsBkgEPrimRecoDiffMCEtaMassCut[igen][itag]->SetXTitle("#it{E}_{reco} (GeV)");
2535  outputContainer->Add(fhPairGeneratorsBkgEPrimRecoDiffMCEtaMassCut[igen][itag]) ;
2536  }
2537  }
2538  }
2539 
2540 // for(Int_t i = 0; i < outputContainer->GetEntries() ; i++)
2541 // {
2542 // printf("Histogram %d, name: %s\n",i, outputContainer->At(i)->GetName());
2543 // }
2544 
2545  return outputContainer;
2546 }
2547 
2548 //___________________________________________________
2550 //___________________________________________________
2551 void AliAnaPi0::Print(const Option_t * /*opt*/) const
2552 {
2553  printf("**** Print %s %s ****\n", GetName(), GetTitle() ) ;
2555 
2556  printf("Number of bins in Centrality: %d \n",GetNCentrBin()) ;
2557  printf("Number of bins in Z vert. pos: %d \n",GetNZvertBin()) ;
2558  printf("Number of bins in Reac. Plain: %d \n",GetNRPBin()) ;
2559  printf("Depth of event buffer: %d \n",GetNMaxEvMix()) ;
2560  printf("Pair in same Module: %d \n",fSameSM) ;
2561  printf("Cuts: \n") ;
2562  // printf("Z vertex position: -%2.3f < z < %2.3f \n",GetZvertexCut(),GetZvertexCut()) ; //It crashes here, why?
2563  printf("Number of modules: %d \n",fNModules) ;
2564  printf("Select pairs with their angle: %d, edep %d, min angle %2.3f, max angle %2.3f \n",fUseAngleCut, fUseAngleEDepCut, fAngleCut, fAngleMaxCut) ;
2565  printf("Asymmetry cuts: n = %d, \n",fNAsymCuts) ;
2566  printf("\tasymmetry < ");
2567  for(Int_t i = 0; i < fNAsymCuts; i++) printf("%2.2f ",fAsymCuts[i]);
2568  printf("\n");
2569 
2570  printf("PID selection bits: n = %d, \n",fNPIDBits) ;
2571  printf("\tPID bit = ");
2572  for(Int_t i = 0; i < fNPIDBits; i++) printf("%d ",fPIDBits[i]);
2573  printf("\n");
2574 
2576  {
2577  printf("pT cuts: n = %d, \n",fNPtCuts) ;
2578  printf("\tpT > ");
2579  for(Int_t i = 0; i < fNPtCuts; i++) printf("%2.2f ",fPtCuts[i]);
2580  printf("GeV/c\n");
2581  printf("\tpT < ");
2582  for(Int_t i = 0; i < fNPtCuts; i++) printf("%2.2f ",fPtCutsMax[i]);
2583  printf("GeV/c\n");
2584 
2585  printf("N cell in cluster cuts: n = %d, \n",fNCellNCuts) ;
2586  printf("\tnCell > ");
2587  for(Int_t i = 0; i < fNCellNCuts; i++) printf("%d ",fCellNCuts[i]);
2588  printf("\n");
2589 
2590  }
2591  printf("------------------------------------------------------\n") ;
2592 }
2593 
2594 //________________________________________
2596 //________________________________________
2598 {
2599  if ( !GetMC() ) return;
2600 
2601  Double_t mesonY = -100 ;
2602  Double_t mesonE = -1 ;
2603  Double_t mesonPt = -1 ;
2604  Double_t mesonPhi = 100 ;
2605  Double_t mesonYeta= -1 ;
2606 
2607  Int_t pdg = 0 ;
2608  Int_t nprim = GetMC()->GetNumberOfTracks();
2609  Int_t nDaught = 0 ;
2610  Int_t iphot1 = 0 ;
2611  Int_t iphot2 = 0 ;
2612 
2613  Float_t cen = GetEventCentrality();
2614  Float_t ep = GetEventPlaneAngle();
2615 
2616  AliVParticle * primary = 0;
2617 
2618  TString genName = "";
2619 
2620  for(Int_t i=0 ; i < nprim; i++)
2621  {
2622  if ( !GetReader()->AcceptParticleMCLabel( i ) ) continue ;
2623 
2624  primary = GetMC()->GetTrack(i) ;
2625  if(!primary)
2626  {
2627  AliWarning("Primaries pointer not available!!");
2628  continue;
2629  }
2630 
2631  // If too small skip
2632  if( primary->E() < 0.4 ) continue;
2633 
2634  pdg = primary->PdgCode();
2635  // Select only pi0 or eta
2636  if( pdg != 111 && pdg != 221) continue ;
2637 
2638  nDaught = primary->GetNDaughters();
2639  iphot1 = primary->GetDaughterLabel(0) ;
2640  iphot2 = primary->GetDaughterLabel(1) ;
2641 
2642  // Protection against floating point exception
2643  if ( primary->E() == TMath::Abs(primary->Pz()) ||
2644  (primary->E() - primary->Pz()) < 1e-3 ||
2645  (primary->E() + primary->Pz()) < 0 ) continue ;
2646 
2647  //printf("i %d, %s %d %s %d \n",i, GetMC()->Particle(i)->GetName(), GetMC()->Particle(i)->GetPdgCode(),
2648  // prim->GetName(), prim->GetPdgCode());
2649 
2650  //Photon kinematics
2651  primary->Momentum(fMCPrimMesonMom);
2652 
2653  mesonY = 0.5*TMath::Log((primary->E()+primary->Pz())/(primary->E()-primary->Pz())) ;
2654 
2655  Bool_t inacceptance = kTRUE;
2657  {
2658  // Check if pi0 enters the calo
2659  if(IsRealCaloAcceptanceOn() && !GetCaloUtils()->IsMCParticleInCalorimeterAcceptance( GetCalorimeter(), primary )) inacceptance = kFALSE;
2660  if(IsFiducialCutOn() && inacceptance && !GetFiducialCut()->IsInFiducialCut(fMCPrimMesonMom.Eta(), fMCPrimMesonMom.Phi(), GetCalorimeter())) inacceptance = kFALSE;
2661  }
2662  else inacceptance = kFALSE;
2663 
2664  mesonPt = fMCPrimMesonMom.Pt () ;
2665  mesonE = fMCPrimMesonMom.E () ;
2666  mesonYeta= fMCPrimMesonMom.Eta() ;
2667  mesonPhi = fMCPrimMesonMom.Phi() ;
2668  if( mesonPhi < 0 ) mesonPhi+=TMath::TwoPi();
2669  mesonPhi *= TMath::RadToDeg();
2670 
2672  Int_t genType = GetNCocktailGenNamesToCheck()-2; // bin 0 is not null
2673  Int_t index = GetReader()->GetCocktailGeneratorAndIndex(i, genName);
2674  //(GetMC())->GetCocktailGenerator(i,genName);
2675 
2676  Float_t weightPt = GetParticlePtWeight(mesonPt, pdg, genName, index) ;
2677 
2679  {
2680  for(Int_t igen = 1; igen < GetNCocktailGenNamesToCheck(); igen++)
2681  {
2682  if ( GetCocktailGenNameToCheck(igen).Contains(genName) &&
2683  ( GetCocktailGenIndexToCheck(igen) < 0 || index == GetCocktailGenIndexToCheck(igen)) )
2684  {
2685  genType = igen-1;
2686  break;
2687  }
2688  }
2689  }
2690 
2692  if(pdg == 111)
2693  {
2694  if(TMath::Abs(mesonY) < 1.0)
2695  {
2696  fhPrimPi0E ->Fill(mesonE , GetEventWeight()*weightPt) ;
2697  fhPrimPi0Pt ->Fill(mesonPt, GetEventWeight()*weightPt) ;
2698  fhPrimPi0Phi->Fill(mesonPt, mesonPhi, GetEventWeight()*weightPt) ;
2699 
2700  fhPrimPi0YetaYcut->Fill(mesonPt, mesonYeta, GetEventWeight()*weightPt) ;
2701 
2703  {
2704  fhPrimPi0PtPerGenerator [genType]->Fill(mesonPt, GetEventWeight()*weightPt) ;
2705  fhPrimPi0PhiPerGenerator[genType]->Fill(mesonPt, mesonPhi, GetEventWeight()*weightPt) ;
2706  }
2707 
2709  {
2710  fhPrimPi0PtCentrality->Fill(mesonPt, cen, GetEventWeight()*weightPt) ;
2711  fhPrimPi0PtEventPlane->Fill(mesonPt, ep , GetEventWeight()*weightPt) ;
2712  }
2713  }
2714 
2715  fhPrimPi0Y ->Fill(mesonPt, mesonY , GetEventWeight()*weightPt) ;
2716  fhPrimPi0Yeta->Fill(mesonPt, mesonYeta, GetEventWeight()*weightPt) ;
2717 
2718  if(inacceptance) fhPrimPi0PtInCalo->Fill(mesonPt,GetEventWeight()*weightPt);
2719 
2721  {
2722  fhPrimPi0YPerGenerator[genType]->Fill(mesonPt, mesonY, GetEventWeight()*weightPt) ;
2723  if(inacceptance) fhPrimPi0PtInCaloPerGenerator[genType]->Fill(mesonPt,GetEventWeight()*weightPt);
2724  }
2725  }
2726  else if(pdg == 221)
2727  {
2728  if(TMath::Abs(mesonY) < 1.0)
2729  {
2730  fhPrimEtaE ->Fill(mesonE , GetEventWeight()*weightPt) ;
2731  fhPrimEtaPt ->Fill(mesonPt, GetEventWeight()*weightPt) ;
2732  fhPrimEtaPhi->Fill(mesonPt, mesonPhi, GetEventWeight()*weightPt) ;
2733 
2735  {
2736  fhPrimEtaPtPerGenerator [genType]->Fill(mesonPt, GetEventWeight()*weightPt) ;
2737  fhPrimEtaPhiPerGenerator[genType]->Fill(mesonPt, mesonPhi, GetEventWeight()*weightPt) ;
2738  }
2739 
2740  fhPrimEtaYetaYcut->Fill(mesonPt, mesonYeta, GetEventWeight()*weightPt) ;
2741 
2743  {
2744  fhPrimEtaPtCentrality->Fill(mesonPt, cen, GetEventWeight()*weightPt) ;
2745  fhPrimEtaPtEventPlane->Fill(mesonPt, ep , GetEventWeight()*weightPt) ;
2746  }
2747  }
2748 
2749  fhPrimEtaY ->Fill(mesonPt, mesonY , GetEventWeight()*weightPt) ;
2750  fhPrimEtaYeta->Fill(mesonPt, mesonYeta, GetEventWeight()*weightPt) ;
2751 
2752  if(inacceptance) fhPrimEtaPtInCalo->Fill(mesonPt,GetEventWeight()*weightPt);
2753 
2755  {
2756  fhPrimEtaYPerGenerator[genType]->Fill(mesonPt, mesonY, GetEventWeight()*weightPt) ;
2757  if(inacceptance) fhPrimEtaPtInCaloPerGenerator[genType]->Fill(mesonPt,GetEventWeight()*weightPt);
2758  }
2759  }
2760 
2761  // Origin of meson
2762  if(fFillOriginHisto && TMath::Abs(mesonY) < 0.7)
2763  {
2764  Int_t momindex = primary->GetMother();
2765  Int_t mompdg = -1;
2766  Int_t momstatus = -1;
2767  Int_t status = -1;
2768  Float_t momR = 0;
2769 
2770  if(momindex >= 0 && momindex < nprim)
2771  {
2772  status = primary->MCStatusCode();
2773  AliVParticle* mother = GetMC()->GetTrack(momindex);
2774  mompdg = TMath::Abs(mother->PdgCode());
2775  momstatus = mother->MCStatusCode();
2776  //momR = mother->R();
2777  momR = TMath::Sqrt(mother->Xv()*mother->Xv()+mother->Yv()*mother->Yv());
2778 
2779  if(pdg == 111)
2780  {
2781  fhPrimPi0ProdVertex->Fill(mesonPt, momR , GetEventWeight()*weightPt);
2782  fhPrimPi0PtStatus ->Fill(mesonPt, status, GetEventWeight()*weightPt);
2783 
2784 
2785  if (momstatus == 21) fhPrimPi0PtOrigin->Fill(mesonPt, 0.5, GetEventWeight()*weightPt);//parton
2786  else if(mompdg < 22 ) fhPrimPi0PtOrigin->Fill(mesonPt, 1.5, GetEventWeight()*weightPt);//quark
2787  else if(mompdg > 2100 && mompdg < 2210)
2788  fhPrimPi0PtOrigin->Fill(mesonPt, 2.5, GetEventWeight()*weightPt);// resonances
2789  else if(mompdg == 221) fhPrimPi0PtOrigin->Fill(mesonPt, 8.5, GetEventWeight()*weightPt);//eta
2790  else if(mompdg == 331) fhPrimPi0PtOrigin->Fill(mesonPt, 9.5, GetEventWeight()*weightPt);//eta prime
2791  else if(mompdg == 213) fhPrimPi0PtOrigin->Fill(mesonPt, 4.5, GetEventWeight()*weightPt);//rho
2792  else if(mompdg == 223) fhPrimPi0PtOrigin->Fill(mesonPt, 5.5, GetEventWeight()*weightPt);//omega
2793  else if(mompdg >= 310 && mompdg <= 323)
2794  fhPrimPi0PtOrigin->Fill(mesonPt, 6.5, GetEventWeight()*weightPt);//k0S, k+-,k*
2795  else if(mompdg == 130) fhPrimPi0PtOrigin->Fill(mesonPt, 6.5, GetEventWeight()*weightPt);//k0L
2796  else if(momstatus == 11 || momstatus == 12 )
2797  fhPrimPi0PtOrigin->Fill(mesonPt, 3.5, GetEventWeight()*weightPt);//resonances
2798  else fhPrimPi0PtOrigin->Fill(mesonPt, 7.5, GetEventWeight()*weightPt);//other?
2799 
2800  //printf("Prim Pi0: index %d, pt %2.2f Prod vertex %3.3f, origin pdg %d, origin status %d, origin UI %d\n",
2801  // momindex, mesonPt,mother->R(),mompdg,momstatus,mother->GetUniqueID());
2802 
2803  if(status!=11)
2804  {
2805  if (momstatus == 21) fhPrimNotResonancePi0PtOrigin->Fill(mesonPt, 0.5, GetEventWeight()*weightPt);//parton
2806  else if(mompdg < 22 ) fhPrimNotResonancePi0PtOrigin->Fill(mesonPt, 1.5, GetEventWeight()*weightPt);//quark
2807  else if(mompdg > 2100 && mompdg < 2210)
2808  fhPrimNotResonancePi0PtOrigin->Fill(mesonPt, 2.5, GetEventWeight()*weightPt);// resonances
2809  else if(mompdg == 221) fhPrimNotResonancePi0PtOrigin->Fill(mesonPt, 8.5, GetEventWeight()*weightPt);//eta
2810  else if(mompdg == 331) fhPrimNotResonancePi0PtOrigin->Fill(mesonPt, 9.5, GetEventWeight()*weightPt);//eta prime
2811  else if(mompdg == 213) fhPrimNotResonancePi0PtOrigin->Fill(mesonPt, 4.5, GetEventWeight()*weightPt);//rho
2812  else if(mompdg == 223) fhPrimNotResonancePi0PtOrigin->Fill(mesonPt, 5.5, GetEventWeight()*weightPt);//omega
2813  else if(mompdg >= 310 && mompdg <= 323)
2814  fhPrimNotResonancePi0PtOrigin->Fill(mesonPt, 6.5, GetEventWeight()*weightPt);//k0S, k+-,k*
2815  else if(mompdg == 130) fhPrimNotResonancePi0PtOrigin->Fill(mesonPt, 6.5, GetEventWeight()*weightPt);//k0L
2816  else if(momstatus == 11 || momstatus == 12 )
2817  fhPrimNotResonancePi0PtOrigin->Fill(mesonPt, 3.5, GetEventWeight()*weightPt);//resonances
2818  else fhPrimNotResonancePi0PtOrigin->Fill(mesonPt, 7.5, GetEventWeight()*weightPt);//other?
2819  }
2820 
2821  }//pi0
2822  else
2823  {
2824  if (momstatus == 21 ) fhPrimEtaPtOrigin->Fill(mesonPt, 0.5, GetEventWeight()*weightPt);//parton
2825  else if(mompdg < 22 ) fhPrimEtaPtOrigin->Fill(mesonPt, 1.5, GetEventWeight()*weightPt);//quark
2826  else if(mompdg > 2100 && mompdg < 2210)
2827  fhPrimEtaPtOrigin->Fill(mesonPt, 2.5, GetEventWeight()*weightPt);//qq resonances
2828  else if(mompdg == 331) fhPrimEtaPtOrigin->Fill(mesonPt, 5.5, GetEventWeight()*weightPt);//eta prime
2829  else if(momstatus == 11 || momstatus == 12 )
2830  fhPrimEtaPtOrigin->Fill(mesonPt, 3.5, GetEventWeight()*weightPt);//resonances
2831  else fhPrimEtaPtOrigin->Fill(mesonPt, 4.5, GetEventWeight()*weightPt);//stable, conversions?
2832  //printf("Other Meson pdg %d, Mother %s, pdg %d, status %d\n",pdg, TDatabasePDG::Instance()->GetParticle(mompdg)->GetName(),mompdg, momstatus );
2833 
2834  fhPrimEtaProdVertex->Fill(mesonPt, momR, GetEventWeight()*weightPt);
2835  }
2836  } // pi0 has mother
2837  }
2838 
2839  // Check if both photons hit calorimeter or a given fiducial region
2840  // only if those settings are specified.
2841  if ( !IsFiducialCutOn() && !IsRealCaloAcceptanceOn() ) continue ;
2842 
2843  if ( nDaught != 2 ) continue; //Only interested in 2 gamma decay
2844 
2845  if ( iphot1 < 0 || iphot1 >= nprim || iphot2 < 0 || iphot2 >= nprim ) continue ;
2846 
2847  Int_t pdg1 = 0;
2848  Int_t pdg2 = 0;
2849  Bool_t inacceptance1 = kTRUE;
2850  Bool_t inacceptance2 = kTRUE;
2851 
2852  AliVParticle * phot1 = GetMC()->GetTrack(iphot1) ;
2853  AliVParticle * phot2 = GetMC()->GetTrack(iphot2) ;
2854 
2855  if(!phot1 || !phot2) continue ;
2856 
2857  pdg1 = phot1->PdgCode();
2858  pdg2 = phot2->PdgCode();
2859 
2860  fPhotonMom1.SetPxPyPzE(phot1->Px(),phot1->Py(),phot1->Pz(),phot1->E());
2861  fPhotonMom2.SetPxPyPzE(phot2->Px(),phot2->Py(),phot2->Pz(),phot2->E());
2862 
2863  // Check if photons hit the Calorimeter acceptance
2865  {
2866  if( !GetCaloUtils()->IsMCParticleInCalorimeterAcceptance( GetCalorimeter(), phot1 )) inacceptance1 = kFALSE ;
2867  if( !GetCaloUtils()->IsMCParticleInCalorimeterAcceptance( GetCalorimeter(), phot2 )) inacceptance2 = kFALSE ;
2868  }
2869 
2870  if( pdg1 != 22 || pdg2 !=22) continue ;
2871 
2872  // Check if photons hit desired acceptance in the fidutial borders fixed in the analysis
2873  if(IsFiducialCutOn())
2874  {
2875  if( inacceptance1 && !GetFiducialCut()->IsInFiducialCut(fPhotonMom1.Eta(), fPhotonMom1.Phi(), GetCalorimeter()) ) inacceptance1 = kFALSE ;
2876  if( inacceptance2 && !GetFiducialCut()->IsInFiducialCut(fPhotonMom2.Eta(), fPhotonMom2.Phi(), GetCalorimeter()) ) inacceptance2 = kFALSE ;
2877  }
2878 
2880 
2881  if(GetCalorimeter()==kEMCAL && inacceptance1 && inacceptance2 && fCheckAccInSector)
2882  {
2883  Int_t absID1=0;
2884  Int_t absID2=0;
2885 
2886  Float_t photonPhi1 = fPhotonMom1.Phi();
2887  Float_t photonPhi2 = fPhotonMom2.Phi();
2888 
2889  if(photonPhi1 < 0) photonPhi1+=TMath::TwoPi();
2890  if(photonPhi2 < 0) photonPhi2+=TMath::TwoPi();
2891 
2892  GetEMCALGeometry()->GetAbsCellIdFromEtaPhi(fPhotonMom1.Eta(),photonPhi1,absID1);
2893  GetEMCALGeometry()->GetAbsCellIdFromEtaPhi(fPhotonMom2.Eta(),photonPhi2,absID2);
2894 
2895  Int_t sm1 = GetEMCALGeometry()->GetSuperModuleNumber(absID1);
2896  Int_t sm2 = GetEMCALGeometry()->GetSuperModuleNumber(absID2);
2897 
2898  Int_t j=0;
2899  Bool_t sameSector = kFALSE;
2900  for(Int_t isector = 0; isector < fNModules/2; isector++)
2901  {
2902  j=2*isector;
2903  if((sm1==j && sm2==j+1) || (sm1==j+1 && sm2==j)) sameSector = kTRUE;
2904  }
2905 
2906  if(sm1!=sm2 && !sameSector)
2907  {
2908  inacceptance1 = kFALSE;
2909  inacceptance2 = kFALSE;
2910  }
2911  //if(sm1!=sm2)printf("sm1 %d, sm2 %d, same sector %d, in acceptance %d\n",sm1,sm2,sameSector,inacceptance);
2912  // if(GetEMCALGeometry()->Impact(phot1) && GetEMCALGeometry()->Impact(phot2))
2913  // inacceptance = kTRUE;
2914  }
2915 
2916  AliDebug(2,Form("Accepted in %s?: m (%2.2f,%2.2f,%2.2f), p1 (%2.2f,%2.2f,%2.2f), p2 (%2.2f,%2.2f,%2.2f) : in1 %d, in2 %d",
2918  mesonPt,mesonYeta,mesonPhi,
2919  fPhotonMom1.Pt(),fPhotonMom1.Eta(),fPhotonMom1.Phi()*TMath::RadToDeg(),
2920  fPhotonMom2.Pt(),fPhotonMom2.Eta(),fPhotonMom2.Phi()*TMath::RadToDeg(),
2921  inacceptance1, inacceptance2));
2922 
2923  if(inacceptance1 && inacceptance2)
2924  {
2925  Float_t asym = TMath::Abs((fPhotonMom1.E()-fPhotonMom2.E()) / (fPhotonMom1.E()+fPhotonMom2.E()));
2926  Double_t angle = fPhotonMom1.Angle(fPhotonMom2.Vect());
2927 
2928  Bool_t cutAngle = kFALSE;
2929  if(fUseAngleCut && (angle < fAngleCut || angle > fAngleMaxCut)) cutAngle = kTRUE;
2930 
2931  AliDebug(2,Form("\t ACCEPTED pdg %d: pt %2.2f, phi %2.2f, eta %2.2f",pdg,mesonPt,mesonPhi,mesonYeta));
2932 
2933  if(pdg==111)
2934  {
2935  fhPrimPi0AccE ->Fill(mesonE , GetEventWeight()*weightPt) ;
2936  fhPrimPi0AccPt ->Fill(mesonPt, GetEventWeight()*weightPt) ;
2937  fhPrimPi0AccPhi ->Fill(mesonPt, mesonPhi , GetEventWeight()*weightPt) ;
2938  fhPrimPi0AccY ->Fill(mesonPt, mesonY , GetEventWeight()*weightPt) ;
2939  fhPrimPi0AccYeta->Fill(mesonPt, mesonYeta, GetEventWeight()*weightPt) ;
2940 
2942  fhPrimPi0AccPtPerGenerator[genType] ->Fill(mesonPt,GetEventWeight()*weightPt) ;
2943 
2945  {
2946  fhPrimPi0AccPtCentrality->Fill(mesonPt, cen, GetEventWeight()*weightPt) ;
2947  fhPrimPi0AccPtEventPlane->Fill(mesonPt, ep , GetEventWeight()*weightPt) ;
2948  }
2949 
2950  if(fFillAngleHisto)
2951  {
2952  fhPrimPi0OpeningAngle ->Fill(mesonPt, angle, GetEventWeight()*weightPt);
2953  if(mesonPt > 5)fhPrimPi0OpeningAngleAsym->Fill(asym, angle, GetEventWeight()*weightPt);
2954  fhPrimPi0CosOpeningAngle ->Fill(mesonPt, TMath::Cos(angle), GetEventWeight()*weightPt);
2955  }
2956 
2957  if(fPhotonMom1.Pt() > GetMinPt() && fPhotonMom2.Pt() > GetMinPt() && !cutAngle)
2958  {
2959  fhPrimPi0AccPtPhotonCuts->Fill(mesonPt, GetEventWeight()*weightPt) ;
2960 
2962  fhPrimPi0AccPtPhotonCutsPerGenerator[genType] ->Fill(mesonPt,GetEventWeight()*weightPt) ;
2963 
2964  if(fFillAngleHisto)
2965  fhPrimPi0OpeningAnglePhotonCuts->Fill(mesonPt, angle, GetEventWeight()*weightPt);
2966 
2967  if ( fNAngleCutBins > 0 && fFillOpAngleCutHisto )
2968  {
2969  Int_t angleBin = -1;
2970  for(Int_t ibin = 0; ibin < fNAngleCutBins; ibin++)
2971  {
2972  if(angle >= fAngleCutBinsArray[ibin] &&
2973  angle < fAngleCutBinsArray[ibin+1]) angleBin = ibin;
2974  }
2975 
2976  if( angleBin >= 0 && angleBin < fNAngleCutBins)
2977  fhPrimPi0AccPtOpAngCuts[angleBin]->Fill(mesonPt,GetEventWeight()*weightPt);
2978  }
2979  }
2980  }
2981  else if(pdg==221)
2982  {
2983  fhPrimEtaAccE ->Fill(mesonE , GetEventWeight()*weightPt) ;
2984  fhPrimEtaAccPt ->Fill(mesonPt, GetEventWeight()*weightPt) ;
2985  fhPrimEtaAccPhi ->Fill(mesonPt, mesonPhi , GetEventWeight()*weightPt) ;
2986  fhPrimEtaAccY ->Fill(mesonPt, mesonY , GetEventWeight()*weightPt) ;
2987  fhPrimEtaAccYeta->Fill(mesonPt, mesonYeta, GetEventWeight()*weightPt) ;
2988 
2990  fhPrimEtaAccPtPerGenerator[genType] ->Fill(mesonPt,GetEventWeight()*weightPt) ;
2991 
2993  {
2994  fhPrimEtaAccPtCentrality->Fill(mesonPt, cen, GetEventWeight()*weightPt) ;
2995  fhPrimEtaAccPtEventPlane->Fill(mesonPt, ep , GetEventWeight()*weightPt) ;
2996  }
2997 
2998  if(fFillAngleHisto)
2999  {
3000  fhPrimEtaOpeningAngle ->Fill(mesonPt, angle, GetEventWeight()*weightPt);
3001  if(mesonPt > 5)fhPrimEtaOpeningAngleAsym->Fill(asym, angle, GetEventWeight()*weightPt);
3002  fhPrimEtaCosOpeningAngle ->Fill(mesonPt, TMath::Cos(angle), GetEventWeight()*weightPt);
3003  }
3004 
3005  if(fPhotonMom1.Pt() > GetMinPt() && fPhotonMom2.Pt() > GetMinPt() && !cutAngle)
3006  {
3007  fhPrimEtaAccPtPhotonCuts->Fill(mesonPt, GetEventWeight()*weightPt) ;
3008 
3010  fhPrimEtaAccPtPhotonCutsPerGenerator[genType]->Fill(mesonPt,GetEventWeight()*weightPt) ;
3011 
3012  if(fFillAngleHisto)
3013  fhPrimEtaOpeningAnglePhotonCuts->Fill(mesonPt, angle, GetEventWeight()*weightPt);
3014 
3015  if ( fNAngleCutBins > 0 && fFillOpAngleCutHisto )
3016  {
3017  Int_t angleBin = -1;
3018  for(Int_t ibin = 0; ibin < fNAngleCutBins; ibin++)
3019  {
3020  if(angle >= fAngleCutBinsArray[ibin] &&
3021  angle < fAngleCutBinsArray[ibin+1]) angleBin = ibin;
3022  }
3023 
3024  if( angleBin >= 0 && angleBin < fNAngleCutBins)
3025  fhPrimEtaAccPtOpAngCuts[angleBin]->Fill(mesonPt,GetEventWeight()*weightPt);
3026  }
3027  }
3028  }
3029  } // Accepted
3030  } // loop on primaries
3031 }
3032 
3033 //________________________________________________
3035 //________________________________________________
3037 {
3038  // Get pTArm and AlphaArm
3039  Float_t momentumSquaredMother = fMCPrimMesonMom.P()*fMCPrimMesonMom.P();
3040  Float_t momentumDaughter1AlongMother = 0.;
3041  Float_t momentumDaughter2AlongMother = 0.;
3042 
3043  if (momentumSquaredMother > 0.)
3044  {
3045  momentumDaughter1AlongMother = (fPhotonMom1.Px()*fMCPrimMesonMom.Px() + fPhotonMom1.Py()*fMCPrimMesonMom.Py()+ fPhotonMom1.Pz()*fMCPrimMesonMom.Pz()) / sqrt(momentumSquaredMother);
3046  momentumDaughter2AlongMother = (fPhotonMom2.Px()*fMCPrimMesonMom.Px() + fPhotonMom2.Py()*fMCPrimMesonMom.Py()+ fPhotonMom2.Pz()*fMCPrimMesonMom.Pz()) / sqrt(momentumSquaredMother);
3047  }
3048 
3049  Float_t momentumSquaredDaughter1 = fPhotonMom1.P()*fPhotonMom1.P();
3050  Float_t ptArmSquared = momentumSquaredDaughter1 - momentumDaughter1AlongMother*momentumDaughter1AlongMother;
3051 
3052  Float_t pTArm = 0.;
3053  if (ptArmSquared > 0.)
3054  pTArm = sqrt(ptArmSquared);
3055 
3056  Float_t alphaArm = 0.;
3057  if(momentumDaughter1AlongMother + momentumDaughter2AlongMother > 0)
3058  alphaArm = (momentumDaughter1AlongMother -momentumDaughter2AlongMother) / (momentumDaughter1AlongMother + momentumDaughter2AlongMother);
3059 
3061  fPhotonMom1Boost.Boost(-fMCPrimMesonMom.BoostVector());
3062  Float_t cosThStar=TMath::Cos(fPhotonMom1Boost.Vect().Angle(fMCPrimMesonMom.Vect()));
3063 
3064  Float_t en = fMCPrimMesonMom.Energy();
3065  Int_t ebin = -1;
3066  if(en > 8 && en <= 12) ebin = 0;
3067  if(en > 12 && en <= 16) ebin = 1;
3068  if(en > 16 && en <= 20) ebin = 2;
3069  if(en > 20) ebin = 3;
3070  if(ebin < 0 || ebin > 3) return ;
3071 
3072  if(pdg==111)
3073  {
3074  fhCosThStarPrimPi0->Fill(en, cosThStar, GetEventWeight());
3075  fhArmPrimPi0[ebin]->Fill(alphaArm, pTArm , GetEventWeight());
3076  }
3077  else
3078  {
3079  fhCosThStarPrimEta->Fill(en, cosThStar, GetEventWeight());
3080  fhArmPrimEta[ebin]->Fill(alphaArm,pTArm , GetEventWeight());
3081  }
3082 
3083  // if(GetDebug() > 2 )
3084  // {
3085  // Float_t asym = 0;
3086  // if(fPhotonMom1.E()+fPhotonMom2.E() > 0) asym = TMath::Abs(fPhotonMom1.E()-fPhotonMom2.E())/(fPhotonMom1.E()+fPhotonMom2.E());
3087  //
3088  // printf("AliAnaPi0::FillArmenterosThetaStar() - E %f, alphaArm %f, pTArm %f, cos(theta*) %f, asymmetry %1.3f\n",
3089  // en,alphaArm,pTArm,cosThStar,asym);
3090  // }
3091 }
3092 
3093 //_______________________________________________________________________________________
3098 //_______________________________________________________________________________________
3100  Int_t ancStatus, Double_t weightPt,
3101  Int_t iclus1, Int_t iclus2,
3102  Int_t mctag1, Int_t mctag2,
3103  Float_t pt1, Float_t pt2,
3104  Int_t ncell1, Int_t ncell2,
3105  Double_t mass, Double_t pt, Double_t asym,
3106  Double_t deta, Double_t dphi, Double_t angle)
3107 {
3108  Int_t momindex = -1;
3109  Int_t mompdg = -1;
3110  Int_t momstatus = -1;
3111  Int_t status = -1;
3112  Float_t prodR = -1;
3113  Int_t mcIndex = -1;
3114  Float_t ptPrim = fMCPrimMesonMom.Pt();
3115  Float_t cent = GetEventCentrality();
3116 
3117  if(ancLabel > -1)
3118  {
3119  AliDebug(1,Form("Common ancestor label %d, pdg %d, name %s, status %d",
3120  ancLabel,ancPDG,TDatabasePDG::Instance()->GetParticle(ancPDG)->GetName(),ancStatus));
3121 
3122  if(ancPDG==22)
3123  {//gamma
3124  mcIndex = 0;
3125  }
3126  else if(TMath::Abs(ancPDG)==11)
3127  {//e
3128  mcIndex = 1;
3129  }
3130  else if(ancPDG==111)
3131  {//Pi0
3132  mcIndex = 2;
3133 
3134  fhMCPi0PtTruePtRecRat->Fill(pt, ptPrim/pt, GetEventWeight()*weightPt);
3135  fhMCPi0PtTruePtRecDif->Fill(pt, pt-ptPrim, GetEventWeight()*weightPt);
3136  fhMCPi0PtRecOpenAngle->Fill(pt, angle , GetEventWeight()*weightPt);
3138  fhMCPi0PerCentrality->Fill(pt, cent, GetEventWeight()*weightPt);
3139 
3140  if ( mass < fPi0MassWindow[1] && mass > fPi0MassWindow[0] )
3141  {
3142  fhMCPi0PtTruePtRecRatMassCut->Fill(pt, ptPrim/pt, GetEventWeight()*weightPt);
3143  fhMCPi0PtTruePtRecDifMassCut->Fill(pt, pt-ptPrim, GetEventWeight()*weightPt);
3144  fhMCPi0PtRecOpenAngleMassCut->Fill(pt, angle , GetEventWeight()*weightPt);
3146  fhMCPi0PerCentralityMassCut->Fill(pt, cent, GetEventWeight()*weightPt);
3147  }
3148 
3149  if(fMultiCutAnaSim)
3150  {
3151  for(Int_t ipt=0; ipt<fNPtCuts; ipt++)
3152  {
3153  for(Int_t icell=0; icell<fNCellNCuts; icell++)
3154  {
3155  for(Int_t iasym=0; iasym<fNAsymCuts; iasym++)
3156  {
3157  Int_t index = ((ipt*fNCellNCuts)+icell)*fNAsymCuts + iasym;
3158  if(pt1 > fPtCuts[ipt] && pt2 > fPtCuts[ipt] &&
3159  pt1 < fPtCutsMax[ipt] && pt2 < fPtCutsMax[ipt] &&
3160  asym < fAsymCuts[iasym] &&
3161  ncell1 >= fCellNCuts[icell] && ncell2 >= fCellNCuts[icell])
3162  {
3163  fhMCPi0MassPtRec [index]->Fill(pt ,mass, GetEventWeight()*weightPt);
3164  fhMCPi0MassPtTrue[index]->Fill(ptPrim,mass, GetEventWeight()*weightPt);
3165 
3166  if ( mass < fPi0MassWindow[1] && mass > fPi0MassWindow[0] )
3167  fhMCPi0PtTruePtRecMassCut[index]->Fill(ptPrim, pt, GetEventWeight()*weightPt);
3168  }//pass the different cuts
3169  }// pid bit cut loop
3170  }// icell loop
3171  }// pt cut loop
3172  }// Multi cut ana sim
3173  else
3174  {
3175  fhMCPi0MassPtTrue [0]->Fill(ptPrim, mass, GetEventWeight()*weightPt);
3176  fhMCPi0MassPtRec [0]->Fill(pt , mass, GetEventWeight()*weightPt);
3177  fhMCPi0PtTruePtRec[0]->Fill(ptPrim, pt, GetEventWeight()*weightPt);
3178 
3179  if ( mass < fPi0MassWindow[1] && mass > fPi0MassWindow[0] )
3180  {
3181  fhMCPi0PtTruePtRecMassCut[0]->Fill(ptPrim, pt, GetEventWeight()*weightPt);
3182 
3183  AliVParticle* ancestor = GetMC()->GetTrack(ancLabel);
3184  status = ancestor->MCStatusCode();
3185  momindex = ancestor->GetMother();
3186 
3187  Bool_t momOK = kFALSE;
3188  if(momindex >= 0)
3189  {
3190  AliVParticle* mother = GetMC()->GetTrack(momindex);
3191  mompdg = TMath::Abs(mother->PdgCode());
3192  momstatus = mother->MCStatusCode();
3193  prodR = TMath::Sqrt(mother->Xv()*mother->Xv()+mother->Yv()*mother->Yv());
3194  //prodR = mother->R();
3195  //uniqueId = mother->GetUniqueID();
3196  momOK = kTRUE;
3197  }
3198 
3199  if(momOK)
3200  {
3201  // printf("Reco Pi0: pt %2.2f Prod vertex %3.3f, origin pdg %d, origin status %d, origin UI %d\n",
3202  // pt,prodR,mompdg,momstatus,uniqueId);
3203 
3204  fhMCPi0ProdVertex->Fill(pt, prodR , GetEventWeight()*weightPt);
3205  fhMCPi0PtStatus ->Fill(pt, status, GetEventWeight()*weightPt);
3206 
3207  if (momstatus == 21) {
3208  fhMCPi0PtOrigin->Fill(pt, 0.5, GetEventWeight()*weightPt);//parton
3209  fhMCPi0Radius[0]->Fill(pt,prodR,GetEventWeight()*weightPt);
3210  }
3211  else if(mompdg < 22 ) {
3212  fhMCPi0PtOrigin->Fill(pt, 1.5, GetEventWeight()*weightPt);//quark
3213  fhMCPi0Radius[1]->Fill(pt,prodR,GetEventWeight()*weightPt);
3214  }
3215  else if(mompdg > 2100 && mompdg < 2210) {
3216  fhMCPi0PtOrigin->Fill(pt, 2.5, GetEventWeight()*weightPt);// resonances
3217  fhMCPi0Radius[2]->Fill(pt,prodR,GetEventWeight()*weightPt);
3218  }
3219  else if(mompdg == 221) {
3220  fhMCPi0PtOrigin->Fill(pt, 8.5, GetEventWeight()*weightPt);//eta
3221  fhMCPi0Radius[8]->Fill(pt,prodR,GetEventWeight()*weightPt);
3222  }
3223  else if(mompdg == 331) {
3224  fhMCPi0PtOrigin->Fill(pt, 9.5, GetEventWeight()*weightPt);//eta prime
3225  fhMCPi0Radius[9]->Fill(pt,prodR,GetEventWeight()*weightPt);
3226  }
3227  else if(mompdg == 213) {
3228  fhMCPi0PtOrigin->Fill(pt, 4.5, GetEventWeight()*weightPt);//rho
3229  fhMCPi0Radius[4]->Fill(pt,prodR,GetEventWeight()*weightPt);
3230  }
3231  else if(mompdg == 223) {
3232  fhMCPi0PtOrigin->Fill(pt, 5.5, GetEventWeight()*weightPt);//omega
3233  fhMCPi0Radius[5]->Fill(pt,prodR,GetEventWeight()*weightPt);
3234  }
3235  else if(mompdg >= 310 && mompdg <= 323) {
3236  fhMCPi0PtOrigin->Fill(pt, 6.5, GetEventWeight()*weightPt);//k0S, k+-,k*
3237  fhMCPi0Radius[6]->Fill(pt,prodR,GetEventWeight()*weightPt);
3238  }
3239  else if(mompdg == 130) {
3240  fhMCPi0PtOrigin->Fill(pt, 6.5, GetEventWeight()*weightPt);//k0L
3241  fhMCPi0Radius[6]->Fill(pt,prodR,GetEventWeight()*weightPt);
3242  }
3243  else if(momstatus == 11 || momstatus == 12 ) {
3244  fhMCPi0PtOrigin->Fill(pt, 3.5, GetEventWeight()*weightPt);//resonances
3245  fhMCPi0Radius[3]->Fill(pt,prodR,GetEventWeight()*weightPt);
3246  }
3247  else {
3248  fhMCPi0PtOrigin->Fill(pt, 7.5, GetEventWeight()*weightPt);//other?
3249  fhMCPi0Radius[7]->Fill(pt,prodR,GetEventWeight()*weightPt);
3250  }
3251 
3252  if(status!=11)
3253  {
3254  if (momstatus == 21) fhMCNotResonancePi0PtOrigin->Fill(pt, 0.5, GetEventWeight()*weightPt);//parton
3255  else if(mompdg < 22 ) fhMCNotResonancePi0PtOrigin->Fill(pt, 1.5, GetEventWeight()*weightPt);//quark
3256  else if(mompdg > 2100 && mompdg < 2210)
3257  fhMCNotResonancePi0PtOrigin->Fill(pt, 2.5, GetEventWeight()*weightPt);// resonances
3258  else if(mompdg == 221) fhMCNotResonancePi0PtOrigin->Fill(pt, 8.5, GetEventWeight()*weightPt);//eta
3259  else if(mompdg == 331) fhMCNotResonancePi0PtOrigin->Fill(pt, 9.5, GetEventWeight()*weightPt);//eta prime
3260  else if(mompdg == 213) fhMCNotResonancePi0PtOrigin->Fill(pt, 4.5, GetEventWeight()*weightPt);//rho
3261  else if(mompdg == 223) fhMCNotResonancePi0PtOrigin->Fill(pt, 5.5, GetEventWeight()*weightPt);//omega
3262  else if(mompdg >= 310 && mompdg <= 323)
3263  fhMCNotResonancePi0PtOrigin->Fill(pt, 6.5, GetEventWeight()*weightPt);//k0S, k+-,k*
3264  else if(mompdg == 130) fhMCNotResonancePi0PtOrigin->Fill(pt, 6.5, GetEventWeight()*weightPt);//k0L
3265  else if(momstatus == 11 || momstatus == 12 )
3266  fhMCNotResonancePi0PtOrigin->Fill(pt, 3.5, GetEventWeight()*weightPt);//resonances
3267  else fhMCNotResonancePi0PtOrigin->Fill(pt, 7.5, GetEventWeight()*weightPt);//other?
3268  }
3269  }
3270 
3271  }//pi0 mass region
3272  }
3273 
3274  if(fNAngleCutBins > 0)
3275  {
3276  Int_t angleBin = -1;
3277  for(Int_t ibin = 0; ibin < fNAngleCutBins; ibin++)
3278  {
3279  if(angle >= fAngleCutBinsArray[ibin] &&
3280  angle < fAngleCutBinsArray[ibin+1]) angleBin = ibin;
3281  }
3282 
3283  if( angleBin >= 0 && angleBin < fNAngleCutBins)
3284  fhReOpAngleBinPairClusterMassMCTruePi0[angleBin]->Fill(pt, mass, GetEventWeight()*weightPt);
3285  }
3286 
3287  }
3288  else if(ancPDG==221)
3289  {//Eta
3290  mcIndex = 3;
3291 
3292  fhMCEtaPtTruePtRecRat->Fill(pt, ptPrim/pt, GetEventWeight()*weightPt);
3293  fhMCEtaPtTruePtRecDif->Fill(pt, pt-ptPrim, GetEventWeight()*weightPt);
3294  fhMCEtaPtRecOpenAngle->Fill(pt, angle , GetEventWeight()*weightPt);
3296  fhMCEtaPerCentrality->Fill(pt, cent, GetEventWeight()*weightPt);
3297 
3298  if ( mass < fEtaMassWindow[1] && mass > fEtaMassWindow[0] )
3299  {
3300  fhMCEtaPtTruePtRecRatMassCut->Fill(pt, ptPrim/pt, GetEventWeight()*weightPt);
3301  fhMCEtaPtTruePtRecDifMassCut->Fill(pt, pt-ptPrim, GetEventWeight()*weightPt);
3302  fhMCEtaPtRecOpenAngleMassCut->Fill(pt, angle , GetEventWeight()*weightPt);
3304  fhMCEtaPerCentralityMassCut->Fill(pt, cent, GetEventWeight()*weightPt);
3305  }
3306 
3307  if(fMultiCutAnaSim)
3308  {
3309  for(Int_t ipt=0; ipt<fNPtCuts; ipt++)
3310  {
3311  for(Int_t icell=0; icell<fNCellNCuts; icell++)
3312  {
3313  for(Int_t iasym=0; iasym<fNAsymCuts; iasym++)
3314  {
3315  Int_t index = ((ipt*fNCellNCuts)+icell)*fNAsymCuts + iasym;
3316  if(pt1 > fPtCuts[ipt] && pt2 > fPtCuts[ipt] &&
3317  pt1 < fPtCutsMax[ipt] && pt2 < fPtCutsMax[ipt] &&
3318  asym < fAsymCuts[iasym] &&
3319  ncell1 >= fCellNCuts[icell] && ncell2 >= fCellNCuts[icell])
3320  {
3321  fhMCEtaMassPtRec [index]->Fill(pt , mass, GetEventWeight()*weightPt);
3322  fhMCEtaMassPtTrue [index]->Fill(ptPrim, mass, GetEventWeight()*weightPt);
3323  fhMCEtaPtTruePtRec[index]->Fill(ptPrim, pt, GetEventWeight()*weightPt);
3324 
3325  if ( mass < fEtaMassWindow[1] && mass > fEtaMassWindow[0] )
3326  fhMCEtaPtTruePtRecMassCut[index]->Fill(ptPrim, pt, GetEventWeight()*weightPt);
3327  }//pass the different cuts
3328  }// pid bit cut loop
3329  }// icell loop
3330  }// pt cut loop
3331  } //Multi cut ana sim
3332  else
3333  {
3334  fhMCEtaMassPtTrue [0]->Fill(ptPrim, mass, GetEventWeight()*weightPt);
3335  fhMCEtaMassPtRec [0]->Fill(pt , mass, GetEventWeight()*weightPt);
3336  fhMCEtaPtTruePtRec[0]->Fill(ptPrim, pt, GetEventWeight()*weightPt);
3337 
3338  if ( mass < fEtaMassWindow[1] && mass > fEtaMassWindow[0] )
3339  {
3340  fhMCEtaPtTruePtRecMassCut[0]->Fill(ptPrim, pt, GetEventWeight()*weightPt);
3341 
3342  Float_t momOK = kFALSE;
3343 
3344  AliVParticle* ancestor = GetMC()->GetTrack(ancLabel);
3345  momindex = ancestor->GetMother();
3346  if(momindex >= 0)
3347  {
3348  AliVParticle* mother = GetMC()->GetTrack(momindex);
3349  mompdg = TMath::Abs(mother->PdgCode());
3350  momstatus = mother->MCStatusCode();
3351  //prodR = mother->R();
3352  prodR = TMath::Sqrt(mother->Xv()*mother->Xv()+mother->Yv()*mother->Yv());
3353  momOK = kTRUE;
3354  }
3355 
3356  if(momOK)
3357  {
3358  fhMCEtaProdVertex->Fill(pt, prodR, GetEventWeight()*weightPt);
3359 
3360  if (momstatus == 21 ) {
3361  fhMCEtaPtOrigin->Fill(pt, 0.5, GetEventWeight()*weightPt);//parton
3362  fhMCEtaRadius[0]->Fill(pt,prodR,GetEventWeight()*weightPt);
3363  }
3364  else if(mompdg < 22 ) {
3365  fhMCEtaPtOrigin->Fill(pt, 1.5, GetEventWeight()*weightPt);//quark
3366  fhMCEtaRadius[1]->Fill(pt,prodR,GetEventWeight()*weightPt);
3367  }
3368  else if(mompdg > 2100 && mompdg < 2210) {
3369  fhMCEtaPtOrigin->Fill(pt, 2.5, GetEventWeight()*weightPt);//qq resonances
3370  fhMCEtaRadius[2]->Fill(pt,prodR,GetEventWeight()*weightPt);
3371  }
3372  else if(mompdg == 331) {
3373  fhMCEtaPtOrigin->Fill(pt, 5.5, GetEventWeight()*weightPt);//eta prime
3374  fhMCEtaRadius[5]->Fill(pt,prodR,GetEventWeight()*weightPt);
3375  }
3376  else if(momstatus == 11 || momstatus == 12 ) {
3377  fhMCEtaPtOrigin->Fill(pt, 3.5, GetEventWeight()*weightPt);//resonances
3378  fhMCEtaRadius[3]->Fill(pt,prodR,GetEventWeight()*weightPt);
3379  }
3380  else {
3381  fhMCEtaPtOrigin->Fill(pt, 4.5, GetEventWeight()*weightPt);//stable, conversions?
3382  fhMCEtaRadius[4]->Fill(pt,prodR,GetEventWeight()*weightPt);
3383  //printf("Other Meson pdg %d, Mother %s, pdg %d, status %d\n",pdg, TDatabasePDG::Instance()->GetParticle(mompdg)->GetName(),mompdg, momstatus );
3384  }
3385 
3386  }
3387 
3388  }// eta mass region
3389  }
3390  if(fNAngleCutBins > 0)
3391  {
3392  Int_t angleBin = -1;
3393  for(Int_t ibin = 0; ibin < fNAngleCutBins; ibin++)
3394  {
3395  if(angle >= fAngleCutBinsArray[ibin] &&
3396  angle < fAngleCutBinsArray[ibin+1]) angleBin = ibin;
3397  }
3398 
3399  if( angleBin >= 0 && angleBin < fNAngleCutBins)
3400  fhReOpAngleBinPairClusterMassMCTrueEta[angleBin]->Fill(pt, mass, GetEventWeight()*weightPt);
3401  }
3402  }
3403  else if(ancPDG==-2212)
3404  {//AProton
3405  mcIndex = 4;
3406  }
3407  else if(ancPDG==-2112)
3408  {//ANeutron
3409  mcIndex = 5;
3410  }
3411  else if(TMath::Abs(ancPDG)==13)
3412  {//muons
3413  mcIndex = 6;
3414  }
3415  else if (TMath::Abs(ancPDG) > 100 && ancLabel > 7)
3416  {
3417  if(ancStatus==1)
3418  {//Stable particles, converted? not decayed resonances
3419  mcIndex = 6;
3420  }
3421  else
3422  {//resonances and other decays, more hadron conversions?
3423  mcIndex = 7;
3424  }
3425  }
3426  else
3427  {//Partons, colliding protons, strings, intermediate corrections
3428  if(ancStatus==11 || ancStatus==12)
3429  {//String fragmentation
3430  mcIndex = 8;
3431  }
3432  else if (ancStatus==21)
3433  {
3434  if(ancLabel < 2)
3435  {//Colliding protons
3436  mcIndex = 11;
3437  }//colliding protons
3438  else if(ancLabel < 6)
3439  {//partonic initial states interactions
3440  mcIndex = 9;
3441  }
3442  else if(ancLabel < 8)
3443  {//Final state partons radiations?
3444  mcIndex = 10;
3445  }
3446  // else {
3447  // printf("AliAnaPi0::FillMCVersusRecDataHistograms() - Check ** Common ancestor label %d, pdg %d, name %s, status %d; \n",
3448  // ancLabel,ancPDG,TDatabasePDG::Instance()->GetParticle(ancPDG)->GetName(),ancStatus);
3449  // }
3450  }//status 21
3451  //else {
3452  // printf("AliAnaPi0::FillMCVersusRecDataHistograms() - Check *** Common ancestor label %d, pdg %d, name %s, status %d; \n",
3453  // ancLabel,ancPDG,TDatabasePDG::Instance()->GetParticle(ancPDG)->GetName(),ancStatus);
3454  // }
3455  }
3456  }//ancLabel > -1
3457  else
3458  { //ancLabel <= -1
3459  //printf("Not related at all label = %d\n",ancLabel);
3460  AliDebug(1,"Common ancestor not found");
3461 
3462  mcIndex = 12;
3463  }
3464 
3465  if(mcIndex >= 0 && mcIndex < 13)
3466  {
3467  fhMCOrgMass [mcIndex]->Fill(pt, mass, GetEventWeight()*weightPt);
3468  fhMCOrgAsym [mcIndex]->Fill(pt, asym, GetEventWeight()*weightPt);
3469  fhMCOrgDeltaEta[mcIndex]->Fill(pt, deta, GetEventWeight()*weightPt);
3470  fhMCOrgDeltaPhi[mcIndex]->Fill(pt, dphi, GetEventWeight()*weightPt);
3471  }
3472 
3474  {
3475  // Get the original clusters
3476  //
3477  Int_t first = 0;
3478  AliVCluster * cluster1 = FindCluster(GetEMCALClusters(),iclus1,first);
3479  AliVCluster * cluster2 = FindCluster(GetEMCALClusters(),iclus2,iclus1);
3480  if(!cluster2 || !cluster1)
3481  {
3482  AliWarning(Form("Cluster1 %p or Cluster 2 %p not found!",cluster1,cluster2));
3483  return;
3484  }
3485 
3486  // Get the generators names of each cluster and background generator tag
3487  //
3488  TString genName1 = "", genName2 = "", genNameBkg1 = "", genNameBkg2 = "";
3489  Int_t indexGen1 = -1, indexGen2 = -1, indexGenBkg1 = -1, indexGenBkg2 = -1;
3490  Int_t genBkgTag1 = GetCocktailGeneratorBackgroundTag(cluster1, mctag1, genName1, indexGen1, genNameBkg1, indexGenBkg1);
3491  if (genBkgTag1 == -1) return;
3492  else if(genBkgTag1 > 3) printf("Bkg1 generator tag larger than 3; Main %s Bkg %s\n",genName1.Data(),genNameBkg1.Data());
3493 
3494  Int_t genBkgTag2 = GetCocktailGeneratorBackgroundTag(cluster2, mctag2, genName2, indexGen2, genNameBkg2, indexGenBkg2);
3495  if (genBkgTag2 == -1) return;
3496  else if(genBkgTag2 > 3) printf("Bkg2 generator tag larger than 3; Main %s Bkg %s\n",genName2.Data(),genNameBkg2.Data());
3497 
3498  // if the clusters do not come from the same generator exclude
3499  if(genName1!=genName2) return;
3500 
3501  Int_t genType = GetNCocktailGenNamesToCheck()-1;
3502  for(Int_t igen = 1; igen < GetNCocktailGenNamesToCheck(); igen++)
3503  {
3504  if ( GetCocktailGenNameToCheck(igen).Contains(genName1) &&
3505  ( GetCocktailGenIndexToCheck(igen) < 0 || indexGen1 == GetCocktailGenIndexToCheck(igen)))
3506  {
3507  genType = igen;
3508  break;
3509  }
3510  }
3511 
3512  // Fill histograms
3513  //
3514  // assign histogram index number depending on pair combination
3515  Int_t tag = -1;
3516  if ( genBkgTag1 == genBkgTag2 )
3517  {
3518  tag = genBkgTag1; // 0,1,2,3
3519  }
3520  else
3521  {
3522  Int_t genBkgMin = -1;
3523  Int_t genBkgMax = -1;
3524 
3525  if(genBkgTag1 > genBkgTag2)
3526  {
3527  genBkgMax = genBkgTag1;
3528  genBkgMin = genBkgTag2;
3529  }
3530  else
3531  {
3532  genBkgMax = genBkgTag2;
3533  genBkgMin = genBkgTag1;
3534  }
3535 
3536  if ( genBkgMin == 0 )
3537  {
3538  if (genBkgMax == 1 ) tag = 4; // clean+hijing
3539  else if(genBkgMax == 2 ) tag = 5; // clean+not hijing
3540  else if(genBkgMax == 3 ) tag = 6; // clean+multiple
3541  }
3542  else if ( genBkgMin == 1 )
3543  {
3544  if ( genBkgMax == 2 ) tag = 7; // hijing + not hijing
3545  else if ( genBkgMax == 3 ) tag = 8; // hijing + multiple
3546  }
3547  else if ( genBkgMin == 2 ) tag = 9; // not hijing + multiple
3548  }
3549 
3550  if(tag == -1)
3551  {
3552  printf("Combination not found, bkg1 tag %d, bkg2 tag %d\n",genBkgTag1,genBkgTag2);
3553  return;
3554  }
3555 
3556  fhPairGeneratorsBkgMass[genType][tag]->Fill(pt, mass, GetEventWeight()*weightPt);
3557  fhPairGeneratorsBkgMass [0][tag]->Fill(pt, mass, GetEventWeight()*weightPt);
3558 
3559  //
3560  if ( ptPrim < 0.1 || pt < 0.5 ) return;
3561 
3562  Float_t ratio = pt / ptPrim;
3563  Float_t diff = pt - ptPrim;
3564 
3565  if ( mcIndex==2 ) // Pi0
3566  {
3567  fhPairGeneratorsBkgMassMCPi0 [0][tag]->Fill(pt, mass, GetEventWeight()*weightPt);
3568  fhPairGeneratorsBkgMassMCPi0[genType][tag]->Fill(pt, mass, GetEventWeight()*weightPt);
3569 
3570  fhPairGeneratorsBkgEPrimRecoRatioMCPi0[0][tag]->Fill(pt, ratio, GetEventWeight()*weightPt);
3571  fhPairGeneratorsBkgEPrimRecoDiffMCPi0 [0][tag]->Fill(pt, diff, GetEventWeight()*weightPt);
3572 
3573  fhPairGeneratorsBkgEPrimRecoRatioMCPi0[genType][tag]->Fill(pt, ratio, GetEventWeight()*weightPt);
3574  fhPairGeneratorsBkgEPrimRecoDiffMCPi0 [genType][tag]->Fill(pt, diff, GetEventWeight()*weightPt);
3575 
3576  if ( mass < fPi0MassWindow[1] && mass > fPi0MassWindow[0] )
3577  {
3578  fhPairGeneratorsBkgEPrimRecoRatioMCPi0MassCut[0][tag]->Fill(pt, ratio, GetEventWeight()*weightPt);
3579  fhPairGeneratorsBkgEPrimRecoDiffMCPi0MassCut [0][tag]->Fill(pt, diff, GetEventWeight()*weightPt);
3580 
3581  fhPairGeneratorsBkgEPrimRecoRatioMCPi0MassCut[genType][tag]->Fill(pt, ratio, GetEventWeight()*weightPt);
3582  fhPairGeneratorsBkgEPrimRecoDiffMCPi0MassCut [genType][tag]->Fill(pt, diff, GetEventWeight()*weightPt);
3583  }
3584 
3586  {
3587  fhPairGeneratorsBkgCentMCPi0 [0][tag]->Fill(pt, cent, GetEventWeight()*weightPt);
3588  fhPairGeneratorsBkgCentMCPi0[genType][tag]->Fill(pt, cent, GetEventWeight()*weightPt);
3589  if ( mass < fPi0MassWindow[1] && mass > fPi0MassWindow[0] )
3590  {
3591  fhPairGeneratorsBkgCentMCPi0MassCut [0][tag]->Fill(pt, cent, GetEventWeight()*weightPt);
3592  fhPairGeneratorsBkgCentMCPi0MassCut[genType][tag]->Fill(pt, cent, GetEventWeight()*weightPt);
3593  }
3594  }
3595  }
3596  else if( mcIndex==3 ) // Eta
3597  {
3598  fhPairGeneratorsBkgMassMCEta [0][tag]->Fill(pt, mass, GetEventWeight()*weightPt);
3599  fhPairGeneratorsBkgMassMCEta[genType][tag]->Fill(pt, mass, GetEventWeight()*weightPt);
3600 
3601  fhPairGeneratorsBkgEPrimRecoRatioMCEta[0][tag]->Fill(pt, ratio, GetEventWeight()*weightPt);
3602  fhPairGeneratorsBkgEPrimRecoDiffMCEta [0][tag]->Fill(pt, diff, GetEventWeight()*weightPt);
3603 
3604  fhPairGeneratorsBkgEPrimRecoRatioMCEta[genType][tag]->Fill(pt, ratio, GetEventWeight()*weightPt);
3605  fhPairGeneratorsBkgEPrimRecoDiffMCEta [genType][tag]->Fill(pt, diff, GetEventWeight()*weightPt);
3606 
3607  if ( mass < fEtaMassWindow[1] && mass > fEtaMassWindow[0] )
3608  {
3609  fhPairGeneratorsBkgEPrimRecoRatioMCEtaMassCut[0][tag]->Fill(pt, ratio, GetEventWeight()*weightPt);
3610  fhPairGeneratorsBkgEPrimRecoDiffMCEtaMassCut [0][tag]->Fill(pt, diff, GetEventWeight()*weightPt);
3611 
3612  fhPairGeneratorsBkgEPrimRecoRatioMCEtaMassCut[genType][tag]->Fill(pt, ratio, GetEventWeight()*weightPt);
3613  fhPairGeneratorsBkgEPrimRecoDiffMCEtaMassCut [genType][tag]->Fill(pt, diff, GetEventWeight()*weightPt);
3614  }
3615 
3617  {
3618  fhPairGeneratorsBkgCentMCEta [0][tag]->Fill(pt, cent, GetEventWeight()*weightPt);
3619  fhPairGeneratorsBkgCentMCEta[genType][tag]->Fill(pt, cent, GetEventWeight()*weightPt);
3620  if ( mass < fEtaMassWindow[1] && mass > fEtaMassWindow[0] )
3621  {
3622  fhPairGeneratorsBkgCentMCEtaMassCut [0][tag]->Fill(pt, cent, GetEventWeight()*weightPt);
3623  fhPairGeneratorsBkgCentMCEtaMassCut[genType][tag]->Fill(pt, cent, GetEventWeight()*weightPt);
3624  }
3625  }
3626  }
3627  } // do cluster overlaps from cocktails
3628 
3629  // carefull adding something else here, "returns" can affect
3630 }
3631 
3632 //__________________________________________
3636 //__________________________________________
3638 {
3639  // In case of simulated data, fill acceptance histograms
3640  if(IsDataMC())
3641  {
3643 
3644  if(fFillOnlyMCAcceptanceHisto) return;
3645  }
3646 
3647 //if (GetReader()->GetEventNumber()%10000 == 0)
3648 // printf("--- Event %d ---\n",GetReader()->GetEventNumber());
3649 
3650  if(!GetInputAODBranch())
3651  {
3652  AliFatal(Form("No input aod photons in AOD with name branch < %s >, STOP",GetInputAODName().Data()));
3653  return;
3654  }
3655 
3656  //
3657  // Init some variables
3658  //
3659 
3660  // Analysis within the same detector:
3661  TClonesArray* secondLoopInputData = GetInputAODBranch();
3662 
3663  Int_t nPhot = GetInputAODBranch()->GetEntriesFast() ;
3664  Int_t nPhot2 = nPhot; // second loop
3665  Int_t minEntries = 2;
3666  Int_t last = 1; // last entry in first loop to be removed
3667 
3668  // Combine 2 detectors:
3670  {
3671  // Input from CaloTrackCorr tasks
3672  secondLoopInputData = (TClonesArray *) GetReader()->GetAODBranchList()->FindObject(fOtherDetectorInputName);
3673 
3674  // In case input from PCM or other external source
3675  if(!secondLoopInputData) secondLoopInputData = (TClonesArray *) GetReader()->GetOutputEvent()->FindObject(fOtherDetectorInputName);
3676  if(!secondLoopInputData) secondLoopInputData = (TClonesArray *) GetReader()->GetInputEvent ()->FindObject(fOtherDetectorInputName);
3677 
3678  if(!secondLoopInputData)
3679  {
3680  AliFatal(Form("Input for other detector not found in branch %s!",fOtherDetectorInputName.Data()));
3681  return ; // coverity
3682  }
3683 
3684  nPhot2 = secondLoopInputData->GetEntriesFast() ; // add one since we remove one for the normal case
3685  minEntries = 1;
3686  last = 0;
3687  }
3688 
3689  AliDebug(1,Form("Photon entries %d", nPhot));
3690 
3691  // If less than photon 2 (1) entries in the list, skip this event
3692  if ( nPhot < minEntries )
3693  {
3694  AliDebug(1,Form("nPhotons %d, cent bin %d continue to next event",nPhot, GetEventCentralityBin()));
3695 
3696  if ( GetNCentrBin() > 1 && IsHighMultiplicityAnalysisOn() )
3698 
3699  return ;
3700  }
3701  else if(fPairWithOtherDetector && nPhot2 < minEntries)
3702  {
3703  AliDebug(1,Form("nPhotons %d, cent bin %d continue to next event",nPhot, GetEventCentralityBin()));
3704 
3705  if ( GetNCentrBin() > 1 && IsHighMultiplicityAnalysisOn() )
3707 
3708  return ;
3709  }
3710 
3711  Int_t ncentr = GetNCentrBin();
3712  if(GetNCentrBin()==0) ncentr = 1;
3713 
3714  //Init variables
3715  Int_t module1 = -1;
3716  Int_t module2 = -1;
3717  Double_t vert[] = {0.0, 0.0, 0.0} ; //vertex
3718  Int_t evtIndex1 = 0 ;
3719  Int_t currentEvtIndex = -1;
3720  Int_t curCentrBin = GetEventCentralityBin();
3721  //Int_t curVzBin = GetEventVzBin();
3722  //Int_t curRPBin = GetEventRPBin();
3723  Int_t eventbin = GetEventMixBin();
3724 
3725  if(eventbin > GetNCentrBin()*GetNZvertBin()*GetNRPBin())
3726  {
3727  AliWarning(Form("Mix Bin not expected: cen bin %d, z bin %d, rp bin %d, total bin %d, Event Centrality %d, z vertex %2.3f, Reaction Plane %2.3f",
3729  return;
3730  }
3731 
3732  // Get shower shape information of clusters
3733 // TObjArray *clusters = 0;
3734 // if (GetCalorimeter()==kEMCAL) clusters = GetEMCALClusters();
3735 // else if(GetCalorimeter()==kPHOS ) clusters = GetPHOSClusters() ;
3736 
3737  //---------------------------------
3738  // First loop on photons/clusters
3739  //---------------------------------
3740  for(Int_t i1 = 0; i1 < nPhot-last; i1++)
3741  {
3742  AliAODPWG4Particle * p1 = (AliAODPWG4Particle*) (GetInputAODBranch()->At(i1)) ;
3743 
3744  // Select photons within a pT range
3745  if ( p1->Pt() < GetMinPt() || p1->Pt() > GetMaxPt() ) continue ;
3746 
3747  //printf("AliAnaPi0::MakeAnalysisFillHistograms() : cluster1 id %d/%d\n",i1,nPhot-1);
3748 
3749  // get the event index in the mixed buffer where the photon comes from
3750  // in case of mixing with analysis frame, not own mixing
3751  evtIndex1 = GetEventIndex(p1, vert) ;
3752  if ( evtIndex1 == -1 )
3753  return ;
3754  if ( evtIndex1 == -2 )
3755  continue ;
3756 
3757  // Only effective in case of mixed event frame
3758  if(TMath::Abs(vert[2]) > GetZvertexCut()) continue ; //vertex cut
3759 
3760  if (evtIndex1 != currentEvtIndex)
3761  {
3762  // Fill event bin info
3763  if( DoOwnMix() ) fhEventBin->Fill(eventbin, GetEventWeight()) ;
3764 
3766  {
3767  fhCentrality->Fill(curCentrBin, GetEventWeight());
3768 
3769  if( GetEventPlane() )
3770  fhEventPlaneResolution->Fill(curCentrBin, TMath::Cos(2.*GetEventPlane()->GetQsubRes()), GetEventWeight());
3771  }
3772 
3773  currentEvtIndex = evtIndex1 ;
3774  }
3775 
3776  //printf("AliAnaPi0::MakeAnalysisFillHistograms(): Photon 1 Evt %d Vertex : %f,%f,%f\n",evtIndex1, GetVertex(evtIndex1)[0] ,GetVertex(evtIndex1)[1],GetVertex(evtIndex1)[2]);
3777 
3778  //Get the momentum of this cluster
3779  fPhotonMom1.SetPxPyPzE(p1->Px(),p1->Py(),p1->Pz(),p1->E());
3780 
3781  //Get (Super)Module number of this cluster
3782  module1 = p1->GetSModNumber();// GetModuleNumber(p1);
3783 
3784  //------------------------------------------
3785  // Recover original cluster
3786  // Declare variables for absid col-row identification of pair
3787  // Also fill col-row, eta-phi histograms depending on pt bin
3788 
3789  Int_t iclus1 = -1, iclus2 = -1 ;
3790  Float_t maxCellFraction1 = 0, maxCellFraction2 = 0;
3791  Int_t absIdMax1 = -1, absIdMax2 = -1;
3792  Int_t icol1 = -1, icol2 = -1, icolAbs1 = -1, icolAbs2 = -1;
3793  Int_t irow1 = -1, irow2 = -1, irowAbs1 = -1, irowAbs2 = -1;
3794  Int_t iRCU1 = -1, iRCU2 = -1;
3795 
3797  {
3798  AliVCluster * cluster1 = FindCluster(GetEMCALClusters(),p1->GetCaloLabel(0),iclus1);
3799  if(!cluster1) AliWarning("Cluster1 not found!");
3800 
3801  absIdMax1 = GetCaloUtils()->GetMaxEnergyCell(GetEMCALCells(),cluster1,maxCellFraction1);
3802 
3803  GetModuleNumberCellIndexesAbsCaloMap(absIdMax1,GetCalorimeter(), icol1, irow1, iRCU1, icolAbs1, irowAbs1);
3804 
3805  if(fMultiCutAnaAcc)
3806  {
3807  for(Int_t ipt = 0; ipt < fNPtCuts; ipt++)
3808  {
3809  if( p1->Pt() > fPtCuts[ipt] && p1->Pt() < fPtCuts[ipt+1] )
3810  {
3811  fhPtBinClusterEtaPhi[ipt]->Fill(p1->Eta(),GetPhi(p1->Phi()),GetEventWeight()) ;
3812 
3813  fhPtBinClusterColRow[ipt]->Fill(icolAbs1,irowAbs1,GetEventWeight()) ;
3814  }
3815  }
3816  }
3817  }
3818 
3819  //---------------------------------
3820  // Second loop on photons/clusters
3821  //---------------------------------
3822  Int_t first = i1+1;
3823  if(fPairWithOtherDetector) first = 0;
3824 
3825  for(Int_t i2 = first; i2 < nPhot2; i2++)
3826  {
3827  //AliAODPWG4Particle * p2 = (AliAODPWG4Particle*) (GetInputAODBranch()->At(i2)) ;
3828  AliAODPWG4Particle * p2 = (AliAODPWG4Particle*) (secondLoopInputData->At(i2)) ;
3829 
3830  // Select photons within a pT range
3831  if ( p2->Pt() < GetMinPt() || p2->Pt() > GetMaxPt() ) continue ;
3832 
3833  //printf("AliAnaPi0::MakeAnalysisFillHistograms() : cluster2 i %d/%d\n",i2,nPhot);
3834 
3835  //In case of mixing frame, check we are not in the same event as the first cluster
3836  Int_t evtIndex2 = GetEventIndex(p2, vert) ;
3837  if ( evtIndex2 == -1 )
3838  return ;
3839  if ( evtIndex2 == -2 )
3840  continue ;
3841  if (GetMixedEvent() && (evtIndex1 == evtIndex2))
3842  continue ;
3843 
3844 // //------------------------------------------
3845 // // Recover original cluster
3846 // Int_t iclus2 = -1;
3847 // AliVCluster * cluster2 = FindCluster(clusters,p2->GetCaloLabel(0),iclus2,iclus1+1);
3848 // // start new loop from iclus1+1 to gain some time
3849 // if(!cluster2) AliWarning("Cluster2 not found!");
3850 //
3851 // // Get the TOF,l0 and ncells from the clusters
3852 // Float_t tof1 = -1;
3853 // Float_t l01 = -1;
3854 // Int_t ncell1 = 0;
3855 // if(cluster1)
3856 // {
3857 // tof1 = cluster1->GetTOF()*1e9;
3858 // l01 = cluster1->GetM02();
3859 // ncell1 = cluster1->GetNCells();
3860 // //printf("cluster1: E %2.2f (%2.2f), l0 %2.2f, tof %2.2f\n",cluster1->E(),p1->E(),l01,tof1);
3861 // }
3862 // //else printf("cluster1 not available: calo label %d / %d, cluster ID %d\n",
3863 // // p1->GetCaloLabel(0),(GetReader()->GetInputEvent())->GetNumberOfCaloClusters()-1,cluster1->GetID());
3864 //
3865 // Float_t tof2 = -1;
3866 // Float_t l02 = -1;
3867 // Int_t ncell2 = 0;
3868 // if(cluster2)
3869 // {
3870 // tof2 = cluster2->GetTOF()*1e9;
3871 // l02 = cluster2->GetM02();
3872 // ncell2 = cluster2->GetNCells();
3873 // //printf("cluster2: E %2.2f (%2.2f), l0 %2.2f, tof %2.2f\n",cluster2->E(),p2->E(),l02,tof2);
3874 // }
3875 // //else printf("cluster2 not available: calo label %d / %d, cluster ID %d\n",
3876 // // p2->GetCaloLabel(0),(GetReader()->GetInputEvent())->GetNumberOfCaloClusters()-1,cluster2->GetID());
3877 //
3878 // if(cluster1 && cluster2)
3879 // {
3880 // Double_t t12diff = tof1-tof2;
3881 // if(TMath::Abs(t12diff) > GetPairTimeCut()) continue;
3882 // }
3883 
3884  Float_t tof1 = p1->GetTime();
3885  Float_t l01 = p1->GetM02();
3886  Int_t ncell1 = p1->GetNCells();
3887  //printf("cluster1: E %2.2f, l0 %2.2f, tof %2.2f\n",p1->E(),l01,tof1);
3888 
3889  Float_t tof2 = p2->GetTime();
3890  Float_t l02 = p2->GetM02();
3891  Int_t ncell2 = p2->GetNCells();
3892  //printf("cluster2: E %2.2f, l0 %2.2f, tof %2.2f\n",p2->E(),l02,tof2);
3893 
3894  Double_t t12diff = tof1-tof2;
3895  fhEPairDiffTime->Fill((fPhotonMom1 + fPhotonMom2).Pt(), t12diff, GetEventWeight());
3896  if(TMath::Abs(t12diff) > GetPairTimeCut()) continue;
3897 
3898  //------------------------------------------
3899 
3900  //printf("AliAnaPi0::MakeAnalysisFillHistograms(): Photon 2 Evt %d Vertex : %f,%f,%f\n",evtIndex2, GetVertex(evtIndex2)[0] ,GetVertex(evtIndex2)[1],GetVertex(evtIndex2)[2]);
3901 
3902  // Get the momentum of this cluster
3903  fPhotonMom2.SetPxPyPzE(p2->Px(),p2->Py(),p2->Pz(),p2->E());
3904 
3905  // Get module number
3906  module2 = p2->GetSModNumber(); //GetModuleNumber(p2);
3907 
3908  //---------------------------------
3909  // Get pair kinematics
3910  //---------------------------------
3911  Double_t m = (fPhotonMom1 + fPhotonMom2).M() ;
3912  Double_t pt = (fPhotonMom1 + fPhotonMom2).Pt();
3913  Double_t deta = fPhotonMom1.Eta() - fPhotonMom2.Eta();
3914  Double_t dphi = fPhotonMom1.Phi() - fPhotonMom2.Phi();
3915  Double_t a = TMath::Abs(p1->E()-p2->E())/(p1->E()+p2->E()) ;
3916 
3917  AliDebug(2,Form("E: fPhotonMom1 %f, fPhotonMom2 %f; Pair: pT %f, mass %f, a %f", p1->E(), p2->E(), (fPhotonMom1 + fPhotonMom2).E(),m,a));
3918 
3919  //--------------------------------
3920  // Opening angle selection
3921  //--------------------------------
3922  // Check if opening angle is too large or too small compared to what is expected
3923  Double_t angle = fPhotonMom1.Angle(fPhotonMom2.Vect());
3925  {
3926  AliDebug(2,Form("Real pair angle %f (deg) not in E %f window",RadToDeg(angle), (fPhotonMom1+fPhotonMom2).E()));
3927  continue;
3928  }
3929 
3930  if(fUseAngleCut && (angle < fAngleCut || angle > fAngleMaxCut))
3931  {
3932  AliDebug(2,Form("Real pair cut %f < angle %f < cut %f (deg)",RadToDeg(fAngleCut), RadToDeg(angle), RadToDeg(fAngleMaxCut)));
3933  continue;
3934  }
3935 
3936  //-----------------------------------
3937  // In case of MC, get the ancestry and
3938  // the weight depending on particle originating the pair if requested
3939  //-----------------------------------
3940  Int_t ancPDG = 0;
3941  Int_t ancStatus = 0;
3942  Int_t ancLabel =-1;
3943  Float_t weightPt = 1;
3944  if(IsDataMC())
3945  {
3946  ancLabel = GetMCAnalysisUtils()->CheckCommonAncestor(p1->GetLabel(), p2->GetLabel(),
3947  GetMC(), ancPDG, ancStatus,fMCPrimMesonMom, fMCProdVertex);
3948  if( ancLabel >= 0 )
3949  {
3950  TString genName;
3951  Int_t index = GetReader()->GetCocktailGeneratorAndIndex(ancLabel, genName);
3952  //(GetMC())->GetCocktailGenerator(i,genName);
3953 
3954  weightPt = GetParticlePtWeight(fMCPrimMesonMom.Pt(), ancPDG, genName, index) ;
3955  }
3956  }
3957 
3958  //-------------------------------------------------------------------------------------------------
3959  // Fill module dependent histograms, put a cut on assymmetry on the first available cut in the array
3960  //-------------------------------------------------------------------------------------------------
3961  if ( a < fAsymCuts[0] && fFillSMCombinations &&
3962  module1 >=0 && module1<fNModules &&
3963  module2 >=0 && module2<fNModules )
3964  {
3966  {
3967  if ( module1==module2 )
3968  {
3969  fhReMod[module1]->Fill(pt, m, GetEventWeight()*weightPt) ;
3970  if(fFillAngleHisto) fhRealOpeningAnglePerSM[module1]->Fill(pt, angle, GetEventWeight()*weightPt);
3971  }
3972  else if (GetCalorimeter() == kEMCAL )
3973  {
3974  // Same sector
3975  Int_t isector1 = module1/2;
3976  Int_t isector2 = module2/2;
3977  if ( isector1==isector2 )
3978  {
3979  fhReSameSectorEMCALMod[isector1]->Fill(pt, m, GetEventWeight()) ;
3980  }
3981  // Same side
3982  else if ( TMath::Abs(isector2-isector1) == 1 )
3983  {
3984  Int_t iside1 = module1;
3985  Int_t iside2 = module2;
3986  // skip EMCal/DCal combination
3987  if(module1 > 11) iside1-=2;
3988  if(module2 > 11) iside2-=2;
3989 
3990  if ( module1 < module2 && module2-module1==2 )
3991  fhReSameSideEMCALMod[iside1]->Fill(pt, m, GetEventWeight());
3992  else if( module2 < module1 && module1-module2==2 )
3993  fhReSameSideEMCALMod[iside2]->Fill(pt, m, GetEventWeight());
3994  } // side
3995  } // EMCAL
3996  else
3997  { // PHOS
3998  if((module1==0 && module2==1) || (module1==1 && module2==0)) fhReDiffPHOSMod[0]->Fill(pt, m, GetEventWeight()*weightPt) ;
3999  if((module1==0 && module2==2) || (module1==2 && module2==0)) fhReDiffPHOSMod[1]->Fill(pt, m, GetEventWeight()*weightPt) ;
4000  if((module1==1 && module2==2) || (module1==2 && module2==1)) fhReDiffPHOSMod[2]->Fill(pt, m, GetEventWeight()*weightPt) ;
4001  if((module1==0 && module2==3) || (module1==3 && module2==0)) fhReDiffPHOSMod[3]->Fill(pt, m, GetEventWeight()*weightPt) ;
4002  if((module1==1 && module2==3) || (module1==3 && module2==1)) fhReDiffPHOSMod[4]->Fill(pt, m, GetEventWeight()*weightPt) ;
4003  if((module1==2 && module2==3) || (module1==3 && module2==2)) fhReDiffPHOSMod[5]->Fill(pt, m, GetEventWeight()*weightPt) ;
4004  if((module1==0 && module2==4) || (module1==4 && module2==0)) fhReDiffPHOSMod[6]->Fill(pt, m, GetEventWeight()*weightPt) ;
4005  if((module1==1 && module2==4) || (module1==4 && module2==1)) fhReDiffPHOSMod[7]->Fill(pt, m, GetEventWeight()*weightPt) ;
4006  if((module1==2 && module2==4) || (module1==4 && module2==2)) fhReDiffPHOSMod[8]->Fill(pt, m, GetEventWeight()*weightPt) ;
4007  if((module1==3 && module2==4) || (module1==4 && module2==3)) fhReDiffPHOSMod[9]->Fill(pt, m, GetEventWeight()*weightPt) ;
4008  } // PHOS
4009  }
4010  else
4011  {
4012  Float_t phi1 = GetPhi(fPhotonMom1.Phi());
4013  Float_t phi2 = GetPhi(fPhotonMom2.Phi());
4014  Bool_t etaside = 0;
4015  if( (p1->GetDetectorTag()==kEMCAL && fPhotonMom1.Eta() < 0)
4016  || (p2->GetDetectorTag()==kEMCAL && fPhotonMom2.Eta() < 0)) etaside = 1;
4017 
4018  if ( phi1 > DegToRad(260) && phi2 > DegToRad(260) && phi1 < DegToRad(280) && phi2 < DegToRad(280)) fhReSameSectorDCALPHOSMod[0+etaside]->Fill(pt, m, GetEventWeight()*weightPt);
4019  else if ( phi1 > DegToRad(280) && phi2 > DegToRad(280) && phi1 < DegToRad(300) && phi2 < DegToRad(300)) fhReSameSectorDCALPHOSMod[2+etaside]->Fill(pt, m, GetEventWeight()*weightPt);
4020  else if ( phi1 > DegToRad(300) && phi2 > DegToRad(300) && phi1 < DegToRad(320) && phi2 < DegToRad(320)) fhReSameSectorDCALPHOSMod[4+etaside]->Fill(pt, m, GetEventWeight()*weightPt);
4021  else if ( (phi1 > DegToRad(260) && phi2 > DegToRad(280) && phi1 < DegToRad(280) && phi2 < DegToRad(300))
4022  || (phi1 > DegToRad(280) && phi2 > DegToRad(260) && phi1 < DegToRad(300) && phi2 < DegToRad(280))) fhReDiffSectorDCALPHOSMod[0+etaside]->Fill(pt, m, GetEventWeight()*weightPt);
4023  else if ( (phi1 > DegToRad(280) && phi2 > DegToRad(300) && phi1 < DegToRad(300) && phi2 < DegToRad(320))
4024  || (phi1 > DegToRad(300) && phi2 > DegToRad(280) && phi1 < DegToRad(320) && phi2 < DegToRad(300))) fhReDiffSectorDCALPHOSMod[2+etaside]->Fill(pt, m, GetEventWeight()*weightPt);
4025  else if ( (phi1 > DegToRad(260) && phi2 > DegToRad(300) && phi1 < DegToRad(280) && phi2 < DegToRad(320))
4026  || (phi1 > DegToRad(300) && phi2 > DegToRad(260) && phi1 < DegToRad(320) && phi2 < DegToRad(280))) fhReDiffSectorDCALPHOSMod[4+etaside]->Fill(pt, m, GetEventWeight()*weightPt);
4027  else fhReDiffSectorDCALPHOSMod[6+etaside]->Fill(pt, m, GetEventWeight()*weightPt);
4028  }
4029  } // Fill SM combinations
4030 
4031  // In case we want only pairs in same (super) module, check their origin.
4032  Bool_t ok = kTRUE;
4033 
4034  if(fSameSM)
4035  {
4037  {
4038  if(module1!=module2) ok=kFALSE;
4039  }
4040  else // PHOS and DCal in same sector
4041  {
4042  Float_t phi1 = GetPhi(fPhotonMom1.Phi());
4043  Float_t phi2 = GetPhi(fPhotonMom2.Phi());
4044  ok=kFALSE;
4045  if ( phi1 > DegToRad(260) && phi2 > DegToRad(260) && phi1 < DegToRad(280) && phi2 < DegToRad(280)) ok = kTRUE;
4046  else if ( phi1 > DegToRad(280) && phi2 > DegToRad(280) && phi1 < DegToRad(300) && phi2 < DegToRad(300)) ok = kTRUE;
4047  else if ( phi1 > DegToRad(300) && phi2 > DegToRad(300) && phi1 < DegToRad(320) && phi2 < DegToRad(320)) ok = kTRUE;
4048  }
4049  } // Pair only in same SM
4050 
4051  if(!ok) continue;
4052 
4053  //
4054  // Fill histograms with selected cluster pairs
4055  //
4056 
4057  // Check if one of the clusters comes from a conversion
4058  if(fCheckConversion)
4059  {
4060  if (p1->IsTagged() && p2->IsTagged()) fhReConv2->Fill(pt, m, GetEventWeight()*weightPt);
4061  else if(p1->IsTagged() || p2->IsTagged()) fhReConv ->Fill(pt, m, GetEventWeight()*weightPt);
4062  }
4063 
4064  // Fill shower shape cut histograms
4066  {
4067  if ( l01 > 0.01 && l01 < 0.4 &&
4068  l02 > 0.01 && l02 < 0.4 ) fhReSS[0]->Fill(pt, m, GetEventWeight()*weightPt); // Tight
4069  else if( l01 > 0.4 && l02 > 0.4 ) fhReSS[1]->Fill(pt, m, GetEventWeight()*weightPt); // Loose
4070  else if( l01 > 0.01 && l01 < 0.4 && l02 > 0.4 ) fhReSS[2]->Fill(pt, m, GetEventWeight()*weightPt); // Both
4071  else if( l02 > 0.01 && l02 < 0.4 && l01 > 0.4 ) fhReSS[2]->Fill(pt, m, GetEventWeight()*weightPt); // Both
4072  }
4073 
4074  //
4075  // Main invariant mass histograms.
4076  // Fill histograms for different bad channel distance, centrality, assymmetry cut and pid bit
4077  //
4078  for(Int_t ipid=0; ipid<fNPIDBits; ipid++)
4079  {
4080  if((p1->IsPIDOK(fPIDBits[ipid],AliCaloPID::kPhoton)) && (p2->IsPIDOK(fPIDBits[ipid],AliCaloPID::kPhoton)))
4081  {
4082  for(Int_t iasym=0; iasym < fNAsymCuts; iasym++)
4083  {
4084  if(a < fAsymCuts[iasym])
4085  {
4086  Int_t index = ((curCentrBin*fNPIDBits)+ipid)*fNAsymCuts + iasym;
4087  //printf("index %d :(cen %d * nPID %d + ipid %d)*nasym %d + iasym %d - max index %d\n",index,curCentrBin,fNPIDBits,ipid,fNAsymCuts,iasym, curCentrBin*fNPIDBits*fNAsymCuts);
4088 
4089  if(index < 0 || index >= ncentr*fNPIDBits*fNAsymCuts) continue ;
4090 
4091  fhRe1 [index]->Fill(pt, m, GetEventWeight()*weightPt);
4092  if(fMakeInvPtPlots)fhReInvPt1[index]->Fill(pt, m, 1./pt * GetEventWeight()*weightPt) ;
4093 
4094  if(fFillBadDistHisto)
4095  {
4096  if(p1->DistToBad()>0 && p2->DistToBad()>0)
4097  {
4098  fhRe2 [index]->Fill(pt, m, GetEventWeight()*weightPt) ;
4099  if(fMakeInvPtPlots)fhReInvPt2[index]->Fill(pt, m, 1./pt * GetEventWeight()*weightPt) ;
4100 
4101  if(p1->DistToBad()>1 && p2->DistToBad()>1)
4102  {
4103  fhRe3 [index]->Fill(pt, m, GetEventWeight()*weightPt) ;
4104  if(fMakeInvPtPlots)fhReInvPt3[index]->Fill(pt, m, 1./pt * GetEventWeight()*weightPt) ;
4105  }// bad 3
4106  }// bad2
4107  }// Fill bad dist histos
4108  }//assymetry cut
4109  }// asymmetry cut loop
4110  }// bad 1
4111  }// pid bit loop
4112 
4113  //
4114  // Fill histograms with opening angle
4115  if(fFillAngleHisto)
4116  {
4117  fhRealOpeningAngle ->Fill(pt, angle, GetEventWeight()*weightPt);
4118  fhRealCosOpeningAngle->Fill(pt, TMath::Cos(angle), GetEventWeight()*weightPt);
4119  }
4120 
4121  //
4122  // Fill histograms for different opening angle bins
4124  {
4125  Int_t angleBin = -1;
4126  for(Int_t ibin = 0; ibin < fNAngleCutBins; ibin++)
4127  {
4128  if(angle >= fAngleCutBinsArray[ibin] &&
4129  angle < fAngleCutBinsArray[ibin+1]) angleBin = ibin;
4130  }
4131 
4132  if( angleBin >= 0 && angleBin < fNAngleCutBins)
4133  {
4134  Float_t e1 = fPhotonMom1.E();
4135  Float_t e2 = fPhotonMom2.E();
4136 
4137  Float_t t1 = tof1;
4138  Float_t t2 = tof2;
4139 
4140  Int_t nc1 = ncell1;
4141  Int_t nc2 = ncell2;
4142 
4143  Float_t eta1 = fPhotonMom1.Eta();
4144  Float_t eta2 = fPhotonMom2.Eta();
4145 
4146  Float_t phi1 = GetPhi(fPhotonMom1.Phi());
4147  Float_t phi2 = GetPhi(fPhotonMom2.Phi());
4148 
4149  Int_t mod1 = module1;
4150  Int_t mod2 = module2;
4151 
4152  // Recover original cluster
4153  AliVCluster * cluster2 = FindCluster(GetEMCALClusters(),p2->GetCaloLabel(0),iclus2);
4154  if(!cluster2) AliWarning("Cluster2 not found!");
4155 
4156  absIdMax2 = GetCaloUtils()->GetMaxEnergyCell(GetEMCALCells(),cluster2,maxCellFraction2);
4157 
4158  if(e2 > e1)
4159  {
4160  e1 = fPhotonMom2.E();
4161  e2 = fPhotonMom1.E();
4162 
4163  t1 = tof2;
4164  t2 = tof1;
4165 
4166  nc1 = ncell2;
4167  nc2 = ncell1;
4168 
4169  eta1 = fPhotonMom2.Eta();
4170  eta2 = fPhotonMom1.Eta();
4171 
4172  phi1 = GetPhi(fPhotonMom2.Phi());
4173  phi2 = GetPhi(fPhotonMom1.Phi());
4174 
4175  mod1 = module2;
4176  mod2 = module1;
4177 
4178  Int_t tmp = absIdMax2;
4179  absIdMax2 = absIdMax1;
4180  absIdMax1 = tmp;
4181  }
4182 
4183  fhReOpAngleBinMinClusterEPerSM[angleBin]->Fill(e2,mod2,GetEventWeight()*weightPt) ;
4184  fhReOpAngleBinMaxClusterEPerSM[angleBin]->Fill(e1,mod1,GetEventWeight()*weightPt) ;
4185 
4186  fhReOpAngleBinMinClusterTimePerSM[angleBin]->Fill(t2,mod2,GetEventWeight()*weightPt) ;
4187  fhReOpAngleBinMaxClusterTimePerSM[angleBin]->Fill(t1,mod1,GetEventWeight()*weightPt) ;
4188 
4189  fhReOpAngleBinMinClusterNCellPerSM[angleBin]->Fill(nc2,mod2,GetEventWeight()*weightPt) ;
4190  fhReOpAngleBinMaxClusterNCellPerSM[angleBin]->Fill(nc1,mod1,GetEventWeight()*weightPt) ;
4191 
4192  fhReOpAngleBinPairClusterMass[angleBin]->Fill(pt,m,GetEventWeight()*weightPt) ;
4193  if(mod2 == mod1) fhReOpAngleBinPairClusterMassPerSM[angleBin]->Fill(m,mod1,GetEventWeight()*weightPt) ;
4194 
4195  if(e1 > 0.01) fhReOpAngleBinPairClusterRatioPerSM[angleBin]->Fill(e2/e1,mod1,GetEventWeight()*weightPt) ;
4196 
4197  fhReOpAngleBinMinClusterEtaPhi[angleBin]->Fill(eta2,phi2,GetEventWeight()*weightPt) ;
4198  fhReOpAngleBinMaxClusterEtaPhi[angleBin]->Fill(eta1,phi1,GetEventWeight()*weightPt) ;
4199 
4200  GetModuleNumberCellIndexesAbsCaloMap(absIdMax2,GetCalorimeter(), icol2, irow2, iRCU2, icolAbs2, irowAbs2);
4201 
4202  //fhReOpAngleBinPairClusterAbsIdMaxCell[angleBin]->Fill(absIdMax1,absIdMax2,GetEventWeight()*weightPt);
4203 
4204  fhReOpAngleBinMinClusterColRow[angleBin]->Fill(icolAbs2,irowAbs2,GetEventWeight()*weightPt) ;
4205  fhReOpAngleBinMaxClusterColRow[angleBin]->Fill(icolAbs1,irowAbs1,GetEventWeight()*weightPt) ;
4206  }
4207  } // fFillOpAngleHisto
4208 
4209 
4210  // Fill histograms with pair assymmetry
4212  {
4213  fhRePtAsym->Fill(pt, a, GetEventWeight()*weightPt);
4214  if ( m > fPi0MassWindow[0] && m < fPi0MassWindow[1] ) fhRePtAsymPi0->Fill(pt, a, GetEventWeight()*weightPt);
4215  if ( m > fEtaMassWindow[0] && m < fEtaMassWindow[1] ) fhRePtAsymEta->Fill(pt, a, GetEventWeight()*weightPt);
4216  }
4217 
4218  // Check cell time content in cluster
4220  {
4221  if ( p1->GetFiducialArea() == 0 && p2->GetFiducialArea() == 0 )
4222  fhReSecondaryCellInTimeWindow ->Fill(pt, m, GetEventWeight()*weightPt);
4223 
4224  else if ( p1->GetFiducialArea() != 0 && p2->GetFiducialArea() != 0 )
4225  fhReSecondaryCellOutTimeWindow->Fill(pt, m, GetEventWeight()*weightPt);
4226  }
4227 
4228  //---------
4229  // MC data
4230  //---------
4231  // Do some MC checks on the origin of the pair, is there any common ancestor and if there is one, who?
4232  if(IsDataMC())
4233  {
4234  if(GetMCAnalysisUtils()->CheckTagBit(p1->GetTag(),AliMCAnalysisUtils::kMCConversion) &&
4236  {
4237  fhReMCFromConversion->Fill(pt, m, GetEventWeight()*weightPt);
4238  }
4239  else if(!GetMCAnalysisUtils()->CheckTagBit(p1->GetTag(),AliMCAnalysisUtils::kMCConversion) &&
4241  {
4242  fhReMCFromNotConversion->Fill(pt, m, GetEventWeight()*weightPt);
4243  }
4244  else
4245  {
4246  fhReMCFromMixConversion->Fill(pt, m, GetEventWeight()*weightPt);
4247  }
4248 
4249  if(fFillOriginHisto)
4250  FillMCVersusRecDataHistograms(ancLabel, ancPDG, ancStatus, weightPt,
4251  p1->GetCaloLabel(0), p2->GetCaloLabel(0),
4252  p1->GetTag(),p2->GetTag(),
4253  p1->Pt(), p2->Pt(),
4254  ncell1, ncell2, m, pt, a, deta, dphi, angle);
4255  }
4256 
4257  //-----------------------
4258  // Multi cuts analysis
4259  //-----------------------
4260  if(fMultiCutAna)
4261  {
4262  // Several pt,ncell and asymmetry cuts
4263  for(Int_t ipt = 0; ipt < fNPtCuts; ipt++)
4264  {
4265  for(Int_t icell = 0; icell < fNCellNCuts; icell++)
4266  {
4267  for(Int_t iasym = 0; iasym < fNAsymCuts; iasym++)
4268  {
4269  Int_t index = ((ipt*fNCellNCuts)+icell)*fNAsymCuts + iasym;
4270  if(p1->Pt() > fPtCuts[ipt] && p2->Pt() > fPtCuts[ipt] &&
4271  p1->Pt() < fPtCutsMax[ipt] && p2->Pt() < fPtCutsMax[ipt] &&
4272  a < fAsymCuts[iasym] &&
4273  ncell1 >= fCellNCuts[icell] && ncell2 >= fCellNCuts[icell])
4274  {
4275  fhRePtNCellAsymCuts[index]->Fill(pt, m, GetEventWeight()*weightPt) ;
4276  if(fFillAngleHisto) fhRePtNCellAsymCutsOpAngle[index]->Fill(pt, angle, GetEventWeight()*weightPt) ;
4277 
4278  if(fFillSMCombinations && module1==module2)
4279  {
4280  fhRePtNCellAsymCutsSM[module1][index]->Fill(pt, m, GetEventWeight()*weightPt) ;
4281  if(fFillAngleHisto) fhRePtNCellAsymCutsSMOpAngle[module1][index]->Fill(pt, angle, GetEventWeight()*weightPt) ;
4282  }
4283  }
4284  }// pid bit cut loop
4285  }// icell loop
4286  }// pt cut loop
4287  }// multiple cuts analysis
4288 
4289  }// second same event particle
4290  }// first cluster
4291 
4292  //-------------------------------------------------------------
4293  // Mixing
4294  //-------------------------------------------------------------
4295  if(DoOwnMix())
4296  {
4297  // Recover events in with same characteristics as the current event
4298 
4299  // Check that the bin exists, if not (bad determination of RP, centrality or vz bin) do nothing
4300  if(eventbin < 0) return ;
4301 
4302  TList * evMixList=fEventsList[eventbin] ;
4303 
4304  if(!evMixList)
4305  {
4306  AliWarning(Form("Mix event list not available, bin %d",eventbin));
4307  return;
4308  }
4309 
4310  Int_t nMixed = evMixList->GetSize() ;
4311  for(Int_t ii=0; ii<nMixed; ii++)
4312  {
4313  TClonesArray* ev2= (TClonesArray*) (evMixList->At(ii));
4314  Int_t nPhot2=ev2->GetEntriesFast() ;
4315  Double_t m = -999;
4316  AliDebug(1,Form("Mixed event %d photon entries %d, centrality bin %d",ii, nPhot2, GetEventCentralityBin()));
4317 
4318  fhEventMixBin->Fill(eventbin, GetEventWeight()) ;
4319 
4320  //---------------------------------
4321  // First loop on photons/clusters
4322  //---------------------------------
4323  for(Int_t i1 = 0; i1 < nPhot; i1++)
4324  {
4325  AliAODPWG4Particle * p1 = (AliAODPWG4Particle*) (GetInputAODBranch()->At(i1)) ;
4326 
4327  // Select photons within a pT range
4328  if ( p1->Pt() < GetMinPt() || p1->Pt() > GetMaxPt() ) continue ;
4329 
4330  // Not sure why this line is here
4331  //if(fSameSM && GetModuleNumber(p1)!=module1) continue;
4332 
4333  //Get kinematics of cluster and (super) module of this cluster
4334  fPhotonMom1.SetPxPyPzE(p1->Px(),p1->Py(),p1->Pz(),p1->E());
4335  module1 = GetModuleNumber(p1);
4336 
4337  //---------------------------------
4338  // Second loop on other mixed event photons/clusters
4339  //---------------------------------
4340  for(Int_t i2 = 0; i2 < nPhot2; i2++)
4341  {
4342  AliAODPWG4Particle * p2 = (AliAODPWG4Particle*) (ev2->At(i2)) ;
4343 
4344  // Select photons within a pT range
4345  if ( p2->Pt() < GetMinPt() || p2->Pt() > GetMaxPt() ) continue ;
4346 
4347  // Get kinematics of second cluster and calculate those of the pair
4348  fPhotonMom2.SetPxPyPzE(p2->Px(),p2->Py(),p2->Pz(),p2->E());
4349  m = (fPhotonMom1+fPhotonMom2).M() ;
4350  Double_t pt = (fPhotonMom1 + fPhotonMom2).Pt();
4351  Double_t a = TMath::Abs(p1->E()-p2->E())/(p1->E()+p2->E()) ;
4352 
4353  // Check if opening angle is too large or too small compared to what is expected
4354  Double_t angle = fPhotonMom1.Angle(fPhotonMom2.Vect());
4356  {
4357  AliDebug(2,Form("Mix pair angle %f (deg) not in E %f window",RadToDeg(angle), (fPhotonMom1+fPhotonMom2).E()));
4358  continue;
4359  }
4360 
4361  if(fUseAngleCut && (angle < fAngleCut || angle > fAngleMaxCut))
4362  {
4363  AliDebug(2,Form("Mix pair cut %f < angle %f < cut %f (deg)",RadToDeg(fAngleCut),RadToDeg(angle),RadToDeg(fAngleMaxCut)));
4364  continue;
4365  }
4366 
4367  AliDebug(2,Form("Mixed Event: pT: fPhotonMom1 %2.2f, fPhotonMom2 %2.2f; Pair: pT %2.2f, mass %2.3f, a %2.3f",p1->Pt(), p2->Pt(), pt,m,a));
4368 
4369  // In case we want only pairs in same (super) module, check their origin.
4370  module2 = GetModuleNumber(p2);
4371 
4372  //-------------------------------------------------------------------------------------------------
4373  // Fill module dependent histograms, put a cut on assymmetry on the first available cut in the array
4374  //-------------------------------------------------------------------------------------------------
4375  if ( a < fAsymCuts[0] && fFillSMCombinations &&
4376  module1 >=0 && module1<fNModules &&
4377  module2 >=0 && module2<fNModules )
4378  {
4379  if ( !fPairWithOtherDetector )
4380  {
4381  if ( module1==module2 )
4382  {
4383  fhMiMod[module1]->Fill(pt, m, GetEventWeight()) ;
4384  if(fFillAngleHisto) fhMixedOpeningAnglePerSM[module1]->Fill(pt, angle, GetEventWeight());
4385  }
4386  else if ( GetCalorimeter()==kEMCAL )
4387  {
4388  // Same sector
4389  Int_t isector1 = module1/2;
4390  Int_t isector2 = module2/2;
4391  if ( isector1==isector2 )
4392  {
4393  fhMiSameSectorEMCALMod[isector1]->Fill(pt, m, GetEventWeight()) ;
4394  }
4395  // Same side
4396  else if ( TMath::Abs(isector2-isector1) == 1 )
4397  {
4398  Int_t iside1 = module1;
4399  Int_t iside2 = module2;
4400  // skip EMCal/DCal combination
4401  if(module1 > 11) iside1-=2;
4402  if(module2 > 11) iside2-=2;
4403 
4404  if ( module1 < module2 && module2-module1==2 )
4405  fhMiSameSideEMCALMod[iside1]->Fill(pt, m, GetEventWeight());
4406  else if( module2 < module1 && module1-module2==2 )
4407  fhMiSameSideEMCALMod[iside2]->Fill(pt, m, GetEventWeight());
4408  }
4409  } // EMCAL
4410  else
4411  { // PHOS
4412  if((module1==0 && module2==1) || (module1==1 && module2==0)) fhMiDiffPHOSMod[0]->Fill(pt, m, GetEventWeight()) ;
4413  if((module1==0 && module2==2) || (module1==2 && module2==0)) fhMiDiffPHOSMod[1]->Fill(pt, m, GetEventWeight()) ;
4414  if((module1==1 && module2==2) || (module1==2 && module2==1)) fhMiDiffPHOSMod[2]->Fill(pt, m, GetEventWeight()) ;
4415  if((module1==0 && module2==3) || (module1==3 && module2==0)) fhMiDiffPHOSMod[3]->Fill(pt, m, GetEventWeight()) ;
4416  if((module1==1 && module2==3) || (module1==3 && module2==1)) fhMiDiffPHOSMod[4]->Fill(pt, m, GetEventWeight()) ;
4417  if((module1==2 && module2==3) || (module1==3 && module2==2)) fhMiDiffPHOSMod[5]->Fill(pt, m, GetEventWeight()) ;
4418  if((module1==0 && module2==4) || (module1==4 && module2==0)) fhMiDiffPHOSMod[6]->Fill(pt, m, GetEventWeight()) ;
4419  if((module1==1 && module2==4) || (module1==4 && module2==1)) fhMiDiffPHOSMod[7]->Fill(pt, m, GetEventWeight()) ;
4420  if((module1==2 && module2==4) || (module1==4 && module2==2)) fhMiDiffPHOSMod[8]->Fill(pt, m, GetEventWeight()) ;
4421  if((module1==3 && module2==4) || (module1==4 && module2==3)) fhMiDiffPHOSMod[9]->Fill(pt, m, GetEventWeight()) ;
4422  } // PHOS
4423  }
4424  else
4425  {
4426  Float_t phi1 = GetPhi(fPhotonMom1.Phi());
4427  Float_t phi2 = GetPhi(fPhotonMom2.Phi());
4428  Bool_t etaside = 0;
4429  if( (p1->GetDetectorTag()==kEMCAL && fPhotonMom1.Eta() < 0)
4430  || (p2->GetDetectorTag()==kEMCAL && fPhotonMom2.Eta() < 0)) etaside = 1;
4431 
4432  if ( phi1 > DegToRad(260) && phi2 > DegToRad(260) && phi1 < DegToRad(280) && phi2 < DegToRad(280)) fhMiSameSectorDCALPHOSMod[0+etaside]->Fill(pt, m, GetEventWeight());
4433  else if ( phi1 > DegToRad(280) && phi2 > DegToRad(280) && phi1 < DegToRad(300) && phi2 < DegToRad(300)) fhMiSameSectorDCALPHOSMod[2+etaside]->Fill(pt, m, GetEventWeight());
4434  else if ( phi1 > DegToRad(300) && phi2 > DegToRad(300) && phi1 < DegToRad(320) && phi2 < DegToRad(320)) fhMiSameSectorDCALPHOSMod[4+etaside]->Fill(pt, m, GetEventWeight());
4435  else if ( (phi1 > DegToRad(260) && phi2 > DegToRad(280) && phi1 < DegToRad(280) && phi2 < DegToRad(300))
4436  || (phi1 > DegToRad(280) && phi2 > DegToRad(260) && phi1 < DegToRad(300) && phi2 < DegToRad(280))) fhMiDiffSectorDCALPHOSMod[0+etaside]->Fill(pt, m, GetEventWeight());
4437  else if ( (phi1 > DegToRad(280) && phi2 > DegToRad(300) && phi1 < DegToRad(300) && phi2 < DegToRad(320))
4438  || (phi1 > DegToRad(300) && phi2 > DegToRad(280) && phi1 < DegToRad(320) && phi2 < DegToRad(300))) fhMiDiffSectorDCALPHOSMod[2+etaside]->Fill(pt, m, GetEventWeight());
4439  else if ( (phi1 > DegToRad(260) && phi2 > DegToRad(300) && phi1 < DegToRad(280) && phi2 < DegToRad(320))
4440  || (phi1 > DegToRad(300) && phi2 > DegToRad(260) && phi1 < DegToRad(320) && phi2 < DegToRad(280))) fhMiDiffSectorDCALPHOSMod[4+etaside]->Fill(pt, m, GetEventWeight());
4441  else fhMiDiffSectorDCALPHOSMod[6+etaside]->Fill(pt, m, GetEventWeight());
4442  }
4443  } // different SM combinations
4444 
4445  Bool_t ok = kTRUE;
4446  if(fSameSM)
4447  {
4449  {
4450  if(module1!=module2) ok=kFALSE;
4451  }
4452  else // PHOS and DCal in same sector
4453  {
4454  Float_t phi1 = GetPhi(fPhotonMom1.Phi());
4455  Float_t phi2 = GetPhi(fPhotonMom2.Phi());
4456  ok=kFALSE;
4457  if ( phi1 > DegToRad(260) && phi2 > DegToRad(260) && phi1 < DegToRad(280) && phi2 < DegToRad(280)) ok = kTRUE;
4458  else if ( phi1 > DegToRad(280) && phi2 > DegToRad(280) && phi1 < DegToRad(300) && phi2 < DegToRad(300)) ok = kTRUE;
4459  else if ( phi1 > DegToRad(300) && phi2 > DegToRad(300) && phi1 < DegToRad(320) && phi2 < DegToRad(320)) ok = kTRUE;
4460  }
4461  } // Pair only in same SM
4462 
4463  if(!ok) continue ;
4464 
4465  //
4466  // Do the final histograms with the selected clusters
4467  //
4468 
4469  // Check if one of the clusters comes from a conversion
4470  if(fCheckConversion)
4471  {
4472  if (p1->IsTagged() && p2->IsTagged()) fhMiConv2->Fill(pt, m, GetEventWeight());
4473  else if(p1->IsTagged() || p2->IsTagged()) fhMiConv ->Fill(pt, m, GetEventWeight());
4474  }
4475 
4476  //
4477  // Main invariant mass histograms
4478  // Fill histograms for different bad channel distance, centrality, assymmetry cut and pid bit
4479  //
4480  for(Int_t ipid=0; ipid<fNPIDBits; ipid++)
4481  {
4482  if((p1->IsPIDOK(ipid,AliCaloPID::kPhoton)) && (p2->IsPIDOK(ipid,AliCaloPID::kPhoton)))
4483  {
4484  for(Int_t iasym=0; iasym < fNAsymCuts; iasym++)
4485  {
4486  if(a < fAsymCuts[iasym])
4487  {
4488  Int_t index = ((curCentrBin*fNPIDBits)+ipid)*fNAsymCuts + iasym;
4489 
4490  if(index < 0 || index >= ncentr*fNPIDBits*fNAsymCuts) continue ;
4491 
4492  fhMi1[index]->Fill(pt, m, GetEventWeight()) ;
4493  if(fMakeInvPtPlots)fhMiInvPt1[index]->Fill(pt, m, 1./pt * GetEventWeight()) ;
4494 
4495  if(fFillBadDistHisto)
4496  {
4497  if(p1->DistToBad()>0 && p2->DistToBad()>0)
4498  {
4499  fhMi2[index]->Fill(pt, m, GetEventWeight()) ;
4500  if(fMakeInvPtPlots)fhMiInvPt2[index]->Fill(pt, m, 1./pt * GetEventWeight()) ;
4501 
4502  if(p1->DistToBad()>1 && p2->DistToBad()>1)
4503  {
4504  fhMi3[index]->Fill(pt, m, GetEventWeight()) ;
4505  if(fMakeInvPtPlots)fhMiInvPt3[index]->Fill(pt, m, 1./pt * GetEventWeight()) ;
4506  }
4507  }
4508  }// Fill bad dist histo
4509 
4510  }//Asymmetry cut
4511  }// Asymmetry loop
4512  }//PID cut
4513  }// PID loop
4514 
4515  //-----------------------
4516  // Multi cuts analysis
4517  //-----------------------
4518  Int_t ncell1 = p1->GetNCells();
4519  Int_t ncell2 = p1->GetNCells();
4520 
4521  if(fMultiCutAna)
4522  {
4523  // Several pt,ncell and asymmetry cuts
4524  for(Int_t ipt=0; ipt<fNPtCuts; ipt++)
4525  {
4526  for(Int_t icell=0; icell<fNCellNCuts; icell++)
4527  {
4528  for(Int_t iasym=0; iasym<fNAsymCuts; iasym++)
4529  {
4530  Int_t index = ((ipt*fNCellNCuts)+icell)*fNAsymCuts + iasym;
4531 
4532  if(p1->Pt() > fPtCuts[ipt] && p2->Pt() > fPtCuts[ipt] &&
4533  p1->Pt() < fPtCutsMax[ipt] && p2->Pt() < fPtCutsMax[ipt] &&
4534  a < fAsymCuts[iasym] &&
4535  ncell1 >= fCellNCuts[icell] && ncell2 >= fCellNCuts[icell]
4536  )
4537  {
4538  //printf("MI ipt %d, iasym%d, icell %d, index %d \n",ipt, iasym, icell, index);
4539  //printf("\t %p, %p\n",fhMiPtNCellAsymCuts[index],fhMiPtNCellAsymCutsOpAngle[index]);
4540 
4541  fhMiPtNCellAsymCuts[index]->Fill(pt, m, GetEventWeight()) ;
4542  if(fFillAngleHisto) fhMiPtNCellAsymCutsOpAngle[index]->Fill(pt, angle, GetEventWeight()) ;
4543 
4544  //printf("ipt %d, icell%d, iasym %d, name %s\n",ipt, icell, iasym, fhRePtNCellAsymCuts[((ipt*fNCellNCuts)+icell)*fNAsymCuts + iasym]->GetName());
4545  }
4546  }// pid bit cut loop
4547  }// icell loop
4548  }// pt cut loop
4549  } // Multi cut ana
4550 
4551  //
4552  // Fill histograms with opening angle
4553  if(fFillAngleHisto)
4554  {
4555  fhMixedOpeningAngle ->Fill(pt, angle, GetEventWeight());
4556  fhMixedCosOpeningAngle->Fill(pt, TMath::Cos(angle), GetEventWeight());
4557  }
4558 
4559  //
4560  // Fill histograms for different opening angle bins
4562  {
4563  Int_t angleBin = -1;
4564  for(Int_t ibin = 0; ibin < fNAngleCutBins; ibin++)
4565  {
4566  if(angle >= fAngleCutBinsArray[ibin] &&
4567  angle < fAngleCutBinsArray[ibin+1]) angleBin = ibin;
4568  }
4569 
4570  if( angleBin >= 0 && angleBin < fNAngleCutBins)
4571  {
4572  Float_t e1 = fPhotonMom1.E();
4573  Float_t e2 = fPhotonMom2.E();
4574 
4575  Float_t t1 = p1->GetTime();
4576  Float_t t2 = p2->GetTime();
4577 
4578  Int_t nc1 = ncell1;
4579  Int_t nc2 = ncell2;
4580 
4581  Float_t eta1 = fPhotonMom1.Eta();
4582  Float_t eta2 = fPhotonMom2.Eta();
4583 
4584  Float_t phi1 = GetPhi(fPhotonMom1.Phi());
4585  Float_t phi2 = GetPhi(fPhotonMom2.Phi());
4586 
4587  Int_t mod1 = module1;
4588  Int_t mod2 = module2;
4589 
4590  // // Recover original cluster
4591  // Int_t iclus1 = -1, iclus2 = -1 ;
4592  // AliVCluster * cluster1 = FindCluster(GetEMCALClusters(),p1->GetCaloLabel(0),iclus1);
4593  // AliVCluster * cluster2 = FindCluster(GetEMCALClusters(),p2->GetCaloLabel(0),iclus2);
4594  //
4595  // Float_t maxCellFraction1 = 0, maxCellFraction2 = 0;
4596  // Int_t absIdMax1 = GetCaloUtils()->GetMaxEnergyCell(GetEMCALCells(),cluster1,maxCellFraction1);
4597  // Int_t absIdMax2 = GetCaloUtils()->GetMaxEnergyCell(GetEMCALCells(),cluster2,maxCellFraction2);
4598 
4599  if(e2 > e1)
4600  {
4601  e1 = fPhotonMom2.E();
4602  e2 = fPhotonMom1.E();
4603 
4604  t1 = p2->GetTime();
4605  t2 = p1->GetTime();
4606 
4607  nc1 = ncell2;
4608  nc2 = ncell1;
4609 
4610  eta1 = fPhotonMom2.Eta();
4611  eta2 = fPhotonMom1.Eta();
4612 
4613  phi1 = GetPhi(fPhotonMom2.Phi());
4614  phi2 = GetPhi(fPhotonMom1.Phi());
4615 
4616  mod1 = module2;
4617  mod2 = module1;
4618 
4619  // Int_t tmp = absIdMax2;
4620  // absIdMax2 = absIdMax1;
4621  // absIdMax1 = tmp;
4622  }
4623 
4624  fhMiOpAngleBinMinClusterEPerSM[angleBin]->Fill(e2,mod2,GetEventWeight()) ;
4625  fhMiOpAngleBinMaxClusterEPerSM[angleBin]->Fill(e1,mod1,GetEventWeight()) ;
4626 
4627  fhMiOpAngleBinMinClusterTimePerSM[angleBin]->Fill(t2,mod2,GetEventWeight()) ;
4628  fhMiOpAngleBinMaxClusterTimePerSM[angleBin]->Fill(t1,mod1,GetEventWeight()) ;
4629 
4630  fhMiOpAngleBinMinClusterNCellPerSM[angleBin]->Fill(nc2,mod2,GetEventWeight()) ;
4631  fhMiOpAngleBinMaxClusterNCellPerSM[angleBin]->Fill(nc1,mod1,GetEventWeight()) ;
4632 
4633  fhMiOpAngleBinPairClusterMass[angleBin]->Fill(pt,m,GetEventWeight()) ;
4634  if(mod2 == mod1) fhMiOpAngleBinPairClusterMassPerSM[angleBin]->Fill(m,mod1,GetEventWeight()) ;
4635 
4636  if(e1 > 0.01) fhMiOpAngleBinPairClusterRatioPerSM[angleBin]->Fill(e2/e1,mod1,GetEventWeight()) ;
4637 
4638  fhMiOpAngleBinMinClusterEtaPhi[angleBin]->Fill(eta2,phi2,GetEventWeight()) ;
4639  fhMiOpAngleBinMaxClusterEtaPhi[angleBin]->Fill(eta1,phi1,GetEventWeight()) ;
4640 
4641  // Int_t icol1 = -1, icol2 = -1, icolAbs1 = -1, icolAbs2 = -1;
4642  // Int_t irow1 = -1, irow2 = -1, irowAbs1 = -1, irowAbs2 = -1;
4643  // Int_t iRCU1 = -1, iRCU2 = -1;
4644  // GetModuleNumberCellIndexesAbsCaloMap(absIdMax1,GetCalorimeter(), icol1, irow1, iRCU1, icolAbs1, irowAbs1);
4645  // GetModuleNumberCellIndexesAbsCaloMap(absIdMax2,GetCalorimeter(), icol2, irow2, iRCU1, icolAbs2,