1 #ifndef ALIFORWARDMULTDIST_H
2 #define ALIFORWARDMULTDIST_H
4 * @file AliForwardMultDists.h
5 * @author Christian Holm Christensen <cholm@nbi.dk>
6 * @date Tue Nov 12 09:57:28 2013
8 * @brief Class to make raw @f$P(N_{ch})@f$ distributions
10 * @ingroup pwglf_forward_multdist
13 #include "AliBaseAODTask.h"
18 class AliAODForwardMult;
21 * Class to make raw @f$ P(N_{ch})@f$ distributions
23 * @ingroup pwglf_forward_multdist
25 class AliForwardMultDists : public AliBaseAODTask
29 /** Mark for invalid pseudo-rapidity */
33 * Histogram enumeration
40 /** MC-truth Triggered */
42 /** MC-truth w/vertex */
44 /** MC-truth triggered and w/vertex */
48 * Structure to define @f$\eta@f$ bins with an @f$ N_{ch}@f$ axis
55 * @param etaMin Low cut on @f$\eta@f$
56 * @param etaMax High cut on @f$\eta@f$
57 * @param nchLow Lowest @f$ N_{ch}@f$ (e.g., -0.5);
59 BinSpec(Double_t etaMin, Double_t etaMax, Double_t nchLow);
61 * Push @a n bins of with @a d in @f$ N_{ch}@f$ onto the axis
63 * If only a single push is done, then we will get an axis of
64 * equally sized bins (@a d) from @f$ l@f$ edge to @f$ nd+low@f$ -
65 * e.g., if one only does
68 * BinSpec b(e1, e2, -.5);
72 * One ends up with 10 bins from -0.5 to 9.5.
74 * @param n Number of bins to push
75 * @param d Bin width of each of the bins
77 void Push(UShort_t n, Double_t d);
79 * Get the axis computed from the setup using Push
81 * @return Reference to the axis
83 const TAxis& Axis() const;
84 Double_t fEtaMin; // Least pseudo-rapidity
85 Double_t fEtaMax; // Largest pseudo-rapidity
86 Double_t fLow; // Low cut
87 TArrayI fN; // Number of bins
88 TArrayD fD; // Bin widths
89 mutable TAxis fAxis; // Our axis
95 AliForwardMultDists();
99 * @param name Name of the task
101 AliForwardMultDists(const char* name);
105 virtual ~AliForwardMultDists() {}
108 * @name Interface memer functions
111 * Create output objects - called at start of job in slave
113 * @return true on success
117 * Set-up internal structures on first seen event
119 * @return true on success
123 * Executed before every event
125 * @return true on success
127 Bool_t PreEvent() { fIsSelected = false; return true; }
129 * Analyse a single event
131 * @param aod AOD Event
133 * @return true on success
135 Bool_t Event(AliAODEvent& aod);
137 * Called at the end of the final processing of the job on the
138 * full data set (merged data)
140 * @return true on success
146 * @name Bin definitions
149 * Add an @f$ \eta@f$ bin
151 * @param spec Bin specification
153 void AddBin(const BinSpec& spec);
155 * Add an @f$ \eta@f$ bin.
157 * @param etaLow Low cut on @f$\eta@f$
158 * @param etaMax High cut on @f$\eta@f$
159 * @param nAxis Axis to use for measured @f$ N_{ch}@f$
161 void AddBin(Double_t etaLow, Double_t etaMax, const TAxis& nAxis);
163 * Add an @f$\eta@f$ bin
165 * @param etaLow Low cut on @f$\eta@f$
166 * @param etaMax High cut on @f$\eta@f$
167 * @param nMax Maximum @f$ N_{ch}@f$
168 * @param nDiv Number of subdivisions per @f$ N_{ch}@f$
171 void AddBin(Double_t etaLow, Double_t etaMax, UShort_t nMax, UShort_t nDiv);
174 * Whether to use the stored phi acceptance
176 * @param use If true, use stored phi acceptance
178 void SetUsePhiAcc(Bool_t use) { fUsePhiAcc = use; }
182 * @param option Not used
184 void Print(Option_t* option="") const;
187 * Project a 2D histogram into a 1D histogram taking care to use
188 * either the @f$\phi@f$ acceptance stored in the overflow bins, or
189 * the @f$\eta@f$ coverage stored in the underflow bins.
191 * @param input 2D histogram to project
192 * @param cache 1D histogram to project into
193 * @param usePhiAcc If true, use the @f$\phi@f$ acceptance stored in
194 * the overflow bins, or if false the @f$\eta@f$ coverage stored in
195 * the underflow bins.
197 static void ProjectX(const TH2& input, TH1& cache, Bool_t usePhiAcc=true);
199 * Project on @f$\eta@f$ axis. If any of the pointers passed is
205 static void ProjectX(const TH2* input, TH1* cache);
209 struct EtaBin : public TObject
218 * @param minEta Least @f$\eta@f$ to consider
219 * @param maxEta Largest @f$\eta@f$ to consider
220 * @param mAxis The @f$ N_{ch}@f$ axis to use for measured data
222 EtaBin(Double_t minEta, Double_t maxEta, const TAxis& mAxis);
226 * @param o object to copy fron
228 EtaBin(const EtaBin& o);
230 * Assignment operator
232 * @param o object to assign from
234 * @return Reference to this object
236 EtaBin& operator=(const EtaBin& o);
242 * Get the name of the bin
244 const char* GetName() const { return fName.Data(); }
246 * Is this bin symmetric around 0?
248 Bool_t IsSymmetric() const;
250 * Is this bin positive only?
252 Bool_t IsNegative() const;
254 * Is this bin positive only?
256 Bool_t IsPositive() const;
258 * Get parent container name
261 * @return Parent container name
263 const char* ParentName() const;
265 * Find the parent container. if not found, and @a create is
266 * true, then make the container.
268 * @param l Top container
269 * @param create If true, create container if not found
271 * @return Container, or null
273 TList* FindParent(TList* l, Bool_t create=true) const;
275 * Create a 1D histogram with specified axis
277 * @param name Name of histogram
278 * @param title Title of histogram
279 * @param xAxis X-axis to use
281 * @return Created histogram
283 static TH1* CreateH1(const char* name, const char* title,
286 * Create a 2D histogram with specified axis
288 * @param name Name of histogram
289 * @param title Title of histogram
290 * @param xAxis X-axis to use
291 * @param yAxis Y-axis to use
293 * @return Created histogram
295 static TH2* CreateH2(const char* name, const char* title,
296 const TAxis& xAxis, const TAxis& yAxis);
298 * Set-up internal structures on first event.
300 * @param list List to add information to
301 * @param hist Template histogram
302 * @param useMC Whether to set-up for MC input
304 void SetupForData(TList* list, const TH2& hist, Bool_t useMC);
306 * Process a single event
308 * @param sumForward Projection of forward data
309 * @param sumCentral Projection of the central data
310 * @param forward The original forward data
311 * @param central The original central data
312 * @param accepted True if event is accepted for analysis
313 * @param mc Distribution of primary particles from MC
315 void Process(const TH1& sumForward, const TH1& sumCentral,
316 const TH2& forward, const TH2& central,
317 Bool_t accepted, const TH1* mc);
319 * Called at the end of the final processing of the job on the
320 * full data set (merged data)
322 * @param in Input list
323 * @param out Output list
325 void Terminate(TList* in, TList* out);
327 TString fName; // Name of this bin
328 TAxis fMAxis; // Axis used for measured Nch
329 TAxis fTAxis; // Axis used for true Nch
330 Double_t fMinEta; // Least @f$\eta@f$ to consider
331 Double_t fMaxEta; // Largest @f$\eta@f$ to consider
332 Int_t fMinBin; // Least @f$\eta@f$ bin to consider
333 Int_t fMaxBin; // Largest @f$\eta@f$ bin to consider
334 TH1* fSum; // Distribution
335 TH2* fCorr; // Correlation between forward and central
336 TH2* fResponse; // Response matrix (for MC)
337 TH1* fTruth; // `true' distribution
338 TH1* fTruthAccepted; // `true' distribution for accepted events
339 TH1* fCoverage; // How much was covered
346 * @param o object to copy fron
348 AliForwardMultDists(const AliForwardMultDists& o);
350 * Assignment operator
352 * @param o object to assign from
354 * @return Reference to this object
356 AliForwardMultDists& operator=(const AliForwardMultDists& o);
360 * @param fwd Forward data structure
362 * @return Always true
364 Bool_t CheckEvent(const AliAODForwardMult& fwd);
366 TList fBins; // List of bins
367 TList* fSymmetric; // Bins symmetric around 0
368 TList* fNegative; // Bins on negative side only
369 TList* fPositive; // Bins on the positive side only
370 TH1* fMCVertex; // Histogram of MC IpZ
371 TH2* fDiag; // Diagnostics
372 TH1* fForwardCache; // Projection cache
373 TH1* fCentralCache; // Projection cache
374 TH1* fMCCache; // Projection cache
375 Bool_t fUsePhiAcc; // If true, scale by phi acceptance
376 Bool_t fIsSelected; // IF the even was selected
378 ClassDef(AliForwardMultDists,1);