]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGLF/RESONANCES/AliRsnMiniAnalysisTask.h
-add trigger mask variables
[u/mrichter/AliRoot.git] / PWGLF / RESONANCES / AliRsnMiniAnalysisTask.h
CommitLineData
af61092c 1#ifndef ALIRSNMINIANALYSISTASK_H
2#define ALIRSNMINIANALYSISTASK_H
3
4//
5// Analysis task for 'mini' sub-package
6// Contains all definitions needed for running an analysis:
7// -- global event cut
8// -- a list of track cuts (any number)
9// -- definitions of output histograms
10// -- values to be computed.
11//
12
13#include <TString.h>
14#include <TClonesArray.h>
15
16#include "AliAnalysisTaskSE.h"
17
18#include "AliRsnEvent.h"
19#include "AliRsnMiniValue.h"
20#include "AliRsnMiniOutput.h"
21
22class TList;
23
24class AliTriggerAnalysis;
25class AliRsnMiniEvent;
26class AliRsnCutSet;
27
28class AliRsnMiniAnalysisTask : public AliAnalysisTaskSE {
29
30public:
31
32 AliRsnMiniAnalysisTask();
33 AliRsnMiniAnalysisTask(const char *name, Bool_t isMC = kFALSE);
34 AliRsnMiniAnalysisTask(const AliRsnMiniAnalysisTask &copy);
35 AliRsnMiniAnalysisTask &operator=(const AliRsnMiniAnalysisTask &copy);
36 virtual ~AliRsnMiniAnalysisTask();
37
38 void UseMC(Bool_t yn = kTRUE) {fUseMC = yn;}
39 void UseCentrality(const char *type) {fUseCentrality = kTRUE; fCentralityType = type; fCentralityType.ToUpper();}
40 void SetUseCentralityPatch(Bool_t isAOD049) {fUseAOD049CentralityPatch = isAOD049;}
41 void UseMultiplicity(const char *type) {fUseCentrality = kFALSE; fCentralityType = type; fCentralityType.ToUpper();}
42 void UseContinuousMix() {fContinuousMix = kTRUE;}
43 void UseBinnedMix() {fContinuousMix = kFALSE;}
44 void SetNMix(Int_t nmix) {fNMix = nmix;}
45 void SetMaxDiffMult (Double_t val) {fMaxDiffMult = val;}
46 void SetMaxDiffVz (Double_t val) {fMaxDiffVz = val;}
47 void SetMaxDiffAngle(Double_t val) {fMaxDiffAngle = val;}
48 void SetEventCuts(AliRsnCutSet *cuts) {fEventCuts = cuts;}
49 void SetMixPrintRefresh(Int_t n) {fMixPrintRefresh = n;}
50 Int_t AddTrackCuts(AliRsnCutSet *cuts);
51 TClonesArray *Outputs() {return &fHistograms;}
52 TClonesArray *Values() {return &fValues;}
53 void SetEventQAHist(TString type,TH2F *histo);
54 void UseBigOutput(Bool_t b=kTRUE) { fBigOutput = b; }
55
56 virtual void UserCreateOutputObjects();
57 virtual void UserExec(Option_t *);
58 virtual void Terminate(Option_t *);
59 virtual void FinishTaskOutput();
60
61 Int_t ValueID(AliRsnMiniValue::EType type, Bool_t useMC = kFALSE);
62 Int_t CreateValue(AliRsnMiniValue::EType type, Bool_t useMC = kFALSE);
63 AliRsnMiniOutput *CreateOutput(const char *name, AliRsnMiniOutput::EOutputType type, AliRsnMiniOutput::EComputation src);
64 AliRsnMiniOutput *CreateOutput(const char *name, const char *outType, const char *compType);
65
66private:
67
68 Char_t CheckCurrentEvent();
69 void FillMiniEvent(Char_t evType);
70 Double_t ComputeAngle();
71 Double_t ComputeCentrality(Bool_t isESD);
72 Double_t ComputeMultiplicity(Bool_t isESD,TString type);
73 Double_t ApplyCentralityPatchAOD049();
74 void FillTrueMotherESD(AliRsnMiniEvent *event);
75 void FillTrueMotherAOD(AliRsnMiniEvent *event);
76 void StoreTrueMother(AliRsnMiniPair *pair, AliRsnMiniEvent *event);
77 Bool_t EventsMatch(AliRsnMiniEvent *event1, AliRsnMiniEvent *event2);
78
79 Bool_t fUseMC; // use or not MC info
80 Int_t fEvNum; //! absolute event counter
81 Bool_t fUseCentrality; // if true, use centrality for event, otherwise use multiplicity
82 TString fCentralityType; // definition used to choose what centrality or multiplicity to use
83 Bool_t fUseAOD049CentralityPatch; //flag to enable AOD049 centrality patch
84
85 Bool_t fContinuousMix; // mixing --> technique chosen (continuous or binned)
86 Int_t fNMix; // mixing --> required number of mixes
87 Double_t fMaxDiffMult; // mixing --> max difference in multiplicity
88 Double_t fMaxDiffVz; // mixing --> max difference in Vz of prim vert
89 Double_t fMaxDiffAngle; // mixing --> max difference in reaction plane angle
90
91 TList *fOutput; // output list
92 TClonesArray fHistograms; // list of histogram definitions
93 TClonesArray fValues; // list of values to be computed
94 TH1F *fHEventStat; // histogram of event statistics
95 TH1F *fHAEventsVsMulti; // histogram of event statistics
96 TH2F *fHAEventVz; // histogram of vertex-z vs. multiplicity/centrality
97 TH2F *fHAEventMultiCent;// histogram of multiplicity vs. centrality
98 TH2F *fHAEventPlane; // histogram of event plane vs. multiplicity/centrality
99
100 AliRsnCutSet *fEventCuts; // cuts on events
101 TObjArray fTrackCuts; // list of single track cuts
102 AliRsnEvent fRsnEvent; //! interface object to the event
103 TTree *fEvBuffer; //! mini-event buffer
104 AliTriggerAnalysis *fTriggerAna; //! trigger analysis
105 AliESDtrackCuts *fESDtrackCuts; //! quality cut for ESD tracks
106 AliRsnMiniEvent *fMiniEvent; //! mini-event cursor
107 Bool_t fBigOutput; // flag if open file for output list
108 Int_t fMixPrintRefresh; // how often info in mixing part is printed
109
110 ClassDef(AliRsnMiniAnalysisTask, 5); // AliRsnMiniAnalysisTask
111};
112
113inline Int_t AliRsnMiniAnalysisTask::CreateValue(AliRsnMiniValue::EType type, Bool_t useMC)
114{
115//
116// Create a new value in the task,
117// and returns its ID, which is needed for setting up histograms.
118// If that value was already initialized, returns its ID and does not recreate it.
119//
120
121 Int_t valID = ValueID(type, useMC);
122 if (valID >= 0 && valID < fValues.GetEntries()) {
123 AliInfo(Form("Value '%s' is already created in slot #%d", AliRsnMiniValue::ValueName(type, useMC), valID));
124 } else {
125 valID = fValues.GetEntries();
126 AliInfo(Form("Creating value '%s' in slot #%d", AliRsnMiniValue::ValueName(type, useMC), valID));
127 new (fValues[valID]) AliRsnMiniValue(type, useMC);
128 }
129
130 return valID;
131}
132
133inline Int_t AliRsnMiniAnalysisTask::ValueID(AliRsnMiniValue::EType type, Bool_t useMC)
134{
135//
136// Searches if a value computation is initialized
137//
138
139 const char *name = AliRsnMiniValue::ValueName(type, useMC);
140 TObject *obj = fValues.FindObject(name);
141 if (obj)
142 return fValues.IndexOf(obj);
143 else
144 return -1;
145}
146
147inline AliRsnMiniOutput *AliRsnMiniAnalysisTask::CreateOutput
148(const char *name, AliRsnMiniOutput::EOutputType type, AliRsnMiniOutput::EComputation src)
149{
150//
151// Create a new histogram definition in the task,
152// which is then returned to the user for its configuration
153//
154
155 Int_t n = fHistograms.GetEntries();
156 AliRsnMiniOutput *newDef = new (fHistograms[n]) AliRsnMiniOutput(name, type, src);
157
158 return newDef;
159}
160
161inline AliRsnMiniOutput *AliRsnMiniAnalysisTask::CreateOutput
162(const char *name, const char *outType, const char *compType)
163{
164//
165// Create a new histogram definition in the task,
166// which is then returned to the user for its configuration
167//
168
169 Int_t n = fHistograms.GetEntries();
170 AliRsnMiniOutput *newDef = new (fHistograms[n]) AliRsnMiniOutput(name, outType, compType);
171
172 return newDef;
173}
174#endif