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