]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/RESONANCES/AliRsnDaughterDef.h
Implementation of all needed changes in the package in order to speed-up the executio...
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / AliRsnDaughterDef.h
1 #ifndef ALIRSNDAUGHTERDEF_H
2 #define ALIRSNDAUGHTERDEF_H
3
4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5  * See cxx source for full Copyright notice                               */
6  
7 ////////////////////////////////////////////////////////////////////////////////
8 //
9 //  Single daughter definitions.
10 //
11 ////////////////////////////////////////////////////////////////////////////////
12
13 #include "AliRsnDaughter.h"
14
15 class AliRsnDaughterDef : public TObject {
16 public:
17
18    AliRsnDaughterDef();
19    AliRsnDaughterDef(EPARTYPE type, Char_t charge = 0);
20    AliRsnDaughterDef(AliRsnDaughter::ESpecies type, Char_t charge = 0);
21    AliRsnDaughterDef(AliRsnDaughter::ERefType refType, Char_t charge = 0);
22    AliRsnDaughterDef(const AliRsnDaughterDef &copy);
23    const AliRsnDaughterDef& operator= (const AliRsnDaughterDef &copy);
24    virtual ~AliRsnDaughterDef() { }
25
26    Bool_t                   IsOnlyTrue()      const {return fOnlyTrue;}
27    AliRsnDaughter::ESpecies GetPID()          const {return fPID;}
28    Double_t                 GetMass()         const {return fMass;}
29    Char_t                   GetChargeC()      const {return fCharge;}
30    Short_t                  GetChargeS()      const {if (fCharge == '+') return 1; else if (fCharge == '-') return -1; else return 0;}
31    AliRsnDaughter::ERefType GetRefType()      const {return fRefType;}
32    virtual const char*      GetName()         const {return Form("%s%c", AliRsnDaughter::SpeciesName(fPID), fCharge);}
33    Bool_t                   IsChargeDefined() const {return (fCharge == '+' || fCharge == '-' || fCharge == '0');}
34    
35    void SetOnlyTrue(Bool_t yn = kTRUE)            {fOnlyTrue = yn;}
36    void SetPID(AliRsnDaughter::ESpecies pid)      {fPID = pid; fRefType = AliRsnDaughter::RefType(pid); fMass = AliRsnDaughter::SpeciesMass(pid);}
37    void SetCharge(Char_t charge)                  {fCharge = charge;}
38    void SetRefType(AliRsnDaughter::ERefType type) {fRefType = type;}
39    
40    Bool_t MatchesPID(AliRsnDaughter *daughter);
41    Bool_t MatchesCharge(AliRsnDaughter *daughter);
42    Bool_t MatchesRefType(AliRsnDaughter *daughter);
43    Bool_t MatchesDaughter(AliRsnDaughter *daughter);
44    Bool_t MatchesPDG(Int_t pdgCode)       {return (AliRsnDaughter::SpeciesPDG(fPID) == pdgCode);}
45    Bool_t MatchesChargeS(Short_t charge)  {return (GetChargeS() == charge);}
46    Bool_t MatchesChargeC(Char_t charge)   {return (GetChargeC() == charge);}
47
48 private:
49
50    Bool_t                    fOnlyTrue; // fag to activate comparison of PID species
51    AliRsnDaughter::ESpecies  fPID;      // PID of particles
52    Double_t                  fMass;     // mass of particles (subordinate to fPID)
53    Char_t                    fCharge;   // charge of particles
54    AliRsnDaughter::ERefType  fRefType;  // object reference type (track/V0/cascade)
55
56    // ROOT dictionary
57    ClassDef(AliRsnDaughterDef, 1)
58 };
59
60 //__________________________________________________________________________________________________
61 inline Bool_t AliRsnDaughterDef::MatchesPID(AliRsnDaughter *daughter)
62 {
63 //
64 // Checks if the daughter true PID (taken from MC) matches
65 // that expected by this object.
66 // Works only if an MC is present and the fPID data member
67 // is set to something different from 'kUnknown'.
68 // If above conditions are not satisfied, it returns always kTRUE.
69 //
70
71    if (fPID == AliRsnDaughter::kUnknown || daughter->GetRefMC() == 0x0) 
72       return kTRUE;
73    else
74       return (AliRsnDaughter::SpeciesPDG(fPID) == daughter->GetPDG());
75 }
76  
77 //__________________________________________________________________________________________________
78 inline Bool_t AliRsnDaughterDef::MatchesCharge(AliRsnDaughter *daughter)
79 {
80 //
81 // Checks that the daughter charge matches that expected by this object.
82 // Works only if the fCharge data member is set to '+', '-' or '0', 
83 // otherwise it accepts everything.
84 //
85
86    switch (fCharge) {
87       case '+': return daughter->IsPos();
88       case '-': return daughter->IsNeg();
89       case '0': return daughter->IsNeutral();
90       default : return kTRUE;
91    }
92 }
93    
94 //__________________________________________________________________________________________________
95 inline Bool_t AliRsnDaughterDef::MatchesRefType(AliRsnDaughter *daughter)
96 {
97 //
98 // Checks that the daughter object type matches that expected by this object.
99 // Works only if the fRefType data member is different from AliRsnDaughter::kNoType,
100 // otherwise it accepts everything.
101 //
102
103    AliRsnDaughter::ERefType type = daughter->RefType();
104    
105    if (fRefType != AliRsnDaughter::kNoType) 
106       return (type == fRefType);
107    else
108       return kTRUE;
109 }
110
111 #endif