]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSMeanVertexer.h
Fixes for Coverity warnings
[u/mrichter/AliRoot.git] / ITS / AliITSMeanVertexer.h
index 613e3de8214a51130bfaef274fb8c84c515b231f..fe30545e7b0d5fb349628a64b2eb28fbcf90c0c6 100644 (file)
@@ -1,8 +1,6 @@
 #ifndef ALIITSMEANVERTEXER_H
 #define ALIITSMEANVERTEXER_H
 
-#include <TString.h>
-
 ///////////////////////////////////////////////////////////////////////
 //                                                                   //
 // Class to compute vertex position using SPD local reconstruction   //
 
 /* $Id$ */
 
-class TObject;
+#include <TObject.h>
+#include <TBits.h>
+
+class TClonesArray;
+class TH1F;
+class TH2F;
 class AliRawReader;
-class AliRunLoader;
-class AliMultiplicity;
 class AliESDVertex;
+class AliITSDetTypeRec;
+class AliITSVertexer;
 
 class AliITSMeanVertexer : public TObject {
 
  public:
-    // default constructor
-    AliITSMeanVertexer();   
-    // standard constructor. filename is the name of the file containing
-    // raw data either in ROOT or DATE format according to file extension
-    AliITSMeanVertexer(TString filename);   
-    // constructor with explicit assignment of names for geometry and loaders
-    AliITSMeanVertexer(TString filename, TString loaderfilename, 
-                       TString geometryfilename);
+  // default constructor
+    AliITSMeanVertexer(Bool_t mode = kTRUE);   
     virtual ~AliITSMeanVertexer();
-    void SetLoaderFileName(TString fn="ITSMeanVertexer.root")
-                           {fLoaderFileName = fn;}
-    void SetGeometryFileName(TString fn="geometry.root")
-                           {fGeometryFileName = fn;}
-    void SetMeanVertexFileName(TString fn) {fMVFileName = fn;}
-    void SetFilterOnContributors(Int_t nc=1){fFilterOnContributors = nc;}
-    void SetFilterOnTracklets(Int_t nc=1){fFilterOnTracklets = nc;}
-    void SetWriteVertices(Bool_t action){fWriteVertices = action;}
-    Bool_t GetWriteVertices() const {return fWriteVertices;}
-    void Reconstruct();
-    void DoVertices();
+    Bool_t Init();
+    void   SetFilterOnContributors(Int_t nc=1){fFilterOnContributors = nc;}
+    Bool_t Reconstruct(AliRawReader *rawReader);
+    void SetCutOnErrX(Double_t cut=3.){fErrXCut = cut;}
+    void SetCutOnR(Double_t cut=0.2){fRCut = cut;}
+    void SetCutOnCls(UInt_t vmin=50, UInt_t vmax=4000){fLowSPD0=vmin; fHighSPD0=vmax;}
+    void   WriteVertices(const char *filename);
 
+    const TH2F*GetVertexXY() const { return fVertexXY; }
+    const TH1F*GetVertexZ()  const { return fVertexZ;  }
+
+    // Methods used for debug purposes
+    Int_t GetArrayEntries() const {return fVertArray.GetEntries();}
+    const AliESDVertex* GetElementAt(Int_t i) const {return (AliESDVertex*)fVertArray[i];}
+    UInt_t GetSPD0cls(Int_t i) const {return fClu0[i];}
+    Bool_t IsGoodVertex(Int_t i) const {return (fAccEvents.TestBitNumber(i)); }
  
- protected:
-    // copy constructor (NO copy allowed: the constructor is protected
-    // to avoid misuse)
+ private:
+    // copy constructor (NO copy allowed)
     AliITSMeanVertexer(const AliITSMeanVertexer& vtxr);
     // assignment operator (NO assignment allowed)
     AliITSMeanVertexer& operator=(const AliITSMeanVertexer& /* vtxr */);
-    void Init(TString filename);  // initialization invoked by constructors
-    Bool_t Filter(AliESDVertex *vert,AliMultiplicity *mult);
-    void AddToMean(AliESDVertex *vert);
-    Bool_t ComputeMean();
 
-    static const TString fgkMVFileNameDefault;  //! default for fMVFileName
-    TString fLoaderFileName;   //! name of the local file containing loaders
-    TString fGeometryFileName; //! name of the file containing the geometry
-    TString fMVFileName;       //! name of the file containing the mean vertex
-    AliRawReader *fRawReader;  //! rawreader object
-    AliRunLoader *fRunLoader;  //! run loader
-    Double_t fWeighPos[3];     //! weighted average position
-    Double_t fWeighSig[3];     //! errors on weighted average position
-    Double_t fAverPos[3];      //! average position
-    Double_t fAverPosSq[3][3];  //! average square position for covariance
-    Int_t fNoEventsContr;      //! number of events used for mean vertex
-    Float_t fTotTracklets;       //! total number of tracklets used (integrated)
-    Float_t fAverTracklets;    //! average number of tracklets per event
-    Float_t fSigmaOnAverTracks; //! RMS of fAverTracklets
+    Bool_t Filter(AliESDVertex *vert,UInt_t mult);
+    void   AddToMean(AliESDVertex *vert);
+    Bool_t ComputeMean(Bool_t killOutliers);
+    void Reset();
+
+    static const Int_t fgkMaxNumOfEvents;   // max. number of events 
+    AliITSDetTypeRec *fDetTypeRec; //! ITS reco class
+    TH2F    *fVertexXY;        //! histogram with transverse vertex distribution (vertex diamond)
+    TH1F    *fVertexZ;         //! histogram with longitudinal vertex distribution
+
+    Double_t fWeighPosSum[3];    //! weighted average position sum (transient)
+    Double_t fWeighSigSum[3];    //! weighted average position sum (transient)
+    Double_t fAverPosSum[3];     //! average position sum (transient)
+    Double_t fAverPosSqSum[3][3];//! average square position sum for covariance (transient)
+    Double_t fWeighPos[3];       //! weighted average position
+    Double_t fWeighSig[3];       //! errors on weighted average position
+    Double_t fAverPos[3];        //! average position
+    Double_t fAverPosSq[3][3];   //! average square position for covariance
+    Int_t fNoEventsContr;        //! number of events used for mean vertex
+    Double_t fTotContributors;      //! Integrated number of contributors
+    Double_t fAverContributors;  //! Average number of contributors
     Int_t fFilterOnContributors; //! Numb. of contrib must be > fFilter...
-    Int_t fFilterOnTracklets; //! Numb. of tracklets must be > fFilterOnTr...
-    Bool_t fWriteVertices; //! if kTRUE all the vertices are saved to a file
+    Bool_t fMode;                //! kTRUE for Vertexer3D; 
+                                 //! kFALSE for VertexerTapan
+    AliITSVertexer* fVertexer;   //! vertexer
+
+    TBits fAccEvents;           //! bit string: 1 for good events 0 for bad ones
+    TClonesArray fVertArray;     //! array of vertices to be averaged
+    UInt_t *fClu0;              //! number of clusters on SPD inner layer
+    Int_t fIndex;               //! current index on the arrays
+    Double_t fErrXCut;          //! cut on error on X (error*1000<fErrXCut)
+    Double_t fRCut;             //| cut on distance from first estimate (mm)
+    UInt_t fLowSPD0;            //! low SPD0 cls value to accept event
+    UInt_t fHighSPD0;           //! high SPD0 cls value to accept event
 
-  ClassDef(AliITSMeanVertexer,0);
+    ClassDef(AliITSMeanVertexer,0)
 };
 
 #endif