]>
Commit | Line | Data |
---|---|---|
bfab35d9 | 1 | #ifndef ALIFORWARDMULTDIST_H |
2 | #define ALIFORWARDMULTDIST_H | |
c8b1a7db | 3 | #include "AliBaseAODTask.h" |
bfab35d9 | 4 | #include <TList.h> |
5 | #include <TString.h> | |
6 | class TH1; | |
7 | class TH2; | |
8 | class AliAODForwardMult; | |
9 | ||
10 | /** | |
11 | * Class to make raw @f$P(N_{ch})@f$ distributions | |
12 | * | |
13 | */ | |
c8b1a7db | 14 | class AliForwardMultDists : public AliBaseAODTask |
bfab35d9 | 15 | { |
16 | public: | |
17 | enum { | |
18 | kInvalidEta = 999 | |
19 | }; | |
281a2bf8 | 20 | enum { |
21 | kAnalysis = 1, | |
22 | kMC = 2, | |
23 | kTrigger = 3, | |
24 | kVertex = 4, | |
25 | kTriggerVertex = 5 | |
26 | }; | |
52b36573 | 27 | /** |
28 | * Structure to define @f$\eta@f$ bins with an @f$ N_{ch}@f$ axis | |
29 | * | |
30 | */ | |
31 | struct BinSpec | |
32 | { | |
33 | /** | |
34 | * Constructor | |
35 | * | |
36 | * @param etaMin Low cut on @f$\eta@f$ | |
37 | * @param etaMax High cut on @f$\eta@f$ | |
38 | * @param nchLow Lowest @f$ N_{ch}@f$ (e.g., -0.5); | |
39 | */ | |
40 | BinSpec(Double_t etaMin, Double_t etaMax, Double_t nchLow); | |
41 | /** | |
42 | * Push @a n bins of with @a d in @f$ N_{ch}@f$ onto the axis | |
43 | * | |
44 | * If only a single push is done, then we will get an axis of | |
45 | * equally sized bins (@a d) from @f$ l@f$ edge to @f$ nd+low@f$ - | |
46 | * e.g., if one only does | |
47 | * | |
48 | * @code | |
49 | * BinSpec b(e1, e2, -.5); | |
50 | * b.Push(10, 1); | |
51 | * @endcode | |
52 | * | |
53 | * One ends up with 10 bins from -0.5 to 9.5. | |
54 | * | |
55 | * @param n Number of bins to push | |
56 | * @param d Bin width of each of the bins | |
57 | */ | |
58 | void Push(UShort_t n, Double_t d); | |
59 | /** | |
60 | * Get the axis computed from the setup using Push | |
61 | * | |
62 | * @return Reference to the axis | |
63 | */ | |
64 | const TAxis& Axis() const; | |
65 | Double_t fEtaMin; | |
66 | Double_t fEtaMax; | |
67 | Double_t fLow; | |
68 | TArrayI fN; | |
69 | TArrayD fD; | |
70 | mutable TAxis fAxis; | |
71 | }; | |
72 | ||
bfab35d9 | 73 | /** |
74 | * Default constructor | |
75 | */ | |
76 | AliForwardMultDists(); | |
77 | /** | |
78 | * User constructor | |
79 | * | |
80 | * @param name Name of the task | |
81 | */ | |
82 | AliForwardMultDists(const char* name); | |
bfab35d9 | 83 | /** |
84 | * Destructor | |
85 | */ | |
86 | virtual ~AliForwardMultDists() {} | |
87 | /** | |
88 | * Create output objects - called at start of job in slave | |
89 | * | |
c8b1a7db | 90 | * @return true on success |
bfab35d9 | 91 | */ |
c8b1a7db | 92 | Bool_t Book(); |
bfab35d9 | 93 | /** |
c8b1a7db | 94 | * Set-up internal structures on first seen event |
bfab35d9 | 95 | * |
c8b1a7db | 96 | * @return true on success |
bfab35d9 | 97 | */ |
c8b1a7db | 98 | Bool_t PreData(); |
bfab35d9 | 99 | /** |
c8b1a7db | 100 | * Executed before every event |
bfab35d9 | 101 | * |
c8b1a7db | 102 | * @return true on success |
bfab35d9 | 103 | */ |
c8b1a7db | 104 | Bool_t PreEvent() { fIsSelected = false; return true; } |
bfab35d9 | 105 | /** |
c8b1a7db | 106 | * Analyse a single event |
bfab35d9 | 107 | * |
c8b1a7db | 108 | * @param aod AOD Event |
109 | * | |
110 | * @return true on success | |
bfab35d9 | 111 | */ |
c8b1a7db | 112 | Bool_t Event(AliAODEvent& aod); |
bfab35d9 | 113 | /** |
c8b1a7db | 114 | * Called at the end of the final processing of the job on the |
115 | * full data set (merged data) | |
bfab35d9 | 116 | * |
c8b1a7db | 117 | * @return true on success |
bfab35d9 | 118 | */ |
c8b1a7db | 119 | Bool_t Finalize(); |
52b36573 | 120 | /** |
121 | * Add an @f$\eta@f$ bin | |
122 | * | |
123 | * @param spec Bin specification | |
124 | */ | |
125 | void AddBin(const BinSpec& spec); | |
bfab35d9 | 126 | /** |
127 | * Add an @f$\eta@f$ bin | |
128 | * | |
c8b1a7db | 129 | * @param etaLow Low cut on @f$\eta@f$ |
130 | * @param etaMax High cut on @f$\eta@f$ | |
52b36573 | 131 | * @param nAxis Axis to use for measured @f$ N_{ch}@f$ |
c8b1a7db | 132 | * |
bfab35d9 | 133 | */ |
52b36573 | 134 | void AddBin(Double_t etaLow, Double_t etaMax, const TAxis& nAxis); |
bfab35d9 | 135 | /** |
52b36573 | 136 | * Add an @f$\eta@f$ bin |
bfab35d9 | 137 | * |
c8b1a7db | 138 | * @param etaLow Low cut on @f$\eta@f$ |
139 | * @param etaMax High cut on @f$\eta@f$ | |
52b36573 | 140 | * @param nMax Maximum @f$ N_{ch}@f$ |
141 | * @param nDiv Number of subdivisions per @f$ N_{ch}@f$ | |
c8b1a7db | 142 | * |
bfab35d9 | 143 | */ |
52b36573 | 144 | void AddBin(Double_t etaLow, Double_t etaMax, UShort_t nMax, UShort_t nDiv); |
bfab35d9 | 145 | /** |
146 | * Whether to use the stored phi acceptance | |
147 | * | |
148 | * @param use If true, use stored phi acceptance | |
149 | */ | |
150 | void SetUsePhiAcc(Bool_t use) { fUsePhiAcc = use; } | |
151 | /** | |
152 | * Print this task | |
153 | * | |
154 | * @param option Not used | |
155 | */ | |
156 | void Print(Option_t* option="") const; | |
c8b1a7db | 157 | protected: |
158 | /** | |
159 | * Project a 2D histogram into a 1D histogram taking care to use | |
160 | * either the @f$\phi@f$ acceptance stored in the overflow bins, or | |
161 | * the @f$\eta@f$ coverage stored in the underflow bins. | |
162 | * | |
163 | * @param input 2D histogram to project | |
164 | * @param cache 1D histogram to project into | |
165 | * @param usePhiAcc If true, use the @f$\phi@f$ acceptance stored in | |
166 | * the overflow bins, or if false the @f$\eta@f$ coverage stored in | |
167 | * the underflow bins. | |
168 | */ | |
169 | static void ProjectX(const TH2& input, TH1& cache, Bool_t usePhiAcc=true); | |
170 | /** | |
171 | * Project on @f$\eta@f$ axis. If any of the pointers passed is | |
172 | * zero, do nothing. | |
173 | * | |
174 | * @param input | |
175 | * @param cache | |
176 | */ | |
177 | static void ProjectX(const TH2* input, TH1* cache); | |
bfab35d9 | 178 | /** |
179 | * An @f$\eta@f$ bin | |
180 | */ | |
181 | struct EtaBin : public TObject | |
182 | { | |
183 | /** | |
184 | * I/O constructor | |
185 | */ | |
186 | EtaBin(); | |
187 | /** | |
188 | * User constructor | |
189 | * | |
190 | * @param minEta Least @f$\eta@f$ to consider | |
191 | * @param maxEta Largest @f$\eta@f$ to consider | |
c8b1a7db | 192 | * @param mAxis The @f$ N_{ch}@f$ axis to use for measured data |
bfab35d9 | 193 | */ |
52b36573 | 194 | EtaBin(Double_t minEta, Double_t maxEta, const TAxis& mAxis); |
bfab35d9 | 195 | /** |
196 | * Copy constructor | |
197 | * | |
198 | * @param o object to copy fron | |
199 | */ | |
200 | EtaBin(const EtaBin& o); | |
201 | /** | |
202 | * Assignment operator | |
203 | * | |
204 | * @param o object to assign from | |
205 | * | |
206 | * @return Reference to this object | |
207 | */ | |
208 | EtaBin& operator=(const EtaBin& o); | |
209 | /** | |
210 | * Destructor | |
211 | */ | |
212 | virtual ~EtaBin() {} | |
213 | /** | |
214 | * Get the name of the bin | |
215 | */ | |
216 | const char* GetName() const { return fName.Data(); } | |
217 | /** | |
218 | * Is this bin symmetric around 0? | |
219 | */ | |
220 | Bool_t IsSymmetric() const; | |
221 | /** | |
222 | * Is this bin positive only? | |
223 | */ | |
224 | Bool_t IsNegative() const; | |
225 | /** | |
226 | * Is this bin positive only? | |
227 | */ | |
228 | Bool_t IsPositive() const; | |
229 | /** | |
230 | * Get parent container name | |
231 | * | |
232 | * | |
233 | * @return Parent container name | |
234 | */ | |
235 | const char* ParentName() const; | |
236 | /** | |
237 | * Find the parent container. if not found, and @a create is | |
238 | * true, then make the container. | |
239 | * | |
240 | * @param l Top container | |
241 | * @param create If true, create container if not found | |
242 | * | |
243 | * @return Container, or null | |
244 | */ | |
245 | TList* FindParent(TList* l, Bool_t create=true) const; | |
52b36573 | 246 | /** |
247 | * Create a 1D histogram with specified axis | |
248 | * | |
249 | * @param name Name of histogram | |
250 | * @param title Title of histogram | |
251 | * @param xAxis X-axis to use | |
252 | * | |
253 | * @return Created histogram | |
254 | */ | |
255 | static TH1* CreateH1(const char* name, const char* title, | |
256 | const TAxis& xAxis); | |
257 | /** | |
258 | * Create a 2D histogram with specified axis | |
259 | * | |
260 | * @param name Name of histogram | |
261 | * @param title Title of histogram | |
262 | * @param xAxis X-axis to use | |
263 | * @param yAxis Y-axis to use | |
264 | * | |
265 | * @return Created histogram | |
266 | */ | |
267 | static TH2* CreateH2(const char* name, const char* title, | |
268 | const TAxis& xAxis, const TAxis& yAxis); | |
bfab35d9 | 269 | /** |
270 | * Set-up internal structures on first event. | |
271 | * | |
272 | * @param list List to add information to | |
273 | * @param hist Template histogram | |
bfab35d9 | 274 | * @param useMC Whether to set-up for MC input |
275 | */ | |
52b36573 | 276 | void SetupForData(TList* list, const TH2& hist, Bool_t useMC); |
bfab35d9 | 277 | /** |
278 | * Process a single event | |
279 | * | |
280 | * @param sumForward Projection of forward data | |
281 | * @param sumCentral Projection of the central data | |
282 | * @param forward The original forward data | |
283 | * @param central The original central data | |
281a2bf8 | 284 | * @param accepted True if event is accepted for analysis |
285 | * @param mc Distribution of primary particles from MC | |
bfab35d9 | 286 | */ |
287 | void Process(const TH1& sumForward, const TH1& sumCentral, | |
288 | const TH2& forward, const TH2& central, | |
281a2bf8 | 289 | Bool_t accepted, const TH1* mc); |
bfab35d9 | 290 | /** |
291 | * Called at the end of the final processing of the job on the | |
292 | * full data set (merged data) | |
293 | * | |
294 | * @param in Input list | |
295 | * @param out Output list | |
bfab35d9 | 296 | */ |
52b36573 | 297 | void Terminate(TList* in, TList* out); |
bfab35d9 | 298 | |
281a2bf8 | 299 | TString fName; // Name of this bin |
52b36573 | 300 | TAxis fMAxis; // Axis used for measured Nch |
301 | TAxis fTAxis; // Axis used for true Nch | |
281a2bf8 | 302 | Double_t fMinEta; // Least @f$\eta@f$ to consider |
303 | Double_t fMaxEta; // Largest @f$\eta@f$ to consider | |
304 | Int_t fMinBin; // Least @f$\eta@f$ bin to consider | |
305 | Int_t fMaxBin; // Largest @f$\eta@f$ bin to consider | |
306 | TH1* fSum; // Distribution | |
307 | TH2* fCorr; // Correlation between forward and central | |
308 | TH2* fResponse; // Response matrix (for MC) | |
309 | TH1* fTruth; // `true' distribution | |
310 | TH1* fTruthAccepted; // `true' distribution for accepted events | |
311 | TH1* fCoverage; // How much was covered | |
bfab35d9 | 312 | |
52b36573 | 313 | ClassDef(EtaBin,2); |
bfab35d9 | 314 | }; |
c8b1a7db | 315 | /** |
316 | * Copy constructor | |
317 | * | |
318 | * @param o object to copy fron | |
319 | */ | |
320 | AliForwardMultDists(const AliForwardMultDists& o); | |
321 | /** | |
322 | * Assignment operator | |
323 | * | |
324 | * @param o object to assign from | |
325 | * | |
326 | * @return Reference to this object | |
327 | */ | |
328 | AliForwardMultDists& operator=(const AliForwardMultDists& o); | |
329 | /** | |
330 | * Check the event | |
331 | * | |
332 | * @param fwd Forward data structure | |
333 | * | |
334 | * @return Always true | |
335 | */ | |
336 | Bool_t CheckEvent(const AliAODForwardMult& fwd); | |
337 | ||
bfab35d9 | 338 | TList fBins; // List of bins |
339 | TList* fSymmetric; // Bins symmetric around 0 | |
340 | TList* fNegative; // Bins on negative side only | |
341 | TList* fPositive; // Bins on the positive side only | |
281a2bf8 | 342 | TH1* fMCVertex; // Histogram of MC IpZ |
343 | TH2* fDiag; // Diagnostics | |
bfab35d9 | 344 | TH1* fForwardCache; // Projection cache |
345 | TH1* fCentralCache; // Projection cache | |
346 | TH1* fMCCache; // Projection cache | |
bfab35d9 | 347 | Bool_t fUsePhiAcc; // If true, scale by phi acceptance |
c8b1a7db | 348 | Bool_t fIsSelected; // IF the even was selected |
bfab35d9 | 349 | |
350 | ClassDef(AliForwardMultDists,1); | |
351 | }; | |
352 | ||
353 | #endif | |
354 | // Local Variables: | |
355 | // mode: C++ | |
356 | // End: | |
357 | ||
358 |