#ifndef ALIFMDMCTRACKDENSITY_MC
#define ALIFMDMCTRACKDENSITY_MC
#include "AliForwardUtil.h"
-#include <TNamed.h>
-class TList;
+#include "AliBaseMCTrackDensity.h"
class TH1D;
-class TH2D;
-class AliMCEvent;
class AliESDFMD;
-class AliMCParticle;
-class AliTrackReference;
-class AliStack;
/**
* A class to calculate the particle density from track references.
* @ingroup pwglf_forward_mc
* @ingroup pwglf_forward_aod
*/
-class AliFMDMCTrackDensity : public TNamed
+class AliFMDMCTrackDensity : public AliBaseMCTrackDensity
{
public:
/**
* @param n Maximum number of strips per 'cluster'
*/
void SetMaxConsequtiveStrips(UShort_t n) { fMaxConsequtiveStrips = n; }
- /**
- * Set whether to only consider primaries
- *
- * @param use If true, consider only primaries
- */
- void SetUseOnlyPrimary(Bool_t use) { fUseOnlyPrimary = use; }
-
- /**
- * Set whether to print debug messages. Please note this will
- * produce a lot of output.
- *
- * @param debug Whether to enable debug messages or not
- */
- void SetDebug(Bool_t debug=true) { fDebug = debug; }
/**
* Loops over all the particles in the passed event. If @a primary
* is not null, then that histogram is filled with the primary
void Print(Option_t* option="") const;
protected:
/**
- * Store a particle hit in FMD<i>dr</i>[<i>s,t</i>] in @a output
- *
+ * Must be defined to return the track-reference ID for this detector
*
- * @param particle Particle to store
- * @param mother Ultimate mother of particle
- * @param longest Longest track reference
- * @param vz Z coordinate of IP
- * @param nC Total number of track-references in this sector
- * @param nT Number of distint strips hit in this sector
- * @param output Output structure
- */
- void StoreParticle(AliMCParticle* particle,
- const AliMCParticle* mother,
- Int_t longest,
- Double_t vz,
- UShort_t nC,
- UShort_t nT,
- AliESDFMD& output,
- Double_t w) const;
+ * @return Detector id set on track references
+ */
+ Int_t GetDetectorId() const;
/**
- * Get incident angle of this track reference
+ * Process a track reference
*
- * @param ref Track reference
- * @param vz Z coordinate of the IP
+ * @param particle Particle
+ * @param mother Ultimate mother (if not primary)
+ * @param ref Reference
*
- * @return incident angle (in radians)
+ * @return 0 if no output should be generated for this reference, or
+ * pointer to track-reference to produce output for.
*/
- Double_t GetTrackRefTheta(const AliTrackReference* ref,
- Double_t vz) const;
+ AliTrackReference* ProcessRef(AliMCParticle* particle,
+ const AliMCParticle* mother,
+ AliTrackReference* ref);
/**
- * Get ultimate mother of a track
- *
- * @param iTr Track number
- * @param event Event
+ * Called at before loop over track references
*
- * @return Pointer to mother or null
*/
- const AliMCParticle* GetMother(Int_t iTr, const AliMCEvent& event) const;
+ void BeginTrackRefs();
/**
- * Calculate flow weight
- *
- * @param eta Pseudo rapidity
- * @param pt Transverse momemtum
- * @param b Impact parameter
- * @param phi Azimuthal angle
- * @param rp Reaction plance angle
- * @param id Particle PDG code
- *
- * @return Flow weight for the particle
+ * Called at before loop over track references
+ *
*/
- Double_t CalculateWeight(Double_t eta, Double_t pt, Double_t b,
- Double_t phi, Double_t rp, Int_t id) const;
+ void EndTrackRefs(Int_t nRefs);
+ /**
+ * Store a particle hit in Base<i>dr</i>[<i>s,t</i>] in @a output
+ *
+ *
+ * @param particle Particle to store
+ * @param mother Ultimate mother of particle
+ * @param longest Longest track reference
+ * @param vz Z coordinate of IP
+ * @param nC Total number of track-references in this sector
+ * @param nT Number of distint strips hit in this sector
+ * @param output Output structure
+ */
+ Double_t StoreParticle(AliMCParticle* particle,
+ const AliMCParticle* mother,
+ AliTrackReference* ref) const;
- Bool_t fUseOnlyPrimary; // Only use primaries
- UShort_t fMaxConsequtiveStrips; // Max 'cluster' size
- TH1D* fNr; // Number of track-refs per cluster
- TH1D* fNt; // Size of cluster in strips
- TH2D* fBinFlow; // eta,phi bin flow
- TH2D* fEtaBinFlow; // dEta vs eta of strip
- TH2D* fPhiBinFlow; // dPhi vs phi of strip
- Bool_t fDebug; // Debug flag
+ mutable struct State
+ {
+ Double_t angle;
+ UShort_t oldDetector;
+ Char_t oldRing;
+ UShort_t oldSector;
+ UShort_t oldStrip;
+ UShort_t startStrip;
+ UShort_t nRefs;
+ UShort_t nStrips;
+ UShort_t count;
+ AliTrackReference* longest; //!
+
+ void Clear(Bool_t alsoCount=false);
+ State& operator=(const State& o);
+ } fState; // State
+
+
+ UShort_t fMaxConsequtiveStrips; // Max 'cluster' size
+ TH1D* fNr; // Number of track-refs per cluster
+ TH1D* fNt; // Size of cluster in strips
+ TH1D* fNc; // Number of clusters per track
+ TH2D* fNcr; // Number of clusters per track
+ AliESDFMD* fOutput; //! Output ESD object
- ClassDef(AliFMDMCTrackDensity,1); // Calculate track-ref density
+ ClassDef(AliFMDMCTrackDensity,3); // Calculate track-ref density
};
#endif