1 #ifndef ALIBaseMCTRACKDENSITY_MC
2 #define ALIBaseMCTRACKDENSITY_MC
4 #include "AliForwardFlowWeights.h"
12 class AliTrackReference;
16 * A class to calculate the particle density from track references.
17 * This code is used both in AliForwardMCCorrectionsTask and
18 * AliBaseMCDensity calculator.
24 * @par Corrections used:
28 * - Incident angle vs number of track references
29 * - Incident angle vs number of strips/cluster
31 * @ingroup pwglf_forward_algo
32 * @ingroup pwglf_forward_mc
33 * @ingroup pwglf_forward_aod
35 class AliBaseMCTrackDensity : public TNamed
39 * Default constructor. Do not use - for ROOT I/O system use only
41 AliBaseMCTrackDensity();
45 * @param name Not used
47 AliBaseMCTrackDensity(const char* name);
51 * @param o Object to copy from
53 AliBaseMCTrackDensity(const AliBaseMCTrackDensity& o);
57 * @param o Object to assign from
59 * @return Reference to this
61 AliBaseMCTrackDensity& operator=(const AliBaseMCTrackDensity& o);
65 virtual ~AliBaseMCTrackDensity() {}
68 * Set whether to only consider primaries
70 * @param use If true, consider only primaries
72 void SetUseOnlyPrimary(Bool_t use) { fUseOnlyPrimary = use; }
74 * Whether to `after-burn' the particles with flow
78 void SetUseFlowWeights(Bool_t use) { fUseFlowWeights = use; }
80 * Set whether to print debug messages. Please note this will
81 * produce a lot of output.
83 * @param debug Whether to enable debug messages or not
85 void SetDebug(Bool_t debug=true) { fDebug = debug; }
89 * @param list List to add outputs to
91 virtual void DefineOutput(TList* list);
93 * Print information to standard out
95 * @param option Not used
97 virtual void Print(Option_t* option="") const;
100 * Loops over all the particles in the passed event. If @a primary
101 * is not null, then that histogram is filled with the primary
102 * particle information - irrespective of whether the particle
103 * actually hits the Base or not. For each track (primary or
104 * secondary, unless only primary information is requested - see
105 * SetUseOnlyPrimary) loop over all track references to that
106 * particle and check if they come from the Base. In that case,
107 * figure out which strip(s) to assign the track to, and fill the @a
110 * @param esd Base ESD structure
111 * @param event MC event
112 * @param vz IP z-coordinate
113 * @param output Output of Base hits
114 * @param primary Primary information, if available.
118 Bool_t ProcessTracks(const AliMCEvent& event,
122 * Process a single track
124 * @param particle Particle
125 * @param mother Ultimate mother
127 * @return true on succsess
129 Bool_t ProcessTrack(AliMCParticle* particle,
130 const AliMCParticle* mother);
132 * Must be defined to return the track-reference ID for this detector
134 * @return Detector id set on track references
136 virtual Int_t GetDetectorId() const = 0;
138 * Process a track reference
140 * @param particle Particle
141 * @param mother Ultimate mother (if not primary)
142 * @param ref Reference
144 * @return 0 if no output should be generated for this reference, or
145 * pointer to track-reference to produce output for.
147 virtual AliTrackReference* ProcessRef(AliMCParticle* particle,
148 const AliMCParticle* mother,
149 AliTrackReference* ref) = 0;
151 * Called at before loop over track references
154 virtual void BeginTrackRefs() {}
155 virtual Bool_t CheckTrackRef(AliTrackReference* /*ref*/) const { return true; }
157 * Called at before loop over track references
160 virtual void EndTrackRefs(Int_t /*nRefs*/) {}
162 * Store a particle hit in Base<i>dr</i>[<i>s,t</i>] in @a output
165 * @param particle Particle to store
166 * @param mother Ultimate mother of particle
167 * @param longest Longest track reference
168 * @param vz Z coordinate of IP
169 * @param nC Total number of track-references in this sector
170 * @param nT Number of distint strips hit in this sector
171 * @param output Output structure
173 virtual Double_t StoreParticle(AliMCParticle* particle,
174 const AliMCParticle* mother,
175 AliTrackReference* ref) const;
177 * Get the parameters of this event
181 * @return true if found, false otherwise
183 Bool_t GetCollisionParameters(const AliMCEvent& event);
185 * Get incident angle of this track reference
187 * @param ref Track reference
188 * @param vz Z coordinate of the IP
190 * @return incident angle (in radians)
192 Double_t GetTrackRefTheta(const AliTrackReference* ref) const;
194 * Get ultimate mother of a track
196 * @param iTr Track number
199 * @return Pointer to mother or null
201 const AliMCParticle* GetMother(Int_t iTr, const AliMCEvent& event) const;
203 * Calculate flow weight
205 * @param eta Pseudo rapidity
206 * @param pt Transverse momemtum
207 * @param phi Azimuthal angle
208 * @param id Particle PDG code
210 * @return Flow weight for the particle
212 Double_t CalculateWeight(Double_t eta, Double_t pt,
213 Double_t phi, Int_t id) const;
215 Bool_t fUseOnlyPrimary; // Only use primaries
216 Bool_t fUseFlowWeights; // Wether to use flow weights
217 TH2D* fBinFlow; // eta,phi bin flow
218 TH2D* fEtaBinFlow; // dEta vs eta of strip
219 TH2D* fPhiBinFlow; // dPhi vs phi of strip
220 TH1D* fNRefs; // Number of track-references per track
221 AliForwardFlowWeights fWeights; // Flow weights
222 Double_t fVz; // IP z-coordinate of this event
223 Double_t fB; // Impact parameter of this event
224 Double_t fPhiR; // Reaction plane of this event
225 Bool_t fDebug; // Debug flag
227 ClassDef(AliBaseMCTrackDensity,2); // Calculate track-ref density