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