- changes by Lucia in order to include PbPb centrality trigger according to trigger...
[u/mrichter/AliRoot.git] / PWGGA / GammaConv / AliConvEventCuts.h
CommitLineData
344100c4 1#ifndef ALICONVEVENTCUTS_H
2#define ALICONVEVENTCUTS_H
3
4// Class handling all kinds of selection cuts for Gamma Conversion analysis
5// Authors: Svein Lindal, Daniel Lohner *
6
7#include "AliAODTrack.h"
8#include "AliESDtrack.h"
9#include "AliVEvent.h"
10#include "AliMCEvent.h"
11#include "AliVTrack.h"
12#include "AliStack.h"
13#include "AliAnalysisCuts.h"
14#include "TH1F.h"
15#include "TF1.h"
16#include "AliAnalysisUtils.h"
17#include "AliAnalysisManager.h"
18#include "TRandom3.h"
dc729816 19#include "AliVCaloTrigger.h"
20#include "AliEmcalTriggerPatchInfo.h"
344100c4 21
22class AliESDEvent;
23class AliAODEvent;
24class TH1F;
25class TH2F;
26class TF1;
27class AliAnalysisCuts;
28class iostream;
29class TList;
30class AliAnalysisManager;
31class AliAODMCParticle;
32
33using namespace std;
34
35class AliConvEventCuts : public AliAnalysisCuts {
36
37 public:
38 enum cutIds {
39 kisHeavyIon,
40 kCentralityMin,
41 kCentralityMax,
42 kSelectSpecialTriggerAlias,
43 kSelectSubTriggerClass,
44 kremovePileUp,
45 kExtraSignals,
46 kNCuts
47 };
48
dc729816 49 enum TriggerTypeEMCAL {
50 kND = -1, //not defined
51 kJ1 = 1,
52 kJ2 = 2,
53 kG1 = 3,
54 kG2 = 4,
55 kL0 = 5,
56 };
344100c4 57
344100c4 58 AliConvEventCuts(const char *name="EventCuts", const char * title="Event Cuts");
59 AliConvEventCuts(const AliConvEventCuts&);
60 AliConvEventCuts& operator=(const AliConvEventCuts&);
61
62 virtual ~AliConvEventCuts(); //virtual destructor
63
64// static AliConvEventCuts * GetStandardCuts2010PbPb();
65// static AliConvEventCuts * GetStandardCuts2010pp();
66
dc729816 67 Int_t fCuts[kNCuts];
68 Bool_t UpdateCutString();
69 static const char * fgkCutNames[kNCuts];
344100c4 70
dc729816 71 // Seters
72 Bool_t SetCutIds (TString cutString);
73 Bool_t SetCut (cutIds cutID, Int_t cut);
74 Bool_t SetIsHeavyIon (Int_t isHeavyIon);
75 Bool_t SetCentralityMax (Int_t centralityBin);
76 Bool_t SetCentralityMin (Int_t centralityBin);
77 Bool_t SetRemovePileUp (Int_t removePileUp);
78 Bool_t SetMultiplicityMethod (Int_t multiplicityMethod);
79 Bool_t SetSelectSpecialTrigger (Int_t selectSpecialTrigger);
80 Bool_t SetSelectSubTriggerClass (Int_t selectSpecialSubTriggerClass);
81 Bool_t SetRejectExtraSignalsCut (Int_t extraSignal);
82 void SetV0ReaderName (TString name) { fV0ReaderName = name ; }
83 void SetAddedSignalPDGCode (Int_t addedSignalPDGcode) { fAddedSignalPDGCode = addedSignalPDGcode ; }
84 void SetPreSelectionCutFlag (Bool_t preSelFlag) { fPreSelCut = preSelFlag ; }
85 void SetCaloTriggerPatchInfoName(const char *n) { fCaloTriggerPatchInfoName = n ; }
86 void SetCaloTriggersName(const char *n) { fCaloTriggersName = n ; }
87 void SetAcceptedHeader(TList *HeaderList) { fHeaderList = HeaderList ; }
88 void SetFillCutHistograms( TString name="",
89 Bool_t preCut = kTRUE) { if(!fHistograms){ InitCutHistograms(name,preCut);} ; }
90 void SetEtaShift(Double_t etaShift) { fEtaShift = etaShift ; } // Eta shift Setting
91 void SetEtaShift(TString pPbOrPbp) { Double_t etaShift = 0.0 ;
92 if(!pPbOrPbp.CompareTo("pPb")) etaShift = -0.465 ;
93 else if(!pPbOrPbp.CompareTo("Pbp")) etaShift = 0.465 ;
94 fEtaShift = etaShift ; }
95 void SetUseReweightingWithHistogramFromFile( Bool_t pi0reweight=kTRUE,
96 Bool_t etareweight=kFALSE,
97 Bool_t k0sreweight=kFALSE,
98 TString path="$ALICE_ROOT/PWGGA/GammaConv/MCSpectraInput.root",
99 TString histoNamePi0 = "",
100 TString histoNameEta = "",
101 TString histoNameK0s = "",
102 TString fitNamePi0 = "",
103 TString fitNameEta = "",
104 TString fitNameK0s ="" )
105 {
106 AliInfo(Form("enabled reweighting for: pi0 : %i, eta: %i, K0s: %i",pi0reweight, etareweight, k0sreweight));
107 fDoReweightHistoMCPi0 = pi0reweight ;
108 fDoReweightHistoMCEta = etareweight ;
109 fDoReweightHistoMCK0s = k0sreweight ;
110 fPathTrFReweighting=path ;
111 fNameHistoReweightingPi0 =histoNamePi0 ;
112 fNameHistoReweightingEta =histoNameEta ;
113 fNameHistoReweightingK0s =histoNameK0s ;
114 fNameFitDataPi0 =fitNamePi0 ;
115 fNameFitDataEta =fitNameEta ;
116 fNameFitDataK0s =fitNameK0s ; }
344100c4 117
dc729816 118 // Geters
119 TString GetCutNumber();
120 TString* GetFoundHeader() { return fGeneratorNames ; }
121 Int_t GetEventQuality() { return fEventQuality; ; }
122 Bool_t GetIsFromPileup() { return fRemovePileUp; }
123 void GetCentralityRange(Double_t range[2]) { range[0]=10*fCentralityMin ;
124 range[1]=10*fCentralityMax ; }
125 TList* GetCutHistograms() { return fHistograms ; }
126 Int_t GetMultiplicityMethod() { return fMultiplicityMethod ; }
127 Int_t GetSignalRejection() { return fRejectExtraSignals ; }
128 Int_t GetNAcceptedHeaders() { return fnHeaders ; }
129 TString * GetAcceptedHeaderNames() { return fGeneratorNames ; }
130 Int_t * GetAcceptedHeaderStart() { return fNotRejectedStart ; }
131 Int_t * GetAcceptedHeaderEnd() { return fNotRejectedEnd ; }
132 TList* GetAcceptedHeader() { return fHeaderList ; }
133 Int_t GetNumberOfContributorsVtx(AliVEvent *event);
134 Double_t GetEtaShift() { return fEtaShift ; }
135 Bool_t GetDoEtaShift() { return fDoEtaShift ; }
136 TString GetSpecialTriggerName() { return fSpecialTriggerName ; }
137 AliEmcalTriggerPatchInfo *GetMainTriggerPatch();
138 ULong_t GetTriggerList();
139 Float_t GetWeightForMeson(TString period, Int_t index, AliStack *MCStack, AliVEvent *InputEvent = 0x0);
140 Double_t GetCentrality(AliVEvent *event);
141 void GetCorrectEtaShiftFromPeriod(TString periodName);
142 void GetNotRejectedParticles(Int_t rejection, TList *HeaderList, AliVEvent *MCEvent);
143 TClonesArray* GetArrayFromEvent(AliVEvent* fInputEvent, const char *name, const char *clname=0);
344100c4 144
dc729816 145 Bool_t InitializeCutsFromCutString(const TString analysisCutSelection);
146 void SelectCollisionCandidates(UInt_t offlineTriggerMask = AliVEvent::kAny) {
147 fOfflineTriggerMask = offlineTriggerMask;
148 fTriggerSelectedManually = kTRUE;
149 }
150 void SelectSpecialTrigger(UInt_t offlineTriggerMask = AliVEvent::kAny,
151 TString TriggerClassName = "AliVEvent::kAny" ) {
152 fOfflineTriggerMask = offlineTriggerMask;
153 fSpecialTriggerName = TriggerClassName;
154 cout << fSpecialTriggerName.Data() << endl;
344100c4 155
dc729816 156 }
157
158 virtual Bool_t IsSelected(TObject* /*obj*/){return kTRUE;}
159 virtual Bool_t IsSelected(TList* /*list*/) {return kTRUE;}
344100c4 160
dc729816 161
162 // Cut Selection
163 Bool_t EventIsSelected(AliVEvent *fInputEvent, AliVEvent *fMCEvent);
164 Int_t IsEventAcceptedByCut(AliConvEventCuts *ReaderCuts, AliVEvent *InputEvent, AliMCEvent *MCEvent, Int_t isHeavyIon);
165
166 void PrintCuts();
167 void PrintCutsWithValues();
168 void InitCutHistograms(TString name="",Bool_t preCut = kTRUE);
344100c4 169
170 ///Cut functions
dc729816 171 Int_t IsParticleFromBGEvent(Int_t index, AliStack *MCStack, AliVEvent *InputEvent = 0x0);
172
173 void LoadReweightingHistosMCFromFile ();
344100c4 174
175 // Event Cuts
dc729816 176 Bool_t IsCentralitySelected(AliVEvent *fInputEvent, AliVEvent *fMCEvent = NULL);
177 Bool_t VertexZCut(AliVEvent *fInputEvent);
178 Bool_t IsTriggerSelected(AliVEvent *fInputEvent, Bool_t isMC);
179 Bool_t HasV0AND() { return fHasV0AND ; }
180 Bool_t IsSDDFired() { return fIsSDDFired ; }
181 Int_t IsSpecialTrigger() { return fSpecialTrigger ; }
f57c67ac 182 Int_t IsSpecialSubTrigger() { return fSpecialSubTrigger ; }
dc729816 183 void InitializeEMCALTrigger( AliVEvent *fInputEvent);
184 Bool_t HasTriggerType(TriggerTypeEMCAL t);
344100c4 185
dc729816 186 // Request Flags
187 Int_t IsHeavyIon() { return fIsHeavyIon ; }
188 void DoEtaShift(Bool_t doEtaShift) { fDoEtaShift = doEtaShift ; }
344100c4 189
344100c4 190
191 protected:
dc729816 192 TList *fHistograms;
193 TList *fHeaderList;
344100c4 194
dc729816 195 Int_t fEventQuality; // EventQuality
344100c4 196 //cuts
dc729816 197 Int_t fIsHeavyIon; // flag for heavy ion
198 Int_t fDetectorCentrality; // centrality detecotor V0M or CL1
199 Int_t fModCentralityClass; // allows to select smaller centrality classes
200 Double_t fMaxVertexZ; // max z offset of vertex
201 Int_t fCentralityMin; // centrality selection lower bin value
202 Int_t fCentralityMax; // centrality selection upper bin value
203 Int_t fMultiplicityMethod; // selected multiplicity method
204 Int_t fSpecialTrigger; // flag
205 Int_t fSpecialSubTrigger; // flag
206 Bool_t fRemovePileUp; // flag
207 Int_t fRejectExtraSignals; //
208 UInt_t fOfflineTriggerMask; // Task processes collision candidates only
209 Bool_t fHasV0AND; // V0AND Offline Trigger
210 Bool_t fIsSDDFired; // SDD FIRED to select with SDD events
211 TRandom3 fRandom; //
212 Int_t fnHeaders; // Number of Headers
213 Int_t *fNotRejectedStart; //[fnHeaders]
214 Int_t *fNotRejectedEnd; //[fnHeaders]
215 TString *fGeneratorNames; //[fnHeaders]
216 TObjString *fCutString; // cut number used for analysis
217 AliAnalysisUtils *fUtils;
218 Double_t fEtaShift;
219 Bool_t fDoEtaShift; // Flag for Etashift
220 Bool_t fDoReweightHistoMCPi0; // Flag for reweighting Pi0 input with histogram
221 Bool_t fDoReweightHistoMCEta; // Flag for reweighting Eta input with histogram
222 Bool_t fDoReweightHistoMCK0s; // Flag for reweighting K0s input with histogram
223 TString fPathTrFReweighting; // Path for file used in reweighting
224 TString fNameHistoReweightingPi0; // Histogram name for reweighting Pi0
225 TString fNameHistoReweightingEta; // Histogram name for reweighting Eta
226 TString fNameHistoReweightingK0s; // Histogram name for reweighting K0s
227 TString fNameFitDataPi0; // Fit name for fit to spectrum of pi0s in Data
228 TString fNameFitDataEta; // Fit name for fit to spectrum of etas in Data
229 TString fNameFitDataK0s; // Fit name for fit to spectrum of k0s in Data
344100c4 230 // Histograms
dc729816 231 TH1F *fHistoEventCuts; // bookkeeping for event selection cuts
232 TH1F *hCentrality; // centrality distribution for selected events
233 TH2F *hCentralityVsNumberOfPrimaryTracks; // centrality distribution for selected events
234 TH1F *hVertexZ; // vertex z distribution for selected events
235 TH1F *hTriggerClass; // fired offline trigger class
236 TH1F *hTriggerClassSelected; // selected fired offline trigger class
237 TH1D *hReweightMCHistPi0; // histogram input for reweighting Pi0
238 TH1D *hReweightMCHistEta; // histogram input for reweighting Eta
239 TH1D *hReweightMCHistK0s; // histogram input for reweighting K0s
240 TF1 *fFitDataPi0; // fit to pi0 spectrum in Data
241 TF1 *fFitDataEta; // fit to eta spectrum in Data
242 TF1 *fFitDataK0s; // fit to K0s spectrum in Data
243 Int_t fAddedSignalPDGCode;
244 Bool_t fPreSelCut; // Flag for preselection cut used in V0Reader
245 Bool_t fTriggerSelectedManually; // Flag for manual trigger selection
246 TString fSpecialTriggerName; // Name of the Special Triggers
247 TString fSpecialSubTriggerName; // Name of the Special Triggers
248 Int_t fNSpecialSubTriggerOptions;
249 // trigger information
250 TString fV0ReaderName; // Name of V0Reader
251 AliVCaloTrigger *fCaloTriggers; //! calo triggers
252 TClonesArray *fTriggerPatchInfo; //! trigger patch info array
253 AliEmcalTriggerPatchInfo *fMainTriggerPatchEMCAL; // main trigger patch, will be cached after first call
254 TString fCaloTriggersName; // name of calo triggers collection
255 TString fCaloTriggerPatchInfoName; // trigger patch info array name
256 ULong_t fTriggersEMCAL; // list of fired EMCAL triggers
257 ULong_t fTriggersEMCALSelected; // list of accepted triggers
258 Bool_t fEMCALTrigInitialized; // EMCAL triggers initialized
344100c4 259
260 private:
261
dc729816 262 ClassDef(AliConvEventCuts,3)
344100c4 263};
264
265
266#endif