LArSoft  v10_04_05
Liquid Argon Software toolkit - https://larsoft.org/
sim::GenericCRTUtility Class Reference

#include "GenericCRT.h"

Public Member Functions

 GenericCRTUtility (std::string const &energyUnitsScale, geo::AuxDetGeometryCore const &auxDetGeom)
 
AuxDetIDE toAuxDetIDE (AuxDetHit const &adhit) const
 
std::vector< unsigned int > GetAuxDetChannels (std::vector< AuxDetHit > const &adhits) const
 
std::vector< AuxDetSimChannelGetAuxDetSimChannels (std::vector< AuxDetHit > const &adhits) const
 
AuxDetSimChannel GetAuxDetSimChannelByNumber (std::vector< AuxDetHit > const &adhits, unsigned int inputchannel) const
 

Private Attributes

geo::AuxDetGeometryCore const * fAuxDetGeom
 
double fEnergyUnitsScale
 

Detailed Description

Definition at line 24 of file GenericCRT.h.

Constructor & Destructor Documentation

sim::GenericCRTUtility::GenericCRTUtility ( std::string const &  energyUnitsScale,
geo::AuxDetGeometryCore const &  auxDetGeom 
)

Title: GenericCRT Utility Class Author: Andrzej Szelc (andrz.nosp@m.ejs@.nosp@m.fnal..nosp@m.gov)

Description: Class with Algorithms to convert sim::AuxDetHits to sim::AuxDetSimChannels

Definition at line 20 of file GenericCRT.cxx.

References fEnergyUnitsScale.

22  : fAuxDetGeom{&auxDetGeom}
23 {
24  HepTool::Evaluator eval;
25  eval.setStdMath();
26  eval.setSystemOfUnits();
27 
28  const std::string scaleExpression = "MeV / " + energyUnitsScale;
29  fEnergyUnitsScale = eval.evaluate(scaleExpression.c_str());
30 
31  if (eval.status() != 0) fEnergyUnitsScale = 1.;
32 }
geo::AuxDetGeometryCore const * fAuxDetGeom
Definition: GenericCRT.h:39

Member Function Documentation

std::vector< unsigned int > sim::GenericCRTUtility::GetAuxDetChannels ( std::vector< AuxDetHit > const &  adhits) const

Definition at line 55 of file GenericCRT.cxx.

References util::size().

Referenced by GetAuxDetSimChannels().

57 {
58  std::vector<unsigned int> AuxDetChanNumber;
59  AuxDetChanNumber.reserve(size(adhits));
60 
61  for (auto const& hit : adhits) {
62 
64  std::find(AuxDetChanNumber.begin(), AuxDetChanNumber.end(), hit.GetID());
65 
66  if (Chanitr == AuxDetChanNumber.end()) { //If trackID is already in the map, update it
67  //if channel ID is not in the set yet, add it
68  AuxDetChanNumber.push_back(hit.GetID());
69  }
70  }
71 
72  return AuxDetChanNumber;
73 }
intermediate_table::iterator iterator
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition: StdUtils.h:101
Detector simulation of raw signals on wires.
sim::AuxDetSimChannel sim::GenericCRTUtility::GetAuxDetSimChannelByNumber ( std::vector< AuxDetHit > const &  adhits,
unsigned int  inputchannel 
) const

Definition at line 75 of file GenericCRT.cxx.

References fAuxDetGeom, geo::AuxDetGeometryCore::FindAuxDetSensitiveAtPosition(), and toAuxDetIDE().

Referenced by GetAuxDetSimChannels().

78 {
79 
80  //loop over sim::AuxDetHits and assign them to AuxDetSimChannels.
81  std::vector<sim::AuxDetIDE> IDEvector;
82 
83  size_t ad_id_no = 9999;
84  size_t ad_sen_id_no = 9999;
85 
86  for (auto const& auxDetHit : adhits) {
87 
88  double xcoordinate = (auxDetHit.GetEntryX() + auxDetHit.GetExitX()) / 2.0;
89  double ycoordinate = (auxDetHit.GetEntryY() + auxDetHit.GetExitY()) / 2.0;
90  double zcoordinate = (auxDetHit.GetEntryZ() + auxDetHit.GetExitZ()) / 2.0;
91  geo::Point_t const worldPos{xcoordinate, ycoordinate, zcoordinate};
92 
93  if (auxDetHit.GetID() == inputchannel) // this is the channel we want.
94  {
95  // Find the IDs given the hit position
96  fAuxDetGeom->FindAuxDetSensitiveAtPosition(worldPos, ad_id_no, ad_sen_id_no, 0.0001);
97 
98  mf::LogDebug("GenericCRTUtility")
99  << "Found an AuxDetHit with ID " << auxDetHit.GetID() << " for AuxDet ID " << ad_id_no
100  << " Sens ID " << ad_sen_id_no << std::endl;
101 
102  auto tempIDE = toAuxDetIDE(auxDetHit);
103 
105  std::find(IDEvector.begin(), IDEvector.end(), tempIDE);
106 
107  if (IDEitr != IDEvector.end()) { //If trackID is already in the map, update it
108  // Andrzej's note - following logic from AuxDetReadout in Legacy, but why are the
109  // other paremeters getting overwritten like that?
110  IDEitr->energyDeposited += tempIDE.energyDeposited;
111  IDEitr->exitX = tempIDE.exitX;
112  IDEitr->exitY = tempIDE.exitY;
113  IDEitr->exitZ = tempIDE.exitZ;
114  IDEitr->exitT = tempIDE.exitT;
115  IDEitr->exitMomentumX = tempIDE.exitMomentumX;
116  IDEitr->exitMomentumY = tempIDE.exitMomentumY;
117  IDEitr->exitMomentumZ = tempIDE.exitMomentumZ;
118  }
119  else { //if trackID is not in the set yet, add it
120  IDEvector.push_back(std::move(tempIDE));
121  } //else
122 
123  // break;
124  } // end if the AuxDetHit channel checks out.
125 
126  } // end main loop on AuxDetHit
127 
128  mf::LogDebug("GenericCRTUtility")
129  << "Returning AuxDetSimChannel for ID " << ad_id_no << " " << ad_sen_id_no << ", with "
130  << IDEvector.size() << " IDEs." << std::endl;
131 
132  //push back the AuxDetSimChannel Vector.
133  //TODO check the last parameter values.
134  return sim::AuxDetSimChannel(ad_id_no, std::move(IDEvector), ad_sen_id_no);
135 }
intermediate_table::iterator iterator
AuxDetIDE toAuxDetIDE(AuxDetHit const &adhit) const
Definition: GenericCRT.cxx:34
geo::AuxDetGeometryCore const * fAuxDetGeom
Definition: GenericCRT.h:39
Collection of particles crossing one auxiliary detector cell.
void FindAuxDetSensitiveAtPosition(Point_t const &point, std::size_t &adg, std::size_t &sv, double tolerance=0) const
Fills the indices of the sensitive auxiliary detector at location.
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
Definition: geo_vectors.h:180
MaybeLogger_< ELseverityLevel::ELsev_success, false > LogDebug
std::vector< sim::AuxDetSimChannel > sim::GenericCRTUtility::GetAuxDetSimChannels ( std::vector< AuxDetHit > const &  adhits) const

Definition at line 137 of file GenericCRT.cxx.

References GetAuxDetChannels(), GetAuxDetSimChannelByNumber(), and util::size().

Referenced by sim::GenericCRT::produce().

139 {
140  auto const auxDetChannels = GetAuxDetChannels(adhits);
141  std::vector<sim::AuxDetSimChannel> auxDetVector;
142  auxDetVector.reserve(size(auxDetChannels));
143 
144  for (auto const channelNum : auxDetChannels) {
145  auxDetVector.push_back(GetAuxDetSimChannelByNumber(adhits, channelNum));
146  }
147 
148  return auxDetVector;
149 }
std::vector< unsigned int > GetAuxDetChannels(std::vector< AuxDetHit > const &adhits) const
Definition: GenericCRT.cxx:55
AuxDetSimChannel GetAuxDetSimChannelByNumber(std::vector< AuxDetHit > const &adhits, unsigned int inputchannel) const
Definition: GenericCRT.cxx:75
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition: StdUtils.h:101
sim::AuxDetIDE sim::GenericCRTUtility::toAuxDetIDE ( sim::AuxDetHit const &  adhit) const

Definition at line 34 of file GenericCRT.cxx.

References sim::AuxDetIDE::energyDeposited, sim::AuxDetIDE::entryT, sim::AuxDetIDE::entryX, sim::AuxDetIDE::entryY, sim::AuxDetIDE::entryZ, sim::AuxDetIDE::exitMomentumX, sim::AuxDetIDE::exitMomentumY, sim::AuxDetIDE::exitMomentumZ, sim::AuxDetIDE::exitT, sim::AuxDetIDE::exitX, sim::AuxDetIDE::exitY, sim::AuxDetIDE::exitZ, fEnergyUnitsScale, sim::AuxDetHit::GetEnergyDeposited(), sim::AuxDetHit::GetEntryT(), sim::AuxDetHit::GetEntryX(), sim::AuxDetHit::GetEntryY(), sim::AuxDetHit::GetEntryZ(), sim::AuxDetHit::GetExitMomentumX(), sim::AuxDetHit::GetExitMomentumY(), sim::AuxDetHit::GetExitMomentumZ(), sim::AuxDetHit::GetExitT(), sim::AuxDetHit::GetExitX(), sim::AuxDetHit::GetExitY(), sim::AuxDetHit::GetExitZ(), sim::AuxDetHit::GetTrackID(), and sim::AuxDetIDE::trackID.

Referenced by GetAuxDetSimChannelByNumber().

35 {
36  sim::AuxDetIDE outputIDE;
37 
38  outputIDE.trackID = adhit.GetTrackID();
39  outputIDE.energyDeposited = adhit.GetEnergyDeposited() * fEnergyUnitsScale;
40  outputIDE.entryX = adhit.GetEntryX();
41  outputIDE.entryY = adhit.GetEntryY();
42  outputIDE.entryZ = adhit.GetEntryZ();
43  outputIDE.entryT = adhit.GetEntryT();
44  outputIDE.exitX = adhit.GetExitX();
45  outputIDE.exitY = adhit.GetExitY();
46  outputIDE.exitZ = adhit.GetExitZ();
47  outputIDE.exitT = adhit.GetExitT();
48  outputIDE.exitMomentumX = adhit.GetExitMomentumX();
49  outputIDE.exitMomentumY = adhit.GetExitMomentumY();
50  outputIDE.exitMomentumZ = adhit.GetExitMomentumZ();
51 
52  return outputIDE;
53 }
int trackID
Geant4 supplied track ID.
float exitMomentumZ
Exit Z-Momentum of particle.
float exitY
Exit position Y of particle.
float entryT
Entry time of particle.
float exitMomentumX
Exit X-Momentum of particle.
float exitT
Exit time of particle.
float exitZ
Exit position Z of particle.
float entryZ
Entry position Z of particle.
float exitX
Exit position X of particle.
float energyDeposited
total energy deposited for this track ID and time
float entryX
Entry position X of particle.
float entryY
Entry position Y of particle.
MC truth information to make RawDigits and do back tracking.
float exitMomentumY
Exit Y-Momentum of particle.

Member Data Documentation

geo::AuxDetGeometryCore const* sim::GenericCRTUtility::fAuxDetGeom
private

Definition at line 39 of file GenericCRT.h.

Referenced by GetAuxDetSimChannelByNumber().

double sim::GenericCRTUtility::fEnergyUnitsScale
private

Definition at line 40 of file GenericCRT.h.

Referenced by GenericCRTUtility(), and toAuxDetIDE().


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