12 #include "TDatabasePDG.h" 19 #include "TLorentzVector.h" 32 #include "art_root_io/TFileService.h" 33 #include "art_root_io/TFileDirectory.h" 36 #include "cetlib_except/exception.h" 41 #include "nugen/EventGeneratorBase/evgenbase.h" 46 #include "TDatabasePDG.h" 101 static TDatabasePDG pdgt;
102 TParticlePDG* pdgp = pdgt.GetParticle(
pdg);
103 if (pdgp)
m = pdgp->Mass();
127 Name(
"EventsToProcess"),
128 Comment(
"Number of events to process")
133 Comment(
"First event to process")
142 Name(
"GetEnergyFromCORSIKA"),
143 Comment(
"true: read particle energy from CORSIKA histograms as a fucntion of azimuth angle")
147 Name(
"UniformEnergyMin"),
148 Comment(
"Minimum particle energy")
152 Name(
"UniformEnergyMax"),
153 Comment(
"Maximum particle energy")
163 Comment(
"CORSIKA histogram file")
199 : EDProducer{config},
209 produces< std::vector<simb::MCTruth> >();
210 produces< sumdata::RunData, art::InRun >();
220 gRandom =
new TRandom3();
223 std::ifstream trackfile;
225 if( !trackfile.is_open() )
228 TFile *chistfile =
new TFile(
fHistFile.c_str());
229 if( chistfile->IsOpen() == kFALSE )
232 std::stringstream hetss;
233 hetss <<
"hEnergyTheta" <<
fPDG;
234 TH2D *hEnergyTheta = (TH2D*)chistfile->Get(hetss.str().c_str());
238 int trackCounter=0, skippedTrackCounter=0;
240 std::getline(trackfile, line);
241 while(std::getline( trackfile, line )){
242 std::stringstream sstream(line);
244 int eventID = 9999999;
269 int biny = hEnergyTheta->GetYaxis()->FindBin(theta);
270 TH1D *hEnergyAtTheta = hEnergyTheta->ProjectionX(
"", biny, biny);
272 if( hEnergyAtTheta->GetEntries() < 1 ){
273 skippedTrackCounter++;
278 track->
energy = hEnergyAtTheta->GetRandom();
289 if( track->
event != eventBefore ){
290 eventBefore = track->
event;
307 std::unique_ptr< std::vector<simb::MCTruth> > truthcol(
new std::vector<simb::MCTruth>);
316 simb::MCParticle particle( trackCtr, track->pdg ,
"primary",-200, track->m , 1 );
324 truthcol->push_back(truth);
void AddTrajectoryPoint(TLorentzVector const &position, TLorentzVector const &momentum)
TLorentzVector getPosition()
void SetOrigin(simb::Origin_t origin)
ChannelGroupService::Name Name
art framework interface to geometry description
#define DEFINE_ART_MODULE(klass)
ProductID put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
std::map< int, std::vector< Track * > > fEventTrackMap
void Add(simb::MCParticle const &part)
void line(double t, double *p, double &x, double &y, double &z)
EventNumber_t event() const
TrackCollectionProxyElement< TrackCollProxy > Track
Proxy to an element of a proxy collection of recob::Track objects.
Event generator information.
def momentum(x1, x2, x3, scale=1.)
TLorentzVector getMomentum()
DataGen311(Parameters const &config)
void produce(art::Event &e) override
cet::coded_exception< error, detail::translate > exception
bool fGetEnergyFromCORSIKA