]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/FORWARD/analysis2/AliFMDMCTrackInspector.h
Merge branch 'master' of https://git.cern.ch/reps/AliRoot
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / analysis2 / AliFMDMCTrackInspector.h
1 #ifndef ALIFMDMCTRACKINSPECTOR_H
2 #define ALIFMDMCTRACKINSPECTOR_H
3 #include "AliFMDEnergyFitter.h"
4 #include "AliFMDMCTrackELoss.h"
5 #include <TArrayF.h>
6 class AliMCEvent;
7 class AliESDEvent;
8
9 /**
10  * Class to fit the simulated energy loss in the FMD
11  * 
12  * @ingroup pwglf_forward_mc
13  * @ingroup pwglf_forward_eloss
14  */
15 class AliFMDMCTrackInspector : public AliFMDEnergyFitter
16 {
17 public:
18   /** 
19    * Constructor - do not use
20    */
21   AliFMDMCTrackInspector();
22   /** 
23    * Constructor 
24    * 
25    * @param title    Title of object - not significant 
26    */
27   AliFMDMCTrackInspector(const char* title);
28   /**
29    * Destructor
30    */
31   virtual ~AliFMDMCTrackInspector();
32
33   /** 
34    * Define the output histograms.  These are put in a sub list of the
35    * passed list.   The histograms are merged before the parent task calls 
36    * AliAnalysisTaskSE::Terminate 
37    * 
38    * @param dir Directory to add to 
39    */
40   virtual void CreateOutputObjects(TList* dir);
41   /** 
42    * Set-up before processing an event 
43    * 
44    * @param mcInput MC input 
45    * 
46    * @return true
47    */
48   virtual Bool_t PreEvent(const AliMCEvent& mcInput);
49   /** 
50    * Process a single event 
51    * 
52    * @param esdInput ESD input 
53    * @param mcInput  MC input
54    * @param cent     Event centrality 
55    * 
56    * @return true
57    */
58   virtual Bool_t Event(const AliESDEvent&  esdInput,
59                        const AliMCEvent&   mcInput,
60                        Double_t            cent=-1);
61   /** 
62    * Post-process accumulated signals 
63    * 
64    * @return true 
65    */
66   virtual Bool_t PostEvent();
67
68   /** 
69    * Get reference to the tracker of energy loss 
70    * 
71    * @return Reference to tracker of energy loss 
72    */  
73   AliFMDMCTrackELoss& GetTracker() { return fTracker; }
74   /** 
75    * Get constant reference to the tracker of energy loss 
76    * 
77    * @return Constant reference to tracker of energy loss 
78    */  
79   const AliFMDMCTrackELoss& GetTracker() const { return fTracker; }
80 protected:
81   /**
82    * copy constructor - not implemented
83    */
84   AliFMDMCTrackInspector(const AliFMDMCTrackInspector&);
85   /**
86    * Assignment operator - not implemented
87    * 
88    */
89   AliFMDMCTrackInspector& operator=(const AliFMDMCTrackInspector&);
90
91   /**
92    * Container of ring histograms 
93    * 
94    */
95 public:
96   struct RingHistos : public AliFMDEnergyFitter::RingHistos
97   {
98     /** 
99      * Default CTOR - do not use 
100      */
101     RingHistos();
102     /** 
103      * User CTOR 
104      * 
105      * @param d Detector number 
106      * @param r Ring identifier 
107      */
108     RingHistos(UShort_t d, Char_t r);
109     /** 
110      * DTOR
111      */
112     ~RingHistos() {}
113     /** 
114      * Copy constructor - not defined
115      * 
116      * @param o Object to copy from 
117      */
118     RingHistos(const RingHistos& o);
119     /** 
120      * Assignment operator  - not defined
121      * 
122      * @param o Object to assign from 
123      * 
124      * @return Reference to this 
125      */
126     RingHistos& operator=(const RingHistos& o);
127     /** 
128      * Create a bin array of increasing bins. This overload uses the
129      * service AliFMDEncodedEdx::Spec::FillBinArray. 
130      * 
131      * @param nBins Number of bins - ignored
132      * @param low   Low cut - ignored
133      * @param high  High cut - ignored
134      * 
135      * @return Array of bin boundaries 
136      */
137     TArrayD MakeIncreasingAxis(Int_t nBins, 
138                                Double_t low,
139                                Double_t high) const;
140     /** 
141      * Initialise object 
142      * 
143      * @param eAxis      Eta axis
144      * @param cAxis      Centrality axis 
145      * @param maxDE      Max energy loss to consider 
146      * @param nDEbins    Number of bins 
147      * @param useIncrBin Whether to use an increasing bin size 
148      */
149     virtual void SetupForData(const TAxis& eAxis, 
150                               const TAxis& cAxis,
151                               Double_t     maxDE=10, 
152                               Int_t        nDEbins=300, 
153                               Bool_t       useIncrBin=true);
154     /** 
155      * Fill in observation 
156      * 
157      * @param flag 0 - fill all, 1 - primary, 2 - secondary
158      * @param eta  Eta of particle observations
159      * @param mult Scaled energy loss 
160      */
161     virtual void FillMC(UShort_t flag, Double_t eta, Double_t mult);
162     /** 
163      * Do scaling of histogram before fitting.  This can be
164      * overwritten to do some smoothing or the like. By default, this
165      * simply scales to the bin width.
166      * 
167      * @param dist Histogram to scale. 
168      */     
169     virtual void  Scale(TH1* dist) const;
170     /** 
171      * Fit the final distributions - called via Terminate 
172      * 
173      * @param dir           Containing directory
174      * @param lowCut        Lower cut on @f$\Delta/\Delta_{mip}@f$ 
175      * @param nParticles    Max. number of particle peaks to fit
176      * @param minEntries    Least number of entries required before fitting
177      * @param minusBins     Number of bins below the 1st peak we start fitting
178      * @param relErrorCut   Largest relative error on paramters
179      * @param chi2nuCut     Largest value of the @f$\chi^2/\nu@f$ 
180      * @param minWeight     Least weight to consider 
181      * @param regCut        When to regalurize 
182      * @param residuals     How to do residuals - if at all 
183      * 
184      * @return List of histograms of parameters 
185      */
186     TObjArray* Fit(TList*           dir, 
187                    Double_t         lowCut, 
188                    UShort_t         nParticles,
189                    UShort_t         minEntries,
190                    UShort_t         minusBins, 
191                    Double_t         relErrorCut, 
192                    Double_t         chi2nuCut,
193                    Double_t         minWeight,
194                    Double_t         regCut,
195                    EResidualMethod  residuals) const;
196     
197     TH2* fPrimary;   // @f$\Delta@f$ vs @f$\eta@f$ for primaries
198     TH2* fSecondary; // @f$\Delta@f$ vs @f$\eta@f$ for second.
199   public:
200     TH2* fBetaGammadEdx;
201     TH2* fBetaGammaEta;
202     TH2* fDedxEta;
203     ClassDef(RingHistos,1); // Cache of histograms per ring 
204   };
205 protected:
206   /** 
207    * Create a container of histograms for a single ring
208    * 
209    * @param d Detector 
210    * @param r Ring 
211    * 
212    * @return Newly allocated container 
213    */
214   AliFMDEnergyFitter::RingHistos* CreateRingHistos(UShort_t d, Char_t r) const;
215   /** Our 'tracker' */
216   AliFMDMCTrackELoss fTracker;
217   /** Cache of current MC IP */
218   TArrayF          fIp;
219   /** Cache of number of tracks */
220   Int_t            fNTrack;
221   /** Cache of numbr of primaries */
222   Int_t            fNPrimary;
223
224   ClassDef(AliFMDMCTrackInspector,1);
225 };
226
227 #endif
228 // Local Variables:
229 //  mode: C++
230 // End: