26 #include "TLorentzVector.h" 71 Comment(
"length of the particle path [cm]")
76 Comment(
"initial energy of the particle [GeV]")
81 Comment(
"particle type (as PDG ID)")
93 Comment(
"list of particle specification")
114 : length(config.length())
115 , energy(config.energy())
116 , type(config.type())
143 fParticleSpecs.assign(particleSpecs.begin(), particleSpecs.end());
148 produces<std::vector<simb::MCParticle>>();
161 auto particles = std::make_unique<std::vector<simb::MCParticle>>();
166 static std::array<TVector3, 6U>
const Dirs = {{
179 int const motherID = trackID - 1;
180 if (motherID >= 0) (*particles)[motherID].AddDaughter(trackID);
182 particles->emplace_back(
190 auto const&
dir = Dirs[trackID % 6];
191 TLorentzVector
const mom{ specs.energy *
dir, specs.energy };
192 unsigned int const nSteps = std::ceil(specs.length);
194 for (
unsigned int i = 1; i <= nSteps; ++i) {
195 double const stepSize =
std::min(specs.length -
double(i - 1), 1.0);
196 pos += TLorentzVector{
dir * stepSize, 1.0 };
208 <<
"Created " << particles->size() <<
" space points.";
fhicl::Atom< double > energy
Utilities to extend the interface of geometry vectors.
virtual void produce(art::Event &event) override
Create and add the particles (the same for all events).
void AddTrajectoryPoint(TLorentzVector const &position, TLorentzVector const &momentum)
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
Creates a collection of simulated particles.
EDProducer(fhicl::ParameterSet const &pset)
ChannelGroupService::Name Name
ParticleMaker(Parameters const &config)
Constructor; see the class documentation for the configuration.
#define DEFINE_ART_MODULE(klass)
fhicl::Sequence< fhicl::Table< ParticleConfig > > particles
Vector rounded01(Vector const &v, Scalar tol)
Returns a vector with all components rounded if close to 0, -1 or +1.
std::vector< ParticleSpecs > fParticleSpecs
Settings for particles.
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
LArSoft-specific namespace.
Definitions of geometry vector data types.
ParticleSpecs(ParticleConfig const &config)
fhicl::Atom< double > length
Event finding and building.