16 #include "art_root_io/TFileService.h" 60 std::vector< std::pair< unsigned int, double> >
idtime;
61 std::vector< art::Ptr< raw::ExternalTrigger> >
trigs;
65 for(
auto const &i : idtime) {
66 if (tim >= i.second-tol && tim <= i.second+tol)
return true;
75 for(
auto const &i : idtime) t += i.second, ++
n;
76 if (n != 0)
return t/
n;
82 idtime.push_back(std::pair<unsigned int,double>(
id,tim));
83 trigs.push_back(trig);
142 produces< std::vector< anab::T0 > >();
143 produces< art::Assns< anab::T0, raw::ExternalTrigger> >();
151 std::unique_ptr< std::vector< anab::T0> > t0col(
new std::vector<anab::T0>);
161 if (externalTriggerListHandle)
164 std::vector< art::Ptr< raw::ExternalTrigger> > trigs;
167 ntrigs = externalTriggerListHandle->size();
170 std::vector<t0> t0vect;
173 for (
auto const& trig : trigs) {
175 tick = trig->GetTrigTime();
184 for (t0it = t0vect.begin(); t0it != t0vect.end(); ++t0it) {
196 if (t0it == t0vect.end()) t0vect.push_back(
t0(
time,
auxdetid,trig));
202 for (
auto const &i : t0vect) {
203 std::cout <<
"Trigger " << num <<
" has " << i.idtime.size() <<
" triggers associated." <<
std::endl;
204 for (
auto const &tit : i.idtime) {
213 for (
auto const &i : t0vect) {
238 fTree = tfs->make<TTree>(
"T0Counter",
"T0Counter");
253 double calctime = (double)t+0.5;
code to link reconstructed objects back to the MC truth information
std::vector< std::pair< unsigned int, double > > idtime
void produce(art::Event &e) override
double fClockSpeedCounter
Handle< PROD > getHandle(SelectorBase const &) const
EDProducer(fhicl::ParameterSet const &pset)
void insert(double tim, unsigned int id, art::Ptr< raw::ExternalTrigger > trig)
Q_EXPORT QTSManip setprecision(int p)
double fSampleTimeCounter
T0Counter & operator=(T0Counter const &)=delete
#define DEFINE_ART_MODULE(klass)
int fCoincidenceTolerance
double fCombinedTimeDelay
SubRunNumber_t subRun() const
ProductID put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
bool CreateAssn(PRODUCER const &prod, art::Event &evt, std::vector< T > const &a, art::Ptr< U > const &b, art::Assns< U, T > &assn, std::string a_instance, size_t indx=UINT_MAX)
Creates a single one-to-one association.
T0Counter(fhicl::ParameterSet const &p)
bool testCoincidence(double tim, double tol) const
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
EventNumber_t event() const
t0(double tim, unsigned int id, art::Ptr< raw::ExternalTrigger > trig)
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
QTextStream & endl(QTextStream &s)
Event finding and building.
std::vector< art::Ptr< raw::ExternalTrigger > > trigs
std::string fTriggerModuleLabel
double tick2Time(unsigned int t)