]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWGLF/FORWARD/analysis2/AliFMDMCTrackDensity.h
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / analysis2 / AliFMDMCTrackDensity.h
index 25d28a4527a169da4ef93d03de8a767cb9f2c19a..3d34fbf178ca183c50adec26bd1950397d12ce5b 100644 (file)
@@ -1,15 +1,9 @@
 #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.
@@ -35,7 +29,7 @@ class AliStack;
  * @ingroup pwglf_forward_mc
  * @ingroup pwglf_forward_aod
  */
-class AliFMDMCTrackDensity : public TNamed
+class AliFMDMCTrackDensity : public AliBaseMCTrackDensity 
 {
 public:
   /** 
@@ -73,20 +67,6 @@ 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
@@ -116,58 +96,94 @@ public:
    * 
    * @param list List to add outputs to
    */
-  void DefineOutput(TList* list);
+  void CreateOutputObjects(TList* list);
   
   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
    * 
+   * @return Detector id set on track references
+   */
+  Int_t GetDetectorId() const;
+  /** 
+   * Process a track reference 
    * 
-   * @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) const;
+   * @param particle Particle 
+   * @param mother   Ultimate mother (if not primary)
+   * @param ref      Reference 
+   * 
+   * @return 0 if no output should be generated for this reference, or
+   * pointer to track-reference to produce output for.
+   */
+  AliTrackReference* ProcessRef(AliMCParticle* particle, 
+                               const AliMCParticle* mother, 
+                               AliTrackReference* ref);
   /** 
-   * Get incident angle of this track reference
+   * Called at before loop over track references
    * 
-   * @param ref Track reference
-   * @param vz  Z coordinate of the IP
+   */
+  void BeginTrackRefs();
+  /** 
+   * Called at before loop over track references
    * 
-   * @return incident angle (in radians)
+   * @param nRefs Number of references 
    */
-  Double_t GetTrackRefTheta(const AliTrackReference* ref,
-                           Double_t vz) const;
+  void EndTrackRefs(Int_t nRefs);
   /** 
-   * Get ultimate mother of a track 
+   * Store a particle hit in Base<i>dr</i>[<i>s,t</i>] in @a output
    * 
-   * @param iTr   Track number 
-   * @param event Event
    * 
-   * @return Pointer to mother or null 
+   * @param particle  Particle to store
+   * @param mother    Ultimate mother of particle 
+   * @param ref       Longest track reference
+   *
+   * @return weight
+   */  
+  Double_t StoreParticle(AliMCParticle*       particle, 
+                        const AliMCParticle* mother,
+                        AliTrackReference*   ref) const;
+  /** 
+   * Structure holding the state of the `tracker' 
+   * 
    */
-  const AliMCParticle* GetMother(Int_t iTr, const AliMCEvent& event) 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;            // Angle 
+    UShort_t oldDetector;      // Last detector
+    Char_t   oldRing;          // Last ring
+    UShort_t oldSector;        // Last sector
+    UShort_t oldStrip;         // Last strip 
+    UShort_t startStrip;       // First strip 
+    UShort_t nRefs;            // Number of references
+    UShort_t nStrips;          // Number of strips 
+    UShort_t count;            // Count of hit strips 
+    AliTrackReference* longest; //! Longest track through 
+    /** 
+     * Clear this state
+     * 
+     * @param alsoCount If true, also clear count 
+     */
+    void Clear(Bool_t alsoCount=false);
+    /** 
+     * Assignment operator 
+     * 
+     * @param o Object to assign from 
+     * 
+     * @return Reference to this object 
+     */
+    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,5); // Calculate track-ref density
 };
 
 #endif