229 std::unique_ptr<std::vector<simb::MCFlux>> mcfluxColl(
new std::vector<simb::MCFlux>);
230 std::unique_ptr<std::vector<simb::MCTruth>> mctruthColl(
new std::vector<simb::MCTruth>);
231 std::unique_ptr<art::Assns<simb::MCTruth, simb::MCFlux>> truth2fluxAssn(
new art::Assns<simb::MCTruth, simb::MCFlux>);
232 std::unique_ptr<std::vector<sim::BeamGateInfo>> beamgateColl(
new std::vector<sim::BeamGateInfo>);
234 std::unique_ptr<std::vector<evgen::ldm::MeVPrtlTruth>> mevprtlColl(
new std::vector<evgen::ldm::MeVPrtlTruth>);
242 simb::MCFlux kaon =
fGenTool->GetNext();
245 std::chrono::duration<double, std::milli> duration = t2 - t1;
246 fNTime[0] = duration.count();
249 bool is_kaon = kaonp.kaon_pdg != 0;
253 std::cout <<
"Flux is kaon (" << is_kaon <<
"). Weight: " << kaonp.weight <<
". Produced with energy: " << kaonp.mom.E()
254 <<
" M=" << kaonp.mom.M() <<
" P=(" << kaonp.mom.Px() <<
", " << kaonp.mom.Py() <<
", " << kaonp.mom.Pz() <<
") At: ("
255 << kaonp.pos.X() <<
", " << kaonp.pos.Y() <<
", " << kaonp.pos.Z() <<
")" << std::endl;
268 fNTime[1] += duration.count();
270 if (!success)
continue;
272 std::cout <<
"New flux. E=" << flux.
mom.E() <<
" At: (" << flux.
pos.X() <<
", " << flux.
pos.Y() <<
", " << flux.
pos.Z() <<
")" << std::endl;
273 std::cout <<
"P=(" << flux.
mom.Px() <<
", " << flux.
mom.Py() <<
", " << flux.
mom.Pz() <<
")" << std::endl;
274 std::cout <<
"Flux weight: " << flux_weight << std::endl;
276 std::array<TVector3, 2> intersection;
281 success =
fRayTool->IntersectDetector(flux, intersection, ray_weight);
284 fNTime[2] += duration.count();
286 if (!success)
continue;
287 std::cout <<
"Ray weight: " << ray_weight << std::endl;
294 success =
fDecayTool->Decay(flux, intersection[0], intersection[1], decay, decay_weight);
297 fNTime[3] += duration.count();
299 if (!success)
continue;
301 std::cout <<
"Decay weight: " << decay_weight << std::endl;
304 double ray_decay_weight = ray_weight * decay_weight;
307 if (!success)
continue;
309 std::cout <<
"RayDecay weight: " << ray_decay_weight << std::endl;
314 double thisPOT =
fGenTool->GetPOT();
318 thisPOT = thisPOT / (flux_weight * ray_decay_weight);
322 ray_decay_weight = 1.;
336 mevprtlColl->push_back(mevprtl_truth);
338 simb::MCTruth mctruth;
343 simb::MCParticle fakenu(0, kaon.fntype,
"primary", -1, 0, -1);
344 fakenu.AddTrajectoryPoint(mevprtl_truth.decay_pos, TLorentzVector(0, 0, flux.
equiv_enu, flux.
equiv_enu));
346 mctruth.SetNeutrino(-1, -1, -1, -1, -1, -1,
349 for (
unsigned i_d = 0; i_d < mevprtl_truth.daughter_mom.size(); i_d++) {
350 TLorentzVector daughter4p(mevprtl_truth.daughter_mom[i_d], mevprtl_truth.daughter_e[i_d]);
351 simb::MCParticle d(0, mevprtl_truth.daughter_pdg[i_d],
"primary", -1, daughter4p.M());
352 d.AddTrajectoryPoint(mevprtl_truth.decay_pos, daughter4p);
366 mctruthColl->push_back(mctruth);
367 mcfluxColl->push_back(kaon);
372 art::PtrMaker<simb::MCFlux> MCFluxPtrMaker {
evt};
373 art::PtrMaker<simb::MCTruth> MCTruthPtrMaker {
evt};
375 art::Ptr<simb::MCTruth> MCTruthPtr = MCTruthPtrMaker(mctruthColl->size() - 1);
376 art::Ptr<simb::MCFlux> MCFluxPtr = MCFluxPtrMaker(mcfluxColl->size() - 1);
377 truth2fluxAssn->addSingle(MCTruthPtr, MCFluxPtr);
382 beamgateColl->push_back(gate);
393 evt.put(std::move(mctruthColl));
394 evt.put(std::move(mcfluxColl));
395 evt.put(std::move(truth2fluxAssn));
396 evt.put(std::move(beamgateColl));
398 evt.put(std::move(mevprtlColl));
std::array< double, 4 > fNTime
std::unique_ptr< evgen::ldm::IMeVPrtlDecay > fDecayTool
bool Deweight(double &weight, double &max_weight)
std::unique_ptr< evgen::ldm::IRayTrace > fRayTool
std::array< uint64_t, 4 > fNCalls
double fRayDecayMaxWeight
BEGIN_PROLOG could also be cout
std::unique_ptr< evgen::ldm::IMesonGen > fGenTool
std::unique_ptr< evgen::ldm::IMeVPrtlFlux > fFluxTool