Reverting previous commit
[u/mrichter/AliRoot.git] / PWG / muon / AliVAnalysisMuon.h
CommitLineData
ac4edd2e 1#ifndef ALIVANALYSISMUON_H
2#define ALIVANALYSISMUON_H
3
4/* $Id: AliVAnalysisMuon.h 47782 2011-02-24 18:37:31Z martinez $ */
5
6//
7// Base class for single muon analysis
8//
9// Author: Diego Stocco
10//
11
12#include "AliAnalysisTaskSE.h"
ac4edd2e 13
14class TString;
15class TObjArray;
16class TAxis;
17class TLorentzVector;
18class TList;
19class AliMergeableCollection;
20class AliCounterCollection;
21class AliVParticle;
22class AliAODEvent;
23class AliESDEvent;
24class AliCFGridSparse;
c6e0141f 25class AliMuonTrackCuts;
26class AliMuonPairCuts;
12e33589 27class AliVVertex;
ac4edd2e 28
29class AliVAnalysisMuon : public AliAnalysisTaskSE {
30 public:
31 AliVAnalysisMuon();
32 AliVAnalysisMuon(const char *name, const AliMuonTrackCuts& trackCuts);
33 AliVAnalysisMuon(const char *name, const AliMuonPairCuts& pairCuts);
34 AliVAnalysisMuon(const char *name, const AliMuonTrackCuts& trackCuts, const AliMuonPairCuts& pairCuts);
c6e0141f 35
ac4edd2e 36 virtual ~AliVAnalysisMuon();
37
38 virtual void UserCreateOutputObjects();
39 virtual void UserExec(Option_t *option);
40 virtual void Terminate(Option_t *option);
41 virtual void NotifyRun();
42 virtual void FinishTaskOutput();
43
44 void SetCentralityClasses(Int_t nCentralityBins = -1, Double_t* centralityBins = 0x0);
45
46 void SetTrigClassPatterns(TString pattern = "CINT CMU !CMUP CMBAC CPBI !-ACE- !-AC- !-E- !WU !EGA !EJE");
47 void SetTerminateOptions(TString physSel="All", TString trigClass="ANY", TString centralityRange="", TString furtherOpts="");
48
c6e0141f 49 /// Get muon track cuts
50 AliMuonTrackCuts* GetMuonTrackCuts() { return fMuonTrackCuts; }
51 /// Get muon pair cuts
52 AliMuonPairCuts* GetMuonPairCuts() { return fMuonPairCuts; }
53
ac4edd2e 54 // Utility methods for CF container
55 static Bool_t SetSparseRange(AliCFGridSparse* gridSparse,
56 Int_t ivar, TString labelName,
57 Double_t varMin, Double_t varMax,
58 TString option = "");
59
60 protected:
61
62 /////////////////////////////////////////////////////
63 // Pure virtual methods to be implemented bu users //
64 /////////////////////////////////////////////////////
65
8396b417 66 virtual void MyUserCreateOutputObjects() = 0;
67 // In this method you have to create your own output as well as
68 // the mergeable objects that will be then used
ac4edd2e 69 // in the counter collection.
8396b417 70 // To do so, create your object and add it to the collection through:
ac4edd2e 71 // TH1* histo = new TH1F();
8396b417 72 // AddObjectToCollection(histo, index)
ac4edd2e 73
74 virtual void ProcessEvent(TString physSel, const TObjArray& selectTrigClasses, TString centrality) = 0;
75 // This method is called at each event.
76 // In this method you can fill the histograms or the CF container that you have created
77
ac4edd2e 78 /////////////////////
79 // Utility methods //
80 /////////////////////
81
82 // Transparently handle tracks in ESD/AOD
83 Int_t GetNTracks();
84 AliVParticle* GetTrack(Int_t itrack);
85 TLorentzVector GetTrackPair(AliVParticle* track1, AliVParticle* track2) const;
86
87 // Methods for MC
88 Bool_t IsMC();
89 Int_t GetNMCTracks();
90 AliVParticle* GetMCTrack(Int_t trackLabel);
c6e0141f 91 Int_t GetMotherIndex(AliVParticle* mcParticle);
92 Int_t GetDaughterIndex(AliVParticle* mcParticle, Int_t idaughter);
ac4edd2e 93 Int_t GetParticleType(AliVParticle* track);
94 Int_t RecoTrackMother(AliVParticle* mcParticle);
95
96 // Methods for mergeable object collections
8396b417 97 Bool_t AddObjectToCollection(TObject* object, Int_t index = -1);
ac4edd2e 98 TObject* GetMergeableObject(TString physSel, TString trigClassName, TString centrality, TString objectName);
8396b417 99 TObject* GetSum(TString physSel, TString trigClassNames, TString centrality, TString objectPattern);
ac4edd2e 100
101 // A useful constant
102 Double_t MuonMass2() const;
103
104 // Handle triggers
105 Bool_t TrackPtCutMatchTrigClass(AliVParticle* track, TString trigClassName);
106 Int_t GetTrigClassPtCutLevel(TString trigClassName);
107
12e33589 108 // Methods for event information
109 AliVVertex* GetVertexSPD() const;
110 /// Set minimum number of vertex contributors
111 void SetMinNvtxContributors(Int_t minNvtxContributors) { fMinNvtxContirbutors = minNvtxContributors; }
112
ac4edd2e 113 enum {
8396b417 114 kPhysSelPass, ///< Physics selected events
115 kPhysSelReject, ///< Events non-passing selection
116 kNselections ///< Number of selections
ac4edd2e 117 };
118
119 enum {
120 kCharmMu, ///< Mu from charm
121 kBeautyMu, ///< Mu from beauty
122 kQuarkoniumMu, ///< Mu from resonance
c6e0141f 123 kWbosonMu, ///< Mu from W
ac4edd2e 124 kDecayMu, ///< Decay mu
125 kSecondaryMu, ///< Secondary mu
126 kRecoHadron, ///< Reconstructed hadron
127 kUnidentified, ///< Particle that fails matching kine
128 kNtrackSources ///< Total number of track sources
129 };
130
c6e0141f 131 AliMuonTrackCuts* fMuonTrackCuts; ///< Muon track cuts
132 AliMuonPairCuts* fMuonPairCuts; ///< Muon pair track cuts
ac4edd2e 133 AliESDEvent* fESDEvent; //!< ESD event, not owner
134 AliAODEvent* fAODEvent; //!< AOD event, not owner
135 TObjArray* fTerminateOptions; ///< Terminate options
8396b417 136 TObjArray* fChargeKeys; ///< Muon charge keys
137 TObjArray* fSrcKeys; ///< MC sources names
138 TObjArray* fPhysSelKeys; ///< Physics selection names
139 TList* fTriggerClasses; ///< List of trigger classes
ac4edd2e 140 TAxis* fCentralityClasses; ///< Centrality classes
141
142 AliCounterCollection* fEventCounters; //!< event counters
143 AliMergeableCollection* fMergeableCollection; //!< collection of mergeable objects
144 TObjArray* fOutputList; //!< List of outputs
12e33589 145 Int_t fMinNvtxContirbutors; ///< Minimum number of vertex contributors
ac4edd2e 146
147 private:
148 AliVAnalysisMuon(const AliVAnalysisMuon&);
149 AliVAnalysisMuon& operator=(const AliVAnalysisMuon&);
150
151 void InitKeys();
152 void CreateMergeableObjects(TString physSel, TString trigClassName, TString centrality);
153 TObjArray* BuildTriggerClasses(TString firedTrigClasses);
154
155 TObjArray* fSelectedTrigPattern; ///< List of triggers to be kept
156 TObjArray* fRejectedTrigPattern; ///< List of triggers to be rejected
157 TObjArray* fSelectedTrigLevel; ///< Track-trigger pt cut for selected trigger class
158 TObjArray* fOutputPrototypeList; //!< List of prototype object to be used in collection
159
12e33589 160 ClassDef(AliVAnalysisMuon, 3);
ac4edd2e 161};
162
163#endif