]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/RESONANCES/AliRsnEvent.h
Implementation of all needed changes in the package in order to speed-up the executio...
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / AliRsnEvent.h
1 #ifndef ALIRSNEVENT_H
2 #define ALIRSNEVENT_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 //  Interface to full event.
10 //
11 ////////////////////////////////////////////////////////////////////////////////
12
13 #include "AliStack.h"
14 #include "AliVEvent.h"
15 #include "AliMCEvent.h"
16 #include "AliESDEvent.h"
17 #include "AliAODEvent.h"
18 #include "AliVVertex.h"
19 #include "AliRsnDaughter.h"
20
21 class AliRsnCutPID;
22 class AliESDtrackCuts;
23 class AliPIDResponse;
24
25 class AliRsnEvent : public TObject {
26 public:
27
28    AliRsnEvent(AliVEvent *ref = 0, AliVEvent *refMC = 0);
29    AliRsnEvent(const AliRsnEvent& copy);
30    AliRsnEvent& operator= (const AliRsnEvent& copy);
31    virtual ~AliRsnEvent();
32
33    // basic setters/getters
34    void            SetRef(AliVEvent *ref)              {fRef = ref;}
35    void            SetRefMC(AliVEvent *refmc)          {fRefMC = refmc;}
36    void            SetLeadingIndex(Int_t i)            {fLeading = i;}
37    void            SetLocalID(Int_t i)                 {fLocalID = i;}
38    void            SetPIDResponse(AliPIDResponse *pid) {fPID = pid;}
39    AliVEvent*      GetRef()                            {return fRef;}
40    AliVEvent*      GetRefMC()                          {return fRefMC;}
41    Int_t           GetLeadingIndex() const             {return fLeading;}
42    Int_t           GetLeadingParticleID() const        {return fLeading;}
43    Int_t           GetLocalID() const                  {return fLocalID;}
44    AliPIDResponse* GetPIDResponse()                    {return fPID;}
45
46    // getters which convert into allowed input types
47    AliESDEvent* GetRefESD()   {if (classMatchRef  (AliESDEvent::Class())) return static_cast<AliESDEvent*>(fRef)  ; return 0x0;}
48    AliAODEvent* GetRefAOD()   {if (classMatchRef  (AliAODEvent::Class())) return static_cast<AliAODEvent*>(fRef)  ; return 0x0;}
49    AliMCEvent*  GetRefMCESD() {if (classMatchRefMC(AliMCEvent ::Class())) return static_cast<AliMCEvent *>(fRefMC); return 0x0;}
50    AliAODEvent* GetRefMCAOD() {if (classMatchRefMC(AliAODEvent::Class())) return static_cast<AliAODEvent*>(fRefMC); return 0x0;}
51    Bool_t       IsESD()       {return (GetRefESD() != 0x0);}
52    Bool_t       IsAOD()       {return (GetRefAOD() != 0x0);}
53
54    // advanced getters
55    Double_t         GetVz()                       {if (fRef) return fRef->GetPrimaryVertex()->GetZ(); return 1E+10;}
56    Int_t            GetMultiplicityFromTracks()   {if (fRef) return fRef->GetNumberOfTracks(); return -1;}
57    Int_t            GetMultiplicityFromMC()       {if (fRefMC) return fRefMC->GetNumberOfTracks(); return -1;}
58    Int_t            GetMultiplicityFromESDCuts();
59    Float_t          GetMultiplicityFromSPD();
60
61    // setters for a daughter
62    Bool_t           SetDaughterAbs(AliRsnDaughter &daughter, Int_t absoluteIndex);
63    Bool_t           SetDaughter(AliRsnDaughter &daughter, Int_t index, AliRsnDaughter::ERefType type = AliRsnDaughter::kTrack);
64    Bool_t           SetDaughterMC(AliRsnDaughter &daughter, Int_t index);
65    AliRsnDaughter   GetDaughterAbs(Int_t absoluteIndex);
66    AliRsnDaughter   GetDaughter(Int_t i, AliRsnDaughter::ERefType type = AliRsnDaughter::kTrack);
67    AliRsnDaughter   GetDaughterMC(Int_t i);
68    Int_t            GetAbsoluteSum() {if (fRef) return (fRef->GetNumberOfTracks() + fRef->GetNumberOfV0s() + fRef->GetNumberOfCascades()); return 0;}
69    Bool_t           ConvertAbsoluteIndex(Int_t index, Int_t &realIndex, AliRsnDaughter::ERefType &type);
70    Int_t            ConvertRealIndex(Int_t index, AliRsnDaughter::ERefType type);
71
72    // leading particle stuff
73    void             SetLeadingParticle(AliRsnDaughter &leading) {if (fLeading >= 0) SetDaughter(leading, fLeading);}
74    Int_t            SelectLeadingParticle(Double_t ptMin = 0.0, AliRsnCutPID *cutPID = 0x0);
75    Double_t         GetAverageMomentum(Int_t &count, AliRsnCutPID *cutPID = 0x0);
76    Bool_t           GetAngleDistr(Double_t &angleMean, Double_t &angleRMS, AliRsnDaughter *reference);
77    
78 private:
79
80    Bool_t classMatchRef  (TClass *ref) {if (fRef  ) return (fRef  ->InheritsFrom(ref)); return kFALSE;}
81    Bool_t classMatchRefMC(TClass *ref) {if (fRefMC) return (fRefMC->InheritsFrom(ref)); return kFALSE;}
82
83    Bool_t SetDaughterESDtrack(AliRsnDaughter &target, Int_t index);
84    Bool_t SetDaughterAODtrack(AliRsnDaughter &target, Int_t index);
85    Bool_t SetDaughterESDv0(AliRsnDaughter &target, Int_t index);
86    Bool_t SetDaughterAODv0(AliRsnDaughter &target, Int_t index);
87    Bool_t SetDaughterESDcascade(AliRsnDaughter &target, Int_t index);
88    Bool_t SetDaughterAODcascade(AliRsnDaughter &target, Int_t index);
89    Bool_t SetMCInfoESD(AliRsnDaughter &target);
90    Bool_t SetMCInfoAOD(AliRsnDaughter &target);
91
92    AliVEvent   *fRef;               //  pointer to input event
93    AliVEvent   *fRefMC;             //  pointer to reference MC event (if any)
94    Int_t        fLeading;           //  index of leading track
95    Int_t        fLocalID;           //  identification number used locally
96    
97    AliPIDResponse *fPID;            //! pointer to PID response
98
99    ClassDef(AliRsnEvent, 5);
100 };
101
102 #endif