LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
sim::SimChannel Class Reference

Energy deposited on a readout channel by simulated tracks. More...

#include "SimChannel.h"

Classes

struct  CompareByTDC
 

Public Types

typedef TDCIDE::first_type StoredTDC_t
 Type for TDC tick used in the internal representation. More...
 
typedef std::vector< TDCIDETDCIDEs_t
 Type of list of energy deposits for each TDC with signal. More...
 
typedef unsigned int TDC_t
 
typedef IDE::TrackID_t TrackID_t
 Type of track ID (the value comes from Geant4) More...
 

Public Member Functions

 SimChannel ()
 
 SimChannel (raw::ChannelID_t channel)
 Constructor: immediately sets the channel number. More...
 
void AddIonizationElectrons (TrackID_t trackID, TDC_t tdc, double numberElectrons, double const *xyz, double energy, TrackID_t origTrackID=util::kBogusI)
 Add ionization electrons and energy to this channel. More...
 
raw::ChannelID_t Channel () const
 Returns the readout channel this object describes. More...
 
std::vector< sim::IDETrackIDsAndEnergies (TDC_t startTDC, TDC_t endTDC) const
 Return all the recorded energy deposition within a time interval. More...
 
TDCIDEs_t const & TDCIDEMap () const
 Returns all the deposited energy information as stored. More...
 
double Charge (TDC_t tdc) const
 Returns the total number of ionization electrons on this channel in the specified TDC. More...
 
double Energy (TDC_t tdc) const
 Returns the total energy on this channel in the specified TDC [MeV]. More...
 
std::vector< sim::TrackIDETrackIDEs (TDC_t startTDC, TDC_t endTDC) const
 Returns energies collected for each track within a time interval. More...
 
bool operator< (const SimChannel &other) const
 Comparison: sorts by channel ID. More...
 
bool operator== (const SimChannel &other) const
 Comparison: true if SimChannels have the same channel ID. More...
 
std::pair< TrackID_t, TrackID_tMergeSimChannel (const SimChannel &channel, int offset)
 Merges the deposits from another channel into this one. More...
 
template<typename Stream >
void Dump (Stream &&out, std::string indent, std::string first_indent) const
 Dumps the full content of the SimChannel into a stream. More...
 
template<typename Stream >
void Dump (Stream &&out, std::string indent="") const
 Documentation at Dump(Stream&&, std::string, std::string) const. More...
 

Private Member Functions

TDCIDEs_t::iterator findClosestTDCIDE (StoredTDC_t tdc)
 Return the iterator to the first TDCIDE not earlier than tdc. More...
 
TDCIDEs_t::const_iterator findClosestTDCIDE (StoredTDC_t tdc) const
 Return the (constant) iterator to the first TDCIDE not earlier than tdc. More...
 

Private Attributes

raw::ChannelID_t fChannel
 readout channel where electrons are collected More...
 
TDCIDEs_t fTDCIDEs
 list of energy deposits for each TDC with signal More...
 

Detailed Description

Energy deposited on a readout channel by simulated tracks.

This class stores the list of all energies deposited on a readout channel. The number of electrons is stored as well.

The information is organized by time: it is divided by TDC ticks, and each TDC tick where some energy was deposited appears in a separate entry, while the quiet TDC ticks are omitted. For each TDC, the information is stored as a list of energy deposits; each deposit comes from a single Geant4 track and stores the location where the ionization happened according to the simulation (see sim::IDE class).

Note that there can be multiple energy deposit records (that is sim::IDE) for a single track in a single TDC tick.

Definition at line 136 of file SimChannel.h.

Member Typedef Documentation

typedef TDCIDE::first_type sim::SimChannel::StoredTDC_t

Type for TDC tick used in the internal representation.

Definition at line 139 of file SimChannel.h.

typedef unsigned int sim::SimChannel::TDC_t

Type for TDC tick used in the interface (different type than raw::TDCtick_t! and from internal representation! but same meaning!)

Definition at line 155 of file SimChannel.h.

typedef std::vector<TDCIDE> sim::SimChannel::TDCIDEs_t

Type of list of energy deposits for each TDC with signal.

Definition at line 142 of file SimChannel.h.

Type of track ID (the value comes from Geant4)

Definition at line 158 of file SimChannel.h.

Constructor & Destructor Documentation

sim::SimChannel::SimChannel ( )

Definition at line 43 of file SimChannel.cxx.

raw::ChannelID_t fChannel
readout channel where electrons are collected
Definition: SimChannel.h:145
constexpr ChannelID_t InvalidChannelID
ID of an invalid channel.
Definition: RawTypes.h:31
sim::SimChannel::SimChannel ( raw::ChannelID_t  channel)
explicit

Constructor: immediately sets the channel number.

Definition at line 46 of file SimChannel.cxx.

46 : fChannel(channel) {}
raw::ChannelID_t fChannel
readout channel where electrons are collected
Definition: SimChannel.h:145

Member Function Documentation

void sim::SimChannel::AddIonizationElectrons ( TrackID_t  trackID,
TDC_t  tdc,
double  numberElectrons,
double const *  xyz,
double  energy,
TrackID_t  origTrackID = util::kBogusI 
)

Add ionization electrons and energy to this channel.

Parameters
trackIDID of simulated track depositing this energy (from Geant4)
tdcTDC tick when this deposit was collected
numberElectronselectrons created at this point by this track
xyzcoordinates of original location of ionization (3D array) [cm]
energyenergy deposited at this point by this track [MeV]

The number of electrons can be fractional because of simulated efficiency and physics effects.

Definition at line 49 of file SimChannel.cxx.

References energy, findClosestTDCIDE(), fTDCIDEs, MF_LOG_ERROR, and weight.

Referenced by larg4::LArVoxelReadout::DriftIonizationElectrons(), and detsim::SimDriftElectrons::produce().

55  {
56  // look at the collection to see if the current TDC already
57  // exists, if not, add it, if so, just add a new track id to the
58  // vector, or update the information if track is already present
59 
60  // no electrons? no energy? no good!
61  if ((numberElectrons < std::numeric_limits<double>::epsilon()) ||
62  (energy <= std::numeric_limits<double>::epsilon())) {
63  // will throw
64  MF_LOG_ERROR("SimChannel") << "AddIonizationElectrons() trying to add to TDC #" << tdc << " "
65  << numberElectrons << " electrons with " << energy
66  << " MeV of energy from track ID=" << trackID;
67  return;
68  } // if no energy or no electrons
69 
70  auto itr = findClosestTDCIDE(tdc);
71 
72  // check if this tdc value is in the vector, it is possible that
73  // the lower bound is different from the given tdc, in which case
74  // we need to add something for that tdc
75  if (itr == fTDCIDEs.end() || itr->first != tdc) {
76  std::vector<sim::IDE> idelist;
77  idelist.emplace_back(trackID, numberElectrons, energy, xyz[0], xyz[1], xyz[2], origTrackID);
78  fTDCIDEs.emplace(itr, tdc, std::move(idelist));
79  }
80  else { // we have that TDC already; itr points to it
81 
82  // loop over the IDE vector for this tdc and add the electrons
83  // to the entry with the same G4 track id
84  for (auto& ide : itr->second) {
85 
86  if (ide.origTrackID != origTrackID) continue;
87 
88  // make a weighted average for the location information
89  double weight = ide.numElectrons + numberElectrons;
90  ide.x = (ide.x * ide.numElectrons + xyz[0] * numberElectrons) / weight;
91  ide.y = (ide.y * ide.numElectrons + xyz[1] * numberElectrons) / weight;
92  ide.z = (ide.z * ide.numElectrons + xyz[2] * numberElectrons) / weight;
93  ide.numElectrons = weight;
94  ide.energy = ide.energy + energy;
95 
96  // found the track id we wanted, so return;
97  return;
98  } // for
99 
100  // if we never found the track id, then this is the first instance of
101  // the track id for this tdc, so add ide to the vector
102  itr->second.emplace_back(
103  trackID, numberElectrons, energy, xyz[0], xyz[1], xyz[2], origTrackID);
104 
105  } // if new TDC ... else
106 
107  } // SimChannel::AddIonizationElectrons()
#define MF_LOG_ERROR(category)
TDCIDEs_t fTDCIDEs
list of energy deposits for each TDC with signal
Definition: SimChannel.h:146
double energy
Definition: plottest35.C:25
TDCIDEs_t::iterator findClosestTDCIDE(StoredTDC_t tdc)
Return the iterator to the first TDCIDE not earlier than tdc.
Definition: SimChannel.cxx:299
double weight
Definition: plottest35.C:25
raw::ChannelID_t sim::SimChannel::Channel ( ) const
inline

Returns the readout channel this object describes.

Definition at line 323 of file SimChannel.h.

Referenced by lar_pandora::LArPandoraHelper::BuildMCParticleHitMaps(), hit::HitCheater::FindHitsOnChannel(), MergeSimChannel(), operator<(), operator==(), hit::MCHitFinder::produce(), larg4::LArG4::produce(), and shower::TCShowerTemplateMaker::showerProfileTrue().

324 {
325  return fChannel;
326 }
raw::ChannelID_t fChannel
readout channel where electrons are collected
Definition: SimChannel.h:145
double sim::SimChannel::Charge ( TDC_t  tdc) const

Returns the total number of ionization electrons on this channel in the specified TDC.

Definition at line 110 of file SimChannel.cxx.

References findClosestTDCIDE(), and fTDCIDEs.

Referenced by detsim::SimWire::produce().

111  {
112  double charge = 0.;
113 
114  auto itr = findClosestTDCIDE(tdc);
115 
116  // check to see if this tdc value is in the map
117  if (itr != fTDCIDEs.end() && itr->first == tdc) {
118 
119  // loop over the list for this tdc value and add up
120  // the total number of electrons
121  for (auto ide : itr->second) {
122  charge += ide.numElectrons;
123  } // end loop over sim::IDE for this tdc
124 
125  } // end if this tdc is represented in the map
126 
127  return charge;
128  }
TDCIDEs_t fTDCIDEs
list of energy deposits for each TDC with signal
Definition: SimChannel.h:146
TDCIDEs_t::iterator findClosestTDCIDE(StoredTDC_t tdc)
Return the iterator to the first TDCIDE not earlier than tdc.
Definition: SimChannel.cxx:299
template<class Stream >
void sim::SimChannel::Dump ( Stream &&  out,
std::string  indent,
std::string  first_indent 
) const

Dumps the full content of the SimChannel into a stream.

Template Parameters
Streaman ostream-like stream object
Parameters
outthe stream to send the information into
indentindentation of the lines (default: none)
first_indentindentation for the first line (default: as indent)

Definition at line 332 of file SimChannel.h.

References sim::IDE::energy, sim::IDE::numElectrons, sim::IDE::trackID, sim::IDE::x, sim::IDE::y, and sim::IDE::z.

Referenced by sim::DumpSimChannels::DumpSimChannel().

333 {
334  out << first_indent << "channel #" << Channel() << " read " << fTDCIDEs.size() << " TDCs:\n";
335  double channel_energy = 0., channel_charge = 0.;
336  for (const auto& TDCinfo : fTDCIDEs) {
337  auto const tdc = TDCinfo.first;
338  out << indent << " TDC #" << tdc << " with " << TDCinfo.second.size() << " IDEs\n";
339  double tdc_energy = 0., tdc_charge = 0.;
340  for (const sim::IDE& ide : TDCinfo.second) {
341  out << indent << " (" << ide.x << ", " << ide.y << ", " << ide.z << ") "
342  << ide.numElectrons << " electrons, " << ide.energy << " MeV (trkID=" << ide.trackID
343  << ")\n";
344  tdc_energy += ide.energy;
345  tdc_charge += ide.numElectrons;
346  } // for IDEs
347  out << indent << " => TDC #" << tdc << " CH #" << Channel() << " collected " << tdc_charge
348  << " electrons and " << tdc_energy << " MeV\n";
349  channel_energy += tdc_energy;
350  channel_charge += tdc_charge;
351  } // for TDCs
352  out << indent << " => channel #" << Channel() << " collected " << channel_charge
353  << " electrons and " << channel_energy << " MeV\n";
354 } // sim::SimChannel::Dump<>()
TrackID_t trackID
Geant4 supplied track ID.
Definition: SimChannel.h:107
float z
z position of ionization [cm]
Definition: SimChannel.h:112
float x
x position of ionization [cm]
Definition: SimChannel.h:110
TDCIDEs_t fTDCIDEs
list of energy deposits for each TDC with signal
Definition: SimChannel.h:146
Ionization at a point of the TPC sensitive volume.
Definition: SimChannel.h:85
float energy
energy deposited by ionization by this track ID and time [MeV]
Definition: SimChannel.h:109
std::string indent(std::size_t const i)
float y
y position of ionization [cm]
Definition: SimChannel.h:111
raw::ChannelID_t Channel() const
Returns the readout channel this object describes.
Definition: SimChannel.h:323
float numElectrons
number of electrons at the readout for this track ID and time
Definition: SimChannel.h:108
template<typename Stream >
void sim::SimChannel::Dump ( Stream &&  out,
std::string  indent = "" 
) const
inline

Documentation at Dump(Stream&&, std::string, std::string) const.

Definition at line 292 of file SimChannel.h.

References art::detail::indent().

293  {
294  Dump(std::forward<Stream>(out), indent, indent);
295  }
void Dump(Stream &&out, std::string indent, std::string first_indent) const
Dumps the full content of the SimChannel into a stream.
Definition: SimChannel.h:332
std::string indent(std::size_t const i)
double sim::SimChannel::Energy ( TDC_t  tdc) const

Returns the total energy on this channel in the specified TDC [MeV].

Definition at line 131 of file SimChannel.cxx.

References energy, findClosestTDCIDE(), and fTDCIDEs.

132  {
133  double energy = 0.;
134 
135  auto itr = findClosestTDCIDE(tdc);
136 
137  // check to see if this tdc value is in the map
138  if (itr != fTDCIDEs.end() && itr->first == tdc) {
139 
140  // loop over the list for this tdc value and add up
141  // the total number of electrons
142  for (auto ide : itr->second) {
143  energy += ide.energy;
144  } // end loop over sim::IDE for this tdc
145 
146  } // end if this tdc is represented in the map
147 
148  return energy;
149  }
TDCIDEs_t fTDCIDEs
list of energy deposits for each TDC with signal
Definition: SimChannel.h:146
double energy
Definition: plottest35.C:25
TDCIDEs_t::iterator findClosestTDCIDE(StoredTDC_t tdc)
Return the iterator to the first TDCIDE not earlier than tdc.
Definition: SimChannel.cxx:299
SimChannel::TDCIDEs_t::iterator sim::SimChannel::findClosestTDCIDE ( StoredTDC_t  tdc)
private

Return the iterator to the first TDCIDE not earlier than tdc.

Definition at line 299 of file SimChannel.cxx.

References fTDCIDEs.

Referenced by AddIonizationElectrons(), Charge(), Energy(), MergeSimChannel(), and TrackIDsAndEnergies().

300  {
301  return std::lower_bound(fTDCIDEs.begin(), fTDCIDEs.end(), tdc, CompareByTDC());
302  }
TDCIDEs_t fTDCIDEs
list of energy deposits for each TDC with signal
Definition: SimChannel.h:146
SimChannel::TDCIDEs_t::const_iterator sim::SimChannel::findClosestTDCIDE ( StoredTDC_t  tdc) const
private

Return the (constant) iterator to the first TDCIDE not earlier than tdc.

Definition at line 304 of file SimChannel.cxx.

References fTDCIDEs.

305  {
306  return std::lower_bound(fTDCIDEs.begin(), fTDCIDEs.end(), tdc, CompareByTDC());
307  }
TDCIDEs_t fTDCIDEs
list of energy deposits for each TDC with signal
Definition: SimChannel.h:146
std::pair< SimChannel::TrackID_t, SimChannel::TrackID_t > sim::SimChannel::MergeSimChannel ( const SimChannel channel,
int  offset 
)

Merges the deposits from another channel into this one.

Parameters
channelthe sim::SimChannel holding information to be merged
offsettrack ID offset for the merge
Returns
range of the IDs of the added tracks

The information from the specified simulated channel is added to the current one. This is achieved by appending the energy deposit information (sim::IDE) at each TDC tick from the merged channel to the list of existing energy deposits for that TDC tick.

In addition, the track IDs of the merged channel are added an offset, so that they can be distinguished from the existing ones. This is useful when simulating tracks with multiple Geant4 runs. Geant4 will reuse track IDs on each run, and using the highest number of track ID from one run as the offset for the next avoids track ID collisions. Note however that this function does not perform any collision check, and it is caller's duty to ensure that the offset is properly large. The return value is a pair including the lowest and the largest track IDs added to this channel, equivalent to the lowest and the highest track IDs present in the merged channel, both augmented by the applied offset.

The channel number of the merged channel is ignored.

Definition at line 249 of file SimChannel.cxx.

References util::abs(), Channel(), findClosestTDCIDE(), fTDCIDEs, and TDCIDEMap().

252  {
253  if (this->Channel() != channel.Channel())
254  throw std::runtime_error("ERROR SimChannel Merge: Trying to merge different channels!");
255 
256  std::pair<TrackID_t, TrackID_t> range_trackID(std::numeric_limits<int>::max(),
257  std::numeric_limits<int>::min());
258 
259  for (auto const& itr : channel.TDCIDEMap()) {
260 
261  auto tdc = itr.first;
262  auto const& ides = itr.second;
263 
264  // find the entry from this SimChannel corresponding to the tdc from the other
265  auto itrthis = findClosestTDCIDE(tdc);
266 
267  // pick which IDE list we have to fill: new one or existing one
268  std::vector<sim::IDE>* curIDEVec;
269  if (itrthis == fTDCIDEs.end() || itrthis->first != tdc) {
270  fTDCIDEs.emplace_back(tdc, std::vector<sim::IDE>());
271  curIDEVec = &(fTDCIDEs.back().second);
272  }
273  else
274  curIDEVec = &(itrthis->second);
275 
276  for (auto const& ide : ides) {
277  curIDEVec->emplace_back(ide, offset);
278  auto tid = std::abs(ide.trackID) + offset;
279  if (tid < range_trackID.first) range_trackID.first = tid;
280  if (tid > range_trackID.second) range_trackID.second = tid;
281  } //end loop over IDEs
282 
283  } //end loop over TDCIDEMap
284 
285  return range_trackID;
286  }
constexpr auto abs(T v)
Returns the absolute value of the argument.
TDCIDEs_t fTDCIDEs
list of energy deposits for each TDC with signal
Definition: SimChannel.h:146
TDCIDEs_t::iterator findClosestTDCIDE(StoredTDC_t tdc)
Return the iterator to the first TDCIDE not earlier than tdc.
Definition: SimChannel.cxx:299
raw::ChannelID_t Channel() const
Returns the readout channel this object describes.
Definition: SimChannel.h:323
bool sim::SimChannel::operator< ( const SimChannel other) const
inline

Comparison: sorts by channel ID.

Definition at line 311 of file SimChannel.h.

References Channel().

312 {
313  return fChannel < other.Channel();
314 }
raw::ChannelID_t fChannel
readout channel where electrons are collected
Definition: SimChannel.h:145
bool sim::SimChannel::operator== ( const SimChannel other) const
inline

Comparison: true if SimChannels have the same channel ID.

Definition at line 315 of file SimChannel.h.

References Channel().

316 {
317  return fChannel == other.Channel();
318 }
raw::ChannelID_t fChannel
readout channel where electrons are collected
Definition: SimChannel.h:145
sim::SimChannel::TDCIDEs_t const & sim::SimChannel::TDCIDEMap ( ) const
inline

Returns all the deposited energy information as stored.

Returns
all the deposited energy information as stored in the object

The returned list is organized in pairs. Each pair contains all ionization information in a single TDC tick (collection of sim::IDE), and the number of that tick. The information is sorted by increasing TDC tick.

See the class description for the details of the ionization information content.

Definition at line 319 of file SimChannel.h.

Referenced by hit::HitCheater::FindHitsOnChannel(), MergeSimChannel(), hit::MCHitFinder::produce(), larg4::LArG4::produce(), and shower::TCShowerTemplateMaker::showerProfileTrue().

320 {
321  return fTDCIDEs;
322 }
TDCIDEs_t fTDCIDEs
list of energy deposits for each TDC with signal
Definition: SimChannel.h:146
std::vector< sim::TrackIDE > sim::SimChannel::TrackIDEs ( TDC_t  startTDC,
TDC_t  endTDC 
) const

Returns energies collected for each track within a time interval.

Parameters
startTDCTDC tick opening the time window
endTDCTDC tick closing the time window (included in the interval)
Returns
a collection of energy and fraction from each track in interval
See also
TrackIDsAndEnergies()

This method returns the energy deposited on this channel by each track ID active in the specified TDC time interval.

Each entry pertains a single track ID. For each entry, all energy deposit information is merged into a single record. It includes:

  • energy of the track, as the integral in the time interval [MeV]
  • energy fraction respect to the total (see below)
  • the ID of the track depositing this energy

The energy fraction is the energy deposited by the track on this channel in the specified time interval, divided by the total of the energy deposited by all tracks on this channel in that same time interval.

Entries are sorted by track ID number.

Definition at line 217 of file SimChannel.cxx.

References e, sim::NoParticleId, and TrackIDsAndEnergies().

Referenced by lar_pandora::LArPandoraHelper::BuildMCParticleHitMaps().

218  {
219 
220  std::vector<sim::TrackIDE> trackIDEs;
221 
222  if (startTDC > endTDC) {
223  mf::LogWarning("SimChannel::TrackIDEs")
224  << "requested tdc range is bogus: " << startTDC << " " << endTDC << " return empty vector";
225  return trackIDEs;
226  }
227 
228  double totalE = 0.;
229  std::vector<sim::IDE> const ides = TrackIDsAndEnergies(startTDC, endTDC);
230  for (auto const& ide : ides)
231  totalE += ide.energy;
232 
233  // protect against a divide by zero below
234  if (totalE < 1.e-5) totalE = 1.;
235 
236  // loop over the entries in the map and fill the input vectors
237  for (auto const& ide : ides) {
238  if (ide.trackID == sim::NoParticleId) continue;
239  trackIDEs.emplace_back(
240  ide.trackID, ide.energy / totalE, ide.energy, ide.numElectrons, ide.origTrackID);
241  }
242 
243  return trackIDEs;
244  }
static const int NoParticleId
Definition: sim.h:21
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:153
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
Float_t e
Definition: plot.C:35
std::vector< sim::IDE > sim::SimChannel::TrackIDsAndEnergies ( TDC_t  startTDC,
TDC_t  endTDC 
) const

Return all the recorded energy deposition within a time interval.

Parameters
startTDCTDC tick opening the time window
endTDCTDC tick closing the time window (included in the interval)
Returns
a collection of energy deposit information from all tracks

This method returns the energy deposited on this channel by each track ID active in the specified TDC time interval.

Each entry pertains a single track ID. For each entry, all energy deposit information is merged into a single record. It includes:

  • energy and number of electrons, as the integral in the time interval
  • position, as average weighted by the number of electrons
  • the ID of the track depositing this energy

Entries are sorted by track ID number.

Definition at line 153 of file SimChannel.cxx.

References energy, sim::IDE::energy, findClosestTDCIDE(), fTDCIDEs, sim::IDE::numElectrons, weight, sim::IDE::x, sim::IDE::y, and sim::IDE::z.

Referenced by cheat::BackTracker::ChannelToTrackIDEs(), and TrackIDEs().

154  {
155  // make a map of track ID values to sim::IDE objects
156 
157  if (startTDC > endTDC) {
158  mf::LogWarning("SimChannel")
159  << "requested tdc range is bogus: " << startTDC << " " << endTDC << " return empty vector";
160  return {}; // returns an empty vector
161  }
162 
163  std::map<TrackID_t, sim::IDE> idToIDE;
164 
165  //find the lower bound for this tdc and then iterate from there
166  auto itr = findClosestTDCIDE(startTDC);
167 
168  while (itr != fTDCIDEs.end()) {
169 
170  // check the tdc value for the iterator, break the loop if we
171  // are outside the range
172  if (itr->first > endTDC) break;
173 
174  // grab the vector of IDEs for this tdc
175  auto const& idelist = itr->second;
176  // now loop over them and add their content to the map
177  for (auto const& ide : idelist) {
178  auto itTrkIDE = idToIDE.find(ide.trackID);
179  if (itTrkIDE != idToIDE.end()) {
180  // the IDE we are going to update:
181  sim::IDE& trackIDE = itTrkIDE->second;
182 
183  double const nel1 = trackIDE.numElectrons;
184  double const nel2 = ide.numElectrons;
185  double const en1 = trackIDE.energy;
186  double const en2 = ide.energy;
187  double const energy = en1 + en2;
188  double const weight = nel1 + nel2;
189 
190  // make a weighted average for the location information
191  trackIDE.x = (ide.x * nel2 + trackIDE.x * nel1) / weight;
192  trackIDE.y = (ide.y * nel2 + trackIDE.y * nel1) / weight;
193  trackIDE.z = (ide.z * nel2 + trackIDE.z * nel1) / weight;
194  trackIDE.numElectrons = weight;
195  trackIDE.energy = energy;
196  } // end if the track id for this one is found
197  else {
198  idToIDE[ide.trackID] = sim::IDE(ide);
199  }
200  } // end loop over vector
201 
202  ++itr;
203  } // end loop over tdc values
204 
205  // now fill the vector with the ides from the map
206  std::vector<sim::IDE> ides;
207  ides.reserve(idToIDE.size());
208  for (auto const& itr : idToIDE) {
209  ides.push_back(itr.second);
210  }
211 
212  return ides;
213  }
float z
z position of ionization [cm]
Definition: SimChannel.h:112
float x
x position of ionization [cm]
Definition: SimChannel.h:110
TDCIDEs_t fTDCIDEs
list of energy deposits for each TDC with signal
Definition: SimChannel.h:146
Ionization at a point of the TPC sensitive volume.
Definition: SimChannel.h:85
float energy
energy deposited by ionization by this track ID and time [MeV]
Definition: SimChannel.h:109
double energy
Definition: plottest35.C:25
TDCIDEs_t::iterator findClosestTDCIDE(StoredTDC_t tdc)
Return the iterator to the first TDCIDE not earlier than tdc.
Definition: SimChannel.cxx:299
float y
y position of ionization [cm]
Definition: SimChannel.h:111
double weight
Definition: plottest35.C:25
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
float numElectrons
number of electrons at the readout for this track ID and time
Definition: SimChannel.h:108

Member Data Documentation

raw::ChannelID_t sim::SimChannel::fChannel
private

readout channel where electrons are collected

Definition at line 145 of file SimChannel.h.

TDCIDEs_t sim::SimChannel::fTDCIDEs
private

list of energy deposits for each TDC with signal

Definition at line 146 of file SimChannel.h.

Referenced by AddIonizationElectrons(), Charge(), Energy(), findClosestTDCIDE(), MergeSimChannel(), and TrackIDsAndEnergies().


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