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