30 std::vector<size_t>());
34 const std::vector<simb::MCParticle>& input_vector,
39 std::runtime_error(
"ERROR in MergeSimSourcesUtility: Source index out of range!");
42 merged_vector.reserve(merged_vector.size() + input_vector.size());
47 for(
size_t i_p=0; i_p<input_vector.size(); i_p++){
52 if(merged_vector.back().TrackId() < range_trackID.first)
53 range_trackID.first = merged_vector.back().TrackId();
54 if(merged_vector.back().TrackId() > range_trackID.second)
55 range_trackID.second = merged_vector.back().TrackId();
63 const std::vector<sim::SimChannel>& input_vector,
67 std::runtime_error(
"ERROR in MergeSimSourcesUtility: Source index out of range!");
69 merged_vector.reserve( merged_vector.size() + input_vector.size() );
74 for(
auto const& simchannel : input_vector){
77 if(it==merged_vector.end()){
78 merged_vector.emplace_back(simchannel.Channel());
79 it = merged_vector.end() - 1;
82 std::pair<int,int> thisrange = it->MergeSimChannel(simchannel,
fG4TrackIDOffsets[source_index]);
83 if(thisrange.first < range_trackID.first) range_trackID.first = thisrange.first;
84 if(thisrange.second > range_trackID.second) range_trackID.second = thisrange.second;
91 const std::vector<sim::AuxDetSimChannel>& input_vector,
95 std::runtime_error(
"ERROR in MergeSimSourcesUtility: Source index out of range!");
97 merged_vector.reserve( merged_vector.size() + input_vector.size() );
102 for(
auto const& simchannel : input_vector){
105 if(it==merged_vector.end()){
106 merged_vector.emplace_back(simchannel.AuxDetID(), simchannel.AuxDetSensitiveID());
107 it = merged_vector.end() - 1;
110 std::pair<int,int> thisrange = it->MergeAuxDetSimChannel(simchannel,
fG4TrackIDOffsets[source_index]);
111 if(thisrange.first < range_trackID.first) range_trackID.first = thisrange.first;
112 if(thisrange.second > range_trackID.second) range_trackID.second = thisrange.second;
119 const std::vector<sim::SimPhotons>& input_vector)
122 merged_vector.reserve( merged_vector.size() + input_vector.size() );
124 for(
auto const& simphotons : input_vector){
127 if(it==merged_vector.end()){
128 merged_vector.emplace_back(simphotons.OpChannel());
129 it = merged_vector.end() - 1;
137 const std::vector<sim::SimPhotonsLite>& input_vector)
140 merged_vector.reserve( merged_vector.size() + input_vector.size() );
142 for(
auto const& simphotons : input_vector){
145 if(it==merged_vector.end()){
146 merged_vector.emplace_back(simphotons.OpChannel);
147 it = merged_vector.end() - 1;
157 std::runtime_error(
"ERROR in MergeSimSourcesUtility: Source index out of range!");
164 if(i==source_index)
continue;
169 std::stringstream
ss;
170 ss <<
"ERROR in MergeSimSourcesUtility: Source trackIDs overlap!" 172 <<
"\n\t" <<
"n\t" << newrange.first <<
" " << newrange.second;
173 throw std::runtime_error(ss.str());
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 > &)
void MergeAuxDetSimChannels(std::vector< sim::AuxDetSimChannel > &, const std::vector< sim::AuxDetSimChannel > &, size_t)
std::vector< int > fG4TrackIDOffsets
std::vector< std::pair< int, int > > fG4TrackIDRanges
void MergeMCParticles(std::vector< simb::MCParticle > &, const std::vector< simb::MCParticle > &, size_t)
std::vector< std::vector< size_t > > fMCParticleListMap