1 #ifndef ST_FWD_TRACK_MAKER_H
2 #define ST_FWD_TRACK_MAKER_H
4 #include "StChain/StMaker.h"
7 #include "GenFit/Track.h"
8 #include "StFwdTrackMaker/include/Tracker/FwdHit.h"
11 #include "FwdTrackerConfig.h"
60 void Clear(
const Option_t *opts =
"");
62 enum { kInnerGeometry,
65 void SetConfigFile(std::string n) {
69 void LoadConfiguration();
70 void SetVisualize(
bool _viz ) { mVisualize = _viz; }
72 vector<StFwdTrack*> mFwdTracks;
74 vector<FwdHit> &GetFttHits() {
return mFwdHitsFtt; }
75 vector<FwdHit> &GetFstHits() {
return mFwdHitsFst; }
79 std::shared_ptr<ForwardTracker> GetForwardTracker() {
return mForwardTracker; }
80 const std::vector<Seed_t> &getTrackSeeds()
const;
81 const std::vector<GenfitTrackResult> &getFitResults()
const;
83 TVector3 GetEventPrimaryVertex();
91 float mEventFilterMinTofMult = 2;
92 bool mEventFilterRequireEventVertex =
false;
93 bool mEventFilterRequireVpdVertex =
true;
94 float mEventFilterMinVpdZ = -99;
95 float mEventFilterMaxVpdZ = 99;
98 size_t eventIndex = 0;
100 TVector3 mEventVertex;
102 std::string mConfigFile;
104 std::map<std::string, TH1 *> mHistograms;
106 bool mVisualize =
false;
107 vector<TVector3> mFttHits;
108 vector<TVector3> mFstHits;
109 vector<TVector3> mFcsClusters;
110 vector<float> mFcsClusterEnergy;
111 vector<TVector3> mFcsPreHits;
113 std::vector< genfit::GFRaveVertex * > mRaveVertices;
114 vector<float> mFttZFromGeom, mFstZFromGeom;
116 void ProcessFwdTracks();
118 void FillTrackDeltas();
126 TMatrixDSym mEventVertexCov;
127 enum FwdVertexSource { kFwdVertexSourceUnknown, kFwdVertexSourceNone, kFwdVertexSourceTpc, kFwdVertexSourceMc, kFwdVertexSourceVpd };
128 FwdVertexSource mFwdVertexSource = StFwdTrackMaker::kFwdVertexSourceUnknown;
129 vector<FwdHit> mFwdHitsFtt;
130 vector<FwdHit> mFwdHitsFst;
131 std::shared_ptr<SiRasterizer> mSiRasterizer;
133 std::shared_ptr<ForwardTracker> mForwardTracker;
134 std::shared_ptr<FwdDataSource> mForwardData;
135 size_t loadMcTracks( std::map<
int, std::shared_ptr<McTrack>> &mcTrackMap );
137 void loadFttHits( std::map<
int, std::shared_ptr<McTrack>> &mcTrackMap, std::map<
int, std::vector<KiTrack::IHit *>> &hitMap,
int count = 0 );
138 void loadFttHitsFromStEvent( std::map<
int, std::shared_ptr<McTrack>> &mcTrackMap, std::map<
int, std::vector<KiTrack::IHit *>> &hitMap,
int count = 0 );
139 void loadFttHitsFromGEANT( std::map<
int, std::shared_ptr<McTrack>> &mcTrackMap, std::map<
int, std::vector<KiTrack::IHit *>> &hitMap,
int count = 0 );
141 int loadFstHits( std::map<
int, std::shared_ptr<McTrack>> &mcTrackMap, std::map<
int, std::vector<KiTrack::IHit *>> &hitMap );
142 int loadFstHitsFromMuDst( std::map<
int, std::shared_ptr<McTrack>> &mcTrackMap, std::map<
int, std::vector<KiTrack::IHit *>> &hitMap );
143 int loadFstHitsFromGEANT( std::map<
int, std::shared_ptr<McTrack>> &mcTrackMap, std::map<
int, std::vector<KiTrack::IHit *>> &hitMap );
144 int loadFstHitsFromStEvent( std::map<
int, std::shared_ptr<McTrack>> &mcTrackMap, std::map<
int, std::vector<KiTrack::IHit *>> &hitMap );
145 int loadFstHitsFromStRnDHits( std::map<
int, std::shared_ptr<McTrack>> &mcTrackMap, std::map<
int, std::vector<KiTrack::IHit *>> &hitMap );
152 static std::string defaultConfig;
153 bool configLoaded =
false;
253 void setZeroB(
bool zeroB =
true ) { mFwdConfig.
set<
bool>(
"TrackFitter:zeroB", zeroB ); }
257 void setConstB(
bool constB =
true ) { mFwdConfig.
set<
bool>(
"TrackFitter:constB", constB ); }
269 void setTrackRefit(
bool refit =
true) { mFwdConfig.
set<
bool>(
"TrackFitter:refit", refit ); }
278 void setFitDebugLvl(
int level = 0 ) {mFwdConfig.
set<
int>(
"TrackFitter.KalmanFitterRefTrack:DebugLvl", level); }
306 mFwdConfig.
set( k, v );
314 void setCrit2( std::string name,
double min,
double max ){
315 for (
auto p : mFwdConfig.
childrenOf(
"TrackFinder.Iteration.SegmentBuilder" ) ){
316 auto nName = mFwdConfig.
get<std::string>( p +
":name",
"DNE" );
318 LOG_DEBUG <<
"Setting Crit2=" << nName <<
" (min=" << min <<
", max=" << max <<
")" << endm;
319 mFwdConfig.
set<
double>(p +
":min", min );
320 mFwdConfig.
set<
double>(p +
":max", max );
333 void setCrit3( std::string name,
double min,
double max ){
334 for (
auto p : mFwdConfig.
childrenOf(
"TrackFinder.Iteration.ThreeHitSegments" ) ){
335 auto nName = mFwdConfig.
get<std::string>( p +
":name",
"DNE" );
337 LOG_DEBUG <<
"Setting Crit3=" << nName <<
" (min=" << min <<
", max=" << max <<
")" << endm;
338 mFwdConfig.
set<
double>(p +
":min", min );
339 mFwdConfig.
set<
double>(p +
":max", max );
void setCrit3(std::string name, double min, double max)
Sets a criteria value in the config for 3-hit criteria.
void setSmearMcPrimaryVertex(bool pvs=true)
Enables smearing of the MC Primary Vertex according to sigmaXY,Z.
int loadFstHits(std::map< int, std::shared_ptr< McTrack >> &mcTrackMap, std::map< int, std::vector< KiTrack::IHit * >> &hitMap)
Loads FST hits from various sources into the hitmap and McTrackMap (if availabale) ...
void setZeroB(bool zeroB=true)
Set B-field to zero (for zero field running)
void FitVertex()
Fit the primary vertex using FWD tracks.
void setPrimaryVertexSigmaZ(double sZ)
Set the resolution for the Primary Vertex in Z sZ : sigma in Z (cm)
void setSeedFindingUseHitRemover(bool use=true)
Enable or disable the HitRemover.
void setFittingMaterialEffects(bool mat=true)
Enable / disable material effects Material effects in kalman filter.
void setConfigKeyValue(std::string k, std::string v)
Set a generic Key Value in the Config object.
void setCrit2(std::string name, double min, double max)
Sets a criteria value in the config for 2-hit criteria.
void setFttHitSource(std::string source)
Set the data source for FTT hits.
std::vector< std::string > childrenOf(std::string path) const
list the paths of children nodes for a given node
void setUseMcSeedForFit(bool mcSeed=true)
Force the use of McSeed for fit.
StFwdTrack * makeStFwdTrack(GenfitTrackResult >r, size_t indexTrack)
void setMaxFailedHitsInFit(int n=-1)
Sets the maximum number of hits that can be considered failed before the entire track fit fails...
void setSeedFindingWithFstFttSimultaneous()
Use FST and Ftt hits (simultaneously) in the Seed Finding.
void setSeedFindingConnectorDistance(int d=1)
Set the connector distance for track finding.
void setUseFstRasteredGeantHits(bool use=true)
Enable or disable the Fst Rasterizer.
void setSeedFindingUseSubsetNN(bool use=true)
Enable or disable the SubsetNN.
void setSeedFindingWithFstFttSequential()
Use FST and Ftt hits (sequentially) in the Seed Finding - then merge tracks.
void setConstB(bool constB=true)
Set B-field to constant (even outside of TPC)
void setTrackFittingOff()
Turn off track fitting Useful if you want to speed up the run but dont need fitting (testing seed fin...
void setSeedFindingWithFtt()
Use Ftt hits in the Seed Finding.
void set(std::string path, T v)
Writes a value of type T to the map Uses convertTo<T> to convert type T to a string rep...
void setSeedFindingNumInterations(int n=1)
Set the number of track finding iterations.
void setFstRasterPhi(double phi=0.00409)
Set the resolution in phi for rasterizing FST hits (from fast sim) Only used when the Rasterizer is e...
void setFitMaxIterations(int n=4)
Sets Max fit iterations before failing.
void setFstRasterR(double r=3.0)
Set the resolution in R for rasterizing FST hits (from fast sim) Only used when the Rasterizer is ena...
void setSeedFindingMinHitsOnTrack(int n=3)
Enable or disable the SubsetNN.
void setUseTruthSeedFinding(bool use=true)
Enable or disable the Truth Seed finding.
void setOutputFilename(std::string fn)
Set the filename for output ROOT file.
T get(std::string path, T dv) const
template function for getting any type that can be converted from string via stringstream ...
void setFitDebugLvl(int level=0)
Sets Fitter debug level.
void setTrackRefit(bool refit=true)
Sets the tracking to refit This adds compatible hits from whichever detector was NOT used in seed fin...
size_t loadMcTracks(std::map< int, std::shared_ptr< McTrack >> &mcTrackMap)
void setGeoCache(TString gc)
Sets geometry cache filename.
void setSeedFindingNumPhiSlices(int n=8)
Set the number of phi slices to split the track iterations into.
void setFitMinIterations(int n=1)
Sets Min fit iterations before converging.
void setPrimaryVertexSigmaXY(double sXY)
Set the resolution for the Primary Vertex in XY sXY : sigma in XY (cm)
void setSeedFindingWithFst()
Use Fst hits in the Seed Finding.