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