68 #include "cetlib_except/exception.h" 72 #include "TLorentzVector.h" 92 std::pair<unsigned, unsigned>
readEventInfo(std::istream& is);
103 ,
fOffset{p.get<
unsigned long int>(
"Offset")}
106 ,
fMoveY{p.get<
double>(
"MoveY", -1e9)}
113 produces<std::vector<simb::MCTruth>>();
114 produces<sumdata::RunData, art::InRun>();
127 for (
unsigned i = 0; i !=
fOffset; ++i) {
129 for (
unsigned p = 0; p != nparticles; ++p) {
130 constexpr
auto all_chars_until = std::numeric_limits<unsigned>::max();
149 <<
"input text file " <<
fInputFileName <<
" cannot be read in produce().\n";
156 <<
"input text file " <<
fInputFileName <<
" cannot be read in produce().\n";
157 auto truthcol = std::make_unique<std::vector<simb::MCTruth>>();
160 e.
put(std::move(truthcol));
170 int secondMother = 0;
171 int firstDaughter = 0;
172 int secondDaughter = 0;
173 double xMomentum = 0.;
174 double yMomentum = 0.;
175 double zMomentum = 0.;
178 double xPosition = 0.;
179 double yPosition = 0.;
180 double zPosition = 0.;
185 std::istringstream inputLine;
192 for (
unsigned short i = 0; i < nParticles; ++i) {
195 inputLine.str(oneLine);
197 inputLine >> status >> pdg >> firstMother >> secondMother >> firstDaughter >> secondDaughter >>
198 xMomentum >> yMomentum >> zMomentum >> energy >> mass >> xPosition >> yPosition >>
203 double totmom = sqrt(pow(xMomentum, 2) + pow(yMomentum, 2) + pow(zMomentum, 2));
204 double kx = xMomentum / totmom;
205 double ky = yMomentum / totmom;
206 double kz = zMomentum / totmom;
208 double l = (
fMoveY - yPosition) / ky;
215 TLorentzVector pos(xPosition, yPosition, zPosition, time);
216 TLorentzVector mom(xMomentum, yMomentum, zMomentum, energy);
232 std::istringstream buffer{line};
235 unsigned event, nparticles;
236 buffer >>
event >> nparticles;
237 return {event, nparticles};
std::pair< unsigned, unsigned > readEventInfo(std::istream &is)
void AddTrajectoryPoint(TLorentzVector const &position, TLorentzVector const &momentum)
unsigned long int fOffset
EDProducer(fhicl::ParameterSet const &pset)
PutHandle< PROD > put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
void produce(art::Event &e) override
PutHandle< PROD > put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
std::string fInputFileName
Name of text file containing events to simulate.
std::ifstream * fInputFile
#define DEFINE_ART_MODULE(klass)
void beginRun(art::Run &run) override
TextFileGen(fhicl::ParameterSet const &p)
void Add(simb::MCParticle const &part)
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
std::string const & DetectorName() const
Returns a string with the name of the detector, as configured.
Event generator information.
simb::MCTruth readNextHepEvt()
Namespace collecting geometry-related classes utilities.
Event Generation using GENIE, cosmics or single particles.
double fMoveY
Project particles to a new y plane.
art framework interface to geometry description
cet::coded_exception< error, detail::translate > exception
Event finding and building.