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