1 #ifndef ALIFORWARDMULTDIST_H
2 #define ALIFORWARDMULTDIST_H
3 #include "AliBaseAODTask.h"
8 class AliAODForwardMult;
11 * Class to make raw @f$P(N_{ch})@f$ distributions
14 class AliForwardMultDists : public AliBaseAODTask
28 * Structure to define @f$\eta@f$ bins with an @f$ N_{ch}@f$ axis
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);
40 BinSpec(Double_t etaMin, Double_t etaMax, Double_t nchLow);
42 * Push @a n bins of with @a d in @f$ N_{ch}@f$ onto the axis
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
49 * BinSpec b(e1, e2, -.5);
53 * One ends up with 10 bins from -0.5 to 9.5.
55 * @param n Number of bins to push
56 * @param d Bin width of each of the bins
58 void Push(UShort_t n, Double_t d);
60 * Get the axis computed from the setup using Push
62 * @return Reference to the axis
64 const TAxis& Axis() const;
76 AliForwardMultDists();
80 * @param name Name of the task
82 AliForwardMultDists(const char* name);
86 virtual ~AliForwardMultDists() {}
88 * Create output objects - called at start of job in slave
90 * @return true on success
94 * Set-up internal structures on first seen event
96 * @return true on success
100 * Executed before every event
102 * @return true on success
104 Bool_t PreEvent() { fIsSelected = false; return true; }
106 * Analyse a single event
108 * @param aod AOD Event
110 * @return true on success
112 Bool_t Event(AliAODEvent& aod);
114 * Called at the end of the final processing of the job on the
115 * full data set (merged data)
117 * @return true on success
121 * Add an @f$\eta@f$ bin
123 * @param spec Bin specification
125 void AddBin(const BinSpec& spec);
127 * Add an @f$\eta@f$ bin
129 * @param etaLow Low cut on @f$\eta@f$
130 * @param etaMax High cut on @f$\eta@f$
131 * @param nAxis Axis to use for measured @f$ N_{ch}@f$
134 void AddBin(Double_t etaLow, Double_t etaMax, const TAxis& nAxis);
136 * Add an @f$\eta@f$ bin
138 * @param etaLow Low cut on @f$\eta@f$
139 * @param etaMax High cut on @f$\eta@f$
140 * @param nMax Maximum @f$ N_{ch}@f$
141 * @param nDiv Number of subdivisions per @f$ N_{ch}@f$
144 void AddBin(Double_t etaLow, Double_t etaMax, UShort_t nMax, UShort_t nDiv);
146 * Whether to use the stored phi acceptance
148 * @param use If true, use stored phi acceptance
150 void SetUsePhiAcc(Bool_t use) { fUsePhiAcc = use; }
154 * @param option Not used
156 void Print(Option_t* option="") const;
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.
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.
169 static void ProjectX(const TH2& input, TH1& cache, Bool_t usePhiAcc=true);
171 * Project on @f$\eta@f$ axis. If any of the pointers passed is
177 static void ProjectX(const TH2* input, TH1* cache);
181 struct EtaBin : public TObject
190 * @param minEta Least @f$\eta@f$ to consider
191 * @param maxEta Largest @f$\eta@f$ to consider
192 * @param mAxis The @f$ N_{ch}@f$ axis to use for measured data
194 EtaBin(Double_t minEta, Double_t maxEta, const TAxis& mAxis);
198 * @param o object to copy fron
200 EtaBin(const EtaBin& o);
202 * Assignment operator
204 * @param o object to assign from
206 * @return Reference to this object
208 EtaBin& operator=(const EtaBin& o);
214 * Get the name of the bin
216 const char* GetName() const { return fName.Data(); }
218 * Is this bin symmetric around 0?
220 Bool_t IsSymmetric() const;
222 * Is this bin positive only?
224 Bool_t IsNegative() const;
226 * Is this bin positive only?
228 Bool_t IsPositive() const;
230 * Get parent container name
233 * @return Parent container name
235 const char* ParentName() const;
237 * Find the parent container. if not found, and @a create is
238 * true, then make the container.
240 * @param l Top container
241 * @param create If true, create container if not found
243 * @return Container, or null
245 TList* FindParent(TList* l, Bool_t create=true) const;
247 * Create a 1D histogram with specified axis
249 * @param name Name of histogram
250 * @param title Title of histogram
251 * @param xAxis X-axis to use
253 * @return Created histogram
255 static TH1* CreateH1(const char* name, const char* title,
258 * Create a 2D histogram with specified axis
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
265 * @return Created histogram
267 static TH2* CreateH2(const char* name, const char* title,
268 const TAxis& xAxis, const TAxis& yAxis);
270 * Set-up internal structures on first event.
272 * @param list List to add information to
273 * @param hist Template histogram
274 * @param useMC Whether to set-up for MC input
276 void SetupForData(TList* list, const TH2& hist, Bool_t useMC);
278 * Process a single event
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
284 * @param accepted True if event is accepted for analysis
285 * @param mc Distribution of primary particles from MC
287 void Process(const TH1& sumForward, const TH1& sumCentral,
288 const TH2& forward, const TH2& central,
289 Bool_t accepted, const TH1* mc);
291 * Called at the end of the final processing of the job on the
292 * full data set (merged data)
294 * @param in Input list
295 * @param out Output list
297 void Terminate(TList* in, TList* out);
299 TString fName; // Name of this bin
300 TAxis fMAxis; // Axis used for measured Nch
301 TAxis fTAxis; // Axis used for true Nch
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
318 * @param o object to copy fron
320 AliForwardMultDists(const AliForwardMultDists& o);
322 * Assignment operator
324 * @param o object to assign from
326 * @return Reference to this object
328 AliForwardMultDists& operator=(const AliForwardMultDists& o);
332 * @param fwd Forward data structure
334 * @return Always true
336 Bool_t CheckEvent(const AliAODForwardMult& fwd);
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
342 TH1* fMCVertex; // Histogram of MC IpZ
343 TH2* fDiag; // Diagnostics
344 TH1* fForwardCache; // Projection cache
345 TH1* fCentralCache; // Projection cache
346 TH1* fMCCache; // Projection cache
347 Bool_t fUsePhiAcc; // If true, scale by phi acceptance
348 Bool_t fIsSelected; // IF the even was selected
350 ClassDef(AliForwardMultDists,1);