LArSoft  v07_13_02
Liquid Argon Software toolkit - http://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)
 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 143 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 147 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 165 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 150 of file SimChannel.h.

Type of track ID (the value comes from Geant4)

Definition at line 168 of file SimChannel.h.

Constructor & Destructor Documentation

sim::SimChannel::SimChannel ( )

Definition at line 42 of file SimChannel.cxx.

44  {}
raw::ChannelID_t fChannel
readout channel where electrons are collected
Definition: SimChannel.h:153
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 47 of file SimChannel.cxx.

48  : fChannel(channel)
49  {}
raw::ChannelID_t fChannel
readout channel where electrons are collected
Definition: SimChannel.h:153

Member Function Documentation

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

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 52 of file SimChannel.cxx.

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

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

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

Returns the readout channel this object describes.

Definition at line 332 of file SimChannel.h.

References Dump().

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

332 { return fChannel; }
raw::ChannelID_t fChannel
readout channel where electrons are collected
Definition: SimChannel.h:153
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 132 of file SimChannel.cxx.

References findClosestTDCIDE(), and fTDCIDEs.

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

133  {
134  double charge = 0.;
135 
136  auto itr = findClosestTDCIDE(tdc);
137 
138  // check to see if this tdc value is in the map
139  if(itr != fTDCIDEs.end() &&
140  itr->first == tdc){
141 
142  // loop over the list for this tdc value and add up
143  // the total number of electrons
144  for(auto ide : itr->second){
145  charge += ide.numElectrons;
146  } // end loop over sim::IDE for this tdc
147 
148  } // end if this tdc is represented in the map
149 
150  return charge;
151  }
TDCIDEs_t fTDCIDEs
list of energy deposits for each TDC with signal
Definition: SimChannel.h:154
TDCIDEs_t::iterator findClosestTDCIDE(StoredTDC_t tdc)
Return the iterator to the first TDCIDE not earlier than tdc.
Definition: SimChannel.cxx:339
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 340 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 Channel(), and sim::DumpSimChannels::DumpSimChannel().

341 {
342  out << first_indent << "channel #" << Channel() << " read " << fTDCIDEs.size()
343  << " TDCs:\n";
344  double channel_energy = 0., channel_charge = 0.;
345  for (const auto& TDCinfo: fTDCIDEs) {
346  auto const tdc = TDCinfo.first;
347  out << indent << " TDC #" << tdc
348  << " with " << TDCinfo.second.size() << " IDEs\n";
349  double tdc_energy = 0., tdc_charge = 0.;
350  for (const sim::IDE& ide: TDCinfo.second) {
351  out << indent
352  << " (" << ide.x << ", " << ide.y << ", " << ide.z << ") "
353  << ide.numElectrons << " electrons, " << ide.energy << " MeV (trkID="
354  << ide.trackID << ")\n";
355  tdc_energy += ide.energy;
356  tdc_charge += ide.numElectrons;
357  } // for IDEs
358  out << indent << " => TDC #" << tdc << " CH #" << Channel()
359  << " collected " << tdc_charge << " electrons and " << tdc_energy
360  << " MeV\n";
361  channel_energy += tdc_energy;
362  channel_charge += tdc_charge;
363  } // for TDCs
364  out << indent << " => channel #" << Channel() << " collected "
365  << channel_charge << " electrons and " << channel_energy << " MeV\n";
366 } // sim::SimChannel::Dump<>()
TrackID_t trackID
Geant4 supplied track ID.
Definition: SimChannel.h:115
float z
z position of ionization [cm]
Definition: SimChannel.h:120
float x
x position of ionization [cm]
Definition: SimChannel.h:118
TDCIDEs_t fTDCIDEs
list of energy deposits for each TDC with signal
Definition: SimChannel.h:154
Ionization at a point of the TPC sensitive volume.
Definition: SimChannel.h:87
float energy
energy deposited by ionization by this track ID and time [MeV]
Definition: SimChannel.h:117
std::string indent(std::size_t const i)
float y
y position of ionization [cm]
Definition: SimChannel.h:119
raw::ChannelID_t Channel() const
Returns the readout channel this object describes.
Definition: SimChannel.h:332
float numElectrons
number of electrons at the readout for this track ID and time
Definition: SimChannel.h:116
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 307 of file SimChannel.h.

References art::detail::indent().

308  { Dump(std::forward<Stream>(out), indent, indent); }
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:340
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 154 of file SimChannel.cxx.

References energy, findClosestTDCIDE(), and fTDCIDEs.

155  {
156  double energy = 0.;
157 
158  auto itr = findClosestTDCIDE(tdc);
159 
160  // check to see if this tdc value is in the map
161  if(itr != fTDCIDEs.end() &&
162  itr->first == tdc){
163 
164  // loop over the list for this tdc value and add up
165  // the total number of electrons
166  for(auto ide : itr->second ){
167  energy += ide.energy;
168  } // end loop over sim::IDE for this tdc
169 
170  } // end if this tdc is represented in the map
171 
172  return energy;
173  }
TDCIDEs_t fTDCIDEs
list of energy deposits for each TDC with signal
Definition: SimChannel.h:154
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:339
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 339 of file SimChannel.cxx.

References fTDCIDEs.

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

340  {
341  return std::lower_bound
342  (fTDCIDEs.begin(), fTDCIDEs.end(), tdc, CompareByTDC());
343  }
TDCIDEs_t fTDCIDEs
list of energy deposits for each TDC with signal
Definition: SimChannel.h:154
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 346 of file SimChannel.cxx.

References fTDCIDEs.

347  {
348  return std::lower_bound
349  (fTDCIDEs.begin(), fTDCIDEs.end(), tdc, CompareByTDC());
350  }
TDCIDEs_t fTDCIDEs
list of energy deposits for each TDC with signal
Definition: SimChannel.h:154
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 279 of file SimChannel.cxx.

References Channel(), findClosestTDCIDE(), fTDCIDEs, max, min, and TDCIDEMap().

281  {
282  if( this->Channel() != channel.Channel() )
283  throw std::runtime_error("ERROR SimChannel Merge: Trying to merge different channels!");
284 
285  std::pair<TrackID_t,TrackID_t> range_trackID(std::numeric_limits<int>::max(),
287 
288  for(auto const& itr : channel.TDCIDEMap()){
289 
290  auto tdc = itr.first;
291  auto const& ides = itr.second;
292 
293  // find the entry from this SimChannel corresponding to the tdc from the other
294  auto itrthis = findClosestTDCIDE(tdc);
295 
296  // pick which IDE list we have to fill: new one or existing one
297  std::vector<sim::IDE>* curIDEVec;
298  if(itrthis == fTDCIDEs.end() ||
299  itrthis->first != tdc){
300  fTDCIDEs.emplace_back(tdc, std::vector<sim::IDE>());
301  curIDEVec = &(fTDCIDEs.back().second);
302  }
303  else
304  curIDEVec = &(itrthis->second);
305 
306  for(auto const& ide : ides){
307  curIDEVec->emplace_back(ide, offset);
308  if( ide.trackID+offset < range_trackID.first )
309  range_trackID.first = ide.trackID+offset;
310  if( ide.trackID+offset > range_trackID.second )
311  range_trackID.second = ide.trackID+offset;
312  }//end loop over IDEs
313 
314  }//end loop over TDCIDEMap
315 
316 
317  return range_trackID;
318 
319  }
TDCIDEs_t fTDCIDEs
list of energy deposits for each TDC with signal
Definition: SimChannel.h:154
Int_t max
Definition: plot.C:27
TDCIDEs_t::iterator findClosestTDCIDE(StoredTDC_t tdc)
Return the iterator to the first TDCIDE not earlier than tdc.
Definition: SimChannel.cxx:339
raw::ChannelID_t Channel() const
Returns the readout channel this object describes.
Definition: SimChannel.h:332
Int_t min
Definition: plot.C:26
bool sim::SimChannel::operator< ( const SimChannel other) const
inline

Comparison: sorts by channel ID.

Definition at line 329 of file SimChannel.h.

References Channel().

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

Comparison: true if SimChannels have the same channel ID.

Definition at line 330 of file SimChannel.h.

References Channel().

330 { return fChannel == other.Channel(); }
raw::ChannelID_t fChannel
readout channel where electrons are collected
Definition: SimChannel.h:153
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 331 of file SimChannel.h.

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

331 { return fTDCIDEs; }
TDCIDEs_t fTDCIDEs
list of energy deposits for each TDC with signal
Definition: SimChannel.h:154
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 244 of file SimChannel.cxx.

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

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

246  {
247 
248  std::vector<sim::TrackIDE> trackIDEs;
249 
250  if(startTDC > endTDC ){
251  mf::LogWarning("SimChannel::TrackIDEs") << "requested tdc range is bogus: "
252  << startTDC << " " << endTDC
253  << " return empty vector";
254  return trackIDEs;
255  }
256 
257  double totalE = 0.;
258  std::vector<sim::IDE> const ides = TrackIDsAndEnergies(startTDC, endTDC);
259  for (auto const& ide : ides)
260  totalE += ide.energy;
261 
262  // protect against a divide by zero below
263  if(totalE < 1.e-5) totalE = 1.;
264 
265  // loop over the entries in the map and fill the input vectors
266  for (auto const& ide : ides){
267  if(ide.trackID == sim::NoParticleId) continue;
268  trackIDEs.emplace_back(ide.trackID, ide.energy/totalE, ide.energy, ide.numElectrons);
269  }
270 
271  return trackIDEs;
272  }
static const int NoParticleId
Definition: sim.h:28
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:178
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
Float_t e
Definition: plot.C:34
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 178 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().

180  {
181  // make a map of track ID values to sim::IDE objects
182 
183  if(startTDC > endTDC ){
184  mf::LogWarning("SimChannel") << "requested tdc range is bogus: "
185  << startTDC << " " << endTDC
186  << " return empty vector";
187  return {}; // returns an empty vector
188  }
189 
190  std::map<TrackID_t, sim::IDE> idToIDE;
191 
192  //find the lower bound for this tdc and then iterate from there
193  auto itr = findClosestTDCIDE(startTDC);
194 
195  while(itr != fTDCIDEs.end()){
196 
197  // check the tdc value for the iterator, break the loop if we
198  // are outside the range
199  if(itr->first > endTDC) break;
200 
201  // grab the vector of IDEs for this tdc
202  auto const& idelist = itr->second;
203  // now loop over them and add their content to the map
204  for(auto const& ide : idelist){
205  auto itTrkIDE = idToIDE.find(ide.trackID);
206  if( itTrkIDE != idToIDE.end() ){
207  // the IDE we are going to update:
208  sim::IDE& trackIDE = itTrkIDE->second;
209 
210  double const nel1 = trackIDE.numElectrons;
211  double const nel2 = ide.numElectrons;
212  double const en1 = trackIDE.energy;
213  double const en2 = ide.energy;
214  double const energy = en1 + en2;
215  double const weight = nel1 + nel2;
216 
217  // make a weighted average for the location information
218  trackIDE.x = (ide.x*nel2 + trackIDE.x*nel1)/weight;
219  trackIDE.y = (ide.y*nel2 + trackIDE.y*nel1)/weight;
220  trackIDE.z = (ide.z*nel2 + trackIDE.z*nel1)/weight;
221  trackIDE.numElectrons = weight;
222  trackIDE.energy = energy;
223  } // end if the track id for this one is found
224  else{
225  idToIDE[ide.trackID] = sim::IDE(ide);
226  }
227  } // end loop over vector
228 
229  ++itr;
230  } // end loop over tdc values
231 
232  // now fill the vector with the ides from the map
233  std::vector<sim::IDE> ides;
234  ides.reserve(idToIDE.size());
235  for(auto const& itr : idToIDE){
236  ides.push_back(itr.second);
237  }
238 
239  return ides;
240  }
float z
z position of ionization [cm]
Definition: SimChannel.h:120
float x
x position of ionization [cm]
Definition: SimChannel.h:118
TDCIDEs_t fTDCIDEs
list of energy deposits for each TDC with signal
Definition: SimChannel.h:154
Ionization at a point of the TPC sensitive volume.
Definition: SimChannel.h:87
float energy
energy deposited by ionization by this track ID and time [MeV]
Definition: SimChannel.h:117
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:339
float y
y position of ionization [cm]
Definition: SimChannel.h:119
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:116

Member Data Documentation

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

readout channel where electrons are collected

Definition at line 153 of file SimChannel.h.

TDCIDEs_t sim::SimChannel::fTDCIDEs
private

list of energy deposits for each TDC with signal

Definition at line 154 of file SimChannel.h.

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


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