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

Fills a ROOT tree with track-based triggering information. More...

Inheritance diagram for sbn::TimeTrackTreeStorage:

Classes

struct  Config
 

Public Types

using TriggerInfo_t = sbn::details::TriggerResponseManager::TriggerInfo_t
 Data record the trigger response branch is based on. More...
 
using Parameters = art::EDAnalyzer::Table< Config >
 

Public Member Functions

 TimeTrackTreeStorage (Parameters const &p)
 
sbn::selHitInfo makeHit (const recob::Hit &hit, unsigned hkey, const recob::Track &trk, const recob::TrackHitMeta &thm, const std::vector< art::Ptr< anab::Calorimetry >> &calo, const geo::GeometryCore *geo)
 
float dEdx_calc (float dQdx, float A, float B, float Wion, float E)
 
void analyze (art::Event const &e) override
 
void endJob () override
 

Private Types

using TriggerInputSpec_t = sbn::details::TriggerResponseManager::TriggerInputSpec_t
 

Private Member Functions

std::vector< std::pair< double,
std::vector< raw::Channel_t > > > 
computePMTwalls () const
 Accesses detector geometry to return all PMT split by wall. More...
 

Private Attributes

art::InputTag const fPFPproducer
 
art::InputTag const fT0Producer
 
art::InputTag const fT0selProducer
 
art::InputTag const fTrackProducer
 
art::InputTag const fTrackFitterProducer
 
art::InputTag const fCaloProducer
 
art::InputTag const fBeamGateProducer
 
art::InputTag const fTriggerProducer
 
art::InputTag const fFlashProducer
 
std::string const fLogCategory
 
float const fMODA
 
float const fMODB
 
float const fWion
 
float const fEfield
 
bool const fForceDowngoing
 Whether to force all tracks to be downgoing. More...
 
unsigned int fEvent
 
unsigned int fRun
 
unsigned int fSubRun
 
sbn::selTrackInfo fTrackInfo
 
sbn::selBeamInfo fBeamInfo
 
sbn::selTriggerInfo fTriggerInfo
 
sbn::selLightInfo fFlashInfo
 
std::vector< sbn::selLightInfofFlashStore
 
sbn::selHitInfo fHitInfo
 
std::vector< sbn::selHitInfofHitStore
 
std::vector< std::pair< double,
std::vector< raw::Channel_t > > > 
fPMTwalls
 PMT geometry objects, grouped by wall (drift) coordinate. More...
 
TTree * fStoreTree = nullptr
 
unsigned int fTotalProcessed = 0
 
sbn::details::TriggerResponseManager fTriggerResponses
 Manages filling of trigger result branches. More...
 

Friends

TriggerInputSpec_t convert (Config::TriggerSpecConfig const &config)
 

Detailed Description

Fills a ROOT tree with track-based triggering information.

Track selection criteria

This module does not perform almost any selection: it processes all the reconstructed particle flow objects (PFO) (typically from Pandora) selected by the module in T0selProducer, which may perform the desired selection. For every PFO which is associated to a track (recob::Track), that associated track and the associated time (anab::T0) are saved in a tree entry.

Optical detector information

Currently, all reconstructed flashes in the cryostat are saved together with each tree entry, i.e. to each selected track. There is no attempt to match a single flash to a track.

Trigger information

There are two distinct groups of information about triggers in the tree. The first one is the hardware trigger, that is the trigger that was actually used to decide to record the event. That is the same information for all tracks within the same event (and the same in both cryostats, too). The other group of information is from trigger logic simulation on the collected data (optical detector waveforms): there may be multiple branches in this group, one for each simulated trigger logic, and each tree entry, corresponding to a selected track, may have its own value for each trigger logic response.

Simulated trigger information

A branch is added for each configured trigger logic. This module actually ignores the details of the logic yielding the results: a trigger result is a group of data products under the same tag. For example, a tag M1 (presumably, a very loose trigger logic requiring just one PMT pair above threshold anywhere in the detector, with no hint of which that threshold is) will produce a branch with name "M1" including information from the M1 data products (so far, only a collection of raw::Trigger is read). It is assumed that there is one trigger result for each selected track (as found in the data product from T0selProducer configuration parameter). Note that a trigger object is expected to be present regardless whether the trigger fired or not. It is assumed that the trigger fired if at least one of the raw::Trigger::TriggerBits() is set, not fired otherwise.

Each branch mirrors a data record, TriggerInfo_t, reporting the response for one simulated trigger logic. The structure and interpretation of the trigger response branch is described in ROOT TTree code by the string in TriggerInfo_t::TriggerResponseBranchStructure, and its meaning is:

Definition at line 164 of file TimeTrackTreeStorage_module.cc.

Member Typedef Documentation

using sbn::TimeTrackTreeStorage::Parameters = art::EDAnalyzer::Table<Config>

Definition at line 294 of file TimeTrackTreeStorage_module.cc.

Data record the trigger response branch is based on.

Definition at line 172 of file TimeTrackTreeStorage_module.cc.

Definition at line 167 of file TimeTrackTreeStorage_module.cc.

Constructor & Destructor Documentation

sbn::TimeTrackTreeStorage::TimeTrackTreeStorage ( Parameters const &  p)
explicit

Definition at line 400 of file TimeTrackTreeStorage_module.cc.

401  : EDAnalyzer{p}
402  // configuration
403  , fPFPproducer { p().PFPproducer() }
404  , fT0Producer { p().T0Producer().value_or(fPFPproducer) }
405  , fT0selProducer { p().T0selProducer().value_or(fPFPproducer) }
406  , fTrackProducer { p().TrackProducer() }
407  , fTrackFitterProducer { p().TrackFitterProducer() }
408  , fCaloProducer { p().CaloProducer() }
409  , fBeamGateProducer { p().BeamGateProducer() }
410  , fTriggerProducer { p().TriggerProducer() }
411  , fFlashProducer { p().FlashProducer() }
412  , fLogCategory { p().LogCategory() }
413  , fMODA { p().MODA() }
414  , fMODB { p().MODB() }
415  , fWion { p().Wion() }
416  , fEfield { p().Efield() }
417  , fForceDowngoing { p().ForceDowngoing() }
418  // algorithms
419  , fPMTwalls { computePMTwalls() }
420  , fStoreTree {
421  art::ServiceHandle<art::TFileService>()->make<TTree>
422  ("TimedTrackStorage", "Timed Track Tree")
423  }
425  { p().EmulatedTriggers(), consumesCollector(), *fStoreTree }
426 {
427 
428  //
429  // declaration of input
430  //
431 
432  // consumes<std::vector<recob::PFParticle>>(fPFPproducer); // not yet?
433  consumes<std::vector<art::Ptr<recob::PFParticle>>>(fT0selProducer);
434  consumes<sbn::ExtraTriggerInfo>(fTriggerProducer);
435  consumes<std::vector<sim::BeamGateInfo>>(fBeamGateProducer);
436  consumes<art::Assns<recob::PFParticle, recob::Track>>(fTrackProducer);
437  consumes<art::Assns<recob::PFParticle, anab::T0>>(fT0Producer);
438  consumes<art::Assns<recob::Hit, recob::Track, recob::TrackHitMeta>>(fTrackProducer);
439  consumes<recob::OpFlash>(fFlashProducer);
440 
441  //
442  // tree population
443  //
444  fStoreTree->Branch("run", &fRun);
445  fStoreTree->Branch("subrun", &fSubRun);
446  fStoreTree->Branch("event", &fEvent);
447  fStoreTree->Branch("beamInfo", &fBeamInfo);
448  fStoreTree->Branch("triggerInfo", &fTriggerInfo);
449  fStoreTree->Branch("selTracks", &fTrackInfo);
450  fStoreTree->Branch("selFlashes", &fFlashStore); //store all flashes in an event for all tracks
451  fStoreTree->Branch("selHits", &fHitStore);
452  //fStoreTree->Branch("selFlashes", &fFlashInfo);
453 
454 } // sbn::TimeTrackTreeStorage::TimeTrackTreeStorage()
std::vector< sbn::selLightInfo > fFlashStore
std::vector< sbn::selHitInfo > fHitStore
sbn::details::TriggerResponseManager fTriggerResponses
Manages filling of trigger result branches.
pdgs p
Definition: selectors.fcl:22
std::vector< std::pair< double, std::vector< raw::Channel_t > > > computePMTwalls() const
Accesses detector geometry to return all PMT split by wall.
std::vector< std::pair< double, std::vector< raw::Channel_t > > > fPMTwalls
PMT geometry objects, grouped by wall (drift) coordinate.
bool const fForceDowngoing
Whether to force all tracks to be downgoing.
fDetProps &fDetProps fDetProps &fDetProps consumesCollector())

Member Function Documentation

void sbn::TimeTrackTreeStorage::analyze ( art::Event const &  e)
override

Definition at line 457 of file TimeTrackTreeStorage_module.cc.

458 {
459  const geo::GeometryCore *geom = lar::providerFrom<geo::Geometry>();
460  // Implementation of required member function here.
461  fEvent = e.event();
462  fSubRun = e.subRun();
463  fRun = e.run();
464  fBeamInfo = {};
465 
466  std::vector<art::Ptr<recob::PFParticle>> const& pfparticles = e.getProduct<std::vector<art::Ptr<recob::PFParticle>>> (fT0selProducer);
467  if(pfparticles.empty()) {
468  mf::LogDebug(fLogCategory) << "No particles in '" << fT0selProducer.encode() << "'.";
469  return;
470  }
471 
472  std::vector<sim::BeamGateInfo> const& beamgate = e.getProduct<std::vector<sim::BeamGateInfo>> (fBeamGateProducer);
473  if(beamgate.empty())
474  mf::LogWarning(fLogCategory) << "No Beam Gate Information!";
475  else {
476  if(beamgate.size() > 1)
477  mf::LogWarning(fLogCategory) << "Event has multiple beam gate info labels! (maybe this changes later to be standard)";
478  sim::BeamGateInfo const& bg = beamgate[0];
482  }
483 
484  sbn::ExtraTriggerInfo const &triggerinfo = e.getProduct<sbn::ExtraTriggerInfo> (fTriggerProducer);
485  fTriggerInfo.beamType = value(triggerinfo.sourceType);
488  fTriggerInfo.triggerID = triggerinfo.triggerID;
489  fTriggerInfo.gateID = triggerinfo.gateID;
490 
491  //mf::LogTrace(fLogCategory) << "HERE!";
492  art::FindOneP<recob::Track> particleTracks(pfparticles,e,fTrackProducer);
493  art::FindOneP<anab::T0> t0Tracks(pfparticles,e,fT0Producer);
494  std::vector<recob::OpFlash> const &particleFlashes = e.getProduct<std::vector<recob::OpFlash>>(fFlashProducer);
495  //art::FindOneP<recob::SpacePoint> particleSPs(pfparticles, e, fT0selProducer);
496  //mf::LogTrace(fLogCategory) << "PFParticles size: " << pfparticles.size() << " art::FindOneP Tracks Size: " << particleTracks.size();
497  art::ValidHandle<std::vector<recob::Track>> allTracks = e.getValidHandle<std::vector<recob::Track>>(fTrackProducer);
498  art::FindManyP<recob::Hit,recob::TrackHitMeta> trkht(allTracks,e,fTrackProducer); //for track hits
499  art::FindManyP<anab::Calorimetry> calorim(allTracks, e, fCaloProducer);
500 
501  // get an extractor bound to this event
502  sbn::details::TriggerResponseManager::Extractors triggerResponseExtractors
504  unsigned int processed = 0;
505  for(unsigned int iPart = 0; iPart < pfparticles.size(); ++iPart)
506  {
507  art::Ptr<recob::Track> const& trackPtr = particleTracks.at(iPart);
508  if(trackPtr.isNull()) continue;
509 
510  fFlashInfo = {};
511  fFlashStore.clear();
512  fHitStore.clear();
513 
514  art::Ptr<anab::T0> const& t0Ptr = t0Tracks.at(iPart);
515  float const track_t0 = t0Ptr->Time();
516  if(!particleFlashes.empty())
517  {
518  //float min_flash_t0_diff = 999999.0;
519  for(unsigned int iFlash = 0; iFlash < particleFlashes.size(); ++iFlash)
520  {
521  fFlashInfo = {};
522  recob::OpFlash const flashPtr = particleFlashes.at(iFlash);
523  float const flash_pe = flashPtr.TotalPE();
524  float const flash_time = flashPtr.Time();
525  float const flash_x = flashPtr.XCenter();
526  float const flash_y = flashPtr.YCenter();
527  float const flash_z = flashPtr.ZCenter();
528  float flash_t0_diff = flash_time - track_t0/1e3;
529  //if(std::abs(flash_t0_diff) < min_flash_t0_diff)
530  //{
531  fFlashInfo.flash_id = iFlash;
532  fFlashInfo.sum_pe = flash_pe;
533  fFlashInfo.flash_time = flash_time;
534  fFlashInfo.flash_x = flash_x;
535  fFlashInfo.flash_y = flash_y;
536  fFlashInfo.flash_z = flash_z;
537  fFlashInfo.diff_flash_t0 = flash_t0_diff;
538  //min_flash_t0_diff = std::abs(flash_t0_diff);
539  fFlashStore.push_back(fFlashInfo);
540  //}
541  }
542  }
543  sbn::selTrackInfo trackInfo;
544  trackInfo.trackID = trackPtr->ID();
545  trackInfo.t0 = track_t0/1e3; //is this in nanoseconds? Will convert to seconds so I can understand better
546  //if(track_t0/1e3 < 10 && track_t0/1e3 > -10)
547  //mf::LogTrace(fLogCategory) << track_t0/1e3 << " Run is: " << fRun << " SubRun is: " << fSubRun << " Event is: " << fEvent << " Track ID is: " << trackPtr->ID();
548 
549  recob::tracking::Point_t startPoint = trackPtr->Start();
550  recob::tracking::Point_t endPoint = trackPtr->End();
551  recob::tracking::Vector_t startDir = trackPtr->StartDirection();
552  bool const flipTrack = fForceDowngoing && (startDir.Y() > 0.0);
553  if (flipTrack) {
554  std::swap(startPoint, endPoint);
555  startDir = -trackPtr->EndDirection();
556  }
557 
558  trackInfo.start_x = startPoint.X();
559  trackInfo.start_y = startPoint.Y();
560  trackInfo.start_z = startPoint.Z();
561  trackInfo.end_x = endPoint.X();
562  trackInfo.end_y = endPoint.Y();
563  trackInfo.end_z = endPoint.Z();
564  trackInfo.dir_x = startDir.X();
565  trackInfo.dir_y = startDir.Y();
566  trackInfo.dir_z = startDir.Z();
567  trackInfo.length = trackPtr->Length();
568 
569  std::vector<geo::Point_t> const trackPath
570  = extractTrajectory(*trackPtr, flipTrack);
572  = util::pathMiddlePoint(trackPath.begin(), std::prev(trackPath.end()));
573  trackInfo.middle_x = middlePoint.X();
574  trackInfo.middle_y = middlePoint.Y();
575  trackInfo.middle_z = middlePoint.Z();
576 
577  //
578  // determination of cathode crossing
579  //
580  // this determination should be independent of track direction;
581  icarus::CathodeDesc_t const cathode
582  = icarus::findTPCcathode(middlePoint, *geom);
583 
584  icarus::CathodeCrossing_t crossInfo
585  = icarus::detectCrossing(trackPath.begin(), trackPath.end(), cathode);
586 
587  if (crossInfo) {
588 
589  auto itBeforeCathode = trackPath.begin() + crossInfo.indexBefore;
590  auto itAfterCathode = trackPath.begin() + crossInfo.indexAfter;
591 
592  geo::Point_t middleBeforeCathode
593  = util::pathMiddlePoint(trackPath.begin(), itBeforeCathode);
594  geo::Point_t middleAfterCathode
595  = util::pathMiddlePoint(itAfterCathode, std::prev(trackPath.end()));
596 
597  // "before" is defined as "smaller x", so:
598  if (distance(middleAfterCathode, cathode) < 0.0) {
599  assert(distance(middleBeforeCathode, cathode) >= 0.0);
600  std::swap(crossInfo.indexBefore, crossInfo.indexAfter);
601  std::swap(itBeforeCathode, itAfterCathode);
602  std::swap(crossInfo.before, crossInfo.after);
603  std::swap(middleBeforeCathode, middleAfterCathode);
604  }
605 
606  trackInfo.beforecathode = crossInfo.before;
607  trackInfo.aftercathode = crossInfo.after;
608 
609  geo::Point_t const& atCathodePoint = crossInfo.crossingPoint;
610  trackInfo.atcathode_x = atCathodePoint.X();
611  trackInfo.atcathode_y = atCathodePoint.Y();
612  trackInfo.atcathode_z = atCathodePoint.Z();
613 
614  trackInfo.midbeforecathode_x = middleBeforeCathode.X();
615  trackInfo.midbeforecathode_y = middleBeforeCathode.Y();
616  trackInfo.midbeforecathode_z = middleBeforeCathode.Z();
617 
618  trackInfo.midaftercathode_x = middleAfterCathode.X();
619  trackInfo.midaftercathode_y = middleAfterCathode.Y();
620  trackInfo.midaftercathode_z = middleAfterCathode.Z();
621 
622  } // if crossing
623 
624  //Animesh added hit information - 2/8/2022
625 
626  unsigned int plane = 0; //hit plane number
627 
628  std::vector<art::Ptr<recob::Hit>> const& allHits = trkht.at(trackPtr.key());
629  std::vector<const recob::TrackHitMeta*> const& trkmetas = trkht.data(trackPtr.key());
630  std::vector<art::Ptr<anab::Calorimetry>> const& calorimetrycol = calorim.at(trackPtr.key());
631  std::vector<std::vector<unsigned int>> hits(plane);
632 
633  // art::FindManyP<recob::SpacePoint> fmspts(allHits, e, fT0selProducer);
634  // or art::FindManyP<recob::SpacePoint> fmspts(allHits, e, fSpacePointModuleLabel); // Not sure how to define it
635  for (size_t ih = 0; ih < allHits.size(); ++ih)
636  {
637  //hits[allHits[ih]->WireID().Plane].push_back(ih);
638  sbn::selHitInfo hinfo = makeHit(*allHits[ih], allHits[ih].key(), *trackPtr, *trkmetas[ih], calorimetrycol, geom);
639  if(hinfo.plane == 2)
640  fHitStore.push_back(hinfo);
641 
642  }
643  float totE = 0;
644  float totq_int = 0;
645  float totq_dqdx = 0;
646  for (size_t i = 0; i < fHitStore.size(); ++i)
647  {
648  if(fHitStore[i].dEdx > -1)
649  {
650  float E_hit = fHitStore[i].dEdx*fHitStore[i].pitch; //energy of hit, in MeV?
651  totE += E_hit;
652  }
653 
654  if(fHitStore[i].dqdx > -1)
655  {
656  float q_hit = fHitStore[i].integral;
657  totq_int += q_hit;
658  float q_hit_dqdx = fHitStore[i].dqdx*fHitStore[i].pitch;
659  totq_dqdx += q_hit_dqdx;
660  }
661  /*
662  if(fHitStore[i].pitch > 1 && fHitStore[i].dqdx < 100)
663  {
664  std::cout << "In strange peak! Event: " << fEvent << " Track ID: " << trackInfo.trackID << " Hit ID: " << i << " Total Number of hits: " << fHitStore.size() << std::endl;
665  }
666  */
667  }
668  trackInfo.energy = totE;
669  trackInfo.charge_int = totq_int;
670  trackInfo.charge_dqdx = totq_dqdx;
671  fTrackInfo = std::move(trackInfo);
672  /*
673  for(size_t trajp = 0; trajp < trackPtr->NumberTrajectoryPoints()-1; ++trajp)
674  {
675  TVector3 cur_point(trackPtr->TrajectoryPoint(traj_p).position.X(), trackPtr->TrajectoryPoint(traj_p).position.Y(), trackPtr->TrajectoryPoint(traj_p).position.Z());
676  TVector3 next_point(trackPtr->TrajectoryPoint(traj_p+1).position.X(), trackPtr->TrajectoryPoint(traj_p+1).position.Y(), trackPtr->TrajectoryPoint(traj_p+1).position.Z());
677  if(abs(cur_point.X()) < 170 && abs(next_point.X()) > 170)
678  //interpolate to get cathode crossing point
679 
680  }
681  */
682 
683  triggerResponseExtractors.fetch(iPart); // TODO no check performed; need to find a way
684 
685  ++processed;
686  ++fTotalProcessed;
687  fStoreTree->Fill();
688  } // for particle
689 
690  mf::LogInfo(fLogCategory) << "Particles Processed: " << processed;
691 
692 } // sbn::TimeTrackTreeStorage::analyze()
std::vector< sbn::selLightInfo > fFlashStore
std::vector< sbn::selHitInfo > fHitStore
float middle_y
Half-way distance along the trajectory.
unsigned int gateID
Incremental counter of gates from any source opened from start of the run.
float atcathode_z
Cathode crossing point of trajectory.
geo::Point_t crossingPoint
Trajectory crossing point.
sbn::details::TriggerResponseManager fTriggerResponses
Manages filling of trigger result branches.
CathodeDesc_t findTPCcathode(geo::Point_t const &point, geo::GeometryCore const &geom)
Returns cathode information for cryostat at the specified point.
double after
Length of the path &quot;after&quot; the cathode.
unsigned int beamGateType
double Start() const
Definition: BeamGateInfo.h:30
float atcathode_x
Cathode crossing point of trajectory.
std::uint64_t beamGateTimestamp
Absolute timestamp of the opening of this beam gate [ns].
double ZCenter() const
Definition: OpFlash.h:117
float beforecathode
Track path length before cathode (lower x).
double Time() const
Definition: OpFlash.h:106
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< Coord_t >, ROOT::Math::GlobalCoordinateSystemTag > Vector_t
Type for representation of momenta in 3D space. See recob::tracking::Coord_t for more details on the ...
Definition: TrackingTypes.h:29
Simple description for the cathode.
double distance(geo::Point_t const &point, CathodeDesc_t const &cathode)
Returns the distance of a point from the cathode.
Additional information on trigger.
float midaftercathode_x
Midpoint of subpath after cathode.
float atcathode_y
Cathode crossing point of trajectory.
std::size_t indexBefore
Index of the point &quot;before&quot; cathode.
float middle_x
Half-way distance along the trajectory.
float midaftercathode_z
Midpoint of subpath after cathode.
Description of geometry of one entire detector.
float midbeforecathode_x
Midpoint of subpath before cathode.
float dEdx(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, const TCSlice &slc, TP3D &tp3d)
Definition: PFPUtils.cxx:2687
Extractors extractorsFor(art::Event const &event)
Returns an object to extract trigger information from event.
sbn::triggerSource sourceType
Type of this gate (sbn::triggerSource::NBits marks this object invalid).
std::uint64_t beamGateTime
float midbeforecathode_y
Midpoint of subpath before cathode.
float aftercathode
Track path length before cathode (higher x).
CathodeCrossing_t detectCrossing(Iter begin, Iter end, CathodeDesc_t const &cathode)
Returns the crossing point of a trajectory on the cathode.
float midaftercathode_y
Midpoint of subpath after cathode.
double before
Length of the path &quot;before&quot; the cathode.
float middle_z
Half-way distance along the trajectory.
double Width() const
Definition: BeamGateInfo.h:31
sbn::selHitInfo makeHit(const recob::Hit &hit, unsigned hkey, const recob::Track &trk, const recob::TrackHitMeta &thm, const std::vector< art::Ptr< anab::Calorimetry >> &calo, const geo::GeometryCore *geo)
do i e
float midbeforecathode_z
Midpoint of subpath before cathode.
auto pathMiddlePoint(FIter itFirst, LIter itLast, double relTarget=0.5)
Returns the geometric point in the middle of the specified path.
temporary value
double TotalPE() const
Definition: OpFlash.cxx:68
std::uint64_t triggerTime
double XCenter() const
Returns the estimated center on x direction (.
Definition: OpFlash.h:113
std::uint64_t triggerTimestamp
Absolute timestamp of this trigger [ns].
bool const fForceDowngoing
Whether to force all tracks to be downgoing.
unsigned int triggerID
The identifier of this trigger (usually matching the event number).
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
Definition: geo_vectors.h:184
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< Coord_t >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space. See recob::tracking::Coord_t for more detai...
Definition: TrackingTypes.h:26
double YCenter() const
Definition: OpFlash.h:115
Information about the cathode crossing of a path.
BeamType_t BeamType() const
Definition: BeamGateInfo.h:32
std::size_t indexAfter
Index of the point &quot;after&quot; cathode.
geo::Point_t middlePoint(BeginIter begin, EndIter end)
Returns the middle of the specified points.
std::vector< std::pair< double, std::vector< raw::Channel_t > > > sbn::TimeTrackTreeStorage::computePMTwalls ( ) const
private

Accesses detector geometry to return all PMT split by wall.

Definition at line 786 of file TimeTrackTreeStorage_module.cc.

786  {
787 
788  geo::GeometryCore const& geom { *lar::providerFrom<geo::Geometry>() };
789 
790  // run the algorithm to identify the PMT walls (as groups of geo::OpDetGeo)
791  std::vector<std::pair<double, std::vector<geo::OpDetGeo const*>>> opDetWalls
793 
794  // and weirdly, the only portable way to go from a OpDetGeo to its channel
795  // is to build a map (maybe because it's not guaranteed to be 1-to-1?)
796  std::map<geo::OpDetGeo const*, raw::Channel_t> opDetToChannel;
797  for (auto const channel: util::counter<raw::Channel_t>(geom.MaxOpChannel()))
798  opDetToChannel[&geom.OpDetGeoFromOpChannel(channel)] = channel;
799 
800  // rewrite the data structure replacing each detector with its readout channel
801  std::vector<std::pair<double, std::vector<raw::Channel_t>>> channelWalls;
802  for (auto const& [ coord, PMTs ]: opDetWalls) {
803  std::vector<raw::Channel_t> channels;
804  channels.reserve(PMTs.size());
805  for (geo::OpDetGeo const* PMT: PMTs)
806  channels.push_back(opDetToChannel.at(PMT));
807 
808  channelWalls.emplace_back(coord, std::move(channels));
809  } // for walls
810 
811  return channelWalls;
812 } // sbn::TimeTrackTreeStorage::computePMTwalls()
#define PMT
Definition: NestAlg.cxx:19
auto coord(Vector &v, unsigned int n) noexcept
Returns an object to manage the coordinate n of a vector.
Description of geometry of one entire detector.
std::vector< std::pair< double, PMTlist_t > > PMTwalls(geo::CryostatGeo const &cryo) const
Groups optical detectors under the specified cryostat into walls.
Algorithm clustering PMT according to their position.
float sbn::TimeTrackTreeStorage::dEdx_calc ( float  dQdx,
float  A,
float  B,
float  Wion,
float  E 
)

Definition at line 760 of file TimeTrackTreeStorage_module.cc.

765 {
766  float LAr_density_gmL = 1.389875; //LAr density in g/cm^3
767  float alpha = A;
768  float beta = B/(LAr_density_gmL*E);
769  float dEdx = ((std::exp(dQdx*Wion*beta) - alpha)/beta)*3.278;
770 
771  return dEdx;
772 
773 }
float LAr_density_gmL
Definition: dedx.py:10
process_name E
float dEdx(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, const TCSlice &slc, TP3D &tp3d)
Definition: PFPUtils.cxx:2687
int Wion
Definition: dedx.py:125
float A
Definition: dedx.py:137
void sbn::TimeTrackTreeStorage::endJob ( )
override

Definition at line 777 of file TimeTrackTreeStorage_module.cc.

777  {
778 
779  mf::LogInfo(fLogCategory) << "Processed " << fTotalProcessed << " tracks.";
780 
781 } // sbn::TimeTrackTreeStorage::endJob()
sbn::selHitInfo sbn::TimeTrackTreeStorage::makeHit ( const recob::Hit hit,
unsigned  hkey,
const recob::Track trk,
const recob::TrackHitMeta thm,
const std::vector< art::Ptr< anab::Calorimetry >> &  calo,
const geo::GeometryCore geo 
)

Definition at line 695 of file TimeTrackTreeStorage_module.cc.

701 {
702 
703  // TrackHitInfo to save
704  sbn::selHitInfo hinfo;
705 
706  // information from the hit object
707  hinfo.integral = hit.Integral();
708  hinfo.sumadc = hit.SummedADC();
709  hinfo.width = hit.RMS();
710  hinfo.pk_time = hit.PeakTime();
711  hinfo.mult = hit.Multiplicity();
712  hinfo.wire = hit.WireID().Wire;
713  hinfo.plane = hit.WireID().Plane;
714  hinfo.channel = geo->PlaneWireToChannel(hit.WireID());
715  hinfo.tpc = hit.WireID().TPC;
716  hinfo.end = hit.EndTick();
717  hinfo.start = hit.StartTick();
718  hinfo.id = (int)hkey;
719 
720  bool const badhit = (thm.Index() == std::numeric_limits<unsigned int>::max()) ||
721  (!trk.HasValidPoint(thm.Index()));
722 
723  //hinfo.ontraj = !badhit;
724  // Save trajectory information if we can
725  if(!badhit)
726  {
727  geo::Point_t const& loc = trk.LocationAtPoint(thm.Index());
728  hinfo.px = loc.X();
729  hinfo.py = loc.Y();
730  hinfo.pz = loc.Z();
731 
732  geo::Vector_t const& dir = trk.DirectionAtPoint(thm.Index());
733  hinfo.dirx = dir.X();
734  hinfo.diry = dir.Y();
735  hinfo.dirz = dir.Z();
736 
737  // And determine if the Hit is on a Calorimetry object
738  for (const art::Ptr<anab::Calorimetry> &c: calo) {
739  if (c->PlaneID().Plane != hinfo.plane) continue;
740 
741  // Found the plane! Now find the hit:
742  for (unsigned i_calo = 0; i_calo < c->dQdx().size(); i_calo++) {
743  // "TpIndices" match to the hit key
744  if (c->TpIndices()[i_calo] != hkey) continue;
745  // Fill the calo information associated with the hit
746  hinfo.oncalo = true;
747  hinfo.pitch = c->TrkPitchVec()[i_calo];
748  hinfo.dqdx = c->dQdx()[i_calo];
749  hinfo.dEdx = dEdx_calc(hinfo.dqdx, fMODA, fMODB, fWion, fEfield);
750  hinfo.rr = c->ResidualRange()[i_calo];
751  break;
752  } // for i_calo
753  break;
754  } // for c
755  }
756 
757  return hinfo;
758 }
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Vector_t
Type for representation of momenta in 3D space.
Definition: geo_vectors.h:164
geo::WireID WireID() const
Definition: Hit.h:233
float RMS() const
RMS of the hit shape, in tick units.
Definition: Hit.h:220
Point_t const & LocationAtPoint(size_t i) const
bool HasValidPoint(size_t i) const
float Integral() const
Integral under the calibrated signal waveform of the hit, in tick x ADC units.
Definition: Hit.h:224
WireID_t Wire
Index of the wire within its plane.
Definition: geo_types.h:580
short int Multiplicity() const
How many hits could this one be shared with.
Definition: Hit.h:226
float dEdx_calc(float dQdx, float A, float B, float Wion, float E)
PlaneID_t Plane
Index of the plane within its TPC.
Definition: geo_types.h:493
raw::TDCtick_t StartTick() const
Initial tdc tick for hit.
Definition: Hit.h:216
tuple dir
Definition: dropbox.py:28
raw::TDCtick_t EndTick() const
Final tdc tick for hit.
Definition: Hit.h:217
raw::ChannelID_t PlaneWireToChannel(WireID const &wireid) const
Returns the ID of the TPC channel connected to the specified wire.
float PeakTime() const
Time of the signal peak, in tick units.
Definition: Hit.h:218
float SummedADC() const
The sum of calibrated ADC counts of the hit (0. by default)
Definition: Hit.h:223
unsigned int Index() const
Hit index along the track trajectory.
Definition: TrackHitMeta.h:55
Vector_t DirectionAtPoint(size_t i) const
TPCID_t TPC
Index of the TPC within its cryostat.
Definition: geo_types.h:406
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
Definition: geo_vectors.h:184

Friends And Related Function Documentation

TriggerInputSpec_t convert ( Config::TriggerSpecConfig const &  config)
friend

Definition at line 388 of file TimeTrackTreeStorage_module.cc.

389  {
390  return {
391  config.Name() // name
392  , config.TriggerTag() // inputTag
393  };
394  } // convert(sbn::TriggerSpecConfig)

Member Data Documentation

art::InputTag const sbn::TimeTrackTreeStorage::fBeamGateProducer
private

Definition at line 326 of file TimeTrackTreeStorage_module.cc.

sbn::selBeamInfo sbn::TimeTrackTreeStorage::fBeamInfo
private

Definition at line 345 of file TimeTrackTreeStorage_module.cc.

art::InputTag const sbn::TimeTrackTreeStorage::fCaloProducer
private

Definition at line 325 of file TimeTrackTreeStorage_module.cc.

float const sbn::TimeTrackTreeStorage::fEfield
private

Definition at line 333 of file TimeTrackTreeStorage_module.cc.

unsigned int sbn::TimeTrackTreeStorage::fEvent
private

Definition at line 340 of file TimeTrackTreeStorage_module.cc.

sbn::selLightInfo sbn::TimeTrackTreeStorage::fFlashInfo
private

Definition at line 347 of file TimeTrackTreeStorage_module.cc.

art::InputTag const sbn::TimeTrackTreeStorage::fFlashProducer
private

Definition at line 328 of file TimeTrackTreeStorage_module.cc.

std::vector<sbn::selLightInfo> sbn::TimeTrackTreeStorage::fFlashStore
private

Definition at line 348 of file TimeTrackTreeStorage_module.cc.

bool const sbn::TimeTrackTreeStorage::fForceDowngoing
private

Whether to force all tracks to be downgoing.

Definition at line 334 of file TimeTrackTreeStorage_module.cc.

sbn::selHitInfo sbn::TimeTrackTreeStorage::fHitInfo
private

Definition at line 349 of file TimeTrackTreeStorage_module.cc.

std::vector<sbn::selHitInfo> sbn::TimeTrackTreeStorage::fHitStore
private

Definition at line 350 of file TimeTrackTreeStorage_module.cc.

std::string const sbn::TimeTrackTreeStorage::fLogCategory
private

Definition at line 329 of file TimeTrackTreeStorage_module.cc.

float const sbn::TimeTrackTreeStorage::fMODA
private

Definition at line 330 of file TimeTrackTreeStorage_module.cc.

float const sbn::TimeTrackTreeStorage::fMODB
private

Definition at line 331 of file TimeTrackTreeStorage_module.cc.

art::InputTag const sbn::TimeTrackTreeStorage::fPFPproducer
private

Definition at line 320 of file TimeTrackTreeStorage_module.cc.

std::vector<std::pair<double, std::vector<raw::Channel_t> > > sbn::TimeTrackTreeStorage::fPMTwalls
private

PMT geometry objects, grouped by wall (drift) coordinate.

Definition at line 356 of file TimeTrackTreeStorage_module.cc.

unsigned int sbn::TimeTrackTreeStorage::fRun
private

Definition at line 341 of file TimeTrackTreeStorage_module.cc.

TTree* sbn::TimeTrackTreeStorage::fStoreTree = nullptr
private

Definition at line 361 of file TimeTrackTreeStorage_module.cc.

unsigned int sbn::TimeTrackTreeStorage::fSubRun
private

Definition at line 342 of file TimeTrackTreeStorage_module.cc.

art::InputTag const sbn::TimeTrackTreeStorage::fT0Producer
private

Definition at line 321 of file TimeTrackTreeStorage_module.cc.

art::InputTag const sbn::TimeTrackTreeStorage::fT0selProducer
private

Definition at line 322 of file TimeTrackTreeStorage_module.cc.

unsigned int sbn::TimeTrackTreeStorage::fTotalProcessed = 0
private

Definition at line 363 of file TimeTrackTreeStorage_module.cc.

art::InputTag const sbn::TimeTrackTreeStorage::fTrackFitterProducer
private

Definition at line 324 of file TimeTrackTreeStorage_module.cc.

sbn::selTrackInfo sbn::TimeTrackTreeStorage::fTrackInfo
private

Definition at line 344 of file TimeTrackTreeStorage_module.cc.

art::InputTag const sbn::TimeTrackTreeStorage::fTrackProducer
private

Definition at line 323 of file TimeTrackTreeStorage_module.cc.

sbn::selTriggerInfo sbn::TimeTrackTreeStorage::fTriggerInfo
private

Definition at line 346 of file TimeTrackTreeStorage_module.cc.

art::InputTag const sbn::TimeTrackTreeStorage::fTriggerProducer
private

Definition at line 327 of file TimeTrackTreeStorage_module.cc.

sbn::details::TriggerResponseManager sbn::TimeTrackTreeStorage::fTriggerResponses
private

Manages filling of trigger result branches.

Definition at line 373 of file TimeTrackTreeStorage_module.cc.

float const sbn::TimeTrackTreeStorage::fWion
private

Definition at line 332 of file TimeTrackTreeStorage_module.cc.


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