10 std::vector<TLorentzVector> traj_points)
23 double thresh = 0.001;
30 double daughter_X = daughter_pos(0);
31 double daughter_Y = daughter_pos(1);
32 double daughter_Z = daughter_pos(2);
40 uint numPoints = traj_points.size();
42 uint traj_idx = 12345;
47 for(
uint point_idx=0; point_idx < numPoints; point_idx++){
49 elem = traj_points.at(point_idx);
54 deltaX = elem_X - daughter_X;
55 deltaY = elem_Y - daughter_Y;
56 deltaZ = elem_Z - daughter_Z;
58 length =
len(deltaX, deltaY, deltaZ);
86 double len(
double x1,
double x2,
double x3)
105 if(strcmp( process.c_str(),
"Primary") == 0){
124 int prim_pdg = part->
PdgCode();
141 G4ReweightTraj theTraj(prim_id, prim_pdg, parent_id,
145 std::vector<TLorentzVector> trajPoints;
149 std::fill_n(processes, nTrajPoints,
"none");
151 std::vector<double> prim_X;
152 std::vector<double> prim_Y;
153 std::vector<double> prim_Z;
155 std::vector<double> prim_Px;
156 std::vector<double> prim_Py;
157 std::vector<double> prim_Pz;
164 for(
uint step_idx = 0; step_idx < nTrajPoints;
167 trajPoints.push_back( part->
Position(step_idx) );
185 prim_Px.push_back(part->
Px(step_idx));
186 prim_Py.push_back(part->
Py(step_idx));
187 prim_Pz.push_back(part->
Pz(step_idx));
191 const TLorentzVector prim_start = part->
Position(0);
192 const TLorentzVector prim_end = part->
Position(nTrajPoints -1);
194 for(
int i=0;
i < prim_nDaughters;
i++){
196 const int daughter_idx = part->
Daughter(
i);
201 const int daughter_pdg = daughter->
PdgCode();
204 theTraj.AddChild(
new G4ReweightTraj(daughter_idx, daughter_pdg,
205 prim_id, event, range) );
208 const TLorentzVector daughter_start = daughter->
Position(0);
215 if(trajPointIdx != 12345){
216 processes[trajPointIdx] = daughter->
Process();
225 if( strcmp( endProc.c_str(),
"hadElastic") == 0 ){
236 double deltaX = ( prim_X.at(
idx) - prim_X.at(
idx -1) );
237 double deltaY = ( prim_Y.at(
idx) - prim_Y.at(
idx -1) );
238 double deltaZ = ( prim_Z.at(
idx) - prim_Z.at(
idx -1) );
240 double length =
len(deltaX, deltaY, deltaZ);
242 double preStepP[3] = {
243 prim_Px.at(
idx-1)*1.e3,
244 prim_Py.at(
idx-1)*1.e3,
245 prim_Pz.at(
idx-1)*1.e3
248 double postStepP[3] = {
249 prim_Px.at(
idx)*1.e3,
250 prim_Py.at(
idx)*1.e3,
268 theTraj.SetEnergy(energy);
280 if(length > 250.0)
continue;
283 G4ReweightStep * theStep =
new G4ReweightStep( prim_id, prim_pdg,
288 theStep->SetDeltaX(deltaX);
289 theStep->SetDeltaY(deltaY);
290 theStep->SetDeltaZ(deltaZ);
292 theTraj.AddStep(theStep);
304 for(
uint i=0;
i<parts.size();
i++){
307 for(
uint j=0;
j<nTrajPoints;
j++){
328 for(
uint i=0;
i<parts.size();
i++){
334 part->
Position(nTrajPoints -1).Z() )
364 for(
uint i=0;
i<parts.size();
i++){
370 for(
uint j=0;
j<nTrajPoints;
j++){
unsigned int NumberTrajectoryPoints() const
const TLorentzVector & Position(const int i=0) const
const simb::MCNeutrino & GetNeutrino() const
double Py(const int i=0) const
G4ReweightTraj makeTraj(const sim::Particle *part, art::Event &evt, art::ServiceHandle< cheat::BackTracker > bt)
bool isPrimary(const sim::Particle *part)
Float_t x1[n_points_granero]
const simb::MCParticle & Nu() const
double Px(const int i=0) const
bool RockFilter_C(art::Ptr< simb::MCTruth > mctruth, art::ServiceHandle< geo::Geometry > geom)
std::pair< Spectrum *, CheatDecomp * > make_pair(SpectrumLoaderBase &loader_data, SpectrumLoaderBase &loader_mc, HistAxis *axis, Cut *cut, const SystShifts &shift, const Var &wei)
std::string Process() const
int NumberDaughters() const
int Daughter(const int i) const
bool RockFilter_D(std::vector< const sim::Particle * > parts, art::ServiceHandle< geo::Geometry > geom)
bool RockFilter_B(std::vector< const sim::Particle * > parts, art::ServiceHandle< geo::Geometry > geom)
double len(double x1, double x2, double x3)
bool isInsideDetectorBigBox(const double x_cm, const double y_cm, const double z_cm) const
Is the particle inside the detector Big Box?
bool RockFilter_A(std::vector< const sim::Particle * > parts, art::ServiceHandle< geo::Geometry > geom)
const sim::Particle * TrackIDToParticle(int const &id) const
Returns a pointer to the sim::Particle object corresponding to the given TrackID. ...
EventNumber_t event() const
double Pz(const int i=0) const
uint GetTrajPointIdx(TLorentzVector daughter_pos, std::vector< TLorentzVector > traj_points)