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

#include "GenericCRT.h"

Public Member Functions

 GenericCRTUtility (const std::string energyUnitsScale)
 
sim::AuxDetIDE toAuxDetIDE (sim::AuxDetHit const &InputHit) const
 
std::vector< unsigned int > GetAuxDetChannels (const std::vector< sim::AuxDetHit > &InputHitVector) const
 
std::vector< sim::AuxDetSimChannelGetAuxDetSimChannels (const std::vector< sim::AuxDetHit > &InputHitVector) const
 
sim::AuxDetSimChannel GetAuxDetSimChannelByNumber (const std::vector< sim::AuxDetHit > &InputHitVector, unsigned int inputchannel) const
 

Private Attributes

art::ServiceHandle< geo::Geometry const > fGeo
 
double fEnergyUnitsScale
 

Detailed Description

Definition at line 25 of file GenericCRT.h.

Constructor & Destructor Documentation

sim::GenericCRTUtility::GenericCRTUtility ( const std::string  energyUnitsScale)

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 19 of file GenericCRT.cxx.

References fEnergyUnitsScale.

20 {
21  HepTool::Evaluator eval;
22  eval.setStdMath();
23  eval.setSystemOfUnits();
24 
25  const std::string scaleExpression = "MeV / " + energyUnitsScale;
26  fEnergyUnitsScale = eval.evaluate(scaleExpression.c_str());
27 
28  if (eval.status() != 0) fEnergyUnitsScale = 1.;
29 }

Member Function Documentation

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

Definition at line 52 of file GenericCRT.cxx.

References util::size().

Referenced by GetAuxDetSimChannels().

54 {
55 
56  std::vector<unsigned int> AuxDetChanNumber;
57  AuxDetChanNumber.reserve(size(InputHitVector));
58 
59  for (auto const& hit : InputHitVector) {
60 
62  std::find(AuxDetChanNumber.begin(), AuxDetChanNumber.end(), hit.GetID());
63 
64  if (Chanitr == AuxDetChanNumber.end()) { //If trackID is already in the map, update it
65  //if channel ID is not in the set yet, add it
66  AuxDetChanNumber.push_back(hit.GetID());
67  } //
68  }
69 
70  return AuxDetChanNumber;
71 }
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 ( const std::vector< sim::AuxDetHit > &  InputHitVector,
unsigned int  inputchannel 
) const

Definition at line 73 of file GenericCRT.cxx.

References fGeo, geo::GeometryCore::FindAuxDetSensitiveAtPosition(), and toAuxDetIDE().

Referenced by GetAuxDetSimChannels().

76 {
77  std::vector<sim::AuxDetIDE> IDEvector;
78  //loop over sim::AuxDetHits and assign them to AuxDetSimChannels.
79 
80  size_t ad_id_no = 9999;
81  size_t ad_sen_id_no = 9999;
82 
83  for (auto const& auxDetHit : InputHitVector) {
84 
85  double xcoordinate = (auxDetHit.GetEntryX() + auxDetHit.GetExitX()) / 2.0;
86  double ycoordinate = (auxDetHit.GetEntryY() + auxDetHit.GetExitY()) / 2.0;
87  double zcoordinate = (auxDetHit.GetEntryZ() + auxDetHit.GetExitZ()) / 2.0;
88  geo::Point_t const worldPos{xcoordinate, ycoordinate, zcoordinate};
89 
90  if (auxDetHit.GetID() == inputchannel) // this is the channel we want.
91  {
92  // Find the IDs given the hit position
93  fGeo->FindAuxDetSensitiveAtPosition(worldPos, ad_id_no, ad_sen_id_no, 0.0001);
94 
95  mf::LogDebug("GenericCRTUtility")
96  << "Found an AuxDetHit with ID " << auxDetHit.GetID() << " for AuxDet ID " << ad_id_no
97  << " Sens ID " << ad_sen_id_no << std::endl;
98 
99  auto tempIDE = toAuxDetIDE(auxDetHit);
100 
102  std::find(IDEvector.begin(), IDEvector.end(), tempIDE);
103 
104  if (IDEitr != IDEvector.end()) { //If trackID is already in the map, update it
105  //Andrzej's note - following logic from AuxDetReadout in Legacy, but why are the other paremeters getting overwritten like that?
106  IDEitr->energyDeposited += tempIDE.energyDeposited;
107  IDEitr->exitX = tempIDE.exitX;
108  IDEitr->exitY = tempIDE.exitY;
109  IDEitr->exitZ = tempIDE.exitZ;
110  IDEitr->exitT = tempIDE.exitT;
111  IDEitr->exitMomentumX = tempIDE.exitMomentumX;
112  IDEitr->exitMomentumY = tempIDE.exitMomentumY;
113  IDEitr->exitMomentumZ = tempIDE.exitMomentumZ;
114  }
115  else { //if trackID is not in the set yet, add it
116  IDEvector.push_back(std::move(tempIDE));
117  } //else
118 
119  // break;
120  } // end if the AuxDetHit channel checks out.
121 
122  } // end main loop on AuxDetHit
123 
124  mf::LogDebug("GenericCRTUtility")
125  << "Returning AuxDetSimChannel for ID " << ad_id_no << " " << ad_sen_id_no << ", with "
126  << IDEvector.size() << " IDEs." << std::endl;
127 
128  //push back the AuxDetSimChannel Vector.
129  //TODO check the last parameter values.
130  return sim::AuxDetSimChannel(ad_id_no, std::move(IDEvector), ad_sen_id_no);
131 }
intermediate_table::iterator iterator
sim::AuxDetIDE toAuxDetIDE(sim::AuxDetHit const &InputHit) const
Definition: GenericCRT.cxx:31
Collection of particles crossing one auxiliary detector cell.
art::ServiceHandle< geo::Geometry const > fGeo
Definition: GenericCRT.h:43
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 ( const std::vector< sim::AuxDetHit > &  InputHitVector) const

Definition at line 133 of file GenericCRT.cxx.

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

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

135 {
136  auto const auxDetChannels = GetAuxDetChannels(InputHitVector);
137  std::vector<sim::AuxDetSimChannel> auxDetVector;
138  auxDetVector.reserve(size(auxDetChannels));
139 
140  for (auto const channelNum : auxDetChannels) {
141  auxDetVector.push_back(GetAuxDetSimChannelByNumber(InputHitVector, channelNum));
142  }
143 
144  return auxDetVector;
145 }
sim::AuxDetSimChannel GetAuxDetSimChannelByNumber(const std::vector< sim::AuxDetHit > &InputHitVector, unsigned int inputchannel) const
Definition: GenericCRT.cxx:73
std::vector< unsigned int > GetAuxDetChannels(const std::vector< sim::AuxDetHit > &InputHitVector) const
Definition: GenericCRT.cxx:52
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition: StdUtils.h:101
sim::AuxDetIDE sim::GenericCRTUtility::toAuxDetIDE ( sim::AuxDetHit const &  InputHit) const

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

32 {
33  sim::AuxDetIDE outputIDE;
34 
35  outputIDE.trackID = InputHit.GetTrackID();
36  outputIDE.energyDeposited = InputHit.GetEnergyDeposited() * fEnergyUnitsScale;
37  outputIDE.entryX = InputHit.GetEntryX();
38  outputIDE.entryY = InputHit.GetEntryY();
39  outputIDE.entryZ = InputHit.GetEntryZ();
40  outputIDE.entryT = InputHit.GetEntryT();
41  outputIDE.exitX = InputHit.GetExitX();
42  outputIDE.exitY = InputHit.GetExitY();
43  outputIDE.exitZ = InputHit.GetExitZ();
44  outputIDE.exitT = InputHit.GetExitT();
45  outputIDE.exitMomentumX = InputHit.GetExitMomentumX();
46  outputIDE.exitMomentumY = InputHit.GetExitMomentumY();
47  outputIDE.exitMomentumZ = InputHit.GetExitMomentumZ();
48 
49  return outputIDE;
50 }
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

double sim::GenericCRTUtility::fEnergyUnitsScale
private

Definition at line 45 of file GenericCRT.h.

Referenced by GenericCRTUtility(), and toAuxDetIDE().

art::ServiceHandle<geo::Geometry const> sim::GenericCRTUtility::fGeo
private

Definition at line 43 of file GenericCRT.h.

Referenced by GetAuxDetSimChannelByNumber().


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