LArSoft
v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
|
Runs Geant4 simulation and propagation of electrons and photons to readout. More...
Public Types | |
using | ModuleType = EDProducer |
using | WorkerType = WorkerT< EDProducer > |
template<typename UserConfig , typename KeysToIgnore = void> | |
using | Table = ProducerBase::Table< UserConfig, KeysToIgnore > |
Public Member Functions | |
LArG4 (fhicl::ParameterSet const &pset) | |
Standard constructor and destructor for an FMWK module. More... | |
virtual | ~LArG4 () |
void | produce (art::Event &evt) |
void | beginJob () |
void | beginRun (art::Run &run) |
template<typename PROD , BranchType B = InEvent> | |
ProductID | getProductID (std::string const &instanceName={}) const |
template<typename PROD , BranchType B> | |
ProductID | getProductID (ModuleDescription const &moduleDescription, std::string const &instanceName) const |
bool | modifiesEvent () const |
template<typename T , BranchType = InEvent> | |
ProductToken< T > | consumes (InputTag const &) |
template<typename T , art::BranchType BT> | |
art::ProductToken< T > | consumes (InputTag const &it) |
template<typename T , BranchType = InEvent> | |
void | consumesMany () |
template<typename Element , BranchType = InEvent> | |
ViewToken< Element > | consumesView (InputTag const &) |
template<typename T , art::BranchType BT> | |
art::ViewToken< T > | consumesView (InputTag const &it) |
template<typename T , BranchType = InEvent> | |
ProductToken< T > | mayConsume (InputTag const &) |
template<typename T , art::BranchType BT> | |
art::ProductToken< T > | mayConsume (InputTag const &it) |
template<typename T , BranchType = InEvent> | |
void | mayConsumeMany () |
template<typename Element , BranchType = InEvent> | |
ViewToken< Element > | mayConsumeView (InputTag const &) |
template<typename T , art::BranchType BT> | |
art::ViewToken< T > | mayConsumeView (InputTag const &it) |
base_engine_t & | createEngine (seed_t seed) |
base_engine_t & | createEngine (seed_t seed, std::string const &kind_of_engine_to_make) |
base_engine_t & | createEngine (seed_t seed, std::string const &kind_of_engine_to_make, label_t const &engine_label) |
seed_t | get_seed_value (fhicl::ParameterSet const &pset, char const key[]="seed", seed_t const implicit_seed=-1) |
Static Public Member Functions | |
static cet::exempt_ptr< Consumer > | non_module_context () |
Protected Member Functions | |
CurrentProcessingContext const * | currentContext () const |
void | validateConsumedProduct (BranchType const bt, ProductInfo const &pi) |
void | prepareForJob (fhicl::ParameterSet const &pset) |
void | showMissingConsumes () const |
Private Member Functions | |
std::unique_ptr< PositionInVolumeFilter > | CreateParticleVolumeFilter (std::set< std::string > const &vol_names) const |
Configures and returns a particle filter. More... | |
Private Attributes | |
g4b::G4Helper * | fG4Help |
G4 interface object. More... | |
larg4::LArVoxelListAction * | flarVoxelListAction |
Geant4 user action to accumulate LAr voxel information. More... | |
larg4::ParticleListAction * | fparticleListAction |
Geant4 user action to particle information. More... | |
std::string | fG4PhysListName |
predefined physics list to use if not making a custom one More... | |
std::string | fG4MacroPath |
bool | fCheckOverlaps |
Whether to use the G4 overlap checker. More... | |
bool | fdumpParticleList |
Whether each event's sim::ParticleList will be displayed. More... | |
bool | fdumpSimChannels |
Whether each event's sim::Channel will be displayed. More... | |
bool | fUseLitePhotons |
int | fSmartStacking |
Whether to instantiate and use class to. More... | |
double | fOffPlaneMargin = 0. |
dictate how tracks are put on stack. More... | |
std::vector< std::string > | fInputLabels |
std::vector< std::string > | fKeepParticlesInVolumes |
Only write particles that have trajectories through these volumes. More... | |
bool | fSparsifyTrajectories |
Sparsify MCParticle Trajectories. More... | |
Runs Geant4 simulation and propagation of electrons and photons to readout.
This module collects generated particles from one or more generators and processes them through Geant4.
The module reads the particles to process from simb::MCTruth
records. Each particle generator is required to produce a vector of such records: std::vector<simb::MCTruth>
.
The module allows two operation modes:
LArG4
configurationLArG4
module configuration, and the module will process all data products of type std::vector<simb::MCTruth>
, in a non-specified orderFor each simb::MCTruth
, a Geant4 run is started. The interface with Geant4 is via a helper class provided by nutools. Only the particles in the truth record which have status code (simb::MCParticle::StatusCode()
) equal to 1
are processed. These particles are called, in LArG4
jargon, primaries.
The LArG4
module produces:
sim::SimChannel
: each sim::SimChannel
represents the set of energy depositions in liquid argon which drifted and were observed on a certain channel; it includes physics effects like attenuation, diffusion, electric field distortion, etc. Information of the generating Geant4 "track" is retained;sim::SimPhotons
or sim::SimPhotonsLite
: each sim::SimPhotons
represents the set of individual photons reaching a channel of the optical detector; it includes physics effects as well as quantum efficiency of the detector (to reduce data size early in the process); sim::SimPhotonsLite
drops the information of the single photons and stores only collective information (e.g. their number).sim::OpDetBacktrackerRecord
(to be documented)sim::AuxDetSimChannel
(to be documented)simb::MCParticle
: the particles generated in the interaction of the primary particles with the material in the world are stored, but minor filtering by geometry and by physics is possible. An association of them with the originating simb::MCTruth
object is also produced.simb::MCTruth
) which have status code (simb::MCParticle::StatusCode()
) equal to 1
are passed to Geant4. These particles are called, in LArG4
jargon, primaries. The interface with Geant4 is via a helper class provided by nutools.simb::MCParticle
object into the output particle list. Each simb::MCParticle
includes a Geant4-like track ID which is also recorded into each sim::IDE
deposited by that particle. This information can be used to track all the deposition from a particle, or to backtrack the particle responsible of a deposition (but see below...). Note that the stored track ID may be different than the one Geant4 used (and, in particular, it's guaranteed to be unique within a sim::LArG4
instance output).sim::LArG4Parameters
service) which allow for Geant4 tracks not to be saved as simb::MCParticle
(e.g. ParticleKineticEnergyCut
, KeepEMShowerDaughters
). When these particles have deposited energy, their sim::IDE
will report the ID of the first parent Geant4 track which is saved in the simb::MCParticle
list, but with its sign flipped. Therefore, when tracking or backtracking (see above), comparisons should be performed using the absolute value of the sim::IDE
(e.g. std::abs(ide.trackID)
).The LArG4
module produces sim::SimChannel
objects from generated simb::MCParticle
. Each particle ("primary") is assigned the time taken from its vertex (a 4-vector), which is expected to be represented in nanoseconds. The sim::SimChannel
object is a collection of sim::IDE
in time. The position in the sim::IDE
is the location where some ionization occurred. The time associated to a sim::IDE
is stored in tick units. The time it represents is the time when the ionization happened, which is the time of the primary particle plus the propagation time to the ionization location, plus the drift time, which the ionized electrons take to reach the anode wire. This time is then shifted to the frame of the electronics time via detinfo::DetectorClocks::G4ToElecTime()
, which adds a configurable time offset. The time is converted into ticks via detinfo::DetectorClocks::TPCClock()
, and this is the final value associated to the sim::IDE
. For a more complete overview, see https://cdcvs.fnal.gov/redmine/projects/larsoft/wiki/Simulation#Simulation-Timing
The random number generators used by this process are:
"larg4::PhysicsList"
): whether to use the G4 overlap checker, which catches different issues than ROOTfalse
): whether to use the G4 overlap checkerfalse
): whether to print all MCParticles trackedfalse
): whether to print all depositions on each SimChannel0
): whether to use class to dictate how tracks are put on stack (nonzero is on)simb::MCParticle
objects (empty keeps all)G4Helper
for setting G4 commandNuRandomService
by default)NuRandomService
by default)simb::MCTruth
will be simulated; if not specified, all simb::MCTruth
vector data products are simulated0
): sets the maximum distance from a plane for the wire charge recovery to occur, in centimeters; for details on how it works, see larg4::LArVoxelReadout::SetOffPlaneChargeRecoveryMargin()
. A value of 0
effectively disables this feature. All TPCs will have the same margin applied.Two models are supported for the simulation of (scintillation) light crossing detector surfaces:
G4OpBoundaryProcess
larg4::OpBoundaryProcessSimple
The model is chosen according to the value of detinfo::DetectorProperties::SimpleBoundary()
, and the choice is currently exerted by larg4::OpticalPhysics
.
The simplified model is faster and simpler: it only deals with absorption and reflection (both specular and diffues). This is the "default" model used in most contexts.
GEANT4 model is more complete and slower. It may take some art to fully configure all the properties of the materials at the sides of the surfaces. The price is a detailed simulation that includes among others refraction and wavelength shifting.
Definition at line 296 of file LArG4_module.cc.
|
inherited |
Definition at line 34 of file EDProducer.h.
|
inherited |
Definition at line 43 of file EDProducer.h.
|
inherited |
Definition at line 35 of file EDProducer.h.
|
explicit |
Standard constructor and destructor for an FMWK module.
Definition at line 342 of file LArG4_module.cc.
References art::errors::Configuration, art::EngineCreator::createEngine(), fG4MacroPath, sim::LArG4Parameters::FillSimEnergyDeposits(), fInputLabels, fSparsifyTrajectories, fUseLitePhotons, LOG_DEBUG, sim::LArG4Parameters::NoElectronPropagation(), sim::LArG4Parameters::NoPhotonPropagation(), art::ProductRegistryHelper::produces(), art::EngineCreator::rng(), and sim::LArG4Parameters::UseLitePhotons().
|
virtual |
|
virtual |
Reimplemented from art::EDProducer.
Definition at line 421 of file LArG4_module.cc.
References g4b::UserActionManager::AddAndAdoptAction(), g4b::G4Helper::ConstructDetector(), larg4::IonizationAndScintillation::CreateInstance(), fCheckOverlaps, fG4Help, fG4MacroPath, fG4PhysListName, fOffPlaneMargin, fparticleListAction, fSmartStacking, geo::GeometryCore::GDMLFile(), larg4::MaterialPropertyLoader::GetPropertiesFromServices(), g4b::G4Helper::GetRunManager(), g4b::G4Helper::InitPhysics(), g4b::UserActionManager::Instance(), sim::LArG4Parameters::KeepEMShowerDaughters(), larg4::LArVoxelReadout::Setup_t::offPlaneMargin, geo::GeometryCore::OpDetGeoName(), sim::LArG4Parameters::ParticleKineticEnergyCut(), larg4::LArVoxelReadoutGeometry::Setup_t::readoutSetup, art::EngineCreator::rng(), g4b::G4Helper::SetOverlapCheck(), g4b::G4Helper::SetParallelWorlds(), g4b::G4Helper::SetUserAction(), sim::LArG4Parameters::StoreTrajectories(), and larg4::MaterialPropertyLoader::UpdateGeometry().
|
virtual |
Reimplemented from art::EDProducer.
Definition at line 504 of file LArG4_module.cc.
References CreateParticleVolumeFilter(), fKeepParticlesInVolumes, fparticleListAction, and larg4::ParticleListAction::ParticleFilter().
|
inherited |
|
inherited |
Definition at line 147 of file Consumer.h.
References art::InputTag::instance(), art::InputTag::label(), and art::InputTag::process().
|
inherited |
Definition at line 162 of file Consumer.h.
|
inherited |
|
inherited |
Definition at line 172 of file Consumer.h.
References art::InputTag::instance(), art::InputTag::label(), and art::InputTag::process().
|
inherited |
Definition at line 26 of file EngineCreator.cc.
References art::EngineCreator::rng().
Referenced by evgen::CosmicsGen::CosmicsGen(), rndm::NuRandomService::createEngine(), cluster::fuzzyCluster::fuzzyCluster(), cluster::HoughLineFinder::HoughLineFinder(), art::MixFilter< T >::initEngine_(), LArG4(), evgen::LightSource::LightSource(), evgen::NeutronOsc::NeutronOsc(), evgen::NucleonDecay::NucleonDecay(), opdet::OpMCDigi::OpMCDigi(), opdet::OptDetDigitizer::OptDetDigitizer(), phot::PhotonLibraryPropagation::PhotonLibraryPropagation(), detsim::SimDriftElectrons::SimDriftElectrons(), evgen::SingleGen::SingleGen(), evgen::SNNueAr40CCGen::SNNueAr40CCGen(), ToyOneShowerGen::ToyOneShowerGen(), and trkf::Track3DKalman::Track3DKalman().
|
inherited |
Definition at line 32 of file EngineCreator.cc.
References art::EngineCreator::rng().
|
inherited |
Definition at line 40 of file EngineCreator.cc.
References art::EngineCreator::rng().
|
private |
Configures and returns a particle filter.
Definition at line 513 of file LArG4_module.cc.
Referenced by beginRun().
|
protectedinherited |
|
inherited |
Definition at line 49 of file EngineCreator.cc.
References fhicl::ParameterSet::get().
Referenced by art::MixFilter< T >::initEngine_().
|
inlineinherited |
|
inherited |
Definition at line 56 of file ProducerBase.h.
References B, and art::ModuleDescription::moduleLabel().
Referenced by art::ProducerBase::modifiesEvent().
|
inherited |
|
inherited |
Definition at line 190 of file Consumer.h.
References art::InputTag::instance(), art::InputTag::label(), and art::InputTag::process().
|
inherited |
Definition at line 205 of file Consumer.h.
|
inherited |
|
inherited |
Definition at line 215 of file Consumer.h.
References art::InputTag::instance(), art::InputTag::label(), and art::InputTag::process().
|
inlineinherited |
Definition at line 40 of file ProducerBase.h.
References art::ProducerBase::getProductID().
|
staticinherited |
Definition at line 76 of file Consumer.cc.
Referenced by art::RootOutput::beginSubRun(), art::OutputModule::doBeginRun(), art::OutputModule::doBeginSubRun(), art::OutputModule::doEndRun(), art::OutputModule::doEndSubRun(), art::ProducingService::doPostReadEvent(), art::ProducingService::doPostReadRun(), art::ProducingService::doPostReadSubRun(), art::OutputModule::doWriteEvent(), art::ProcessPackage< L >::postScheduleSignal(), art::BeginEndPackage< Level::Run >::Begin::postScheduleSignal(), art::BeginEndPackage< Level::Run >::End::postScheduleSignal(), art::BeginEndPackage< Level::SubRun >::Begin::postScheduleSignal(), art::BeginEndPackage< Level::SubRun >::End::postScheduleSignal(), art::ProcessPackage< L >::preScheduleSignal(), art::BeginEndPackage< Level::Run >::Begin::preScheduleSignal(), art::BeginEndPackage< Level::SubRun >::Begin::preScheduleSignal(), art::EventProcessor::readEvent(), art::EventProcessor::readRun(), art::EmptyEvent::readRun_(), art::EventProcessor::readSubRun(), and art::EmptyEvent::readSubRun_().
|
protectedinherited |
Definition at line 89 of file Consumer.cc.
References fhicl::ParameterSet::get_if_present().
Referenced by art::EDProducer::doBeginJob(), art::EDFilter::doBeginJob(), and art::EDAnalyzer::doBeginJob().
|
virtual |
The main routine of this module: Fetch the primary particles from the event, simulate their evolution in the detctor, and produce the detector response.
Implements art::EDProducer.
Definition at line 563 of file LArG4_module.cc.
References geo::GeometryCore::AuxDet(), sim::SimChannel::Channel(), larg4::AuxDetReadout::clear(), larg4::OpDetPhotonTable::ClearEnergyDeposits(), larg4::OpDetPhotonTable::ClearTable(), geo::GeometryCore::Cryostat(), DEFINE_ART_MODULE, sim::SimPhotonsLite::DetectedPhotons, sim::dump::DumpMCParticle(), sim::dump::DumpMCTruth(), fdumpParticleList, fdumpSimChannels, fG4Help, sim::LArG4Parameters::FillSimEnergyDeposits(), fInputLabels, fparticleListAction, fSparsifyTrajectories, fUseLitePhotons, g4b::G4Helper::G4Run(), art::Ptr< T >::get(), larg4::AuxDetReadout::GetAuxDetSimChannel(), art::DataViewImpl::getByLabel(), larg4::OpDetPhotonTable::GetLitePhotons(), art::DataViewImpl::getManyByType(), larg4::OpDetPhotonTable::GetPhotons(), larg4::ParticleListAction::GetPrimaryTruthIndex(), larg4::LArVoxelReadout::GetSimChannelMap(), larg4::OpDetPhotonTable::GetSimEnergyDeposits(), art::Event::id(), larg4::OpDetPhotonTable::Instance(), larg4::ParticleListAction::isDropped(), LOG_DEBUG, art::errors::LogicError, simb::MCParticle::Mother(), geo::GeometryCore::NAuxDets(), geo::GeometryCore::Ncryostats(), sim::LArG4Parameters::NoElectronPropagation(), geo::GeometryCore::NOpDets(), sim::LArG4Parameters::NoPhotonPropagation(), geo::AuxDetGeo::NSensitiveVolume(), geo::CryostatGeo::NTPC(), sim::SimPhotonsLite::OpChannel, art::Handle< T >::provenance(), art::Event::put(), larg4::ParticleListAction::ResetTrackIDOffset(), simb::MCParticle::SparsifyTrajectory(), sim::SimChannel::TDCIDEMap(), simb::MCParticle::TrackId(), larg4::ParticleListAction::YieldList(), and larg4::OpDetPhotonTable::YieldOpDetBacktrackerRecords().
|
protectedinherited |
Definition at line 125 of file Consumer.cc.
Referenced by art::EDProducer::doEndJob(), art::EDFilter::doEndJob(), art::EDAnalyzer::doEndJob(), and art::RootOutput::endJob().
|
protectedinherited |
Definition at line 101 of file Consumer.cc.
References art::errors::ProductRegistrationFailure.
|
private |
Whether to use the G4 overlap checker.
Definition at line 318 of file LArG4_module.cc.
Referenced by beginJob().
|
private |
Whether each event's sim::ParticleList will be displayed.
Definition at line 319 of file LArG4_module.cc.
Referenced by produce().
|
private |
Whether each event's sim::Channel will be displayed.
Definition at line 320 of file LArG4_module.cc.
Referenced by produce().
|
private |
G4 interface object.
Definition at line 311 of file LArG4_module.cc.
Referenced by beginJob(), produce(), and ~LArG4().
|
private |
directory path for Geant4 macro file to be executed before main MC processing.
Definition at line 316 of file LArG4_module.cc.
Referenced by beginJob(), and LArG4().
|
private |
predefined physics list to use if not making a custom one
Definition at line 315 of file LArG4_module.cc.
Referenced by beginJob().
|
private |
Definition at line 325 of file LArG4_module.cc.
|
private |
Only write particles that have trajectories through these volumes.
Definition at line 326 of file LArG4_module.cc.
Referenced by beginRun().
|
private |
Geant4 user action to accumulate LAr voxel information.
Definition at line 312 of file LArG4_module.cc.
|
private |
dictate how tracks are put on stack.
Off-plane charge recovery margin
Definition at line 323 of file LArG4_module.cc.
Referenced by beginJob().
|
private |
Geant4 user action to particle information.
Definition at line 313 of file LArG4_module.cc.
Referenced by beginJob(), beginRun(), and produce().
|
private |
Whether to instantiate and use class to.
Definition at line 322 of file LArG4_module.cc.
Referenced by beginJob().
|
private |
Sparsify MCParticle Trajectories.
Definition at line 328 of file LArG4_module.cc.
|
private |
Definition at line 321 of file LArG4_module.cc.