Added an ID data member to particles and events, and incremented version accordingly
authorpulvir <pulvir@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 17 Jun 2011 09:39:38 +0000 (09:39 +0000)
committerpulvir <pulvir@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 17 Jun 2011 09:39:38 +0000 (09:39 +0000)
PWG2/RESONANCES/AliRsnMiniEvent.cxx
PWG2/RESONANCES/AliRsnMiniEvent.h
PWG2/RESONANCES/AliRsnMiniParticle.h

index 3de40a132d5eca7ccc83dad7996e65f9f614141a..33344c5655c10a3bf36340444cf7719f816d9172 100644 (file)
@@ -24,6 +24,18 @@ void AliRsnMiniEvent::AddParticle(AliRsnMiniParticle copy)
    new (fParticles[n]) AliRsnMiniParticle(copy);
 }
 
+//__________________________________________________________________________________________________
+AliRsnMiniParticle* AliRsnMiniEvent::GetParticle(Int_t i)
+{
+//
+// Return the leading particle
+//
+
+   if (i < 0 || i > fParticles.GetEntriesFast()) return 0x0;
+   
+   return (AliRsnMiniParticle*)fParticles[i];
+}
+
 //__________________________________________________________________________________________________
 AliRsnMiniParticle* AliRsnMiniEvent::LeadingParticle()
 {
@@ -36,3 +48,30 @@ AliRsnMiniParticle* AliRsnMiniEvent::LeadingParticle()
    
    return (AliRsnMiniParticle*)fParticles[fLeading];
 }
+
+//__________________________________________________________________________________________________
+Int_t AliRsnMiniEvent::CountParticles(Char_t charge, Int_t cutID)
+{
+//
+// Counts how many particles have the specified charge and cut bit
+// if charge is not '+', '-' or '0', all charges are considered
+// if cut bit is < 0, it is not checked
+//
+
+   Int_t count = 0;
+   TObjArrayIter next(&fParticles);
+   AliRsnMiniParticle *part = 0x0;
+   
+   while ( (part = (AliRsnMiniParticle*)next()) ) {
+      if (charge == '+' || charge == '-' || charge == '0') {
+         if (part->Charge() != charge) continue;
+      }
+      if (cutID > 0) {
+         if (!part->HasCutBit(cutID)) continue;
+      }
+      count++;
+   }
+   
+   return count;
+}
+
index 611fd75a4dab49481f85d9a161421963f5f77e37..0e1c06649e18f788ac2748b0ec8b9c1c99e1feae 100644 (file)
@@ -19,16 +19,20 @@ public:
    AliRsnMiniEvent() : fVz(0.0), fMult(0.0), fAngle(0.0), fLeading(-1), fParticles("AliRsnMiniParticle", 0) {}
    ~AliRsnMiniEvent() {fParticles.Delete();}
    
+   Int_t&              ID()        {return fID;}
    Float_t&            Vz()        {return fVz;}
    Float_t&            Mult()      {return fMult;}
    Float_t&            Angle()     {return fAngle;}
    TClonesArray&       Particles() {return fParticles;}
-
+   
+   Int_t               CountParticles(Char_t charge = 0, Int_t cutID = -1);
+   AliRsnMiniParticle* GetParticle(Int_t i);
    AliRsnMiniParticle* LeadingParticle();
    void                AddParticle(AliRsnMiniParticle copy);
    
 private:
    
+   Int_t         fID;         // ID number
    Float_t       fVz;         // z-position of vertex
    Float_t       fMult;       // multiplicity or centrality
    Float_t       fAngle;      // angle of reaction plane to main reference frame
@@ -36,7 +40,7 @@ private:
    Int_t         fLeading;    // index of leading particle
    TClonesArray  fParticles;  // list of selected particles
    
-   ClassDef(AliRsnMiniEvent,1)
+   ClassDef(AliRsnMiniEvent,2)
 };
 
 #endif
index 4c869fd65ac9e738f7df4ef053a681058b643705..2e2f58efe13073fea10d5a72a51465730c4dd991 100644 (file)
@@ -16,8 +16,9 @@ class AliRsnDaughter;
 class AliRsnMiniParticle : public TObject {
 public:
 
-   AliRsnMiniParticle() : fCharge(0), fPDG(0), fMother(0), fMotherPDG(0), fCutBits(0x0) {Int_t i = 3; while (i--) fPsim[i] = fPrec[i] = 0.0;}
+   AliRsnMiniParticle() : fIndex(-1), fCharge(0), fPDG(0), fMother(0), fMotherPDG(0), fCutBits(0x0) {Int_t i = 3; while (i--) fPsim[i] = fPrec[i] = 0.0;}
 
+   Int_t&         Index()                    {return fIndex;}
    Char_t&        Charge()                   {return fCharge;}
    Float_t&       PsimX()                    {return fPsim[0];}
    Float_t&       PsimY()                    {return fPsim[1];}
@@ -42,6 +43,7 @@ public:
 
 private:
 
+   Int_t     fIndex;        // ID of track in its event
    Char_t    fCharge;       // track charge *character*: '+', '-', '0' (whatever else = undefined)
    Float_t   fPsim[3];      // MC momentum of the track
    Float_t   fPrec[3];      // reconstructed momentum of the track
@@ -50,7 +52,7 @@ private:
    Short_t   fMotherPDG;    // PDG code of mother
    UShort_t  fCutBits;      // list of bits used to know what cuts were passed by this track
    
-   ClassDef(AliRsnMiniParticle,1)
+   ClassDef(AliRsnMiniParticle,2)
 };
 
 #endif