]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/RESONANCES/AliRsnEvent.h
fix for Coverity (B.Hippolyte)
[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 "AliVEvent.h"
14 #include "AliMCEvent.h"
15 #include "AliESDEvent.h"
16 #include "AliAODEvent.h"
17 #include "AliRsnDaughter.h"
18
19 class AliRsnCutPID;
20 class AliESDtrackCuts;
21
22 class AliRsnEvent : public TObject {
23 public:
24
25    AliRsnEvent(AliVEvent *ref = 0, AliVEvent *refMC = 0);
26    AliRsnEvent(const AliRsnEvent& copy);
27    AliRsnEvent& operator= (const AliRsnEvent& copy);
28    virtual ~AliRsnEvent();
29
30    // basic setters/getters
31    void       SetRef(AliVEvent *ref)       {fRef = ref;}
32    void       SetRefMC(AliVEvent *refmc)   {fRefMC = refmc;}
33    void       SetLeadingIndex(Int_t i)     {fLeading = i;}
34    void       SetLocalID(Int_t i)          {fLocalID = i;}
35    AliVEvent* GetRef()                     {return fRef;}
36    AliVEvent* GetRefMC()                   {return fRefMC;}
37    Int_t      GetLeadingIndex() const      {return fLeading;}
38    Int_t      GetLeadingParticleID() const {return fLeading;}
39    Int_t      GetLocalID() const           {return fLocalID;}
40
41    // getters which convert into allowed input types
42    AliESDEvent* GetRefESD()   {if (classMatchRef  (AliESDEvent::Class())) return static_cast<AliESDEvent*>(fRef)  ; return 0x0;}
43    AliAODEvent* GetRefAOD()   {if (classMatchRef  (AliAODEvent::Class())) return static_cast<AliAODEvent*>(fRef)  ; return 0x0;}
44    AliMCEvent*  GetRefMCESD() {if (classMatchRefMC(AliMCEvent ::Class())) return static_cast<AliMCEvent *>(fRefMC); return 0x0;}
45    AliAODEvent* GetRefMCAOD() {if (classMatchRefMC(AliAODEvent::Class())) return static_cast<AliAODEvent*>(fRefMC); return 0x0;}
46    Bool_t       IsESD()       {return (GetRefESD() != 0x0);}
47    Bool_t       IsAOD()       {return (GetRefAOD() != 0x0);}
48
49    // advanced getters
50    Double_t         GetVz();
51    Int_t            GetMultiplicity(AliESDtrackCuts *cuts = 0x0);
52    Int_t            GetMultiplicityMC();
53
54    // setters for a daughter
55    Bool_t           SetDaughterAbs(AliRsnDaughter &daughter, Int_t absoluteIndex);
56    Bool_t           SetDaughter(AliRsnDaughter &daughter, Int_t index, AliRsnDaughter::ERefType type = AliRsnDaughter::kTrack);
57    Bool_t           SetDaughterMC(AliRsnDaughter &daughter, Int_t index);
58    AliRsnDaughter   GetDaughterAbs(Int_t absoluteIndex);
59    AliRsnDaughter   GetDaughter(Int_t i, AliRsnDaughter::ERefType type = AliRsnDaughter::kTrack);
60    AliRsnDaughter   GetDaughterMC(Int_t i);
61    Int_t            GetAbsoluteSum();
62    Bool_t           ConvertAbsoluteIndex(Int_t index, Int_t &realIndex, AliRsnDaughter::ERefType &type);
63    Int_t            ConvertRealIndex(Int_t index, 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 = 0x0);
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 classMatchRef  (TClass *ref) {if (fRef  ) return (fRef  ->InheritsFrom(ref)); return kFALSE;}
83    Bool_t classMatchRefMC(TClass *ref) {if (fRefMC) return (fRefMC->InheritsFrom(ref)); return kFALSE;}
84
85    Bool_t SetDaughterESDtrack(AliRsnDaughter &target, Int_t index);
86    Bool_t SetDaughterAODtrack(AliRsnDaughter &target, Int_t index);
87    Bool_t SetDaughterESDv0(AliRsnDaughter &target, Int_t index);
88    Bool_t SetDaughterAODv0(AliRsnDaughter &target, Int_t index);
89    Bool_t SetDaughterESDcascade(AliRsnDaughter &target, Int_t index);
90    Bool_t SetDaughterAODcascade(AliRsnDaughter &target, Int_t index);
91    Bool_t SetMCInfoESD(AliRsnDaughter &target);
92    Bool_t SetMCInfoAOD(AliRsnDaughter &target);
93
94    AliVEvent   *fRef;               //  pointer to input event
95    AliVEvent   *fRefMC;             //  pointer to reference MC event (if any)
96    Int_t        fLeading;           //  index of leading track
97    Int_t        fLocalID;           //  identification number used locally
98
99    static AliRsnEvent *fgRsnEvent1; //! pointer to current event #1 (default current event)
100    static AliRsnEvent *fgRsnEvent2; //! pointer to current event #2 (different from the other when doing mixing)
101
102    ClassDef(AliRsnEvent, 4);
103 };
104
105 #endif