]>
Commit | Line | Data |
---|---|---|
5376e016 CP |
1 | #ifndef ALIANALYSISMUMUCUTELEMENT_H |
2 | #define ALIANALYSISMUMUCUTELEMENT_H | |
3 | ||
4 | /** | |
5 | * | |
6 | * \class AliAnalysisMuMuCutElement | |
7 | * | |
8 | * \brief Describes an elementary cut (either event cut, track cut, pair cut, or trigger class cut) | |
9 | * | |
10 | */ | |
11 | ||
12 | #include "TObject.h" | |
13 | #include "TString.h" | |
14 | ||
15 | #include <vector> | |
16 | ||
17 | class TMethodCall; | |
18 | class AliVEvent; | |
19 | class AliInputEventHandler; | |
20 | class AliVParticle; | |
21 | ||
22 | class AliAnalysisMuMuCutElement : public TObject | |
23 | { | |
24 | public: | |
25 | ||
26 | enum ECutType | |
27 | { | |
28 | kEvent=0, // a cut on event | |
29 | kTrack=1, // a cut on track | |
30 | kTrackPair=2, // a cut on track pair | |
31 | kTriggerClass=3, // a cut on trigger class | |
32 | kAny=4 // must be the last one | |
33 | }; | |
34 | ||
35 | static const char* CutTypeName(ECutType type); | |
36 | ||
37 | AliAnalysisMuMuCutElement(); | |
38 | ||
39 | AliAnalysisMuMuCutElement(ECutType expectedType, | |
40 | TObject& cutObject, | |
41 | const char* cutMethodName, | |
42 | const char* cutMethodPrototype, | |
43 | const char* defaultParameters); | |
44 | ||
45 | virtual ~AliAnalysisMuMuCutElement(); | |
46 | ||
47 | virtual Bool_t IsValid() const { return (fCutMethod != 0x0); } | |
48 | ||
49 | const char* GetName() const { return fName.Data(); } | |
50 | ||
51 | virtual Bool_t Pass(const AliVEvent& event) const; | |
52 | ||
53 | virtual Bool_t Pass(const AliInputEventHandler& eventHandler) const; | |
54 | ||
55 | virtual Bool_t Pass(const AliVParticle& particle) const; | |
56 | ||
57 | virtual Bool_t Pass(const AliVParticle& p1, const AliVParticle& p2) const; | |
58 | ||
59 | virtual Bool_t Pass(const TString& firedTriggerClasses, TString& acceptedTriggerClasses, | |
60 | UInt_t L0, UInt_t L1, UInt_t L2) const; | |
61 | ||
62 | virtual void Print(Option_t* opt="") const; | |
63 | ||
64 | Bool_t IsEventCutter() const { return fIsEventCutter; } | |
65 | Bool_t IsEventHandlerCutter() const { return fIsEventHandlerCutter; } | |
66 | Bool_t IsTrackCutter() const { return fIsTrackCutter; } | |
67 | Bool_t IsTrackPairCutter() const { return fIsTrackPairCutter; } | |
68 | Bool_t IsTriggerClassCutter() const { return fIsTriggerClassCutter; } | |
69 | ||
70 | TObject* GetCutObject() const { return fCutObject; } | |
71 | ||
72 | const Long_t* GetCallParams() const { return &fCallParams[0]; } | |
73 | ||
74 | const char* GetCallMethodName() const; | |
75 | const char* GetCallMethodProto() const; | |
76 | ||
77 | Bool_t IsEqual(const TObject* obj) const; | |
78 | ||
79 | private: | |
80 | ||
81 | void Init(ECutType type=kAny) const; | |
82 | ||
83 | Bool_t CallCutMethod(Long_t p) const; | |
84 | Bool_t CallCutMethod(Long_t p1, Long_t p2) const; | |
85 | ||
86 | Int_t CountOccurences(const TString& prototype, const char* search) const; | |
87 | ||
88 | /// not implemented on purpose | |
89 | AliAnalysisMuMuCutElement(const AliAnalysisMuMuCutElement& rhs); | |
90 | /// not implemented on purpose | |
91 | AliAnalysisMuMuCutElement& operator=(const AliAnalysisMuMuCutElement& rhs); | |
92 | ||
93 | protected: | |
94 | TString fName; // name of the cut | |
95 | mutable Bool_t fIsEventCutter; // whether or not the cut is an event cutter | |
96 | mutable Bool_t fIsEventHandlerCutter; // whether or not the cut is an event handler cutter | |
97 | mutable Bool_t fIsTrackCutter; // whether or not the cut is a track cutter | |
98 | mutable Bool_t fIsTrackPairCutter; // whether or not the cut is a track pair cutter | |
99 | mutable Bool_t fIsTriggerClassCutter; // whether or not the cut is a trigger class cutter | |
100 | private: | |
101 | ||
102 | TObject* fCutObject; // pointer (not owner) to the object doing the actual cut work | |
103 | TString fCutMethodName; // method (of fCutObject) to be called to do the cut | |
104 | TString fCutMethodPrototype; // prototype of the method to be called to do the cut | |
105 | TString fDefaultParameters; // default parameters of the cut method (might be empty) | |
106 | mutable Int_t fNofParams; // number of parameters | |
107 | mutable TMethodCall* fCutMethod; //! cut method | |
108 | ||
109 | mutable std::vector<Long_t> fCallParams; //! vector of parameters for the fCutMethod | |
110 | mutable std::vector<Double_t> fDoubleParams; //! temporary vector to hold the references | |
111 | ||
112 | ClassDef(AliAnalysisMuMuCutElement,1) // One piece of a cut combination | |
113 | }; | |
114 | ||
115 | class AliAnalysisMuMuCutElementBar : public AliAnalysisMuMuCutElement | |
116 | { | |
117 | public: | |
118 | AliAnalysisMuMuCutElementBar(); | |
119 | ||
120 | AliAnalysisMuMuCutElementBar(const AliAnalysisMuMuCutElement& ce); | |
121 | ||
122 | virtual ~AliAnalysisMuMuCutElementBar(); | |
123 | ||
124 | Bool_t IsValid() const { return fCutElement && fCutElement->IsValid(); } | |
125 | ||
126 | Bool_t Pass(const AliVEvent& event) const { return !fCutElement->Pass(event); } | |
127 | ||
128 | Bool_t Pass(const AliInputEventHandler& eventHandler) const { return !fCutElement->Pass(eventHandler); } | |
129 | ||
130 | Bool_t Pass(const AliVParticle& particle) const { return !fCutElement->Pass(particle); } | |
131 | ||
132 | Bool_t Pass(const AliVParticle& p1, const AliVParticle& p2) const { return !fCutElement->Pass(p1,p2); } | |
133 | ||
134 | Bool_t Pass(const TString& firedTriggerClasses, TString& acceptedTriggerClasses, | |
135 | UInt_t L0, UInt_t L1, UInt_t L2) const | |
136 | { return fCutElement->Pass(firedTriggerClasses,acceptedTriggerClasses,L0,L1,L2); } | |
137 | ||
138 | void Print(Option_t* opt="") const; | |
139 | ||
140 | private: | |
0804b4cc | 141 | |
142 | /// not implemented on purpose | |
143 | AliAnalysisMuMuCutElementBar(const AliAnalysisMuMuCutElementBar& rhs); | |
144 | /// not implemented on purpose | |
145 | AliAnalysisMuMuCutElementBar& operator=(const AliAnalysisMuMuCutElementBar& rhs); | |
146 | ||
5376e016 CP |
147 | const AliAnalysisMuMuCutElement* fCutElement; // the cut element we're the negation of |
148 | ||
149 | ClassDef(AliAnalysisMuMuCutElementBar,1) // opposite of cut element (i.e. !cutelement) | |
150 | }; | |
151 | ||
152 | #endif |