63 std::vector<anab::sParticleIDAlgScores> AlgScoresVec;
66 for (
size_t i_calo = 0; i_calo < calos.size(); i_calo++){
68 art::Ptr<anab::Calorimetry> calo = calos.at(i_calo);
71 else if(plid != calo->
PlaneID())
72 throw cet::exception(
"Chi2PIDAlg") <<
"PlaneID mismatch: " << plid <<
", " << calo->
PlaneID();
80 std::vector<double> vpida;
81 std::vector<float> trkdedx = calo->dEdx();
82 std::vector<float> trkres = calo->ResidualRange();
83 std::vector<float> deadwireresrc = calo->DeadWireResRC();
86 for (
unsigned i = 0; i<trkdedx.size(); ++i){
88 if (i==0 || i==trkdedx.size()-1)
continue;
89 avgdedx += trkdedx[i];
91 PIDA += trkdedx[i]*pow(trkres[i],0.42);
92 vpida.push_back(trkdedx[i]*pow(trkres[i],0.42));
95 if (trkdedx[i]>1000)
continue;
97 if (bin>=1&&bin<=dedx_range_pro->GetNbinsX()){
131 double errdedx = 0.04231+0.0001783*trkdedx[i]*trkdedx[i];
132 errdedx *= trkdedx[i];
133 chi2pro += pow((trkdedx[i]-bincpro)/std::sqrt(pow(binepro,2)+pow(errdedx,2)),2);
134 chi2ka += pow((trkdedx[i]-bincka)/std::sqrt(pow(bineka,2)+pow(errdedx,2)),2);
135 chi2pi += pow((trkdedx[i]-bincpi)/std::sqrt(pow(binepi,2)+pow(errdedx,2)),2);
136 chi2mu += pow((trkdedx[i]-bincmu)/std::sqrt(pow(binemu,2)+pow(errdedx,2)),2);
157 chi2proton.
fNdf = npt;
158 chi2proton.
fValue = chi2pro/npt;
166 chi2muon.
fValue = chi2mu/npt;
174 chi2kaon.
fValue = chi2ka/npt;
182 chi2pion.
fValue = chi2pi/npt;
184 AlgScoresVec.push_back(chi2proton);
185 AlgScoresVec.push_back(chi2muon);
186 AlgScoresVec.push_back(chi2kaon);
187 AlgScoresVec.push_back(chi2pion);
193 pida_median.
fAlgName =
"PIDA_median";
196 pida_median.
fValue = TMath::Median(vpida.size(), &vpida[0]);
198 AlgScoresVec.push_back(pida_median);
204 pida_mean.
fValue = PIDA/used_trkres;
206 AlgScoresVec.push_back(pida_mean);
TProfile * dedx_range_mu
muon template
The data type to uniquely identify a Plane.
TProfile * dedx_range_pro
proton template
TProfile * dedx_range_pi
pion template
float fValue
Result of Particle ID algorithm/test.
std::bitset< 8 > fPlaneMask
Bitset for PlaneID used by algorithm, allowing for multiple planes and up to 8 total planes...
constexpr details::BinObj< T > bin(T value)
Returns a wrapper to print the specified data in binary format.
std::string fAlgName
< determined particle ID
int fNdf
Number of degrees of freedom used by algorithm, if applicable. Set to -9999 by default.
kTrackDir fTrackDir
Track direction enum: defined in ParticleID_VariableTypeEnums.h. Set to kNoDirection by default...
kVariableType fVariableType
Variable type enum: defined in ParticleID_VariableTypeEnums.h. Set to kNotSet by default.
constexpr PlaneID()=default
Default constructor: an invalid plane ID.
std::bitset< 8 > GetBitset(geo::PlaneID planeID)
TProfile * dedx_range_ka
kaon template
int fAssumedPdg
PDG of particle hypothesis assumed by algorithm, if applicable. Set to 0 by default.