47 class MergeSimSources;
60 fhicl::Comment{
"offset to add to the MC particles from each source"}};
94 fhicl::Comment{
"merges energy deposit collection; if omitted, follows LArG4Parmeters"}};
98 fhicl::Comment{
"labels of sim::SimEnergyDeposit collections to merge"},
99 std::vector<std::string>{
"TPCActive",
"Other"}
111 std::vector<std::string>{
"LArG4DetectorServicevolAuxDetSensitiveCRTStripY",
151 template <
typename Optional>
152 std::optional<typename Optional::value_type> getOptionalValue(Optional
const& parameter)
155 using Value_t =
typename Optional::value_type;
157 if (!parameter.hasValue())
return std::nullopt;
180 getOptionalValue(params().FillSimEnergyDeposits)
190 <<
"Unequal input vector sizes: InputSourcesLabels and TrackIDOffsets.\n";
196 consumes<std::vector<simb::MCParticle>>(tag);
197 consumes<art::Assns<simb::MCParticle, simb::MCTruth, sim::GeneratedParticleInfo>>(tag);
206 consumes<std::vector<sim::SimPhotons>>(tag);
208 consumes<std::vector<sim::SimPhotonsLite>>(tag);
213 consumes<std::vector<sim::SimPhotons>>(reflected_tag);
215 consumes<std::vector<sim::SimPhotonsLite>>(reflected_tag);
222 consumes<std::vector<sim::SimEnergyDeposit>>(edep_tag);
229 consumes<std::vector<sim::AuxDetHit>>(auxdethit_tag);
238 produces<std::vector<simb::MCParticle>>();
239 produces<art::Assns<simb::MCTruth, simb::MCParticle, sim::GeneratedParticleInfo>>();
246 produces<std::vector<sim::SimPhotons>>();
248 produces<std::vector<sim::SimPhotonsLite>>();
260 produces<std::vector<sim::SimEnergyDeposit>>(edep_inst);
265 produces<std::vector<sim::AuxDetHit>>(auxdethit_inst);
276 auto partCol = std::make_unique<std::vector<simb::MCParticle>>();
277 auto scCol = std::make_unique<std::vector<sim::SimChannel>>();
278 auto PhotonCol = std::make_unique<std::vector<sim::SimPhotons>>();
279 auto LitePhotonCol = std::make_unique<std::vector<sim::SimPhotonsLite>>();
280 auto ReflPhotonCol = std::make_unique<std::vector<sim::SimPhotons>>();
281 auto ReflLitePhotonCol = std::make_unique<std::vector<sim::SimPhotonsLite>>();
283 std::make_unique<art::Assns<simb::MCTruth, simb::MCParticle, sim::GeneratedParticleInfo>>();
284 auto adCol = std::make_unique<std::vector<sim::AuxDetSimChannel>>();
285 auto pamCol = std::make_unique<std::vector<sim::ParticleAncestryMap>>();
287 using edeps_t = std::vector<sim::SimEnergyDeposit>;
288 std::vector<edeps_t> edepCols;
291 using aux_det_hits_t = std::vector<sim::AuxDetHit>;
292 std::vector<aux_det_hits_t> auxdethitCols;
301 auto const input_partCol = e.
getValidHandle<std::vector<simb::MCParticle>>(input_label);
302 MergeUtility.MergeMCParticles(*partCol, *input_partCol, i_source);
305 const std::vector<size_t>& assocVectorPrimitive =
306 MergeUtility.GetMCParticleListMap().at(i_source);
308 input_partCol, e, input_label);
311 mctAssn.at(i_p), makePartPtr(assocVectorPrimitive[i_p]), mctAssn.
data(i_p).ref());
315 auto const& input_scCol = e.
getProduct<std::vector<sim::SimChannel>>(input_label);
316 MergeUtility.MergeSimChannels(*scCol, input_scCol, i_source);
320 auto const& input_adCol = e.
getProduct<std::vector<sim::AuxDetSimChannel>>(input_label);
321 MergeUtility.MergeAuxDetSimChannels(*adCol, input_adCol, i_source);
326 auto const& input_PhotonCol = e.
getProduct<std::vector<sim::SimPhotons>>(input_label);
327 MergeUtility.MergeSimPhotons(*PhotonCol, input_PhotonCol);
330 auto const& input_LitePhotonCol =
331 e.
getProduct<std::vector<sim::SimPhotonsLite>>(input_label);
332 MergeUtility.MergeSimPhotonsLite(*LitePhotonCol, input_LitePhotonCol);
338 auto const& input_PhotonCol =
339 e.
getProduct<std::vector<sim::SimPhotons>>(input_reflected_label);
340 MergeUtility.MergeSimPhotons(*ReflPhotonCol, input_PhotonCol);
343 auto const& input_LitePhotonCol =
344 e.
getProduct<std::vector<sim::SimPhotonsLite>>(input_reflected_label);
345 MergeUtility.MergeSimPhotonsLite(*ReflLitePhotonCol, input_LitePhotonCol);
353 MergeUtility.MergeSimEnergyDeposits(edepCol, e.
getProduct<edeps_t>(edep_tag), i_source);
358 for (
auto const& [auxdethit_inst, auxdethitCol] :
361 MergeUtility.MergeAuxDetHits(
362 auxdethitCol, e.
getProduct<aux_det_hits_t>(auxdethit_tag), i_source);
367 MergeUtility.MergeParticleAncestryMaps(*pamCol, input_pamCol, i_source);
373 e.
put(std::move(partCol));
374 e.
put(std::move(tpassn));
380 e.
put(std::move(PhotonCol));
382 e.
put(std::move(LitePhotonCol));
393 e.
put(std::make_unique<edeps_t>(move(edepCol)), edep_inst);
398 for (
auto&& [auxdethit_inst, auxdethitCol] :
400 e.
put(std::make_unique<aux_det_hits_t>(move(auxdethitCol)), auxdethit_inst);
411 log <<
"Configuration:" 413 for (
auto const& [i_source, tag, offset] :
415 log <<
"\n [" << i_source <<
"] '" << tag.encode() <<
"' (ID offset: " << offset <<
")";
424 log <<
"\n - filling Simulated Photons";
426 log <<
"\n - using photon summary (`SimPhotonsLite`)";
428 log <<
"\n - using detailed photons (`SimPhotons`)";
436 log <<
" '" << label <<
"'";
444 log <<
" '" << label <<
"'";
bool const fFillSimChannels
bool const fFillMCParticles
Store parameters for running LArG4.
MergeSimSources(Parameters const &config)
fhicl::Sequence< int > TrackIDOffsets
Definition of util::zip().
Definition of util::enumerate().
bool const fFillSimEnergyDeposits
EDProducer(fhicl::ParameterSet const &pset)
fhicl::Atom< bool > FillAuxDetSimChannels
Contains data associated to particles from detector simulation.
fhicl::OptionalAtom< bool > FillSimEnergyDeposits
fhicl::Atom< bool > FillSimChannels
auto enumerate(Iterables &&...iterables)
Range-for loop helper tracking the number of iteration.
fhicl::Sequence< std::string > EnergyDepositInstanceLabels
std::vector< art::InputTag > const fInputSourcesLabels
bool const fUseLitePhotons
PutHandle< PROD > put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
Simulation objects for optical detectors.
std::vector< std::string > const fAuxDetHitsInstanceLabels
auto counter(T begin, T end)
Returns an object to iterate values from begin to end in a range-for loop.
#define DEFINE_ART_MODULE(klass)
bool const fFillSimPhotons
bool const fFillParticleAncestryMaps
fhicl::Atom< bool > FillSimPhotons
std::vector< int > const fTrackIDOffsets
Test of util::counter and support utilities.
void dumpConfiguration() const
fhicl::Atom< bool > StoreReflected
void produce(art::Event &e) override
fhicl::Sequence< std::string > AuxDetHitsInstanceLabels
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
static std::string const ReflectedLabel
fhicl::Atom< bool > FillMCParticles
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
bool const fStoreReflected
bool const fFillAuxDetHits
contains information for a single step in the detector simulation
object containing MC truth information necessary for making RawDigits and doing back tracking ...
auto zip(Iterables &&...iterables)
Range-for loop helper iterating across many collections at the same time.
fhicl::Atom< bool > FillAuxDetHits
cet::maybe_ref< Data const > data(size_type i) const
bool const fFillAuxDetSimChannels
fhicl::Atom< bool > FillParticleAncestryMaps
PROD const & getProduct(InputTag const &tag) const
fhicl::Sequence< art::InputTag > InputSourcesLabels
std::vector< std::string > const fEnergyDepositionInstances