1 #include "AliAODMCParticle.h"
2 #include "AliAODMCHeader.h"
18 fNCaloPhotonMCLabels(0),
19 fNCaloPhotonMotherMCLabels(0),
23 for (
Int_t i =0; i<50; i++){
24 fCaloPhotonMCLabels[i]=-1;
26 for (
Int_t i =0; i<20; i++){
27 fCaloPhotonMotherMCLabels[i]=-1;
40 fNCaloPhotonMCLabels(0),
41 fNCaloPhotonMotherMCLabels(0),
52 for (
Int_t i =0; i<50; i++){
55 for (
Int_t i =0; i<20; i++){
69 fNCaloPhotonMCLabels(0),
70 fNCaloPhotonMotherMCLabels(0),
76 for (
Int_t i =0; i<50; i++){
79 for (
Int_t i =0; i<20; i++){
89 fDCArPrimVtx(original.fDCArPrimVtx),
90 fDCAzPrimVtx(original.fDCAzPrimVtx),
91 fInvMassPair(original.fInvMassPair),
92 fCaloPhoton(original.fCaloPhoton),
93 fCaloClusterRef(original.fCaloClusterRef),
94 fNCaloPhotonMCLabels(original.fNCaloPhotonMCLabels),
95 fNCaloPhotonMotherMCLabels(original.fNCaloPhotonMotherMCLabels),
96 fCaloPhotonMCFlags(original.fCaloPhotonMCFlags)
101 for (
Int_t i =0; i<50; i++){
104 for (
Int_t i =0; i<20; i++){
123 Double_t primCo[3] = {primVertex->GetX(),primVertex->GetY(),primVertex->GetZ()};
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]);
140 fDCArPrimVtx = TMath::Sqrt( TMath::Power(primCo[0]-S[0],2) + TMath::Power(primCo[1]-S[1],2));
150 Bool_t isElectron = kFALSE;
151 Bool_t isConversion = kFALSE;
152 Bool_t isConversionFullyContained = kFALSE;
154 Bool_t isMergedPartConv = kFALSE;
156 Bool_t isDalitzMerged = kFALSE;
157 Bool_t isPhotonWithElecMother = kFALSE;
159 Bool_t isSubLeadingEM = kFALSE;
162 TParticle* Photon = 0x0;
176 energyPerPart[i] = dummy->Energy();
178 if (!(TMath::Abs(dummy->GetPdgCode())== 11 || TMath::Abs(dummy->GetPdgCode())== 22)){
180 energyPerPart[i]= 0.25;
183 energyPerPart[i] = 0;
187 TMath::Sort(fNCaloPhotonMCLabels,energyPerPart,sortIdx);
193 delete [] energyPerPart;
194 delete [] orginalContrib;
204 Int_t particleMotherLabel = Photon->GetMother(0);
205 Int_t particleGrandMotherLabel = -1;
206 Int_t particleMotherPDG = -1;
207 Int_t particleGrandMotherPDG = -1;
208 Int_t particleMotherNDaugthers = 0;
209 Int_t particleGrandMotherNDaugthers = 0;
210 if (particleMotherLabel > -1){
211 particleMotherNDaugthers = mcEvent->Particle(Photon->GetMother(0))->GetNDaughters();
212 particleGrandMotherLabel = mcEvent->Particle(Photon->GetMother(0))->GetMother(0);
213 particleMotherPDG = mcEvent->Particle(Photon->GetMother(0))->GetPdgCode();
214 if (particleGrandMotherLabel > -1){
215 particleGrandMotherPDG = mcEvent->Particle(mcEvent->Particle(Photon->GetMother(0))->GetMother(0))->GetPdgCode();
216 particleGrandMotherNDaugthers = mcEvent->Particle(mcEvent->Particle(Photon->GetMother(0))->GetMother(0))->GetNDaughters();
222 if (particleMotherLabel > -1){
223 if( TMath::Abs(particleMotherPDG) == 111 || TMath::Abs(particleMotherPDG) == 221 || TMath::Abs(particleMotherPDG) == 331 ){
226 }
else if (TMath::Abs(particleMotherPDG) == 22 && particleGrandMotherLabel > -1){
227 if ( TMath::Abs(particleMotherPDG) == 22 && (TMath::Abs(particleGrandMotherPDG) == 111 || TMath::Abs(particleGrandMotherPDG) == 221 || TMath::Abs(particleGrandMotherPDG) == 331) ){
241 if (particleMotherLabel > -1 && particleMotherNDaugthers == 3)
244 if (TMath::Abs(particleMotherPDG) == 11){
245 isPhotonWithElecMother = kTRUE;
246 if (particleGrandMotherLabel > -1){
247 if (TMath::Abs(particleGrandMotherPDG) == 22 )
255 if (particleMotherLabel > -1) {
257 if (TMath::Abs(particleMotherPDG) == 22)
258 isConversion = kTRUE;
260 if (particleGrandMotherLabel > -1 && particleGrandMotherNDaugthers == 3 )
263 if (particleGrandMotherLabel > -1){
264 if (TMath::Abs(particleGrandMotherPDG) == 11 || TMath::Abs(particleGrandMotherPDG) == 22){
270 Bool_t enablePrintOuts = kFALSE;
276 TParticle* dummyPart =NULL;
279 if (i > 49)
continue;
280 if (enablePrintOuts) cout <<
"checking particle: " << i << endl;
283 Int_t dummyPartMotherLabel = dummyPart->GetMother(0);
284 Int_t dummyPartGrandMotherLabel = -1;
285 Int_t dummyPartMotherPDG = -1;
286 Int_t dummyPartGrandMotherPDG = -1;
288 if (dummyPartMotherLabel > -1){
289 dummyPartGrandMotherLabel = mcEvent->Particle(dummyPart->GetMother(0))->GetMother(0);
290 dummyPartMotherPDG = mcEvent->Particle(dummyPart->GetMother(0))->GetPdgCode();
292 if (dummyPartGrandMotherLabel > -1){
293 dummyPartGrandMotherPDG = mcEvent->Particle(mcEvent->Particle(dummyPart->GetMother(0))->GetMother(0))->GetPdgCode();
297 if (isPhoton && (!isShower || !isPhotonWithElecMother )){
298 if (enablePrintOuts) cout <<
"lead gamma" << endl;
299 if (dummyPartMotherLabel > -1 && particleMotherLabel > -1){
300 if (dummyPartMotherLabel == particleMotherLabel)
302 if (dummyPartGrandMotherLabel > -1){
304 if (TMath::Abs(dummyPart->GetPdgCode()) == 11 && dummyPartGrandMotherLabel == particleMotherLabel )
305 isMergedPartConv = kTRUE;
307 if (TMath::Abs(dummyPart->GetPdgCode()) == 11 && dummyPartMotherLabel == particleMotherLabel )
308 isDalitzMerged = kTRUE;
314 if (isElectron && !isShower){
315 if (enablePrintOuts) cout <<
"lead electron" << endl;
316 if (dummyPartMotherLabel > -1 && particleMotherLabel > -1){
317 if ( TMath::Abs(dummyPart->GetPdgCode()) == 11 && isConversion && dummyPartMotherLabel == particleMotherLabel ) {
318 isConversionFullyContained = kTRUE;
319 if (enablePrintOuts) cout <<
"found full conversion" << endl;
320 }
else if (TMath::Abs(dummyPart->GetPdgCode()) == 11) {
321 if (enablePrintOuts) cout <<
"current is electron" << endl;
323 Bool_t isShowerCurrent = kFALSE;
324 if (TMath::Abs(dummyPartGrandMotherPDG) == 11)
325 isShowerCurrent = kTRUE;
326 if (TMath::Abs(dummyPartGrandMotherPDG) == 22)
327 isShowerCurrent = kTRUE;
330 Bool_t isConvCurrent = kFALSE;
331 if (TMath::Abs(dummyPartMotherPDG) == 22 && !isShowerCurrent)
332 isConvCurrent = kTRUE;
334 if (enablePrintOuts) cout <<
"conv current: " << isConvCurrent <<
"\t shower current: " << isShowerCurrent << endl;
336 if( dummyPartMotherLabel == particleMotherLabel && TMath::Abs(particleMotherPDG) != 22 && !isShowerCurrent ) {
337 isDalitzMerged = kTRUE;
340 }
else if (isConversion && isConvCurrent){
341 if (particleGrandMotherLabel > -1 && dummyPartGrandMotherLabel > -1){
343 if( dummyPartGrandMotherLabel == particleGrandMotherLabel && !isShowerCurrent )
344 isMergedPartConv = kTRUE;
347 }
else if (dummyPartGrandMotherLabel > -1 && isConvCurrent){
348 if (dummyPartGrandMotherLabel == particleMotherLabel && (TMath::Abs(particleMotherPDG) == 111 || TMath::Abs(particleMotherPDG) == 221 || TMath::Abs(particleMotherPDG) == 331) ){
349 isDalitzMerged = kTRUE;
353 }
else if (isConversion && particleGrandMotherLabel > -1){
354 if (dummyPartMotherLabel == particleGrandMotherLabel && (TMath::Abs(dummyPartMotherPDG) == 111 || TMath::Abs(dummyPartMotherPDG) == 221 || TMath::Abs(dummyPartMotherPDG) == 331) ){
355 isDalitzMerged = kTRUE;
359 }
else if (TMath::Abs(dummyPart->GetPdgCode()) == 22){
361 Bool_t isShowerCurrent = kFALSE;
362 if (TMath::Abs(dummyPartMotherPDG) == 11)
363 isShowerCurrent = kTRUE;
364 if (TMath::Abs(dummyPartMotherPDG) == 22)
365 isShowerCurrent = kTRUE;
368 if( dummyPartMotherLabel == particleMotherLabel && !isShowerCurrent ) {
369 isDalitzMerged = kTRUE;
371 }
else if (particleGrandMotherLabel > -1){
373 if( dummyPartMotherLabel == particleGrandMotherLabel && !isShowerCurrent )
374 isMergedPartConv = kTRUE;
381 if (dummyPartMotherLabel > -1){
382 if (TMath::Abs(dummyPart->GetPdgCode()) == 22){
392 fNCaloPhotonMotherMCLabels++;
394 if ((TMath::Abs(dummyPartMotherPDG) == 111 || TMath::Abs(dummyPartMotherPDG) == 221 || TMath::Abs(dummyPartMotherPDG) == 331) && !isPhoton && !isElectron)
395 isSubLeadingEM = kTRUE;
396 }
else if (TMath::Abs(dummyPart->GetPdgCode()) == 11){
398 if ( TMath::Abs(dummyPartMotherPDG) != 22 ){
407 fNCaloPhotonMotherMCLabels++;
409 if ((TMath::Abs(dummyPartMotherPDG) == 111 || TMath::Abs(dummyPartMotherPDG) == 221 || TMath::Abs(dummyPartMotherPDG) == 331) && !isPhoton && !isElectron)
410 isSubLeadingEM = kTRUE;
411 }
else if (dummyPartGrandMotherLabel > -1){
413 if ( (TMath::Abs(dummyPartGrandMotherPDG) == 111 || TMath::Abs(dummyPartGrandMotherPDG) == 221 || TMath::Abs(dummyPartGrandMotherPDG) == 331)){
423 fNCaloPhotonMotherMCLabels++;
425 if (!isPhoton && !isElectron)
426 isSubLeadingEM = kTRUE;
433 fCaloPhotonMCFlags = isPhoton *1 + isElectron *2 + isConversion*4+ isConversionFullyContained *8 + isMerged *16 + isMergedPartConv*32 + isDalitz *64 + isDalitzMerged *128 + isPhotonWithElecMother *256 + isShower * 512 + isSubLeadingEM * 1024;
438 TClonesArray *AODMCTrackArray =
dynamic_cast<TClonesArray*
>(
event->FindListObject(AliAODMCParticle::StdBranchName()));
439 if (!AODMCTrackArray)
return;
442 Bool_t isElectron = kFALSE;
443 Bool_t isConversion = kFALSE;
444 Bool_t isConversionFullyContained = kFALSE;
446 Bool_t isMergedPartConv = kFALSE;
448 Bool_t isDalitzMerged = kFALSE;
449 Bool_t isPhotonWithElecMother = kFALSE;
451 Bool_t isSubLeadingEM = kFALSE;
453 AliAODMCParticle* Photon;
454 AliAODMCParticle* PhotonMother;
455 AliAODMCParticle* PhotonGrandMother;
471 energyPerPart[i] = dummy->E();
473 if (!(TMath::Abs(dummy->GetPdgCode())== 11 || TMath::Abs(dummy->GetPdgCode())== 22)){
475 energyPerPart[i]= 0.25;
478 energyPerPart[i] = 0;
482 TMath::Sort(fNCaloPhotonMCLabels,energyPerPart,sortIdx);
488 delete [] energyPerPart;
489 delete [] orginalContrib;
497 Int_t particleMotherLabel = Photon->GetMother();
498 Int_t particleGrandMotherLabel = -1;
499 Int_t particleMotherPDG = -1;
500 Int_t particleGrandMotherPDG = -1;
501 Int_t particleMotherNDaugthers = 0;
502 Int_t particleGrandMotherNDaugthers = 0;
503 if (particleMotherLabel > -1){
504 PhotonMother = (AliAODMCParticle*) AODMCTrackArray->At(Photon->GetMother());
505 particleMotherNDaugthers = PhotonMother->GetNDaughters();
506 particleGrandMotherLabel = PhotonMother->GetMother();
507 particleMotherPDG = PhotonMother->GetPdgCode();
508 if (particleGrandMotherLabel > -1){
509 PhotonGrandMother = (AliAODMCParticle*) AODMCTrackArray->At(PhotonMother->GetMother());
510 particleGrandMotherPDG = PhotonGrandMother->GetPdgCode();
511 particleGrandMotherNDaugthers = PhotonGrandMother->GetNDaughters();
516 if (particleMotherLabel > -1){
517 if( TMath::Abs(particleMotherPDG) == 111 || TMath::Abs(particleMotherPDG) == 221 || TMath::Abs(particleMotherPDG) == 331 ){
520 }
else if (TMath::Abs(particleMotherPDG) == 22 && particleGrandMotherLabel > -1){
521 if ( TMath::Abs(particleMotherPDG) == 22 && (TMath::Abs(particleGrandMotherPDG) == 111 || TMath::Abs(particleGrandMotherPDG) == 221 || TMath::Abs(particleGrandMotherPDG) == 331) ){
532 if(TMath::Abs(Photon->GetPdgCode()) == 22){
535 if (particleMotherLabel > -1 && particleMotherNDaugthers == 3)
538 if (TMath::Abs(particleMotherPDG) == 11){
539 isPhotonWithElecMother = kTRUE;
540 if (particleGrandMotherLabel > -1){
541 if (TMath::Abs(particleGrandMotherPDG) == 22 )
547 if(TMath::Abs(Photon->GetPdgCode()) == 11 ){
549 if (particleMotherLabel > -1) {
551 if (TMath::Abs(particleMotherPDG) == 22)
552 isConversion = kTRUE;
554 if (particleGrandMotherLabel > -1 && particleGrandMotherNDaugthers == 3 )
557 if (particleGrandMotherLabel > -1){
558 if (TMath::Abs(particleGrandMotherPDG) == 11 || TMath::Abs(particleGrandMotherPDG) == 22){
567 AliAODMCParticle* dummyPart = NULL;
568 AliAODMCParticle* dummyPartMother = NULL;
569 AliAODMCParticle* dummyPartGrandMother = NULL;
571 if (i > 49)
continue;
573 Int_t dummyPartMotherLabel = dummyPart->GetMother();
574 Int_t dummyPartGrandMotherLabel = -1;
575 Int_t dummyPartMotherPDG = -1;
576 Int_t dummyPartGrandMotherPDG = -1;
579 if (dummyPartMotherLabel > -1){
580 dummyPartMother = (AliAODMCParticle*) AODMCTrackArray->At(dummyPart->GetMother());
581 dummyPartGrandMotherLabel = dummyPartMother->GetMother();
582 dummyPartMotherPDG = dummyPartMother->GetPdgCode();
584 if (dummyPartGrandMotherLabel > -1){
585 dummyPartGrandMother = (AliAODMCParticle*) AODMCTrackArray->At(dummyPartMother->GetMother());
586 dummyPartGrandMotherPDG = dummyPartGrandMother->GetPdgCode();
592 if (isPhoton && (!isShower || !isPhotonWithElecMother )){
593 if (dummyPartMotherLabel > -1 && particleMotherLabel > -1){
594 if (dummyPartMotherLabel == particleMotherLabel)
596 if (dummyPartGrandMotherLabel > -1){
598 if (TMath::Abs(dummyPart->GetPdgCode()) == 11 && dummyPartGrandMotherLabel == particleMotherLabel )
599 isMergedPartConv = kTRUE;
601 if (TMath::Abs(dummyPart->GetPdgCode()) == 11 && dummyPartMotherLabel == particleMotherLabel )
602 isDalitzMerged = kTRUE;
608 if (isElectron && !isShower){
609 if (dummyPartMotherLabel > -1 && particleMotherLabel > -1){
610 if ( TMath::Abs(dummyPart->GetPdgCode()) == 11 && isConversion && dummyPartMotherLabel == particleMotherLabel ) {
611 isConversionFullyContained = kTRUE;
612 }
else if (TMath::Abs(dummyPart->GetPdgCode()) == 11) {
615 Bool_t isShowerCurrent = kFALSE;
616 if (TMath::Abs(dummyPartGrandMotherPDG) == 11)
617 isShowerCurrent = kTRUE;
618 if (TMath::Abs(dummyPartGrandMotherPDG) == 22)
619 isShowerCurrent = kTRUE;
622 Bool_t isConvCurrent = kFALSE;
623 if (TMath::Abs(dummyPartMotherPDG) == 22 && !isShowerCurrent)
624 isConvCurrent = kTRUE;
627 if( dummyPartMotherLabel == particleMotherLabel && TMath::Abs(particleMotherPDG) != 22 && !isShowerCurrent ) {
628 isDalitzMerged = kTRUE;
631 }
else if (isConversion && isConvCurrent){
632 if (particleGrandMotherLabel > -1 && dummyPartGrandMotherLabel > -1){
634 if( dummyPartGrandMotherLabel == particleGrandMotherLabel && !isShowerCurrent )
635 isMergedPartConv = kTRUE;
638 }
else if (dummyPartGrandMotherLabel > -1 && isConvCurrent){
639 if (dummyPartGrandMotherLabel == particleMotherLabel && (TMath::Abs(particleMotherPDG) == 111 || TMath::Abs(particleMotherPDG) == 221 || TMath::Abs(particleMotherPDG) == 331) ){
640 isDalitzMerged = kTRUE;
644 }
else if (isConversion && particleGrandMotherLabel > -1){
645 if (dummyPartMotherLabel == particleGrandMotherLabel && (TMath::Abs(dummyPartMotherPDG) == 111 || TMath::Abs(dummyPartMotherPDG) == 221 || TMath::Abs(dummyPartMotherPDG) == 331) ){
646 isDalitzMerged = kTRUE;
650 }
else if (TMath::Abs(dummyPart->GetPdgCode()) == 22){
652 Bool_t isShowerCurrent = kFALSE;
653 if (TMath::Abs(dummyPartMotherPDG) == 11)
654 isShowerCurrent = kTRUE;
655 if (TMath::Abs(dummyPartMotherPDG) == 22)
656 isShowerCurrent = kTRUE;
659 if( dummyPartMotherLabel == particleMotherLabel && !isShowerCurrent ) {
660 isDalitzMerged = kTRUE;
662 }
else if (particleGrandMotherLabel > -1){
664 if( dummyPartMotherLabel == particleGrandMotherLabel && !isShowerCurrent )
665 isMergedPartConv = kTRUE;
671 if (dummyPartMotherLabel > -1){
672 if (TMath::Abs(dummyPart->GetPdgCode()) == 22){
682 fNCaloPhotonMotherMCLabels++;
684 if ((TMath::Abs(dummyPartMotherPDG) == 111 || TMath::Abs(dummyPartMotherPDG) == 221 || TMath::Abs(dummyPartMotherPDG) == 331) && !isPhoton && !isElectron)
685 isSubLeadingEM = kTRUE;
686 }
else if (TMath::Abs(dummyPart->GetPdgCode()) == 11){
688 if ( TMath::Abs(dummyPartMotherPDG) != 22 ){
697 fNCaloPhotonMotherMCLabels++;
699 if ((TMath::Abs(dummyPartMotherPDG) == 111 || TMath::Abs(dummyPartMotherPDG) == 221 || TMath::Abs(dummyPartMotherPDG) == 331) && !isPhoton && !isElectron)
700 isSubLeadingEM = kTRUE;
701 }
else if (dummyPartGrandMotherLabel > -1){
703 if ( (TMath::Abs(dummyPartGrandMotherPDG) == 111 || TMath::Abs(dummyPartGrandMotherPDG) == 221 || TMath::Abs(dummyPartGrandMotherPDG) == 331)){
713 fNCaloPhotonMotherMCLabels++;
715 if (!isPhoton && !isElectron)
716 isSubLeadingEM = kTRUE;
723 fCaloPhotonMCFlags = isPhoton *1 + isElectron *2 + isConversion*4+ isConversionFullyContained *8 + isMerged *16 + isMergedPartConv*32 + isDalitz *64 + isDalitzMerged *128 + isPhotonWithElecMother *256 + isShower * 512 + isSubLeadingEM * 1024;
730 cout << endl << endl <<
"particles contributing: " << endl;
732 TParticle *dummy = NULL;
735 cout << i <<
"\t"<<
fCaloPhotonMCLabels[i] <<
"\t pdg code: " <<dummy->GetPdgCode() <<
"\t prod radius: "<< dummy->R() <<
"\t energy: " << dummy->Energy() ;
736 if (dummy->GetMother(0) > -1){
737 TParticle* dummyMother = (TParticle*)mcEvent->Particle(dummy->GetMother(0));
738 cout <<
"\t mother part: " << dummy->GetMother(0) <<
"\t mother pdg code: " << dummyMother->GetPdgCode() <<
"\t energy: " << dummyMother->Energy() << endl;
739 if (dummyMother->GetMother(0) > -1){
740 TParticle* dummyGrandMother = (TParticle*)mcEvent->Particle(dummyMother->GetMother(0));
741 cout <<
"\t grandmother part: " << dummyMother->GetMother(0) <<
"\t grandmother pdg code: " << dummyGrandMother->GetPdgCode() <<
"\t energy: " << dummyGrandMother->Energy() << endl;
751 cout <<
"mothers contributing: " << endl;
753 TParticle *dummy = NULL;
756 cout << i <<
"\t"<<
fCaloPhotonMotherMCLabels[i] <<
"\t pdg code: " <<dummy->GetPdgCode() <<
"\t prod radius: "<< dummy->R() <<
"\t energy: " << dummy->Energy() << endl;
virtual Double_t GetPy() const
Long_t fCaloPhotonMotherMCLabels[20]
Int_t fNCaloPhotonMCLabels
Int_t fNCaloPhotonMotherMCLabels
void SetCaloPhotonMCFlags(AliMCEvent *mcEvent, Bool_t enableSort)
virtual Double_t GetPz() const
AliAODConversionPhoton & operator=(const AliAODConversionPhoton &g)
Double_t fConversionPoint[3]
void PrintCaloMCLabelsAndInfo(AliMCEvent *mcEvent)
virtual ~AliAODConversionPhoton()
Bool_t IsLargestComponentElectron()
Int_t GetCaloPhotonMCLabel(Int_t i)
void SetMass(Float_t mass)
virtual Double_t GetPx() const
Long_t fCaloPhotonMCLabels[50]
Bool_t IsPhotonWithElecMother()
Bool_t IsConversionFullyContained()
void CalculateDistanceOfClossetApproachToPrimVtx(const AliVVertex *primVertex)
void SetCaloPhotonMCFlagsAOD(AliVEvent *event, Bool_t enableSort)
Bool_t IsLargestComponentPhoton()
Bool_t IsMergedPartConv()