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;
process_name can override from command line with o or output calo
auto end(FixedBins< T, C > const &) noexcept
float dEdx(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, const TCSlice &slc, TP3D &tp3d)