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