All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Types | Public Member Functions | Private Attributes | List of all members
icarus::trigger::BeamGateInfoFromTracks Class Reference

Writes a set collection of beam gates into each event. More...

Inheritance diagram for icarus::trigger::BeamGateInfoFromTracks:

Classes

struct  Config
 

Public Types

using nanoseconds = util::quantities::intervals::nanoseconds
 
using Parameters = art::SharedProducer::Table< Config >
 

Public Member Functions

 BeamGateInfoFromTracks (Parameters const &config, art::ProcessingFrame const &)
 
virtual void produce (art::Event &event, art::ProcessingFrame const &) override
 Fills the plots. Also extracts the information to fill them with. More...
 

Private Attributes

art::InputTag const fT0selProducer
 Input particles. More...
 
art::InputTag const fT0Producer
 Input particle/time associations. More...
 
nanoseconds const fGateStartOffset
 Offset of gate start from particle time. More...
 
nanoseconds const fGateDuration
 Width of the gate being created. More...
 
sim::BeamType_t const fBeamGateType
 Type of gate saved. More...
 
std::string const fLogCategory
 Message facility stream category for output. More...
 

Detailed Description

Writes a set collection of beam gates into each event.

This module writes a list of sim::BeamGateInfo based on the time associated to a selection of reconstructed tracks.

It may be used as input to modules which require to operate on beam gates, to select time(s) around the reconstructed (and selected) tracks.

Input data products

This module acts on a selection of tracks, which implies that the input is a set of pointers to tracks rather than to an actual track collection. For each track, an associated time is required.

Output data products

Configuration parameters

A terse online description of the parameters is printed by running lar --print-description BeamGateInfoFromTracks.

Note
Time strings are strings with a value and its mandatory unit. For example, 5.5 microseconds are expressed as "5.5 us" or "5500 ns".

Time scales

This module was introduced as a mean to determine the proper time intervals when to apply a trigger simulation. It is evident that for this use case a precise result requires the timing of the gates carefully aligned with the timing of the PMT. (the convention is that the PMT waveforms have a timestamp in the electronics time reference).

The time of the gates created by this module is offered as sim::BeamGateInfo; LArSoft prescribes it to be be specified in nanoseconds and in simulation time reference). Designed for simulation, this time scale refers to the opening of the beam gate (or its surrogate definition in samples with no beam to be gated). Or so is my understanding of it.

The input anab::T0, on the other end, as produced by the Pandora pattern recognition algorithm, and ultimately relative to the trigger time. In a perfectly aligned setup, this is equivalent to the trigger time in real data.

The output of this module attempts to adhere to that convention, and it defines the gate boundaries with respect to the beam gate time.

Definition at line 138 of file BeamGateInfoFromTracks_module.cc.

Member Typedef Documentation

Definition at line 142 of file BeamGateInfoFromTracks_module.cc.

using icarus::trigger::BeamGateInfoFromTracks::Parameters = art::SharedProducer::Table<Config>

Definition at line 216 of file BeamGateInfoFromTracks_module.cc.

Constructor & Destructor Documentation

icarus::trigger::BeamGateInfoFromTracks::BeamGateInfoFromTracks ( Parameters const &  config,
art::ProcessingFrame const &   
)
explicit

Definition at line 287 of file BeamGateInfoFromTracks_module.cc.

288  : art::SharedProducer(config)
289  // configuration
290  , fT0selProducer(config().T0selProducer())
291  , fT0Producer(config().T0Producer())
292  , fGateStartOffset(config().GateStartOffset())
293  , fGateDuration(config().GateEndOffset() - fGateStartOffset)
294  , fBeamGateType(config().getGateType())
295  , fLogCategory(config().LogCategory())
296 {
297 
298  async<art::InEvent>();
299 
300  //
301  // output data declaration
302  //
303  produces<std::vector<sim::BeamGateInfo>>();
304  produces<art::Assns<sim::BeamGateInfo, recob::PFParticle>>();
305  produces<art::Assns<sim::BeamGateInfo, anab::T0>>();
306 
307  //
308  // configuration report (short)
309  //
310  auto const& beamType
312 
313  mf::LogInfo{ fLogCategory }
314  << "Configuration:"
315  << "\n - particle selection: '" << fT0selProducer.encode() << '\''
316  << "\n - associated times: '" << fT0Producer.encode() << '\''
317  << "\n - gate around particle time: " << fGateStartOffset
318  << " -- " << (fGateStartOffset+fGateDuration)
319  << " (" << fGateDuration << "; gate type: \"" << beamType.name()
320  << "\" [#" << fBeamGateType << "])"
321  ;
322 
323 } // icarus::trigger::BeamGateInfoFromTracks::BeamGateInfoFromTracks()
sim::BeamType_t const fBeamGateType
Type of gate saved.
nanoseconds const fGateDuration
Width of the gate being created.
art::InputTag const fT0selProducer
Input particles.
static util::MultipleChoiceSelection< GateType_t > const GateTypeSelector
Selector for Type parameter.
Option_t const & get(Choices_t value) const
Returns the specified option.
std::string const fLogCategory
Message facility stream category for output.
nanoseconds const fGateStartOffset
Offset of gate start from particle time.
art::InputTag const fT0Producer
Input particle/time associations.

Member Function Documentation

void icarus::trigger::BeamGateInfoFromTracks::produce ( art::Event &  event,
art::ProcessingFrame const &   
)
overridevirtual

Fills the plots. Also extracts the information to fill them with.

Definition at line 328 of file BeamGateInfoFromTracks_module.cc.

329 {
330 
331  //
332  // fetch input
333  //
334  auto const& particles
335  = event.getProduct<std::vector<art::Ptr<recob::PFParticle>>>(fT0selProducer);
336 
337  mf::LogDebug(fLogCategory)
338  << "Writing gates for " << particles.size() << " particles.";
339 
340  art::FindOneP<anab::T0> const particleT0(particles, event, fT0Producer);
341 
343  art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(event)
344  };
345 
346  // add this offset to a time vs. trigger to make it vs. beam gate
347  nanoseconds const triggerToBeamGate
348  = detTimings.TriggerTime() - detTimings.BeamGateTime();
349 
350  //
351  // create the content
352  //
353  std::vector<sim::BeamGateInfo> gates;
354  art::Assns<sim::BeamGateInfo, recob::PFParticle> gateToParticle;
355  art::Assns<sim::BeamGateInfo, anab::T0> gateToTime;
356 
357  art::PtrMaker<sim::BeamGateInfo> const makeGatePtr { event };
358 
359  for (auto const& [ iParticle, particlePtr ]: util::enumerate(particles)) {
360 
361  art::Ptr<anab::T0> const t0Ptr = particleT0.at(iParticle);
362  if (t0Ptr.isNull()) {
363  art::Exception e { art::errors::NotFound };
364  e << "Selected track #" << iParticle << " (";
365  if (particlePtr) e << "ID=" << particlePtr->Self() << ", ";
366  e << "#" << particlePtr.key()
367  << " in its collection) has no associated time."
368  ;
369  throw e << '\n';
370  } // if no T0
371 
372  // t0 is stored in trigger time
374  { util::quantities::points::nanosecond(t0Ptr->Time()) };
375 
376  // 1DetectorTimings1 does not handle the beam gate time when converting to
377  // simulation time, so I need to explicitly add the difference
379  = detTimings.toSimulationTime(t0 + triggerToBeamGate + fGateStartOffset);
380 
381  // time conversion is currently redundant here, left as documentation
382  sim::BeamGateInfo gate {
383  gateStart.value() // start
385  , fBeamGateType // type
386  };
387 
388  {
389  mf::LogTrace log{ fLogCategory };
390  log << "Gate for selected track #" << iParticle << " (";
391  if (particlePtr) log << "ID=" << particlePtr->Self() << ", ";
392  log << "#" << particlePtr.key()
393  << " in its collection): time = " << t0 << " => "
394  << gate.Start() << " -- " << (gate.Start() + gate.Width())
395  << " ns (" << gate.Width() << " ns)"
396  ;
397  }
398 
399  gates.push_back(std::move(gate));
400 
401  art::Ptr<sim::BeamGateInfo> gatePtr { makeGatePtr(gates.size() - 1) };
402  gateToParticle.addSingle(gatePtr, particlePtr);
403  gateToTime.addSingle(gatePtr, t0Ptr);
404 
405  } // for
406 
407  //
408  // store output
409  //
410  event.put(moveToUniquePtr(gates));
411  event.put(moveToUniquePtr(gateToParticle));
412  event.put(moveToUniquePtr(gateToTime));
413 
414 } // icarus::trigger::BeamGateInfoFromTracks::produce()
sim::BeamType_t const fBeamGateType
Type of gate saved.
nanoseconds const fGateDuration
Width of the gate being created.
art::InputTag const fT0selProducer
Input particles.
auto enumerate(Iterables &&...iterables)
Range-for loop helper tracking the number of iteration.
Definition: enumerate.h:69
timescale_traits< TriggerTimeCategory >::time_point_t trigger_time
A point in time on the trigger time scale.
timescale_traits< SimulationTimeCategory >::time_point_t simulation_time
A point in time on the simulation time scale.
constexpr IV convertInto() const
Convert this interval into the specified one.
Definition: intervals.h:389
A class exposing an upgraded interface of detinfo::DetectorClocksData.
do i e
nanosecond_as<> nanosecond
Type of time point stored in nanoseconds, in double precision.
Definition: spacetime.h:339
util::quantities::intervals::nanoseconds nanoseconds
std::string const fLogCategory
Message facility stream category for output.
temporary value
fDetProps &fDetProps fDetProps &fDetProps detTimings
nanoseconds const fGateStartOffset
Offset of gate start from particle time.
art::InputTag const fT0Producer
Input particle/time associations.

Member Data Documentation

sim::BeamType_t const icarus::trigger::BeamGateInfoFromTracks::fBeamGateType
private

Type of gate saved.

Definition at line 248 of file BeamGateInfoFromTracks_module.cc.

nanoseconds const icarus::trigger::BeamGateInfoFromTracks::fGateDuration
private

Width of the gate being created.

Definition at line 246 of file BeamGateInfoFromTracks_module.cc.

nanoseconds const icarus::trigger::BeamGateInfoFromTracks::fGateStartOffset
private

Offset of gate start from particle time.

Definition at line 245 of file BeamGateInfoFromTracks_module.cc.

std::string const icarus::trigger::BeamGateInfoFromTracks::fLogCategory
private

Message facility stream category for output.

Definition at line 251 of file BeamGateInfoFromTracks_module.cc.

art::InputTag const icarus::trigger::BeamGateInfoFromTracks::fT0Producer
private

Input particle/time associations.

Definition at line 242 of file BeamGateInfoFromTracks_module.cc.

art::InputTag const icarus::trigger::BeamGateInfoFromTracks::fT0selProducer
private

Input particles.

Definition at line 241 of file BeamGateInfoFromTracks_module.cc.


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