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