26 #include "Utilities/AssociationUtil.h" 56 if (c.
pulses.size() == 0) {
57 return std::numeric_limits<double>::quiet_NaN();
60 double t = std::numeric_limits<double>::quiet_NaN();
62 if (method ==
"Mean") {
64 for (
auto p : c.
pulses) { t +=
p->StartTimeInNanoSec(); }
65 t = t / (double(c.
pulses.size()));
67 }
else if (method ==
"First") {
72 t =
d->StartTimeInNanoSec();
76 <<
"Unknown time of flight cluster time calculation method: " << method <<
"." <<
std::endl;
84 return dstime - ustime;
89 produces<std::vector<brb::ToF>>();
90 produces<art::Assns<brb::ToF, brb::BeamlineDigit>>();
105 std::unique_ptr<std::vector<brb::ToF>>
106 tof_reco(
new std::vector<brb::ToF>);
107 std::unique_ptr<art::Assns<brb::ToF, brb::BeamlineDigit>>
112 std::vector<art::Ptr<brb::BeamlineDigit>> digits;
124 std::vector<ToFPulseCluster> dscounterclusters = dsclusters;
128 for (
auto usc : usclusters) {
129 for (
auto dsc : dscounterclusters) {
137 tof_reco->push_back(tof);
138 util::CreateAssn(*
this, e, *(tof_reco.get()), usc.pulses, *(tof_assn.get()), tof_reco->
size()-1);
139 util::CreateAssn(*
this, e, *(tof_reco.get()), dsc.pulses, *(tof_assn.get()), tof_reco->
size()-1);
144 e.
put(std::move(tof_reco));
145 e.
put(std::move(tof_assn));
static bool CreateAssn(art::EDProducer const &prod, art::Event &evt, std::vector< T > &a, art::Ptr< U > b, art::Assns< T, U > &assn, size_t indx=UINT_MAX, std::string const &instance=std::string())
Create a 1 to 1 association between a new product and one already in the event.
std::vector< ToFPulseCluster > GetClusters(beamlinegeo::ToFCounter counter) const
void SetTimestamps(std::pair< float, float > timestamps)
double StartTimeInNanoSec() const
void FindClusters(std::vector< art::Ptr< brb::BeamlineDigit >> digits, double clusterWindow)
std::pair< Spectrum *, CheatDecomp * > make_pair(SpectrumLoaderBase &loader_data, SpectrumLoaderBase &loader_mc, HistAxis *axis, Cut *cut, const SystShifts &shift, const Var &wei)
Definition of the beamline offline geometry. Also implementation of a service to obtain this informat...
DEFINE_ART_MODULE(TestTMapFile)
TimeOfFlightReco(fhicl::ParameterSet const &p)
ProductID put(std::unique_ptr< PROD > &&product)
void reconfigure(const fhicl::ParameterSet &p)
Encapsulation of reconstructed digitizer 'hits'. Used for ToF PMTs and SiPMs, and Cherenkov and Muon ...
void produce(art::Event &e) override
T get(std::string const &key) const
Encapsulation of reconstructed Time-of-Flight (ToF) information. Part of beamline reconstruction for ...
double calculateTime(ToFPulseCluster c, std::string method) const
std::string fClusterTimeMethod
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
std::vector< art::Ptr< brb::BeamlineDigit > > pulses
double calculateTimeOfFlight(double ustime, double dstime) const
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
art::InputTag fBeamlineToFDataLabel