Skip to content
Merged
2 changes: 2 additions & 0 deletions sbnanaobj/StandardRecord/SRTrack.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include "sbnanaobj/StandardRecord/SRTrackTruth.h"
#include "sbnanaobj/StandardRecord/SRTrkChi2PID.h"
#include "sbnanaobj/StandardRecord/SRTrkLikelihoodPID.h"
#include "sbnanaobj/StandardRecord/SRTrkMCS.h"
#include "sbnanaobj/StandardRecord/SRTrkRange.h"
#include "sbnanaobj/StandardRecord/SRCRTHitMatch.h"
Expand Down Expand Up @@ -45,6 +46,7 @@ namespace caf
SRVector3D end; ///< End point of track

SRTrkChi2PID chi2pid[3]; ///< Per-plane Chi2 Particle ID
SRTrkLikelihoodPID likepid[3]; ///< Per-plane likelihood-based Particle ID variabeles (@f$ \lambda = \sum -\ln L / L_{max} @f$ where @f$\Sigma@f$ is done over hits)
SRTrackCalo calo[3]; ///< Per-plane Calorimetry information
Plane_t bestplane; ///< Plane index with the most hits. -1 if no calorimetry

Expand Down
33 changes: 33 additions & 0 deletions sbnanaobj/StandardRecord/SRTrkLikelihoodPID.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/**
* @file sbnanaobj/StandardRecord/SRTrkLikelihoodPID.cxx
* @brief An `SRTrkLikelihoodPID` is a high level track ParticlePID object for
* for larana LikelihoodPIDAlg results.
* @author Sungbin Oh ([email protected])
*/

#include "sbnanaobj/StandardRecord/SRTrkLikelihoodPID.h"

#include "sbnanaobj/StandardRecord/SRConstants.h"

namespace caf
{

SRTrkLikelihoodPID::SRTrkLikelihoodPID():
pdg(-999),
pid_ndof(-99),
lambda_muon(caf::kSignalingNaN),
lambda_pion(caf::kSignalingNaN),
lambda_proton(caf::kSignalingNaN)
{ }

void SRTrkLikelihoodPID::setDefault()
{
pdg = 0;
pid_ndof = -5;
lambda_muon = -5.0;
lambda_pion = -5.0;
lambda_proton = -5.0;
}
Comment on lines 15 to 30
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry to be picky. I still don't like that we have default values set in 3 places. In the default constructor, in the setDefault function and in the corresponding sbncode PR they get set explicitly when making the object.

I like the defaults used in the default constructor here so my suggestion is to remove the other two instances completely. For this PR this means removing the setDefault() function, it doesn't appear to be used anywhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @henrylay97 , no problem at all!
I've removed the other two places setting the default values, also removing void SRTrkLikelihoodPID::setDefault().

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like it either, but there was a rationale that aimed to distinguish data that was never initialised (values from constructor), and the data that was defaulted by the user (setDefault()).
Without the former, if code omits an initialisation we end up with random values in the data files, and when we try comparing two versions of data we may see red-herring differences because of that.


} // end namespace caf
////////////////////////////////////////////////////////////////////////
31 changes: 31 additions & 0 deletions sbnanaobj/StandardRecord/SRTrkLikelihoodPID.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/**
* @file sbnanaobj/StandardRecord/SRTrkLikelihoodPID.h
* @brief An `SRTrkLikelihoodPID` is a high level track ParticlePID object for
* for larana LikelihoodPIDAlg results.
* @author Sungbin Oh ([email protected])
*/
#ifndef SRTRKLIKELIHOODPID_H
#define SRTRKLIKELIHOODPID_H

namespace caf
{
/// Track PID from dE/dx v. likelihood from dE/dx PDF measured with residual range-based kinetic energy and hit pitch
class SRTrkLikelihoodPID
{
public:

SRTrkLikelihoodPID();

int pdg; ///< Likelihood PID pdg
int pid_ndof; ///< Number of degress of freedom in likelihood PID
float lambda_muon; ///< Sum of -lnL/L_max (muon hypothesis)
float lambda_pion; ///< Sum of -lnL/L_max (charged pion hypothesis)
float lambda_proton; ///< Sum of -lnL/L_max (proton hypothesis)

void setDefault();
};

} // end namespace

#endif // SRTRKLIKELIHOODPID_H
//////////////////////////////////////////////////////////////////////////////
7 changes: 6 additions & 1 deletion sbnanaobj/StandardRecord/classes_def.xml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@
<version ClassVersion="10" checksum="3777054621"/>
</class>

<class name="caf::SRTrack" ClassVersion="15">
<class name="caf::SRTrack" ClassVersion="16">
<version ClassVersion="16" checksum="4075719476"/>
<version ClassVersion="15" checksum="175611744"/>
<version ClassVersion="14" checksum="3934033130"/>
<version ClassVersion="13" checksum="522362999"/>
Expand Down Expand Up @@ -167,6 +168,10 @@
<version ClassVersion="10" checksum="3162028429"/>
</class>

<class name="caf::SRTrkLikelihoodPID" ClassVersion="10">
<version ClassVersion="10" checksum="2386830952"/>
</class>

<class name="caf::SRTrkMCS" ClassVersion="11">
<version ClassVersion="11" checksum="2241616344"/>
<version ClassVersion="10" checksum="4182678053"/>
Expand Down