Public Member Functions | Private Attributes | List of all members
beamlinereco::ToFClusterAlg Class Reference

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N20-12-03/BeamlineReco/ToFClusterAlg.h"

Public Member Functions

 ToFClusterAlg ()
 
void Reset ()
 
void FindClusters (std::vector< art::Ptr< brb::BeamlineDigit >> digits, double clusterWindow)
 
std::vector< ToFPulseClusterGetClusters (beamlinegeo::ToFCounter counter) const
 

Private Attributes

std::vector< ToFPulseCluster_dsClusters
 
std::vector< ToFPulseCluster_usClusters
 
std::vector< ToFPulseCluster_sipmClusters
 
double _clusterWindow
 

Detailed Description

Definition at line 20 of file ToFClusterAlg.h.

Constructor & Destructor Documentation

beamlinereco::ToFClusterAlg::ToFClusterAlg ( )
inline

Definition at line 22 of file ToFClusterAlg.h.

References beamlinereco::ToFPulseCluster::counter, and slidt::Reset().

Member Function Documentation

void beamlinereco::ToFClusterAlg::FindClusters ( std::vector< art::Ptr< brb::BeamlineDigit >>  digits,
double  clusterWindow 
)

Definition at line 43 of file ToFClusterAlg.h.

References beamlinereco::ToFPulseCluster::counter, d, beamlinegeo::DS, beamlinegeo::DSSiPM, stan::math::fabs(), srt_file_template::find_if, beamlinereco::ToFPulseCluster::pulses, shutoffs::starttime, beamlinereco::ToFPulseCluster::time, and beamlinegeo::US.

Referenced by beamlinereco::ToFSingleCounterAnalysis::analyze(), and beamlinereco::TimeOfFlightReco::produce().

43  {
44  _clusterWindow = clusterWindow;
45 
46  for (auto d : digits) {
47  // Get correct cluster list for digit
48  std::vector<ToFPulseCluster> *clusters;
49  switch (d->ChannelID().Detector) {
50  case beamlinegeo::ToFCounter::US: clusters = &_usClusters; break;
51  case beamlinegeo::ToFCounter::DS: clusters = &_dsClusters; break;
52  case beamlinegeo::ToFCounter::DSSiPM: clusters = &_sipmClusters; break;
53  default: continue;
54  }
55  // Find cluster containing pulse (if any)
56  double starttime = d->StartTimeInNanoSec();
57  auto clusterit = std::find_if(clusters->begin(), clusters->end(),
58  [starttime,clusterWindow](ToFPulseCluster &cluster){
59  return fabs(starttime - cluster.time) < clusterWindow;
60  });
61 
62  if (clusterit == clusters->end()) { // Could not find one
63  // insert new cluster
64  ToFPulseCluster cluster;
65  cluster.time = starttime;
66  cluster.counter = beamlinegeo::ToFCounter(d->ChannelID().Detector);
67  cluster.pulses.push_back(d);
68  clusters->push_back(cluster);
69  } else { // Found cluster
70  clusterit->pulses.push_back(d);
71  }
72  }
73  }
std::vector< ToFPulseCluster > _usClusters
Definition: ToFClusterAlg.h:30
fvar< T > fabs(const fvar< T > &x)
Definition: fabs.hpp:15
Float_t d
Definition: plot.C:236
std::vector< ToFPulseCluster > _dsClusters
Definition: ToFClusterAlg.h:29
std::vector< ToFPulseCluster > _sipmClusters
Definition: ToFClusterAlg.h:31
std::vector< ToFPulseCluster > beamlinereco::ToFClusterAlg::GetClusters ( beamlinegeo::ToFCounter  counter) const

Definition at line 75 of file ToFClusterAlg.h.

References beamlinegeo::DS, beamlinegeo::DSSiPM, allTimeWatchdog::endl, art::errors::StdException, and beamlinegeo::US.

Referenced by beamlinereco::ToFSingleCounterAnalysis::analyze(), and beamlinereco::TimeOfFlightReco::produce().

75  {
76  switch(counter) {
81  << "Bad time of flight counter: " << counter << "." << std::endl;
82  }
83  }
std::vector< ToFPulseCluster > _usClusters
Definition: ToFClusterAlg.h:30
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
std::vector< ToFPulseCluster > _dsClusters
Definition: ToFClusterAlg.h:29
std::vector< ToFPulseCluster > _sipmClusters
Definition: ToFClusterAlg.h:31
void beamlinereco::ToFClusterAlg::Reset ( )

Definition at line 36 of file ToFClusterAlg.h.

36  {
37  _usClusters.clear();
38  _dsClusters.clear();
39  _sipmClusters.clear();
40  _clusterWindow = -999;
41  }
std::vector< ToFPulseCluster > _usClusters
Definition: ToFClusterAlg.h:30
std::vector< ToFPulseCluster > _dsClusters
Definition: ToFClusterAlg.h:29
std::vector< ToFPulseCluster > _sipmClusters
Definition: ToFClusterAlg.h:31

Member Data Documentation

double beamlinereco::ToFClusterAlg::_clusterWindow
private

Definition at line 32 of file ToFClusterAlg.h.

std::vector<ToFPulseCluster> beamlinereco::ToFClusterAlg::_dsClusters
private

Definition at line 29 of file ToFClusterAlg.h.

std::vector<ToFPulseCluster> beamlinereco::ToFClusterAlg::_sipmClusters
private

Definition at line 31 of file ToFClusterAlg.h.

std::vector<ToFPulseCluster> beamlinereco::ToFClusterAlg::_usClusters
private

Definition at line 30 of file ToFClusterAlg.h.


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