Fix problem in terminate. Add possibility to select the minimum number of vertex...
[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 = "");
df1e3f7a 59
60 /// Set minimum number of vertex contributors
61 void SetMinNvtxContributors(Int_t minNvtxContributors) { fMinNvtxContirbutors = minNvtxContributors; }
ac4edd2e 62
63 protected:
64
65 /////////////////////////////////////////////////////
66 // Pure virtual methods to be implemented bu users //
67 /////////////////////////////////////////////////////
68
8396b417 69 virtual void MyUserCreateOutputObjects() = 0;
70 // In this method you have to create your own output as well as
71 // the mergeable objects that will be then used
ac4edd2e 72 // in the counter collection.
8396b417 73 // To do so, create your object and add it to the collection through:
ac4edd2e 74 // TH1* histo = new TH1F();
8396b417 75 // AddObjectToCollection(histo, index)
ac4edd2e 76
77 virtual void ProcessEvent(TString physSel, const TObjArray& selectTrigClasses, TString centrality) = 0;
78 // This method is called at each event.
79 // In this method you can fill the histograms or the CF container that you have created
80
ac4edd2e 81 /////////////////////
82 // Utility methods //
83 /////////////////////
84
85 // Transparently handle tracks in ESD/AOD
86 Int_t GetNTracks();
87 AliVParticle* GetTrack(Int_t itrack);
88 TLorentzVector GetTrackPair(AliVParticle* track1, AliVParticle* track2) const;
89
90 // Methods for MC
91 Bool_t IsMC();
92 Int_t GetNMCTracks();
93 AliVParticle* GetMCTrack(Int_t trackLabel);
c6e0141f 94 Int_t GetMotherIndex(AliVParticle* mcParticle);
95 Int_t GetDaughterIndex(AliVParticle* mcParticle, Int_t idaughter);
ac4edd2e 96 Int_t GetParticleType(AliVParticle* track);
97 Int_t RecoTrackMother(AliVParticle* mcParticle);
98
99 // Methods for mergeable object collections
8396b417 100 Bool_t AddObjectToCollection(TObject* object, Int_t index = -1);
ac4edd2e 101 TObject* GetMergeableObject(TString physSel, TString trigClassName, TString centrality, TString objectName);
8396b417 102 TObject* GetSum(TString physSel, TString trigClassNames, TString centrality, TString objectPattern);
ac4edd2e 103
104 // A useful constant
105 Double_t MuonMass2() const;
106
107 // Handle triggers
108 Bool_t TrackPtCutMatchTrigClass(AliVParticle* track, TString trigClassName);
109 Int_t GetTrigClassPtCutLevel(TString trigClassName);
110
12e33589 111 // Methods for event information
112 AliVVertex* GetVertexSPD() const;
12e33589 113
ac4edd2e 114 enum {
8396b417 115 kPhysSelPass, ///< Physics selected events
116 kPhysSelReject, ///< Events non-passing selection
117 kNselections ///< Number of selections
ac4edd2e 118 };
119
120 enum {
121 kCharmMu, ///< Mu from charm
122 kBeautyMu, ///< Mu from beauty
123 kQuarkoniumMu, ///< Mu from resonance
c6e0141f 124 kWbosonMu, ///< Mu from W
ac4edd2e 125 kDecayMu, ///< Decay mu
126 kSecondaryMu, ///< Secondary mu
127 kRecoHadron, ///< Reconstructed hadron
128 kUnidentified, ///< Particle that fails matching kine
129 kNtrackSources ///< Total number of track sources
130 };
131
c6e0141f 132 AliMuonTrackCuts* fMuonTrackCuts; ///< Muon track cuts
133 AliMuonPairCuts* fMuonPairCuts; ///< Muon pair track cuts
ac4edd2e 134 AliESDEvent* fESDEvent; //!< ESD event, not owner
135 AliAODEvent* fAODEvent; //!< AOD event, not owner
136 TObjArray* fTerminateOptions; ///< Terminate options
8396b417 137 TObjArray* fChargeKeys; ///< Muon charge keys
138 TObjArray* fSrcKeys; ///< MC sources names
139 TObjArray* fPhysSelKeys; ///< Physics selection names
140 TList* fTriggerClasses; ///< List of trigger classes
ac4edd2e 141 TAxis* fCentralityClasses; ///< Centrality classes
142
143 AliCounterCollection* fEventCounters; //!< event counters
144 AliMergeableCollection* fMergeableCollection; //!< collection of mergeable objects
145 TObjArray* fOutputList; //!< List of outputs
12e33589 146 Int_t fMinNvtxContirbutors; ///< Minimum number of vertex contributors
ac4edd2e 147
148 private:
149 AliVAnalysisMuon(const AliVAnalysisMuon&);
150 AliVAnalysisMuon& operator=(const AliVAnalysisMuon&);
151
152 void InitKeys();
153 void CreateMergeableObjects(TString physSel, TString trigClassName, TString centrality);
154 TObjArray* BuildTriggerClasses(TString firedTrigClasses);
155
156 TObjArray* fSelectedTrigPattern; ///< List of triggers to be kept
157 TObjArray* fRejectedTrigPattern; ///< List of triggers to be rejected
158 TObjArray* fSelectedTrigLevel; ///< Track-trigger pt cut for selected trigger class
159 TObjArray* fOutputPrototypeList; //!< List of prototype object to be used in collection
160
12e33589 161 ClassDef(AliVAnalysisMuon, 3);
ac4edd2e 162};
163
164#endif