]> git.uio.no Git - u/mrichter/AliRoot.git/blob - FMD/AliFMDBackgroundCorrection.h
Fixes
[u/mrichter/AliRoot.git] / FMD / AliFMDBackgroundCorrection.h
1 // -*- mode: C++ -*- 
2
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights
4  * reserved. 
5  *
6  * See cxx source for full Copyright notice                               
7  */
8 // This class computes background corrections for the FMD. The
9 // correction is computed in eta,phi cells and the objects stored can
10 // be put into alien to use with analysis.
11 //
12 // Author: Hans Hjersing Dalsgaard, NBI, hans.dalsgaard@cern.ch
13 //
14 // 
15
16 #ifndef ALIFMDBACKGROUNDCORRECTION_H
17 #define ALIFMDBACKGROUNDCORRECTION_H
18
19 #include "AliFMDInput.h"
20 #include <TObjArray.h>
21 #include <AliRunLoader.h>
22 #include <AliFMDFloatMap.h>
23 #include <TH2F.h>
24 class AliTrackReference;
25
26 /**
27  * Background correction map.
28  * 
29  */
30 class AliFMDBackgroundCorrection : public TNamed 
31 {
32 public:
33   /** 
34    * Constructor
35    */
36   AliFMDBackgroundCorrection() ;
37   /** 
38    * Destructor
39    */
40   virtual ~AliFMDBackgroundCorrection() {};
41   /** 
42    * Generate the background correction
43    * 
44    * @param from_hits     Whether we run over hits
45    * @param nvtxbins      Number of vertex bins
46    * @param zvtxcut       Outer cut on interaction point Z coordinate
47    * @param nBinsEta      Number of psuedo-rapidity bins
48    * @param storeInAlien  Whether to store the result in AliEn
49    * @param runNo         Run number 
50    * @param endRunNo      End validity 
51    * @param filename      The output file name 
52    * @param simulate      Whether to run the simulation or not
53    * @param nEvents       Number of events to analyse 
54    * @param inFile        Whether an input file is specified
55    * @param infilename    Input file name
56    */
57   void GenerateBackgroundCorrection(Bool_t        from_hits    = kFALSE,
58                                     Int_t         nvtxbins     = 10,
59                                     Float_t       zvtxcut      = 10,
60                                     Int_t         nBinsEta     = 100, 
61                                     Bool_t        storeInAlien = kFALSE, 
62                                     Int_t         runNo        = 0, 
63                                     Int_t         endRunNo     = 999999999, 
64                                     const Char_t* filename  ="background.root", 
65                                     Bool_t        simulate     = kFALSE, 
66                                     Int_t         nEvents      = 10,
67                                     Bool_t        inFile       = kFALSE,
68                                     const Char_t* infilename="");
69   /** 
70    * Nested class that derives from AliFMDInput to do the actual
71    * processing  
72    */  
73   class AliFMDInputBG : public AliFMDInput 
74   {
75     
76   public :
77     //AliFMDInputBG() ; 
78     /** 
79      * Constructo
80      * 
81      * @param hits_not_trackrefs Use hits rather than track references
82      */
83     AliFMDInputBG(Bool_t hits_not_trackrefs);
84     /** 
85      * Initialize the object
86      * 
87      * 
88      * @return @c true on success.
89      */
90     Bool_t Init();
91
92     /** 
93      * Get number of primaries seen
94      * 
95      * 
96      * @return Number of primaries seen 
97      */    
98     Int_t GetNprim() {return fPrim;}
99     /** 
100      * Get number of hits (total number of particles seen)
101      * 
102      * 
103      * @return Total number of particles seen
104      */
105     Int_t GetNhits() {return fHits;}
106     /** 
107      * Set the interaction point Z coordinate cut 
108      * 
109      * @param vtxCut The Z coordinate cut 
110      */
111     void  SetVtxCutZ(Double_t vtxCut) { fZvtxCut = vtxCut;}
112     /** 
113      * Set the number of vertex bins
114      * 
115      * @param nBins Number of vertex bins 
116      */
117     void  SetNvtxBins(Int_t nBins) { fNvtxBins = nBins;}
118     /** 
119      * Set the number of eta bins
120      * 
121      * @param nBins Number of eta bins
122      */
123     void  SetNbinsEta(Int_t nBins) { fNbinsEta = nBins;}
124     /** 
125      * Get a list of hits i.e., the particles that hit the FMD
126      * 
127      * @return List of particles
128      */
129     TObjArray*  GetHits() {return &fHitArray;}
130     /** 
131      * Get a list of primaries i.e., the primary particles that hit the FMD
132      * 
133      * @return List of particles
134      */
135     TObjArray*  GetPrimaries() {return &fPrimaryArray;}
136     /** 
137      * Get the run loader used
138      * 
139      * @return Run loader used 
140      */
141     AliRunLoader* GetRunLoader() {return fLoader; }
142   private:
143     /** 
144      * Process a single hit
145      * 
146      * @param h Hit data
147      * @param p Particle that made the hit
148      * 
149      * @return @c false on failure
150      */    
151     Bool_t ProcessHit(AliFMDHit* h, TParticle* p );
152     /** 
153      * Process a track reference 
154      * 
155      * @param tr Track reference
156      * @param p  Particle that made the track reference
157      * 
158      * @return  @c false on failure
159      */
160     Bool_t ProcessTrackRef(AliTrackReference* tr, TParticle* p );
161     /** 
162      * Process a single event
163      * 
164      * @param det     Detector
165      * @param ring    Ring
166      * @param sector  Sector 
167      * @param strip   Strip
168      * @param nTrack  Track number
169      * @param charge  Charge 
170      * 
171      * @return @c false on failure
172      */
173     Bool_t ProcessEvent(UShort_t det,
174                         Char_t ring, 
175                         UShort_t sector, 
176                         UShort_t strip,
177                         Int_t nTrack,
178                         Float_t charge);
179     /** 
180      * Called at start of event
181      * 
182      * @param event Event number
183      * 
184      * @return @c false on failure
185      */         
186     Bool_t Begin(Int_t event );
187     /** 
188      * Called at end of event 
189      * 
190      * @return @c false on failure
191      */
192     Bool_t End();
193     TObjArray      fPrimaryArray;     // List of primaries
194     TObjArray      fHitArray;         // List of all particles
195     TH2F           fPrimaryMapInner;  // Histogram for inners
196     TH2F           fPrimaryMapOuter;  // Histogram for outers
197     // FIXME: Consider using AliFMDUShortMap, or maybe new class AliFMDIntMap
198     AliFMDFloatMap fHitMap;           // A map of hits
199     AliFMDFloatMap fLastTrackByStrip; // A map of last track 
200     Int_t          fPrim;             // Number of primaries
201     Int_t          fHits;             // Number of hits
202     Double_t       fZvtxCut;          // Vertex cut
203     Int_t          fNvtxBins;         // Number of vertex bins
204     Int_t          fPrevTrack;        // Previous track number
205     Int_t          fPrevDetector;     // Previous detector number
206     Char_t         fPrevRing;         // Previous ring number
207     Int_t          fPrevSec;          // Previous sector number
208     Int_t          fNbinsEta;         // Number of eta bins
209   };
210   
211 private:
212   /** 
213    * Run a simulation
214    * 
215    * @param e_t Not used
216    */  
217   void Simulate(Int_t e);
218   /** 
219    * Process all primaries from the run loader
220    * 
221    * @param rl Run loader
222    */
223   void ProcessPrimaries(AliRunLoader* rl);
224   TObjArray fCorrectionArray; // Array of corrections
225   TList     fPrimaryList;     // List of primaries
226   ClassDef(AliFMDBackgroundCorrection,0)
227   
228 };
229 #endif
230 // EOF