7 #include <phfield/PHFieldConfig_v3.h>
8 #include <phfield/PHFieldUtility.h>
9 #include <phgeom/PHGeomUtility.h>
27 #include <phgeom/PHGeomTGeo.h>
41 #include <boost/lexical_cast.hpp>
45 _input_type(
SQReco::E1039),
46 _fitter_type(
SQReco::KFREF),
49 _eval_file_name(
"eval.root"),
52 _enable_eval_dst(false),
53 _tracklet_vector(nullptr),
56 _eventReducer(nullptr),
65 _event_header(nullptr),
67 _triggerhit_vector(nullptr),
68 _legacy_rec_container(true),
71 _recTrackVec(nullptr),
72 _use_geom_io_node(false),
74 _t_geo_manager(nullptr)
162 if(
Verbosity() > 1) std::cout <<
"SQReco::InitField" << std::endl;
169 std::cout <<
"PHField check: " <<
"-------" << std::endl;
170 std::ofstream field_scan(
"field_scan.csv");
181 if(
Verbosity() > 1) std::cout <<
"SQReco::InitGeom" << std::endl;
188 std::cout <<
"SQReco::InitGeom - Both 'geom_file_name' and 'use_geom_io_node' are active. Use only one." << std::endl;
196 if(
Verbosity() > 1) std::cout <<
"SQReco::InitGeom - use geom from RUN node tree." << std::endl;
200 std::cout <<
"SQReco::InitGeom - Failed at loading the GEOMETRY_IO node." << std::endl;
206 if(
Verbosity() > 1) std::cout <<
"SQReco::InitGeom - use geom from PAR node tree." << std::endl;
210 std::cout <<
"SQReco::InitGeom - Failed at loading the GEOMETRY node." << std::endl;
235 LogInfo(
"SRawEvent before the Reducer");
247 LogInfo(
"SRawEvent after the Reducer");
309 if(
Verbosity() > 2) std::cout <<
"Entering SQReco::process_event: " <<
_event << std::endl;
324 int nFittedTracks = 0;
326 for(
auto iter = rec_tracklets.begin(); iter != rec_tracklets.end(); ++iter)
356 if(
Verbosity() > 2) std::cout <<
"Leaving SQReco::process_event: " <<
_event <<
", finder status " << finderstatus <<
", " << nTracklets <<
" track candidates, " << nFittedTracks <<
" fitted tracks" << std::endl;
364 for(
auto iter = eval_tracklets.begin(); iter != eval_tracklets.end(); ++iter)
368 new((*_tracklets)[nTracklets])
Tracklet(*iter);
406 if(
Verbosity() > 2) std::cout << __FUNCTION__ <<
": " << __LINE__ <<
": kmtrk nodelist empty" << std::endl;
412 if(
Verbosity() > 2) std::cout << __FUNCTION__ <<
": " << __LINE__ <<
": kFitter failed to converge" << std::endl;
420 if(
Verbosity() > 2) std::cout << __FUNCTION__ <<
": " << __LINE__ <<
": kmtrk quality cut failed" << std::endl;
446 if(
Verbosity() > 2) std::cout << __FUNCTION__ <<
": " << __LINE__ <<
": gFitter failed to converge." << std::endl;
506 LogInfo(
"No DST node, create one");
513 _recEvent = findNode::getClass<SRecEvent>(topNode,
"SRecEvent");
522 _recTrackVec = findNode::getClass<SQTrackVector>(eventNode,
"SQRecTrackVector");
536 _tracklet_vector = findNode::getClass<TrackletVector>(topNode,
"TrackletVector");
552 _run_header = findNode::getClass<SQRun>(topNode,
"SQRun");
555 if(
Verbosity() > 2) std::cout << __FUNCTION__ <<
": !_run_header" << std::endl;
559 _spill_map = findNode::getClass<SQSpillMap>(topNode,
"SQSpillMap");
562 if(
Verbosity() > 2) std::cout << __FUNCTION__ <<
": !_spill_map" << std::endl;
566 _event_header = findNode::getClass<SQEvent>(topNode,
"SQEvent");
569 if(
Verbosity() > 2) std::cout << __FUNCTION__ <<
": !_event_header" << std::endl;
573 _hit_vector = findNode::getClass<SQHitVector>(topNode,
"SQHitVector");
576 std::cout << __FUNCTION__ <<
": !_hit_vector" << std::endl;
583 if(
Verbosity() > 2) std::cout << __FUNCTION__ <<
": !_triggerhit_vector" << std::endl;
589 _rawEvent = findNode::getClass<SRawEvent>(topNode,
"SRawEvent");
592 if(
Verbosity() > 0)
LogInfo(
"Using SRawEvent as input for E906-like data input");
int reduceEvent(SRawEvent *rawEvent)
@ VERBOSITY_A_LOT
Output a lot of messages.
@ VERBOSITY_SOME
Output some useful messages during manual command line running.
virtual int Verbosity() const
Gets the verbosity of this module.
Definition of hit structure.
void setOutputListIndex(unsigned int i)
Set the index of the final output tracklet list.
std::list< Tracklet > & getTrackletList(int i)
std::list< Tracklet > & getFinalTracklets()
Final output.
virtual int setRawEvent(SRawEvent *event_input)
int processOneTrack(KalmanTrack &_track)
void updateTrack(KalmanTrack &_track)
void setControlParameter(int nMaxIteration, double tolerance)
Set the convergence control parameters.
SRecTrack getSRecTrack()
Output to SRecTrack.
std::list< Node > & getNodeList()
void setTracklet(Tracklet &tracklet, bool wildseedcov=true)
bool isValid()
Self check to see if it is null.
PHBoolean addNode(PHNode *)
PHFieldConfig_v3 implements field configuration information for input a field map file.
static PHField * GetFieldMapNode(const PHFieldConfig *default_config=nullptr, PHCompositeNode *topNode=nullptr, const int verbosity=0)
Get transient PHField from DST nodes. If not found, make a new one based on default_config.
virtual void identify(std::ostream &os=std::cout) const
virtual double get_DoubleFlag(const std::string &name) const
virtual const std::string get_CharFlag(const std::string &flag) const
PHGeomTGeo provide run-time access to TGeoManger. It is transient object and it shall NOT be saved to...
virtual int isValid() const
isValid returns non zero if object contains vailid data
static int ImportGeomFile(PHCompositeNode *topNode, const std::string &geometry_file)
TGeo ROOT/GDML/Macro file -> DST node with automatic file type discrimination based on file names.
static PHGeomTGeo * GetGeomTGeoNode(PHCompositeNode *topNode, bool build_new=true)
Get non-persistent PHGeomTGeo from DST nodes. If not found, make a new one.
static TGeoManager * GetTGeoManager(PHCompositeNode *topNode)
Main user interface: DST node -> TGeoManager for downstream use.
static PHGeomTGeo * LoadFromIONode(PHCompositeNode *topNode)
PHNode * findFirst(const std::string &, const std::string &)
void SplitLevel(const int i)
static PHTFileServer & get(void)
return reference to class singleton
void open(const std::string &filename, const std::string &type="RECREATE")
open a SafeTFile. If filename is not found in the map, create a new TFile and append to the map; incr...
bool cd(const std::string &filename)
change to directory of TFile matching filename
void init(GFField *field, const TString &fitter_choice="KalmanFitterRefTrack")
int processTrack(GFTrack &track, bool display=false)
void print(unsigned int debugLvl=0)
void postFitUpdate(bool updateMeasurements=true)
void setTracklet(Tracklet &tracklet, double z_reference=590., bool wildseedcov=false)
virtual const SQHit * at(const size_t idkey) const =0
An SQ interface class to hold one detector hit.
virtual void set_pos(const float a)
virtual void set_trigger_mask(const bool a)
virtual void set_tdc_time(const float a)
virtual void set_hodo_mask(const bool a)
virtual void set_drift_distance(const float a)
virtual void set_in_time(const bool a)
TGeoManager * _t_geo_manager
std::string _geom_file_name
SQReco::FITTER_TYPE _fitter_type
SQTrackVector * _recTrackVec
SQReco::INPUT_TYPE _input_type
SQGenFit::GFField * _gfield
virtual int InitFastTracking()
std::map< int, size_t > _m_trghitID_idx
bool fitTrackCand(Tracklet &tracklet, KalmanFitter *fitter)
SQHitVector * _triggerhit_vector
std::map< int, size_t > _m_hitID_idx
int updateHitInfo(SRawEvent *sraw_event)
virtual int GetNodes(PHCompositeNode *topNode)
virtual int process_event(PHCompositeNode *topNode)
TClonesArray * _tracklets
virtual int MakeNodes(PHCompositeNode *topNode)
virtual int InitGeom(PHCompositeNode *topNode)
TrackletVector * _tracklet_vector
virtual int End(PHCompositeNode *topNode)
Called at the end of all processing.
void ProcessEventFinish()
SRawEvent * BuildSRawEvent()
SQReco(const std::string &name="SQReco")
std::vector< int > _eval_listIDs
void add_eval_list(int listID)
SQHitVector * _hit_vector
virtual int InitRun(PHCompositeNode *topNode)
virtual int Init(PHCompositeNode *topNode)
bool _legacy_rec_container
bool is_eval_dst_enabled() const
virtual int InitField(PHCompositeNode *topNode)
bool is_eval_enabled() const
EventReducer * _eventReducer
KalmanFastTracking * _fastfinder
void fillRecTrack(SRecTrack &recTrack)
SQGenFit::GFFitter * _gfitter
virtual const SQSpill * get(unsigned int idkey) const
Return the SQSpill entry having spill ID = 'idkey'. Return '0' if no entry exists.
virtual void push_back(const SQTrack *trk)=0
void identify(std::ostream &os=std::cout) const
PHObject virtual overloads.
std::vector< Hit > & getAllHits()
void setEventInfo(Int_t runID, Int_t spillID, Int_t eventID)
Sets.
void setRecStatus(int status)
void insertTrack(SRecTrack trk)
Insert tracks.
void setRawEvent(SRawEvent *rawEvent)
directly setup everything by raw event
void setNHitsInPT(Int_t nHitsX, Int_t nHitsY)
void setPTSlope(Double_t slopeX, Double_t slopeY)
Prop. tube muon ID info.
void setTriggerRoad(Int_t roadID)
Trigger road info.
void setKalmanStatus(Int_t status)
void push_back(const Tracklet *tracklet)
static recoConsts * instance()
bool SetTriggerHit(SRawEvent *sraw, const SQHitVector *hit_vec, std::map< int, size_t > *hitID_idx=0, const bool do_assert=false)
bool SetEvent(SRawEvent *sraw, const SQEvent *evt, const bool do_assert=false)
bool SetHit(SRawEvent *sraw, const SQHitVector *hit_vec, std::map< int, size_t > *hitID_idx=0, const bool do_assert=false)
bool SetSpill(SRawEvent *sraw, const SQSpill *sp, const bool do_assert=false)