]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/RESONANCES/AliRsnEvent.h
AliRsnCut:
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / AliRsnEvent.h
1 //
2 // *** Class AliRsnEvent ***
3 //
4 // A container for a collection of AliRsnDaughter objects from an event.
5 // Contains also the primary vertex, useful for some cuts.
6 // In order to retrieve easily the tracks which have been identified
7 // as a specific type and charge, there is an array of indexes which
8 // allows to avoid to loop on all tracks and have only the neede ones.
9 //
10 // authors: A. Pulvirenti (email: alberto.pulvirenti@ct.infn.it)
11 //          M. Vala (email: martin.vala@cern.ch)
12 //
13
14 #ifndef ALIRSNEVENT_H
15 #define ALIRSNEVENT_H
16
17 #include "AliVEvent.h"
18 #include "AliMCEvent.h"
19 #include "AliESDEvent.h"
20 #include "AliAODEvent.h"
21 #include "AliRsnDaughter.h"
22
23 class AliRsnCutPID;
24 class AliESDtrackCuts;
25
26 class AliRsnEvent : public TObject {
27 public:
28
29    AliRsnEvent(AliVEvent *ref = 0, AliVEvent *refMC = 0);
30    AliRsnEvent(const AliRsnEvent& copy);
31    AliRsnEvent& operator= (const AliRsnEvent& copy);
32    virtual ~AliRsnEvent();
33
34    // basic setters/getters
35    void       SetRef(AliVEvent *ref)       {fRef = ref;}
36    void       SetRefMC(AliVEvent *refmc)   {fRefMC = refmc;}
37    void       SetLeadingIndex(Int_t i)     {fLeading = i;}
38    void       SetLocalID(Int_t i)          {fLocalID = i;}
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
45    // getters which convert into allowed input types
46    AliESDEvent* GetRefESD()   {if (fRef  ->IsA() == AliESDEvent::Class()) return static_cast<AliESDEvent*>(fRef)  ; else return 0x0;}
47    AliAODEvent* GetRefAOD()   {if (fRef  ->IsA() == AliAODEvent::Class()) return static_cast<AliAODEvent*>(fRef)  ; else return 0x0;}
48    AliMCEvent*  GetRefMCESD() {if (fRefMC->IsA() == AliMCEvent ::Class()) return static_cast<AliMCEvent*> (fRefMC); else return 0x0;}
49    AliAODEvent* GetRefMCAOD() {if (fRefMC->IsA() == AliAODEvent::Class()) return static_cast<AliAODEvent*>(fRefMC); else return 0x0;}
50    Bool_t       IsESD()       {return (GetRefESD() != 0x0);}
51    Bool_t       IsAOD()       {return (GetRefAOD() != 0x0);}
52
53    // advanced getters
54    Double_t         GetVz();
55    Int_t            GetMultiplicity(AliESDtrackCuts *cuts = 0x0);
56
57    // setters for a daughter
58    Bool_t           SetDaughter(AliRsnDaughter &daughter, Int_t index, AliRsnDaughter::ERefType type = AliRsnDaughter::kTrack);
59    Bool_t           SetDaughterMC(AliRsnDaughter &daughter, Int_t index);
60    AliRsnDaughter   GetDaughter(Int_t i, AliRsnDaughter::ERefType type = AliRsnDaughter::kTrack);
61    AliRsnDaughter   GetDaughterMC(Int_t i);
62    Int_t            GetAbsoluteSum();
63    Bool_t           ConvertAbsoluteIndex(Int_t index, Int_t &realIndex, AliRsnDaughter::ERefType &type);
64
65    // leading particle stuff
66    void             SetLeadingParticle(AliRsnDaughter &leading) {if (fLeading >= 0) SetDaughter(leading, fLeading);}
67    Int_t            SelectLeadingParticle(Double_t ptMin = 0.0, AliRsnCutPID *cutPID = 0x0);
68    Double_t         GetAverageMomentum(Int_t &count, AliRsnCutPID *cutPID = 0x0);
69    Bool_t           GetAngleDistr(Double_t &angleMean, Double_t &angleRMS, AliRsnDaughter reference);
70
71    // statig getters
72    static AliRsnEvent    *GetCurrentEvent1()                                 {return fgRsnEvent1;}
73    static AliRsnEvent    *GetCurrentEvent2()                                 {return fgRsnEvent2;}
74    static void            SetCurrentEvent1(AliRsnEvent *event, Int_t id = 0) {fgRsnEvent1 = event; fgRsnEvent1->SetLocalID(id);}
75    static void            SetCurrentEvent2(AliRsnEvent *event, Int_t id = 0) {fgRsnEvent2 = event; fgRsnEvent2->SetLocalID(id);}
76    static Bool_t          IsCurrentEvent1()                                  {if (fgRsnEvent1 != 0x0) return kTRUE; return kFALSE;}
77    static Bool_t          IsCurrentEvent2()                                  {if (fgRsnEvent2 != 0x0) return kTRUE; return kFALSE;}
78    static Bool_t          SameEvent()                                        {if (fgRsnEvent1 == fgRsnEvent2) return kTRUE; return kFALSE;}
79    
80 private:
81
82    Bool_t SetDaughterESDtrack(AliRsnDaughter &target, Int_t index);
83    Bool_t SetDaughterAODtrack(AliRsnDaughter &target, Int_t index);
84    Bool_t SetDaughterESDv0(AliRsnDaughter &target, Int_t index);
85    Bool_t SetDaughterAODv0(AliRsnDaughter &target, Int_t index);
86    Bool_t SetDaughterESDcascade(AliRsnDaughter &target, Int_t index);
87    Bool_t SetDaughterAODcascade(AliRsnDaughter &target, Int_t index);
88    Bool_t SetMCInfoESD(AliRsnDaughter &target);
89    Bool_t SetMCInfoAOD(AliRsnDaughter &target);
90
91    AliVEvent   *fRef;         //  pointer to input event
92    AliVEvent   *fRefMC;       //  pointer to reference MC event (if any)
93    Int_t        fLeading;     //  index of leading track
94    Int_t        fLocalID;     //  identification number used locally
95
96    static AliRsnEvent    *fgRsnEvent1;     //! pointer to current event #1 (default current event)
97    static AliRsnEvent    *fgRsnEvent2;     //! pointer to current event #2 (different from the other when doing mixing)
98
99    ClassDef(AliRsnEvent, 4);
100 };
101
102 #endif