]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
fixed coding conventions violations
authorpulvir <pulvir@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 20 Oct 2006 18:19:04 +0000 (18:19 +0000)
committerpulvir <pulvir@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 20 Oct 2006 18:19:04 +0000 (18:19 +0000)
PWG2/RESONANCES/AliRsnAnalysis.cxx
PWG2/RESONANCES/AliRsnAnalysis.h
PWG2/RESONANCES/AliRsnDaughter.cxx
PWG2/RESONANCES/AliRsnDaughter.h
PWG2/RESONANCES/AliRsnDaughterCut.cxx
PWG2/RESONANCES/AliRsnDaughterCut.h
PWG2/RESONANCES/AliRsnEvent.cxx
PWG2/RESONANCES/AliRsnEvent.h
PWG2/RESONANCES/AliRsnReader.cxx
PWG2/RESONANCES/AliRsnReader.h

index 4eedede40cf95d06971b84614e602260a280cb56..13809df515c62270693f682447979c8db951b6af 100644 (file)
 //-------------------------------------------------------------------------
 //                     Class AliRsnAnalysis
 //            Reconstruction and analysis of a binary resonance
+// ........................................
+// ........................................
+// ........................................
+// ........................................
+// ........................................
 // 
 // author: A. Pulvirenti             (email: alberto.pulvirenti@ct.infn.it)
 //-------------------------------------------------------------------------
@@ -24,9 +29,6 @@
 
 #include <TH1.h>
 #include <TTree.h>
-#include <TRefArray.h>
-#include <TParticle.h>
-#include <TObjectTable.h>
 #include <TDatabasePDG.h>
 
 #include "AliRsnDaughter.h"
@@ -38,11 +40,11 @@ ClassImp(AliRsnAnalysis)
 
 //--------------------------------------------------------------------------------------------------------
 AliRsnAnalysis::AliRsnAnalysis() 
+{
 //
 // Constructor
 // Initializes all pointers and collections to NULL.
 //
-{
        fMixHistograms = 0;
        fHistograms = 0;
        fEventsTree = 0;
@@ -55,11 +57,11 @@ AliRsnAnalysis::AliRsnAnalysis()
 }
 //--------------------------------------------------------------------------------------------------------
 void AliRsnAnalysis::AddCutPair(AliRsnDaughterCut *cut)
+{
 //
 // Add a cut on pairs.
 // This cut is global for all pairs.
 //
-{
        if (!cut->IsPairCut()) {
                Warning("AddCutPair", "This is a single cut, cannot be added");
                return;
@@ -71,11 +73,11 @@ void AliRsnAnalysis::AddCutPair(AliRsnDaughterCut *cut)
 }
 //--------------------------------------------------------------------------------------------------------
 void AliRsnAnalysis::AddCutSingle(AliPID::EParticleType type, AliRsnDaughterCut *cut)
+{
 //
 // Add a cut on single particles.
 // This cut must be specified for each particle type.
 //
-{
        if (cut->IsPairCut()) {
                Warning("AddCutSingle", "This is a pair cut, cannot be added");
                return;
@@ -89,33 +91,33 @@ void AliRsnAnalysis::AddCutSingle(AliPID::EParticleType type, AliRsnDaughterCut
 //--------------------------------------------------------------------------------------------------------
 void AliRsnAnalysis::AddMixPairDef
 (AliPID::EParticleType p1, Char_t sign1, AliPID::EParticleType p2, Char_t sign2)
+{
 //
 // Adds a new pair definition to create a new histogram,
 // for the event mixing step.
 // If the pair defs array is NULL, it is initialized here.
 //
-{
        if (!fMixPairDefs) fMixPairDefs = new TObjArray(0);
        fMixPairDefs->AddLast( new AliPairDef(p1, sign1, p2, sign2, 0, kFALSE) );
 }
 //--------------------------------------------------------------------------------------------------------
 void AliRsnAnalysis::AddPairDef
 (AliPID::EParticleType p1, Char_t sign1, AliPID::EParticleType p2, Char_t sign2, Bool_t onlyTrue)
+{
 //
 // Adds a new pair definition to create a new histogram,
 // for the signal evaluation (same event) step.
 // If the pair defs array is NULL, it is initialized here.
 //
-{
        if (!fPairDefs) fPairDefs = new TObjArray(0);
        fPairDefs->AddLast( new AliPairDef(p1, sign1, p2, sign2, fTrueMotherPDG, onlyTrue) );
 }
 //--------------------------------------------------------------------------------------------------------
 void AliRsnAnalysis::Clear(Option_t* /* option */)
+{
 //
 // Clear heap
 //
-{
        fHistograms->Clear("C");
        fPairDefs->Clear("C");
                
@@ -128,6 +130,7 @@ void AliRsnAnalysis::Clear(Option_t* /* option */)
 }
 //--------------------------------------------------------------------------------------------------------
 Stat_t AliRsnAnalysis::EventMix(Int_t nmix, Int_t multDiffMax, Double_t vzDiffMax, Bool_t compareTotMult)
+{
 //
 // Performs event mixing.
 // It takes the array of fMixPairDefs and stores results in fMixHistograms.
@@ -149,7 +152,6 @@ Stat_t AliRsnAnalysis::EventMix(Int_t nmix, Int_t multDiffMax, Double_t vzDiffMa
 // analysis->AddMixPairDef(AliRsnEvent::kPion, '+', AliRsnEvent::kKaon, '-');
 // analysis->AddMixPairDef(AliRsnEvent::kKaon, '-', AliRsnEvent::kPion, '+');
 //
-{
        // allocate the histograms array
        Int_t i, npairdefs = (Int_t)fMixPairDefs->GetEntries();
        fMixHistograms = new TObjArray(npairdefs);
@@ -260,6 +262,7 @@ Stat_t AliRsnAnalysis::EventMix(Int_t nmix, Int_t multDiffMax, Double_t vzDiffMa
 }
 //--------------------------------------------------------------------------------------------------------
 Stat_t AliRsnAnalysis::Process()
+{
 //
 // Reads the list 'fPairDefs', and builds an inv-mass histogram for each definition.
 // For each event, particle of 'type 1' are combined with particles of 'type 2' as 
@@ -269,7 +272,6 @@ Stat_t AliRsnAnalysis::Process()
 // It can also be used when one wants to evaluate the 'background' with the 'wrong sign'
 // particle pairs.
 //
-{
        // allocate the histograms array in order to contain 
        // as many objects as the number of pair definitionss
        Int_t i, npairdefs = (Int_t)fPairDefs->GetEntries();
@@ -316,11 +318,11 @@ Stat_t AliRsnAnalysis::Process()
        return nPairs;
 }
 //--------------------------------------------------------------------------------------------------------
-void AliRsnAnalysis::WriteHistograms()
+void AliRsnAnalysis::WriteHistograms() const
+{
 //
 // Writes histograms in current directory
 //
-{
        TH1D *histogram;
        TObjArrayIter iter(fHistograms);
        while ( (histogram = (TH1D*)iter.Next()) ) {
@@ -337,12 +339,12 @@ void AliRsnAnalysis::WriteHistograms()
 //--------------------------------------------------------------------------------------------------------
 Stat_t AliRsnAnalysis::Compute
 (AliPairDef *pd, TH1D* &histogram, AliRsnEvent *event1, AliRsnEvent *event2)
+{
 //
 // Adds to the specified histogram the invariant mass spectrum calculated taking
 // particles of type 1 from event 1, and particles of type 2 from event 2.
 // Events can be equal (signal) or different (background with event mixing).
 //
-{
        // define two 'cursor' objects
        AliRsnDaughter *track1 = 0, *track2 = 0;
        
@@ -387,7 +389,7 @@ Stat_t AliRsnAnalysis::Compute
                        // total 4-momentum
                        track1->SetMass(pd->GetMass1());
                        track2->SetMass(pd->GetMass2());
-                       AliRsnDaughter sum = (*track1) + (*track2);
+                       AliRsnDaughter sum = AliRsnDaughter::Sum(*track1, *track2);
                                
                        // if the choice to get ONLY true pairs is selected, a check is made on the mothers
                        if (pd->GetOnlyTrue()) {
@@ -410,11 +412,11 @@ Stat_t AliRsnAnalysis::Compute
        return nPairs;
 }
 //--------------------------------------------------------------------------------------------------------
-Bool_t AliRsnAnalysis::SingleCutCheck(Int_t itype, AliRsnDaughter *track)
+Bool_t AliRsnAnalysis::SingleCutCheck(Int_t itype, AliRsnDaughter *track) const
+{
 //
 // Checks a track against single particle cuts (if defined)
 //
-{
        if (!fCuts[itype]) return kTRUE;
        
        TObjArrayIter iter(fCuts[itype]);
@@ -426,11 +428,11 @@ Bool_t AliRsnAnalysis::SingleCutCheck(Int_t itype, AliRsnDaughter *track)
        return kTRUE;
 }
 //--------------------------------------------------------------------------------------------------------
-Bool_t AliRsnAnalysis::PairCutCheck(AliRsnDaughter *track1, AliRsnDaughter *track2)
+Bool_t AliRsnAnalysis::PairCutCheck(AliRsnDaughter *track1, AliRsnDaughter *track2) const
+{
 //
 // Checks a pair against pair cuts (if defined)
 //
-{
        if (!fPairCuts) return kTRUE;
        
        TObjArrayIter iter(fPairCuts);
@@ -445,10 +447,10 @@ Bool_t AliRsnAnalysis::PairCutCheck(AliRsnDaughter *track1, AliRsnDaughter *trac
 AliRsnAnalysis::AliPairDef::AliPairDef
 (AliPID::EParticleType p1, Char_t sign1, 
  AliPID::EParticleType p2, Char_t sign2, Int_t pdgMother, Bool_t onlyTrue)
+{
 //
 // Constructor for nested class
 //
-{
        fOnlyTrue = onlyTrue;
        fTrueMotherPDG = 0;
        if (fOnlyTrue) fTrueMotherPDG = pdgMother;
@@ -475,12 +477,12 @@ AliRsnAnalysis::AliPairDef::AliPairDef
        }
 }
 //--------------------------------------------------------------------------------------------------------
-Text_t* AliRsnAnalysis::AliPairDef::ParticleName(AliPID::EParticleType part)
+Text_t* AliRsnAnalysis::AliPairDef::ParticleName(AliPID::EParticleType part) const
+{
 //
 // [PRIVATE]
 // Returns the name of the particle in text format
 //
-{
        if (part == AliPID::kElectron) return ("E");
        else if (part == AliPID::kMuon) return ("Mu");
        else if (part == AliPID::kPion) return ("Pi");
index 15576bd5c064ebd0a9df2b243a3f5d6adaabeade..e052e418707a372255af6f4429a4f8fc1721820e 100644 (file)
@@ -6,6 +6,10 @@
 //-------------------------------------------------------------------------
 //                      Class AliRsnAnalysis
 //             Reconstruction and analysis of K* Rsn
+// ........................................
+// ........................................
+// ........................................
+// ........................................
 // 
 // author: A. Pulvirenti             (email: alberto.pulvirenti@ct.infn.it)
 //-------------------------------------------------------------------------
@@ -28,6 +32,8 @@ class AliRsnAnalysis : public TObject
 public:
 
                 AliRsnAnalysis();
+                        AliRsnAnalysis(const AliRsnAnalysis &copy) : TObject(copy) { }
+                        AliRsnAnalysis& operator=(const AliRsnAnalysis & /*copy*/) { return (*this); }
        virtual ~AliRsnAnalysis() {Clear();}
        
        void     AddCutPair(AliRsnDaughterCut *cut);
@@ -41,7 +47,7 @@ public:
        void     SetEventsTree(TTree *tree)                       {fEventsTree = tree;}
        void     SetRejectFakes(Bool_t doit=kTRUE)                {fRejectFakes = doit;}                
        void     SetTrueMotherPDG(Int_t pdg)                      {fTrueMotherPDG = pdg;}
-       void     WriteHistograms();
+       void     WriteHistograms() const;
        
 private:
 
@@ -53,13 +59,13 @@ private:
                                   
                virtual ~AliPairDef()                 { }
                
-               Char_t                 GetSign1()     {return fSign1;}
-               Char_t                 GetSign2()     {return fSign2;}
-               Bool_t                 GetOnlyTrue()  {return fOnlyTrue;}
-               AliPID::EParticleType  GetParticle1() {return fParticle1;}
-               AliPID::EParticleType  GetParticle2() {return fParticle2;}
-               Double_t               GetMass1()     {return fMass1;}
-               Double_t               GetMass2()     {return fMass2;}
+               Char_t                 GetSign1() const {return fSign1;}
+               Char_t                 GetSign2() const {return fSign2;}
+               Bool_t                 GetOnlyTrue() const {return fOnlyTrue;}
+               AliPID::EParticleType  GetParticle1() const {return fParticle1;}
+               AliPID::EParticleType  GetParticle2() const {return fParticle2;}
+               Double_t               GetMass1() const {return fMass1;}
+               Double_t               GetMass2() const {return fMass2;}
                                
            void SetSign1(Char_t value)                 {fSign1 = value;}
                void SetSign2(Char_t value)                 {fSign2 = value;}
@@ -68,25 +74,25 @@ private:
                void SetParticle1(AliPID::EParticleType p)  {fParticle1 = p;}
                void SetParticle2(AliPID::EParticleType p)  {fParticle2 = p;}
                
-               Text_t* ParticleName(AliPID::EParticleType part);
+               Text_t* ParticleName(AliPID::EParticleType part) const;
                
        private:
        
                Bool_t                 fOnlyTrue;          // flag to be used for spectra of true pairs
                Int_t                  fTrueMotherPDG; // PDG code of true mother (if requested)
                
-               Double_t               fMass1;     //
-               Char_t                 fSign1;     // info about particle 1
-               AliPID::EParticleType  fParticle1; //
+               Double_t               fMass1;     // info
+               Char_t                 fSign1;     // about
+               AliPID::EParticleType  fParticle1; // particle 1
        
-               Double_t               fMass2;     //
-               Char_t                 fSign2;     // info about particle 2
-               AliPID::EParticleType  fParticle2; //
+               Double_t               fMass2;     // info
+               Char_t                 fSign2;     // about
+               AliPID::EParticleType  fParticle2; // particle 2
        };
        
        Stat_t     Compute(AliPairDef *pd, TH1D* &h, AliRsnEvent *ev1, AliRsnEvent *ev2);
-       Bool_t     SingleCutCheck(Int_t itype, AliRsnDaughter *track);
-       Bool_t     PairCutCheck(AliRsnDaughter *track1, AliRsnDaughter *track2);
+       Bool_t     SingleCutCheck(Int_t itype, AliRsnDaughter *track) const;
+       Bool_t     PairCutCheck(AliRsnDaughter *track1, AliRsnDaughter *track2) const;
        
        Bool_t     fRejectFakes;             // reject particles labeled as fake
        
index cc85cf6b23c4ca81b8195d534a221a0d2c2b9555..382c2aeb2d0892f368350935e692e24ede68ed8f 100644 (file)
@@ -15,7 +15,7 @@
  
 //-------------------------------------------------------------------------
 //                      Class AliRsnDaughter
-//  
+//                     ----------------------
 //           A simple object which describes a reconstructed track
 //           with some references to its related generated particle
 //           and some facilities which could help in composing its
@@ -27,7 +27,6 @@
 #include <Riostream.h>
 
 #include <TParticle.h>
-#include <TParticlePDG.h>
 
 #include "AliESDtrack.h"
 #include "AliRsnDaughter.h"
@@ -36,12 +35,12 @@ ClassImp(AliRsnDaughter)
 
 //--------------------------------------------------------------------------------------------------------
 AliRsnDaughter::AliRsnDaughter()
+{
 // 
 // Default constructor.
 // Its unique argument defines how many PID weights are allowed. 
 // Actually, it should be the same as AliESDtrack::kSPECIES (=5).
-//
-{ 
+// 
        fSign = (Char_t)0;
        fPDG = (UShort_t)0;
        fIndex = (UShort_t)0;
@@ -62,10 +61,10 @@ AliRsnDaughter::AliRsnDaughter()
 }
 //--------------------------------------------------------------------------------------------------------
 AliRsnDaughter::AliRsnDaughter(const AliRsnDaughter &copy) : TObject(copy)
+{
 //
 // Copy constructor
 //
-{
        fSign = copy.fSign;
        fPDG = copy.fPDG;
        fIndex = copy.fIndex;
@@ -88,6 +87,7 @@ AliRsnDaughter::AliRsnDaughter(const AliRsnDaughter &copy) : TObject(copy)
 }
 //--------------------------------------------------------------------------------------------------------
 Bool_t AliRsnDaughter::Adopt(const AliESDtrack* esdTrack, Bool_t checkITSRefit)
+{
 //
 // Copies reconstructed data from an AliESDtrack:
 //
@@ -104,7 +104,6 @@ Bool_t AliRsnDaughter::Adopt(const AliESDtrack* esdTrack, Bool_t checkITSRefit)
 // - if the passed label is negative, track is considered as "fake", and 
 //   this info is kept to allow fake tracks exclusion when doing analysis
 //
-{
        // check for refit in the ITS (if requested)
        if (checkITSRefit) {
                if ( !(esdTrack->GetStatus() & AliESDtrack::kITSrefit) ) {
@@ -138,6 +137,7 @@ Bool_t AliRsnDaughter::Adopt(const AliESDtrack* esdTrack, Bool_t checkITSRefit)
 }
 //--------------------------------------------------------------------------------------------------------
 Bool_t AliRsnDaughter::Adopt(TParticle* particle)
+{
 //
 // Copies data from a generated particle:
 // 
@@ -150,7 +150,6 @@ Bool_t AliRsnDaughter::Adopt(TParticle* particle)
 // When an AliRsnDaughter is copied from a TParticle, it is 
 // considered always good for analysis and never fake.
 //
-{
        // get particle sign form the sign of PDG code
        Int_t pdg = particle->GetPdgCode();
        if (TMath::Abs(pdg) < 20) {
@@ -178,12 +177,11 @@ Bool_t AliRsnDaughter::Adopt(TParticle* particle)
        return kTRUE;
 }
 //--------------------------------------------------------------------------------------------------------
-AliRsnDaughter operator+(AliRsnDaughter t1, AliRsnDaughter t2)
+AliRsnDaughter AliRsnDaughter::Sum(AliRsnDaughter t1, AliRsnDaughter t2)
+{
 //
-// Sum operator overloading.
 // Builds a new AliRsnDaughter object with the sum of momenta of two particles.
 //
-{
        // create new AliRsnDaughter with default useless values for datamembers
        AliRsnDaughter out;
        
@@ -201,11 +199,11 @@ AliRsnDaughter operator+(AliRsnDaughter t1, AliRsnDaughter t2)
        }
 
        // compute total 4-momentum
-       Double_t Etot  = t1.GetEnergy() + t2.GetEnergy();
+       Double_t etot  = t1.GetEnergy() + t2.GetEnergy();
        Double_t pxTot = t1.GetPx() + t2.GetPx();
        Double_t pyTot = t1.GetPy() + t2.GetPy();
        Double_t pzTot = t1.GetPz() + t2.GetPz();
-       Double_t mass  = TMath::Sqrt(Etot*Etot - pxTot*pxTot - pyTot*pyTot - pzTot*pzTot);
+       Double_t mass  = TMath::Sqrt(etot*etot - pxTot*pxTot - pyTot*pyTot - pzTot*pzTot);
        
        //TLorentzVector v1 = track1.Get4Momentum();
        //TLorentzVector v2 = track2.Get4Momentum();
index 124a412e5cbdd0eec4d9cfdd5d9384ce0b154f24..89018cfaf7f607e1ddcc7a2722cd930f699248a4 100644 (file)
@@ -19,9 +19,9 @@
 
 #include "AliPID.h"
 #include <TVector3.h>
-#include <TParticle.h>
 #include <TLorentzVector.h>
 
+class TParticle;
 class AliESDtrack;
 
 class AliRsnDaughter : public TObject
@@ -72,7 +72,7 @@ public:
        void           SetTruePDG(Short_t pdg)                                            {fTruePDG = pdg;}
        void           SetVxVyVz(Double_t vx,Double_t vy,Double_t vz) {fV[0]=vx;fV[1]=vy;fV[2]=vz;}
        
-       friend AliRsnDaughter operator+(AliRsnDaughter t1, AliRsnDaughter t2);
+       static AliRsnDaughter Sum(AliRsnDaughter t1, AliRsnDaughter t2);
        
 private:
        
index f79b3ab4db4ce2ebe9c3b8f8d6d9dfe3f496db7f..81acb12199a661923c0605b99978fac71ff9022a 100644 (file)
  
 //-------------------------------------------------------------------------
 //                      Class AliRsnDaughterCut
-//  
+//                     -------------------------
 //           Implementation of track cuts for analysis.
+//           These cuts must be added to the AliRsnAnalysis
+//           object in order to make cut on single particles
+//           or on pairs of particles.
 // 
 // author: A. Pulvirenti             (email: alberto.pulvirenti@ct.infn.it)
 //-------------------------------------------------------------------------
 ClassImp(AliRsnDaughterCut)
 
 //--------------------------------------------------------------------------------------------------------
-Bool_t AliRsnDaughterCut::Pass(AliRsnDaughter* /*track1*/, AliRsnDaughter* /*track2*/)
+Bool_t AliRsnDaughterCut::Pass(AliRsnDaughter* /*track1*/, AliRsnDaughter* /*track2*/) const
+{
 // 
 // Virtual method for cut passing.
 // This function must be overridden and return kTRUE when cut is passed.
-//
-{ 
+// 
        TObject::Error("Pass", "This method must be overridden!");
        return kFALSE;
 }
 //--------------------------------------------------------------------------------------------------------
-Bool_t AliRsnDaughterCutPtSingle::Pass(AliRsnDaughter *track1, AliRsnDaughter* /*track2*/)
+Bool_t AliRsnDaughterCutPtSingle::Pass(AliRsnDaughter *track1, AliRsnDaughter* /*track2*/) const
+{
 // 
 // Cut on single track momentum.
 //
-{ 
        if (!track1) return kFALSE;
        if (track1->GetPt() < fPtMin) return kFALSE;
        if (track1->GetPt() > fPtMax) return kFALSE;
@@ -51,14 +54,14 @@ Bool_t AliRsnDaughterCutPtSingle::Pass(AliRsnDaughter *track1, AliRsnDaughter* /
        return kTRUE;
 }
 //--------------------------------------------------------------------------------------------------------
-Bool_t AliRsnDaughterCutPtPair::Pass(AliRsnDaughter *track1, AliRsnDaughter *track2)
+Bool_t AliRsnDaughterCutPtPair::Pass(AliRsnDaughter *track1, AliRsnDaughter *track2) const
+{
 // 
 // Cut on single track momentum.
-//
-{ 
+// 
        if (!track1 || !track2) return kFALSE;
        
-       AliRsnDaughter sum = (*track1) + (*track2);
+       AliRsnDaughter sum = AliRsnDaughter::Sum(*track1, *track2);
        
        if (sum.GetPt() < fPtMin) return kFALSE;
        if (sum.GetPt() > fPtMax) return kFALSE;
index a72bf527a946db37b892cd9fa74a30a32d9d6656..8068b17941ae06887d060b857371c8f1713a0ee9 100644 (file)
@@ -24,12 +24,12 @@ public:
                               AliRsnDaughterCut() {  }
        virtual       ~AliRsnDaughterCut() {  }
        
-               Bool_t IsPairCut() {return fPairCut;}
-       virtual Bool_t Pass(AliRsnDaughter *track1, AliRsnDaughter *track2 = 0);
+               Bool_t IsPairCut() const {return fPairCut;}
+       virtual Bool_t Pass(AliRsnDaughter *track1, AliRsnDaughter *track2 = 0) const;
        
 protected:
 
-       Bool_t  fPairCut;
+       Bool_t  fPairCut;  // this flag is TRUE for all pair cuts
        
        ClassDef(AliRsnDaughterCut,1)
 };
@@ -42,7 +42,7 @@ public:
                               AliRsnDaughterCutPtSingle(Double_t min, Double_t max) {fPairCut=kFALSE;fPtMin=min;fPtMax=max;}
        virtual       ~AliRsnDaughterCutPtSingle()                           { }
        
-       virtual Bool_t Pass(AliRsnDaughter *track1, AliRsnDaughter *track2 = 0);
+       virtual Bool_t Pass(AliRsnDaughter *track1, AliRsnDaughter *track2 = 0) const;
 
 protected:
 
@@ -60,7 +60,7 @@ public:
                               AliRsnDaughterCutPtPair(Double_t min, Double_t max) {fPairCut=kTRUE;fPtMin=min;fPtMax=max;}
        virtual       ~AliRsnDaughterCutPtPair()                           { }
        
-       virtual Bool_t Pass(AliRsnDaughter *track1, AliRsnDaughter *track2);
+       virtual Bool_t Pass(AliRsnDaughter *track1, AliRsnDaughter *track2) const;
 
 protected:
 
index d8751fb54e8b193ebaae548ae2617d1a96bcadb0..9badd160675d0fa51ee89b040fd51ce9bf8e3064 100644 (file)
  
 //-------------------------------------------------------------------------
 //                      Class AliRsnEvent
-//  Simple collection of reconstructed tracks, selected from an ESD event
+//                     -------------------
+//           Simple collection of reconstructed tracks
+//           selected from an ESD event
+//           to be used for analysis.
+//           .........................................
 // 
 // author: A. Pulvirenti             (email: alberto.pulvirenti@ct.infn.it)
 //-------------------------------------------------------------------------
 
 #include <Riostream.h>
 
-#include <TTree.h>
 #include <TString.h>
-#include <TParticle.h>
 #include <TObjArray.h>
-#include <TRefArray.h>
 #include <TClonesArray.h>
 
-#include "AliESD.h"
-#include "AliStack.h"
-#include "AliESDtrack.h"
 #include "AliRsnDaughter.h"
 #include "AliRsnEvent.h"
 
@@ -45,10 +43,10 @@ AliRsnEvent::AliRsnEvent() :
  fPVy(0.0),
  fPVz(0.0),
  fMultiplicity(-1)
+{
 //
 // Default constructor
 //
-{
        Int_t i;
        for (i = 0; i < AliPID::kSPECIES; i++) {
                fPos[i] = NULL;
@@ -64,11 +62,33 @@ AliRsnEvent::AliRsnEvent(const AliRsnEvent &event) :
  fPVy(event.fPVy), 
  fPVz(event.fPVz),
  fMultiplicity(event.fMultiplicity)
+{
 //
 // Copy constructor.
 // Creates new instances of all collections to store a copy of all objects.
 //
+       // clone tracks collections
+       Int_t i;
+       for (i = 0; i < AliPID::kSPECIES; i++) {
+               fPos[i] = 0;
+               fNeg[i] = 0;
+               if (event.fPos[i]) fPos[i] = (TClonesArray*)event.fPos[i]->Clone();
+               if (event.fNeg[i]) fNeg[i] = (TClonesArray*)event.fNeg[i]->Clone();
+       }
+}
+AliRsnEvent& AliRsnEvent::operator=(const AliRsnEvent &event)
 {
+//
+// Assignment operator.
+// Creates new instances of all collections to store a copy of all objects.
+//
+       fIsESD = event.fIsESD;
+       fPath = event.fPath;
+       fPVx = event.fPVx; 
+       fPVy = event.fPVy; 
+       fPVz = event.fPVz;
+       fMultiplicity = event.fMultiplicity;
+
        // clone tracks collections
        Int_t i;
        for (i = 0; i < AliPID::kSPECIES; i++) {
@@ -77,13 +97,15 @@ AliRsnEvent::AliRsnEvent(const AliRsnEvent &event) :
                if (event.fPos[i]) fPos[i] = (TClonesArray*)event.fPos[i]->Clone();
                if (event.fNeg[i]) fNeg[i] = (TClonesArray*)event.fNeg[i]->Clone();
        }
+       
+       return (*this);
 }
-//--------------------------------------------------------------------------------------------------------
+//--------------------------------------------------------------------------------------------------------//--------------------------------------------------------------------------------------------------------
 void AliRsnEvent::AddTrack(AliRsnDaughter track)
+{
 //
 // Stores a track into the correct array
 //
-{
        Int_t pdg, sign, ifirst, ilast;
        
        // if sign is zero, track is not stored
@@ -120,12 +142,12 @@ void AliRsnEvent::AddTrack(AliRsnDaughter track)
 }
 //--------------------------------------------------------------------------------------------------------
 void AliRsnEvent::Clear(Option_t *option)
+{
 //
 // Clears list of tracks and references.
 // If the string "DELETE" is specified, the collection classes
 // are also cleared from heap.
 //
-{
        // evaluate option
        TString opt(option);
        Bool_t deleteCollections = opt.Contains("DELETE", TString::kIgnoreCase);
@@ -144,12 +166,12 @@ void AliRsnEvent::Clear(Option_t *option)
 }
 //--------------------------------------------------------------------------------------------------------
 Int_t AliRsnEvent::GetMultiplicity(Bool_t recalc)
+{
 //
 // Computes multiplicity.
 // If it is already computed (fMultiplicity > -1), it returns that value,
 // unless one sets the argument to kTRUE.
 //
-{
        if (fMultiplicity < 0) recalc = kTRUE;
        if (recalc) {
                fMultiplicity = 0;
@@ -163,11 +185,11 @@ Int_t AliRsnEvent::GetMultiplicity(Bool_t recalc)
        return fMultiplicity;
 }
 //--------------------------------------------------------------------------------------------------------
-const char * AliRsnEvent::GetOriginFileName()
+const char * AliRsnEvent::GetOriginFileName() const
+{
 //
 // Returns the path where input file was stored
 //
-{
        TString str(fPath);
        if (fIsESD) {
                str.Append("/AliESDs.root");
@@ -180,10 +202,10 @@ const char * AliRsnEvent::GetOriginFileName()
 }
 //--------------------------------------------------------------------------------------------------------
 TClonesArray* AliRsnEvent::GetTracks(Char_t sign, AliPID::EParticleType type)
+{
 //
 // Returns the particle collection specified in argument
 //
-{
        Int_t itype = (Int_t)type;
        if (itype >= 0 && itype < AliPID::kSPECIES) {
                if (sign == '+') return fPos[type]; else return fNeg[type];
@@ -194,11 +216,11 @@ TClonesArray* AliRsnEvent::GetTracks(Char_t sign, AliPID::EParticleType type)
 }
 //--------------------------------------------------------------------------------------------------------
 void AliRsnEvent::Init()
+{
 //
 // Action 1: define default values for some data members (including pointers).
 // Action 2: if 'ntracks' > 0 allocates memory to store tracks.
 //
-{
        Int_t i;
        for (i = 0; i < AliPID::kSPECIES; i++) {
                fPos[i] = new TClonesArray("AliRsnDaughter", 0);
@@ -209,10 +231,10 @@ void AliRsnEvent::Init()
 }
 //--------------------------------------------------------------------------------------------------------
 Int_t AliRsnEvent::PDG2Enum(Int_t pdgcode)
+{
 //
 // Converts a PDG code into the correct slot in the EParticleType enumeration in AliPID
 //
-{
        Int_t i;
        for (i = 0; i < AliPID::kSPECIES; i++) {
                if (AliPID::ParticleCode((AliPID::EParticleType)i) == TMath::Abs(pdgcode)) {
@@ -224,10 +246,10 @@ Int_t AliRsnEvent::PDG2Enum(Int_t pdgcode)
 }
 //--------------------------------------------------------------------------------------------------------
 void AliRsnEvent::PrintTracks()
+{
 //
 // Print data for particles stored in this event
 //
-{
        cout << endl;
        
        AliRsnDaughter *track = 0;
index 11390ffa4cab72bab1f4a560b0853466f1745e20..1495a51c0ddffdcd5d7af669da93826acd4686d1 100644 (file)
@@ -13,7 +13,6 @@
 #ifndef ALIRSNEVENT_H
 #define ALIRSNEVENT_H
 
-#include <TMath.h>
 #include "AliPID.h"
 
 class AliRsnDaughter;
@@ -23,33 +22,34 @@ class AliRsnEvent : public TObject
 public:
                       AliRsnEvent();
                       AliRsnEvent(const AliRsnEvent& copy);
+                                  AliRsnEvent& operator=(const AliRsnEvent& copy);
                         
        virtual       ~AliRsnEvent() {Clear("DELETE");}
        
        void           AddTrack(AliRsnDaughter track);
        void           Clear(Option_t *option = "");
        Int_t          GetMultiplicity(Bool_t recalc = kFALSE);
-       const char*    GetOriginFileName();
-       Double_t       GetPrimaryVertexX()                                     {return fPVx;}
-       Double_t       GetPrimaryVertexY()                                     {return fPVy;}
-       Double_t       GetPrimaryVertexZ()                                     {return fPVz;}
-       void           GetPrimaryVertex(Double_t &x, Double_t &y, Double_t &z) {x=fPVx;y=fPVy;z=fPVz;}
+       const char*    GetOriginFileName() const;
+       Double_t       GetPrimaryVertexX() const {return fPVx;}
+       Double_t       GetPrimaryVertexY() const {return fPVy;}
+       Double_t       GetPrimaryVertexZ() const {return fPVz;}
+       void           GetPrimaryVertex(Double_t &x, Double_t &y, Double_t &z) const {x=fPVx;y=fPVy;z=fPVz;}
        TClonesArray*  GetTracks(Char_t sign, AliPID::EParticleType type);
        void           Init();
        Int_t          PDG2Enum(Int_t pdgcode);
        void           PrintTracks();
-       void           SetESD(Bool_t yesno = kTRUE)                            {fIsESD=yesno;}
-       void           SetPath(TString path)                                   {fPath=path;}
-       void           SetPrimaryVertex(Double_t x, Double_t y, Double_t z)    {fPVx=x;fPVy=y;fPVz=z;}
+       void           SetESD(Bool_t yesno = kTRUE) {fIsESD=yesno;}
+       void           SetPath(TString path) {fPath=path;}
+       void           SetPrimaryVertex(Double_t x, Double_t y, Double_t z) {fPVx=x;fPVy=y;fPVz=z;}
 
 private:
 
        Bool_t         fIsESD;                    // if true, it is ESD event, otherwise it comes from Kine
        TString        fPath;                     // complete path where input event file is stored
        
-       Double_t       fPVx;                              //
-       Double_t       fPVy;                              // primary vertex
-       Double_t       fPVz;                              //
+       Double_t       fPVx;                              // position of
+       Double_t       fPVy;                              // primary
+       Double_t       fPVz;                              // vertex
        
        Int_t          fMultiplicity;             // global event multiplicity
 
index 5453951afc51d4a34089d0ba8ccb80ca2dcf5e56..34d95a5d768235ecf1165cd23dc661b619cf7cb6 100644 (file)
 //                     Class AliRsnReader
 //
 //   Reader for conversion of ESD or Kinematics output into AliRsnEvent
+//   .....
+//   .....
+//   .....
+//   .....
+//   .....
+//   .....
+//   .....
 // 
 // author: A. Pulvirenti             (email: alberto.pulvirenti@ct.infn.it)
 //-------------------------------------------------------------------------
 #include <TH1.h>
 #include <TH3.h>
 #include <TFile.h>
-#include <TChain.h>
+#include <TTree.h>
 #include <TArrayF.h>
 #include <TParticle.h>
 #include <TRandom.h>
-#include <TObjString.h>
-#include <TObjectTable.h>
-#include <TOrdCollection.h>
 
 #include "AliRun.h"
 #include "AliESD.h"
@@ -40,7 +44,6 @@
 #include "AliHeader.h"
 #include "AliESDtrack.h"
 #include "AliRunLoader.h"
-#include "AliGenEventHeader.h"
 #include "AliGenPythiaEventHeader.h"
 
 #include "AliRsnDaughter.h"
@@ -51,6 +54,7 @@ ClassImp(AliRsnReader)
 
 //--------------------------------------------------------------------------------------------------------
 AliRsnReader::AliRsnReader()
+{
 //
 // Constructor.
 // Initializes all working parameters to default values:
@@ -58,7 +62,6 @@ AliRsnReader::AliRsnReader()
 // - rejection of non-ITS-refitted tracks
 // - maximum distance allowed from primary vertex = 3.0 cm (beam pipe)
 //
-{
        fPIDMethod = kESDPID;
        Int_t i;
        for (i = 0; i < AliPID::kSPECIES; i++) fPrior[i] = 1.0;
@@ -77,12 +80,37 @@ AliRsnReader::AliRsnReader()
 }
 //--------------------------------------------------------------------------------------------------------
 AliRsnReader::AliRsnReader(const AliRsnReader &copy) : TObject(copy)
+{
 //
 // Copy constructor.
 // Initializes all working parameters to same values of another simlar object.
 // TTree data member is not created.
 //
+       fPIDMethod = copy.fPIDMethod;
+       Int_t i;
+       for (i = 0; i < AliPID::kSPECIES; i++) fPrior[i] = copy.fPrior[i];
+       fPtLimit4PID = copy.fPtLimit4PID;
+       fProbThreshold = copy.fProbThreshold;
+       fMaxRadius = copy.fMaxRadius;
+
+       fEvents = 0;
+       for (i = AliPID::kElectron; i <= AliPID::kProton; i++) {
+               fEffPos[i] = copy.fEffPos[i];
+               fEffNeg[i] = copy.fEffNeg[i];
+       }
+       
+       fResPt = copy.fResPt;
+       fResLambda = copy.fResLambda;
+       fResPhi = copy.fResPhi;
+}
+//--------------------------------------------------------------------------------------------------------
+AliRsnReader& AliRsnReader::operator=(const AliRsnReader &copy)
 {
+//
+// Assignment operator.
+// Initializes all working parameters to same values of another simlar object.
+// TTree data member is not created.
+//
        fPIDMethod = copy.fPIDMethod;
        Int_t i;
        for (i = 0; i < AliPID::kSPECIES; i++) fPrior[i] = copy.fPrior[i];
@@ -99,15 +127,17 @@ AliRsnReader::AliRsnReader(const AliRsnReader &copy) : TObject(copy)
        fResPt = copy.fResPt;
        fResLambda = copy.fResLambda;
        fResPhi = copy.fResPhi;
+       
+       return (*this);
 }
 //--------------------------------------------------------------------------------------------------------
 void AliRsnReader::Clear(Option_t *option)
+{
 //
 // Clear collection of filenames.
 // If requested with the option "DELETELIST", 
 // the collection object is also deleted.
 //
-{
        TString opt(option);
        
        if (!opt.CompareTo("TREE", TString::kIgnoreCase)) {
@@ -129,6 +159,7 @@ void AliRsnReader::Clear(Option_t *option)
 }
 //--------------------------------------------------------------------------------------------------------
 Bool_t AliRsnReader::EffSim(Int_t pdg, Double_t pt, Double_t eta, Double_t z)
+{
 //
 // If efficiency histogram are present, they are used to simulate efficiency.
 // Pt, Eta and Z are used to find reconstruction efficiency value to be used
@@ -136,7 +167,6 @@ Bool_t AliRsnReader::EffSim(Int_t pdg, Double_t pt, Double_t eta, Double_t z)
 // An extraction is done, and it is supposed that particle must be accepted
 // only when this function retunrs kTRUE (= successful extraction).
 //
-{
        // find particle sign from PDG code
        Int_t sign;
        if (TMath::Abs(pdg) >= 211) {
@@ -164,11 +194,11 @@ Bool_t AliRsnReader::EffSim(Int_t pdg, Double_t pt, Double_t eta, Double_t z)
        return (ran <= ref);
 }
 //--------------------------------------------------------------------------------------------------------
-Double_t* AliRsnReader::GetPIDprobabilities(AliRsnDaughter track)
+Double_t* AliRsnReader::GetPIDprobabilities(AliRsnDaughter track) const
+{
 //
 // Computes PID probabilites starting from priors and weights
 //
-{
        Double_t *prob = new Double_t[AliPID::kSPECIES];
        
        Int_t i;
@@ -190,10 +220,10 @@ Double_t* AliRsnReader::GetPIDprobabilities(AliRsnDaughter track)
 }
 //--------------------------------------------------------------------------------------------------------
 void AliRsnReader::Identify(AliRsnDaughter &track)
+{
 //
 // Identifies a track according to method selected
 //
-{
        Bool_t doESDPID = (fPIDMethod == kESDPID);
        Bool_t keepRecSign = (fPIDMethod == kPerfectPIDwithRecSign);
        
@@ -232,6 +262,7 @@ void AliRsnReader::Identify(AliRsnDaughter &track)
 }
 //--------------------------------------------------------------------------------------------------------
 TTree* AliRsnReader::ReadParticles(const char *path, Option_t *option)
+{
 //
 // Opens the file "galice.root" and kinematics in the path specified,
 // loads Kinematics informations and fills and AliRsnEvent object
@@ -245,7 +276,6 @@ TTree* AliRsnReader::ReadParticles(const char *path, Option_t *option)
 // - "E" --> do efficiency simulation
 // - "P" --> do momentum smearing
 //
-{
        fPIDMethod = kPerfectPID;
 
        TTree *events = new TTree("selection", "AliRsnEvents");
@@ -364,6 +394,7 @@ TTree* AliRsnReader::ReadParticles(const char *path, Option_t *option)
 }
 //--------------------------------------------------------------------------------------------------------
 TTree* AliRsnReader::ReadTracks(const char *path, Option_t *option)
+{
 //
 // Reads AliESD in a given path, with and "experimental" method.
 // When using this method, no Kinematics information is assumed
@@ -373,7 +404,6 @@ TTree* AliRsnReader::ReadTracks(const char *path, Option_t *option)
 // - "R" : reject tracks which do not have the flag "kITSRefit" set to TRUE
 // - "F" : reject 'fake' tracks (negative label)
 //
-{
        fPIDMethod = kESDPID;
 
        TTree *events = new TTree("selection", "AliRsnEvents");
@@ -475,6 +505,7 @@ TTree* AliRsnReader::ReadTracks(const char *path, Option_t *option)
 }
 //--------------------------------------------------------------------------------------------------------
 TTree* AliRsnReader::ReadTracksAndParticles(const char *path, Option_t *option)
+{
 //
 // Reads AliESD in a given path, getting also informations from Kinematics.
 // In this case, the PID method used is the one selected with apposite setter.
@@ -483,7 +514,6 @@ TTree* AliRsnReader::ReadTracksAndParticles(const char *path, Option_t *option)
 // - "F" : reject 'fake' tracks (negative label)
 // - "M" : use 'true' momentum instead of reconstructed one
 //
-{
        TTree *events = new TTree("selection", "AliRsnEvents");
        TTree::SetBranchStyle(1);
        AliRsnEvent *event = new AliRsnEvent;
@@ -624,22 +654,22 @@ TTree* AliRsnReader::ReadTracksAndParticles(const char *path, Option_t *option)
 }
 //--------------------------------------------------------------------------------------------------------
 void AliRsnReader::SetEfficiencyHistogram(AliPID::EParticleType type, TH3D *h, Bool_t pos)
+{
 //
 // Sets efficiency histogram for a given particle species.
 // If third argument is "true", histo is assigned to positive particles,
 // otherwise it is assigned to negative particles.
 //
-{
        if (type >= AliPID::kElectron && type < AliPID::kPhoton) {
                if (pos) fEffPos[type] = h; else fEffNeg[type] = h;
        }
 }
 //--------------------------------------------------------------------------------------------------------
 void AliRsnReader::SetPriorProbabilities(Double_t *prior)
+{
 //
 // Set prior probabilities to be used in case of ESD PID.
 //
-{
        if (!prior) return;
        
        Int_t i = 0;
@@ -647,19 +677,19 @@ void AliRsnReader::SetPriorProbabilities(Double_t *prior)
 }
 //--------------------------------------------------------------------------------------------------------
 void AliRsnReader::SetPriorProbability(AliPID::EParticleType type, Double_t value)
+{
 //
 // Sets prior probability referred to a single particle species.
 //
-{
        if (type >= AliPID::kElectron && type < AliPID::kPhoton) fPrior[type] = value;
 }
 //--------------------------------------------------------------------------------------------------------
 void AliRsnReader::SmearMomentum(Double_t &px, Double_t &py, Double_t &pz) 
+{
 //
 // Use resolution histograms to do smearing of momentum
 // (to introduce reconstruction effects)
 //
-{
        Double_t pt = TMath::Sqrt(px*px + py*py);
        Double_t lambda = TMath::ATan2(pz, pt);
        Double_t phi = TMath::ATan2(py, px);
@@ -688,10 +718,10 @@ void AliRsnReader::SmearMomentum(Double_t &px, Double_t &py, Double_t &pz)
 }
 //--------------------------------------------------------------------------------------------------------
 AliPID::EParticleType AliRsnReader::FindType(Int_t pdg)
+{
 //
 // Finds the enum value corresponding to a PDG code
 //
-{
        pdg = TMath::Abs(pdg);
        switch (pdg) {
                case   11: return AliPID::kElectron; break;
@@ -704,10 +734,10 @@ AliPID::EParticleType AliRsnReader::FindType(Int_t pdg)
 }
 //--------------------------------------------------------------------------------------------------------
 AliRunLoader* AliRsnReader::OpenRunLoader(const char *path)
+{
 //
 // Open the Run loader with events in a given path
 //
-{
        // clear gALICE
        if (gAlice) {
                delete gAlice;
index c70b91f41250dd714b3806d5058d2e70c75756cf..33a863719f4fcb141ceda1f54db9b9852aa8c256 100644 (file)
@@ -7,6 +7,10 @@
 //                      Class AliRsnEventReader
 //             
 //   Reader for conversion of ESD or Kinematics output into AliRsnEvent
+//   .....
+//   .....
+//   .....
+//   .....
 // 
 // author: A. Pulvirenti             (email: alberto.pulvirenti@ct.infn.it)
 //-------------------------------------------------------------------------
@@ -35,12 +39,13 @@ public:
 
                   AliRsnReader();
                           AliRsnReader(const AliRsnReader& copy);
+                          AliRsnReader& operator=(const AliRsnReader& copy);
        virtual   ~AliRsnReader() {Clear("DELTREE");}
        
        void       Clear(Option_t *option = "");
        Bool_t     EffSim(Int_t pdg, Double_t pt, Double_t eta, Double_t z);
        TTree*     GetEvents() const                                                              {return fEvents;}
-       Double_t*  GetPIDprobabilities(AliRsnDaughter track);
+       Double_t*  GetPIDprobabilities(AliRsnDaughter track) const;
        void       Identify(AliRsnDaughter &track);
        TTree*     ReadParticles(const char *path, Option_t *option="");
        TTree*     ReadTracks(const char *path, Option_t *option="R");