10 #include "Framework/ParticleData/PDGUtils.h"
12 #include "messagefacility/MessageLogger/MessageLogger.h"
28 fBNBtree =
dynamic_cast<TTree*
>(fluxInputFile->Get(
"h201"));
40 fWindowtree =
dynamic_cast<TTree*
>(fluxInputFile->Get(
"h220"));
50 mf::LogInfo(
"BooNEInterface") <<
"Reading " <<
fNEntries <<
" events" << std::endl;
56 std::string run_number = fluxInputFile->GetName();
57 std::regex
r(
"\\d\\d\\d\\d");
59 std::regex_search(run_number,m,r);
61 std::istringstream buffer(m[0].str().c_str());
65 for (
int iev = 0 ; iev <
fNEntries ; iev++ ) {
72 mf::LogInfo(
"BooNEInterface") <<
"Min Weight: " <<
fMinWeight
93 mf::LogDebug(
"BooNEInterface") <<
"At entry: " << ientry << std::endl;
111 mf::LogWarning(
"BooNEInterface") <<
"Neutrino type not recognized! ntp = " <<
fBooneNtp.
ntp
133 double gsimple_vtxx = nu_x + (nu_momx / nu_momz) * (tank_z - nu_z) + targ_x;
134 double gsimple_vtxy = nu_y + (nu_momy / nu_momz) * (tank_z - nu_z) + targ_y;
135 double gsimple_vtxz = tank_z+targ_z;
138 double dist = std::sqrt(std::pow(nu_x-gsimple_vtxx,2) +
139 std::pow(nu_y-gsimple_vtxy,2) +
140 std::pow(nu_z-tank_z,2));
145 nu_time += dist / (TMath::C() / 1e9);
147 mf::LogDebug(
"BooNEInterface") <<
"weight = " << flux.fnimpwt
148 <<
", nu time = " << nu_time
150 <<
", dist = " << dist
153 fNuPos = TLorentzVector(gsimple_vtxx * 100,
165 flux.fevtno = ientry;
183 double apppz = flux.fpppz;
184 if (TMath::Abs(flux.fpppz) < 1.0e-30) apppz = 1.0e-30;
185 flux.fppdxdz = pppx / apppz;
186 flux.fppdydz = pppy / apppz;
195 if (ptype_input != 0) ptype_input = genie::pdg::GeantToPdg(ptype_input);
196 if (tptype_input != 0) tptype_input= genie::pdg::GeantToPdg(tptype_input);
198 flux.fptype = ptype_input;
199 flux.ftptype = tptype_input;
220 double parent_mass = std::sqrt(ppenergy * ppenergy -
221 pppz * pppz * (ppdxdz * ppdxdz +
225 double parent_energy = std::sqrt(pdPx * pdPx +
228 parent_mass * parent_mass);
230 double gamma = parent_energy / parent_mass;
232 beta[0] = pdPx / parent_energy;
233 beta[1] = pdPy / parent_energy;
234 beta[2] = pdPz / parent_energy;
241 double Necm = gamma * Nenergy - partial;
249 if (fabs((parent_mass*parent_mass-0.105658389*0.105658389)/(2.*parent_mass)-Necm)/Necm <= 0.001)
259 if (fabs((parent_mass*parent_mass-0.105658389*0.105658389)/(2.*parent_mass)-Necm)/Necm <= 0.001) {
295 flux.fmuparpx = muparpx;
296 flux.fmuparpy = muparpy;
297 flux.fmuparpz = muparpz;
298 flux.fmupare = mupare;
300 flux.fnwtnear = flux.fnwtfar = 1;
float ini_t[20]
E of particle in before chain, array length 'npart'.
int npart
1,2,3,4: nue, nuebar, numu, numubar
float ini_pos[20][3]
id of each particle in before chain, array length 'npart'
float windowbase[3]
pot in the file
float ini_eng[20]
3-mom of particle in before chain, array length 'npart'
float pot
Frame conversion from beam to flux frame.
tuple m
now if test mode generate materials, CRT shell, world, gdml header else just generate CRT shell for u...
bool FillMCFlux(Long64_t ientry, simb::MCFlux &mcflux)
Interface to read flux files in BooNE tuple format.
void SetRootFile(TFile *rootFileName)
float windowdir2[3]
Flux window direction vector 1.
float windowdir1[3]
Flux window base vector.
float ini_mom[20][3]
3-pos of particle in before chain, array length 'npart'
constexpr double dist(const TReal *x, const TReal *y, const unsigned int dimension)
float targ_pos_beam[3]
3-position of the flux window;
float fin_pol[20][3]
final 3-mom of particle in before chain, array length 'npart'
int ntp
Magic Weight: CrossSect * BooBeamNT.
BEGIN_PROLOG could also be cout