]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/RESONANCES/AliRsnEvent.h
Macro to add the energy distribution task to the train
[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 "AliMCEvent.h"
18 #include "AliESDEvent.h"
19 #include "AliAODEvent.h"
20 #include "AliRsnDaughter.h"
21
22 class AliVEvent;
23 class AliRsnCutPID;
24 class AliESDtrackCuts;
25
26 class AliRsnEvent : public TObject
27 {
28   public:
29
30     AliRsnEvent(AliVEvent *ref = 0, AliVEvent *refMC = 0);
31     AliRsnEvent(const AliRsnEvent& copy);
32     AliRsnEvent& operator= (const AliRsnEvent& copy);
33     virtual ~AliRsnEvent();
34     
35     // basic setters/getters
36     void       SetRef  (AliVEvent *ref)     {fRef = ref;}
37     void       SetRefMC(AliVEvent *refmc)   {fRefMC = refmc;}
38     void       SetLeadingIndex(Int_t i)     {fLeading = i;}
39     void       SetLocalID(Int_t i)          {fLocalID = i;}
40     AliVEvent* GetRef()                     {return fRef;}
41     AliVEvent* GetRefMC()                   {return fRefMC;}
42     Int_t      GetLeadingIndex() const      {return fLeading;}
43     Int_t      GetLeadingParticleID() const {return fLeading;}
44     Int_t      GetLocalID() const           {return fLocalID;}
45     
46     // getters which convert into allowed input types
47     AliESDEvent* GetRefESD()   {return dynamic_cast<AliESDEvent*>(fRef);}
48     AliAODEvent* GetRefAOD()   {return dynamic_cast<AliAODEvent*>(fRef);}
49     AliMCEvent*  GetRefMCESD() {return dynamic_cast<AliMCEvent*> (fRefMC);}
50     AliAODEvent* GetRefMCAOD() {return dynamic_cast<AliAODEvent*>(fRefMC);}
51     Bool_t       IsESD()       {return (GetRefESD() != 0x0);}
52     Bool_t       IsAOD()       {return (GetRefAOD() != 0x0);}
53     
54     // advanced getters
55     Double_t         GetVz();
56     Int_t            GetMultiplicity(AliESDtrackCuts *cuts = 0x0);
57     
58     // setters for a daughter
59     Bool_t           SetDaughter  (AliRsnDaughter &daughter, Int_t index, AliRsnDaughter::ERefType type = AliRsnDaughter::kTrack);
60     Bool_t           SetDaughterMC(AliRsnDaughter &daughter, Int_t index);
61     AliRsnDaughter   GetDaughter  (Int_t i, AliRsnDaughter::ERefType type = AliRsnDaughter::kTrack);
62     AliRsnDaughter   GetDaughterMC(Int_t i);
63     Int_t            GetAbsoluteSum();
64     Bool_t           ConvertAbsoluteIndex(Int_t index, Int_t &realIndex, AliRsnDaughter::ERefType &type);
65     
66     // leading particle stuff
67     void             SetLeadingParticle(AliRsnDaughter &leading) {if (fLeading >= 0) SetDaughter(leading, fLeading);}
68     Int_t            SelectLeadingParticle(Double_t ptMin = 0.0, AliRsnCutPID *cutPID = 0x0);
69     Double_t         GetAverageMomentum(Int_t &count, AliRsnCutPID *cutPID = 0x0);
70     Bool_t           GetAngleDistr(Double_t &angleMean, Double_t &angleRMS, AliRsnDaughter reference);
71     
72     // statig getters
73     static AliRsnEvent *GetCurrentEvent1()                                 {return fgRsnEvent1;}
74     static AliRsnEvent *GetCurrentEvent2()                                 {return fgRsnEvent2;}
75     static void         SetCurrentEvent1(AliRsnEvent *event, Int_t id = 0) {fgRsnEvent1 = event; fgRsnEvent1->SetLocalID(id);}
76     static void         SetCurrentEvent2(AliRsnEvent *event, Int_t id = 0) {fgRsnEvent2 = event; fgRsnEvent2->SetLocalID(id);}
77     static Bool_t       IsCurrentEvent1()                                  {if (fgRsnEvent1 != 0x0) return kTRUE; return kFALSE;}
78     static Bool_t       IsCurrentEvent2()                                  {if (fgRsnEvent2 != 0x0) return kTRUE; return kFALSE;}
79     static Bool_t       SameEvent()                                        {if (fgRsnEvent1 == fgRsnEvent2) return kTRUE; return kFALSE;}
80
81   private:
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     static AliRsnEvent *fgRsnEvent1;  //! pointer to current event #1 (default current event)
98     static AliRsnEvent *fgRsnEvent2;  //! pointer to current event #2 (different from the other when doing mixing)
99
100     ClassDef(AliRsnEvent, 4);
101 };
102
103 #endif