From 6326aeaeb9c08c6fc1212077883a4c54c4c3b697 Mon Sep 17 00:00:00 2001 From: kleinb Date: Wed, 2 Dec 2009 09:07:52 +0000 Subject: [PATCH] Store the status code of the MC particle in the AOD, used the upper bits of fFlag for this --- STEER/AliAODHandler.cxx | 3 ++- STEER/AliAODMCParticle.cxx | 7 +++---- STEER/AliAODMCParticle.h | 28 ++++++++++++++++++++-------- 3 files changed, 25 insertions(+), 13 deletions(-) diff --git a/STEER/AliAODHandler.cxx b/STEER/AliAODHandler.cxx index 002dd95edd5..16955922af4 100644 --- a/STEER/AliAODHandler.cxx +++ b/STEER/AliAODHandler.cxx @@ -260,6 +260,7 @@ void AliAODHandler::StoreMCParticles(){ AliAODMCParticle mcpart_tmp(mcpart,i,flag); + mcpart_tmp.SetStatus(mcpart->Particle()->GetStatusCode()); // Int_t d0 = mcpart_tmp.GetDaughter(0); Int_t d1 = mcpart_tmp.GetDaughter(1); @@ -311,7 +312,7 @@ void AliAODHandler::StoreMCParticles(){ if(fMCEventH->IsParticleSelected(m))mcpart_tmp.SetMother(fMCEventH->GetNewLabel(m)); else AliError(Form("PROBLEM Mother not selected %d \n", m)); } - + new (l[j++]) AliAODMCParticle(mcpart_tmp); } diff --git a/STEER/AliAODMCParticle.cxx b/STEER/AliAODMCParticle.cxx index ee25c4de4b0..b9abf7cceed 100644 --- a/STEER/AliAODMCParticle.cxx +++ b/STEER/AliAODMCParticle.cxx @@ -71,8 +71,6 @@ AliAODMCParticle::AliAODMCParticle(AliMCParticle* mcpart, Int_t label,Int_t flag { fDaughter[0] = mcpart->GetFirstDaughter(); fDaughter[1] = mcpart->GetLastDaughter(); - // Set unique id - TObject::SetUniqueID(mcpart->Particle()->GetUniqueID()); } @@ -94,7 +92,6 @@ AliAODMCParticle::AliAODMCParticle(const AliAODMCParticle& mcPart) : // Copy constructor fDaughter[0] = mcPart.fDaughter[0]; fDaughter[1] = mcPart.fDaughter[1]; - } AliAODMCParticle& AliAODMCParticle::operator=(const AliAODMCParticle& mcPart) @@ -151,5 +148,7 @@ void AliAODMCParticle::Print(const Option_t */*opt*/) const { Printf(">>> PDG (%d) : %s",fPdgCode,"Unknown"); } Printf(">> P(%3.3f,%3.3f,%3.3f) V((%3.3f,%3.3f,%3.3f,%3.3f)",fPx,fPy,fPz,fVx,fVy,fVz,fVt); - Printf("> Mother %d, First Daughter %d Last Daughter %d Process %d",fMother,fDaughter[0],fDaughter[1],TObject::GetUniqueID()); + Printf("> Mother %d, First Daughter %d Last Daughter %d , Status %d, PhysicalPrimary %d", + fMother,fDaughter[0],fDaughter[1],GetStatus(), + IsPhysicalPrimary()); } diff --git a/STEER/AliAODMCParticle.h b/STEER/AliAODMCParticle.h index c06c3057207..9c7ce3c0dc9 100644 --- a/STEER/AliAODMCParticle.h +++ b/STEER/AliAODMCParticle.h @@ -75,8 +75,23 @@ class AliAODMCParticle: public AliVParticle { virtual Int_t GetPdgCode() const { return fPdgCode;} enum { kPrimary = 1<<0, kPhysicalPrim = 1<<1 }; - void SetFlag(Int_t flag){fFlag = flag;} - Int_t GetFlag() const {return fFlag;} + void SetFlag(UInt_t flag){fFlag = flag;} + UInt_t GetFlag() const {return fFlag;} + + + // for the status we use the upper 16 bits/2 bytes of the flag word + void SetStatus(Int_t status){ + // a TParticle can have a negative stuts, catch this here and do nothing + if(status<0)return; + // reset the upper bins keep the lower bins + fFlag &= 0xffff; + // bit shift by 16 + fFlag |= (((UInt_t)status)<<16); + } + UInt_t GetStatus() const { + // bit shift by 16 + return fFlag>>16; + } // Bitwise operations void SetPrimary(Bool_t b = kTRUE){ @@ -98,7 +113,7 @@ class AliAODMCParticle: public AliVParticle { Int_t fPdgCode; // PDG code of the particle - Int_t fFlag; // Flag for indication of primary etc + UInt_t fFlag; // Flag for indication of primary etc Int_t fLabel; // Label of the original MCParticle Int_t fMother; // Index of the mother particles Int_t fDaughter[2]; // Indices of the daughter particles @@ -114,7 +129,7 @@ class AliAODMCParticle: public AliVParticle { // Copy the uniquID to another data member? unique ID is correctly handled // via TOBject Copy construct but not by AliVParticle ctor (no passing of - // TParicles + // TParticles // Need a flag for primaries? /* @@ -129,10 +144,7 @@ class AliAODMCParticle: public AliVParticle { }; */ - - - - ClassDef(AliAODMCParticle,3) // AliVParticle realisation for AODMCParticles + ClassDef(AliAODMCParticle,4) // AliVParticle realisation for AODMCParticles }; -- 2.43.0