]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWGLF/FORWARD/analysis2/AliFMDEventInspector.h
Coverity fixes
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / analysis2 / AliFMDEventInspector.h
index a08ec575801db8d7a4a917b56aaa24427875b481..9d89019eb73e7e9fae57569ddf6840161812d076 100644 (file)
  */
 #include <TNamed.h>
 #include <TAxis.h>
+#include <TList.h>
 #include "AliDisplacedVertexSelection.h"
 class AliESDEvent;
+class AliOADBPhysicsSelection;
 class TH2D;
 class TH1D;
 class TH1I;
 class TH1F;
 class TH2F;
+class TH2I;
 class TAxis;
-class TList;
+class TVector3;
+// class TList;
 
 /** 
  * This class inspects the event 
@@ -51,19 +55,19 @@ public:
    * Return codes 
    */
   enum ECodes {
-    /** all ok */
+    /** all ok - bin 1 */
     kOk = 0,
-    /** No ESD event */
+    /** No ESD event - bin 2 */
     kNoEvent = 0x1, 
-    /** No triggers found */
+    /** No triggers found - bin 3 */
     kNoTriggers = 0x2, 
-    /** No SPD data */ 
+    /** No SPD data - bin 4 */ 
     kNoSPD = 0x4, 
-    /** No FMD data */
+    /** No FMD data - bin 5 */
     kNoFMD = 0x8, 
-    /** No vertex found */
+    /** No vertex found - bin 6 */
     kNoVertex = 0x10, 
-    /** Vertex out of range */
+    /** Vertex out of range - bin 7 */
     kBadVertex = 0x20
   };
   /** 
@@ -81,8 +85,29 @@ public:
     kE,
     kPileUp,
     kMCNSD,
+    kSatellite,
     kOffline
   };
+  /** 
+   * Centrality methods 
+   */
+  enum ECentMethod { 
+    kV0Multiplicity, 
+    kV0Amplitude, 
+    kV0Charge, 
+    kFMDRough, 
+    kNTracks, 
+    kLTracks, 
+    kCL0, 
+    kCL1, 
+    kCND, 
+    kNParticles,
+    kNeutrons,
+    kV0vsFMD, 
+    kV0vsNTracks, 
+    kZEMvsZDC
+  };
+
   /** 
    * Collision systems
    */
@@ -91,6 +116,33 @@ public:
     kPP, 
     kPbPb
   };
+  enum EVtxStatus { 
+    kVtxOK = 1, 
+    kNoVtx, 
+    kNoSPDVtx, 
+    kFewContrib, 
+    kUncertain,
+    kNotVtxZ
+  }; 
+  enum ETrgStatus {
+    kNoTrgWords=1,
+    kPP2760Fast, 
+    kMUON,
+    kTriggered,
+    kMinBias,
+    kMinBiasNoSPD,
+    kV0AndTrg,
+    kHighMult,
+    kCentral, 
+    kSemiCentral, 
+    kDiffractive,
+    kUser,
+    kOther
+  };
+  /** 
+   * Folder name 
+   */
+  static const char* fgkFolderName;
   /** 
    * Constructor 
    */
@@ -101,31 +153,17 @@ public:
    * @param name Name of object
    */
   AliFMDEventInspector(const char* name);
-  /** 
-   * Copy constructor 
-   * 
-   * @param o Object to copy from 
-   */
-  AliFMDEventInspector(const AliFMDEventInspector& o);
   /** 
    * Destructor 
    */
   virtual ~AliFMDEventInspector();
-  /** 
-   * Assignement operator
-   * 
-   * @param o Object to assign from 
-   * 
-   * @return Reference to this object
-   */
-  AliFMDEventInspector& operator=(const AliFMDEventInspector&);
 
   /** 
    * Initialize the object 
    * 
    * @param vtxAxis Vertex axis in use 
    */
-  virtual void Init(const TAxis& vtxAxis);
+  virtual void SetupForData(const TAxis& vtxAxis);
   /** 
    * Process the event 
    * 
@@ -135,7 +173,7 @@ public:
    *                  event (according to the setting of fLowFluxCut) 
    * @param ivz       On return, the found vertex bin (1-based).  A zero
    *                  means outside of the defined vertex range
-   * @param vz        On return, the z position of the interaction
+   * @param ip        On return, coordinates of interaction point
    * @param cent      On return, the centrality (in percent) or < 0 
    *                  if not found
    * @param nClusters On return, number of SPD clusters in @f$ |\eta|<1@f$ 
@@ -146,7 +184,7 @@ public:
                 UInt_t&            triggers,
                 Bool_t&            lowFlux,
                 UShort_t&          ivz, 
-                Double_t&          vz,
+                TVector3&          ip,
                 Double_t&          cent,
                 UShort_t&          nClusters);
   /** 
@@ -156,7 +194,7 @@ public:
    * 
    * @param dir Directory to add to 
    */
-  void DefineOutput(TList* dir);
+  void CreateOutputObjects(TList* dir);
   /** 
    * Set the number of SPD tracklets for which we consider the event a
    * low-flux event or not .
@@ -181,6 +219,13 @@ public:
    * 
    * @param use Use it or not 
    */
+  void SetpA2012Vtx(Bool_t use) {fUsepA2012Vertex= use; }
+ /** 
+   * Use the 2012 pA vtx code.   
+   * 
+   * @param use Use it or not 
+   */
+
   void SetUseV0AndForNSD(Bool_t use=true) {fUseV0AND = use; }
   /** 
    * Set the minimum number of contributors for a 2nd pile-up vertex 
@@ -209,19 +254,72 @@ public:
   {
     fUseDisplacedVertices = use;
   }  
-  
+  Bool_t IsUseDisplacedVertices() const { return fUseDisplacedVertices; }
+  /** 
+   * Set the lower centrality cut - if negative, do not use 
+   *
+   * @deprecated We should accept all events in the AOD pass
+   * 
+   * @param mincent Lower cut on centrality
+   */
+  void SetMinCentrality(Double_t mincent=-1.0);
+  /** 
+   * Set the upper centrality cut - if negative, do not use 
+   *
+   * @deprecated We should accept all events in the AOD pass
+   * 
+   * @param maxcent Upper cut on centrality
+   */
+  void SetMaxCentrality(Double_t maxcent=-1.0);
+  /** 
+   * Set the centrality method to use.  Possible values are 
+   *
+   * - VOM      - VZERO multiplicity 
+   * - V0A      - VZERO amplitude
+   * - V0C      - VZERO charge
+   * - FMD      - FMD scaled energy loss
+   * - TRK      - Number of tracks
+   * - TKL      - Number of tracks
+   * - CL0      - 
+   * - CL1      - 
+   * - CND      - 
+   * - NPA      - Neutral particles 
+   * - ZNA      - ZDC neutron amplitude 
+   * - V0MvsFMD - VZERO versus FMD 
+   * - TKLvsVOM - Tracks versus VZERO 
+   * - ZEMvsZDC - ZDC 
+   * 
+   * @param m 
+   */
+  void SetCentralityMethod(const TString& m) { fCentMethod = m; }
+  /** 
+   * Set the centrality method
+   * 
+   * @param m Method identifier 
+   */
+  void SetCentralityMethod(ECentMethod m);
   /** 
    * Set the debug level.  The higher the value the more output 
    * 
    * @param dbg Debug level 
    */
   void SetDebug(Int_t dbg=1) { fDebug = dbg; }
+  /** 
+   * Set whether this is MC or not.  Needed by energy loss fitter task
+   * that never instantices AliFMDMCEventInspector.  In particular, we
+   * need this to make sure we ignore the FAST partition flag in MC
+   * for 2.76TeV pp.
+   * 
+   * @param isMC If true, assume MC input 
+   */
+  void SetMC(Bool_t isMC=true) { fMC = isMC; }
   /** 
    * Fetch our histograms from the passed list 
    * 
    * @param d             Input
    * @param hEventsTr     On return, pointer to histogram, or null
    * @param hEventsTrVtx  On return, pointer to histogram, or null
+   * @param hEventsAcc    On return, pointer to histogram, or null
    * @param hTriggers     On return, pointer to histogram, or null
    * 
    * @return true on success, false otherwise 
@@ -229,6 +327,7 @@ public:
   Bool_t FetchHistograms(const TList* d, 
                         TH1I*& hEventsTr, 
                         TH1I*& hEventsTrVtx, 
+                        TH1I*& hEventsAcc,
                         TH1I*& hTriggers) const;
   /** 
    * Read the collision system, collision energy, and L3 field setting
@@ -257,12 +356,55 @@ public:
    * @return The magnetic field setting 
    */
   Short_t  GetField() const { return fField; }
+  /** 
+   * Get the current run number 
+   * 
+   * @return The current run number 
+   */
+  ULong_t GetRunNumber() const { return fRunNumber; }
+  /** 
+   * Get the production year.
+   * 
+   * - For real data, this is the year of the data taking 
+   * - For MC this is the year the production is anchored to.
+   * 
+   * @return A two-digit year (post millennium), or -1
+   */
+  Short_t GetProductionYear() const { return fProdYear; }
+  /** 
+   * Get the production period. 
+   * 
+   * - For real data, this is the period identifier of the data taking 
+   * - For MC data, this is the period identifier the production was
+   *   anchored to
+   * 
+   * @return Period identifier or null
+   */
+  Char_t  GetProductionPeriod() const { return fProdLetter; } 
+  /** 
+   * Get the AliROOT revision used for this production
+   * 
+   * @return SVN revision number or -1
+   */
+  Short_t GetProductionRevision() const { return fProdSVN; } 
+  /** 
+   * Check if the production was an MC production anchored in some
+   * real data.
+   * 
+   * @return true if this (MC) production was anchored 
+   */
+  Bool_t  IsProductionMC() const { return fProdMC; }
+  
   /** 
    * Print information
    * 
    * @param option Not used 
    */
   void Print(Option_t* option="") const;
+  // getter for fmincentrality
+  // Double_t GetMinCentrality() const { return fMinCent;}
+  // gettter for fmaxcentrality 
+  // Double_t GetMaxCentrality() const { return fMaxCent;}
   /** 
    * Store information about running conditions in output list 
    * 
@@ -275,10 +417,46 @@ public:
    * - field Contains the L3 magnetic field (kG)
    * - run   Contains the run number
    * 
-   * @param runNo Run number - read off from ESD event
    */
-  virtual void StoreInformation(Int_t runNo);
+  virtual void StoreInformation();
+  /** 
+   * Store - if possible - production information in a sub-list 
+   * 
+   */
+  virtual void StoreProduction();
+  /** 
+   * Return a string representing the return code 
+   * 
+   * @param mask Code 
+   * 
+   * @return String representation 
+   */
+  static const char* CodeString(UInt_t mask);
 protected:
+  /** 
+   * Copy constructor - not implemented
+   * 
+   * @param o Object to copy from 
+   */
+  AliFMDEventInspector(const AliFMDEventInspector& o);
+  /** 
+   * Assignement operator - not implemented
+   * 
+   * @param o Object to assign from 
+   * 
+   * @return Reference to this object
+   */
+  AliFMDEventInspector& operator=(const AliFMDEventInspector& o);
+  /** 
+   * Cache the configure trigger classes from the physis selection.  
+   * 
+   * @param cache   where to cache the trigger class. 
+   * @param classes List of configured classes. 
+   * @param o       Object from OADB with config
+   */
+  void CacheConfiguredTriggerClasses(TList& cache, 
+                                    const TList* classes,
+                                    AliOADBPhysicsSelection* o);
   /** 
    * Read the trigger information from the ESD event 
    * 
@@ -288,22 +466,143 @@ protected:
    * 
    * @return @c true on success, @c false otherwise 
    */
-  Bool_t ReadTriggers(const AliESDEvent* esd, UInt_t& triggers, 
+  Bool_t ReadTriggers(const AliESDEvent& esd, UInt_t& triggers, 
                      UShort_t& nClusters);
+  /** 
+   * Possible extra check for p-Pb from 2012/13 - require V0AND.
+   * 
+   * @param esd Event structure 
+   * 
+   * @return true on success
+   */
+  Bool_t CheckpAExtraV0(const AliESDEvent& esd) const;
+  /** 
+   * Check, for the @f$\sqrt{s}=2.76GeV@f$ pp run wether this event
+   * was in the fast partition, and if so, filter it out.
+   * 
+   * @param fastonly Event was in fast-only partition 
+   * 
+   * @return true if event was in the fast-only partition, for the run
+   * period.
+   */
+  virtual Bool_t CheckFastPartition(bool fastonly) const;
+  /** 
+   * Check if we have an NSD trigger for pp runs 
+   * 
+   * @param esd      Data
+   * @param triggers Trigger mask to be filled 
+   * 
+   * @return true if we have an NSD trigger 
+   */
+  virtual Bool_t CheckNSD(const AliESDEvent& esd, UInt_t& triggers) const;
+  /** 
+   * Check if we have an INEL&gt;0 trigger 
+   *  
+   * @param esd        Data 
+   * @param nClusters  On return, number of clusters
+   * @param triggers   Trigger mask to be filled
+   * 
+   * @return true if we have an INEL&gt;0 trigger 
+   */
+  virtual Bool_t CheckINELGT0(const AliESDEvent& esd, UShort_t& nClusters, 
+                             UInt_t& triggers) const;
+  /** 
+   * Check if this is a pile-up event
+   * 
+   * @param esd       Data
+   * @param triggers Trigger mask to be filled
+   * 
+   * @return true if this is a pile-up event
+   */
+  virtual Bool_t CheckPileup(const AliESDEvent& esd, UInt_t& triggers) const;
+  /** 
+   * Check for multi-vertex pile-up 
+   * 
+   * @param esd ESD event 
+   * @param checkOtherBC Also check other BC's 
+   * 
+   * @return true if multiple vertices found 
+   */
+  virtual Bool_t CheckMultiVertex(const AliESDEvent& esd, 
+                                 Bool_t checkOtherBC=false) const;
+  /** 
+   * Check if we have a cosmic trigger.  These should be filtered out. 
+   * 
+   * @param trigStri Trigger string 
+   * 
+   * @return true if we have a cosmic trigger
+   */
+  virtual Bool_t CheckCosmics(const TString& trigStri) const;
+  /** 
+   * Check if the trigger string corresponds to an empty event 
+   * 
+   * @param trigStr  Trigger string 
+   * @param triggers Trigger mask to be filled
+   * 
+   * @return true if the trigger string corresponds to an empty event 
+   */
+  virtual Bool_t CheckEmpty(const TString& trigStr, UInt_t& triggers) const;
+  /** 
+   * Check the trigger words to see if we have a B, A, C, or E event. 
+   * 
+   * @param esd       Data
+   * @param triggers  Trigger mask to be filled
+   * 
+   * @return always true
+   */
+  virtual Bool_t CheckWords(const AliESDEvent& esd, UInt_t& triggers) const;
   /** 
    * Read the vertex information from the ESD event 
    * 
    * @param esd  ESD event 
-   * @param vz   On return, the vertex Z position 
-   * @param vx   On return, the vertex X position 
-   * @param vy   On return, the vertex Y position 
+   * @param ip   On return, the coordinates of the IP
    * 
    * @return @c true on success, @c false otherwise 
    */
-  Bool_t ReadVertex(const AliESDEvent* esd, 
-                   Double_t& vz, 
-                   Double_t& vx, 
-                   Double_t& vy);
+  Bool_t ReadVertex(const AliESDEvent& esd, TVector3& ip);
+  /** 
+   * Check the vertex using the method used in PWG-UD.  That is 
+   *
+   * - Check we have a vertex and status is OK
+   * - Check if we have an SPD vertex and that it's status is OK 
+   * - Check if the vertex is from the Z-vertexer, and if it is, 
+   *   - Check that the dispersion and resolution is OK 
+   * 
+   * @param esd Data 
+   * @param ip  On return, the coordinates of the IP
+   * 
+   * @return status
+   */
+  virtual EVtxStatus CheckPWGUDVertex(const AliESDEvent& esd, 
+                                     TVector3& ip) const;
+  /** 
+   * Check the vertex. That is
+   *
+   * - Check if we have an SPD vertex and that it's status is OK 
+   * - Check that we have enough contributors 
+   * - Check that the reslution is OK 
+   * 
+   * @param esd Data 
+   * @param ip  On return, the coordinates of the IP
+   * 
+   * @return status
+   */
+  virtual EVtxStatus CheckpA2012Vertex(const AliESDEvent& esd, 
+                                    TVector3& ip) const;
+  /** 
+   * Check the vertex for pA 2012 settings. That is
+   *
+   * 
+   * @param esd Data 
+   * @param ip  On return, the coordinates of the IP
+   * 
+   * @return true if the vertex was found and met the requirements
+   */
+
+
+
+
+  virtual EVtxStatus CheckVertex(const AliESDEvent& esd, TVector3& ip) const;
   /** 
    * Read centrality from event 
    * 
@@ -313,36 +612,52 @@ protected:
    * 
    * @return False on error, true otherwise 
    */
-  virtual Bool_t ReadCentrality(const AliESDEvent* esd, Double_t& cent,
+  virtual Bool_t ReadCentrality(const AliESDEvent& esd, Double_t& cent,
                                UShort_t& qual) const;
 
-  TH1I*    fHEventsTr;    //! Histogram of events w/trigger
-  TH1I*    fHEventsTrVtx; //! Events w/trigger and vertex 
-  TH1I*    fHEventsAccepted; //! Events w/trigger and vertex in range 
-  TH2D*    fHEventsAcceptedXY; //! XY vtx with trigger and Z vertex in range 
-  TH1I*    fHTriggers;    //! Triggers
-  TH1I*    fHType;        //! Type (low/high flux) of event
-  TH1I*    fHWords;       //! Trigger words 
-  TH1F*    fHCent;        //! Centrality 
-  TH2F*    fHCentVsQual;  //! Centrality vs quality 
-  Int_t    fLowFluxCut;   //  Low flux cut
-  Double_t fMaxVzErr;     //  Maximum error on v_z
-  TList*   fList;         //! Histogram container 
-  UShort_t fEnergy;       // CMS energy (per nucleon pair) [GeV]
-  Short_t  fField;        // L3 magnetic field [kG]
-  UShort_t fCollisionSystem; //  Collision system
-  Int_t    fDebug;        //  Debug level 
-  TAxis*   fCentAxis;     // Centrality axis used in histograms
-  TAxis    fVtxAxis;      //Vtx Axis 
-  Bool_t   fUseFirstPhysicsVertex; //Use the vtx code from p+p first physics
-  Bool_t   fUseV0AND;     //Use the vtx code from p+p first physics
-  UShort_t fMinPileupContrib; // Minimum number of contributors to 2nd
-                             // pile-up vertex
-  Double_t fMinPileupDistance; // Minimum distance of 2nd pile-up
-                              // vertex 
-  Bool_t   fUseDisplacedVertices; //Analyze displaced vertices?
+  TH1I*    fHEventsTr;            //! Histogram of events w/trigger
+  TH1I*    fHEventsTrVtx;         //! Events w/trigger and vertex 
+  TH1I*    fHEventsAccepted;      //! Events w/trigger and vertex in range 
+  TH2D*    fHEventsAcceptedXY;    //! XY vtx with trigger and Z vertex in range 
+  TH1I*    fHTriggers;            //! Triggers
+  TH2I*    fHTriggerCorr;         //! Correlation of triggers
+  TH1I*    fHType;                //! Type (low/high flux) of event
+  TH1I*    fHWords;               //! Trigger words 
+  TH1F*    fHCent;                //! Centrality 
+  TH2F*    fHCentVsQual;          //! Centrality vs quality 
+  TH1I*    fHStatus;              //! Event processing status 
+  TH1I*    fHVtxStatus;           //! Vertex processing status 
+  TH1I*    fHTrgStatus;           //! Trigger processing status 
+  Int_t    fLowFluxCut;           //  Low flux cut
+  Double_t fMaxVzErr;             //  Maximum error on v_z
+  TList*   fList;                 //! Histogram container 
+  UShort_t fEnergy;               // CMS energy (per nucleon pair) [GeV]
+  Short_t  fField;                // L3 magnetic field [kG]
+  UShort_t fCollisionSystem;      //  Collision system
+  Int_t    fDebug;                //  Debug level 
+  TAxis*   fCentAxis;             // Centrality axis used in histograms
+  TAxis    fVtxAxis;              // IP_z Axis 
+  Bool_t   fUseFirstPhysicsVertex;//Use the vtx code from p+p first physics
+  Bool_t   fUseV0AND;             // Use the vtx code from p+p first physics
+  UShort_t fMinPileupContrib;     // Min contributors to 2nd pile-up IP
+  Double_t fMinPileupDistance;    // Min distance of 2nd pile-up IP
+  Bool_t   fUseDisplacedVertices; // Analyze displaced vertices?
   AliDisplacedVertexSelection fDisplacedVertex; //Displaced vertex selector
-  ClassDef(AliFMDEventInspector,4); // Inspect the event 
+  TList    fCollWords;            //! Configured collision words 
+  TList    fBgWords;              //! Configured background words 
+  TString  fCentMethod;           // Centrality method
+  Double_t fMinCent;              // min centrality
+  Double_t fMaxCent;              // max centrailty
+  Bool_t   fUsepA2012Vertex;      // flag to use pA2012 Veretx selection
+  ULong_t  fRunNumber;            // Current run number 
+  Bool_t   fMC;                   // Is this MC input
+  Short_t  fProdYear;             // Production year 
+  Char_t   fProdLetter;           // Production letter 
+  Short_t  fProdPass;             // Pass number 
+  Int_t    fProdSVN;              // AliROOT revision used in production
+  Bool_t   fProdMC;               // True if anchor production
+
+  ClassDef(AliFMDEventInspector,12); // Inspect the event 
 };
 
 #endif