Class Reference for E1039 Core & Analysis Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SQReco.cxx
Go to the documentation of this file.
1 #include "SQReco.h"
2 
3 #include "KalmanFastTracking.h"
4 #include "EventReducer.h"
5 
6 #include <phfield/PHFieldConfig_v3.h>
7 #include <phfield/PHFieldUtility.h>
8 #include <phgeom/PHGeomUtility.h>
9 
10 #include <interface_main/SQHit.h>
19 
21 #include <fun4all/PHTFileServer.h>
22 #include <phool/PHNodeIterator.h>
23 #include <phool/PHIODataNode.h>
24 #include <phool/getClass.h>
25 #include <phool/recoConsts.h>
26 #include <phgeom/PHGeomTGeo.h>
27 
28 #include <TFile.h>
29 #include <TTree.h>
30 
31 #include <cstring>
32 #include <cmath>
33 #include <cfloat>
34 #include <cassert>
35 #include <stdexcept>
36 #include <limits>
37 #include <memory>
38 #include <fstream>
39 #include <exception>
40 #include <boost/lexical_cast.hpp>
41 
42 #ifdef _DEBUG_ON
43 # define LogDebug(exp) std::cout << "DEBUG: " << __FUNCTION__ <<": "<< __LINE__ << ": " << exp << std::endl
44 #else
45 # define LogDebug(exp)
46 #endif
47 
48 SQReco::SQReco(const std::string& name):
49  SubsysReco(name),
50  _input_type(SQReco::E1039),
51  _fitter_type(SQReco::KFREF),
52  _enable_eval(false),
53  _eval_file_name("eval.root"),
54  _eval_tree(nullptr),
55  _tracklets(nullptr),
56  _enable_eval_dst(false),
57  _tracklet_vector(nullptr),
58  _evt_reducer_opt(""),
59  _fastfinder(nullptr),
60  _eventReducer(nullptr),
61  _enable_KF(true),
62  _kfitter(nullptr),
63  _gfitter(nullptr),
64  _phfield(nullptr),
65  _gfield(nullptr),
66  _event(0),
67  _run_header(nullptr),
68  _spill_map(nullptr),
69  _event_header(nullptr),
70  _hit_vector(nullptr),
71  _triggerhit_vector(nullptr),
72  _legacy_rec_container(true),
73  _rawEvent(nullptr),
74  _recEvent(nullptr),
75  _recTrackVec(nullptr),
76  _geom_file_name(""),
77  _t_geo_manager(nullptr)
78 {
79  rc = recoConsts::instance();
80  _eval_listIDs.clear();
81 }
82 
84 {}
85 
87 {
89 }
90 
92 {
93  if(is_eval_enabled())
94  {
95  InitEvalTree();
96  ResetEvalVars();
97  }
98 
99  int ret = MakeNodes(topNode);
100  if(ret != Fun4AllReturnCodes::EVENT_OK) return ret;
101 
102  ret = GetNodes(topNode);
103  if(ret != Fun4AllReturnCodes::EVENT_OK) return ret;
104 
105  ret = InitField(topNode);
106  if(ret != Fun4AllReturnCodes::EVENT_OK) return ret;
107 
108  ret = InitGeom(topNode);
109  if(ret != Fun4AllReturnCodes::EVENT_OK) return ret;
110 
111  //Init track finding
112  _fastfinder = new KalmanFastTracking(_phfield, _t_geo_manager, false);
113  _fastfinder->Verbosity(Verbosity());
114 
115  if(_evt_reducer_opt == "none") //Meaning we disable the event reducer
116  {
117  _eventReducer = nullptr;
118  }
119  else if(_evt_reducer_opt == "") //Meaning we initialize the event reducer by opts
120  {
121  _evt_reducer_opt = rc->get_CharFlag("EventReduceOpts");
122 
123  _eventReducer = new EventReducer(_evt_reducer_opt);
124  }
125  else
126  {
127  _eventReducer = new EventReducer(_evt_reducer_opt);
128  }
129 
130  //Initialize the fitter
131  if(_enable_KF)
132  {
133  if(_fitter_type == SQReco::LEGACY)
134  {
135  _kfitter = new KalmanFitter(_phfield, _t_geo_manager);
136  _kfitter->setControlParameter(50, 0.001);
137  }
138  else
139  {
140  _gfitter = new SQGenFit::GFFitter();
141  if(_fitter_type == SQReco::KF)
142  {
143  _gfitter->init(_gfield, "KalmanFitter");
144  }
145  else if(_fitter_type == SQReco::KFREF)
146  {
147  _gfitter->init(_gfield, "KalmanFitterRefTrack");
148  }
149  else if(_fitter_type == SQReco::DAF)
150  {
151  _gfitter->init(_gfield, "DafSimple");
152  }
153  else if(_fitter_type == SQReco::DAFREF)
154  {
155  _gfitter->init(_gfield, "DafRef");
156  }
157 
158  //TODO: common settings for sqfitter
159  }
160  }
161 
163 }
164 
165 int SQReco::InitField(PHCompositeNode* topNode)
166 {
167  if(Verbosity() > 1)
168  {
169  std::cout << "SQReco::InitField" << std::endl;
170  if(!_enable_KF)
171  {
172  std::cout << " KF is disabled thus phfield is not needed. Skip InitField for SQReco." << std::endl;
174  }
175  }
176 
177  std::unique_ptr<PHFieldConfig> default_field_cfg(new PHFieldConfig_v3(rc->get_CharFlag("fMagFile"), rc->get_CharFlag("kMagFile"), rc->get_DoubleFlag("FMAGSTR"), rc->get_DoubleFlag("KMAGSTR"), 5.));
178  _phfield = PHFieldUtility::GetFieldMapNode(default_field_cfg.get(), topNode, 0);
179 
181  {
182  std::cout << "PHField check: " << "-------" << std::endl;
183  std::ofstream field_scan("field_scan.csv");
184  _phfield->identify(field_scan);
185  field_scan.close();
186  }
187 
188  if(_fitter_type != SQReco::LEGACY) _gfield = new SQGenFit::GFField(_phfield);
190 }
191 
192 int SQReco::InitGeom(PHCompositeNode* topNode)
193 {
194  if(Verbosity() > 1)
195  {
196  std::cout << "SQReco::InitGeom" << std::endl;
197  if(!_enable_KF)
198  {
199  std::cout << " KF is disabled thus TGeo is not needed. Skip InitGeom for SQReco." << std::endl;
201  }
202  }
203 
204  PHGeomTGeo* dstGeom = PHGeomUtility::GetGeomTGeoNode(topNode, true); //hacky way to bypass PHGeoUtility's lack of exception throwing
205  if(!dstGeom->isValid())
206  {
207  if(_geom_file_name == "") return Fun4AllReturnCodes::ABORTEVENT;
208 
209  if(Verbosity() > 1) std::cout << "SQReco::InitGeom - create geom from " << _geom_file_name << std::endl;
210  int ret = PHGeomUtility::ImportGeomFile(topNode, _geom_file_name);
211  if(ret != Fun4AllReturnCodes::EVENT_OK) return ret;
212  }
213  else
214  {
215  if(Verbosity() > 1) std::cout << "SQReco::InitGeom - use geom from NodeTree." << std::endl;
216  }
217 
218  _t_geo_manager = PHGeomUtility::GetTGeoManager(topNode);
220 }
221 
222 int SQReco::updateHitInfo(SRawEvent* sraw_event)
223 {
224  for(Hit hit : sraw_event->getAllHits())
225  {
226  size_t idx = _m_hitID_idx[hit.index];
227  SQHit* sq_hit = _hit_vector->at(idx);
228 
229  sq_hit->set_tdc_time(hit.tdcTime);
230  sq_hit->set_drift_distance(hit.driftDistance);
231  sq_hit->set_pos(hit.pos);
232  sq_hit->set_in_time(hit.isInTime());
233  sq_hit->set_hodo_mask(hit.isHodoMask());
234  sq_hit->set_trigger_mask(hit.isTriggerMask());
235  }
236 
237  return 0;
238 }
239 
240 SRawEvent* SQReco::BuildSRawEvent()
241 {
242  //Needed for E1039 since we switched to a more generic interface
243  //SRawEvent is still needed so that the code can be used for E906 as well
244  SRawEvent* sraw_event = new SRawEvent();
245  _m_hitID_idx.clear();
246  _m_trghitID_idx.clear();
247 
248  int run_id = 0;
249  int spill_id = 0;
250  int event_id = _event;
251  if(_event_header)
252  {
253  run_id = _event_header->get_run_id();
254  spill_id = _event_header->get_spill_id();
255  event_id = _event_header->get_event_id();
256  }
257  sraw_event->setEventInfo(run_id, spill_id, event_id);
258 
259  //Trigger setting - either from trigger emulation or TS, default to 0
260  int triggers[10];
261  for(int i = SQEvent::NIM1; i <= SQEvent::MATRIX5; ++i)
262  {
263  if(_event_header)
264  triggers[i] = _event_header->get_trigger(static_cast<SQEvent::TriggerMask>(i));
265  else
266  triggers[i] = 0;
267  }
268  sraw_event->setTriggerBits(triggers);
269 
270  //Get target position
271  int targetPos = 0;
272  if(_spill_map)
273  {
274  SQSpill* spill = _spill_map->get(spill_id);
275  if(spill)
276  {
277  targetPos = spill->get_target_pos();
278  }
279  }
280  sraw_event->setTargetPos(1);
281 
282  //Get beam information - QIE -- not implemented yet
283 
284  //Get trigger hits - TriggerHit
285  if(_triggerhit_vector)
286  {
287  for(size_t idx = 0; idx < _triggerhit_vector->size(); ++idx)
288  {
289  SQHit* sq_hit = _triggerhit_vector->at(idx);
290  _m_trghitID_idx[sq_hit->get_hit_id()] = idx;
291 
292  Hit h;
293  h.index = sq_hit->get_hit_id();
294  h.detectorID = sq_hit->get_detector_id();
295  h.elementID = sq_hit->get_element_id();
296  h.tdcTime = sq_hit->get_tdc_time();
297  h.driftDistance = fabs(sq_hit->get_drift_distance()); //MC L-R info removed here
298  h.pos = sq_hit->get_pos();
299 
300  if(sq_hit->is_in_time()) h.setInTime();
301  sraw_event->insertTriggerHit(h);
302  }
303  }
304 
305  for(size_t idx = 0; idx < _hit_vector->size(); ++idx)
306  {
307  SQHit* sq_hit = _hit_vector->at(idx);
308 
309  Hit h;
310  h.index = sq_hit->get_hit_id();
311  h.detectorID = sq_hit->get_detector_id();
312  h.elementID = sq_hit->get_element_id();
313  h.tdcTime = sq_hit->get_tdc_time();
314  h.driftDistance = fabs(sq_hit->get_drift_distance()); //MC L-R info removed here
315  h.pos = sq_hit->get_pos();
316 
317  if(sq_hit->is_in_time()) h.setInTime();
318  sraw_event->insertHit(h);
319 
320  /* We should not need the following code, since all these logic are done in
321  // inside eventreducer
322  //TODO calibration
323  if(p_geomSvc->isCalibrationLoaded())
324  {
325  if((h.detectorID >= 1 && h.detectorID <= nChamberPlanes) || (h.detectorID >= nChamberPlanes+nHodoPlanes+1))
326  {
327  h.setInTime(p_geomSvc->isInTime(h.detectorID, h.tdcTime));
328  if(h.isInTime()) h.driftDistance = p_geomSvc->getDriftDistance(h.detectorID, h.tdcTime);
329  }
330  }
331 
332  // FIXME just for the meeting, figure this out fast!
333  if(!_triggerhit_vector and h.detectorID >= 31 and h.detectorID <= 46) {
334  sraw_event->insertTriggerHit(h);
335  }
336  */
337  }
338 
339  sraw_event->reIndex(true);
340  return sraw_event;
341 }
342 
344 {
345  LogDebug("Entering SQReco::process_event: " << _event);
346 
347  if(is_eval_enabled()) ResetEvalVars();
348  if(_input_type == SQReco::E1039)
349  {
350  if(!_event_header)
351  {
352  if(Verbosity() > 2) LogDebug("!_event_header");
353  //return Fun4AllReturnCodes::ABORTRUN;
354  }
355 
356  if(!_spill_map)
357  {
358  if(Verbosity() > 2) LogDebug("!_spill_map");
359  //return Fun4AllReturnCodes::ABORTRUN;
360  }
361 
362  if(!_hit_vector)
363  {
364  if(Verbosity() > 2) LogDebug("!_hit_vector");
366  }
367  }
368 
369  std::unique_ptr<SRawEvent> up_raw_event;
370  if(_input_type == SQReco::E1039)
371  {
372  up_raw_event = std::unique_ptr<SRawEvent>(BuildSRawEvent());
373  _rawEvent = up_raw_event.get();
374  }
375 
377  {
378  LogInfo("SRawEvent before the Reducer");
379  _rawEvent->identify();
380  }
381 
382  if(_eventReducer != nullptr)
383  {
384  _eventReducer->reduceEvent(_rawEvent);
385  if(_input_type == SQReco::E1039) updateHitInfo(_rawEvent);
386  }
387 
389  {
390  LogInfo("SRawEvent after the Reducer");
391  _rawEvent->identify();
392  }
393 
394  int finderstatus = _fastfinder->setRawEvent(_rawEvent);
395  if(_legacy_rec_container)
396  {
397  _recEvent->setRawEvent(_rawEvent);
398  _recEvent->setRecStatus(finderstatus);
399  }
400  if(Verbosity() >= Fun4AllBase::VERBOSITY_A_LOT) _fastfinder->printTimers();
401 
402  int nTracklets = 0;
403  int nFittedTracks = 0;
404  std::list<Tracklet>& rec_tracklets = _fastfinder->getFinalTracklets();
405  for(auto iter = rec_tracklets.begin(); iter != rec_tracklets.end(); ++iter)
406  {
407  iter->calcChisq();
408  if(Verbosity() > Fun4AllBase::VERBOSITY_A_LOT) iter->print();
409 
410  bool fitOK = false;
411  if(_enable_KF)
412  {
413  if(_fitter_type == SQReco::LEGACY)
414  fitOK = fitTrackCand(*iter, _kfitter);
415  else
416  fitOK = fitTrackCand(*iter, _gfitter);
417  }
418 
419  if(!fitOK)
420  {
421  SRecTrack recTrack = iter->getSRecTrack(_enable_KF && (_fitter_type == SQReco::LEGACY));
422  recTrack.setKalmanStatus(-1);
423 
424  fillRecTrack(recTrack);
425  }
426  else
427  {
428  ++nFittedTracks;
429  }
430 
431  if(is_eval_enabled()) new((*_tracklets)[nTracklets]) Tracklet(*iter);
432  if(is_eval_dst_enabled()) _tracklet_vector->push_back(&(*iter));
433  ++nTracklets;
434  }
435  LogDebug("Leaving SQReco::process_event: " << _event << ", finder status " << finderstatus << ", " << nTracklets << " track candidates, " << nFittedTracks << " fitted tracks");
436 
437  //add additional eval information if applicable
439  {
440  for(unsigned int i = 0; i < _eval_listIDs.size(); ++i)
441  {
442  std::list<Tracklet>& eval_tracklets = _fastfinder->getTrackletList(_eval_listIDs[i]);
443  for(auto iter = eval_tracklets.begin(); iter != eval_tracklets.end(); ++iter)
444  {
445  if(is_eval_enabled())
446  {
447  new((*_tracklets)[nTracklets]) Tracklet(*iter);
448  ++nTracklets;
449  }
450 
451  if(is_eval_dst_enabled()) _tracklet_vector->push_back(&(*iter));
452  }
453  }
454  }
455 
456  if(is_eval_enabled() && nTracklets > 0) _eval_tree->Fill();
457 
458  ++_event;
460 }
461 
463 {
464  if(Verbosity() >= Fun4AllBase::VERBOSITY_SOME) std::cout << "SQReco::End" << std::endl;
465  if(is_eval_enabled())
466  {
467  PHTFileServer::get().cd(_eval_file_name.Data());
468  _eval_tree->Write();
469  }
470 
471  delete _fastfinder;
472  if(_gfitter != nullptr) delete _gfitter;
473 
475 }
476 
477 bool SQReco::fitTrackCand(Tracklet& tracklet, KalmanFitter* fitter)
478 {
479  KalmanTrack kmtrk;
480  kmtrk.setTracklet(tracklet);
481 
482  if(kmtrk.getNodeList().empty())
483  {
484  LogDebug("kmtrk nodelist empty");
485  return false;
486  }
487 
488  if(_kfitter->processOneTrack(kmtrk) == 0)
489  {
490  LogDebug("kFitter failed to converge");
491  return false;
492  }
493 
494  if(!kmtrk.isValid())
495  {
496  LogDebug("kmtrk quality cut failed");
497  return false;
498  }
499 
500  SRecTrack strack = kmtrk.getSRecTrack();
501 
502  //Set trigger road ID
503  TriggerRoad road(tracklet);
504  strack.setTriggerRoad(road.getRoadID());
505 
506  //Set prop tube slopes
507  strack.setNHitsInPT(tracklet.seg_x.getNHits(), tracklet.seg_y.getNHits());
508  strack.setPTSlope(tracklet.seg_x.a, tracklet.seg_y.a);
509 
510  fillRecTrack(strack);
511  return true;
512 }
513 
514 bool SQReco::fitTrackCand(Tracklet& tracklet, SQGenFit::GFFitter* fitter)
515 {
516  SQGenFit::GFTrack gftrk;
517  gftrk.setTracklet(tracklet);
518 
519  int fitOK = _gfitter->processTrack(gftrk);
520  if(fitOK != 0)
521  {
522  LogDebug("gFitter failed to converge.");
523  return false;
524  }
525 
527  {
528  gftrk.postFitUpdate();
529  gftrk.print(2);
530  }
531 
532  //TODO: A gtrack quality cut?
533 
534  SRecTrack strack = gftrk.getSRecTrack();
535 
536  //Set trigger road ID
537  TriggerRoad road(tracklet);
538  strack.setTriggerRoad(road.getRoadID());
539 
540  //Set prop tube slopes
541  strack.setNHitsInPT(tracklet.seg_x.getNHits(), tracklet.seg_y.getNHits());
542  strack.setPTSlope(tracklet.seg_x.a, tracklet.seg_y.a);
543 
544  fillRecTrack(strack);
545  return true;
546 }
547 
548 int SQReco::InitEvalTree()
549 {
550  PHTFileServer::get().open(_eval_file_name.Data(), "RECREATE");
551 
552  _tracklets = new TClonesArray("Tracklet");
553 
554  _eval_tree = new TTree("eval", "eval");
555  _eval_tree->Branch("eventID", &_event, "eventID/I");
556  _eval_tree->Branch("tracklets", &_tracklets, 256000, 99);
557  _tracklets->BypassStreamer();
558 
559  return 0;
560 }
561 
562 int SQReco::ResetEvalVars()
563 {
564  _tracklets->Clear();
565  return 0;
566 }
567 
568 void SQReco::fillRecTrack(SRecTrack& recTrack)
569 {
570  if(_legacy_rec_container)
571  _recEvent->insertTrack(recTrack);
572  else
573  _recTrackVec->push_back(&recTrack);
574 }
575 
576 int SQReco::MakeNodes(PHCompositeNode* topNode)
577 {
578  PHNodeIterator iter(topNode);
579  PHCompositeNode* eventNode = static_cast<PHCompositeNode*>(iter.findFirst("PHCompositeNode", "DST"));
580  if(!eventNode)
581  {
582  LogInfo("No DST node, create one");
583  eventNode = new PHCompositeNode("DST");
584  topNode->addNode(eventNode);
585  }
586 
587  if(_legacy_rec_container)
588  {
589  _recEvent = new SRecEvent();
590  PHIODataNode<PHObject>* recEventNode = new PHIODataNode<PHObject>(_recEvent, "SRecEvent", "PHObject");
591  eventNode->addNode(recEventNode);
592  if(Verbosity() >= Fun4AllBase::VERBOSITY_SOME) LogInfo("DST/SRecEvent Added");
593  }
594  else
595  {
596  _recTrackVec = new SQTrackVector_v1();
597  PHIODataNode<PHObject>* recEventNode = new PHIODataNode<PHObject>(_recTrackVec, "SQRecTrackVector", "PHObject");
598  eventNode->addNode(recEventNode);
599  if(Verbosity() >= Fun4AllBase::VERBOSITY_SOME) LogInfo("DST/SQRecTrackVector Added");
600  }
601 
602  if(_enable_eval_dst)
603  {
604  _tracklet_vector = new TrackletVector();
605  _tracklet_vector->SplitLevel(99);
606  PHIODataNode<PHObject>* trackletVecNode = new PHIODataNode<PHObject>(_tracklet_vector, "TrackletVector", "PHObject");
607  eventNode->addNode(trackletVecNode);
608  if(Verbosity() >= Fun4AllBase::VERBOSITY_SOME) LogInfo("DST/TrackletVector Added");
609  }
610 
612 }
613 
614 int SQReco::GetNodes(PHCompositeNode* topNode)
615 {
616  if(_input_type == SQReco::E1039)
617  {
618  _run_header = findNode::getClass<SQRun>(topNode, "SQRun");
619  if(!_run_header)
620  {
621  if(Verbosity() > 2) LogDebug("!_run_header");
622  //return Fun4AllReturnCodes::ABORTEVENT;
623  }
624 
625  _spill_map = findNode::getClass<SQSpillMap>(topNode, "SQSpillMap");
626  if(!_spill_map)
627  {
628  if(Verbosity() > 2) LogDebug("!_spill_map");
629  //return Fun4AllReturnCodes::ABORTEVENT;
630  }
631 
632  _event_header = findNode::getClass<SQEvent>(topNode, "SQEvent");
633  if(!_event_header)
634  {
635  if(Verbosity() > 2) LogDebug("!_event_header");
636  //return Fun4AllReturnCodes::ABORTEVENT;
637  }
638 
639  _hit_vector = findNode::getClass<SQHitVector>(topNode, "SQHitVector");
640  if(!_hit_vector)
641  {
642  LogDebug("!_hit_vector");
644  }
645 
646  _triggerhit_vector = findNode::getClass<SQHitVector>(topNode, "SQTriggerHitVector");
647  if(!_triggerhit_vector)
648  {
649  if(Verbosity() > 2) LogDebug("!_triggerhit_vector");
650  //return Fun4AllReturnCodes::ABORTEVENT;
651  }
652  }
653  else
654  {
655  _rawEvent = findNode::getClass<SRawEvent>(topNode, "SRawEvent");
656  if(_rawEvent)
657  {
658  if(Verbosity() > 0) LogInfo("Using SRawEvent as input for E906-like data input");
659  }
660  }
661 
663 }
664 
665 void SQReco::add_eval_list(int listID)
666 {
667  if(std::find(_eval_listIDs.begin(), _eval_listIDs.end(), listID) == _eval_listIDs.end())
668  {
669  _eval_listIDs.push_back(listID);
670  }
671 }
int setRawEvent(SRawEvent *event_input)
virtual void set_pos(const float a)
Definition: SQHit.h:61
void SplitLevel(const int i)
Definition: PHObject.h:42
virtual int get_run_id() const =0
Return the run ID.
std::list< Tracklet > & getTrackletList(int i)
int Init(PHCompositeNode *topNode)
Definition: SQReco.cxx:86
SRecTrack getSRecTrack()
Definition: GFTrack.cxx:391
virtual void set_hodo_mask(const bool a)
Definition: SQHit.h:94
Float_t driftDistance
Definition: SRawEvent.h:81
void setTriggerBits(Int_t triggers[])
Definition: SRawEvent.cxx:625
std::vector< Hit > & getAllHits()
Definition: SRawEvent.h:141
void setRecStatus(int status)
Definition: SRecEvent.h:424
virtual float get_pos() const
Return the absolute position of this hit. Probably the value is not properly set at present...
Definition: SQHit.h:60
virtual bool get_trigger(const SQEvent::TriggerMask i) const =0
Return the trigger bit (fired or not) of the selected trigger channel.
SRecTrack getSRecTrack()
Output to SRecTrack.
PHGeomTGeo provide run-time access to TGeoManger. It is transient object and it shall NOT be saved to...
Definition: PHGeomTGeo.h:24
Short_t detectorID
Definition: SRawEvent.h:78
void setTracklet(Tracklet &tracklet, double z_reference=590., bool wildseedcov=false)
Definition: GFTrack.cxx:335
virtual void set_tdc_time(const float a)
Definition: SQHit.h:55
bool is_eval_enabled() const
Definition: SQReco.h:68
virtual double get_DoubleFlag(const std::string &name) const
Definition: PHFlag.cc:49
PHBoolean addNode(PHNode *)
static PHGeomTGeo * GetGeomTGeoNode(PHCompositeNode *topNode, bool build_new=true)
Get non-persistent PHGeomTGeo from DST nodes. If not found, make a new one.
int process_event(PHCompositeNode *topNode)
Definition: SQReco.cxx:343
void insertTriggerHit(Hit h)
Definition: SRawEvent.h:160
An SQ interface class to hold one detector hit.
Definition: SQHit.h:20
#define LogDebug(exp)
Definition: SQReco.cxx:45
PHFieldConfig_v3 implements field configuration information for input a field map file...
int InitRun(PHCompositeNode *topNode)
Definition: SQReco.cxx:91
virtual int get_event_id() const =0
Return the event ID, which is unique per run.
virtual int get_spill_id() const =0
Return the spill ID.
void setKalmanStatus(Int_t status)
Definition: SRecEvent.h:147
void postFitUpdate(bool updateMeasurements=true)
Definition: GFTrack.cxx:382
static int ImportGeomFile(PHCompositeNode *topNode, const std::string &geometry_file)
TGeo ROOT/GDML/Macro file -&gt; DST node with automatic file type discrimination based on file names...
Float_t tdcTime
Definition: SRawEvent.h:80
static recoConsts * instance()
Definition: recoConsts.cc:7
virtual short get_target_pos() const
Return the target position in this spill.
Definition: SQSpill.h:38
void print(unsigned int debugLvl=0)
Definition: GFTrack.cxx:470
static PHTFileServer & get(void)
return reference to class singleton
Definition: PHTFileServer.h:36
void init(GFField *field, const TString &fitter_choice="KalmanFitterRefTrack")
Definition: GFFitter.cxx:29
virtual bool is_in_time() const
Return &#39;true&#39; if this hit is in the time window.
Definition: SQHit.h:90
void setControlParameter(int nMaxIteration, double tolerance)
Set the convergence control parameters.
Definition: KalmanFitter.h:31
virtual void push_back(const SQTrack *trk)=0
Definition of hit structure.
Definition: SRawEvent.h:34
virtual void set_drift_distance(const float a)
Definition: SQHit.h:58
int getNHits() const
void setPTSlope(Double_t slopeX, Double_t slopeY)
Definition: SRecEvent.h:224
void setEventInfo(Int_t runID, Int_t spillID, Int_t eventID)
Sets.
Definition: SRawEvent.cxx:124
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 set_trigger_mask(const bool a)
Definition: SQHit.h:97
An SQ interface class to hold the data of one spill.
Definition: SQSpill.h:19
virtual const SQHit * at(const size_t idkey) const
Definition: SQHitVector.h:53
virtual ~SQReco()
Definition: SQReco.cxx:83
virtual short get_detector_id() const
Return the detector ID of this hit.
Definition: SQHit.h:42
virtual float get_drift_distance() const
Return the drift distance of this hit. Probably the value is not properly set at present. Meaningful only if this hit is of drift chamber or prop tube.
Definition: SQHit.h:57
virtual int Verbosity() const
Gets the verbosity of this module.
Definition: Fun4AllBase.h:64
void setTargetPos(Short_t targetPos)
Definition: SRawEvent.h:196
Output a lot of messages.
Definition: Fun4AllBase.h:48
std::list< Node > & getNodeList()
Definition: KalmanTrack.h:84
virtual const std::string get_CharFlag(const std::string &flag) const
Definition: PHFlag.cc:13
void setInTime(bool f=true)
Definition: SRawEvent.h:56
PropSegment seg_x
Definition: FastTracklet.h:230
void setTracklet(Tracklet &tracklet, bool wildseedcov=true)
Definition: KalmanTrack.cxx:62
virtual float get_tdc_time() const
Return the TDC time (nsec) of this hit.
Definition: SQHit.h:54
Int_t index
Definition: SRawEvent.h:77
PropSegment seg_y
Definition: FastTracklet.h:231
bool cd(const std::string &filename)
change to directory of TFile matching filename
void insertHit(Hit h)
Insert a new hit.
Definition: SRawEvent.cxx:131
void setNHitsInPT(Int_t nHitsX, Int_t nHitsY)
Definition: SRecEvent.h:225
void identify(std::ostream &os=std::cout) const
PHObject virtual overloads.
Definition: SRawEvent.h:103
Definition: SQReco.h:42
static TGeoManager * GetTGeoManager(PHCompositeNode *topNode)
Main user interface: DST node -&gt; TGeoManager for downstream use.
Output some useful messages during manual command line running.
Definition: Fun4AllBase.h:39
virtual void set_in_time(const bool a)
Definition: SQHit.h:91
int reduceEvent(SRawEvent *rawEvent)
void insertTrack(SRecTrack trk)
Insert tracks.
Definition: SRecEvent.h:458
virtual void identify(std::ostream &os=std::cout) const
bool is_eval_dst_enabled() const
Definition: SQReco.h:70
virtual size_t size() const
Definition: SQHitVector.h:50
Short_t elementID
Definition: SRawEvent.h:79
void reIndex(bool doSort=false)
Reset the number hits on each plane.
Definition: SRawEvent.cxx:559
#define LogInfo(message)
Definition: DbSvc.cc:14
Float_t pos
Definition: SRawEvent.h:82
virtual int get_hit_id() const
Return the ID of this hit.
Definition: SQHit.h:39
void setRawEvent(SRawEvent *rawEvent)
directly setup everything by raw event
Definition: SRecEvent.cxx:690
SQReco(const std::string &name="SQReco")
Definition: SQReco.cxx:48
void setTriggerRoad(Int_t roadID)
Definition: SRecEvent.h:220
virtual short get_element_id() const
Return the element ID of this hit.
Definition: SQHit.h:45
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 isValid()
Self check to see if it is null.
Definition: KalmanTrack.cxx:96
int End(PHCompositeNode *topNode)
Called at the end of all processing.
Definition: SQReco.cxx:462
int processTrack(GFTrack &track, bool display=false)
Definition: GFFitter.cxx:50
TFile clean handling.
void Verbosity(const int a)
std::list< Tracklet > & getFinalTracklets()
Final output.
virtual int isValid() const
isValid returns non zero if object contains vailid data
Definition: PHGeomTGeo.cc:100
void push_back(const Tracklet *tracklet)
virtual const SQSpill * get(unsigned int idkey) const
Return the SQSpill entry having spill ID = &#39;idkey&#39;. Return &#39;0&#39; if no entry exists.
Definition: SQSpillMap.h:41
void add_eval_list(int listID)
Definition: SQReco.cxx:665
int processOneTrack(KalmanTrack &_track)