]>
Commit | Line | Data |
---|---|---|
b2e7f2d6 | 1 | //==================================================================== |
2 | #include "AliForwarddNdetaTask.h" | |
3 | #include <TMath.h> | |
4 | #include <TH2D.h> | |
5 | #include <TH1D.h> | |
6 | #include <THStack.h> | |
7 | #include <TList.h> | |
5bb5d1f6 | 8 | #include <TFile.h> |
b2e7f2d6 | 9 | #include <AliAnalysisManager.h> |
10 | #include <AliAODEvent.h> | |
11 | #include <AliAODHandler.h> | |
12 | #include <AliAODInputHandler.h> | |
13 | #include "AliForwardUtil.h" | |
01caf91f | 14 | #include "AliAODForwardMult.h" |
b2e7f2d6 | 15 | |
16 | //____________________________________________________________________ | |
17 | AliForwarddNdetaTask::AliForwarddNdetaTask() | |
e1f47419 | 18 | : AliBasedNdetaTask() |
fb3430ac | 19 | { |
20 | // | |
21 | // Constructor | |
22 | // | |
23 | } | |
b2e7f2d6 | 24 | |
25 | //____________________________________________________________________ | |
26 | AliForwarddNdetaTask::AliForwarddNdetaTask(const char* /* name */) | |
e1f47419 | 27 | : AliBasedNdetaTask("Forward") |
b2e7f2d6 | 28 | { |
fb3430ac | 29 | // |
30 | // Constructor | |
31 | // | |
32 | // Paramters | |
33 | // name Name of task | |
b2e7f2d6 | 34 | } |
35 | ||
36 | //____________________________________________________________________ | |
37 | AliForwarddNdetaTask::AliForwarddNdetaTask(const AliForwarddNdetaTask& o) | |
e1f47419 | 38 | : AliBasedNdetaTask(o) |
fb3430ac | 39 | { |
40 | // | |
41 | // Copy constructor | |
42 | // | |
43 | } | |
b2e7f2d6 | 44 | |
e1f47419 | 45 | //____________________________________________________________________ |
46 | AliBasedNdetaTask::CentralityBin* | |
47 | AliForwarddNdetaTask::MakeCentralityBin(const char* name, Short_t l, Short_t h) | |
48 | const | |
49 | { | |
50 | // | |
51 | // Make a new centrality bin | |
52 | // | |
53 | // Parameters: | |
54 | // name Histogram names | |
55 | // l Lower cut | |
56 | // h Upper cut | |
57 | // | |
58 | // Return: | |
59 | // Newly allocated object (of our type) | |
60 | // | |
61 | return new AliForwarddNdetaTask::CentralityBin(name, l, h); | |
62 | } | |
63 | ||
e1f47419 | 64 | |
b2e7f2d6 | 65 | //____________________________________________________________________ |
66 | TH2D* | |
fb3430ac | 67 | AliForwarddNdetaTask::GetHistogram(const AliAODEvent* aod, Bool_t mc) |
b2e7f2d6 | 68 | { |
fb3430ac | 69 | // |
70 | // Retrieve the histogram | |
71 | // | |
72 | // Parameters: | |
73 | // aod AOD event | |
74 | // mc Whether to get the MC histogram or not | |
75 | // | |
76 | // Return: | |
77 | // Retrieved histogram or null | |
78 | // | |
fe52e455 | 79 | TObject* obj = 0; |
80 | if (mc) obj = aod->FindListObject("ForwardMC"); | |
81 | else obj = aod->FindListObject("Forward"); | |
b2e7f2d6 | 82 | |
83 | // We should have a forward object at least | |
fe52e455 | 84 | if (!obj) { |
85 | if (!mc) AliWarning("No Forward object found AOD"); | |
86 | return 0; | |
87 | } | |
88 | AliAODForwardMult* forward = static_cast<AliAODForwardMult*>(obj); | |
e1f47419 | 89 | return &(forward->GetHistogram()); |
90 | } | |
fe52e455 | 91 | |
e1f47419 | 92 | //======================================================================== |
93 | void | |
e1f47419 | 94 | AliForwarddNdetaTask::CentralityBin::End(TList* sums, |
95 | TList* results, | |
ffca499d | 96 | UShort_t scheme, |
e1f47419 | 97 | const TH1* shapeCorr, |
98 | Double_t trigEff, | |
99 | Bool_t symmetrice, | |
100 | Int_t rebin, | |
c25b5e1b | 101 | Bool_t rootProj, |
e1f47419 | 102 | Bool_t corrEmpty, |
c25b5e1b | 103 | Bool_t cutEdges, |
ffca499d | 104 | Int_t triggerMask, |
9ecab72f | 105 | Int_t marker, |
c89b9ac1 | 106 | Int_t color, |
107 | TList* mclist, | |
108 | TList* truthlist ) | |
b2e7f2d6 | 109 | { |
c25b5e1b | 110 | AliInfo(Form("In End of %s with corrEmpty=%d, cutEdges=%d, rootProj=%d", |
111 | GetName(), corrEmpty, cutEdges, rootProj)); | |
ffca499d | 112 | AliBasedNdetaTask::CentralityBin::End(sums, results, scheme, |
113 | shapeCorr, trigEff, | |
c25b5e1b | 114 | symmetrice, rebin, |
115 | rootProj, corrEmpty, cutEdges, | |
c89b9ac1 | 116 | triggerMask, marker, color, mclist, truthlist); |
5bb5d1f6 | 117 | |
118 | if (!IsAllBin()) return; | |
119 | TFile* file = TFile::Open("forward.root", "READ"); | |
120 | if (!file) return; | |
121 | ||
122 | TList* forward = static_cast<TList*>(file->Get("Forward")); | |
123 | if (!forward) { | |
124 | AliError("List Forward not found in forward.root"); | |
125 | return; | |
126 | } | |
127 | TList* rings = static_cast<TList*>(forward->FindObject("ringResults")); | |
128 | if (!rings) { | |
129 | AliError("List ringResults not found in forward.root"); | |
130 | return; | |
131 | } | |
132 | THStack* res = static_cast<THStack*>(rings->FindObject("all")); | |
133 | if (!res) { | |
134 | AliError(Form("Stack all not found in %s", rings->GetName())); | |
135 | return; | |
136 | } | |
137 | if (!fTriggers) { | |
138 | AliError("Triggers histogram not set"); | |
139 | return; | |
140 | } | |
141 | Double_t ntotal = 0; | |
142 | Double_t epsilonT = trigEff; | |
143 | // TEMPORARY FIX | |
144 | if (triggerMask == AliAODForwardMult::kNSD) { | |
145 | // This is a local change | |
146 | epsilonT = 0.92; | |
147 | AliWarning(Form("Using hard-coded NSD trigger efficiency of %f",epsilonT)); | |
148 | } | |
149 | AliInfo("Adding per-ring histograms to output"); | |
150 | Double_t scaler = Normalization(*fTriggers, scheme, epsilonT, ntotal); | |
151 | TIter next(res->GetHists()); | |
152 | TH1* hist = 0; | |
153 | while ((hist = static_cast<TH1*>(next()))) hist->Scale(scaler); | |
154 | res->SetName("dndetaRings"); | |
155 | fOutput->Add(res); | |
b2e7f2d6 | 156 | } |
157 | ||
158 | //________________________________________________________________________ | |
fe52e455 | 159 | // |
160 | // EOF | |
161 | // |