LArSoft  v06_74_01
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
 Dumps the full content of the SimChannel into a stream. 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 41 of file SimChannel.cxx.

43  {}
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 46 of file SimChannel.cxx.

47  : fChannel(channel)
48  {}
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 51 of file SimChannel.cxx.

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

Referenced by larg4::LArVoxelReadout::DriftIonizationElectrons().

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

Returns the readout channel this object describes.

Definition at line 333 of file SimChannel.h.

References Dump().

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

333 { 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 131 of file SimChannel.cxx.

References findClosestTDCIDE(), and fTDCIDEs.

Referenced by detsim::SimWire::produce(), and detsim::SimWireT962::produce().

132  {
133  double charge = 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() &&
139  itr->first == tdc){
140 
141  // loop over the list for this tdc value and add up
142  // the total number of electrons
143  for(auto ide : itr->second){
144  charge += ide.numElectrons;
145  } // end loop over sim::IDE for this tdc
146 
147  } // end if this tdc is represented in the map
148 
149  return charge;
150  }
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:338
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)
indent_firstindentation for the first line (default: as indent)

Definition at line 341 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().

342 {
343  out << first_indent << "channel #" << Channel() << " read " << fTDCIDEs.size()
344  << " TDCs:\n";
345  double channel_energy = 0., channel_charge = 0.;
346  for (const auto& TDCinfo: fTDCIDEs) {
347  auto const tdc = TDCinfo.first;
348  out << indent << " TDC #" << tdc
349  << " with " << TDCinfo.second.size() << " IDEs\n";
350  double tdc_energy = 0., tdc_charge = 0.;
351  for (const sim::IDE& ide: TDCinfo.second) {
352  out << indent
353  << " (" << ide.x << ", " << ide.y << ", " << ide.z << ") "
354  << ide.numElectrons << " electrons, " << ide.energy << " MeV (trkID="
355  << ide.trackID << ")\n";
356  tdc_energy += ide.energy;
357  tdc_charge += ide.numElectrons;
358  } // for IDEs
359  out << indent << " => TDC #" << tdc << " CH #" << Channel()
360  << " collected " << tdc_charge << " electrons and " << tdc_energy
361  << " MeV\n";
362  channel_energy += tdc_energy;
363  channel_charge += tdc_charge;
364  } // for TDCs
365  out << indent << " => channel #" << Channel() << " collected "
366  << channel_charge << " electrons and " << channel_energy << " MeV\n";
367 } // 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:333
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

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)
indent_firstindentation for the first line (default: as indent)

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:341
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 153 of file SimChannel.cxx.

References energy, findClosestTDCIDE(), and fTDCIDEs.

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

References fTDCIDEs.

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

339  {
340  return std::lower_bound
341  (fTDCIDEs.begin(), fTDCIDEs.end(), tdc, CompareByTDC());
342  }
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 345 of file SimChannel.cxx.

References fTDCIDEs.

346  {
347  return std::lower_bound
348  (fTDCIDEs.begin(), fTDCIDEs.end(), tdc, CompareByTDC());
349  }
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 278 of file SimChannel.cxx.

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

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

Comparison: sorts by 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
bool sim::SimChannel::operator== ( const SimChannel other) const
inline

Comparison: true if SimChannels have the same channel ID.

Definition at line 331 of file SimChannel.h.

References Channel().

331 { 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 332 of file SimChannel.h.

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

332 { 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 243 of file SimChannel.cxx.

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

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

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

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