Class Reference for E1039 Core & Analysis Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
UtilSQHit Namespace Reference

A set of utility functions about SQHit. More...

Functions

SQHitVectorFindHits (const SQHitVector *vec_in, const std::string det_name, const bool in_time=false)
 Extract a set of hits that are of the given detector (det_name). More...
 
SQHitVectorFindHits (const SQHitVector *vec_in, const int det_id, const bool in_time=false)
 
SQHitVectorFindFirstHits (const SQHitVector *vec_in, const std::string det_name, const bool in_time=false)
 Extract a set of first hits that are of the given detector (det_name), where "first" means the earliest (i.e. largest TDC time) hit per element. More...
 
SQHitVectorFindFirstHits (const SQHitVector *vec_in, const int det_id, const bool in_time=false)
 
std::vector< SQHit * > * FindHitsFast (const SQEvent *evt, const SQHitVector *hit_vec, const std::string det_name)
 Fast-extract a set of hits that are of the given detector (det_name). More...
 
std::vector< SQHit * > * FindHitsFast (const SQEvent *evt, const SQHitVector *hit_vec, const int det_id)
 Fast-extract a set of hits that are of the given detector (det_id). More...
 
std::vector< SQHit * > * FindTriggerHitsFast (const SQEvent *evt, const SQHitVector *hit_vec, const std::string det_name)
 Fast-extract a set of trigger hits that are of the given detector (det_name). More...
 
std::vector< SQHit * > * FindTriggerHitsFast (const SQEvent *evt, const SQHitVector *hit_vec, const int det_id)
 Fast-extract a set of trigger hits that are of the given detector (det_id). More...
 

Detailed Description

A set of utility functions about SQHit.

Function Documentation

◆ FindFirstHits() [1/2]

SQHitVector * UtilSQHit::FindFirstHits ( const SQHitVector vec_in,
const int  det_id,
const bool  in_time = false 
)

See FindHits() to find how to handle the returned object.

Definition at line 49 of file UtilSQHit.cc.

References SQHitVector::at(), SQHitVector::clear(), SQHitVector::Clone(), SQHit::get_detector_id(), SQHit::get_element_id(), SQHit::get_tdc_time(), SQHit::is_in_time(), SQHitVector::push_back(), and SQHitVector::size().

+ Here is the call graph for this function:

◆ FindFirstHits() [2/2]

SQHitVector * UtilSQHit::FindFirstHits ( const SQHitVector vec_in,
const std::string  det_name,
const bool  in_time = false 
)

Extract a set of first hits that are of the given detector (det_name), where "first" means the earliest (i.e. largest TDC time) hit per element.

See FindHits() to find how to handle the returned object.

Definition at line 40 of file UtilSQHit.cc.

References GeomSvc::getDetectorID(), and GeomSvc::instance().

Referenced by SubsysRecoBG::ExtractHits(), AnaEffCham::process_event(), and AnaEffHodo::process_event().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ FindHits() [1/2]

SQHitVector * UtilSQHit::FindHits ( const SQHitVector vec_in,
const int  det_id,
const bool  in_time = false 
)

See the other FindHits() function to find how to handle the returned object.

Definition at line 25 of file UtilSQHit.cc.

References SQHitVector::begin(), SQHitVector::clear(), SQHitVector::Clone(), SQHitVector::end(), SQHit::get_detector_id(), SQHit::is_in_time(), and SQHitVector::push_back().

+ Here is the call graph for this function:

◆ FindHits() [2/2]

SQHitVector * UtilSQHit::FindHits ( const SQHitVector vec_in,
const std::string  det_name,
const bool  in_time = false 
)

Extract a set of hits that are of the given detector (det_name).

The SQHitVector object returned has to be deleted outside this function. The recommended way is to use "shared_ptr", which auto-deletes the object.

shared_ptr<SQHitVector> hv_h1t(UtilSQHit::FindHits(hit_vec, "H1T"));
cout << "N = " << hv_h1t->size() << endl;
SQHitVector * FindHits(const SQHitVector *vec_in, const std::string det_name, const bool in_time=false)
Extract a set of hits that are of the given detector (det_name).
Definition: UtilSQHit.cc:16

Definition at line 16 of file UtilSQHit.cc.

References GeomSvc::getDetectorID(), and GeomSvc::instance().

Referenced by AnaEffCham::process_event(), AnaHodoHit::process_event(), AnaTriggerHit::process_event(), AnaTrigSignal::process_event(), AnaSimHit::process_event(), AnaChamPlane::process_event(), and ExtractTdcDist::process_event().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ FindHitsFast() [1/2]

std::vector< SQHit * > * UtilSQHit::FindHitsFast ( const SQEvent evt,
const SQHitVector hit_vec,
const int  det_id 
)

Fast-extract a set of hits that are of the given detector (det_id).

Useful for speed when many SubsysReco modules are registered and accessing the hit vector repeatedly. The returned variable is vector<SQHit*> (not SQHitVector), which can be used as follows for example:

auto vec = UtilSQHit::FindHitsFast(evt, hit_vec, det_id);
for (auto it = vec->begin(); it != vec->end(); it++) {
int ele_id = (*it)->get_element_id();
double time = (*it)->get_tdc_time ();
}
std::vector< SQHit * > * FindHitsFast(const SQEvent *evt, const SQHitVector *hit_vec, const std::string det_name)
Fast-extract a set of hits that are of the given detector (det_name).
Definition: UtilSQHit.cc:76

Caller must not delete the vector nor the SQHit objects.

This function has an internal static variable that holds one hit vector per detector. The variable is filled only on the 1st call per event, and used by all SubsysReco modules. The reason of using vector<SQHit*> is to avoid multiple creations+deletions of SQHitVector.

Definition at line 99 of file UtilSQHit.cc.

References SQHitVector::begin(), SQHitVector::end(), SQHit::get_detector_id(), SQEvent::get_event_id(), and SQEvent::get_run_id().

+ Here is the call graph for this function:

◆ FindHitsFast() [2/2]

std::vector< SQHit * > * UtilSQHit::FindHitsFast ( const SQEvent evt,
const SQHitVector hit_vec,
const std::string  det_name 
)

Fast-extract a set of hits that are of the given detector (det_name).

See FindHitsFast(evt, hit_vec, det_id) for details.

Definition at line 76 of file UtilSQHit.cc.

References GeomSvc::getDetectorID(), and GeomSvc::instance().

+ Here is the call graph for this function:

◆ FindTriggerHitsFast() [1/2]

std::vector< SQHit * > * UtilSQHit::FindTriggerHitsFast ( const SQEvent evt,
const SQHitVector hit_vec,
const int  det_id 
)

Fast-extract a set of trigger hits that are of the given detector (det_id).

See FindHitsFast() for usage.

Definition at line 133 of file UtilSQHit.cc.

References SQHitVector::begin(), SQHitVector::end(), SQHit::get_detector_id(), SQEvent::get_event_id(), and SQEvent::get_run_id().

+ Here is the call graph for this function:

◆ FindTriggerHitsFast() [2/2]

std::vector< SQHit * > * UtilSQHit::FindTriggerHitsFast ( const SQEvent evt,
const SQHitVector hit_vec,
const std::string  det_name 
)

Fast-extract a set of trigger hits that are of the given detector (det_name).

See FindTriggerHitsFast(evt, hit_vec, det_id) for details.

Definition at line 123 of file UtilSQHit.cc.

References GeomSvc::getDetectorID(), and GeomSvc::instance().

+ Here is the call graph for this function: