695 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"UseTrainingMode",
m_useTrainingMode));
699 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle,
"TrainingOutputFileName",
m_trainingOutputFile));
701 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle,
"CaloHitListName",
m_caloHitListName));
703 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle,
"MCParticleListName",
m_mcParticleListName));
708 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle,
"BdtName", bdtName));
711 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle,
"BdtFileName", bdtFileName));
713 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle,
"MinAdaBDTScore",
m_minAdaBDTScore));
718 if (STATUS_CODE_SUCCESS != statusCode)
720 std::cout <<
"BdtBeamParticleIdTool::ReadSettings - unable to load bdt" <<
std::endl;
725 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"MinimumPurity",
m_minPurity));
727 PANDORA_RETURN_RESULT_IF_AND_IF(
728 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"MinimumCompleteness",
m_minCompleteness));
730 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
733 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"MaximumNeutrinos",
m_maxNeutrinos));
737 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
738 XmlHelper::ReadVectorOfValues(xmlHandle,
"BeamTPCIntersection", beamLArTPCIntersection));
740 if (3 == beamLArTPCIntersection.size())
742 pandora::CartesianVector beamLArTPCIntersectionCartesianVector(
743 beamLArTPCIntersection.at(0), beamLArTPCIntersection.at(1), beamLArTPCIntersection.at(2));
746 else if (!beamLArTPCIntersection.empty())
748 std::cout <<
"BdtBeamParticleIdTool::ReadSettings - invalid BeamTPCIntersection specified " <<
std::endl;
749 return STATUS_CODE_INVALID_PARAMETER;
754 pandora::CartesianVector beamLArTPCIntersectionCartesianVector(-33.051
f, 461.06
f, 0.
f);
759 PANDORA_RETURN_RESULT_IF_AND_IF(
760 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadVectorOfValues(xmlHandle,
"BeamDirection", beamDirection));
762 if (3 == beamDirection.size())
764 CartesianVector beamDirectionCartesianVector(beamDirection.at(0), beamDirection.at(1), beamDirection.at(2));
767 else if (!beamDirection.empty())
769 std::cout <<
"BdtBeamParticleIdTool::ReadSettings - invalid BeamDirection specified " <<
std::endl;
770 return STATUS_CODE_INVALID_PARAMETER;
775 const float thetaXZ0(-11.844
f *
M_PI / 180.
f);
776 CartesianVector beamDirectionCartesianVector(std::sin(thetaXZ0), 0.
f, std::cos(thetaXZ0));
780 float selectedFraction(0.
f);
782 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"SelectedFraction", selectedFraction));
784 if (selectedFraction > std::numeric_limits<float>::epsilon())
787 unsigned int nSelectedHits(0);
789 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"NSelectedHits", nSelectedHits));
791 if (nSelectedHits > 0)
794 float containmentLimit(0.
f);
796 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"ContainmentLimit", containmentLimit));
798 if (containmentLimit < 0.
f)
800 std::cout <<
"BdtBeamParticleIdTool::ReadSettings - invalid ContainmentLimit specified " <<
std::endl;
801 return STATUS_CODE_INVALID_PARAMETER;
803 else if (containmentLimit > 0.
f)
808 return STATUS_CODE_SUCCESS;
void SetBeamLArTPCIntersection(const pandora::CartesianVector &beamLArTPCIntersection)
Set m_beamLArTPCIntersection.
std::string m_filePathEnvironmentVariable
The environment variable providing a list of paths to bdt files.
std::string m_mcParticleListName
Name of input MC particle list.
float m_minAdaBDTScore
Minimum score required to classify a slice as a beam particle.
bool m_useTrainingMode
Should use training mode. If true, training examples will be written to the output file...
void SetBeamDirection(const pandora::CartesianVector &beamDirection)
Set m_beamDirection.
void SetNSelectedHits(const unsigned int nSelectedHits)
Set m_nSelectedHits.
std::string m_trainingOutputFile
Output file name for training examples.
void SetSelectedFraction(const float selectedFraction)
Set m_selectedFraction.
float m_minPurity
Minimum purity of the best slice to use event for training.
float m_minCompleteness
Minimum completeness of the best slice to use event for training.
static std::string FindFileInPath(const std::string &unqualifiedFileName, const std::string &environmentVariable, const std::string &delimiter=":")
Find the fully-qualified file name by searching through a list of delimiter-separated paths in a name...
void SetContainmentLimit(const float containmentLimit)
Set m_containmentLimit.
pandora::StatusCode Initialize(const std::string ¶meterLocation, const std::string &bdtName)
Initialize the bdt model.
Dft::FloatVector FloatVector
unsigned int m_maxNeutrinos
The maximum number of neutrinos to select in any one event.
std::string m_caloHitListName
Name of input calo hit list.
AdaBoostDecisionTree m_adaBoostDecisionTree
The adaptive boost decision tree.
SliceFeatureParameters m_sliceFeatureParameters
Geometry information block.
QTextStream & endl(QTextStream &s)