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