All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
sbn::ITCSSelectionTool Class Referenceabstract

#include <ITCSSelectionTool.h>

Inheritance diagram for sbn::ITCSSelectionTool:
sbn::TrackCaloSkimmerSelectAllTrack sbn::TrackCaloSkimmerSelectAnode2CathodeTrack sbn::TrackCaloSkimmerSelectStoppingTrack

Public Member Functions

 ITCSSelectionTool (const fhicl::ParameterSet &p)
 
 fRequireT0 (p.get< bool >("RequireT0", true))
 
 fInvert (p.get< bool >("Invert", false))
 
 fNPreScale (p.get< unsigned >("PreScale", 1))
 
 fISelect (0)
 
virtual ~ITCSSelectionTool () noexcept=default
 
bool DoSelect (const TrackInfo &t)
 For external modules to call: run the actual selection. More...
 
unsigned GetPrescale () const
 

Protected Member Functions

virtual bool Select (const TrackInfo &t)=0
 For children to implement: Whether to select a given track. More...
 

Protected Attributes

std::vector< bool > fAllowT0
 
bool fRequireT0
 
bool fInvert
 
unsigned fNPreScale
 
unsigned fISelect
 

Detailed Description

Definition at line 9 of file ITCSSelectionTool.h.

Constructor & Destructor Documentation

sbn::ITCSSelectionTool::ITCSSelectionTool ( const fhicl::ParameterSet &  p)
inline

Definition at line 11 of file ITCSSelectionTool.h.

11  :
12  fAllowT0(p.get<std::vector<bool>>("AllowT0", {})),
pdgs p
Definition: selectors.fcl:22
std::vector< bool > fAllowT0
virtual sbn::ITCSSelectionTool::~ITCSSelectionTool ( )
virtualdefaultnoexcept

Member Function Documentation

bool sbn::ITCSSelectionTool::DoSelect ( const TrackInfo t)
inline

For external modules to call: run the actual selection.

Definition at line 27 of file ITCSSelectionTool.h.

27  {
28 
29  bool has_good_t0 = t.whicht0 >= 0;
30  // Check if the T0 is allowed
31  if (!fAllowT0.empty()) {
32  if (t.whicht0 >= 0 && ((unsigned)t.whicht0 >= fAllowT0.size() || !fAllowT0[t.whicht0])) {
33  has_good_t0 = false;
34  }
35  }
36 
37  if (!has_good_t0 && fRequireT0) return false;
38 
39  bool selected = Select(t) == !fInvert /* implement inversion */;
40 
41  // update index
42  fISelect += selected;
43 
44  return selected && (fISelect % fNPreScale == 0) /* implement prescale */;
45  }
virtual bool Select(const TrackInfo &t)=0
For children to implement: Whether to select a given track.
std::vector< bool > fAllowT0
sbn::ITCSSelectionTool::fInvert ( p.get< bool >  "Invert", false)
sbn::ITCSSelectionTool::fISelect ( )
inline

Definition at line 16 of file ITCSSelectionTool.h.

17  {
18  // Set ISelect to a random number
19  // so that events get prescaled uniformly across runs
20  srand (time(NULL)); // random seed
21  fISelect = rand();
22  }
sbn::ITCSSelectionTool::fNPreScale ( p.get< unsigned >  "PreScale", 1)
sbn::ITCSSelectionTool::fRequireT0 ( p.get< bool >  "RequireT0", true)
unsigned sbn::ITCSSelectionTool::GetPrescale ( ) const
inline

Definition at line 47 of file ITCSSelectionTool.h.

47 { return fNPreScale; }
virtual bool sbn::ITCSSelectionTool::Select ( const TrackInfo t)
protectedpure virtual

For children to implement: Whether to select a given track.

Implemented in sbn::TrackCaloSkimmerSelectStoppingTrack, sbn::TrackCaloSkimmerSelectAllTrack, and sbn::TrackCaloSkimmerSelectAnode2CathodeTrack.

Member Data Documentation

std::vector<bool> sbn::ITCSSelectionTool::fAllowT0
protected

Definition at line 53 of file ITCSSelectionTool.h.

bool sbn::ITCSSelectionTool::fInvert
protected

Definition at line 55 of file ITCSSelectionTool.h.

unsigned sbn::ITCSSelectionTool::fISelect
protected

Definition at line 57 of file ITCSSelectionTool.h.

unsigned sbn::ITCSSelectionTool::fNPreScale
protected

Definition at line 56 of file ITCSSelectionTool.h.

bool sbn::ITCSSelectionTool::fRequireT0
protected

Definition at line 54 of file ITCSSelectionTool.h.


The documentation for this class was generated from the following file: