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