2 #ifndef ALIANALYSISTASKMUMU_H
3 #define ALIANALYSISTASKMUMU_H
6 // AliAnalysisTaskMuMu : base class for mu pairs analysis
7 // Contains common things for ESD-based and AOD-based analysis
9 // author: L. Aphecetche (Subatech)
12 #ifndef ALIANALYSISTASKSE_H
13 # include "AliAnalysisTaskSE.h"
24 class AliHistogramCollection;
26 class AliCounterCollection;
28 class AliMuonTrackCuts;
32 class AliAnalysisTaskMuMu : public AliAnalysisTaskSE
55 kChi2MatchTrigger=BIT(17)
72 AliAnalysisTaskMuMu();
73 AliAnalysisTaskMuMu(Bool_t fromESD, TList* triggerClassesToConsider, const char* beamYear=0x0, TArrayF* centralities=0x0);
74 AliAnalysisTaskMuMu(Bool_t fromESD, const char* beamYear, TArrayF* centralities=0x0);
75 virtual ~AliAnalysisTaskMuMu();
77 virtual void AddEventCut(const char* cutName, UInt_t mask);
79 virtual void AddPairCut(const char* cutName, UInt_t maskForOneOrBothTrack, UInt_t maskForTrackPair=0);
81 virtual void AddSingleCut(const char* cutName, UInt_t mask);
83 void AddTriggerClasses(const char* triggerlist, const char* sep=",");
85 virtual void DisableHistogramming() { fIsHistogrammingDisabled = kTRUE; }
87 virtual void FinishTaskOutput();
91 virtual Bool_t IsHistogrammingDisabled() const { return fIsHistogrammingDisabled; }
93 static void MergeCentralities(AliHistogramCollection* histogramCollection);
95 virtual void NotifyRun();
97 virtual void Print(Option_t* opt="") const;
99 virtual void ShouldSeparatePlusAndMinus(Bool_t value) { fShouldSeparatePlusAndMinus = value; }
101 virtual Bool_t ShouldSeparatePlusAndMinus() const { return fShouldSeparatePlusAndMinus; }
103 virtual void Terminate(Option_t *);
105 void UseBackgroundTriggers(Bool_t value=kTRUE) { fUseBackgroundTriggers = value; }
107 void UserCreateOutputObjects();
109 virtual void UserExec(Option_t* opt);
111 class PairCut : public TObject {
113 PairCut(const char* name="", UInt_t maskForOneOrBothTrack=0, UInt_t maskForTrackPair=0)
114 : TObject(), fName("p"),fMaskForOneOrBothTrack(maskForOneOrBothTrack),fMaskForTrackPair(maskForTrackPair)
118 const char* GetName() const { return fName.Data(); }
119 UInt_t MaskForOneOrBothTrack() const { return fMaskForOneOrBothTrack; }
120 UInt_t MaskForTrackPair() const { return fMaskForTrackPair; }
121 void Print(Option_t* opt="") const;
124 TString fName; // name of the cut
125 UInt_t fMaskForOneOrBothTrack; // mask for the cut that at least of the two tracks should match
126 UInt_t fMaskForTrackPair; // mask for the cut both tracks should match
128 ClassDef(AliAnalysisTaskMuMu::PairCut,1); // a simple wrapper for two masks
134 Bool_t PassPhysicsSelection() const;
136 Bool_t CheckTriggerClass(const TString& toCheck, const TString& firedTriggerClasses, UInt_t l0Inputs) const;
138 virtual void FillHistos(const char* physics, const char* triggerClassName, const char* centrality, const AliVEvent& event);
140 void FillHistosForTrack(const char* physics, const char* triggerClassName, const char* centrality, const AliVParticle& track, Int_t trackIndex);
142 void Fill(const char* eventtype, TObjString* tname, const char* centrality, float fcent, const AliVEvent& event);
144 void AssertHistogramCollection(const char* physics, const char* triggerClassName);
146 void BeautifyHistos();
148 void CreateHisto(TObjArray* array,
150 const char* triggerClassName,
151 const char* hname, const char* htitle,
152 Int_t nbinsx, Double_t xmin, Double_t xmax,
153 Int_t nbinsy, Double_t ymin, Double_t ymax) const;
155 void CreateEventHisto(const char* physics,
156 const char* triggerClassName,
157 const char* hname, const char* htitle,
158 Int_t nbinsx, Double_t xmin, Double_t xmax,
159 Int_t nbinsy=0, Double_t ymin=0.0, Double_t ymax=0.0) const;
161 void CreateSingleHisto(const char* physics,
162 const char* triggerClassName,
163 const char* hname, const char* htitle,
164 Int_t nbinsx, Double_t xmin, Double_t xmax,
165 Int_t nbinsy=0, Double_t ymin=0.0, Double_t ymax=0.0,
166 Bool_t separatePlusAndMinus=kFALSE) const;
168 void CreatePairHisto(const char* physics,
169 const char* triggerClassName,
170 const char* hname, const char* htitle,
171 Int_t nbinsx, Double_t xmin, Double_t xmax,
172 Int_t nbinsy=0, Double_t ymin=0.0, Double_t ymax=0.0) const;
174 void DefineCentralityClasses(TArrayF* centralities);
176 void FillHistogramCollection(const char* physics, const char* triggerClassName);
178 UInt_t GetTriggerInputBitMaskFromInputName(const char* inputName) const;
180 TH1* Histo(const char* physics, const char* histoname);
182 TH1* Histo(const char* physics, const char* triggerClassName, const char* histoname);
184 TH1* Histo(const char* physics, const char* triggerClassName, const char* what, const char* histoname);
186 TH1* Histo(const char* physics, const char* triggerClassName, const char* cent, const char* what, const char* histoname);
188 Double_t MuonMass2() const;
190 const char* DefaultCentralityName() const;
192 const char* CentralityName(Double_t centrality) const;
194 Double_t Deg2() const { return 2.0*TMath::DegToRad(); }
195 Double_t Deg3() const { return 3.0*TMath::DegToRad(); }
196 Double_t Deg10() const { return 10.2*TMath::DegToRad(); }
198 Double_t AbsZEnd() const { return 505.0; /* cm */ }
200 Bool_t IsDynamicTriggerClasses() const { return fIsDynamicTriggerClasses; }
204 void ComputeTrackMask(const AliVParticle& track, Int_t trackIndex);
206 UInt_t GetEventMask(const AliVEvent& event) const;
208 void GetPairMask(const AliVParticle& t1, const AliVParticle& t2,
209 Int_t trackIndex1, Int_t trackIndex2,
210 UInt_t& mask1, UInt_t& mask2,
211 UInt_t& mask12) const;
213 UInt_t GetTrackMask(Int_t trackIndex) const;
215 Double_t GetTrackTheta(const AliVParticle& particle) const;
217 Bool_t PairRapidityCut(const AliVParticle& t1, const AliVParticle& t2) const;
219 /* methods prefixed with EA should really not exist at all. They are there
220 only because the some of our base interfaces are shamelessly incomplete or
224 void EAComputeTrackMasks(const AliVEvent& event);
226 TString EAGetFiredTriggerClasses(const AliVEvent& event) const;
228 Int_t EAGetNumberOfMuonTracks(const AliVEvent& event) const;
230 UInt_t EAGetL0TriggerInputs(const AliVEvent& event) const;
232 AliVParticle* EAGetTrack(const AliVEvent& event, Int_t i) const;
234 Double_t EAGetTrackChi2MatchTrigger(const AliVParticle& track) const;
236 Double_t EAGetTrackDCA(const AliVParticle& particle) const;
238 Double_t EAGetTrackRabs(const AliVParticle& particle) const;
240 Double_t EAGetTrackNormalizedChi2(const AliVParticle& particle) const;
242 Bool_t EAGetTZEROFlags(const AliVEvent& event, Bool_t& backgroundFlag, Bool_t& pileupFlag, Bool_t& satelliteFlag) const;
244 Bool_t AtLeastOneMuonTrigger(const TString& firedTriggerClasses) const;
246 Bool_t AtLeastOneEmcalTrigger(const TString& firedTriggerClasses) const;
248 Bool_t AtLeastOneMBTrigger(const TString& firedTriggerClasses) const;
250 Bool_t TriggerSBACECondition(const TString& triggerName) const;
254 TList* fOutput; //! list of output objects
255 AliHistogramCollection* fHistogramCollection; //! collection of histograms
256 AliCounterCollection* fEventCounters; //! event counters
258 AliMuonTrackCuts* fMuonTrackCuts; //! common cuts for muon tracks (from Diego)
259 TArrayI fPrecomputedTrackMasks; //! track masks
261 Bool_t fIsFromESD; // whether we read from ESD or AOD
262 Bool_t fIsDynamicTriggerClasses; // whether or not to update considered triggers on the fly
263 Bool_t fShouldSeparatePlusAndMinus; // whether or not to histogram mu+ and mu- separately
264 Bool_t fIsHistogrammingDisabled; // disable histogramming completely (only counters will be filled)
266 TString fBeamYear; // beam and year
267 std::vector<double> fCentralityLimits; // centrality limits
269 TList* fTriggerClasses; // trigger classes to consider
270 TObjArray* fSingleTrackCutNames; // cut on single tracks (array of TObjString)
271 TObjArray* fPairTrackCutNames; // cut on track pairs (array of TObjString)
272 TObjArray* fCentralityNames; // names to create histograms
273 TObjArray* fEventCutNames; // cut at event level (array of TObjString)
275 Bool_t fUseBackgroundTriggers; // whether or not we should use the ACE triggers
277 std::map<std::string,int> fTriggerInputBitMap; // map of L0 input name to bit
279 AliAnalysisTaskMuMu(const AliAnalysisTaskMuMu&); // not implemented (on purpose)
280 AliAnalysisTaskMuMu& operator=(const AliAnalysisTaskMuMu&); // not implemented (on purpose)
283 ClassDef(AliAnalysisTaskMuMu,17) // a class to analyse muon pairs (and single also ;-) )