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 event MC event
111 * @param vz IP z-coordinate
112 * @param primary Primary information, if available.
116 Bool_t ProcessTracks(const AliMCEvent& event,
120 * Process a single track
122 * @param particle Particle
123 * @param mother Ultimate mother
125 * @return true on succsess
127 Bool_t ProcessTrack(AliMCParticle* particle,
128 const AliMCParticle* mother);
130 * Must be defined to return the track-reference ID for this detector
132 * @return Detector id set on track references
134 virtual Int_t GetDetectorId() const = 0;
136 * Process a track reference
138 * @param particle Particle
139 * @param mother Ultimate mother (if not primary)
140 * @param ref Reference
142 * @return 0 if no output should be generated for this reference, or
143 * pointer to track-reference to produce output for.
145 virtual AliTrackReference* ProcessRef(AliMCParticle* particle,
146 const AliMCParticle* mother,
147 AliTrackReference* ref) = 0;
149 * Called at before loop over track references
152 virtual void BeginTrackRefs() {}
154 * Check a track reference
156 * @return true if the track reference should be used
158 virtual Bool_t CheckTrackRef(AliTrackReference*) const { return true; }
160 * Called at before loop over track references
163 virtual void EndTrackRefs(Int_t /*nRefs*/) {}
165 * Store a particle hit in Base<i>dr</i>[<i>s,t</i>] in @a output
168 * @param particle Particle to store
169 * @param mother Ultimate mother of particle
170 * @param ref Longest track reference
172 * @return Weight factor
174 virtual Double_t StoreParticle(AliMCParticle* particle,
175 const AliMCParticle* mother,
176 AliTrackReference* ref) const;
178 * Get the parameters of this event
182 * @return true if found, false otherwise
184 Bool_t GetCollisionParameters(const AliMCEvent& event);
186 * Get incident angle of this track reference
188 * @param ref Track reference
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