42 if(calos.size()==0)
return -99999;
46 art::Ptr<anab::Calorimetry>
calo = calos[0];
47 for(
size_t i = calos.size(); i > 0; i--){
48 if(calos[i-1]->
dEdx().size() > nhits*1.5){
49 nhits = calos[i-1]->dEdx().size();
55 if(calo->XYZ().size() != nhits || nhits < 1)
return -99999;
58 double distStart = (calo->XYZ()[0] -
end).Mag2();
59 double distEnd = (calo->XYZ()[nhits-1] -
end).Mag2();
62 double resrgStart = 0;
63 std::vector<double> v_resrg;
64 std::vector<double> v_dedx;
66 for(
size_t i = 0; i < nhits; i++){
67 double dedx = calo->dEdx()[i];
68 double resrg = calo->ResidualRange()[i];
71 if(distStart < distEnd && calo->ResidualRange()[0] > calo->ResidualRange()[nhits-1]) resrg = calo->ResidualRange()[0] - calo->ResidualRange()[i];
72 if(distStart > distEnd && calo->ResidualRange()[0] < calo->ResidualRange()[nhits-1]) resrg = calo->ResidualRange()[nhits-1] - calo->ResidualRange()[i];
75 if(resrg < fResRangeMin && dedx > maxDedx && dedx <
fDEdxMax){
83 for(
size_t i = 0; i < nhits; i++){
84 double dedx = calo->dEdx()[i];
85 double resrg = calo->ResidualRange()[i];
88 if(distStart < distEnd && calo->ResidualRange()[0] > calo->ResidualRange()[nhits-1]) resrg = calo->ResidualRange()[0] - calo->ResidualRange()[i];
89 if(distStart > distEnd && calo->ResidualRange()[0] < calo->ResidualRange()[nhits-1]) resrg = calo->ResidualRange()[nhits-1] - calo->ResidualRange()[i];
93 v_resrg.push_back(resrg);
94 v_dedx.push_back(dedx);
99 if(v_dedx.size() < 10)
return -99999;
102 TGraph *gdedx =
new TGraph(v_dedx.size(), &v_resrg[0], &v_dedx[0]);
103 try{ gdedx->Fit(
"pol0",
"Q"); }
catch(...){
return -99999; }
104 TF1* polfit = gdedx->GetFunction(
"pol0");
105 double polchi2 = polfit->GetChisquare();
108 try{ gdedx->Fit(
"expo",
"Q"); }
catch(...){
return -99999; }
109 TF1* expfit = gdedx->GetFunction(
"expo");
110 double expchi2 = expfit->GetChisquare();
113 return polchi2/expchi2;
142 if((startStops && !endInFiducial && track.
End().Y() > track.
Vertex().Y())
143 || (endStops && !startInFiducial && track.
Vertex().Y() > track.
End().Y())){
161 if((startStops && !endInFiducial && track2.
End().Y() > 0)
162 || (endStops && !startInFiducial && track.
End().Y() > 0)){
fhicl::Table< Containment > ContainmentCuts
bool StoppingEnd(geo::Point_t end, std::vector< art::Ptr< anab::Calorimetry >> calos)
fhicl::Atom< double > DEdxMax
~StoppingParticleCosmicIdAlg()
void reconfigure(const Config &config)
process_name use argoneut_mc_hitfinder track
double fStoppingChi2Limit
double StoppingChiSq(geo::Point_t end, std::vector< art::Ptr< anab::Calorimetry >> calos)
process_name can override from command line with o or output calo
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
fhicl::Atom< double > ResRangeMin
StoppingParticleCosmicIdAlg(const Config &config)
bool StoppingParticleCosmicId(recob::Track track, std::vector< art::Ptr< anab::Calorimetry >> calos)
fhicl::Atom< double > ResRangeMax
Point_t const & Vertex() const
auto end(FixedBins< T, C > const &) noexcept
float dEdx(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, const TCSlice &slc, TP3D &tp3d)
fhicl::Atom< double > StoppingChi2Limit
Point_t const & End() const
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.
Track from a non-cascading particle.A recob::Track consists of a recob::TrackTrajectory, plus additional members relevant for a "fitted" track:
bool InFiducial(geo::Point_t point, double fiducial)