19 : fG4TrackIDOffsets(offsets)
32 std::vector<size_t>());
36 const std::vector<simb::MCParticle>& input_vector,
41 std::runtime_error(
"ERROR in MergeSimSourcesUtility: Source index out of range!");
44 merged_vector.reserve(merged_vector.size() + input_vector.size());
49 for(
size_t i_p=0; i_p<input_vector.size(); i_p++){
54 if(
std::abs(merged_vector.back().TrackId()) < range_trackID.first)
55 range_trackID.first =
std::abs(merged_vector.back().TrackId());
56 if(
std::abs(merged_vector.back().TrackId()) > range_trackID.second)
57 range_trackID.second =
std::abs(merged_vector.back().TrackId());
65 const std::vector<sim::SimChannel>& input_vector,
69 std::runtime_error(
"ERROR in MergeSimSourcesUtility: Source index out of range!");
71 merged_vector.reserve( merged_vector.size() + input_vector.size() );
76 for(
auto const& simchannel : input_vector){
79 if(it==merged_vector.end()){
80 merged_vector.emplace_back(simchannel.Channel());
81 it = merged_vector.end() - 1;
84 std::pair<int,int> thisrange = it->MergeSimChannel(simchannel,
fG4TrackIDOffsets[source_index]);
86 range_trackID.first =
std::abs(thisrange.first);
88 range_trackID.second =
std::abs(thisrange.second);
95 const std::vector<sim::AuxDetSimChannel>& input_vector,
99 std::runtime_error(
"ERROR in MergeSimSourcesUtility: Source index out of range!");
101 merged_vector.reserve( merged_vector.size() + input_vector.size() );
106 for(
auto const& simchannel : input_vector){
109 if(it==merged_vector.end()){
110 merged_vector.emplace_back(simchannel.AuxDetID(), simchannel.AuxDetSensitiveID());
111 it = merged_vector.end() - 1;
116 std::vector<sim::AuxDetIDE> all_ides = it->AuxDetIDEs();
118 all_ides.emplace_back(ide, offset);
120 auto tid =
std::abs(ide.trackID)+offset;
122 if( tid < range_trackID.first )
123 range_trackID.first = tid;
124 if( tid > range_trackID.second )
125 range_trackID.second = tid;
136 const std::vector<sim::SimPhotons>& input_vector)
139 merged_vector.reserve( merged_vector.size() + input_vector.size() );
141 for(
auto const& simphotons : input_vector){
144 if(it==merged_vector.end()){
145 merged_vector.emplace_back(simphotons.OpChannel());
146 it = merged_vector.end() - 1;
154 const std::vector<sim::SimPhotonsLite>& input_vector)
157 merged_vector.reserve( merged_vector.size() + input_vector.size() );
159 for(
auto const& simphotons : input_vector){
162 if(it==merged_vector.end()){
163 merged_vector.emplace_back(simphotons.OpChannel);
164 it = merged_vector.end() - 1;
173 std::vector<sim::SimEnergyDeposit>&
dest,
174 const std::vector<sim::SimEnergyDeposit>& src,
175 std::size_t source_index
182 dest.reserve(dest.size() + src.size());
183 std::transform(
begin(src),
end(src), back_inserter(dest), offsetEDepID);
189 std::vector<sim::AuxDetHit>&
dest,
190 const std::vector<sim::AuxDetHit>& src,
191 std::size_t source_index
195 auto const offsetAuxDetHitID = [offset](
sim::AuxDetHit const& adh)
198 dest.reserve(dest.size() + src.size());
199 std::transform(
begin(src),
end(src), back_inserter(dest), offsetAuxDetHitID);
207 std::runtime_error(
"ERROR in MergeSimSourcesUtility: Source index out of range!");
214 if(i==source_index)
continue;
219 std::stringstream ss;
220 ss <<
"ERROR in MergeSimSourcesUtility: Source trackIDs overlap!" 222 <<
"\n\t" <<
"n\t" << newrange.first <<
" " << newrange.second;
223 throw std::runtime_error(ss.str());
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
unsigned int GetTrackID() const
void MergeSimPhotonsLite(std::vector< sim::SimPhotonsLite > &, const std::vector< sim::SimPhotonsLite > &)
void MergeSimChannels(std::vector< sim::SimChannel > &, const std::vector< sim::SimChannel > &, size_t)
void UpdateG4TrackIDRange(std::pair< int, int >, size_t)
MergeSimSourcesUtility(std::vector< int > const &)
void MergeSimPhotons(std::vector< sim::SimPhotons > &, const std::vector< sim::SimPhotons > &)
static sim::SimEnergyDeposit offsetSimEnergyDepositTrackID(sim::SimEnergyDeposit const &, int)
void MergeAuxDetSimChannels(std::vector< sim::AuxDetSimChannel > &, const std::vector< sim::AuxDetSimChannel > &, size_t)
float GetExitMomentumY() const
void MergeAuxDetHits(std::vector< sim::AuxDetHit > &, const std::vector< sim::AuxDetHit > &, size_t) const
Collection of particles crossing one auxiliary detector cell.
geo::Point_t Start() const
std::vector< int > fG4TrackIDOffsets
std::vector< std::pair< int, int > > fG4TrackIDRanges
float GetEnergyDeposited() const
static int max(int a, int b)
unsigned int GetID() const
void MergeMCParticles(std::vector< simb::MCParticle > &, const std::vector< simb::MCParticle > &, size_t)
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
float GetExitMomentumX() const
MC truth information to make RawDigits and do back tracking.
static sim::AuxDetHit offsetAuxDetHitTrackID(sim::AuxDetHit const &, int)
Energy deposition in the active material.
void MergeSimEnergyDeposits(std::vector< sim::SimEnergyDeposit > &, const std::vector< sim::SimEnergyDeposit > &, size_t) const
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
float GetExitMomentumZ() const
double ScintYieldRatio() const
std::vector< std::vector< size_t > > fMCParticleListMap