9 #include "Pandora/AlgorithmHeaders.h"
18 VisualMonitoringAlgorithm::VisualMonitoringAlgorithm() :
19 m_showCurrentMCParticles(
false),
20 m_showCurrentCaloHits(
false),
21 m_showCurrentTracks(
false),
22 m_showCurrentClusters(
false),
23 m_showCurrentPfos(
false),
24 m_showCurrentVertices(
false),
27 m_showDetector(
false),
29 m_showOnlyAvailable(
false),
30 m_showAssociatedTracks(
false),
31 m_hitColors(
"iterate"),
32 m_thresholdEnergy(-1.f),
33 m_transparencyThresholdE(-1.f),
34 m_energyScaleThresholdE(1.f),
36 m_showPfoVertices(
true),
37 m_showPfoHierarchy(
true)
45 PANDORA_MONITORING_API(SetEveDisplayParameters(this->GetPandora(),
m_showDetector,
46 (
m_detectorView.find(
"xz") != std::string::npos) ? DETECTOR_VIEW_XZ : (
m_detectorView.find(
"xy") != std::string::npos) ? DETECTOR_VIEW_XY : DETECTOR_VIEW_DEFAULT,
125 PANDORA_MONITORING_API(SaveAndViewEvent(this->GetPandora(),
m_saveEventPath));
129 PANDORA_MONITORING_API(ViewEvent(this->GetPandora()));
132 return STATUS_CODE_SUCCESS;
139 const MCParticleList *pMCParticleList = NULL;
141 if (listName.empty())
143 if (STATUS_CODE_SUCCESS != PandoraContentApi::GetCurrentList(*
this, pMCParticleList))
145 if (PandoraContentApi::GetSettings(*this)->ShouldDisplayAlgorithmInfo())
146 std::cout <<
"VisualMonitoringAlgorithm: mc particle list unavailable." << std::endl;
152 if (STATUS_CODE_SUCCESS != PandoraContentApi::GetList(*
this, listName, pMCParticleList))
154 if (PandoraContentApi::GetSettings(*this)->ShouldDisplayAlgorithmInfo())
155 std::cout <<
"VisualMonitoringAlgorithm: mc particle list unavailable." << std::endl;
160 PANDORA_MONITORING_API(VisualizeMCParticles(
161 this->GetPandora(), pMCParticleList, listName.empty() ?
"CurrentMCParticles" : listName.c_str(), AUTO, &
m_particleSuppressionMap));
168 const CaloHitList *pCaloHitList = NULL;
170 if (listName.empty())
172 if (STATUS_CODE_SUCCESS != PandoraContentApi::GetCurrentList(*
this, pCaloHitList))
174 if (PandoraContentApi::GetSettings(*this)->ShouldDisplayAlgorithmInfo())
175 std::cout <<
"VisualMonitoringAlgorithm: current calo hit list unavailable." << std::endl;
181 if (STATUS_CODE_SUCCESS != PandoraContentApi::GetList(*
this, listName, pCaloHitList))
183 if (PandoraContentApi::GetSettings(*this)->ShouldDisplayAlgorithmInfo())
184 std::cout <<
"VisualMonitoringAlgorithm: calo hit list " << listName <<
" unavailable." << std::endl;
190 CaloHitList caloHitList;
192 for (CaloHitList::const_iterator iter = pCaloHitList->begin(), iterEnd = pCaloHitList->end(); iter != iterEnd; ++iter)
194 const CaloHit *
const pCaloHit = *iter;
198 caloHitList.push_back(pCaloHit);
202 PANDORA_MONITORING_API(VisualizeCaloHits(this->GetPandora(), &caloHitList, listName.empty() ?
"CurrentCaloHits" : listName.c_str(),
203 (
m_hitColors.find(
"energy") != std::string::npos ? AUTOENERGY : GRAY)));
210 const TrackList *pTrackList = NULL;
212 if (listName.empty())
214 if (STATUS_CODE_SUCCESS != PandoraContentApi::GetCurrentList(*
this, pTrackList))
216 if (PandoraContentApi::GetSettings(*this)->ShouldDisplayAlgorithmInfo())
217 std::cout <<
"VisualMonitoringAlgorithm: current track list unavailable." << std::endl;
223 if (STATUS_CODE_SUCCESS != PandoraContentApi::GetList(*
this, listName, pTrackList))
225 if (PandoraContentApi::GetSettings(*this)->ShouldDisplayAlgorithmInfo())
226 std::cout <<
"VisualMonitoringAlgorithm: track list " << listName <<
" unavailable." << std::endl;
234 for (TrackList::const_iterator iter = pTrackList->begin(), iterEnd = pTrackList->end(); iter != iterEnd; ++iter)
236 const Track *
const pTrack = *iter;
239 trackList.push_back(pTrack);
242 PANDORA_MONITORING_API(VisualizeTracks(this->GetPandora(), &trackList, listName.empty() ?
"CurrentTracks" : listName.c_str(), GRAY));
249 const ClusterList *pClusterList = NULL;
251 if (listName.empty())
253 if (STATUS_CODE_SUCCESS != PandoraContentApi::GetCurrentList(*
this, pClusterList))
255 if (PandoraContentApi::GetSettings(*this)->ShouldDisplayAlgorithmInfo())
256 std::cout <<
"VisualMonitoringAlgorithm: current cluster list unavailable." << std::endl;
262 if (STATUS_CODE_SUCCESS != PandoraContentApi::GetList(*
this, listName, pClusterList))
264 if (PandoraContentApi::GetSettings(*this)->ShouldDisplayAlgorithmInfo())
265 std::cout <<
"VisualMonitoringAlgorithm: cluster list " << listName <<
" unavailable." << std::endl;
271 ClusterList clusterList;
273 for (ClusterList::const_iterator iter = pClusterList->begin(), iterEnd = pClusterList->end(); iter != iterEnd; ++iter)
275 const Cluster *
const pCluster = *iter;
278 clusterList.push_back(pCluster);
281 PANDORA_MONITORING_API(VisualizeClusters(this->GetPandora(), &clusterList, listName.empty() ?
"CurrentClusters" : listName.c_str(),
282 (
m_hitColors.find(
"particleid") != std::string::npos)
284 : (
m_hitColors.find(
"iterate") != std::string::npos) ? AUTOITER : (
m_hitColors.find(
"energy") != std::string::npos) ? AUTOENERGY : AUTO,
292 const PfoList *pPfoList = NULL;
294 if (listName.empty())
296 if (STATUS_CODE_SUCCESS != PandoraContentApi::GetCurrentList(*
this, pPfoList))
298 if (PandoraContentApi::GetSettings(*this)->ShouldDisplayAlgorithmInfo())
299 std::cout <<
"VisualMonitoringAlgorithm: current pfo list unavailable." << std::endl;
305 if (STATUS_CODE_SUCCESS != PandoraContentApi::GetList(*
this, listName, pPfoList))
307 if (PandoraContentApi::GetSettings(*this)->ShouldDisplayAlgorithmInfo())
308 std::cout <<
"VisualMonitoringAlgorithm: pfo list " << listName <<
" unavailable." << std::endl;
313 PANDORA_MONITORING_API(VisualizeParticleFlowObjects(this->GetPandora(), pPfoList, listName.empty() ?
"CurrentPfos" : listName.c_str(),
314 (
m_hitColors.find(
"particleid") != std::string::npos)
316 : (
m_hitColors.find(
"iterate") != std::string::npos ? AUTOITER : (
m_hitColors.find(
"energy") != std::string::npos ? AUTOENERGY : AUTO)),
326 if (listName.empty())
328 if (STATUS_CODE_SUCCESS != PandoraContentApi::GetCurrentList(*
this, pVertexList))
330 if (PandoraContentApi::GetSettings(*this)->ShouldDisplayAlgorithmInfo())
331 std::cout <<
"VisualMonitoringAlgorithm: current vertex list unavailable." << std::endl;
337 if (STATUS_CODE_SUCCESS != PandoraContentApi::GetList(*
this, listName, pVertexList))
339 if (PandoraContentApi::GetSettings(*this)->ShouldDisplayAlgorithmInfo())
340 std::cout <<
"VisualMonitoringAlgorithm: vertex list " << listName <<
" unavailable." << std::endl;
348 for (VertexList::const_iterator iter = pVertexList->begin(), iterEnd = pVertexList->end(); iter != iterEnd; ++iter)
350 const Vertex *
const pVertex = *iter;
353 vertexList.push_back(pVertex);
356 PANDORA_MONITORING_API(VisualizeVertices(this->GetPandora(), &vertexList, listName.empty() ?
"CurrentVertices" : listName.c_str(), AUTO));
363 PANDORA_RETURN_RESULT_IF_AND_IF(
364 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"ShowCurrentMCParticles",
m_showCurrentMCParticles));
366 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
369 PANDORA_RETURN_RESULT_IF_AND_IF(
370 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"ShowCurrentCaloHits",
m_showCurrentCaloHits));
372 PANDORA_RETURN_RESULT_IF_AND_IF(
373 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadVectorOfValues(xmlHandle,
"CaloHitListNames",
m_caloHitListNames));
375 PANDORA_RETURN_RESULT_IF_AND_IF(
376 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"ShowCurrentTracks",
m_showCurrentTracks));
378 PANDORA_RETURN_RESULT_IF_AND_IF(
379 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadVectorOfValues(xmlHandle,
"TrackListNames",
m_trackListNames));
381 PANDORA_RETURN_RESULT_IF_AND_IF(
382 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"ShowCurrentClusters",
m_showCurrentClusters));
384 PANDORA_RETURN_RESULT_IF_AND_IF(
385 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadVectorOfValues(xmlHandle,
"ClusterListNames",
m_clusterListNames));
387 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"ShowCurrentPfos",
m_showCurrentPfos));
389 PANDORA_RETURN_RESULT_IF_AND_IF(
390 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadVectorOfValues(xmlHandle,
"PfoListNames",
m_pfoListNames));
392 PANDORA_RETURN_RESULT_IF_AND_IF(
393 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"ShowCurrentVertices",
m_showCurrentVertices));
395 PANDORA_RETURN_RESULT_IF_AND_IF(
396 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadVectorOfValues(xmlHandle,
"VertexListNames",
m_vertexListNames));
398 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"DisplayEvent",
m_displayEvent));
400 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"SaveEventPath",
m_saveEventPath));
402 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"ShowDetector",
m_showDetector));
404 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"DetectorView",
m_detectorView));
407 PANDORA_RETURN_RESULT_IF_AND_IF(
408 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"ShowOnlyAvailable",
m_showOnlyAvailable));
410 PANDORA_RETURN_RESULT_IF_AND_IF(
411 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"ShowAssociatedTracks",
m_showAssociatedTracks));
413 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"HitColors",
m_hitColors));
416 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"ThresholdEnergy",
m_thresholdEnergy));
418 PANDORA_RETURN_RESULT_IF_AND_IF(
419 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"TransparencyThresholdE",
m_transparencyThresholdE));
421 PANDORA_RETURN_RESULT_IF_AND_IF(
422 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"EnergyScaleThresholdE",
m_energyScaleThresholdE));
424 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"ScalingFactor",
m_scalingFactor));
426 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"ShowPfoVertices",
m_showPfoVertices));
428 PANDORA_RETURN_RESULT_IF_AND_IF(
429 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"ShowPfoHierarchy",
m_showPfoHierarchy));
431 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
436 const std::string pdgEnergy(*iter);
437 StringVector pdgEnergySeparated;
438 const std::string delimiter =
":";
439 XmlHelper::TokenizeString(pdgEnergy, pdgEnergySeparated, delimiter);
441 if (pdgEnergySeparated.size() != 2)
442 return STATUS_CODE_INVALID_PARAMETER;
447 if (!StringToType(pdgEnergySeparated.at(0), pdgCode) || !StringToType(pdgEnergySeparated.at(1), energy))
448 return STATUS_CODE_INVALID_PARAMETER;
453 return STATUS_CODE_SUCCESS;
pandora::StringVector m_pfoListNames
Names of pfo lists to show.
std::string m_saveEventPath
The path to save event displays to. m_displayEvent must also be set.
pandora::StringVector m_caloHitListNames
Names of calo hit lists to show.
void VisualizeCaloHitList(const std::string &listName) const
Visualize a specified calo hit list.
float m_transparencyThresholdE
Cell energy for which transparency is saturated (0%, fully opaque)
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
bool m_showCurrentVertices
Whether to show current vertex list.
void VisualizeParticleFlowList(const std::string &listName) const
Visualize a specified pfo list.
pandora::StringVector m_vertexListNames
Names of vertex lists to show.
bool m_showCurrentCaloHits
Whether to show current calohitlist.
bool m_showCurrentPfos
Whether to show current particle flow object list.
void VisualizeTrackList(const std::string &listName) const
Visualize a specified track list.
bool m_showDetector
Whether to display the detector geometry.
pandora::StatusCode Run()
bool m_showCurrentMCParticles
Whether to show current mc particles.
float m_scalingFactor
TEve works with [cm], Pandora usually works with [mm] (but LArContent went with cm too) ...
bool m_showPfoHierarchy
Whether to display daughter pfos only under parent pfo elements.
float m_thresholdEnergy
Cell energy threshold for display (em scale)
bool m_showAssociatedTracks
Whether to display tracks associated to clusters when viewing cluster lists.
bool m_showOnlyAvailable
Whether to show only available (i.e. non-clustered) calohits and tracks.
pandora::StringVector m_suppressMCParticles
List of PDG numbers and energies for MC particles to be suppressed (e.g. " 22:0.1 2112:1...
bool m_showCurrentClusters
Whether to show current clusters.
pandora::StringVector m_mcParticleListNames
Names of mc particles lists to show.
bool m_showPfoVertices
Whether to display pfo vertices.
void VisualizeMCParticleList(const std::string &listName) const
Visualize mc particle list.
required by fuzzyCluster table::sbnd_g4_services gaushitTruthMatch pandora
void VisualizeVertexList(const std::string &listName) const
Visualize a specified vertex list.
void VisualizeClusterList(const std::string &listName) const
Visualize a specified calo hit list.
float m_energyScaleThresholdE
Cell energy for which color is at top end of continous color palette.
Header file for the visual monitoring algorithm class.
bool m_showCurrentTracks
Whether to show current tracks.
std::string m_detectorView
The detector view, default, xy or xz.
pandora::StringVector m_clusterListNames
Names of cluster lists to show.
bool m_displayEvent
Whether to display the event.
pandora::StringVector m_trackListNames
Names of track lists to show.
std::list< Vertex > VertexList
BEGIN_PROLOG don t mess with this pandoraTrackGausCryoW true
BEGIN_PROLOG could also be cout
PdgCodeToEnergyMap m_particleSuppressionMap
Map from pdg-codes to energy for suppression of particles types below specific energies.
std::string m_hitColors
Define the hit coloring scheme (default: pfo, choices: pfo, particleid)