Belle II Software  release-08-01-10
Fitter3D.h
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 
9 //-----------------------------------------------------------------------------
10 // Description : A class to fit tracks in 3D
11 //-----------------------------------------------------------------------------
12 
13 #ifndef TRGCDCFitter3D_FLAG_
14 #define TRGCDCFitter3D_FLAG_
15 
16 #include <string>
17 #include <vector>
18 #include <TFile.h>
19 #include <TTree.h>
20 #include <TVectorD.h>
21 
22 #ifdef TRGCDC_SHORT_NAMES
23 #define TCFitter3D TRGCDCFitter3D
24 #endif
25 
26 namespace Belle2 {
32  class TRGCDC;
33  class TRGCDCTrack;
34  class TRGCDCSegmentHit;
35  class TRGCDCJSignal;
36  class TRGCDCJLUT;
37  class TRGCDCJSignalData;
38 
41 
42  public:
43 
45  TRGCDCFitter3D(const std::string& name,
46  const std::string& rootFitter3DFile,
47  const TRGCDC&,
48  const std::map<std::string, bool>& flags);
50  virtual ~TRGCDCFitter3D();
51 
52  public:
53 
55  void initialize();
57  void terminate();
58 
60  int doit(std::vector<TRGCDCTrack*>& trackList);
61 
63  int doitComplex(std::vector<TRGCDCTrack*>& trackList);
64 
66  static double calPhi(TRGCDCSegmentHit const* segmentHit, double eventTime);
68  static void getMCValues(const TRGCDC& m_cdc_in, TRGCDCTrack* aTrack, const std::map<std::string, double>& m_mConstD_in,
69  std::map<std::string, double>& m_mDouble_in, std::map<std::string, std::vector<double> >& m_mVector_in);
70 
72  bool isAxialTrackFull(const TRGCDCTrack& aTrack);
73 
75  bool isStereoTrackFull(const TRGCDCTrack& aTrack);
76 
78  static void findHitAxialSuperlayers(const TRGCDCTrack& aTrack, std::vector<double>& useAxSL, bool printError);
79 
81  static void findHitStereoSuperlayers(const TRGCDCTrack& aTrack, std::vector<double>& useStSL, bool printError);
82 
84  void removeImpossibleStereoSuperlayers(std::vector<double>& useStSL);
85 
87  static void selectAxialTSs(const TRGCDCTrack& aTrack, std::vector<int>& bestTSIndex);
88 
90  static int do2DFit(TRGCDCTrack& aTrack, const std::map<std::string, bool>& m_mBool_in,
91  const std::map<std::string, double>& m_mConstD_in,
92  std::map<std::string, std::vector<double> >& m_mConstV_in, std::map<std::string, double>& m_mDouble_in,
93  std::map<std::string, std::vector<double> >& m_mVector_in);
94 
96  void print3DInformation(int iTrack);
97 
100  void saveVhdlAndCoe();
102  void saveAllSignals();
104  void saveIoSignals();
105 
107  std::string name(void) const;
109  std::string version(void) const;
110 
112  static void getStereoGeometry(std::map<std::string, std::vector<double> >& stGeometry);
113 
115  static void getStereoXt(std::vector<double> const& stPriorityLayer, std::vector<std::vector<double> >& stXts, bool isSimple = 0);
116 
118  static void getConstants(std::map<std::string, double>& mConstD, std::map<std::string, std::vector<double> >& mConstV,
119  bool isXtSimple = 0);
120 
121  private:
123  const std::string m_name;
124 
126  const TRGCDC& m_cdc;
127 
129  std::map<std::string, double> m_mDouble;
131  std::map<std::string, std::vector<double> > m_mVector;
133  std::map<std::string, double> m_mConstD;
135  std::map<std::string, std::vector<double> > m_mConstV;
137  std::map<std::string, bool> m_mBool;
138 
140  std::map<std::string, TRGCDCJSignal> m_mSignalStorage;
142  std::map<std::string, TRGCDCJLUT*> m_mLutStorage;
145 
148 
151 
154 
157 
159  std::map<std::string, TVectorD*> m_mTVectorD;
161  std::map<std::string, TClonesArray*> m_mTClonesArray;
163  std::map<std::string, std::vector<signed long long> > m_mSavedSignals;
165  std::map<std::string, std::vector<signed long long> > m_mSavedIoSignals;
166 
167  };
168 
170 }
171 
172 
173 #endif
A class to fit tracks in 3D.
Definition: Fitter3D.h:40
std::map< std::string, TVectorD * > m_mTVectorD
TVectorD map for saving values to root file.
Definition: Fitter3D.h:159
std::map< std::string, std::vector< double > > m_mVector
Map to hold vector values for Fitter3D.
Definition: Fitter3D.h:131
std::map< std::string, bool > m_mBool
Map to hold input options.
Definition: Fitter3D.h:137
std::map< std::string, double > m_mConstD
Map to hold constant values for Fitter3D.
Definition: Fitter3D.h:133
std::map< std::string, std::vector< signed long long > > m_mSavedSignals
Array of saved signals.
Definition: Fitter3D.h:163
std::map< std::string, TRGCDCJLUT * > m_mLutStorage
Map to hold JLuts.
Definition: Fitter3D.h:142
std::map< std::string, std::vector< double > > m_mConstV
Map to hold constant vectcors for Fitter3D.
Definition: Fitter3D.h:135
std::map< std::string, double > m_mDouble
Map to hold double values for Fitter3D.
Definition: Fitter3D.h:129
const std::string m_name
Name.
Definition: Fitter3D.h:123
std::map< std::string, TRGCDCJSignal > m_mSignalStorage
Map to hold JSignals.
Definition: Fitter3D.h:140
std::map< std::string, TClonesArray * > m_mTClonesArray
TClonesArray map for saving values to root file.
Definition: Fitter3D.h:161
TFile * m_fileFitter3D
Tfile for Fitter3D root file.
Definition: Fitter3D.h:150
TRGCDCJSignalData * m_commonData
For VHDL code.
Definition: Fitter3D.h:144
TTree * m_treeTrackFitter3D
TTree for tracks of fitter3D.
Definition: Fitter3D.h:153
std::map< std::string, std::vector< signed long long > > m_mSavedIoSignals
Array of I/O signals.
Definition: Fitter3D.h:165
TTree * m_treeConstantsFitter3D
TTree for constants of fitter3D.
Definition: Fitter3D.h:156
std::string m_rootFitter3DFileName
Members for saving.
Definition: Fitter3D.h:147
const TRGCDC & m_cdc
CDCTRG.
Definition: Fitter3D.h:126
A class to hold common data for JSignals.
Definition: JSignalData.h:33
A class to represent a track segment hit in CDC.
Definition: SegmentHit.h:31
A class to represent a reconstructed charged track in TRGCDC.
Definition: TRGCDCTrack.h:38
The instance of TRGCDC is a singleton.
Definition: TRGCDC.h:69
static void findHitAxialSuperlayers(const TRGCDCTrack &aTrack, std::vector< double > &useAxSL, bool printError)
Finds which axial superlayers has TSs. useAxSL array indicating hit superlayers.
Definition: Fitter3D.cc:1133
static void getStereoGeometry(std::map< std::string, std::vector< double > > &stGeometry)
Get stereo geometry.
Definition: Fitter3D.cc:1558
void initialize()
Initialization.
Definition: Fitter3D.cc:78
static double calPhi(TRGCDCSegmentHit const *segmentHit, double eventTime)
Utility functions.
Definition: Fitter3D.cc:895
bool isStereoTrackFull(const TRGCDCTrack &aTrack)
Checks if stereo track has 4 TSs. One per each superlayer.
Definition: Fitter3D.cc:1102
void saveVhdlAndCoe()
Functions for saving.
Definition: Fitter3D.cc:912
int doit(std::vector< TRGCDCTrack * > &trackList)
Does track fitting.
Definition: Fitter3D.cc:213
static void getStereoXt(std::vector< double > const &stPriorityLayer, std::vector< std::vector< double > > &stXts, bool isSimple=0)
Get stereo Xt.
Definition: Fitter3D.cc:1578
void removeImpossibleStereoSuperlayers(std::vector< double > &useStSL)
Removes TSs that are not possible with track Pt.
Definition: Fitter3D.cc:1193
static void selectAxialTSs(const TRGCDCTrack &aTrack, std::vector< int > &bestTSIndex)
Selects priority TSs when there are multiple candidate TSs for a superlayer.
Definition: Fitter3D.cc:1204
void terminate()
Termination.
Definition: Fitter3D.cc:1530
void saveIoSignals()
Saves all I/O signals for debugging.
Definition: Fitter3D.cc:944
TRGCDCFitter3D(const std::string &name, const std::string &rootFitter3DFile, const TRGCDC &, const std::map< std::string, bool > &flags)
Constructor.
Definition: Fitter3D.cc:62
void print3DInformation(int iTrack)
Print's information for debugging 3D.
Definition: Fitter3D.cc:1474
virtual ~TRGCDCFitter3D()
Destructor.
Definition: Fitter3D.cc:74
static void findHitStereoSuperlayers(const TRGCDCTrack &aTrack, std::vector< double > &useStSL, bool printError)
Finds which stereo superlayers has TSs. useStSL array indicating hit superlayers.
Definition: Fitter3D.cc:1164
static int do2DFit(TRGCDCTrack &aTrack, const std::map< std::string, bool > &m_mBool_in, const std::map< std::string, double > &m_mConstD_in, std::map< std::string, std::vector< double > > &m_mConstV_in, std::map< std::string, double > &m_mDouble_in, std::map< std::string, std::vector< double > > &m_mVector_in)
Does 2D fit. Returns 0 if fit is done successfully. m_mBool should have fIsPrintError,...
Definition: Fitter3D.cc:1259
std::string name(void) const
Gets name of class.
Definition: Fitter3D.cc:1553
static void getConstants(std::map< std::string, double > &mConstD, std::map< std::string, std::vector< double > > &mConstV, bool isXtSimple=0)
Get constants for firmwareFit.
Definition: Fitter3D.cc:1596
std::string version(void) const
Gets version of class.
Definition: Fitter3D.cc:1548
static void getMCValues(const TRGCDC &m_cdc_in, TRGCDCTrack *aTrack, const std::map< std::string, double > &m_mConstD_in, std::map< std::string, double > &m_mDouble_in, std::map< std::string, std::vector< double > > &m_mVector_in)
Function for mc debugging.
Definition: Fitter3D.cc:963
void saveAllSignals()
Saves all signals for debugging.
Definition: Fitter3D.cc:934
int doitComplex(std::vector< TRGCDCTrack * > &trackList)
Does track fitting using JSignals.
Definition: Fitter3D.cc:460
bool isAxialTrackFull(const TRGCDCTrack &aTrack)
Checks if axial track has 5 TSs. One per each superlayer.
Definition: Fitter3D.cc:1071
Abstract base class for different kinds of events.