AliPhysics  97344c9 (97344c9)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliAnaPhotonConvInCalo.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 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 <TH2F.h>
18 #include <TH3D.h>
19 #include <TClonesArray.h>
20 #include <TObjString.h>
21 #include "TParticle.h"
22 #include "TDatabasePDG.h"
23 
24 // --- Analysis system ---
25 #include "AliAnaPhotonConvInCalo.h"
26 #include "AliCaloTrackReader.h"
27 #include "AliStack.h"
28 #include "AliCaloPID.h"
29 #include "AliMCAnalysisUtils.h"
30 #include "AliFiducialCut.h"
31 #include "AliVCluster.h"
32 #include "AliAODMCParticle.h"
33 
37 
38 //________________________________________________
40 //________________________________________________
43 fRemoveConvertedPair(kFALSE),
44 fAddConvertedPairsToAOD(kFALSE),
45 fFillClusterConvDistHisto(kFALSE),
46 fMassCut(0), fMassCutTight(0),
47 fConvAsymCut(1.), fConvDEtaCut(2.),
48 fConvDPhiMinCut(-1.), fConvDPhiMaxCut(7.),
49 fMomentum(), fProdVertex(),
50 // Histograms
51 fhPtPhotonConv(0),
52 fhConvDeltaEta(0), fhConvDeltaPhi(0), fhConvDeltaEtaPhi(0),
53 fhConvAsym(0), fhConvPt(0),
54 fhConvDistEta(0), fhConvDistPhi(0), fhConvDistEn(0), fhConvDistMass(0),
55 fhConvDistEtaCutEta(0), fhConvDistPhiCutEta(0), fhConvDistEnCutEta(0), fhConvDistMassCutEta(0),
56 fhConvDistEtaCutMass(0), fhConvDistPhiCutMass(0), fhConvDistEnCutMass(0),
57 fhConvDistEtaCutAsy(0), fhConvDistPhiCutAsy(0), fhConvDistEnCutAsy(0), fhConvDistMassCutAsy(0),
58 fhConvDistEtaCutAll(0), fhConvDistPhiCutAll(0), fhConvDistEnCutAll(0),
59 
60 // MC histograms
61 fhPtConversionTagged(0), fhPtAntiNeutronTagged(0),
62 fhPtAntiProtonTagged(0), fhPtUnknownTagged(0),
63 
64 fhConvDeltaEtaMCConversion(0), fhConvDeltaPhiMCConversion(0), fhConvDeltaEtaPhiMCConversion(0),
65 fhConvAsymMCConversion(0), fhConvPtMCConversion(0),
66 //fhConvDispersionMCConversion(0),
67 fhConvM02MCConversion(0),
68 
69 fhConvDeltaEtaMCAntiNeutron(0), fhConvDeltaPhiMCAntiNeutron(0), fhConvDeltaEtaPhiMCAntiNeutron(0),
70 fhConvAsymMCAntiNeutron(0), fhConvPtMCAntiNeutron(0),
71 //fhConvDispersionMCAntiNeutron(0),
72 fhConvM02MCAntiNeutron(0),
73 fhConvDeltaEtaMCAntiProton(0), fhConvDeltaPhiMCAntiProton(0), fhConvDeltaEtaPhiMCAntiProton(0),
74 fhConvAsymMCAntiProton(0), fhConvPtMCAntiProton(0),
75 //fhConvDispersionMCAntiProton(0),
76 fhConvM02MCAntiProton(0),
77 fhConvDeltaEtaMCString(0), fhConvDeltaPhiMCString(0), fhConvDeltaEtaPhiMCString(0),
78 fhConvAsymMCString(0), fhConvPtMCString(0),
79 //fhConvDispersionMCString(0),
80 fhConvM02MCString(0),
81 fhConvDistMCConversion(0), fhConvDistMCConversionCuts(0)
82 {
84 
85  for(Int_t ibin = 0; ibin < 6; ibin++)
86  {
87  fhEtaPhiPhotonConv [ibin] = 0;
88  fhEtaPhiPhotonConvPaired[ibin] = 0;
89  fhConvPtMCConversionRcut[ibin] = 0;
90  //fhConvPtRcut [ibin] = 0;
91  }
92 
93 }
94 
95 //_____________________________________________________
97 //_____________________________________________________
99 {
100  TString parList ; //this will be list of parameters used for this analysis.
101  const Int_t buffersize = 255;
102  char onePar[buffersize] ;
103 
104  snprintf(onePar,buffersize,"--- AliAnaPhotonConvInCalo---:") ;
105  parList+=onePar ;
106  snprintf(onePar,buffersize,"Conversion pair mass cut = %1.2f and tight mass cut = %1.2f; ",fMassCut,fMassCutTight);
107  parList+=onePar ;
108  snprintf(onePar,buffersize,"Conversion Selection: fConvAsymCut %1.2f, fConvDEtaCut %1.2f fConvDPhiCut (%1.2f,%1.2f); ",
110  parList+=onePar ;
111  snprintf(onePar,buffersize,"Add conversion pair to AOD = %d, remove partners? %d. ",fAddConvertedPairsToAOD, fRemoveConvertedPair);
112  parList+=onePar ;
113 
114  return new TObjString(parList) ;
115 }
116 
117 //_______________________________________________________
120 //_______________________________________________________
122 {
123  TList * outputContainer = new TList() ;
124  outputContainer->SetName("PhotonConvInCaloHistos") ;
125 
129 
130  Int_t ndist = 250;
131  Int_t mindist = 0;
132  Int_t maxdist = 500;
133 
134  TString region[] = {"ITS","TPC","TRD","TOF","Top EMCal","In EMCal"};
135 
136  fhPtPhotonConv = new TH1F("hPtPhotonConv","Number of #gamma over calorimeter, conversion",nptbins,ptmin,ptmax);
137  fhPtPhotonConv->SetYTitle("N");
138  fhPtPhotonConv->SetXTitle("#it{p}_{T #gamma}(GeV/#it{c})");
139  outputContainer->Add(fhPtPhotonConv) ;
140 
141  Float_t ebin[] = {0.3,0.4,0.5,0.6,0.75,1,2};
142 
143  for(Int_t iebin = 0; iebin < 6; iebin++)
144  {
145  fhEtaPhiPhotonConv[iebin] = new TH2F
146  (Form("hEtaPhiPhotonConv_ebin%d",iebin),Form("pair #eta vs #phi, %2.2f<#it{E}<%2.2f GeV/#it{c}",ebin[iebin],ebin[iebin+1]),
147  netabins,etamin,etamax,nphibins,phimin,phimax);
148  fhEtaPhiPhotonConv[iebin]->SetYTitle("#phi (rad)");
149  fhEtaPhiPhotonConv[iebin]->SetXTitle("#eta");
150  outputContainer->Add(fhEtaPhiPhotonConv[iebin]) ;
151 
152  fhEtaPhiPhotonConvPaired[iebin] = new TH2F
153  (Form("hEtaPhiPhotonConvPaired_ebin%d",iebin),Form("cluster #eta vs #phi, %2.2f<#it{E}<%2.2f GeV/#it{c}",ebin[iebin],ebin[iebin+1]),
154  netabins,etamin,etamax,nphibins,phimin,phimax);
155  fhEtaPhiPhotonConvPaired[iebin]->SetYTitle("#phi (rad)");
156  fhEtaPhiPhotonConvPaired[iebin]->SetXTitle("#eta");
157  outputContainer->Add(fhEtaPhiPhotonConvPaired[iebin]) ;
158  }
159 
160  fhConvDeltaEta = new TH2F
161  ("hConvDeltaEta","#Delta #eta of selected conversion pairs",100,0,fMassCut,netabins*2,-0.5,0.5);
162  fhConvDeltaEta->SetYTitle("#Delta #eta");
163  fhConvDeltaEta->SetXTitle("Pair Mass (GeV/#it{c}^{2})");
164  outputContainer->Add(fhConvDeltaEta) ;
165 
166  fhConvDeltaPhi = new TH2F
167  ("hConvDeltaPhi","#Delta #phi of selected conversion pairs",100,0,fMassCut,nphibins*2,-0.5,0.5);
168  fhConvDeltaPhi->SetYTitle("#Delta #phi");
169  fhConvDeltaPhi->SetXTitle("Pair Mass (GeV/#it{c}^{2})");
170  outputContainer->Add(fhConvDeltaPhi) ;
171 
172  fhConvDeltaEtaPhi = new TH2F
173  ("hConvDeltaEtaPhi","#Delta #eta vs #Delta #phi of selected conversion pairs",netabins,-0.5,0.5,nphibins,-0.5,0.5);
174  fhConvDeltaEtaPhi->SetYTitle("#Delta #phi");
175  fhConvDeltaEtaPhi->SetXTitle("#Delta #eta");
176  outputContainer->Add(fhConvDeltaEtaPhi) ;
177 
178  fhConvAsym = new TH2F
179  ("hConvAsym","Asymmetry of selected conversion pairs",100,0,fMassCut,100,0,1);
180  fhConvAsym->SetYTitle("Asymmetry");
181  fhConvAsym->SetXTitle("Pair Mass (GeV/#it{c}^{2})");
182  outputContainer->Add(fhConvAsym) ;
183 
184  fhConvPt = new TH2F
185  ("hConvPt","#it{p}_{T} of selected conversion pairs",100,0,fMassCut,100,0.,10.);
186  fhConvPt->SetYTitle("Pair #it{p}_{T} (GeV/#it{c})");
187  fhConvPt->SetXTitle("Pair #it{M} (GeV/#it{c}^{2})");
188  outputContainer->Add(fhConvPt) ;
189 
190 // for(Int_t iR = 0; iR < 6; iR++)
191 // {
192 // fhConvPtRcut[iR] = new TH2F
193 // (Form("hConvPt_R%d",iR),
194 // Form("#it{p}_{T} of selected conversion pairs in %s?",region[iR].Data()),
195 // 100,0,fMassCut,100,0.,10.);
196 // fhConvPtRcut[iR]->SetYTitle("Pair #it{p}_{T} (GeV/#it{c})");
197 // fhConvPtRcut[iR]->SetXTitle("Pair Mass (GeV/#it{c}^{2})");
198 // outputContainer->Add(fhConvPtRcut[iR]) ;
199 // }
200 
202  {
203  fhConvDistEta = new TH2F
204  ("hConvDistEta","distance to conversion vertex",netabins,etamin,etamax,ndist,mindist,maxdist);
205  fhConvDistEta->SetXTitle("#eta");
206  fhConvDistEta->SetYTitle(" distance (cm)");
207  outputContainer->Add(fhConvDistEta) ;
208 
209  fhConvDistPhi = new TH2F
210  ("hConvDistPhi","distance to conversion vertex",nphibins,phimin,phimax,ndist,mindist,maxdist);
211  fhConvDistPhi->SetXTitle("#phi (rad)");
212  fhConvDistPhi->SetYTitle(" distance (cm)");
213  outputContainer->Add(fhConvDistPhi) ;
214 
215  fhConvDistEn = new TH2F
216  ("hConvDistEn","distance to conversion vertex",nptbins,ptmin,ptmax,ndist,mindist,maxdist);
217  fhConvDistEn->SetXTitle("#it{E} (GeV)");
218  fhConvDistEn->SetYTitle(" distance (cm)");
219  outputContainer->Add(fhConvDistEn) ;
220 
221  fhConvDistMass = new TH2F
222  ("hConvDistMass","distance to conversion vertex",100,0,fMassCut,ndist,mindist,maxdist);
223  fhConvDistMass->SetXTitle("#it{M} (GeV/#it{c}^{2})");
224  fhConvDistMass->SetYTitle(" distance (cm)");
225  outputContainer->Add(fhConvDistMass) ;
226 
228  ("hConvDistEtaCutEta",Form("distance to conversion vertex, #Delta #eta < %2.2f",fConvDEtaCut),netabins,etamin,etamax,ndist,mindist,maxdist);
229  fhConvDistEtaCutEta->SetXTitle("#eta");
230  fhConvDistEtaCutEta->SetYTitle(" distance (cm)");
231  outputContainer->Add(fhConvDistEtaCutEta) ;
232 
234  ("hConvDistPhiCutEta",Form("distance to conversion vertex, #Delta #eta < %2.2f",fConvDEtaCut),nphibins,phimin,phimax,ndist,mindist,maxdist);
235  fhConvDistPhiCutEta->SetXTitle("#phi (rad)");
236  fhConvDistPhiCutEta->SetYTitle(" distance (cm)");
237  outputContainer->Add(fhConvDistPhiCutEta) ;
238 
240  ("hConvDistEnCutEta",Form("distance to conversion vertex, #Delta #eta < %2.2f",fConvDEtaCut),nptbins,ptmin,ptmax,ndist,mindist,maxdist);
241  fhConvDistEnCutEta->SetXTitle("#it{E} (GeV)");
242  fhConvDistEnCutEta->SetYTitle(" distance (cm)");
243  outputContainer->Add(fhConvDistEnCutEta) ;
244 
246  ("hConvDistMassCutEta",Form("distance to conversion vertex, #Delta #eta < %2.2f",fConvDEtaCut),100,0,fMassCut,ndist,mindist,maxdist);
247  fhConvDistMassCutEta->SetXTitle("#it{M} (GeV/#it{c}^{2})");
248  fhConvDistMassCutEta->SetYTitle(" distance (cm)");
249  outputContainer->Add(fhConvDistMassCutEta) ;
250 
252  ("hConvDistEtaCutMass",Form("distance to conversion vertex, #it{M} < %0.2f MeV/#it{c}^{2}",fMassCutTight),netabins,etamin,etamax,ndist,mindist,maxdist);
253  fhConvDistEtaCutMass->SetXTitle("#eta");
254  fhConvDistEtaCutMass->SetYTitle(" distance (cm)");
255  outputContainer->Add(fhConvDistEtaCutMass) ;
256 
258  ("hConvDistPhiCutMass",Form("distance to conversion vertex, #it{M} < %0.2f MeV/#it{c}^{2}",fMassCutTight),nphibins,phimin,phimax,ndist,mindist,maxdist);
259  fhConvDistPhiCutMass->SetXTitle("#phi (rad)");
260  fhConvDistPhiCutMass->SetYTitle(" distance (cm)");
261  outputContainer->Add(fhConvDistPhiCutMass) ;
262 
264  ("hConvDistEnCutMass",Form("distance to conversion vertex, #it{M} < %0.2f MeV/#it{c}^{2}",fMassCutTight),nptbins,ptmin,ptmax,ndist,mindist,maxdist);
265  fhConvDistEnCutMass->SetXTitle("#it{E} (GeV)");
266  fhConvDistEnCutMass->SetYTitle(" distance (cm)");
267  outputContainer->Add(fhConvDistEnCutMass) ;
268 
270  ("hConvDistEtaCutAsy",Form("distance to conversion vertex, #it{A} < %2.2f",fConvAsymCut),netabins,etamin,etamax,ndist,mindist,maxdist);
271  fhConvDistEtaCutAsy->SetXTitle("#eta");
272  fhConvDistEtaCutAsy->SetYTitle(" distance (cm)");
273  outputContainer->Add(fhConvDistEtaCutAsy) ;
274 
276  ("hConvDistPhiCutAsy",Form("distance to conversion vertex, #it{A} < %2.2f",fConvAsymCut),nphibins,phimin,phimax,ndist,mindist,maxdist);
277  fhConvDistPhiCutAsy->SetXTitle("#phi (rad)");
278  fhConvDistPhiCutAsy->SetYTitle(" distance (cm)");
279  outputContainer->Add(fhConvDistPhiCutAsy) ;
280 
282  ("hConvDistEnCutAsy",Form("distance to conversion vertex, #it{A} < %2.2f",fConvAsymCut),nptbins,ptmin,ptmax,ndist,mindist,maxdist);
283  fhConvDistEnCutAsy->SetXTitle("#it{E} (GeV)");
284  fhConvDistEnCutAsy->SetYTitle(" distance (cm)");
285  outputContainer->Add(fhConvDistEnCutAsy) ;
286 
288  ("hConvDistMassCutAsy",Form("distance to conversion vertex, #it{A} < %2.2f",fConvDEtaCut),100,0,fMassCut,ndist,mindist,maxdist);
289  fhConvDistMassCutAsy->SetXTitle("#it{M} (GeV/#it{c}^{2})");
290  fhConvDistMassCutEta->SetYTitle(" distance (cm)");
291  outputContainer->Add(fhConvDistMassCutAsy) ;
292 
294  ("hConvDistEtaCutAll",Form("distance to conversion vertex, #it{M} < %0.2f MeV/#it{c}^{2}, #Delta #eta < %2.2f, #it{A} < %2.2f",
295  fConvDEtaCut,fMassCutTight,fConvAsymCut),netabins,etamin,etamax,ndist,mindist,maxdist);
296  fhConvDistEtaCutAll->SetXTitle("#eta");
297  fhConvDistEtaCutAll->SetYTitle(" distance (cm)");
298  outputContainer->Add(fhConvDistEtaCutAll) ;
299 
301  ("hConvDistPhiCutAll",Form("distance to conversion vertex, #it{M} < %0.2f MeV/#it{c}^{2}, #Delta #eta < %2.2f, #it{A} < %2.2f",
302  fConvDEtaCut,fMassCutTight,fConvAsymCut),nphibins,phimin,phimax,ndist,mindist,maxdist);
303  fhConvDistPhiCutAll->SetXTitle("#phi (rad)");
304  fhConvDistPhiCutAll->SetYTitle(" distance (cm)");
305  outputContainer->Add(fhConvDistPhiCutAll) ;
306 
308  ("hConvDistEnCutAll",Form("distance to conversion vertex, #it{M} < %0.2f MeV/#it{c}^{2}, #Delta #eta < %2.2f, #it{A} < %2.2f",
309  fConvDEtaCut,fMassCutTight,fConvAsymCut),nptbins,ptmin,ptmax,ndist,mindist,maxdist);
310  fhConvDistEnCutAll->SetXTitle("#it{E} (GeV)");
311  fhConvDistEnCutAll->SetYTitle(" distance (cm)");
312  outputContainer->Add(fhConvDistEnCutAll) ;
313  }
314 
315  if(IsDataMC())
316  {
317  fhPtConversionTagged = new TH1F("hPtMCConversionTagged","Number of converted #gamma over calorimeter, tagged as converted",nptbins,ptmin,ptmax);
318  fhPtConversionTagged->SetYTitle("N");
319  fhPtConversionTagged->SetXTitle("#it{p}_{T #gamma}(GeV/#it{c})");
320  outputContainer->Add(fhPtConversionTagged) ;
321 
322  fhPtAntiNeutronTagged = new TH1F("hPtMCAntiNeutronTagged","Number of AntiNeutron id as Photon over calorimeter, tagged as converted",nptbins,ptmin,ptmax);
323  fhPtAntiNeutronTagged->SetYTitle("N");
324  fhPtAntiNeutronTagged->SetXTitle("#it{p}_{T #gamma}(GeV/#it{c})");
325  outputContainer->Add(fhPtAntiNeutronTagged) ;
326 
327  fhPtAntiProtonTagged = new TH1F("hPtMCAntiProtonTagged","Number of AntiProton id as Photon over calorimeter, tagged as converted",nptbins,ptmin,ptmax);
328  fhPtAntiProtonTagged->SetYTitle("N");
329  fhPtAntiProtonTagged->SetXTitle("#it{p}_{T #gamma}(GeV/#it{c})");
330  outputContainer->Add(fhPtAntiProtonTagged) ;
331 
332  fhPtUnknownTagged = new TH1F("hPtMCUnknownTagged","Number of Unknown id as Photon over calorimeter, tagged as converted",nptbins,ptmin,ptmax);
333  fhPtUnknownTagged->SetYTitle("N");
334  fhPtUnknownTagged->SetXTitle("#it{p}_{T #gamma}(GeV/#it{c})");
335  outputContainer->Add(fhPtUnknownTagged) ;
336 
338  {
340  ("hConvDistMCConversion","calculated conversion distance vs real vertes for MC conversion",ndist,mindist,maxdist,ndist,mindist,maxdist);
341  fhConvDistMCConversion->SetXTitle("distance");
342  fhConvDistMCConversion->SetYTitle("vertex R");
343  outputContainer->Add(fhConvDistMCConversion) ;
344 
346  ("hConvDistMCConversionCuts",
347  Form("calculated conversion distance vs real vertes for MC conversion, #Delta #eta < %2.2f, #it{M} < 10 MeV/#it{c}^{2}, #it{A} < %2.2f",
349  ndist,mindist,maxdist,ndist,mindist,maxdist);
350  fhConvDistMCConversionCuts->SetXTitle("distance");
351  fhConvDistMCConversionCuts->SetYTitle("vertex R");
352  outputContainer->Add(fhConvDistMCConversionCuts) ;
353  }
354 
356  ("hConvDeltaEtaMCConversion","#Delta #eta of selected conversion pairs from real conversions",100,0,fMassCut,netabins,-0.5,0.5);
357  fhConvDeltaEtaMCConversion->SetYTitle("#Delta #eta");
358  fhConvDeltaEtaMCConversion->SetXTitle("Pair Mass (GeV/#it{c}^{2})");
359  outputContainer->Add(fhConvDeltaEtaMCConversion) ;
360 
362  ("hConvDeltaPhiMCConversion","#Delta #phi of selected conversion pairs from real conversions",100,0,fMassCut,nphibins,-0.5,0.5);
363  fhConvDeltaPhiMCConversion->SetYTitle("#Delta #phi");
364  fhConvDeltaPhiMCConversion->SetXTitle("Pair Mass (GeV/#it{c}^{2})");
365  outputContainer->Add(fhConvDeltaPhiMCConversion) ;
366 
368  ("hConvDeltaEtaPhiMCConversion","#Delta #eta vs #Delta #phi of selected conversion pairs, from real conversions",netabins,-0.5,0.5,nphibins,-0.5,0.5);
369  fhConvDeltaEtaPhiMCConversion->SetYTitle("#Delta #phi");
370  fhConvDeltaEtaPhiMCConversion->SetXTitle("#Delta #eta");
371  outputContainer->Add(fhConvDeltaEtaPhiMCConversion) ;
372 
374  ("hConvAsymMCConversion","Asymmetry of selected conversion pairs from real conversions",100,0,fMassCut,100,0,1);
375  fhConvAsymMCConversion->SetYTitle("Asymmetry");
376  fhConvAsymMCConversion->SetXTitle("Pair Mass (GeV/#it{c}^{2})");
377  outputContainer->Add(fhConvAsymMCConversion) ;
378 
380  ("hConvPtMCConversion","#it{p}_{T} of selected conversion pairs from real conversions",100,0,fMassCut,nptbins,ptmin,ptmax);
381  fhConvPtMCConversion->SetYTitle("Pair #it{p}_{T} (GeV/#it{c})");
382  fhConvPtMCConversion->SetXTitle("Pair Mass (GeV/#it{c}^{2})");
383  outputContainer->Add(fhConvPtMCConversion) ;
384 
385  for(Int_t iR = 0; iR < 6; iR++)
386  {
388  (Form("hConvPtMCConversion_R%d",iR),
389  Form("#it{p}_{T} of selected conversion pairs from real conversions in %s",region[iR].Data()),
390  100,0,fMassCut,nptbins,ptmin,ptmax);
391  fhConvPtMCConversionRcut[iR]->SetYTitle("Pair #it{p}_{T} (GeV/#it{c})");
392  fhConvPtMCConversionRcut[iR]->SetXTitle("Pair Mass (GeV/#it{c}^{2})");
393  outputContainer->Add(fhConvPtMCConversionRcut[iR]) ;
394  }
395 
396 // fhConvDispersionMCConversion = new TH2F
397 // ("hConvDispersionMCConversion","#it{p}_{T} of selected conversion pairs from real conversions",100,0.,1.,100,0.,1.);
398 // fhConvDispersionMCConversion->SetYTitle("Dispersion cluster 1");
399 // fhConvDispersionMCConversion->SetXTitle("Dispersion cluster 2");
400 // outputContainer->Add(fhConvDispersionMCConversion) ;
401 
403  ("hConvM02MCConversion","#it{p}_{T} of selected conversion pairs from real conversion",100,0.,1.,100,0.,1.);
404  fhConvM02MCConversion->SetYTitle("M02 cluster 1");
405  fhConvM02MCConversion->SetXTitle("M02 cluster 2");
406  outputContainer->Add(fhConvM02MCConversion) ;
407 
409  ("hConvDeltaEtaMCAntiNeutron","#Delta #eta of selected conversion pairs from anti-neutrons",100,0,fMassCut,netabins,-0.5,0.5);
410  fhConvDeltaEtaMCAntiNeutron->SetYTitle("#Delta #eta");
411  fhConvDeltaEtaMCAntiNeutron->SetXTitle("Pair Mass (GeV/#it{c}^{2})");
412  outputContainer->Add(fhConvDeltaEtaMCAntiNeutron) ;
413 
415  ("hConvDeltaPhiMCAntiNeutron","#Delta #phi of selected conversion pairs from anti-neutrons",100,0,fMassCut,nphibins,-0.5,0.5);
416  fhConvDeltaPhiMCAntiNeutron->SetYTitle("#Delta #phi");
417  fhConvDeltaPhiMCAntiNeutron->SetXTitle("Pair Mass (GeV/#it{c}^{2})");
418  outputContainer->Add(fhConvDeltaPhiMCAntiNeutron) ;
419 
421  ("hConvDeltaEtaPhiMCAntiNeutron","#Delta #eta vs #Delta #phi of selected conversion pairs from anti-neutrons",netabins,-0.5,0.5,nphibins,-0.5,0.5);
422  fhConvDeltaEtaPhiMCAntiNeutron->SetYTitle("#Delta #phi");
423  fhConvDeltaEtaPhiMCAntiNeutron->SetXTitle("#Delta #eta");
424  outputContainer->Add(fhConvDeltaEtaPhiMCAntiNeutron) ;
425 
427  ("hConvAsymMCAntiNeutron","Asymmetry of selected conversion pairs from anti-neutrons",100,0,fMassCut,100,0,1);
428  fhConvAsymMCAntiNeutron->SetYTitle("Asymmetry");
429  fhConvAsymMCAntiNeutron->SetXTitle("Pair Mass (GeV/#it{c}^{2})");
430  outputContainer->Add(fhConvAsymMCAntiNeutron) ;
431 
433  ("hConvPtMCAntiNeutron","#it{p}_{T} of selected conversion pairs from anti-neutrons",100,0,fMassCut,nptbins,ptmin,ptmax);
434  fhConvPtMCAntiNeutron->SetYTitle("Pair #it{p}_{T} (GeV/#it{c})");
435  fhConvPtMCAntiNeutron->SetXTitle("Pair Mass (GeV/#it{c}^{2})");
436  outputContainer->Add(fhConvPtMCAntiNeutron) ;
437 
438 // fhConvDispersionMCAntiNeutron = new TH2F
439 // ("hConvDispersionMCAntiNeutron","#it{p}_{T} of selected conversion pairs from anti-neutrons",100,0.,1.,100,0.,1.);
440 // fhConvDispersionMCAntiNeutron->SetYTitle("Dispersion cluster 1");
441 // fhConvDispersionMCAntiNeutron->SetXTitle("Dispersion cluster 2");
442 // outputContainer->Add(fhConvDispersionMCAntiNeutron) ;
443 
445  ("hConvM02MCAntiNeutron","#it{p}_{T} of selected conversion pairs from string",100,0.,1.,100,0.,1.);
446  fhConvM02MCAntiNeutron->SetYTitle("M02 cluster 1");
447  fhConvM02MCAntiNeutron->SetXTitle("M02 cluster 2");
448  outputContainer->Add(fhConvM02MCAntiNeutron) ;
449 
451  ("hConvDeltaEtaMCAntiProton","#Delta #eta of selected conversion pairs from anti-protons",100,0,fMassCut,netabins,-0.5,0.5);
452  fhConvDeltaEtaMCAntiProton->SetYTitle("#Delta #eta");
453  fhConvDeltaEtaMCAntiProton->SetXTitle("Pair Mass (GeV/#it{c}^{2})");
454  outputContainer->Add(fhConvDeltaEtaMCAntiProton) ;
455 
457  ("hConvDeltaPhiMCAntiProton","#Delta #phi of selected conversion pairs from anti-protons",100,0,fMassCut,nphibins,-0.5,0.5);
458  fhConvDeltaPhiMCAntiProton->SetYTitle("#Delta #phi");
459  fhConvDeltaPhiMCAntiProton->SetXTitle("Pair Mass (GeV/#it{c}^{2})");
460  outputContainer->Add(fhConvDeltaPhiMCAntiProton) ;
461 
463  ("hConvDeltaEtaPhiMCAntiProton","#Delta #eta vs #Delta #phi of selected conversion pairs from anti-protons",netabins,-0.5,0.5,nphibins,-0.5,0.5);
464  fhConvDeltaEtaPhiMCAntiProton->SetYTitle("#Delta #phi");
465  fhConvDeltaEtaPhiMCAntiProton->SetXTitle("#Delta #eta");
466  outputContainer->Add(fhConvDeltaEtaPhiMCAntiProton) ;
467 
469  ("hConvAsymMCAntiProton","Asymmetry of selected conversion pairs from anti-protons",100,0,fMassCut,100,0,1);
470  fhConvAsymMCAntiProton->SetYTitle("Asymmetry");
471  fhConvAsymMCAntiProton->SetXTitle("Pair Mass (GeV/#it{c}^{2})");
472  outputContainer->Add(fhConvAsymMCAntiProton) ;
473 
475  ("hConvPtMCAntiProton","#it{p}_{T} of selected conversion pairs from anti-protons",100,0,fMassCut,nptbins,ptmin,ptmax);
476  fhConvPtMCAntiProton->SetYTitle("Pair #it{p}_{T} (GeV/#it{c})");
477  fhConvPtMCAntiProton->SetXTitle("Pair Mass (GeV/#it{c}^{2})");
478  outputContainer->Add(fhConvPtMCAntiProton) ;
479 
480 // fhConvDispersionMCAntiProton = new TH2F
481 // ("hConvDispersionMCAntiProton","#it{p}_{T} of selected conversion pairs from anti-protons",100,0.,1.,100,0.,1.);
482 // fhConvDispersionMCAntiProton->SetYTitle("Dispersion cluster 1");
483 // fhConvDispersionMCAntiProton->SetXTitle("Dispersion cluster 2");
484 // outputContainer->Add(fhConvDispersionMCAntiProton) ;
485 
487  ("hConvM02MCAntiProton","#it{p}_{T} of selected conversion pairs from string",100,0.,1.,100,0.,1.);
488  fhConvM02MCAntiProton->SetYTitle("M02 cluster 1");
489  fhConvM02MCAntiProton->SetXTitle("M02 cluster 2");
490  outputContainer->Add(fhConvM02MCAntiProton) ;
491 
493  ("hConvDeltaEtaMCString","#Delta #eta of selected conversion pairs from string",100,0,fMassCut,netabins,-0.5,0.5);
494  fhConvDeltaEtaMCString->SetYTitle("#Delta #eta");
495  fhConvDeltaEtaMCString->SetXTitle("Pair Mass (GeV/#it{c}^{2})");
496  outputContainer->Add(fhConvDeltaEtaMCString) ;
497 
499  ("hConvDeltaPhiMCString","#Delta #phi of selected conversion pairs from string",100,0,fMassCut,nphibins,-0.5,0.5);
500  fhConvDeltaPhiMCString->SetYTitle("#Delta #phi");
501  fhConvDeltaPhiMCString->SetXTitle("Pair Mass (GeV/#it{c}^{2})");
502  outputContainer->Add(fhConvDeltaPhiMCString) ;
503 
505  ("hConvDeltaEtaPhiMCString","#Delta #eta vs #Delta #phi of selected conversion pairs from string",netabins,-0.5,0.5,nphibins,-0.5,0.5);
506  fhConvDeltaEtaPhiMCString->SetYTitle("#Delta #phi");
507  fhConvDeltaEtaPhiMCString->SetXTitle("#Delta #eta");
508  outputContainer->Add(fhConvDeltaEtaPhiMCString) ;
509 
511  ("hConvAsymMCString","Asymmetry of selected conversion pairs from string",100,0,fMassCut,100,0,1);
512  fhConvAsymMCString->SetYTitle("Asymmetry");
513  fhConvAsymMCString->SetXTitle("Pair Mass (GeV/#it{c}^{2})");
514  outputContainer->Add(fhConvAsymMCString) ;
515 
516  fhConvPtMCString = new TH2F
517  ("hConvPtMCString","#it{p}_{T} of selected conversion pairs from string",100,0,fMassCut,nptbins,ptmin,ptmax);
518  fhConvPtMCString->SetYTitle("Pair #it{p}_{T} (GeV/#it{c})");
519  fhConvPtMCString->SetXTitle("Pair Mass (GeV/#it{c}^{2})");
520  outputContainer->Add(fhConvPtMCString) ;
521 
522 // fhConvDispersionMCString = new TH2F
523 // ("hConvDispersionMCString","#it{p}_{T} of selected conversion pairs from string",100,0.,1.,100,0.,1.);
524 // fhConvDispersionMCString->SetYTitle("Dispersion cluster 1");
525 // fhConvDispersionMCString->SetXTitle("Dispersion cluster 2");
526 // outputContainer->Add(fhConvDispersionMCString) ;
527 
528  fhConvM02MCString = new TH2F
529  ("hConvM02MCString","#it{p}_{T} of selected conversion pairs from string",100,0.,1.,100,0.,1.);
530  fhConvM02MCString->SetYTitle("M02 cluster 1");
531  fhConvM02MCString->SetXTitle("M02 cluster 2");
532  outputContainer->Add(fhConvM02MCString) ;
533  }
534 
535  return outputContainer ;
536 }
537 
538 //___________________________________________
540 //___________________________________________
542 {
543  AddToHistogramsName("AnaPhotonConvInCalo_");
544 
545  fConvAsymCut = 0.2 ;
546  fMassCut = 0.04 ; // 40 MeV/c^2
547  fMassCutTight = 0.03 ; // 30 MeV/c^2
548  fConvDEtaCut = 0.04 ;
549  fConvDPhiMinCut = 0 ;
550  fConvDPhiMaxCut = 0.05 ;
551  fRemoveConvertedPair = kFALSE;
552  fAddConvertedPairsToAOD = kFALSE;
553 }
554 
555 //________________________________________________________
558 //________________________________________________________
560 {
561  // Loop on stored AOD photons
562  Int_t naod = GetOutputAODBranch()->GetEntriesFast();
563  AliDebug(1,Form("AOD branch entries %d", naod));
564 
565  // List to be used in conversion analysis, to tag the cluster as candidate for conversion
566  Bool_t * indexConverted = new Bool_t[naod];
567  for (Int_t i = 0; i < naod; i++) indexConverted[i] = kFALSE;
568 
569  for(Int_t iaod = 0; iaod < naod ; iaod++)
570  {
571  AliAODPWG4Particle* calo = (AliAODPWG4Particle*) (GetOutputAODBranch()->At(iaod));
572 
573  //Bool_t bConverted = kFALSE;
574 
575  // Check if set previously as converted couple, if so skip its use.
576  //if (indexConverted[iaod]) continue;
577 
578  // Second cluster loop
579  AliAODPWG4Particle* calo2 = 0;
580  for(Int_t jaod = iaod + 1 ; jaod < naod ; jaod++)
581  {
582  // Check if set previously as converted couple, if so skip its use.
583  //if (indexConverted[jaod]) continue;
584 
585  //printf("Check Conversion indeces %d and %d\n",iaod,jaod);
586  calo2 = (AliAODPWG4Particle*) (GetOutputAODBranch()->At(jaod));
587 
588  //
589  // Add both clusters
590  //
591  fMomentum = *(calo->Momentum())+*(calo2->Momentum());
592  Float_t ptConvPair = fMomentum.Pt();
593  Float_t phiConvPair = fMomentum.Phi();
594  Float_t etaConvPair = fMomentum.Eta();
595  //Float_t eConvPair = fMomentum.E();
596  Float_t pairM = calo->GetPairMass(calo2);
597  //printf("\t both in calo, mass %f, cut %f\n",pairM,fMassCut);
598 
599  //................................................
600  // Get mass of pair, if small, take this pair.
601  if(pairM < fMassCut)
602  {
603  Float_t phi = calo->Phi();
604  if(phi < 0) phi +=TMath::TwoPi();
605  Float_t phi2 = calo2->Phi();
606  if(phi2 < 0) phi2+=TMath::TwoPi();
607 
608  calo->SetTagged(kFALSE);
609  Float_t asymmetry = TMath::Abs(calo->E()-calo2->E())/(calo->E()+calo2->E());
610  Float_t dPhi = phi-phi2;
611  Float_t dEta = calo->Eta() - calo2->Eta();
612 
613  //...............................................
614  // Fill few histograms with kinematics of the pair
615  // FIXME, move all this to MakeAnalysisFillHistograms ...
616 
617  fhConvDeltaEta ->Fill( pairM, dEta , GetEventWeight());
618  fhConvDeltaPhi ->Fill( pairM, dPhi , GetEventWeight());
619  fhConvAsym ->Fill( pairM, asymmetry , GetEventWeight());
620  fhConvDeltaEtaPhi->Fill( dEta , dPhi , GetEventWeight());
621  fhConvPt ->Fill( pairM, ptConvPair, GetEventWeight());
622 
623  Float_t convDist = -1;
624  Float_t convDist2 = -1;
626  {
627  // Estimate conversion distance, T. Awes, M. Ivanov
628  // Under the assumption that the pair has zero mass, and that each electron
629  // of the pair has the same momentum, they will each have the same bend radius
630  // given by R=p/(qB) = p / (300 B) with p in [MeV/c], B in [Tesla] and R in [m].
631  // With nominal ALICE magnet current of 30kA B=0.5T, and so with E_cluster=p,
632  // R = E/1.5 [cm]. Under these assumptions, the distance from the conversion
633  // point to the EMCal can be related to the separation distance, L=2y, on the EMCal
634  // as d = sqrt(R^2 -(R-y)^2) = sqrt(2Ry - y^2). And since R>>y we can write as
635  // d = sqrt(E*L/1.5) where E is the cluster energy and L is the distance in cm between
636  // the clusters.
637 
638  TObjArray * clusters = 0;
639  if(calo->GetDetectorTag() == kEMCAL) clusters = GetEMCALClusters();
640  else clusters = GetPHOSClusters ();
641 
642  Int_t iclus = -1;
643  AliVCluster *cluster1 = FindCluster(clusters,calo ->GetCaloLabel(0),iclus);
644  AliVCluster *cluster2 = FindCluster(clusters,calo2->GetCaloLabel(0),iclus);
645 
646  Float_t pos1[3];
647  cluster1->GetPosition(pos1);
648  Float_t pos2[3];
649  cluster2->GetPosition(pos2);
650  Float_t clustDist = TMath::Sqrt((pos1[0]-pos2[0])*(pos1[0]-pos2[0])+
651  (pos1[1]-pos2[1])*(pos1[1]-pos2[1])+
652  (pos1[2]-pos2[2])*(pos1[2]-pos2[2]));
653 
654  Float_t convDist = TMath::Sqrt(calo ->E()*clustDist*0.01/0.15) * 100.; // cm
655  Float_t convDist2 = TMath::Sqrt(calo2->E()*clustDist*0.01/0.15) * 100.; // cm
656  //printf("l = %f, e1 = %f, d1=%f, e2 = %f, d2=%f\n",clustDist,calo->E(),convDist,calo2->E(),convDist2);
657  AliDebug(2,Form("Pair with mass %2.3f < %2.3f, %1.2f < dPhi %2.2f < %2.2f, dEta %f < %2.2f, asymmetry %2.2f< %2.2f; \n"
658  " cluster1 id %d, e %2.3f SM %d, eta %2.3f, phi %2.3f ; \n"
659  " cluster2 id %d, e %2.3f, SM %d, eta %2.3f, phi %2.3f \n",
660  pairM,fMassCut,fConvDPhiMinCut, dPhi, fConvDPhiMaxCut, dEta, fConvDEtaCut, asymmetry, fConvAsymCut,
661  calo ->GetCaloLabel(0), calo ->E(), GetCaloUtils()->GetModuleNumber(calo ,GetReader()->GetInputEvent()), calo ->Eta(), phi,
662  calo2->GetCaloLabel(0), calo2->E(), GetCaloUtils()->GetModuleNumber(calo2,GetReader()->GetInputEvent()), calo2->Eta(), phi2));
663 
664 
665 // Int_t convDistR1 = -1;
666 // if ( convDist > 430-75. ) convDistR1 = 0;
667 // else if ( convDist < 430-275. ) convDistR1 = 1;
668 // else if ( convDist < 430-375. ) convDistR1 = 2;
669 // else if ( convDist < 430-400. ) convDistR1 = 3;
670 // else if ( convDist < 0 ) convDistR1 = 4;
671 // else convDistR1 = 5;
672 //
673 // Int_t convDistR2 = -1;
674 // if ( convDist2 > 430-75. ) convDistR2 = 0;
675 // else if ( convDist2 < 430-275. ) convDistR2 = 1;
676 // else if ( convDist2 < 430-375. ) convDistR2 = 2;
677 // else if ( convDist2 < 430-400. ) convDistR2 = 3;
678 // else if ( convDist2 < 0 ) convDistR2 = 4;
679 // else convDistR2 = 5;
680 //
681 // if(convDistR1 >= 0)
682 // fhConvPtRcut[convDistR1]->Fill( pairM, ptConvPair, GetEventWeight());
683 // if(convDistR2 >= 0)
684 // fhConvPtRcut[convDistR2]->Fill( pairM, ptConvPair, GetEventWeight());
685 
686  fhConvDistEta ->Fill(calo ->Eta(),convDist , GetEventWeight());
687  fhConvDistEta ->Fill(calo2->Eta(),convDist2, GetEventWeight());
688  fhConvDistPhi ->Fill(phi , convDist , GetEventWeight());
689  fhConvDistPhi ->Fill(phi2, convDist2, GetEventWeight());
690  fhConvDistEn ->Fill(calo ->E(), convDist , GetEventWeight());
691  fhConvDistEn ->Fill(calo2->E(), convDist2, GetEventWeight());
692  fhConvDistMass->Fill(pairM, convDist , GetEventWeight());
693  fhConvDistMass->Fill(pairM, convDist2, GetEventWeight());
694 
695  //dEta cut
696  if(TMath::Abs(dEta) < fConvDEtaCut)
697  {
698  fhConvDistEtaCutEta ->Fill(calo ->Eta(), convDist , GetEventWeight());
699  fhConvDistEtaCutEta ->Fill(calo2->Eta(), convDist2, GetEventWeight());
700  fhConvDistPhiCutEta ->Fill(phi , convDist , GetEventWeight());
701  fhConvDistPhiCutEta ->Fill(phi2, convDist2, GetEventWeight());
702  fhConvDistEnCutEta ->Fill(calo ->E(), convDist , GetEventWeight());
703  fhConvDistEnCutEta ->Fill(calo2->E(), convDist2, GetEventWeight());
704  fhConvDistMassCutEta->Fill(pairM, convDist , GetEventWeight());
705  fhConvDistMassCutEta->Fill(pairM, convDist2, GetEventWeight());
706  }
707 
708  //mass cut
709  if(pairM < fMassCutTight)
710  {
711  fhConvDistEtaCutMass ->Fill(calo ->Eta(), convDist , GetEventWeight());
712  fhConvDistEtaCutMass ->Fill(calo2->Eta(), convDist2, GetEventWeight());
713  fhConvDistPhiCutMass ->Fill(phi , convDist , GetEventWeight());
714  fhConvDistPhiCutMass ->Fill(phi2, convDist2, GetEventWeight());
715  fhConvDistEnCutMass ->Fill(calo ->E(), convDist , GetEventWeight());
716  fhConvDistEnCutMass ->Fill(calo2->E(), convDist2, GetEventWeight());
717  }
718 
719  // asymmetry cut
720  if(asymmetry < fConvAsymCut)
721  {
722  fhConvDistEtaCutAsy ->Fill(calo ->Eta(), convDist , GetEventWeight());
723  fhConvDistEtaCutAsy ->Fill(calo2->Eta(), convDist2, GetEventWeight());
724  fhConvDistPhiCutAsy ->Fill(phi , convDist , GetEventWeight());
725  fhConvDistPhiCutAsy ->Fill(phi2, convDist2, GetEventWeight());
726  fhConvDistEnCutAsy ->Fill(calo ->E(), convDist , GetEventWeight());
727  fhConvDistEnCutAsy ->Fill(calo2->E(), convDist2, GetEventWeight());
728  fhConvDistMassCutAsy->Fill(pairM, convDist , GetEventWeight());
729  fhConvDistMassCutAsy->Fill(pairM, convDist2, GetEventWeight());
730  }// asymmetry cut
731 
732  // All cuts
733  if(TMath::Abs(dEta) < fConvDEtaCut && pairM < fMassCutTight && asymmetry < fConvAsymCut)
734  {
735  fhConvDistEtaCutAll ->Fill(calo ->Eta(), convDist , GetEventWeight());
736  fhConvDistEtaCutAll ->Fill(calo2->Eta(), convDist2, GetEventWeight());
737  fhConvDistPhiCutAll ->Fill(phi , convDist , GetEventWeight());
738  fhConvDistPhiCutAll ->Fill(phi2, convDist2, GetEventWeight());
739  fhConvDistEnCutAll ->Fill(calo ->E(), convDist , GetEventWeight());
740  fhConvDistEnCutAll ->Fill(calo2->E(), convDist2, GetEventWeight());
741  }
742  }
743 
744  //...........................................
745  // Fill more histograms, simulated data
746  Int_t ancPDG = 0;
747  Int_t ancStatus = 0;
748  Int_t ancLabel =-1;
749  if(IsDataMC())
750  {
751  // Check the origin of the pair, look for conversion, antinucleons or jet correlations (strings)
752 
753  ancLabel = GetMCAnalysisUtils()->CheckCommonAncestor(calo->GetLabel(), calo2->GetLabel(),
754  GetReader(), ancPDG, ancStatus, fMomentum, fProdVertex);
755 
756  // printf("AliAnaPhotonConvInCalo::MakeAnalysisFillHistograms() - Common ancestor label %d, pdg %d, name %s, status %d; \n",
757  // ancLabel,ancPDG,TDatabasePDG::Instance()->GetParticle(ancPDG)->GetName(),ancStatus);
758 
759  Int_t tag1 = calo ->GetTag();
760  Int_t tag2 = calo2->GetTag();
761 // Float_t disp1 = cluster1->GetDispersion();
762 // Float_t disp2 = cluster2->GetDispersion();
763  Float_t l0cl1 = calo ->GetM02();
764  Float_t l0cl2 = calo2->GetM02();
765 
767  {
768  if(GetMCAnalysisUtils()->CheckTagBit(tag2,AliMCAnalysisUtils::kMCConversion) && (ancPDG==22 || TMath::Abs(ancPDG)==11) && ancLabel > -1)
769  {
770  fhConvDeltaEtaMCConversion ->Fill( pairM, dEta , GetEventWeight());
771  fhConvDeltaPhiMCConversion ->Fill( pairM, dPhi , GetEventWeight());
772  fhConvAsymMCConversion ->Fill( pairM, asymmetry , GetEventWeight());
773  fhConvDeltaEtaPhiMCConversion->Fill( dEta , dPhi , GetEventWeight());
774  fhConvPtMCConversion ->Fill( pairM, ptConvPair, GetEventWeight());
775  //fhConvDispersionMCConversion ->Fill( disp1, disp2 , GetEventWeight());
776  fhConvM02MCConversion ->Fill( l0cl1, l0cl2 , GetEventWeight());
777 
778  Float_t prodR = TMath::Sqrt(fProdVertex.X()*fProdVertex.X()+fProdVertex.Y()*fProdVertex.Y());
779 
781  {
782  fhConvDistMCConversion ->Fill( convDist , prodR, GetEventWeight());
783  fhConvDistMCConversion ->Fill( convDist2, prodR, GetEventWeight());
784  }
785 
786  Int_t convR = -1;
787  if ( prodR < 75. ) convR = 0;
788  else if ( prodR < 275. ) convR = 1;
789  else if ( prodR < 375. ) convR = 2;
790  else if ( prodR < 400. ) convR = 3;
791  else if ( prodR < 430. ) convR = 4;
792  else convR = 5;
793 
794  if ( convR >= 0 )
795  fhConvPtMCConversionRcut[convR]->Fill( pairM, ptConvPair, GetEventWeight());
796 
797  if ( fFillClusterConvDistHisto && dEta < fConvDEtaCut && pairM < fMassCutTight && asymmetry < fConvAsymCut )
798  {
799  fhConvDistMCConversionCuts->Fill( convDist , prodR, GetEventWeight());
800  fhConvDistMCConversionCuts->Fill( convDist2, prodR, GetEventWeight());
801  }
802 
803  }
804  }
805  else if(GetMCAnalysisUtils()->CheckTagBit(tag1,AliMCAnalysisUtils::kMCAntiNeutron))
806  {
807  if(GetMCAnalysisUtils()->CheckTagBit(tag2,AliMCAnalysisUtils::kMCAntiNeutron) && ancPDG==-2112 && ancLabel > -1)
808  {
809  fhConvDeltaEtaMCAntiNeutron ->Fill( pairM, dEta , GetEventWeight());
810  fhConvDeltaPhiMCAntiNeutron ->Fill( pairM, dPhi , GetEventWeight());
811  fhConvAsymMCAntiNeutron ->Fill( pairM, asymmetry , GetEventWeight());
812  fhConvDeltaEtaPhiMCAntiNeutron ->Fill( dEta , dPhi , GetEventWeight());
813  fhConvPtMCAntiNeutron ->Fill( pairM, ptConvPair, GetEventWeight());
814  //fhConvDispersionMCAntiNeutron ->Fill( disp1, disp2 , GetEventWeight());
815  fhConvM02MCAntiNeutron ->Fill( l0cl1, l0cl2 , GetEventWeight());
816  }
817  }
818  else if(GetMCAnalysisUtils()->CheckTagBit(tag1,AliMCAnalysisUtils::kMCAntiProton))
819  {
820  if(GetMCAnalysisUtils()->CheckTagBit(tag2,AliMCAnalysisUtils::kMCAntiProton) && ancPDG==-2212 && ancLabel > -1)
821  {
822  fhConvDeltaEtaMCAntiProton ->Fill( pairM, dEta , GetEventWeight());
823  fhConvDeltaPhiMCAntiProton ->Fill( pairM, dPhi , GetEventWeight());
824  fhConvAsymMCAntiProton ->Fill( pairM, asymmetry , GetEventWeight());
825  fhConvDeltaEtaPhiMCAntiProton ->Fill( dEta , dPhi , GetEventWeight());
826  fhConvPtMCAntiProton ->Fill( pairM, ptConvPair, GetEventWeight());
827  //fhConvDispersionMCAntiProton ->Fill( disp1, disp2 , GetEventWeight());
828  fhConvM02MCAntiProton ->Fill( l0cl1, l0cl2 , GetEventWeight());
829  }
830  }
831 
832  // Pairs coming from fragmenting pairs.
833  if( ancPDG < 22 && ancLabel > 7 && (ancStatus == 11 || ancStatus == 12) )
834  {
835  fhConvDeltaEtaMCString ->Fill( pairM, dEta , GetEventWeight());
836  fhConvDeltaPhiMCString ->Fill( pairM, dPhi , GetEventWeight());
837  fhConvAsymMCString ->Fill( pairM, asymmetry , GetEventWeight());
838  fhConvDeltaEtaPhiMCString ->Fill( dEta, dPhi , GetEventWeight());
839  fhConvPtMCString ->Fill( pairM, ptConvPair, GetEventWeight());
840  //fhConvDispersionMCString ->Fill( disp1, disp2 , GetEventWeight());
841  fhConvM02MCString ->Fill( l0cl1, l0cl2 , GetEventWeight());
842  }
843 
844  }// Data MC
845 
846  //...............................................
847  //...............................................
848  // Select pairs in a eta/phi/asymmetry windows
849  //
850  if(TMath::Abs(dEta) < fConvDEtaCut &&
851  TMath::Abs(dPhi) < fConvDPhiMaxCut &&
852  TMath::Abs(dPhi) > fConvDPhiMinCut &&
853  asymmetry < fConvAsymCut )
854  {
855  indexConverted[iaod] = kTRUE;
856  indexConverted[jaod] = kTRUE;
857  //bConverted = kTRUE;
858 
859  Float_t ebin[] = {0.3,0.4,0.5,0.6,0.75,1,2};
860  Int_t bin1 = -1;
861  Int_t bin2 = -1;
862  Int_t bin12 = -1;
863  for(Int_t iebin = 0; iebin < 6; iebin++)
864  {
865  if( calo ->Pt() > ebin[iebin] && calo ->Pt() <= ebin[iebin+1] ) bin1 = iebin ;
866  if( calo2->Pt() > ebin[iebin] && calo2->Pt() <= ebin[iebin+1] ) bin2 = iebin ;
867  if( ptConvPair > ebin[iebin] && ptConvPair <= ebin[iebin+1] ) bin12 = iebin ;
868  }
869 
870  if(bin1 > -1) fhEtaPhiPhotonConvPaired[bin1 ]->Fill(calo ->Eta(), phi , GetEventWeight());
871  if(bin2 > -1) fhEtaPhiPhotonConvPaired[bin2 ]->Fill(calo2->Eta(), phi2 , GetEventWeight());
872  if(bin12 > -1) fhEtaPhiPhotonConv [bin12]->Fill(etaConvPair , phiConvPair, GetEventWeight());
873 
874  fhPtPhotonConv->Fill(ptConvPair, GetEventWeight());
875 
876  if(IsDataMC())
877  {
878  //....................................................................
879  // Access MC information in stack if requested, check that it exists.
880  Int_t label =calo->GetLabel();
881  if(label < 0)
882  {
883  AliDebug(1,Form("*** bad label ***: label %d", label));
884  continue;
885  }
886 
887  //Float_t eprim = 0;
888  //Float_t ptprim = 0;
889  if(GetReader()->ReadStack())
890  {
891  if(label >= GetMCStack()->GetNtrack())
892  {
893  AliDebug(1,Form("*** large label ***: label %d, n tracks %d", label, GetMCStack()->GetNtrack()));
894  continue ;
895  }
896 
897  TParticle* primary = GetMCStack()->Particle(label);
898  if(!primary)
899  {
900  AliDebug(1,Form("*** no primary ***: label %d", label));
901  continue;
902  }
903  //eprim = primary->Energy();
904  //ptprim = primary->Pt();
905  }
906  else if(GetReader()->ReadAODMCParticles())
907  {
908  TClonesArray * mcparticles = GetReader()->GetAODMCParticles();
909 
910  if(label >= mcparticles->GetEntriesFast())
911  {
912  AliDebug(2,Form("*** large label ***: label %d, n tracks %d",label, mcparticles->GetEntriesFast()));
913  continue ;
914  }
915 
916  // Get the particle
917  AliAODMCParticle* aodprimary = (AliAODMCParticle*) mcparticles->At(label);
918 
919  if(!aodprimary)
920  {
921  AliDebug(2,Form("*** no primary ***: label %d", label));
922  continue;
923  }
924 
925  //eprim = aodprimary->E();
926  //ptprim = aodprimary->Pt();
927  }
928 
929  Int_t tag = calo ->GetTag();
930  if(ancLabel >=0 )
931  {
932  if( GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCPhoton))
933  {
935  {
936  fhPtConversionTagged ->Fill(ptConvPair, GetEventWeight());
937  }
938  }
939  else if(GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCAntiNeutron))
940  {
941  fhPtAntiNeutronTagged ->Fill(ptConvPair, GetEventWeight());
942  }
943  else if(GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCAntiProton))
944  {
945  fhPtAntiProtonTagged ->Fill(ptConvPair, GetEventWeight());
946  }
947  }
948  else
949  {
950  fhPtUnknownTagged ->Fill(ptConvPair, GetEventWeight());
951  }
952  } // MC
953 
954  //..........................................................................................................
955  // Pair selected as converted, remove both clusters or recombine them into a photon and put them in the AOD
956  // Add to AOD
958  {
959  // Create AOD of pair analysis
960  AliAODPWG4Particle aodpair = AliAODPWG4Particle(fMomentum);
961  aodpair.SetLabel(calo->GetLabel());
962 
963  // Set the indeces of the original caloclusters
964  aodpair.SetCaloLabel(calo->GetCaloLabel(0),calo2->GetCaloLabel(0));
965  aodpair.SetDetectorTag(calo->GetDetectorTag());
966  aodpair.SetIdentifiedParticleType(calo->GetIdentifiedParticleType());
967  aodpair.SetTag(calo->GetTag());
968  aodpair.SetTagged(kTRUE);
969 
970  // Add AOD with pair object to aod branch
971  AddAODParticle(aodpair);
972  //printf("added pair: naod %d new %d\n",naod,GetOutputAODBranch()->GetEntriesFast());
973  }
974 
975  // Do not add the current calocluster
977  {
978  //printf("TAGGED\n");
979 
980  // Tag this cluster as likely conversion
981  calo ->SetTagged(kTRUE);
982  calo2->SetTagged(kTRUE);
983  }
984  } // selected converted pair
985  } // mass cut
986 
987  } // Mass loop
988 
989  }// main loop
990 
991  // Remove entries identified as conversion electrons
992  // Revise if this is OK
994  {
995  for(Int_t iaod = 0; iaod < naod ; iaod++)
996  {
997  if(indexConverted[iaod]) GetOutputAODBranch()->RemoveAt(iaod);
998  }
999  GetOutputAODBranch()->Compress();
1000  }
1001 
1002  delete [] indexConverted;
1003 
1004  AliDebug(1,Form("End fill AODs, with %d entries",GetOutputAODBranch()->GetEntriesFast()));
1005 }
1006 
1007 
1008 //____________________________________________________________
1010 //____________________________________________________________
1012 {
1013  if(! opt)
1014  return;
1015 
1016  printf("**** Print %s %s ****\n", GetName(), GetTitle() ) ;
1018 
1019  printf("Add conversion pair to AOD = %d, removed? %d\n",fAddConvertedPairsToAOD, fRemoveConvertedPair);
1020  printf("Conversion pair mass cut = %1.2f and %1.2f\n",fMassCut,fMassCutTight);
1021  printf("Conversion selection cut : A < %1.2f; %1.3f < Dphi < %1.3f; Deta < %1.3f\n",
1023 
1024  printf(" \n") ;
1025 }
1026 
Float_t GetHistoPtMax() const
TH2F * fhConvDeltaEtaPhi
! Small mass photons, correlation in phi and eta
TH2F * fhConvDeltaEtaMCAntiNeutron
! Small mass cluster pairs, correlation in eta, origin of both clusters is anti neutron ...
TH2F * fhConvM02MCAntiProton
! Small mass cluster pairs, m02 of cluster 1 vs cluster 2, origin of both clusters is anti proton ...
TH2F * fhConvDistMassCutEta
! Approx distance to vertex vs Mass, dEta < fConvDEtaCut
Float_t GetHistoPtMin() const
Float_t fConvDPhiMaxCut
Select conversion pairs when dphi of pair smaller than cut.
Float_t fConvDPhiMinCut
Select conversion pairs when dphi of pair lager than cut.
virtual void AddToHistogramsName(TString add)
TH2F * fhConvM02MCAntiNeutron
! Small mass cluster pairs, m02 of cluster 1 vs cluster 2, origin of both clusters is anti neutron ...
Definition: External.C:236
TH2F * fhConvDistEnCutAll
! Approx distance to vertex vs energy, dEta < fConvDEtacut, M < 20 MeV/c^2, A < fConvAsymCut ...
TH2F * fhConvDistPhi
! Approx distance to vertex vs azimuth
TH2F * fhConvDistMCConversionCuts
! Calculated conversion distance vs real distance to vertex
Bool_t fRemoveConvertedPair
Remove conversion pairs.
Float_t fConvDEtaCut
Select conversion pairs when deta of pair smaller than cut.
TH2F * fhConvM02MCConversion
! Small mass cluster pairs, m02 of cluster 1 vs cluster 2
TH2F * fhConvDeltaEtaMCConversion
! Small mass cluster pairs, correlation in eta, origin of both clusters is conversion ...
TH2F * fhConvPt
! Small mass photons, pT of pair
TH2F * fhConvDeltaPhiMCConversion
! Small mass cluster pairs, correlation in phi, origin of both clusters is conversion ...
TH2F * fhConvDistEta
! Approx distance to vertex vs rapidity
Int_t GetHistoPhiBins() const
TH1F * fhPtAntiNeutronTagged
! Number of identified gamma from AntiNeutrons gamma, tagged as conversion
virtual TClonesArray * GetOutputAODBranch() const
TH2F * fhConvDeltaEta
! Small mass photons, correlation in eta
Float_t GetHistoPhiMin() const
TH2F * fhConvAsymMCString
! Small mass cluster pairs, correlation in energy asymmetry, origin of both clusters is string ...
TH2F * fhConvPtMCConversionRcut[6]
! Small mass cluster pairs, pt of pair, origin of both clusters is conversion, for different producti...
TH2F * fhConvPtMCConversion
! Small mass cluster pairs, pt of pair, origin of both clusters is conversion
TH2F * fhConvAsym
! Small mass photons, correlation in energy asymmetry
Int_t GetModuleNumber(AliAODPWG4Particle *particle, AliVEvent *inputEvent) const
Get the EMCAL/PHOS module number that corresponds to this particle.
const Double_t etamin
TH2F * fhConvDeltaEtaMCString
! Small mass cluster pairs, correlation in eta, origin of both clusters is string ...
TH2F * fhConvDistEtaCutAsy
! Approx distance to vertex vs rapidity, A < fConvAsymCut
Base class for CaloTrackCorr analysis algorithms.
TH2F * fhConvDeltaPhi
! Small mass photons, correlation in phi
TH2F * fhConvDeltaPhiMCAntiProton
! Small mass cluster pairs, correlation in phi, origin of both clusters is anti proton ...
TH1F * fhPtUnknownTagged
! Number of identified gamma from unknown, tagged as conversion
TH2F * fhConvDistEtaCutEta
! Approx distance to vertex vs rapidity, dEta < fConvDEtaCut
void InitParameters()
Initialize the parameters of the analysis.
TObjString * GetAnalysisCuts()
Save parameters used for analysis.
TH1F * fhPtPhotonConv
! Number of identified photon vs transverse momentum
TH2F * fhConvDistEnCutAsy
! Approx distance to vertex vs energy, A < fConvAsymCut
int Int_t
Definition: External.C:63
TH2F * fhConvPtMCAntiNeutron
! Small mass cluster pairs, pt of pair, origin of both clusters is anti neutron
virtual TClonesArray * GetAODMCParticles() const
virtual AliHistogramRanges * GetHistogramRanges()
TH2F * fhConvDistEnCutEta
! Approx distance to vertex vs Energy, dEta < fConvDEtaCut
float Float_t
Definition: External.C:68
TH2F * fhConvDeltaEtaPhiMCAntiProton
! Small mass cluster pairs, correlation in eta-phi, origin of both clusters is anti proton ...
TH2F * fhConvPtMCString
! Small mass cluster pairs, pt of pairs, origin of both clusters is string
const Double_t ptmax
TH2F * fhConvDistMass
! Approx distance to vertex vs Mass
TH2F * fhEtaPhiPhotonConv[6]
! Pseudorapidity vs Phi of identified photon conv pair for 6 transverse momentum bins ...
TH2F * fhConvDeltaPhiMCAntiNeutron
! Small mass cluster pairs, correlation in phi, origin of both clusters is anti neutron ...
TH1F * fhPtConversionTagged
! Number of identified gamma from Conversion , tagged as conversion
TH2F * fhConvDistPhiCutMass
! Approx distance to vertex vs azimuth, M < 20 MeV/c^2
virtual AliCalorimeterUtils * GetCaloUtils() const
TH2F * fhConvDeltaEtaPhiMCConversion
! Small mass cluster pairs, correlation in eta-phi, origin of both clusters is conversion ...
AliAnaPhotonConvInCalo()
Default constructor. Initialize parameters.
TH2F * fhEtaPhiPhotonConvPaired[6]
! Pseudorapidity vs Phi of identified photon conv leg for 6 transverse momentum bins ...
TH2F * fhConvDeltaEtaPhiMCString
! Small mass cluster pairs, correlation in eta-phi, origin of both clusters is string ...
const Double_t ptmin
TH2F * fhConvDistEn
! Approx distance to vertex vs Energy
Float_t fMassCutTight
Mass cut for the conversion pairs selection, tighter.
virtual Double_t GetEventWeight() const
Bool_t fFillClusterConvDistHisto
Fill histograms with calculated conversion distance with data clusters.
TH2F * fhConvDistEtaCutAll
! Approx distance to vertex vs rapidity, dEta < fConvDEtaCut, M < 20 MeV/c^2, A < fConvAsymCut ...
virtual TObjArray * GetPHOSClusters() const
Float_t GetHistoEtaMin() const
TH2F * fhConvDistMCConversion
! Calculated conversion distance vs real distance to vertex
Bool_t Data(TH1F *h, Double_t *rangefit, Bool_t writefit, Double_t &sgn, Double_t &errsgn, Double_t &bkg, Double_t &errbkg, Double_t &sgnf, Double_t &errsgnf, Double_t &sigmafit, Int_t &status)
TH2F * fhConvDeltaEtaMCAntiProton
! Small mass cluster pairs, correlation in eta, origin of both clusters is anti proton ...
TH2F * fhConvDistPhiCutAll
! Approx distance to vertex vs azimuth, dEta < fConvDEtaCut, M < 20 MeV/c^2, A < fConvAsymCut ...
virtual Int_t GetModuleNumber(AliAODPWG4Particle *part) const
TH1F * fhPtAntiProtonTagged
! Number of identified gamma from AntiProtons gamma, tagged as conversion
TH2F * fhConvPtMCAntiProton
! Small mass cluster pairs, pt of pairs, origin of both clusters is anti proton
TH2F * fhConvDistEtaCutMass
! Approx distance to vertex vs rapidity, M < 20 MeV/c^2
TH2F * fhConvAsymMCAntiProton
! Small mass cluster pairs, correlation in energy asymmetry, origin of both clusters is anti proton ...
Float_t GetHistoEtaMax() const
virtual void AddAODParticle(AliAODPWG4Particle part)
Int_t GetHistoPtBins() const
TH2F * fhConvM02MCString
! Small mass cluster pairs, m02 of cluster 1 vs cluster 2, origin of both clusters is string ...
Bool_t fAddConvertedPairsToAOD
Put Converted pairs in AOD.
TLorentzVector fMomentum
! Cluster momentum
TH2F * fhConvDistMassCutAsy
! Approx distance to vertex vs mass, A < fConvAsymCut
TH2F * fhConvAsymMCAntiNeutron
! Small mass cluster pairs, correlation in energy asymmetry, origin of both clusters is anti neutron ...
TH2F * fhConvDistPhiCutEta
! Approx distance to vertex vs azimuth
ClassImp(AliAnalysisTaskCRC) AliAnalysisTaskCRC
const Double_t etamax
Conversions pairs clusters analysis.
virtual AliMCAnalysisUtils * GetMCAnalysisUtils()
TVector3 fProdVertex
! Production vertex
Float_t fConvAsymCut
Select conversion pairs when asymmetry is smaller than cut.
virtual void Print(const Option_t *) const
Print some relevant parameters set for the analysis.
TH2F * fhConvAsymMCConversion
! Small mass cluster pairs, correlation in energy asymmetry, origin of both clusters is conversion ...
const char Option_t
Definition: External.C:48
Float_t fMassCut
Mass cut for the conversion pairs selection.
virtual AliVCluster * FindCluster(TObjArray *clusters, Int_t clId, Int_t &iclus, Int_t first=0)
void Print(const Option_t *opt) const
Print some relevant parameters set for the analysis.
Float_t GetHistoPhiMax() const
virtual AliCaloTrackReader * GetReader() const
bool Bool_t
Definition: External.C:53
Int_t GetHistoEtaBins() const
TH2F * fhConvDistEnCutMass
! Approx distance to vertex vs Energy, M < 20 MeV/c^2
virtual TObjArray * GetEMCALClusters() const
Int_t CheckCommonAncestor(Int_t index1, Int_t index2, const AliCaloTrackReader *reader, Int_t &ancPDG, Int_t &ancStatus, TLorentzVector &momentum, TVector3 &prodVertex)
Int_t nptbins
TH2F * fhConvDeltaEtaPhiMCAntiNeutron
! Small mass cluster pairs, correlation in eta-phi, origin of both clusters is anti neutron ...
TH2F * fhConvDeltaPhiMCString
! Small mass cluster pairs, correlation in phi, origin of both clusters is string ...
const Double_t phimin
TH2F * fhConvDistPhiCutAsy
! Approx distance to vertex vs azimuth, A < fConvAsymCut