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