Classes | Public Member Functions | Private Attributes | List of all members
cheat::BackTracker Class Reference

#include <BackTracker.h>

Inheritance diagram for cheat::BackTracker:
cheat::BackTrackerService

Classes

struct  fhiclConfig
 

Public Member Functions

 BackTracker (const fhiclConfig &config, const cheat::ParticleInventory *partInv, const geo::GeometryCore *geom)
 
 BackTracker (const fhicl::ParameterSet &pSet, const cheat::ParticleInventory *partInv, const geo::GeometryCore *geom)
 
 BackTracker (BackTracker const &)=delete
 
template<typename Evt >
void PrepEvent (const Evt &evt)
 
template<typename Evt >
void PrepSimChannels (const Evt &evt)
 
template<typename Evt >
bool CanRun (const Evt &evt)
 
template<typename Evt >
std::vector< art::Ptr< recob::Hit > > SpacePointToHits_Ps (art::Ptr< recob::SpacePoint > const &spt, const Evt &evt) const
 
template<typename Evt >
std::vector< double > SpacePointToXYZ (detinfo::DetectorClocksData const &clockData, art::Ptr< recob::SpacePoint > const &spt, const Evt &evt) const
 
void ClearEvent ()
 
bool SimChannelsReady () const
 
const std::vector< art::Ptr< sim::SimChannel > > & SimChannels () const
 
std::vector< const sim::IDE * > TrackIdToSimIDEs_Ps (int const &id) const
 
std::vector< const sim::IDE * > TrackIdToSimIDEs_Ps (int const &id, const geo::View_t view) const
 
art::Ptr< sim::SimChannelFindSimChannelPtr (raw::ChannelID_t channel) const
 Returns the cached sim::SimChannel on the specified channel. More...
 
art::Ptr< sim::SimChannelFindSimChannel (raw::ChannelID_t channel) const
 Returns the cached sim::SimChannel on the specified channel. More...
 
std::vector< sim::TrackIDEChannelToTrackIDEs (detinfo::DetectorClocksData const &clockData, raw::ChannelID_t channel, const double hit_start_time, const double hit_end_time) const
 
std::vector< sim::TrackIDEHitToTrackIDEs (detinfo::DetectorClocksData const &clockData, recob::Hit const &hit) const
 
std::vector< sim::TrackIDEHitToTrackIDEs (detinfo::DetectorClocksData const &clockData, art::Ptr< recob::Hit > const &hit) const
 
std::vector< int > HitToTrackIds (detinfo::DetectorClocksData const &clockData, recob::Hit const &hit) const
 
std::vector< sim::TrackIDEHitToEveTrackIDEs (detinfo::DetectorClocksData const &clockData, recob::Hit const &hit) const
 
std::vector< sim::TrackIDEHitToEveTrackIDEs (detinfo::DetectorClocksData const &clockData, art::Ptr< recob::Hit > const &hit) const
 
std::vector< art::Ptr< recob::Hit > > TrackIdToHits_Ps (detinfo::DetectorClocksData const &clockData, int tkId, std::vector< art::Ptr< recob::Hit >> const &hitsIn) const
 
std::vector< std::vector< art::Ptr< recob::Hit > > > TrackIdsToHits_Ps (detinfo::DetectorClocksData const &clockData, std::vector< int > const &tkIds, std::vector< art::Ptr< recob::Hit >> const &hitsIn) const
 
std::vector< sim::IDEHitToAvgSimIDEs (detinfo::DetectorClocksData const &clockData, recob::Hit const &hit) const
 
std::vector< sim::IDEHitToAvgSimIDEs (detinfo::DetectorClocksData const &clockData, art::Ptr< recob::Hit > const &hit) const
 
std::vector< const sim::IDE * > HitToSimIDEs_Ps (detinfo::DetectorClocksData const &clockData, recob::Hit const &hit) const
 
std::vector< const sim::IDE * > HitToSimIDEs_Ps (detinfo::DetectorClocksData const &clockData, art::Ptr< recob::Hit > const &hit) const
 
std::vector< double > SimIDEsToXYZ (std::vector< sim::IDE > const &ides) const
 
std::vector< double > SimIDEsToXYZ (std::vector< const sim::IDE * > const &ide_Ps) const
 
std::vector< double > HitToXYZ (detinfo::DetectorClocksData const &clockData, const recob::Hit &hit) const
 
std::vector< double > HitToXYZ (detinfo::DetectorClocksData const &clockData, art::Ptr< recob::Hit > const &hit) const
 
double HitCollectionPurity (detinfo::DetectorClocksData const &clockData, std::set< int > const &trackIds, std::vector< art::Ptr< recob::Hit >> const &hits) const
 
double HitChargeCollectionPurity (detinfo::DetectorClocksData const &clockData, std::set< int > const &trackIds, std::vector< art::Ptr< recob::Hit >> const &hits) const
 
double HitCollectionEfficiency (detinfo::DetectorClocksData const &clockData, std::set< int > const &trackIds, std::vector< art::Ptr< recob::Hit >> const &hits, std::vector< art::Ptr< recob::Hit >> const &allhits, geo::View_t const &view) const
 
double HitChargeCollectionEfficiency (detinfo::DetectorClocksData const &clockData, std::set< int > const &trackIds, std::vector< art::Ptr< recob::Hit >> const &hits, std::vector< art::Ptr< recob::Hit >> const &allhits, geo::View_t const &view) const
 
std::set< int > GetSetOfTrackIds () const
 
std::set< int > GetSetOfEveIds () const
 
std::set< int > GetSetOfTrackIds (detinfo::DetectorClocksData const &clockData, std::vector< art::Ptr< recob::Hit >> const &hits) const
 
std::set< int > GetSetOfEveIds (detinfo::DetectorClocksData const &clockData, std::vector< art::Ptr< recob::Hit >> const &hits) const
 
std::vector< double > SpacePointHitsToWeightedXYZ (detinfo::DetectorClocksData const &clockData, std::vector< art::Ptr< recob::Hit >> const &hits) const
 

Private Attributes

const cheat::ParticleInventoryfPartInv
 
const geo::GeometryCorefGeom
 
const art::InputTag fG4ModuleLabel
 
const art::InputTag fSimChannelModuleLabel
 
const art::InputTag fHitLabel
 
const double fMinHitEnergyFraction
 
const bool fOverrideRealData
 
const double fHitTimeRMS
 
std::vector< art::Ptr< sim::SimChannel > > fSimChannels
 

Detailed Description

Definition at line 39 of file BackTracker.h.

Constructor & Destructor Documentation

cheat::BackTracker::BackTracker ( const fhiclConfig config,
const cheat::ParticleInventory partInv,
const geo::GeometryCore geom 
)

Definition at line 25 of file BackTracker.cc.

28  : fPartInv(partInv)
29  , fGeom(geom)
30  , fG4ModuleLabel(config.G4ModuleLabel())
31  , fSimChannelModuleLabel(config.SimChannelModuleLabel())
32  , fHitLabel(config.DefaultHitModuleLabel())
33  , fMinHitEnergyFraction(config.MinHitEnergyFraction())
34  , fOverrideRealData(config.OverrideRealData())
35  , fHitTimeRMS(config.HitTimeRMS())
36  {}
const art::InputTag fHitLabel
Definition: BackTracker.h:266
const geo::GeometryCore * fGeom
Definition: BackTracker.h:263
const art::InputTag fSimChannelModuleLabel
Definition: BackTracker.h:265
const double fMinHitEnergyFraction
Definition: BackTracker.h:267
static Config * config
Definition: config.cpp:1054
const cheat::ParticleInventory * fPartInv
Definition: BackTracker.h:262
const double fHitTimeRMS
Definition: BackTracker.h:269
const bool fOverrideRealData
Definition: BackTracker.h:268
const art::InputTag fG4ModuleLabel
Definition: BackTracker.h:264
cheat::BackTracker::BackTracker ( const fhicl::ParameterSet pSet,
const cheat::ParticleInventory partInv,
const geo::GeometryCore geom 
)

Definition at line 39 of file BackTracker.cc.

42  : fPartInv(partInv)
43  , fGeom(geom)
44  , fG4ModuleLabel(pSet.get<art::InputTag>("G4ModuleLabel", "largeant"))
45  , fSimChannelModuleLabel(pSet.get<art::InputTag>("SimChannelModuleLabel", fG4ModuleLabel))
46  , // -- D.R. if not provided, default behavior is to use the G4ModuleLabel
47  fHitLabel(pSet.get<art::InputTag>("DefaultHitModuleLabel", "hitfd"))
48  , fMinHitEnergyFraction(pSet.get<double>("MinHitEnergyFraction", 0.010))
49  , fOverrideRealData(pSet.get<bool>("OverrideRealData", false))
50  , fHitTimeRMS(pSet.get<double>("HitTimeRMS", 1.0))
51  {}
const art::InputTag fHitLabel
Definition: BackTracker.h:266
const geo::GeometryCore * fGeom
Definition: BackTracker.h:263
const art::InputTag fSimChannelModuleLabel
Definition: BackTracker.h:265
const double fMinHitEnergyFraction
Definition: BackTracker.h:267
T get(std::string const &key) const
Definition: ParameterSet.h:271
const cheat::ParticleInventory * fPartInv
Definition: BackTracker.h:262
const double fHitTimeRMS
Definition: BackTracker.h:269
const bool fOverrideRealData
Definition: BackTracker.h:268
const art::InputTag fG4ModuleLabel
Definition: BackTracker.h:264
cheat::BackTracker::BackTracker ( BackTracker const &  )
delete

Member Function Documentation

template<typename Evt >
bool cheat::BackTracker::CanRun ( const Evt &  evt)
inline

Definition at line 94 of file BackTracker.h.

95  {
96  return !evt.isRealData() || fOverrideRealData;
97  }
const bool fOverrideRealData
Definition: BackTracker.h:268
TCEvent evt
Definition: DataStructs.cxx:7
std::vector< sim::TrackIDE > cheat::BackTracker::ChannelToTrackIDEs ( detinfo::DetectorClocksData const &  clockData,
raw::ChannelID_t  channel,
const double  hit_start_time,
const double  hit_end_time 
) const

Definition at line 131 of file BackTracker.cc.

135  {
137  if (!schannel) return {};
138 
139  std::vector<sim::TrackIDE> trackIDEs;
140  double totalE = 0.;
141 
142  // loop over the electrons in the channel and grab those that are in time
143  // with the identified hit start and stop times
144  int start_tdc = clockData.TPCTick2TDC(hit_start_time);
145  int end_tdc = clockData.TPCTick2TDC(hit_end_time);
146  if (start_tdc < 0) start_tdc = 0;
147  if (end_tdc < 0) end_tdc = 0;
148  std::vector<sim::IDE> simides = schannel->TrackIDsAndEnergies(start_tdc, end_tdc);
149 
150  // first get the total energy represented by all track ids for
151  // this channel and range of tdc values
152  for (size_t e = 0; e < simides.size(); ++e)
153  totalE += simides[e].energy;
154 
155  // protect against a divide by zero below
156  if (totalE < 1.e-5) totalE = 1.;
157 
158  // loop over the entries in the map and fill the input vectors
159 
160  for (size_t e = 0; e < simides.size(); ++e) {
161 
162  if (simides[e].trackID == sim::NoParticleId) continue;
163 
165  info.trackID = simides[e].trackID;
166  info.energyFrac = simides[e].energy / totalE;
167  info.energy = simides[e].energy;
168  info.numElectrons = simides[e].numElectrons;
169 
170  trackIDEs.push_back(info);
171  }
172 
173  return trackIDEs;
174  }
art::Ptr< sim::SimChannel > FindSimChannelPtr(raw::ChannelID_t channel) const
Returns the cached sim::SimChannel on the specified channel.
Definition: BackTracker.cc:108
float numElectrons
number of electrons from the particle detected on the wires
Definition: SimChannel.h:29
uint8_t channel
Definition: CRTFragment.hh:201
float energy
energy from the particle with this trackID [MeV]
Definition: SimChannel.h:28
const double e
static const int NoParticleId
Definition: sim.h:28
float energyFrac
fraction of hit energy from the particle with this trackID
Definition: SimChannel.h:27
int trackID
Geant4 supplied trackID.
Definition: SimChannel.h:26
std::vector< sim::IDE > TrackIDsAndEnergies(TDC_t startTDC, TDC_t endTDC) const
Return all the recorded energy deposition within a time interval.
Definition: SimChannel.cxx:180
Ionization energy from a Geant4 track.
Definition: SimChannel.h:25
void cheat::BackTracker::ClearEvent ( )

Definition at line 55 of file BackTracker.cc.

56  {
57  fSimChannels.clear();
58  // fAllHitList.clear();
59  }
std::vector< art::Ptr< sim::SimChannel > > fSimChannels
Definition: BackTracker.h:271
art::Ptr< sim::SimChannel > cheat::BackTracker::FindSimChannel ( raw::ChannelID_t  channel) const

Returns the cached sim::SimChannel on the specified channel.

Parameters
channelID of the TPC channel to find
Returns
art pointer to sim::SimChannel
Exceptions
cet::exception(category: "BackTracker") if no sim::SimChannel for the requested channel found
See also
FindSimChannelPtr()

Definition at line 122 of file BackTracker.cc.

123  {
124  if (auto const chan = FindSimChannelPtr(channel)) return chan;
125  throw cet::exception("BackTracker") << "No sim::SimChannel corresponding "
126  << "to channel: " << channel << "\n";
127  }
art::Ptr< sim::SimChannel > FindSimChannelPtr(raw::ChannelID_t channel) const
Returns the cached sim::SimChannel on the specified channel.
Definition: BackTracker.cc:108
uint8_t channel
Definition: CRTFragment.hh:201
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
art::Ptr< sim::SimChannel > cheat::BackTracker::FindSimChannelPtr ( raw::ChannelID_t  channel) const

Returns the cached sim::SimChannel on the specified channel.

Parameters
channelID of the TPC channel to find
Returns
art pointer to sim::SimChannel, or an null pointer if none
See also
FindSimChannel()

Definition at line 108 of file BackTracker.cc.

109  {
110  auto ilb = std::lower_bound(fSimChannels.begin(),
111  fSimChannels.end(),
112  channel,
114  return (a->Channel() < channel);
115  });
116  return ((ilb != fSimChannels.end()) && ((*ilb)->Channel() == channel))
117  ? *ilb: art::Ptr<sim::SimChannel>{};
118  }
std::vector< art::Ptr< sim::SimChannel > > fSimChannels
Definition: BackTracker.h:271
uint8_t channel
Definition: CRTFragment.hh:201
const double a
unsigned int ChannelID_t
Type representing the ID of a readout channel.
Definition: RawTypes.h:28
std::set<int> cheat::BackTracker::GetSetOfEveIds ( ) const
inline

Definition at line 247 of file BackTracker.h.

248  {
249  return fPartInv->GetSetOfEveIds();
250  }
const cheat::ParticleInventory * fPartInv
Definition: BackTracker.h:262
std::set< int > GetSetOfEveIds() const
std::set< int > cheat::BackTracker::GetSetOfEveIds ( detinfo::DetectorClocksData const &  clockData,
std::vector< art::Ptr< recob::Hit >> const &  hits 
) const

Definition at line 551 of file BackTracker.cc.

553  {
554  std::set<int> eveIds;
555  for (const auto& hit : hits) {
556  const std::vector<sim::TrackIDE> ides = this->HitToEveTrackIDEs(clockData, hit);
557  for (const auto& ide : ides) {
558  eveIds.insert(ide.trackID);
559  } // end ides
560  } // End for hits
561  return eveIds;
562  }
std::vector< sim::TrackIDE > HitToEveTrackIDEs(detinfo::DetectorClocksData const &clockData, recob::Hit const &hit) const
Definition: BackTracker.cc:201
Detector simulation of raw signals on wires.
std::set<int> cheat::BackTracker::GetSetOfTrackIds ( ) const
inline

Definition at line 242 of file BackTracker.h.

243  {
244  return fPartInv->GetSetOfTrackIds();
245  }
std::set< int > GetSetOfTrackIds() const
const cheat::ParticleInventory * fPartInv
Definition: BackTracker.h:262
std::set< int > cheat::BackTracker::GetSetOfTrackIds ( detinfo::DetectorClocksData const &  clockData,
std::vector< art::Ptr< recob::Hit >> const &  hits 
) const

Definition at line 533 of file BackTracker.cc.

535  {
536  std::set<int> tids;
537  for (const auto& hit : hits) {
538  const double start = hit->PeakTimeMinusRMS(fHitTimeRMS);
539  const double end = hit->PeakTimePlusRMS(fHitTimeRMS);
540  std::vector<sim::TrackIDE> trackIDEs =
541  this->ChannelToTrackIDEs(clockData, hit->Channel(), start, end);
542  for (const auto& ide : trackIDEs) {
543  tids.insert(ide.trackID);
544  } // End for TrackIDEs
545  } // End for hits
546  return tids;
547  } // End GetSetOfTrackIds
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
const double fHitTimeRMS
Definition: BackTracker.h:269
Detector simulation of raw signals on wires.
std::vector< sim::TrackIDE > ChannelToTrackIDEs(detinfo::DetectorClocksData const &clockData, raw::ChannelID_t channel, const double hit_start_time, const double hit_end_time) const
Definition: BackTracker.cc:131
double cheat::BackTracker::HitChargeCollectionEfficiency ( detinfo::DetectorClocksData const &  clockData,
std::set< int > const &  trackIds,
std::vector< art::Ptr< recob::Hit >> const &  hits,
std::vector< art::Ptr< recob::Hit >> const &  allhits,
geo::View_t const &  view 
) const

Definition at line 497 of file BackTracker.cc.

502  {
503  double desired = 0., total = 0.;
504  for (const auto& hit : hits) {
505  std::vector<sim::TrackIDE> hitTrackIDEs = this->HitToTrackIDEs(clockData, hit);
506  for (const auto& hitIDE : hitTrackIDEs) {
507  if (trackIds.find(hitIDE.trackID) != trackIds.end() &&
508  hitIDE.energyFrac >= fMinHitEnergyFraction) {
509  desired += hit->Integral();
510  break;
511  } // end if hit id matches and energy sufficient.
512  } // End for IDE in HitTrackIDEs.
513  } // End for hit in hits.
514 
515  for (const auto& hit : allHits) {
516  if (hit->View() != view && view != geo::k3D) { continue; }
517  std::vector<sim::TrackIDE> hitTrackIDEs = this->HitToTrackIDEs(clockData, hit);
518  for (const auto& hitIDE : hitTrackIDEs) {
519  if (trackIds.find(hitIDE.trackID) != trackIds.end() &&
520  hitIDE.energyFrac >= fMinHitEnergyFraction) {
521  total += hit->Integral();
522  break;
523  } // end if hit matches
524  } // end for ide in ides
525  } // End for hit in allHits
526 
527  if (total > 0.) { return desired / total; }
528  return 0.;
529  }
const double fMinHitEnergyFraction
Definition: BackTracker.h:267
std::vector< sim::TrackIDE > HitToTrackIDEs(detinfo::DetectorClocksData const &clockData, recob::Hit const &hit) const
Definition: BackTracker.cc:178
3-dimensional objects, potentially hits, clusters, prongs, etc.
Definition: geo_types.h:135
Detector simulation of raw signals on wires.
double cheat::BackTracker::HitChargeCollectionPurity ( detinfo::DetectorClocksData const &  clockData,
std::set< int > const &  trackIds,
std::vector< art::Ptr< recob::Hit >> const &  hits 
) const

Definition at line 437 of file BackTracker.cc.

440  {
441  double totalCharge = 0., desired = 0.;
442  for (const auto& hit : hits) {
443  totalCharge += hit->Integral();
444  std::vector<sim::TrackIDE> trackIDEs = this->HitToTrackIDEs(clockData, hit);
445  for (const auto& trackIDE : trackIDEs) {
446  if (trackIds.find(trackIDE.trackID) != trackIds.end()) {
447  desired += hit->Integral();
448  break;
449  } // End if trackId in trackIds.
450  } // End for trackIDE in trackIDEs
451  } // End for Hit in Hits
452  if (totalCharge > 0.0) { return (desired / totalCharge); }
453  return 0.0;
454  }
std::vector< sim::TrackIDE > HitToTrackIDEs(detinfo::DetectorClocksData const &clockData, recob::Hit const &hit) const
Definition: BackTracker.cc:178
Detector simulation of raw signals on wires.
double cheat::BackTracker::HitCollectionEfficiency ( detinfo::DetectorClocksData const &  clockData,
std::set< int > const &  trackIds,
std::vector< art::Ptr< recob::Hit >> const &  hits,
std::vector< art::Ptr< recob::Hit >> const &  allhits,
geo::View_t const &  view 
) const

Definition at line 458 of file BackTracker.cc.

463  {
464 
465  int desired = 0, total = 0;
466 
467  for (const auto& hit : hits) {
468  std::vector<sim::TrackIDE> hitTrackIDEs = this->HitToTrackIDEs(clockData, hit);
469  for (const auto& trackIDE : hitTrackIDEs) {
470  if (trackIds.find(trackIDE.trackID) != trackIds.end() &&
471  trackIDE.energyFrac >= fMinHitEnergyFraction) {
472  ++desired;
473  break;
474  } // End if trackID in trackIds.
475  } // end for trackIDE in TrackIDEs
476  } // end for hit in hits
477 
478  for (const auto& hit : allHits) {
479  if (hit->View() != view && view != geo::k3D) {
480  continue;
481  } // End if hit.view = view or view = geo::k3D
482  std::vector<sim::TrackIDE> hitTrackIDEs = this->HitToTrackIDEs(clockData, hit);
483  for (const auto& hitIDE : hitTrackIDEs) {
484  if (trackIds.find(hitIDE.trackID) != trackIds.end() &&
485  hitIDE.energyFrac >= fMinHitEnergyFraction) {
486  ++total;
487  break;
488  }
489  } // END for all IDEs in HitTrackIDEs.
490  } // end for hit in allHits.
491  if (total >= 0) { return double(double(desired) / double(total)); }
492  return 0.;
493  }
const double fMinHitEnergyFraction
Definition: BackTracker.h:267
std::vector< sim::TrackIDE > HitToTrackIDEs(detinfo::DetectorClocksData const &clockData, recob::Hit const &hit) const
Definition: BackTracker.cc:178
3-dimensional objects, potentially hits, clusters, prongs, etc.
Definition: geo_types.h:135
Detector simulation of raw signals on wires.
double cheat::BackTracker::HitCollectionPurity ( detinfo::DetectorClocksData const &  clockData,
std::set< int > const &  trackIds,
std::vector< art::Ptr< recob::Hit >> const &  hits 
) const

Definition at line 417 of file BackTracker.cc.

420  {
421  int desired = 0;
422  for (const auto& hit : hits) {
423  std::vector<sim::TrackIDE> hitTrackIDEs = this->HitToTrackIDEs(clockData, hit);
424  for (const auto& tIDE : hitTrackIDEs) {
425  if (trackIds.find(tIDE.trackID) != trackIds.end()) {
426  ++desired;
427  break;
428  } // End if TID Found
429  } // END for trackIDE in TrackIDEs
430  } // End for hit in hits
431  if (hits.size() > 0) { return double(double(desired) / double(hits.size())); }
432  return 0;
433  }
std::vector< sim::TrackIDE > HitToTrackIDEs(detinfo::DetectorClocksData const &clockData, recob::Hit const &hit) const
Definition: BackTracker.cc:178
Detector simulation of raw signals on wires.
std::vector< sim::IDE > cheat::BackTracker::HitToAvgSimIDEs ( detinfo::DetectorClocksData const &  clockData,
recob::Hit const &  hit 
) const

Definition at line 305 of file BackTracker.cc.

307  {
308  // Get services.
309 
310  int start_tdc = clockData.TPCTick2TDC(hit.PeakTimeMinusRMS(fHitTimeRMS));
311  int end_tdc = clockData.TPCTick2TDC(hit.PeakTimePlusRMS(fHitTimeRMS));
312  if (start_tdc < 0) start_tdc = 0;
313  if (end_tdc < 0) end_tdc = 0;
314 
315  return (this->FindSimChannel(hit.Channel()))->TrackIDsAndEnergies(start_tdc, end_tdc);
316  }
art::Ptr< sim::SimChannel > FindSimChannel(raw::ChannelID_t channel) const
Returns the cached sim::SimChannel on the specified channel.
Definition: BackTracker.cc:122
const double fHitTimeRMS
Definition: BackTracker.h:269
Detector simulation of raw signals on wires.
std::vector<sim::IDE> cheat::BackTracker::HitToAvgSimIDEs ( detinfo::DetectorClocksData const &  clockData,
art::Ptr< recob::Hit > const &  hit 
) const
inline

Definition at line 196 of file BackTracker.h.

198  {
199  return this->HitToAvgSimIDEs(clockData, *hit);
200  }
std::vector< sim::IDE > HitToAvgSimIDEs(detinfo::DetectorClocksData const &clockData, recob::Hit const &hit) const
Definition: BackTracker.cc:305
std::vector< sim::TrackIDE > cheat::BackTracker::HitToEveTrackIDEs ( detinfo::DetectorClocksData const &  clockData,
recob::Hit const &  hit 
) const

Definition at line 201 of file BackTracker.cc.

203  {
204  std::vector<sim::TrackIDE> eveIDEs;
205  std::vector<sim::TrackIDE> trackIDEs = this->HitToTrackIDEs(clockData, hit);
206  std::map<int, std::pair<double, double>> eveToEMap;
207  double totalE = 0.0;
208  for (const auto& trackIDE : trackIDEs) {
209  auto check = eveToEMap.emplace(fPartInv->TrackIdToEveTrackId(trackIDE.trackID),
210  std::make_pair(trackIDE.energy, trackIDE.numElectrons));
211  if (check.second == false) {
212  check.first->second.first += trackIDE.energy;
213  check.first->second.second += trackIDE.numElectrons;
214  }
215  // eveToEMap[fPartInv->TrackIdToEveTrackId(trackIDE.trackID)].first
216  // += trackIDE.energy;
217  totalE += trackIDE.energy;
218  } // End for trackIDEs
219  eveIDEs.reserve(eveToEMap.size());
220  for (const auto& eveToE : eveToEMap) {
221  sim::TrackIDE eveTrackIDE_tmp;
222 
223  eveTrackIDE_tmp.trackID = eveToE.first;
224  eveTrackIDE_tmp.energy = eveToE.second.first;
225  eveTrackIDE_tmp.energyFrac = (eveTrackIDE_tmp.energy) / (totalE);
226  eveTrackIDE_tmp.numElectrons = eveToE.second.second;
227 
228  eveIDEs.push_back(eveTrackIDE_tmp);
229  } // END eveToEMap loop
230  return eveIDEs;
231  }
float numElectrons
number of electrons from the particle detected on the wires
Definition: SimChannel.h:29
float energy
energy from the particle with this trackID [MeV]
Definition: SimChannel.h:28
std::vector< sim::TrackIDE > HitToTrackIDEs(detinfo::DetectorClocksData const &clockData, recob::Hit const &hit) const
Definition: BackTracker.cc:178
bool check(const std::vector< std::vector< float > > &outputs)
float energyFrac
fraction of hit energy from the particle with this trackID
Definition: SimChannel.h:27
const cheat::ParticleInventory * fPartInv
Definition: BackTracker.h:262
Detector simulation of raw signals on wires.
int trackID
Geant4 supplied trackID.
Definition: SimChannel.h:26
int TrackIdToEveTrackId(const int &tid) const
Ionization energy from a Geant4 track.
Definition: SimChannel.h:25
std::vector<sim::TrackIDE> cheat::BackTracker::HitToEveTrackIDEs ( detinfo::DetectorClocksData const &  clockData,
art::Ptr< recob::Hit > const &  hit 
) const
inline

Definition at line 175 of file BackTracker.h.

177  {
178  return this->HitToEveTrackIDEs(clockData, *hit);
179  }
std::vector< sim::TrackIDE > HitToEveTrackIDEs(detinfo::DetectorClocksData const &clockData, recob::Hit const &hit) const
Definition: BackTracker.cc:201
std::vector< const sim::IDE * > cheat::BackTracker::HitToSimIDEs_Ps ( detinfo::DetectorClocksData const &  clockData,
recob::Hit const &  hit 
) const

Definition at line 320 of file BackTracker.cc.

322  {
323  std::vector<const sim::IDE*> retVec;
324  int start_tdc = clockData.TPCTick2TDC(hit.PeakTimeMinusRMS(fHitTimeRMS));
325  int end_tdc = clockData.TPCTick2TDC(hit.PeakTimePlusRMS(fHitTimeRMS));
326  if (start_tdc < 0) start_tdc = 0;
327  if (end_tdc < 0) end_tdc = 0;
328 
329  if (start_tdc > end_tdc) { throw; }
330 
331  const std::vector<std::pair<unsigned short, std::vector<sim::IDE>>>& tdcIDEMap =
332  (this->FindSimChannel(hit.Channel()))
333  ->TDCIDEMap(); // This in fact does not return a std::map. It returns a
334  // vector... with no guarantee that it is sorted...
335  std::vector<const std::pair<unsigned short, std::vector<sim::IDE>>*> tdcIDEMap_SortedPointers;
336  for (auto& pair : tdcIDEMap) {
337  tdcIDEMap_SortedPointers.push_back(&pair);
338  }
339 
340  // This is a bunch of extra steps, due to needing a vector we can sort, and
341  // needing those items in the sorted vector to be the items from the sim
342  // channels (so a pointer to the IDEs inside the sim channels can be made).
343  // The work around is to make a vector of pointers to IDEs inside the
344  // TDCIDEMap (which is a constant reference to the fTDCIDEs in the
345  // SimChannel.)
346  auto pairSort = [](auto& a, auto& b) { return a->first < b->first; };
347  if (!std::is_sorted(
348  tdcIDEMap_SortedPointers.begin(), tdcIDEMap_SortedPointers.end(), pairSort)) {
349  std::sort(tdcIDEMap_SortedPointers.begin(), tdcIDEMap_SortedPointers.end(), pairSort);
350  }
351 
352  std::vector<sim::IDE> dummyVec; // I need something to stick in a pair to compare pair<tdcVal,
353  // IDE>. This is an otherwise useless "hack".
354  std::pair<double, std::vector<sim::IDE>> start_tdcPair =
355  std::make_pair(start_tdc, dummyVec); // This pair is a "hack" to make my comparison work
356  // for lower and upper bound.
357  std::pair<double, std::vector<sim::IDE>> end_tdcPair = std::make_pair(end_tdc, dummyVec);
358  auto start_tdcPair_P = &start_tdcPair;
359  auto end_tdcPair_P = &end_tdcPair;
360  auto mapFirst = std::lower_bound(
361  tdcIDEMap_SortedPointers.begin(), tdcIDEMap_SortedPointers.end(), start_tdcPair_P, pairSort);
362 
363  // iterator to just after the last interesting IDE
364  auto mapLast = std::upper_bound(
365  tdcIDEMap_SortedPointers.begin(), tdcIDEMap_SortedPointers.end(), end_tdcPair_P, pairSort);
366  for (auto& mapitr = mapFirst; mapitr != mapLast; ++mapitr) {
367  for (auto& ide : (*mapitr)->second) {
368  retVec.push_back(&ide);
369  } // Add all interesting IDEs to the retVec
370  }
371  return retVec;
372  }
art::Ptr< sim::SimChannel > FindSimChannel(raw::ChannelID_t channel) const
Returns the cached sim::SimChannel on the specified channel.
Definition: BackTracker.cc:122
const double a
const double fHitTimeRMS
Definition: BackTracker.h:269
Detector simulation of raw signals on wires.
static bool * b
Definition: config.cpp:1043
std::vector<const sim::IDE*> cheat::BackTracker::HitToSimIDEs_Ps ( detinfo::DetectorClocksData const &  clockData,
art::Ptr< recob::Hit > const &  hit 
) const
inline

Definition at line 205 of file BackTracker.h.

207  {
208  return this->HitToSimIDEs_Ps(clockData, *hit);
209  }
std::vector< const sim::IDE * > HitToSimIDEs_Ps(detinfo::DetectorClocksData const &clockData, recob::Hit const &hit) const
Definition: BackTracker.cc:320
std::vector< sim::TrackIDE > cheat::BackTracker::HitToTrackIDEs ( detinfo::DetectorClocksData const &  clockData,
recob::Hit const &  hit 
) const

Definition at line 178 of file BackTracker.cc.

180  {
181  const double start = hit.PeakTimeMinusRMS(fHitTimeRMS);
182  const double end = hit.PeakTimePlusRMS(fHitTimeRMS);
183  return this->ChannelToTrackIDEs(clockData, hit.Channel(), start, end);
184  }
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
const double fHitTimeRMS
Definition: BackTracker.h:269
Detector simulation of raw signals on wires.
std::vector< sim::TrackIDE > ChannelToTrackIDEs(detinfo::DetectorClocksData const &clockData, raw::ChannelID_t channel, const double hit_start_time, const double hit_end_time) const
Definition: BackTracker.cc:131
std::vector<sim::TrackIDE> cheat::BackTracker::HitToTrackIDEs ( detinfo::DetectorClocksData const &  clockData,
art::Ptr< recob::Hit > const &  hit 
) const
inline

Definition at line 161 of file BackTracker.h.

163  {
164  return this->HitToTrackIDEs(clockData, *hit);
165  }
std::vector< sim::TrackIDE > HitToTrackIDEs(detinfo::DetectorClocksData const &clockData, recob::Hit const &hit) const
Definition: BackTracker.cc:178
std::vector< int > cheat::BackTracker::HitToTrackIds ( detinfo::DetectorClocksData const &  clockData,
recob::Hit const &  hit 
) const

Definition at line 188 of file BackTracker.cc.

190  {
191  std::vector<int> retVec;
192  for (auto const trackIDE : this->HitToTrackIDEs(clockData, hit)) {
193  retVec.push_back(trackIDE.trackID);
194  }
195  return retVec;
196  }
std::vector< sim::TrackIDE > HitToTrackIDEs(detinfo::DetectorClocksData const &clockData, recob::Hit const &hit) const
Definition: BackTracker.cc:178
Detector simulation of raw signals on wires.
std::vector< double > cheat::BackTracker::HitToXYZ ( detinfo::DetectorClocksData const &  clockData,
const recob::Hit hit 
) const

Definition at line 409 of file BackTracker.cc.

410  {
411  std::vector<const sim::IDE*> ide_Ps = this->HitToSimIDEs_Ps(clockData, hit);
412  return this->SimIDEsToXYZ(ide_Ps);
413  }
std::vector< double > SimIDEsToXYZ(std::vector< sim::IDE > const &ides) const
Definition: BackTracker.cc:376
std::vector< const sim::IDE * > HitToSimIDEs_Ps(detinfo::DetectorClocksData const &clockData, recob::Hit const &hit) const
Definition: BackTracker.cc:320
std::vector<double> cheat::BackTracker::HitToXYZ ( detinfo::DetectorClocksData const &  clockData,
art::Ptr< recob::Hit > const &  hit 
) const
inline

Definition at line 217 of file BackTracker.h.

218  {
219  return this->HitToXYZ(clockData, *hit);
220  }
std::vector< double > HitToXYZ(detinfo::DetectorClocksData const &clockData, const recob::Hit &hit) const
Definition: BackTracker.cc:409
template<typename Evt >
void cheat::BackTracker::PrepEvent ( const Evt &  evt)
template<typename Evt >
void cheat::BackTracker::PrepSimChannels ( const Evt &  evt)
const std::vector<art::Ptr<sim::SimChannel> >& cheat::BackTracker::SimChannels ( ) const
inline

Definition at line 120 of file BackTracker.h.

121  {
122  return fSimChannels;
123  }
std::vector< art::Ptr< sim::SimChannel > > fSimChannels
Definition: BackTracker.h:271
bool cheat::BackTracker::SimChannelsReady ( ) const
inline

Definition at line 114 of file BackTracker.h.

115  {
116  return !fSimChannels.empty();
117  }
std::vector< art::Ptr< sim::SimChannel > > fSimChannels
Definition: BackTracker.h:271
std::vector< double > cheat::BackTracker::SimIDEsToXYZ ( std::vector< sim::IDE > const &  ides) const

Definition at line 376 of file BackTracker.cc.

377  {
378  std::vector<double> xyz(3, 0.0);
379  double w = 0.0;
380  for (auto const& ide : ides) {
381  double weight = ide.numElectrons;
382  w += weight;
383  xyz[0] += (weight * ide.x);
384  xyz[1] += (weight * ide.y);
385  xyz[2] += (weight * ide.z);
386  }
387  if (w < 1.e-5)
388  throw cet::exception("BackTracker") << "No sim::IDEs providing non-zero number of electrons"
389  << " can't determine originating location from truth\n";
390  xyz[0] = xyz[0] / w;
391  xyz[1] = xyz[1] / w;
392  xyz[2] = xyz[2] / w;
393  return xyz;
394  }
weight
Definition: test.py:257
const double e
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
std::vector< double > cheat::BackTracker::SimIDEsToXYZ ( std::vector< const sim::IDE * > const &  ide_Ps) const

Definition at line 398 of file BackTracker.cc.

399  {
400  std::vector<sim::IDE> ides;
401  for (auto ide_P : ide_Ps) {
402  ides.push_back(*ide_P);
403  }
404  return this->SimIDEsToXYZ(ides);
405  }
std::vector< double > SimIDEsToXYZ(std::vector< sim::IDE > const &ides) const
Definition: BackTracker.cc:376
std::vector< double > cheat::BackTracker::SpacePointHitsToWeightedXYZ ( detinfo::DetectorClocksData const &  clockData,
std::vector< art::Ptr< recob::Hit >> const &  hits 
) const

Definition at line 566 of file BackTracker.cc.

568  {
569  std::vector<double> xyz(3, -99999.9);
570  std::vector<std::vector<std::vector<int>>> numHits(fGeom->Ncryostats());
571  std::vector<std::vector<std::vector<double>>> hitWeight(fGeom->Ncryostats());
572  std::vector<std::vector<std::vector<std::vector<double>>>> hitPos(fGeom->Ncryostats());
573  //Do we need to resize everything...
574  for (size_t c = 0; c < numHits.size(); ++c) {
575  numHits[c].resize(fGeom->NTPC(c));
576  hitWeight[c].resize(fGeom->NTPC(c));
577  hitPos[c].resize(fGeom->NTPC(c));
578  for (size_t t = 0; t < numHits[c].size(); ++t) {
579  numHits[c][t].resize(fGeom->Nplanes(t, c));
580  hitWeight[c][t].resize(fGeom->Nplanes(t, c));
581  hitPos[c][t].resize(fGeom->Nplanes(t, c));
582  }
583  }
584 
585  for (art::PtrVector<recob::Hit>::const_iterator ihit = hits.begin(); ihit != hits.end();
586  ++ihit) {
587 
588  const recob::Hit& hit = **ihit;
589 
590  // use the HitToXYZ and Geometry::PositionToTPC
591  // to figure out which drift volume the hit originates from
592  std::vector<double> hitOrigin = this->HitToXYZ(clockData, *ihit);
593  unsigned int cstat = 0;
594  unsigned int tpc = 0;
595  const double worldLoc[3] = {hitOrigin[0], hitOrigin[1], hitOrigin[2]};
596  fGeom->PositionToTPC(worldLoc, tpc, cstat);
597 
598  if (hit.WireID().Cryostat == cstat && hit.WireID().TPC == tpc) {
599  ++numHits[cstat][tpc][hit.WireID().Plane];
600  hitWeight[cstat][tpc][hit.WireID().Plane] = hit.Integral();
601  hitPos[cstat][tpc][hit.WireID().Plane] = hitOrigin;
602  }
603  }
604 
605  // loop over the vectors we made and find the average position for the hits
606  // in the future we might take a weighted average
607  int nhits = 0;
608  xyz[0] = 0.;
609  xyz[1] = 0.;
610  xyz[2] = 0.;
611  for (size_t c = 0; c < numHits.size(); ++c) {
612  for (size_t t = 0; t < numHits[c].size(); ++t) {
613  for (size_t p = 0; p < numHits[c][t].size(); ++p) {
614 
615  if (numHits[c][t][p] == 1) {
616  ++nhits;
617  xyz[0] += hitPos[c][t][p][0];
618  xyz[1] += hitPos[c][t][p][1];
619  xyz[2] += hitPos[c][t][p][2];
620  }
621 
622  } // end loop over planes
623  } // end loop over tpcs
624  } // end loop over cryostats
625 
626  // get the average position
627  if (nhits < 1)
628  throw cet::exception("BackTracker")
629  << "No hits to determine originating location from truth\n";
630 
631  xyz[0] /= nhits;
632  xyz[1] /= nhits;
633  xyz[2] /= nhits;
634 
635  // Done.
636  return xyz;
637  }
const geo::GeometryCore * fGeom
Definition: BackTracker.h:263
geo::WireID WireID() const
Definition: Hit.h:233
CryostatID_t Cryostat
Index of cryostat.
Definition: geo_types.h:212
float Integral() const
Integral under the calibrated signal waveform of the hit, in tick x ADC units.
Definition: Hit.h:224
unsigned int Ncryostats() const
Returns the number of cryostats in the detector.
geo::TPCGeo const & PositionToTPC(geo::Point_t const &point) const
Returns the TPC at specified location.
unsigned int Nplanes(unsigned int tpc=0, unsigned int cstat=0) const
Returns the total number of wire planes in the specified TPC.
typename data_t::const_iterator const_iterator
Definition: PtrVector.h:55
std::vector< double > HitToXYZ(detinfo::DetectorClocksData const &clockData, const recob::Hit &hit) const
Definition: BackTracker.cc:409
p
Definition: test.py:223
PlaneID_t Plane
Index of the plane within its TPC.
Definition: geo_types.h:493
Detector simulation of raw signals on wires.
unsigned int NTPC(unsigned int cstat=0) const
Returns the total number of TPCs in the specified cryostat.
2D representation of charge deposited in the TDC/wire plane
Definition: Hit.h:48
TPCID_t TPC
Index of the TPC within its cryostat.
Definition: geo_types.h:406
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
template<typename Evt >
std::vector<art::Ptr<recob::Hit> > cheat::BackTracker::SpacePointToHits_Ps ( art::Ptr< recob::SpacePoint > const &  spt,
const Evt &  evt 
) const
template<typename Evt >
std::vector<double> cheat::BackTracker::SpacePointToXYZ ( detinfo::DetectorClocksData const &  clockData,
art::Ptr< recob::SpacePoint > const &  spt,
const Evt &  evt 
) const
std::vector< std::vector< art::Ptr< recob::Hit > > > cheat::BackTracker::TrackIdsToHits_Ps ( detinfo::DetectorClocksData const &  clockData,
std::vector< int > const &  tkIds,
std::vector< art::Ptr< recob::Hit >> const &  hitsIn 
) const

Definition at line 262 of file BackTracker.cc.

265  {
266  // returns a subset of the hits in the hitsIn collection that are matched
267  // to MC particles listed in tkIds
268 
269  // temporary vector of TrackIds and Ptrs to hits so only one
270  // loop through the (possibly large) hitsIn collection is needed
271  std::vector<std::pair<int, art::Ptr<recob::Hit>>> hitList;
272  std::vector<sim::TrackIDE> tids;
273  for (auto itr = hitsIn.begin(); itr != hitsIn.end(); ++itr) {
274  tids.clear();
275  art::Ptr<recob::Hit> const& hit = *itr;
276  tids = this->ChannelToTrackIDEs(
277  clockData, hit->Channel(), hit->PeakTimeMinusRMS(fHitTimeRMS), hit->PeakTimePlusRMS(fHitTimeRMS));
278  for (auto itid = tids.begin(); itid != tids.end(); ++itid) {
279  for (auto itkid = tkIds.begin(); itkid != tkIds.end(); ++itkid) {
280  if (itid->trackID == *itkid) {
281  if (itid->energyFrac > fMinHitEnergyFraction)
282  hitList.push_back(std::make_pair(*itkid, hit));
283  }
284  } // itkid
285  } // itid
286  } // itr
287 
288  // now build the truHits vector that will be returned to the caller
289  std::vector<std::vector<art::Ptr<recob::Hit>>> truHits;
290  // temporary vector containing hits assigned to one MC particle
291  std::vector<art::Ptr<recob::Hit>> tmpHits;
292  for (auto itkid = tkIds.begin(); itkid != tkIds.end(); ++itkid) {
293  tmpHits.clear();
294  for (auto itr = hitList.begin(); itr != hitList.end(); ++itr) {
295  if (*itkid == (*itr).first) tmpHits.push_back((*itr).second);
296  }
297  truHits.push_back(tmpHits);
298  }
299  return truHits;
300  }
const double fMinHitEnergyFraction
Definition: BackTracker.h:267
const double fHitTimeRMS
Definition: BackTracker.h:269
float PeakTimeMinusRMS(float sigmas=+1.) const
Definition: Hit.h:239
Detector simulation of raw signals on wires.
std::vector< sim::TrackIDE > ChannelToTrackIDEs(detinfo::DetectorClocksData const &clockData, raw::ChannelID_t channel, const double hit_start_time, const double hit_end_time) const
Definition: BackTracker.cc:131
float PeakTimePlusRMS(float sigmas=+1.) const
Returns a time sigmas RMS away from the peak time.
Definition: Hit.h:236
raw::ChannelID_t Channel() const
ID of the readout channel the hit was extracted from.
Definition: Hit.h:230
std::vector< art::Ptr< recob::Hit > > cheat::BackTracker::TrackIdToHits_Ps ( detinfo::DetectorClocksData const &  clockData,
int  tkId,
std::vector< art::Ptr< recob::Hit >> const &  hitsIn 
) const

Definition at line 235 of file BackTracker.cc.

238  {
239  // returns a subset of the hits in the hitsIn collection that are matched
240  // to the given track
241 
242  // temporary vector of TrackIds and Ptrs to hits so only one
243  // loop through the (possibly large) hitsIn collection is needed
244  std::vector<art::Ptr<recob::Hit>> hitList;
245  std::vector<sim::TrackIDE> trackIDE;
246  for (auto itr = hitsIn.begin(); itr != hitsIn.end(); ++itr) {
247  trackIDE.clear();
248  art::Ptr<recob::Hit> const& hit = *itr;
249  trackIDE = this->ChannelToTrackIDEs(
250  clockData, hit->Channel(), hit->PeakTimeMinusRMS(fHitTimeRMS), hit->PeakTimePlusRMS(fHitTimeRMS));
251  for (auto itr_trakIDE = trackIDE.begin(); itr_trakIDE != trackIDE.end(); ++itr_trakIDE) {
252  if (itr_trakIDE->trackID == tkId && itr_trakIDE->energyFrac > fMinHitEnergyFraction)
253  hitList.push_back(hit);
254  } // itr_trakIDE
255  } // itr
256  return hitList;
257  }
const double fMinHitEnergyFraction
Definition: BackTracker.h:267
const double fHitTimeRMS
Definition: BackTracker.h:269
float PeakTimeMinusRMS(float sigmas=+1.) const
Definition: Hit.h:239
Detector simulation of raw signals on wires.
std::vector< sim::TrackIDE > ChannelToTrackIDEs(detinfo::DetectorClocksData const &clockData, raw::ChannelID_t channel, const double hit_start_time, const double hit_end_time) const
Definition: BackTracker.cc:131
float PeakTimePlusRMS(float sigmas=+1.) const
Returns a time sigmas RMS away from the peak time.
Definition: Hit.h:236
raw::ChannelID_t Channel() const
ID of the readout channel the hit was extracted from.
Definition: Hit.h:230
std::vector< const sim::IDE * > cheat::BackTracker::TrackIdToSimIDEs_Ps ( int const &  id) const

Definition at line 63 of file BackTracker.cc.

64  {
65  std::vector<const sim::IDE*> ideps;
66  for (size_t sc = 0; sc < fSimChannels.size(); ++sc) {
67  const auto& tdcidemap = fSimChannels[sc]->TDCIDEMap(); // This returns a reference.
68  // loop over the IDEMAP
69  for (auto mapitr = tdcidemap.begin(); mapitr != tdcidemap.end(); mapitr++) {
70  // loop over the vector of IDE objects.
71  const std::vector<sim::IDE>& idevec =
72  (*mapitr).second; // note, mapitr.second returns the actual data from
73  // the map, not a copy
74  for (size_t iv = 0; iv < idevec.size(); ++iv) {
75  // const sim::IDE* const idep = &idevec[iv];
76  // if( abs(idevec[iv].trackID) == id) continue;
77  // ideps.push_back(idep);
78  if (abs(idevec[iv].trackID) == id) ideps.push_back(&(idevec[iv]));
79  } // end for index in idevec
80  } // end loop over map from sim::SimChannel
81  } // end loop over sim::SimChannels
82  return ideps;
83  }
std::vector< art::Ptr< sim::SimChannel > > fSimChannels
Definition: BackTracker.h:271
T abs(T value)
std::vector< const sim::IDE * > cheat::BackTracker::TrackIdToSimIDEs_Ps ( int const &  id,
const geo::View_t  view 
) const

Definition at line 87 of file BackTracker.cc.

88  {
89  std::vector<const sim::IDE*> ide_Ps;
90  for (const art::Ptr<sim::SimChannel> sc : fSimChannels) {
91  if (fGeom->View(sc->Channel()) != view) continue;
92 
93  // loop over the IDEMAP
94  for (const auto& item : sc->TDCIDEMap()) {
95 
96  // loop over the vector of IDE objects.
97  for (const sim::IDE& ide : item.second) {
98  if (abs(ide.trackID) == id) ide_Ps.push_back(&ide);
99  }
100  } // end loop over map from sim::SimChannel
101  } // end loop over sim::SimChannels
102 
103  return ide_Ps;
104  }
TrackID_t trackID
Geant4 supplied track ID.
Definition: SimChannel.h:112
const geo::GeometryCore * fGeom
Definition: BackTracker.h:263
std::vector< art::Ptr< sim::SimChannel > > fSimChannels
Definition: BackTracker.h:271
T abs(T value)
Ionization at a point of the TPC sensitive volume.
Definition: SimChannel.h:84
View_t View(geo::PlaneID const &pid) const
Returns the view (wire orientation) on the channels of specified TPC plane.

Member Data Documentation

const art::InputTag cheat::BackTracker::fG4ModuleLabel
private

Definition at line 264 of file BackTracker.h.

const geo::GeometryCore* cheat::BackTracker::fGeom
private

Definition at line 263 of file BackTracker.h.

const art::InputTag cheat::BackTracker::fHitLabel
private

Definition at line 266 of file BackTracker.h.

const double cheat::BackTracker::fHitTimeRMS
private

Definition at line 269 of file BackTracker.h.

const double cheat::BackTracker::fMinHitEnergyFraction
private

Definition at line 267 of file BackTracker.h.

const bool cheat::BackTracker::fOverrideRealData
private

Definition at line 268 of file BackTracker.h.

const cheat::ParticleInventory* cheat::BackTracker::fPartInv
private

Definition at line 262 of file BackTracker.h.

const art::InputTag cheat::BackTracker::fSimChannelModuleLabel
private

Definition at line 265 of file BackTracker.h.

std::vector<art::Ptr<sim::SimChannel> > cheat::BackTracker::fSimChannels
mutableprivate

Definition at line 271 of file BackTracker.h.


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