]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/FORWARD/analysis2/AliSPDMCTrackDensity.h
b3c280633751758a075e14738187134093eed843
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / analysis2 / AliSPDMCTrackDensity.h
1 #ifndef ALISPDMCTRACKDENSITY_MC
2 #define ALISPDMCTRACKDENSITY_MC
3 #include <AliBaseMCTrackDensity.h>
4
5 /**
6  * A class to calculate the particle density from track references.
7  * This code is used both in AliForwardMCCorrectionsTask and
8  * AliSPDMCDensity calculator. 
9  * 
10  * @par Input: 
11  *    - AliMultiplicity object  - from reconstruction
12  *    - Kinematics
13  *    - Track-References
14  *
15  * @par Output: 
16  *    - AliESDSPD object  - content is # of track references/strip
17  *
18  * @par Corrections used: 
19  *    - None
20  *
21  * @par Histograms: 
22  *    - Incident angle vs number of track references
23  *    - Incident angle vs number of strips/cluster
24  *
25  * @ingroup pwglf_forward_algo
26  * @ingroup pwglf_forward_mc
27  * @ingroup pwglf_forward_aod
28  */
29 class AliSPDMCTrackDensity : public AliBaseMCTrackDensity
30 {
31 public:
32   /** 
33    * Default constructor.  Do not use - for ROOT I/O system use only 
34    */
35   AliSPDMCTrackDensity();
36   /** 
37    * Normal constructor 
38    * 
39    * @param name Not used
40    */
41   AliSPDMCTrackDensity(const char* name);
42   /** 
43    * Copy constructor 
44    * 
45    * @param o Object to copy from 
46    */
47   AliSPDMCTrackDensity(const AliSPDMCTrackDensity& o);
48   /** 
49    * Assignment operator
50    * 
51    * @param o Object to assign from 
52    * 
53    * @return Reference to this 
54    */
55   AliSPDMCTrackDensity& operator=(const AliSPDMCTrackDensity& o);
56   /** 
57    * Destructor. 
58    */
59   virtual ~AliSPDMCTrackDensity() {}
60
61   /** 
62    * Loops over all the particles in the passed event.  If @a primary
63    * is not null, then that histogram is filled with the primary
64    * particle information - irrespective of whether the particle
65    * actually hits the SPD or not.  For each track (primary or
66    * secondary, unless only primary information is requested - see
67    * SetUseOnlyPrimary) loop over all track references to that
68    * particle and check if they come from the SPD.  In that case,
69    * figure out which @f$(\eta,\varphi)@f$-bin to assign the track to,
70    * and fill the @a output histogram
71    * 
72    * @param event    MC event 
73    * @param vz       IP z--coordinate
74    * @param output   Output of SPD hits
75    * @param primary  Primary information, if available. 
76    * 
77    * @return true 
78    */
79   Bool_t Calculate(const AliMCEvent&   event, 
80                    Double_t            vz,
81                    TH2D&               output,
82                    TH2D*               primary);
83   void Print(Option_t* option="") const;
84 protected:
85   /** 
86    * Must be defined to return the track-reference ID for this detector
87    * 
88    * @return Detector id set on track references
89    */
90   Int_t GetDetectorId() const;
91   /** 
92    * Process a track reference 
93    * 
94    * @param particle Particle 
95    * @param mother   Ultimate mother (if not primary)
96    * @param ref      Reference 
97    * 
98    * @return 0 if no output should be generated for this reference, or
99    * pointer to track-reference to produce output for.
100    */
101   AliTrackReference* ProcessRef(AliMCParticle* particle, 
102                                 const AliMCParticle* mother, 
103                                 AliTrackReference* ref);
104   /** 
105    * Called at before loop over track references
106    * 
107    */
108   void BeginTrackRefs();
109   Bool_t CheckTrackRef(AliTrackReference* /*ref*/) const;
110   /** 
111    * Store a particle hit in Base<i>dr</i>[<i>s,t</i>] in @a output
112    * 
113    * 
114    * @param particle  Particle to store
115    * @param mother    Ultimate mother of particle 
116    * @param longest   Longest track reference
117    * @param vz        Z coordinate of IP
118    * @param nC        Total number of track-references in this sector  
119    * @param nT        Number of distint strips hit in this sector
120    * @param output    Output structure 
121    */  
122   Double_t StoreParticle(AliMCParticle*       particle, 
123                          const AliMCParticle* mother,
124                          AliTrackReference*   ref) const;
125   Double_t fMinR;             // Min radius 
126   Double_t fMaxR;             // Max radius 
127   Double_t fMinZ;             // Min z
128   Double_t fMaxZ;             // Max z
129   AliTrackReference* fStored; //! Last stored
130   TH2D*              fOutput; //! Output 
131
132   ClassDef(AliSPDMCTrackDensity,3); // Calculate track-ref density
133 };
134
135 #endif
136 // Local Variables:
137 //  mode: C++ 
138 // End: