]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/ITSrec/AliITSMeanVertexer.h
Fix for FMD DA
[u/mrichter/AliRoot.git] / ITS / ITSrec / AliITSMeanVertexer.h
1 #ifndef ALIITSMEANVERTEXER_H
2 #define ALIITSMEANVERTEXER_H
3
4 ///////////////////////////////////////////////////////////////////////
5 //                                                                   //
6 // Class to compute vertex position using SPD local reconstruction   //
7 // An average vertex position using all the events                   //
8 // is built and saved                                                //
9 ///////////////////////////////////////////////////////////////////////
10
11 /* $Id$ */
12
13 #include <TObject.h>
14 #include <TBits.h>
15 #include "TClonesArray.h"
16
17 class TClonesArray;
18 class TH1F;
19 class TH2F;
20 class AliRawReader;
21 class AliESDVertex;
22 class AliITSDetTypeRec;
23 class AliITSVertexer;
24
25 class AliITSMeanVertexer : public TObject {
26
27  public:
28   // default constructor
29     AliITSMeanVertexer(Bool_t mode = kTRUE);   
30     virtual ~AliITSMeanVertexer();
31  
32     Bool_t Init();
33  
34     void   SetFilterOnContributors(Int_t nc=1){fFilterOnContributors = nc;}
35     Bool_t Reconstruct(AliRawReader *rawReader);
36     void SetCutOnErrX(Double_t cut=9.5){fErrXCut = cut;}
37     void SetCutOnR(Double_t cut=0.5){fRCut = cut;}
38     void SetCutOnCls(UInt_t vmin=50, UInt_t vmax=7000){fLowSPD0=vmin; fHighSPD0=vmax;}
39     void SetZFiducialRegion(Double_t zcut=40.){fZCutDiamond=zcut;}
40     void   WriteVertices(const char *filename);
41
42     const TH2F*GetVertexXY() const { return fVertexXY; }
43     const TH1F*GetVertexZ()  const { return fVertexZ;  }
44
45     // Methods used for debug purposes
46     Int_t GetArrayEntries() const {return fVertArray.GetEntries();}
47     const AliESDVertex* GetElementAt(Int_t i) const {return (AliESDVertex*)fVertArray[i];}
48     UInt_t GetSPD0cls(Int_t i) const {return fClu0[i];}
49     Bool_t IsGoodVertex(Int_t i) const {return (fAccEvents.TestBitNumber(i)); }
50  
51  private:
52     // copy constructor (NO copy allowed)
53     AliITSMeanVertexer(const AliITSMeanVertexer& vtxr);
54     // assignment operator (NO assignment allowed)
55     AliITSMeanVertexer& operator=(const AliITSMeanVertexer& /* vtxr */);
56
57     Bool_t Filter(AliESDVertex *vert,UInt_t mult);
58     void   AddToMean(AliESDVertex *vert);
59     Bool_t ComputeMean(Bool_t killOutliers);
60     void Reset(Bool_t redefine2D,Bool_t complete);
61     void ResetArray(){fAccEvents.ResetAllBits(kTRUE); fVertArray.Clear();
62       fIndex=0; for(Int_t i=0;i<fgkMaxNumOfEvents;i++)fClu0[i]=0; }
63
64     static const Int_t fgkMaxNumOfEvents;   // max. number of events 
65     AliITSDetTypeRec *fDetTypeRec; //! ITS reco class
66     TH2F    *fVertexXY;        //! histogram with transverse vertex distribution (vertex diamond)
67     TH1F    *fVertexZ;         //! histogram with longitudinal vertex distribution
68
69     Double_t fWeighPosSum[3];    //! weighted average position sum (transient)
70     Double_t fWeighSigSum[3];    //! weighted average position sum (transient)
71     Double_t fAverPosSum[3];     //! average position sum (transient)
72     Double_t fAverPosSqSum[3][3];//! average square position sum for covariance (transient)
73     Double_t fWeighPos[3];       //! weighted average position
74     Double_t fWeighSig[3];       //! errors on weighted average position
75     Double_t fAverPos[3];        //! average position
76     Double_t fAverPosSq[3][3];   //! average square position for covariance
77     Int_t fNoEventsContr;        //! number of events used for mean vertex
78     Double_t fTotContributors;      //! Integrated number of contributors
79     Double_t fAverContributors;  //! Average number of contributors
80     Int_t fFilterOnContributors; //! Numb. of contrib must be > fFilter...
81     Bool_t fMode;                //! kTRUE for Vertexer3D; 
82                                  //! kFALSE for VertexerTapan
83     AliITSVertexer* fVertexer;   //! vertexer
84
85     TBits fAccEvents;           //! bit string: 1 for good events 0 for bad ones
86     TClonesArray fVertArray;     //! array of vertices to be averaged
87     UInt_t *fClu0;              //! number of clusters on SPD inner layer
88     Int_t fIndex;               //! current index on the arrays
89     Double_t fErrXCut;          //! cut on error on X (error*1000<fErrXCut)
90     Double_t fRCut;             //| cut on distance from first estimate (mm)
91     Double_t fZCutDiamond;      //! -/+ fZCutDiamond is the Z fiducial region
92     UInt_t fLowSPD0;            //! low SPD0 cls value to accept event
93     UInt_t fHighSPD0;           //! high SPD0 cls value to accept event
94     TH1F *fMultH;               //! debug hist: mult. on SPD0 before Filter
95     TH1F *fErrXH;               //! debug hist: error on X before Filter
96     TH1F *fMultHa;              //! debug hist: mult. on SPD0 after Filter
97     TH1F *fErrXHa;              //! debug hist: error on X after Filter
98     TH1F *fDistH;               //! debug hist: distance from peak
99     TH1F *fContrH;              //! debug hist: number of contributors
100     TH1F *fContrHa;             //! debug hist: number of contributors - after filter
101
102     ClassDef(AliITSMeanVertexer,0)
103 };
104
105 #endif