AliPhysics  d565ceb (d565ceb)
AliAODConversionPhoton.cxx
Go to the documentation of this file.
1 #include "AliAODMCParticle.h"
2 #include "AliAODMCHeader.h"
5 
6 using namespace std;
7 
9 
13 fDCArPrimVtx(0),
14 fDCAzPrimVtx(0),
15 fInvMassPair(0),
16 fCaloPhoton(0),
17 fCaloClusterRef(-1),
18 fNCaloPhotonMCLabels(0),
19 fNCaloPhotonMotherMCLabels(0),
20 fCaloPhotonMCFlags(0)
21 {
22  // initialize calo photon MC labels
23  for (Int_t i =0; i<50; i++){
24  fCaloPhotonMCLabels[i]=-1;
25  }
26  for (Int_t i =0; i<20; i++){
27  fCaloPhotonMotherMCLabels[i]=-1;
28  }
29  //Standard constructor
30 }
31 
33 AliAODConversionParticle(kfphoton),
35 fDCArPrimVtx(0),
36 fDCAzPrimVtx(0),
37 fInvMassPair(0),
38 fCaloPhoton(0),
39 fCaloClusterRef(-1),
40 fNCaloPhotonMCLabels(0),
41 fNCaloPhotonMotherMCLabels(0),
42 fCaloPhotonMCFlags(0)
43 {
44  //Constructor from kfphoton
45 
46  // puts the mass to zero and store dilepton mass
47  SetMass(kfphoton->M());
48 
49  //SetE(P());
50 
51  // initialize calo photon MC labels
52  for (Int_t i =0; i<50; i++){
53  fCaloPhotonMCLabels[i]=-1;
54  }
55  for (Int_t i =0; i<20; i++){
57  }
58 
59 }
60 
64 fDCArPrimVtx(0),
65 fDCAzPrimVtx(0),
66 fInvMassPair(0),
67 fCaloPhoton(0),
68 fCaloClusterRef(-1),
72 {
73  //Constructor from TLorentzVector
74 
75  // initialize calo photon MC labels
76  for (Int_t i =0; i<50; i++){
77  fCaloPhotonMCLabels[i]=-1;
78  }
79  for (Int_t i =0; i<20; i++){
81  }
82 }
83 
84 
85 
87 AliAODConversionParticle(original),
88 AliConversionPhotonBase(original),
89 fDCArPrimVtx(original.fDCArPrimVtx),
90 fDCAzPrimVtx(original.fDCAzPrimVtx),
91 fInvMassPair(original.fInvMassPair),
92 fCaloPhoton(original.fCaloPhoton),
97 {
98  //Copy constructor
99 
100  // initialize calo photon MC labels
101  for (Int_t i =0; i<50; i++){
103  }
104  for (Int_t i =0; i<20; i++){
106  }
107 }
108 
110 {
111  // empty standard destructor
112 }
113 
115 {
116  // assignment operator
117  return *this;
118 }
119 
122 
123  Double_t primCo[3] = {primVertex->GetX(),primVertex->GetY(),primVertex->GetZ()};
124 
125  Double_t absoluteP = TMath::Sqrt(TMath::Power(GetPx(),2) + TMath::Power(GetPy(),2) + TMath::Power(GetPz(),2));
126  Double_t p[3] = {GetPx()/absoluteP,GetPy()/absoluteP,GetPz()/absoluteP};
127  Double_t CP[3];
128 
129  CP[0] = fConversionPoint[0] - primCo[0];
130  CP[1] = fConversionPoint[1] - primCo[1];
131  CP[2] = fConversionPoint[2] - primCo[2];
132 
133  Double_t Lambda = - (CP[0]*p[0]+CP[1]*p[1]+CP[2]*p[2])/(p[0]*p[0]+p[1]*p[1]+p[2]*p[2]);
134 
135  Double_t S[3];
136  S[0] = fConversionPoint[0] + p[0]*Lambda;
137  S[1] = fConversionPoint[1] + p[1]*Lambda;
138  S[2] = fConversionPoint[2] + p[2]*Lambda;
139 
140  fDCArPrimVtx = TMath::Sqrt( TMath::Power(primCo[0]-S[0],2) + TMath::Power(primCo[1]-S[1],2));
141  fDCAzPrimVtx = primCo[2]-S[2];
142 
143  return;
144 }
145 
146 
147 void AliAODConversionPhoton::SetCaloPhotonMCFlags(AliMCEvent *mcEvent, Bool_t enableSort){
148 
149  Bool_t isPhoton = kFALSE; // largest contribution to cluster is photon
150  Bool_t isElectron = kFALSE; // largest contribution to cluster is electron
151  Bool_t isConversion = kFALSE; // largest contribution to cluster is converted electron
152  Bool_t isConversionFullyContained = kFALSE; // largest contribution to cluster is converted electron, second electron has been found in same cluster
153  Bool_t isMerged = kFALSE; // cluster contains more than one particle from the same decay
154  Bool_t isMergedPartConv = kFALSE; // cluster contains more than one particle from the same decay and at least one of the particles came from a conversion
155  Bool_t isDalitz = kFALSE; // this cluster was created by a particle stemming from a dalitz decay
156  Bool_t isDalitzMerged = kFALSE; // this cluster was created by a particle stemming from a dalitz decay and more than one particle of the dalitz decay is contained in the cluster
157  Bool_t isPhotonWithElecMother = kFALSE; // this cluster is from a photon with an electron as mother
158  Bool_t isShower = kFALSE; // this cluster contains as a largest contribution a particle from a shower or radiative process
159  Bool_t isSubLeadingEM = kFALSE; // cluster contains at least one electron or photon from a pi0, eta or eta_prime in subleading contribution
160  Bool_t isElectronFromFragPhoton = kFALSE; // largest contribution to cluster is from converted electron, but photon stems from fragmentation photon ( q -> q gamma)
161 
162 
163 
164  TParticle* Photon = 0x0;
165  if (fNCaloPhotonMCLabels==0) return;
166 
167  if (enableSort){
168  // sort the array according to the energy of contributing particles
169  if (fNCaloPhotonMCLabels>1){
170  // cout << "start sorting" << endl;
171  Int_t* sortIdx = new Int_t[fNCaloPhotonMCLabels];
172  Double_t* energyPerPart = new Double_t[fNCaloPhotonMCLabels];
173  Long_t* orginalContrib = new Long_t[fNCaloPhotonMCLabels];
174  for (Int_t i = 0; i < fNCaloPhotonMCLabels; i++){
175  orginalContrib[i] = fCaloPhotonMCLabels[i];
176  if (fCaloPhotonMCLabels[i]> -1){
177  TParticle* dummy = mcEvent->Particle(fCaloPhotonMCLabels[i]);
178  if (dummy){
179  energyPerPart[i] = dummy->Energy();
180  // suppress energy of hadrons !!! DIRTY hack !!!
181  if (!(TMath::Abs(dummy->GetPdgCode())== 11 || TMath::Abs(dummy->GetPdgCode())== 22)){
182  // cout << "suppressed hadron energy for:" << dummy->GetPdgCode() << endl;
183  energyPerPart[i]= 0.25; // put energy to mip
184  }
185  }
186  } else {
187  energyPerPart[i] = 0;
188  }
189  }
190 
191  TMath::Sort(fNCaloPhotonMCLabels,energyPerPart,sortIdx);
192  for(Int_t index = 0; index < fNCaloPhotonMCLabels; index++) {
193  fCaloPhotonMCLabels[index] = orginalContrib [sortIdx[index]] ;
194 
195  }
196  delete [] sortIdx;
197  delete [] energyPerPart;
198  delete [] orginalContrib;
199  }
200  }
201 
202  if(GetCaloPhotonMCLabel(0)>-1) Photon = mcEvent->Particle(GetCaloPhotonMCLabel(0));
203 
204  if(Photon == NULL){
205  return;
206  }
207 
208  Int_t particleMotherLabel = Photon->GetMother(0);
209  Int_t particleGrandMotherLabel = -1;
210  Int_t particleGrandMotherX2Label = -1;
211  Int_t particleGrandMotherX3Label = -1;
212  Int_t particleGrandMotherX4Label = -1;
213  Int_t particleGrandMotherX5Label = -1;
214  Int_t particleGrandMotherX6Label = -1;
215  Int_t particleGrandMotherX7Label = -1;
216 
217  Int_t particleMotherPDG = -1;
218  Int_t particleGrandMotherPDG = -1;
219  Int_t particleGrandMotherX2PDG = -1;
220  Int_t particleGrandMotherX3PDG = -1;
221  Int_t particleGrandMotherX4PDG = -1;
222  Int_t particleGrandMotherX5PDG = -1;
223  Int_t particleGrandMotherX6PDG = -1;
224 
225  Int_t particleMotherNDaugthers = 0;
226  Int_t particleGrandMotherNDaugthers = 0;
227 
228  if (particleMotherLabel > -1){
229  particleMotherNDaugthers = mcEvent->Particle(Photon->GetMother(0))->GetNDaughters();
230  particleGrandMotherLabel = mcEvent->Particle(Photon->GetMother(0))->GetMother(0);
231  particleMotherPDG = mcEvent->Particle(Photon->GetMother(0))->GetPdgCode();
232  if (particleGrandMotherLabel > -1){
233  particleGrandMotherPDG = mcEvent->Particle(mcEvent->Particle(Photon->GetMother(0))->GetMother(0))->GetPdgCode();
234  particleGrandMotherNDaugthers = mcEvent->Particle(mcEvent->Particle(Photon->GetMother(0))->GetMother(0))->GetNDaughters();
235  particleGrandMotherX2Label = mcEvent->Particle(mcEvent->Particle(Photon->GetMother(0))->GetMother(0))->GetMother(0);
236  if (particleGrandMotherX2Label > -1){
237  particleGrandMotherX2PDG = mcEvent->Particle(mcEvent->Particle(mcEvent->Particle(Photon->GetMother(0))->GetMother(0))->GetMother(0))->GetPdgCode();
238  particleGrandMotherX3Label = mcEvent->Particle(mcEvent->Particle(mcEvent->Particle(Photon->GetMother(0))->GetMother(0))->GetMother(0))->GetMother(0);
239  if (particleGrandMotherX3Label > -1){
240  particleGrandMotherX3PDG = mcEvent->Particle(mcEvent->Particle(mcEvent->Particle(mcEvent->Particle(Photon->GetMother(0))->GetMother(0))->GetMother(0))->GetMother(0))->GetPdgCode();
241  particleGrandMotherX4Label = mcEvent->Particle(mcEvent->Particle(mcEvent->Particle(mcEvent->Particle(Photon->GetMother(0))->GetMother(0))->GetMother(0))->GetMother(0))->GetMother(0);
242  if (particleGrandMotherX4Label > -1){
243  particleGrandMotherX4PDG = mcEvent->Particle(mcEvent->Particle(mcEvent->Particle(mcEvent->Particle(mcEvent->Particle(Photon->GetMother(0))->GetMother(0))->GetMother(0))->GetMother(0))->GetMother(0))->GetPdgCode();
244  particleGrandMotherX5Label = mcEvent->Particle(mcEvent->Particle(mcEvent->Particle(mcEvent->Particle(mcEvent->Particle(Photon->GetMother(0))->GetMother(0))->GetMother(0))->GetMother(0))->GetMother(0))->GetMother(0);
245  if (particleGrandMotherX5Label > -1){
246  particleGrandMotherX5PDG = mcEvent->Particle(mcEvent->Particle(mcEvent->Particle(mcEvent->Particle(mcEvent->Particle(mcEvent->Particle(Photon->GetMother(0))->GetMother(0))->GetMother(0))->GetMother(0))->GetMother(0))->GetMother(0))->GetPdgCode();
247  particleGrandMotherX6Label = mcEvent->Particle(mcEvent->Particle(mcEvent->Particle(mcEvent->Particle(mcEvent->Particle(mcEvent->Particle(Photon->GetMother(0))->GetMother(0))->GetMother(0))->GetMother(0))->GetMother(0))->GetMother(0))->GetMother(0);
248  if (particleGrandMotherX6Label > -1){
249  particleGrandMotherX6PDG = mcEvent->Particle(mcEvent->Particle(mcEvent->Particle(mcEvent->Particle(mcEvent->Particle(mcEvent->Particle(mcEvent->Particle(Photon->GetMother(0))->GetMother(0))->GetMother(0))->GetMother(0))->GetMother(0))->GetMother(0))->GetMother(0))->GetPdgCode();
250  particleGrandMotherX7Label = mcEvent->Particle(mcEvent->Particle(mcEvent->Particle(mcEvent->Particle(mcEvent->Particle(mcEvent->Particle(mcEvent->Particle(Photon->GetMother(0))->GetMother(0))->GetMother(0))->GetMother(0))->GetMother(0))->GetMother(0))->GetMother(0))->GetMother(0);
251  }
252  }
253  }
254  }
255  }
256  }
257  }
258 
259  //determine mother/grandmother of leading particle and if it is pion/eta/eta_prime: fill array fCaloPhotonMotherMCLabels at position 0
260  if (particleMotherLabel > -1){
261  if( TMath::Abs(particleMotherPDG) == 111 || TMath::Abs(particleMotherPDG) == 221 || TMath::Abs(particleMotherPDG) == 331 ){
262  fCaloPhotonMotherMCLabels[0] = particleMotherLabel;
264  } else if (particleGrandMotherLabel > -1 && TMath::Abs(particleMotherPDG) == 22 &&
265  (TMath::Abs(particleGrandMotherPDG) == 111 || TMath::Abs(particleGrandMotherPDG) == 221 || TMath::Abs(particleGrandMotherPDG) == 331) ){
266  fCaloPhotonMotherMCLabels[0] = particleGrandMotherLabel;
268  } else {
269  fCaloPhotonMotherMCLabels[0] = particleMotherLabel;
271  }
272  }
273 
274  // Check whether the first contribution was photon
275  if(TMath::Abs(mcEvent->Particle(GetCaloPhotonMCLabel(0))->GetPdgCode()) == 22){
276  isPhoton = kTRUE;
277  // did it decay via the dalitz channel
278  if (particleMotherLabel > -1 && particleMotherNDaugthers == 3)
279  isDalitz = kTRUE;
280  // Test whether particle stems from a shower or radiation
281  if (TMath::Abs(particleMotherPDG) == 11){ // check whether photon stems from electron
282  isPhotonWithElecMother = kTRUE;
283  if (particleGrandMotherLabel > -1){ // test whether first particle has a grandmother
284  if (TMath::Abs(particleGrandMotherPDG) == 22 )
285  isShower = kTRUE; // check whether grandmother is a photon (meaning this is most likely a shower)
286  }
287  }
288  }
289 
290  // Check whether the first contribution was electron
291  if( TMath::Abs(mcEvent->Particle(GetCaloPhotonMCLabel(0))->GetPdgCode()) == 11 ){
292  isElectron = kTRUE;
293  if (particleMotherLabel > -1) {
294  // was it a conversion
295  if (TMath::Abs(particleMotherPDG) == 22)
296  isConversion = kTRUE;
297  // did it decay via the dalitz channel
298  if (particleGrandMotherLabel > -1 && particleGrandMotherNDaugthers == 3 )
299  isDalitz = kTRUE;
300  }
301  if (particleGrandMotherLabel > -1){ // check whether electron has a grandmother
302  if (TMath::Abs(particleGrandMotherPDG) == 11 || TMath::Abs(particleGrandMotherPDG) == 22){ // test whether electron has photon or electron as grandmother (meaning will most likely be a shower)
303  isShower = kTRUE;
304  }
305  }
306  // consider the rare case, where the conversion electron stems from photon, which stems from electron, which stems from photon, ...
307  if (isConversion && TMath::Abs(particleGrandMotherPDG) == 11 && particleGrandMotherX2PDG == 22){
308  SetCaloPhotonMCLabel(0,particleGrandMotherLabel);
309  fCaloPhotonMotherMCLabels[0] = particleGrandMotherX3Label;
310  if (TMath::Abs(particleGrandMotherX3PDG) == 11 && particleGrandMotherX4PDG == 22 ){
311  SetCaloPhotonMCLabel(0,particleGrandMotherX3Label);
312  fCaloPhotonMotherMCLabels[0] = particleGrandMotherX5Label;
313  if (TMath::Abs(particleGrandMotherX5PDG) == 11 && particleGrandMotherX6PDG == 22 ){
314  SetCaloPhotonMCLabel(0,particleGrandMotherX5Label);
315  fCaloPhotonMotherMCLabels[0] = particleGrandMotherX7Label;
316  }
317  }
318  }
319 
320  // consider the case, where a photon stems from a photon which stems from a photon etc...which is common for frag. photons
321  if (particleMotherLabel > -1){
322  TParticle *dummyMother = mcEvent->Particle(particleMotherLabel);
323  if (dummyMother){
324  while (dummyMother->GetPdgCode() == 22){ // follow conversion photon's history, as long as the mother is a photon
325  if (dummyMother->GetMother(0) > -1){
326  dummyMother = mcEvent->Particle(dummyMother->GetMother(0));
327  if (TMath::Abs(dummyMother->GetPdgCode()) == 11){ // in case of additional conversion skip to photon's grandma, which should be a photon
328  if (dummyMother->GetMother(0) > -1){
329  dummyMother = mcEvent->Particle(dummyMother->GetMother(0));
330  }
331  }
332  isElectronFromFragPhoton = (TMath::Abs(dummyMother->GetPdgCode()) < 6);// photon stems from quark = fragmentation photon
333  }
334  }
335  }
336  }
337  }
338 
339  Bool_t enablePrintOuts = kFALSE;
340 // if (fNCaloPhotonMCLabels>2)
341 // enablePrintOuts = kTRUE;
342 
343  // check whether there were other contributions to the cluster
344  if (fNCaloPhotonMCLabels>1){
345  TParticle* dummyPart =NULL;
346 
347  for (Int_t i = 1; i< fNCaloPhotonMCLabels; i++){
348  if (i > 49) continue; // abort if more than 50 entries to the cluster have been checked (more are not stored in these objects)
349  if (enablePrintOuts) cout << "checking particle: " << i << endl;
350  if (GetCaloPhotonMCLabel(i) < 0) continue;
351  dummyPart = mcEvent->Particle(GetCaloPhotonMCLabel(i));
352  Int_t dummyPartMotherLabel = dummyPart->GetMother(0);
353  Int_t dummyPartGrandMotherLabel = -1;
354  Int_t dummyPartMotherPDG = -1;
355  Int_t dummyPartGrandMotherPDG = -1;
356  // check whether this particle has a mother & obtain the pdg code
357  if (dummyPartMotherLabel > -1){
358  dummyPartGrandMotherLabel = mcEvent->Particle(dummyPart->GetMother(0))->GetMother(0);
359  dummyPartMotherPDG = mcEvent->Particle(dummyPart->GetMother(0))->GetPdgCode();
360  // check whether this particle has a grandmother & obtain its pdg code
361  if (dummyPartGrandMotherLabel > -1){
362  dummyPartGrandMotherPDG = mcEvent->Particle(mcEvent->Particle(dummyPart->GetMother(0))->GetMother(0))->GetPdgCode();
363  }
364  }
365  // largest contribution was from photon and is not from shower or electron mother
366  if (isPhoton && (!isShower || !isPhotonWithElecMother )){
367  if (enablePrintOuts) cout << "lead gamma" << endl;
368  if (dummyPartMotherLabel > -1 && particleMotherLabel > -1){ // test whether first particle has a mother
369  if (dummyPartMotherLabel == particleMotherLabel)
370  isMerged = kTRUE; // test whether current and first particle have the same mother => i.e. other gamma from decay or dalitz electron
371  if (dummyPartGrandMotherLabel > -1){ // test whether first particle has a grandmother
372  // check whether particle is an electron from a conversion of a photon from the original mother
373  if (TMath::Abs(dummyPart->GetPdgCode()) == 11 && dummyPartGrandMotherLabel == particleMotherLabel )
374  isMergedPartConv = kTRUE;
375  // check whether particle is an electron from a dalitz decay from the original mother
376  if (TMath::Abs(dummyPart->GetPdgCode()) == 11 && dummyPartMotherLabel == particleMotherLabel )
377  isDalitzMerged = kTRUE;
378  }
379  }
380  }
381 
382  // largest contribution was from electron & not a from a shower
383  if (isElectron && !isShower){
384  if (enablePrintOuts) cout << "lead electron" << endl;
385  if (dummyPartMotherLabel > -1 && particleMotherLabel > -1){ // test whether first particle has a mother
386  if ( TMath::Abs(dummyPart->GetPdgCode()) == 11 && isConversion && dummyPartMotherLabel == particleMotherLabel ) {
387  isConversionFullyContained = kTRUE; // test whether conversion is fully contained in cluster
388  if (enablePrintOuts) cout << "found full conversion" << endl;
389  } else if (TMath::Abs(dummyPart->GetPdgCode()) == 11) { // current particle is an electron
390  if (enablePrintOuts) cout << "current is electron" << endl;
391  // check whether current particle is a shower
392  Bool_t isShowerCurrent = kFALSE;
393  if (TMath::Abs(dummyPartGrandMotherPDG) == 11)
394  isShowerCurrent = kTRUE;
395  if (TMath::Abs(dummyPartGrandMotherPDG) == 22)
396  isShowerCurrent = kTRUE;
397 
398  // check whether current particle is a conversion
399  Bool_t isConvCurrent = kFALSE;
400  if (TMath::Abs(dummyPartMotherPDG) == 22 && !isShowerCurrent)
401  isConvCurrent = kTRUE;
402 
403  if (enablePrintOuts) cout << "conv current: " << isConvCurrent << "\t shower current: " << isShowerCurrent << endl;
404  // check whether orginal electron and this electron stem from the same particle and electron originated in dalitz decay
405  if( dummyPartMotherLabel == particleMotherLabel && TMath::Abs(particleMotherPDG) != 22 && !isShowerCurrent ) {
406  isDalitzMerged = kTRUE;
407  isMerged = kTRUE;
408  // both particles are from conversions
409  } else if (isConversion && isConvCurrent){
410  if (particleGrandMotherLabel > -1 && dummyPartGrandMotherLabel > -1){ // test whether first particle has a grandmother and current particle has one as well
411  // check whether orginal electron and this electron stem from the same particle and electron stems from conversion
412  if( dummyPartGrandMotherLabel == particleGrandMotherLabel && !isShowerCurrent )
413  isMergedPartConv = kTRUE;
414  }
415  // check whether current electron is from conversion & orginal e are from same mother
416  } else if (dummyPartGrandMotherLabel > -1 && isConvCurrent){
417  if (dummyPartGrandMotherLabel == particleMotherLabel && (TMath::Abs(particleMotherPDG) == 111 || TMath::Abs(particleMotherPDG) == 221 || TMath::Abs(particleMotherPDG) == 331) ){
418  isDalitzMerged = kTRUE;
419  isMerged = kTRUE;
420  }
421  // check whether current electron & orginal e is from conversion are from same mother
422  } else if (isConversion && particleGrandMotherLabel > -1){
423  if (dummyPartMotherLabel == particleGrandMotherLabel && (TMath::Abs(dummyPartMotherPDG) == 111 || TMath::Abs(dummyPartMotherPDG) == 221 || TMath::Abs(dummyPartMotherPDG) == 331) ){
424  isDalitzMerged = kTRUE;
425  isMerged = kTRUE;
426  }
427  }
428  } else if (TMath::Abs(dummyPart->GetPdgCode()) == 22){ // test whether this particle is a photon
429  // check whether current particle is a shower
430  Bool_t isShowerCurrent = kFALSE;
431  if (TMath::Abs(dummyPartMotherPDG) == 11)
432  isShowerCurrent = kTRUE;
433  if (TMath::Abs(dummyPartMotherPDG) == 22)
434  isShowerCurrent = kTRUE;
435 
436  // check whether orginal electron and this photon stem from the same particle and electron originated in dalitz
437  if( dummyPartMotherLabel == particleMotherLabel && !isShowerCurrent ) {
438  isDalitzMerged = kTRUE;
439  isMerged = kTRUE;
440  } else if (particleGrandMotherLabel > -1){ // test whether first particle has a grandmother
441  // check whether orginal electron and this photon stem from the same particle and electron stems from conversion
442  if( dummyPartMotherLabel == particleGrandMotherLabel && !isShowerCurrent )
443  isMergedPartConv = kTRUE;
444  }
445  }
446  }
447  }
448 
449 
450  if (dummyPartMotherLabel > -1){ // test whether particle has a mother
451  if (TMath::Abs(dummyPart->GetPdgCode()) == 22){ // test whether particle is a photon
452  //check if photon directly comes from a pion/eta/eta_prime decay
453  Bool_t helpN = true;
454  for(Int_t j=0; j<fNCaloPhotonMotherMCLabels; j++){
455  if (fCaloPhotonMotherMCLabels[j] == dummyPartMotherLabel){ //check if mother is already contained in fCaloPhotonMotherMCLabels
456  helpN = false;
457  }
458  }
459  if (helpN){
461  fNCaloPhotonMotherMCLabels++; //only if particle label is not yet contained in array, count up fNCaloPhotonMotherMCLabels
462  }
463  if ((TMath::Abs(dummyPartMotherPDG) == 111 || TMath::Abs(dummyPartMotherPDG) == 221 || TMath::Abs(dummyPartMotherPDG) == 331) && !isPhoton && !isElectron)
464  isSubLeadingEM = kTRUE;
465  } else if (TMath::Abs(dummyPart->GetPdgCode()) == 11){ //test whether particle is an electron
466  //check if electron comes from a pion decay
467  if ( TMath::Abs(dummyPartMotherPDG) != 22 ){
468  Bool_t helpN = true;
469  for(Int_t j=0; j<fNCaloPhotonMotherMCLabels; j++){
470  if (fCaloPhotonMotherMCLabels[j] == dummyPartMotherLabel){ //check if mother is already contained in fCaloPhotonMotherMCLabels
471  helpN = false;
472  }
473  }
474  if (helpN){
476  fNCaloPhotonMotherMCLabels++; //only if particle label is not yet contained in array, count up fNCaloPhotonMotherMCLabels
477  }
478  if ((TMath::Abs(dummyPartMotherPDG) == 111 || TMath::Abs(dummyPartMotherPDG) == 221 || TMath::Abs(dummyPartMotherPDG) == 331) && !isPhoton && !isElectron)
479  isSubLeadingEM = kTRUE;
480  } else if (dummyPartGrandMotherLabel > -1){ //if it is not a dalitz decay, test whether particle has a grandmother
481  //check if it is a conversion electron that has pion/eta/eta_prime as grandmother
482  if ( (TMath::Abs(dummyPartGrandMotherPDG) == 111 || TMath::Abs(dummyPartGrandMotherPDG) == 221 || TMath::Abs(dummyPartGrandMotherPDG) == 331)){
483 
484  Bool_t helpN = true;
485  for(Int_t j=0; j<fNCaloPhotonMotherMCLabels; j++){
486  if (fCaloPhotonMotherMCLabels[j] == dummyPartGrandMotherLabel){ //check if grandmother is already contained in fCaloPhotonMotherMCLabels
487  helpN = false;
488  }
489  }
490  if (helpN){
491  fCaloPhotonMotherMCLabels[fNCaloPhotonMotherMCLabels] = dummyPartGrandMotherLabel;
492  fNCaloPhotonMotherMCLabels++; //only if particle label is not yet contained in array, count up fNCaloPhotonMotherMCLabels
493  }
494  if (!isPhoton && !isElectron)
495  isSubLeadingEM = kTRUE;
496  }
497  }
498  }
499  }
500  }
501  }
502  fCaloPhotonMCFlags = isPhoton *1 + isElectron *2 + isConversion*4+ isConversionFullyContained *8 + isMerged *16 + isMergedPartConv*32 + isDalitz *64 + isDalitzMerged *128 + isPhotonWithElecMother *256 + isShower * 512 + isSubLeadingEM * 1024 + isElectronFromFragPhoton * 2048;
503 }
504 
505 void AliAODConversionPhoton::SetCaloPhotonMCFlagsAOD(AliVEvent* event, Bool_t enableSort){
506 
507  TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(event->FindListObject(AliAODMCParticle::StdBranchName()));
508  if (!AODMCTrackArray) return;
509 
510  Bool_t isPhoton = kFALSE; // largest contribution to cluster is photon
511  Bool_t isElectron = kFALSE; // largest contribution to cluster is electron
512  Bool_t isConversion = kFALSE; // largest contribution to cluster is converted electron
513  Bool_t isConversionFullyContained = kFALSE; // largest contribution to cluster is converted electron, second electron has been found in same cluster
514  Bool_t isMerged = kFALSE; // largest contribution to cluster is photon, second photon or electron from dalitz has been found in same cluster
515  Bool_t isMergedPartConv = kFALSE; // cluster contains more than one particle from the same decay and at least one of the particles came from a conversion
516  Bool_t isDalitz = kFALSE; // this cluster was created by a particle stemming from a dality decay
517  Bool_t isDalitzMerged = kFALSE; // this cluster was created by a particle stemming from a dality decay and more than one particle of the dalitz decay is contained in the cluster
518  Bool_t isPhotonWithElecMother = kFALSE; // this cluster is from a photon with an electron as mother
519  Bool_t isShower = kFALSE; // this cluster contains as a largest contribution a particle from a shower or radiative process
520  Bool_t isSubLeadingEM = kFALSE; // cluster contains at least one electron or photon from a pi0 or eta in subleading contribution
521  Bool_t isElectronFromFragPhoton = kFALSE; // largest contribution to cluster is from converted electron, but photon stems from fragmentation photon ( q -> q gamma)
522 
523  AliAODMCParticle* Photon;
524  AliAODMCParticle* PhotonMother;
525  AliAODMCParticle* PhotonGrandMother;
526 
527  if (fNCaloPhotonMCLabels==0) return;
528  Photon = (AliAODMCParticle*) AODMCTrackArray->At(GetCaloPhotonMCLabel(0));
529 
530  if (enableSort){
531  // sort the array according to the energy of contributing particles
532  if (fNCaloPhotonMCLabels>1){
533  // cout << "start sorting" << endl;
534  Int_t* sortIdx = new Int_t[fNCaloPhotonMCLabels];
535  Double_t* energyPerPart = new Double_t[fNCaloPhotonMCLabels];
536  Long_t* orginalContrib = new Long_t[fNCaloPhotonMCLabels];
537  for (Int_t i = 0; i < fNCaloPhotonMCLabels; i++){
538  orginalContrib[i] = fCaloPhotonMCLabels[i];
539  if (fCaloPhotonMCLabels[i]> -1){
540  AliAODMCParticle* dummy = (AliAODMCParticle*) AODMCTrackArray->At(GetCaloPhotonMCLabel(i));
541  energyPerPart[i] = dummy->E();
542  // suppress energy of hadrons !!! DIRTY hack !!!
543  if (!(TMath::Abs(dummy->GetPdgCode())== 11 || TMath::Abs(dummy->GetPdgCode())== 22)){
544  // cout << "suppressed hadron energy" << endl;
545  energyPerPart[i]= 0.25; // put energy to mip
546  }
547  } else {
548  energyPerPart[i] = 0;
549  }
550  }
551 
552  TMath::Sort(fNCaloPhotonMCLabels,energyPerPart,sortIdx);
553  for(Int_t index = 0; index < fNCaloPhotonMCLabels; index++) {
554  fCaloPhotonMCLabels[index] = orginalContrib [sortIdx[index]] ;
555 
556  }
557  delete [] sortIdx;
558  delete [] energyPerPart;
559  delete [] orginalContrib;
560  }
561  }
562 
563  if(Photon == NULL){
564  return;
565  }
566 
567  Int_t particleMotherLabel = Photon->GetMother();
568  Int_t particleGrandMotherLabel = -1;
569  Int_t particleMotherPDG = -1;
570  Int_t particleGrandMotherPDG = -1;
571  Int_t particleMotherNDaugthers = 0;
572  Int_t particleGrandMotherNDaugthers = 0;
573  Int_t particleGrandMotherX2Label = -1;
574  Int_t particleGrandMotherX3Label = -1;
575  Int_t particleGrandMotherX4Label = -1;
576  Int_t particleGrandMotherX5Label = -1;
577  Int_t particleGrandMotherX6Label = -1;
578  Int_t particleGrandMotherX7Label = -1;
579  Int_t particleGrandMotherX2PDG = -1;
580  Int_t particleGrandMotherX3PDG = -1;
581  Int_t particleGrandMotherX4PDG = -1;
582  Int_t particleGrandMotherX5PDG = -1;
583  Int_t particleGrandMotherX6PDG = -1;
584 
585  if (particleMotherLabel > -1){
586  PhotonMother = (AliAODMCParticle*) AODMCTrackArray->At(Photon->GetMother());
587  particleMotherNDaugthers = PhotonMother->GetNDaughters();
588  particleGrandMotherLabel = PhotonMother->GetMother();
589  particleMotherPDG = PhotonMother->GetPdgCode();
590  if (particleGrandMotherLabel > -1){
591  PhotonGrandMother = (AliAODMCParticle*) AODMCTrackArray->At(PhotonMother->GetMother());
592  particleGrandMotherPDG = PhotonGrandMother->GetPdgCode();
593  particleGrandMotherNDaugthers = PhotonGrandMother->GetNDaughters();
594  AliAODMCParticle* dummyGMM = NULL;
595 
596  particleGrandMotherX2Label = PhotonGrandMother->GetMother();
597  if (particleGrandMotherX2Label > -1){
598  dummyGMM = (AliAODMCParticle*) AODMCTrackArray->At(particleGrandMotherX2Label);
599  particleGrandMotherX2PDG = dummyGMM->GetPdgCode();
600  particleGrandMotherX3Label = dummyGMM->GetMother();
601  if (particleGrandMotherX3Label > -1){
602  dummyGMM = (AliAODMCParticle*) AODMCTrackArray->At(particleGrandMotherX3Label);
603  particleGrandMotherX3PDG = dummyGMM->GetPdgCode();
604  particleGrandMotherX4Label = dummyGMM->GetMother();
605  if (particleGrandMotherX4Label > -1){
606  dummyGMM = (AliAODMCParticle*) AODMCTrackArray->At(particleGrandMotherX4Label);
607  particleGrandMotherX4PDG = dummyGMM->GetPdgCode();
608  particleGrandMotherX5Label = dummyGMM->GetMother();
609  if (particleGrandMotherX5Label > -1){
610  dummyGMM = (AliAODMCParticle*) AODMCTrackArray->At(particleGrandMotherX5Label);
611  particleGrandMotherX5PDG = dummyGMM->GetPdgCode();
612  particleGrandMotherX6Label = dummyGMM->GetMother();
613  if (particleGrandMotherX6Label > -1){
614  dummyGMM = (AliAODMCParticle*) AODMCTrackArray->At(particleGrandMotherX6Label);
615  particleGrandMotherX6PDG = dummyGMM->GetPdgCode();
616  particleGrandMotherX7Label = dummyGMM->GetMother();
617  }
618  }
619  }
620  }
621  }
622  }
623  }
624 
625  //determine mother/grandmother of leading particle and if it is pion/eta/eta_prime: fill array fCaloPhotonMotherMCLabels at position 0
626  if (particleMotherLabel > -1){
627  if( TMath::Abs(particleMotherPDG) == 111 || TMath::Abs(particleMotherPDG) == 221 || TMath::Abs(particleMotherPDG) == 331 ){
628  fCaloPhotonMotherMCLabels[0] = particleMotherLabel;
630  } else if (TMath::Abs(particleMotherPDG) == 22 && particleGrandMotherLabel > -1){
631  if ( TMath::Abs(particleMotherPDG) == 22 && (TMath::Abs(particleGrandMotherPDG) == 111 || TMath::Abs(particleGrandMotherPDG) == 221 || TMath::Abs(particleGrandMotherPDG) == 331) ){
632  fCaloPhotonMotherMCLabels[0] = particleGrandMotherLabel;
634  }
635  } else {
636  fCaloPhotonMotherMCLabels[0] = particleMotherLabel;
638  }
639  }
640 
641  // Check whether the first contribution was photon
642  if(TMath::Abs(Photon->GetPdgCode()) == 22){
643  isPhoton = kTRUE;
644  // did it decay via the dalitz channel
645  if (particleMotherLabel > -1 && particleMotherNDaugthers == 3)
646  isDalitz = kTRUE;
647  // Test whether particle stems from a shower or radiation
648  if (TMath::Abs(particleMotherPDG) == 11){ // check whether photon stems from electron
649  isPhotonWithElecMother = kTRUE;
650  if (particleGrandMotherLabel > -1){ // test whether first particle has a grandmother
651  if (TMath::Abs(particleGrandMotherPDG) == 22 )
652  isShower = kTRUE; // check whether grandmother is a photon (meaning this is most likely a shower)
653  }
654  }
655  }
656  // Check whether the first contribution was electron
657  if(TMath::Abs(Photon->GetPdgCode()) == 11 ){
658  isElectron = kTRUE;
659  if (particleMotherLabel > -1) {
660  // was it a conversion
661  if (TMath::Abs(particleMotherPDG) == 22)
662  isConversion = kTRUE;
663  // did it decay via the dalitz channel
664  if (particleGrandMotherLabel > -1 && particleGrandMotherNDaugthers == 3 )
665  isDalitz = kTRUE;
666  }
667  if (particleGrandMotherLabel > -1){ // check whether electron has a grandmother
668  if (TMath::Abs(particleGrandMotherPDG) == 11 || TMath::Abs(particleGrandMotherPDG) == 22){ // test whether electron has photon or electron as grandmother (meaning will most likely be a shower)
669  isShower = kTRUE;
670  }
671  }
672  // consider the rare case, where the conversion electron stems from photon, which stems from electron, which stems from photon, ...
673  if (isConversion && TMath::Abs(particleGrandMotherPDG) == 11 && particleGrandMotherX2PDG == 22){
674  SetCaloPhotonMCLabel(0,particleGrandMotherLabel);
675  fCaloPhotonMotherMCLabels[0] = particleGrandMotherX3Label;
676  if (TMath::Abs(particleGrandMotherX3PDG) == 11 && particleGrandMotherX4PDG == 22 ){
677  SetCaloPhotonMCLabel(0,particleGrandMotherX3Label);
678  fCaloPhotonMotherMCLabels[0] = particleGrandMotherX5Label;
679  if (TMath::Abs(particleGrandMotherX5PDG) == 11 && particleGrandMotherX6PDG == 22 ){
680  SetCaloPhotonMCLabel(0,particleGrandMotherX5Label);
681  fCaloPhotonMotherMCLabels[0] = particleGrandMotherX7Label;
682  }
683  }
684  }
685 
686  // consider the case, where a photon stems from a photon which stems from a photon etc...which is common for frag. photons
687  if (particleMotherLabel > -1){
688  AliAODMCParticle* dummyMother = (AliAODMCParticle*) AODMCTrackArray->At(Photon->GetMother());
689  if (dummyMother){
690  while (dummyMother->GetPdgCode() == 22){ // follow conversion photon's history, as long as the mother is a photon
691  if (dummyMother->GetMother() > -1){
692  dummyMother = (AliAODMCParticle*) AODMCTrackArray->At(dummyMother->GetMother());
693  if (TMath::Abs(dummyMother->GetPdgCode()) == 11){ // in case of additional conversion skip to photon's grandma, which should be a photon
694  if (dummyMother->GetMother() > -1){
695  dummyMother = (AliAODMCParticle*) AODMCTrackArray->At(dummyMother->GetMother());
696  }
697  }
698  isElectronFromFragPhoton = (TMath::Abs(dummyMother->GetPdgCode()) < 6);// photon stems from quark = fragmentation photon
699  }
700  }
701  }
702  }
703  }
704 
705 
706 
707  // check whether there were other contributions to the cluster
708  if (fNCaloPhotonMCLabels>1){
709  AliAODMCParticle* dummyPart = NULL;
710  AliAODMCParticle* dummyPartMother = NULL;
711  AliAODMCParticle* dummyPartGrandMother = NULL;
712  for (Int_t i = 1; i< fNCaloPhotonMCLabels; i++){
713  if (i > 49) continue; // abort if more than 50 entries to the cluster have been checked (more are not stored in these objects)
714  dummyPart = (AliAODMCParticle*) AODMCTrackArray->At(GetCaloPhotonMCLabel(i));
715  Int_t dummyPartMotherLabel = dummyPart->GetMother();
716  Int_t dummyPartGrandMotherLabel = -1;
717  Int_t dummyPartMotherPDG = -1;
718  Int_t dummyPartGrandMotherPDG = -1;
719 
720  // check whether this particle has a mother & obtain the pdg code
721  if (dummyPartMotherLabel > -1){
722  dummyPartMother = (AliAODMCParticle*) AODMCTrackArray->At(dummyPart->GetMother());
723  dummyPartGrandMotherLabel = dummyPartMother->GetMother();
724  dummyPartMotherPDG = dummyPartMother->GetPdgCode();
725  // check whether this particle has a grandmother & obtain its pdg code
726  if (dummyPartGrandMotherLabel > -1){
727  dummyPartGrandMother = (AliAODMCParticle*) AODMCTrackArray->At(dummyPartMother->GetMother());
728  dummyPartGrandMotherPDG = dummyPartGrandMother->GetPdgCode();
729  }
730  }
731 
732 
733  // largest contribution was from photon and is not from shower or electron mother
734  if (isPhoton && (!isShower || !isPhotonWithElecMother )){
735  if (dummyPartMotherLabel > -1 && particleMotherLabel > -1){ // test whether first particle has a mother
736  if (dummyPartMotherLabel == particleMotherLabel)
737  isMerged = kTRUE; // test whether current and first particle have the same mother => i.e. other gamma from decay or dalitz electron
738  if (dummyPartGrandMotherLabel > -1){ // test whether first particle has a grandmother
739  // check whether particle is an electron from a conversion of a photon from the original mother
740  if (TMath::Abs(dummyPart->GetPdgCode()) == 11 && dummyPartGrandMotherLabel == particleMotherLabel )
741  isMergedPartConv = kTRUE;
742  // check whether particle is an electron from a dalitz decay from the original mother
743  if (TMath::Abs(dummyPart->GetPdgCode()) == 11 && dummyPartMotherLabel == particleMotherLabel )
744  isDalitzMerged = kTRUE;
745  }
746  }
747  }
748 
749  // largest contribution was from electron & not a from a shower
750  if (isElectron && !isShower){
751  if (dummyPartMotherLabel > -1 && particleMotherLabel > -1){ // test whether first particle has a mother
752  if ( TMath::Abs(dummyPart->GetPdgCode()) == 11 && isConversion && dummyPartMotherLabel == particleMotherLabel ) {
753  isConversionFullyContained = kTRUE; // test whether conversion is fully contained in cluster
754  } else if (TMath::Abs(dummyPart->GetPdgCode()) == 11) { // current particle is an electron
755 
756  // check whether current particle is a shower
757  Bool_t isShowerCurrent = kFALSE;
758  if (TMath::Abs(dummyPartGrandMotherPDG) == 11)
759  isShowerCurrent = kTRUE;
760  if (TMath::Abs(dummyPartGrandMotherPDG) == 22)
761  isShowerCurrent = kTRUE;
762 
763  // check whether current particle is a conversion
764  Bool_t isConvCurrent = kFALSE;
765  if (TMath::Abs(dummyPartMotherPDG) == 22 && !isShowerCurrent)
766  isConvCurrent = kTRUE;
767 
768  // check whether orginal electron and this electron stem from the same particle and electron originated in dalitz decay
769  if( dummyPartMotherLabel == particleMotherLabel && TMath::Abs(particleMotherPDG) != 22 && !isShowerCurrent ) {
770  isDalitzMerged = kTRUE;
771  isMerged = kTRUE;
772  // both particles are from conversions
773  } else if (isConversion && isConvCurrent){
774  if (particleGrandMotherLabel > -1 && dummyPartGrandMotherLabel > -1){ // test whether first particle has a grandmother and current particle has one as well
775  // check whether orginal electron and this electron stem from the same particle and electron stems from conversion
776  if( dummyPartGrandMotherLabel == particleGrandMotherLabel && !isShowerCurrent )
777  isMergedPartConv = kTRUE;
778  }
779  // check whether current electron is from conversion & orginal e are from same mother
780  } else if (dummyPartGrandMotherLabel > -1 && isConvCurrent){
781  if (dummyPartGrandMotherLabel == particleMotherLabel && (TMath::Abs(particleMotherPDG) == 111 || TMath::Abs(particleMotherPDG) == 221 || TMath::Abs(particleMotherPDG) == 331) ){
782  isDalitzMerged = kTRUE;
783  isMerged = kTRUE;
784  }
785  // check whether current electron & orginal e is from conversion are from same mother
786  } else if (isConversion && particleGrandMotherLabel > -1){
787  if (dummyPartMotherLabel == particleGrandMotherLabel && (TMath::Abs(dummyPartMotherPDG) == 111 || TMath::Abs(dummyPartMotherPDG) == 221 || TMath::Abs(dummyPartMotherPDG) == 331) ){
788  isDalitzMerged = kTRUE;
789  isMerged = kTRUE;
790  }
791  }
792  } else if (TMath::Abs(dummyPart->GetPdgCode()) == 22){ // test whether this particle is a photon
793  // check whether current particle is a shower
794  Bool_t isShowerCurrent = kFALSE;
795  if (TMath::Abs(dummyPartMotherPDG) == 11)
796  isShowerCurrent = kTRUE;
797  if (TMath::Abs(dummyPartMotherPDG) == 22)
798  isShowerCurrent = kTRUE;
799 
800  // check whether orginal electron and this photon stem from the same particle and electron originated in dalitz
801  if( dummyPartMotherLabel == particleMotherLabel && !isShowerCurrent ) {
802  isDalitzMerged = kTRUE;
803  isMerged = kTRUE;
804  } else if (particleGrandMotherLabel > -1){ // test whether first particle has a grandmother
805  // check whether orginal electron and this photon stem from the same particle and electron stems from conversion
806  if( dummyPartMotherLabel == particleGrandMotherLabel && !isShowerCurrent )
807  isMergedPartConv = kTRUE;
808  }
809  }
810  }
811  }
812 
813  if (dummyPartMotherLabel > -1){ // test whether particle has a mother
814  if (TMath::Abs(dummyPart->GetPdgCode()) == 22){ // test whether particle is a photon
815  //check if photon directly comes from a pion/eta/eta_prime decay
816  Bool_t helpN = true;
817  for(Int_t j=0; j<fNCaloPhotonMotherMCLabels; j++){
818  if (fCaloPhotonMotherMCLabels[j] == dummyPartMotherLabel){ //check if mother is already contained in fCaloPhotonMotherMCLabels
819  helpN = false;
820  }
821  }
822  if (helpN){
824  fNCaloPhotonMotherMCLabels++; //only if particle label is not yet contained in array, count up fNCaloPhotonMotherMCLabels
825  }
826  if ((TMath::Abs(dummyPartMotherPDG) == 111 || TMath::Abs(dummyPartMotherPDG) == 221 || TMath::Abs(dummyPartMotherPDG) == 331) && !isPhoton && !isElectron)
827  isSubLeadingEM = kTRUE;
828  } else if (TMath::Abs(dummyPart->GetPdgCode()) == 11){ //test whether particle is an electron
829  //check if electron comes from a pion decay
830  if ( TMath::Abs(dummyPartMotherPDG) != 22 ){
831  Bool_t helpN = true;
832  for(Int_t j=0; j<fNCaloPhotonMotherMCLabels; j++){
833  if (fCaloPhotonMotherMCLabels[j] == dummyPartMotherLabel){ //check if mother is already contained in fCaloPhotonMotherMCLabels
834  helpN = false;
835  }
836  }
837  if (helpN){
839  fNCaloPhotonMotherMCLabels++; //only if particle label is not yet contained in array, count up fNCaloPhotonMotherMCLabels
840  }
841  if ((TMath::Abs(dummyPartMotherPDG) == 111 || TMath::Abs(dummyPartMotherPDG) == 221 || TMath::Abs(dummyPartMotherPDG) == 331) && !isPhoton && !isElectron)
842  isSubLeadingEM = kTRUE;
843  } else if (dummyPartGrandMotherLabel > -1){ //if it is not a dalitz decay, test whether particle has a grandmother
844  //check if it is a conversion electron that has pion/eta/eta_prime as grandmother
845  if ( (TMath::Abs(dummyPartGrandMotherPDG) == 111 || TMath::Abs(dummyPartGrandMotherPDG) == 221 || TMath::Abs(dummyPartGrandMotherPDG) == 331)){
846 
847  Bool_t helpN = true;
848  for(Int_t j=0; j<fNCaloPhotonMotherMCLabels; j++){
849  if (fCaloPhotonMotherMCLabels[j] == dummyPartGrandMotherLabel){ //check if grandmother is already contained in fCaloPhotonMotherMCLabels
850  helpN = false;
851  }
852  }
853  if (helpN){
854  fCaloPhotonMotherMCLabels[fNCaloPhotonMotherMCLabels] = dummyPartGrandMotherLabel;
855  fNCaloPhotonMotherMCLabels++; //only if particle label is not yet contained in array, count up fNCaloPhotonMotherMCLabels
856  }
857  if (!isPhoton && !isElectron)
858  isSubLeadingEM = kTRUE;
859  }
860  }
861  }
862  }
863  }
864  }
865  fCaloPhotonMCFlags = isPhoton *1 + isElectron *2 + isConversion*4+ isConversionFullyContained *8 + isMerged *16 + isMergedPartConv*32 + isDalitz *64 + isDalitzMerged *128 + isPhotonWithElecMother *256 + isShower * 512 + isSubLeadingEM * 1024 + isElectronFromFragPhoton * 2048;;
866 }
867 
868 //_____________________________________________________________________________
869 // prints information of MC particles contributing to cluster
870 //_____________________________________________________________________________
872  cout << endl << endl << "particles contributing: " << endl;
873  for (Int_t i =0 ; i < fNCaloPhotonMCLabels; i++ ){
874  TParticle *dummy = NULL;
875  if (fCaloPhotonMCLabels[i]>0){
876  dummy = (TParticle*)mcEvent->Particle(fCaloPhotonMCLabels[i]);
877  cout << i << "\t"<< fCaloPhotonMCLabels[i] << "\t pdg code: " <<dummy->GetPdgCode() << "\t prod radius: "<< dummy->R() << "\t energy: " << dummy->Energy() ;
878  if (dummy->GetMother(0) > -1){
879  TParticle* dummyMother = (TParticle*)mcEvent->Particle(dummy->GetMother(0));
880  cout << "\t mother part: " << dummy->GetMother(0) << "\t mother pdg code: " << dummyMother->GetPdgCode() << "\t energy: " << dummyMother->Energy() << endl;
881  if (dummyMother->GetMother(0) > -1){
882  TParticle* dummyGrandMother = (TParticle*)mcEvent->Particle(dummyMother->GetMother(0));
883  cout << "\t grandmother part: " << dummyMother->GetMother(0) << "\t grandmother pdg code: " << dummyGrandMother->GetPdgCode() << "\t energy: " << dummyGrandMother->Energy() << endl;
884  } else {
885  cout << endl;
886  }
887  } else {
888  cout << endl;
889  }
890  }
891 // if (dummy) delete dummy;
892  }
893  cout << "mothers contributing: " << endl;
894  for (Int_t i =0 ; i < fNCaloPhotonMotherMCLabels; i++ ){
895  TParticle *dummy = NULL;
896  if (fCaloPhotonMotherMCLabels[i]>0){
897  dummy = (TParticle*)mcEvent->Particle(fCaloPhotonMotherMCLabels[i]);
898  cout << i << "\t"<< fCaloPhotonMotherMCLabels[i] << "\t pdg code: " <<dummy->GetPdgCode() << "\t prod radius: "<< dummy->R() << "\t energy: " << dummy->Energy() << endl;
899 
900 
901  }
902 // if (dummy) delete dummy;
903  }
904 }
905 
906 //_____________________________________________________________________________
907 // prints information of cluster as it is flagged
908 //_____________________________________________________________________________
910  cout << fCaloPhotonMCFlags << "\t photon: " << IsLargestComponentPhoton() << "\t electron: " << IsLargestComponentElectron() << "\t conversion: " << IsConversion() << "\t conversion full: "
911  << IsConversionFullyContained() << "\t merged: " << IsMerged() << "\t merged p.conv: " << IsMergedPartConv() << "\t Dalitz: " << IsDalitz() << "\t Dalitz merged: " << IsDalitzMerged()
912  << "\t rad: " << IsPhotonWithElecMother() << "\t shower: " << IsShower() << "\t no EM lead: " << IsEMNonLeading() << "\t EM sub lead: " << IsSubLeadingEM() << endl;
913 }
virtual Double_t GetPy() const
double Double_t
Definition: External.C:58
void SetCaloPhotonMCFlags(AliMCEvent *mcEvent, Bool_t enableSort)
virtual Double_t GetPz() const
void SetCaloPhotonMCLabel(Int_t i, Int_t labelCaloPhoton)
AliAODConversionPhoton & operator=(const AliAODConversionPhoton &g)
void PrintCaloMCLabelsAndInfo(AliMCEvent *mcEvent)
int Int_t
Definition: External.C:63
virtual Double_t GetPx() const
bool Bool_t
Definition: External.C:53
void CalculateDistanceOfClossetApproachToPrimVtx(const AliVVertex *primVertex)
void SetCaloPhotonMCFlagsAOD(AliVEvent *event, Bool_t enableSort)