StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StGenericVertexFinder.h
1 
12 #ifndef STAR_StGenericVertexFinder
13 #define STAR_StGenericVertexFinder
14 
15 #include <vector>
16 
17 #include "TMinuit.h"
18 
19 #include "StPrimaryVertex.h"
20 #include "tables/St_vertexSeed_Table.h"
21 #include "StGenericVertexMaker/VertexFinderOptions.h"
22 
23 class StEvent;
24 class StMuDst;
25 class StDcaGeometry;
26 class TClonesArray;
27 class St_db_Maker;
28 
29 
31 {
32 public:
33 
34  // Alias for shorthand
35  using StDcaList = std::vector<const StDcaGeometry*>;
36 
39  using VertexFit_t = star_vertex::VertexFit_t;
40 
42  using SeedFinder_t = star_vertex::SeedFinder_t;
43 
44  // virtual and '=0' ; those MUST be implemented
45  virtual ~StGenericVertexFinder(); // virtual destructor
46  virtual int fit(StEvent*)=0; // fit the vertex
47 
48  StPrimaryVertex* getVertex(int idx) const;
49  void addVertex(const StPrimaryVertex& vtx);
50  int size() const;
51  void UseVertexConstraint(const vertexSeed_st& beamline);
52  void NoVertexConstraint();
53  int IsVertexConstraint() const {return mVertexConstrain;}
54  virtual void UsePCT(bool usePCT = true);
55  virtual void UseBTOF(bool useBTOF = true){mUseBtof=useBTOF;}
56  virtual void UseCTB (bool useCTB = true){mUseCtb =useCTB ;}
57 
58  virtual void printInfo(ostream& = cout) const=0;
59 
60  // General (default)
61  virtual void SetMode(Int_t mode=0 ) {mMode = mode;}
62  virtual int GetMode() const {return mMode;}
63  void SetDebugLevel(Int_t level) {mDebugLevel=level;}
64  virtual void Init(){ /* noop */;}
65  virtual void Finish(){ /* noop */;}
66  virtual void InitRun(int run_number, const St_db_Maker* db_maker);
67  virtual void Clear();
68  const std::vector<StPrimaryVertex> *result() {return &mVertexList;}
69 
70  void result(TClonesArray& stMuDstPrimaryVertices);
71 
72  void FillStEvent(StEvent*);
73  virtual void SetVertexPosition(double x,double y,double z){assert(0);}
74  virtual void SetVertexError(double x,double y,double z){assert(0);}
75  virtual int IsFixed() const {return 0;}
76 
77  virtual int fit(const StMuDst& muDst) { return -1; }
78 
79 protected:
80 
83 
84  StGenericVertexFinder(SeedFinder_t seedFinder, VertexFit_t fitMode);
85 
86  StPrimaryVertexOrder mVertexOrderMethod; // will default to 0 i.e. orderByNumberOfDaughters
87  bool mVertexConstrain; // Use vertex constraint from db
88  int mMode; // used for any Finder behavior change
89 
91  VertexFit_t mVertexFitMode;
92 
94  SeedFinder_t mSeedFinderType;
95 
96  int mDebugLevel;
97  bool mUseBtof; // default use btof = false
98  bool mUseCtb; // default use ctb = false
99 
102  vertexSeed_st mBeamline;
103 
106  StDcaList mDCAs;
107 
108  TMinuit* mMinuit;
109 
113 
117  std::vector<double> FindSeeds_TSpectrum();
118 
121  double beamX(double z) const;
122 
125  double beamY(double z) const;
126 
129  StThreeVectorD CalcVertexSeed(const StDcaList &trackDcas);
130 
132  virtual double CalcChi2DCAs(const StThreeVectorD &point);
133 
135  double CalcChi2Beamline(const StThreeVectorD& point);
136 
138  double CalcChi2DCAsBeamline(const StThreeVectorD &point);
139 
140  // A static interface to CalcChi2DCAs(...)
141  static void fcnCalcChi2DCAs(int& npar, double* gin, double& f, double* par, Int_t iflag)
142  {
143  f = sSelf->CalcChi2DCAs( StThreeVectorD(par) );
144  }
145 
147  static void fcnCalcChi2DCAsBeamline1D(int& npar, double* gin, double& f, double* par, Int_t iflag)
148  {
149  double z = par[0], x = sSelf->beamX(z), y = sSelf->beamY(z);
150  f = sSelf->CalcChi2DCAs( StThreeVectorD(x, y, z) );
151  }
152 
154  static void fcnCalcChi2DCAsBeamline(int& npar, double* gin, double& f, double* par, int iflag)
155  {
157  }
158 
159 private:
160 
162  std::vector<StPrimaryVertex> mVertexList;
163 
164  virtual void UseVertexConstraint() = 0;
165 };
166 
167 #endif
virtual double CalcChi2DCAs(const StThreeVectorD &point)
Caclulates total chi2 for the track DCAs stored in mDCAs and a point.
void UseVertexConstraint(const vertexSeed_st &beamline)
star_vertex::VertexFit_t VertexFit_t
double CalcChi2DCAsBeamline(const StThreeVectorD &point)
Caclulates total chi2 for the beamline and track DCAs stored in mDCAs and a point.
SeedFinder_t mSeedFinderType
The type of vertex seed finder to use in derived concrete implementation.
double CalcChi2Beamline(const StThreeVectorD &point)
Caclulates chi2 for the beamline and a point.
double beamX(double z) const
StPrimaryVertexOrder
star_vertex::SeedFinder_t SeedFinder_t
Options to select vertex seed finder.
double beamY(double z) const
std::vector< double > FindSeeds_TSpectrum()
static void fcnCalcChi2DCAsBeamline1D(int &npar, double *gin, double &f, double *par, Int_t iflag)
A static interface to CalcChi2DCAs(...) with x and y fixed by beamline equation.
StThreeVectorD CalcVertexSeed(const StDcaList &trackDcas)
static void fcnCalcChi2DCAsBeamline(int &npar, double *gin, double &f, double *par, int iflag)
A static interface to CalcChi2DCAsBeamline(...)
VertexFit_t mVertexFitMode
The type of vertex fit to use in derived concrete implementation.
static StGenericVertexFinder * sSelf
By default point to invalid object.
StGenericVertexFinder()
Default initialization with unspecified seed finder and fitting mode.