66 #include "cetlib_except/exception.h" 68 #include "TLorentzVector.h" 102 produces< std::vector<simb::MCTruth> >();
103 produces< sumdata::RunData, art::InRun >();
120 <<
" cannot be read.\n";
133 run.
put(std::move(runcol));
145 <<
" cannot be read in produce().\n";
148 std::unique_ptr< std::vector<simb::MCTruth> > truthcol(
new std::vector<simb::MCTruth>);
153 unsigned short nParticles = 0;
157 int secondMother = 0;
158 int firstDaughter = 0;
159 int secondDaughter = 0;
160 double xMomentum = 0.;
161 double yMomentum = 0.;
162 double zMomentum = 0.;
165 double xPosition = 0.;
166 double yPosition = 0.;
167 double zPosition = 0.;
173 std::istringstream inputLine;
174 inputLine.str(oneLine);
176 inputLine >>
event >> nParticles;
181 for(
unsigned short i = 0; i < nParticles; ++i){
184 inputLine.str(oneLine);
186 inputLine >> status >> pdg
187 >> firstMother >> secondMother >> firstDaughter >> secondDaughter
188 >> xMomentum >> yMomentum >> zMomentum >> energy >> mass
189 >> xPosition >> yPosition >> zPosition >> time;
193 double totmom = sqrt(pow(xMomentum,2)+pow(yMomentum,2)+pow(zMomentum,2));
194 double kx = xMomentum/totmom;
195 double ky = yMomentum/totmom;
196 double kz = zMomentum/totmom;
198 double l = (
fMoveY-yPosition)/ky;
205 TLorentzVector pos(xPosition, yPosition, zPosition, time);
206 TLorentzVector mom(xMomentum, yMomentum, zMomentum, energy);
214 truthcol->push_back(truth);
216 e.
put(std::move(truthcol));
227 mf::LogWarning(
"TextFileGen")<<
"Particles will be moved to a new plane y = "<<fMoveY<<
" cm.\n";
void AddTrajectoryPoint(TLorentzVector const &position, TLorentzVector const &momentum)
void produce(art::Event &e) override
art::ProductID put(std::unique_ptr< PROD > &&)
void Add(simb::MCParticle &part)
ProductID put(std::unique_ptr< PROD > &&product)
std::string fInputFileName
Name of text file containing events to simulate.
std::ifstream * fInputFile
#define DEFINE_ART_MODULE(klass)
std::string DetectorName() const
Returns a string with the name of the detector, as configured.
T get(std::string const &key) const
void beginRun(art::Run &run) override
TextFileGen(fhicl::ParameterSet const &p)
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
Event generator information.
Namespace collecting geometry-related classes utilities.
void reconfigure(fhicl::ParameterSet const &p)
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