]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliStack.cxx
removing obsolete component from libAliHLTTrigger
[u/mrichter/AliRoot.git] / STEER / AliStack.cxx
index 2bc35641a34fc832dadfce073288fa61f36dda92..0550ea8e8861f18c6a7845862e54b281c75088ef 100644 (file)
@@ -29,6 +29,7 @@
 #include <TClonesArray.h>
 #include <TObjArray.h>
 #include <TPDGCode.h>
+#include <TMCProcess.h>
 #include <TParticle.h>
 #include <TParticlePDG.h>
 #include <TDatabasePDG.h>
@@ -207,7 +208,7 @@ void AliStack::PushTrack(Int_t done, Int_t parent, Int_t pdg,
     = new(fParticles[fLoadPoint++]) 
       TParticle(pdg, is, parent, -1, kFirstDaughter, kLastDaughter,
                px, py, pz, e, vx, vy, vz, tof);
-   
+                
   particle->SetPolarisation(polx, poly, polz);
   particle->SetWeight(weight);
   particle->SetUniqueID(mech);
@@ -226,7 +227,6 @@ void AliStack::PushTrack(Int_t done, Int_t parent, Int_t pdg,
   particle->SetBit(kDaughtersBit);
   //  Add the particle to the stack
   
-  
   fParticleMap.AddAtAndExpand(particle, fNtrack);//CHECK!!
 
   if(parent>=0) {
@@ -281,8 +281,10 @@ TParticle*  AliStack::PopPrimaryForTracking(Int_t i)
   
   TParticle* particle = Particle(i);
   
-  if (!particle->TestBit(kDoneBit))
+  if (!particle->TestBit(kDoneBit)) {
+    fCurrentTrack = particle;
     return particle;
+  }
   else
     return 0;
 }      
@@ -490,23 +492,41 @@ Bool_t AliStack::KeepPhysics(const TParticle* part)
     // by physics analysis. Decision is put here.
     //
     Bool_t keep = kFALSE;
+
+    Int_t parent = part->GetFirstMother();
+    if (parent >= 0 && parent <= fHgwmk) {
+      TParticle* father = GetParticleMapEntry(parent);
     //
     // Keep first-generation daughter from primaries with heavy flavor 
     //
-    Int_t parent = part->GetFirstMother();
-    if (parent >= 0 && parent <= fHgwmk) {
-       TParticle* father = GetParticleMapEntry(parent);
        Int_t kf = father->GetPdgCode();
        kf = TMath::Abs(kf);
        Int_t kfl = kf;
        // meson ?
        if  (kfl > 10) kfl/=100;
        // baryon
-       if (kfl > 10) kfl/=10;
-       if (kfl > 10) kfl/=10;
+       if (kfl > 10)  kfl/=10;
+       if (kfl > 10)  kfl/=10;
        if (kfl >= 4) {
            keep = kTRUE;
        }
+       //
+       // e+e- from pair production of primary gammas
+       //
+       if ((part->GetUniqueID()) == kPPair)  keep = kTRUE;
+    }
+    //
+    // Decay(cascade) from primaries
+    // 
+    if ((part->GetUniqueID() == kPDecay) && (parent >= 0)) {
+      // Particles from decay
+      TParticle* father = GetParticleMapEntry(parent);
+      Int_t imo = parent;
+      while((imo > fHgwmk) && (father->GetUniqueID() == kPDecay)) {
+       imo =  father->GetFirstMother();
+       father = GetParticleMapEntry(imo);
+      }
+      if ((imo <= fHgwmk)) keep = kTRUE;
     }
     return keep;
 }
@@ -807,6 +827,15 @@ void AliStack::DumpLoadedStack() const
         "\n=======================================================================\n\n");
 }
 
+//_____________________________________________________________________________
+void  AliStack::SetCurrentTrack(Int_t track)
+{ 
+  fCurrent = track; 
+  if (fCurrent < fNprimary) fCurrentTrack = Particle(track);
+}
+
+
+//_____________________________________________________________________________
 //
 // protected methods
 //
@@ -901,7 +930,7 @@ void AliStack::ConnectTree(TTree* tree)
   TBranch *branch=fTreeK->GetBranch("Particles");
   if(branch == 0x0)
    {
-    branch = fTreeK->Branch("Particles", "TParticle", &fParticleBuffer, 4000);
+    branch = fTreeK->Branch("Particles", &fParticleBuffer, 4000);
     AliDebug(2, "Creating Branch in Tree");
    }  
   else
@@ -942,7 +971,7 @@ Bool_t AliStack::IsStable(Int_t pdg) const
   // Nuclear code is 10LZZZAAAI
   if(pdg>1000000000)return kTRUE;
 
-  const Int_t kNstable = 15;
+  const Int_t kNstable = 18;
   Int_t i;
   
   Int_t pdgStable[kNstable] = {
@@ -961,6 +990,9 @@ Bool_t AliStack::IsStable(Int_t pdg) const
     3312,               // Xsi Minus 
     3322,               // Xsi 
     3334,               // Omega
+    kNuE,               // Electron Neutrino 
+    kNuMu,              // Muon Neutrino
+    kNuTau              // Tau Neutrino
   };
     
   Bool_t isStable = kFALSE;
@@ -974,6 +1006,7 @@ Bool_t AliStack::IsStable(Int_t pdg) const
   return isStable;
 }
 
+//_____________________________________________________________________________
 Bool_t AliStack::IsPhysicalPrimary(Int_t index)
 {
     //
@@ -1005,6 +1038,9 @@ Bool_t AliStack::IsPhysicalPrimary(Int_t index)
        Int_t imo =  p->GetFirstMother();
        TParticle* pm  = Particle(imo);
        Int_t mpdg = TMath::Abs(pm->GetPdgCode());
+// Check for Sigma0 
+       if ((mpdg == 3212) &&  (imo <  GetNprimary())) return kTRUE;
+// 
 // Check if it comes from a pi0 decay
 //
 // What about the pi0 Dalitz ??