13 std::vector<double> fakeTpc0Flashes;
14 std::vector<double> fakeTpc1Flashes;
21 for (
auto const particle: particles){
25 double time = particle.T() * 1
e-3;
30 if(!(pdg==13||pdg==11||pdg==22||pdg==2212||pdg==211||pdg==321||pdg==111))
continue;
33 int npts = particle.NumberTrajectoryPoints();
34 double TPC0Energy = 0;
35 double TPC1Energy = 0;
36 for(
int i = 1; i < npts; i++){
38 pt.SetX(particle.Vx(i)); pt.SetY(particle.Vy(i)); pt.SetZ(particle.Vz(i));
41 if(pt.X() <= 0) TPC0Energy += particle.E(i-1) - particle.E(i);
42 else TPC1Energy += particle.E(i-1) - particle.E(i);
45 if(TPC0Energy > 0.01) fakeTpc0Flashes.push_back(time);
46 else if(TPC1Energy > 0.01) fakeTpc1Flashes.push_back(time);
49 std::sort(fakeTpc0Flashes.begin(), fakeTpc0Flashes.end());
50 double previousTime = -99999;
52 for(
size_t i = 0; i < fakeTpc0Flashes.size(); i++){
53 double time = fakeTpc0Flashes[i];
55 if(
std::abs(time-previousTime) < 0.01){
56 fakeTpc0Flashes.erase(fakeTpc0Flashes.begin()+i);
58 else previousTime = time;
61 std::sort(fakeTpc1Flashes.begin(), fakeTpc1Flashes.end());
62 previousTime = -99999;
64 for(
size_t i = 0; i < fakeTpc1Flashes.size(); i++){
65 double time = fakeTpc1Flashes[i];
67 if(
std::abs(time-previousTime) < 0.01){
68 fakeTpc1Flashes.erase(fakeTpc1Flashes.begin()+i);
70 else previousTime = time;
73 return std::make_pair(fakeTpc0Flashes, fakeTpc1Flashes);
79 bool beamFlash =
false;
80 std::sort(flashes.begin(), flashes.end());
82 for(
size_t i = 0; i < flashes.size(); i++){
83 double time = flashes[i];
84 if(time > beamTimeMin && time < beamTimeMax) beamFlash =
true;
bool BeamFlash(std::vector< double > flashes, double beamTimeMin, double beamTimeMax)
std::pair< std::vector< double >, std::vector< double > > FakeTpcFlashes(std::vector< simb::MCParticle > particles)
stream1 can override from command line with o or output services user sbnd
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
bool InFiducial(geo::Point_t point, double fiducial)