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