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
47 : (
m_detectorView.find(
"xy") != std::string::npos) ? DETECTOR_VIEW_XY
48 : DETECTOR_VIEW_DEFAULT,
127 PANDORA_MONITORING_API(SaveAndViewEvent(this->GetPandora(),
m_saveEventPath));
131 PANDORA_MONITORING_API(ViewEvent(this->GetPandora()));
134 return STATUS_CODE_SUCCESS;
141 const MCParticleList *pMCParticleList = NULL;
143 if (listName.empty())
145 if (STATUS_CODE_SUCCESS != PandoraContentApi::GetCurrentList(*
this, pMCParticleList))
147 if (PandoraContentApi::GetSettings(*this)->ShouldDisplayAlgorithmInfo())
148 std::cout <<
"VisualMonitoringAlgorithm: mc particle list unavailable." << std::endl;
154 if (STATUS_CODE_SUCCESS != PandoraContentApi::GetList(*
this, listName, pMCParticleList))
156 if (PandoraContentApi::GetSettings(*this)->ShouldDisplayAlgorithmInfo())
157 std::cout <<
"VisualMonitoringAlgorithm: mc particle list unavailable." << std::endl;
162 PANDORA_MONITORING_API(VisualizeMCParticles(
163 this->GetPandora(), pMCParticleList, listName.empty() ?
"CurrentMCParticles" : listName.c_str(), AUTO, &
m_particleSuppressionMap));
170 const CaloHitList *pCaloHitList = NULL;
172 if (listName.empty())
174 if (STATUS_CODE_SUCCESS != PandoraContentApi::GetCurrentList(*
this, pCaloHitList))
176 if (PandoraContentApi::GetSettings(*this)->ShouldDisplayAlgorithmInfo())
177 std::cout <<
"VisualMonitoringAlgorithm: current calo hit list unavailable." << std::endl;
183 if (STATUS_CODE_SUCCESS != PandoraContentApi::GetList(*
this, listName, pCaloHitList))
185 if (PandoraContentApi::GetSettings(*this)->ShouldDisplayAlgorithmInfo())
186 std::cout <<
"VisualMonitoringAlgorithm: calo hit list " << listName <<
" unavailable." << std::endl;
192 CaloHitList caloHitList;
196 const CaloHit *
const pCaloHit = *iter;
200 caloHitList.push_back(pCaloHit);
204 PANDORA_MONITORING_API(VisualizeCaloHits(this->GetPandora(), &caloHitList, listName.empty() ?
"CurrentCaloHits" : listName.c_str(),
205 (
m_hitColors.find(
"energy") != std::string::npos ? AUTOENERGY : GRAY)));
212 const TrackList *pTrackList = NULL;
214 if (listName.empty())
216 if (STATUS_CODE_SUCCESS != PandoraContentApi::GetCurrentList(*
this, pTrackList))
218 if (PandoraContentApi::GetSettings(*this)->ShouldDisplayAlgorithmInfo())
219 std::cout <<
"VisualMonitoringAlgorithm: current track list unavailable." << std::endl;
225 if (STATUS_CODE_SUCCESS != PandoraContentApi::GetList(*
this, listName, pTrackList))
227 if (PandoraContentApi::GetSettings(*this)->ShouldDisplayAlgorithmInfo())
228 std::cout <<
"VisualMonitoringAlgorithm: track list " << listName <<
" unavailable." << std::endl;
238 const Track *
const pTrack = *iter;
241 trackList.push_back(pTrack);
244 PANDORA_MONITORING_API(VisualizeTracks(this->GetPandora(), &trackList, listName.empty() ?
"CurrentTracks" : listName.c_str(), GRAY));
251 const ClusterList *pClusterList = NULL;
253 if (listName.empty())
255 if (STATUS_CODE_SUCCESS != PandoraContentApi::GetCurrentList(*
this, pClusterList))
257 if (PandoraContentApi::GetSettings(*this)->ShouldDisplayAlgorithmInfo())
258 std::cout <<
"VisualMonitoringAlgorithm: current cluster list unavailable." << std::endl;
264 if (STATUS_CODE_SUCCESS != PandoraContentApi::GetList(*
this, listName, pClusterList))
266 if (PandoraContentApi::GetSettings(*this)->ShouldDisplayAlgorithmInfo())
267 std::cout <<
"VisualMonitoringAlgorithm: cluster list " << listName <<
" unavailable." << std::endl;
273 ClusterList clusterList;
277 const Cluster *
const pCluster = *iter;
280 clusterList.push_back(pCluster);
283 PANDORA_MONITORING_API(VisualizeClusters(this->GetPandora(), &clusterList, listName.empty() ?
"CurrentClusters" : listName.c_str(),
284 (
m_hitColors.find(
"particleid") != std::string::npos) ? AUTOID
285 : (
m_hitColors.find(
"iterate") != std::string::npos) ? AUTOITER
286 : (
m_hitColors.find(
"energy") != std::string::npos) ? AUTOENERGY
295 const PfoList *pPfoList = NULL;
297 if (listName.empty())
299 if (STATUS_CODE_SUCCESS != PandoraContentApi::GetCurrentList(*
this, pPfoList))
301 if (PandoraContentApi::GetSettings(*this)->ShouldDisplayAlgorithmInfo())
302 std::cout <<
"VisualMonitoringAlgorithm: current pfo list unavailable." << std::endl;
308 if (STATUS_CODE_SUCCESS != PandoraContentApi::GetList(*
this, listName, pPfoList))
310 if (PandoraContentApi::GetSettings(*this)->ShouldDisplayAlgorithmInfo())
311 std::cout <<
"VisualMonitoringAlgorithm: pfo list " << listName <<
" unavailable." << std::endl;
316 PANDORA_MONITORING_API(VisualizeParticleFlowObjects(this->GetPandora(), pPfoList, listName.empty() ?
"CurrentPfos" : listName.c_str(),
317 (
m_hitColors.find(
"particleid") != std::string::npos)
319 : (
m_hitColors.find(
"iterate") != std::string::npos ? AUTOITER : (
m_hitColors.find(
"energy") != std::string::npos ? AUTOENERGY : AUTO)),
329 if (listName.empty())
331 if (STATUS_CODE_SUCCESS != PandoraContentApi::GetCurrentList(*
this, pVertexList))
333 if (PandoraContentApi::GetSettings(*this)->ShouldDisplayAlgorithmInfo())
334 std::cout <<
"VisualMonitoringAlgorithm: current vertex list unavailable." << std::endl;
340 if (STATUS_CODE_SUCCESS != PandoraContentApi::GetList(*
this, listName, pVertexList))
342 if (PandoraContentApi::GetSettings(*this)->ShouldDisplayAlgorithmInfo())
343 std::cout <<
"VisualMonitoringAlgorithm: vertex list " << listName <<
" unavailable." << std::endl;
353 const Vertex *
const pVertex = *iter;
356 vertexList.push_back(pVertex);
359 PANDORA_MONITORING_API(VisualizeVertices(this->GetPandora(), &vertexList, listName.empty() ?
"CurrentVertices" : listName.c_str(), AUTO));
366 PANDORA_RETURN_RESULT_IF_AND_IF(
367 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"ShowCurrentMCParticles",
m_showCurrentMCParticles));
369 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
372 PANDORA_RETURN_RESULT_IF_AND_IF(
373 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"ShowCurrentCaloHits",
m_showCurrentCaloHits));
375 PANDORA_RETURN_RESULT_IF_AND_IF(
376 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadVectorOfValues(xmlHandle,
"CaloHitListNames",
m_caloHitListNames));
378 PANDORA_RETURN_RESULT_IF_AND_IF(
379 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"ShowCurrentTracks",
m_showCurrentTracks));
381 PANDORA_RETURN_RESULT_IF_AND_IF(
382 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadVectorOfValues(xmlHandle,
"TrackListNames",
m_trackListNames));
384 PANDORA_RETURN_RESULT_IF_AND_IF(
385 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"ShowCurrentClusters",
m_showCurrentClusters));
387 PANDORA_RETURN_RESULT_IF_AND_IF(
388 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadVectorOfValues(xmlHandle,
"ClusterListNames",
m_clusterListNames));
390 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"ShowCurrentPfos",
m_showCurrentPfos));
392 PANDORA_RETURN_RESULT_IF_AND_IF(
393 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadVectorOfValues(xmlHandle,
"PfoListNames",
m_pfoListNames));
395 PANDORA_RETURN_RESULT_IF_AND_IF(
396 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"ShowCurrentVertices",
m_showCurrentVertices));
398 PANDORA_RETURN_RESULT_IF_AND_IF(
399 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadVectorOfValues(xmlHandle,
"VertexListNames",
m_vertexListNames));
401 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"DisplayEvent",
m_displayEvent));
403 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"SaveEventPath",
m_saveEventPath));
405 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"ShowDetector",
m_showDetector));
407 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"DetectorView",
m_detectorView));
410 PANDORA_RETURN_RESULT_IF_AND_IF(
411 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"ShowOnlyAvailable",
m_showOnlyAvailable));
413 PANDORA_RETURN_RESULT_IF_AND_IF(
414 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"ShowAssociatedTracks",
m_showAssociatedTracks));
416 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"HitColors",
m_hitColors));
419 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"ThresholdEnergy",
m_thresholdEnergy));
421 PANDORA_RETURN_RESULT_IF_AND_IF(
422 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"TransparencyThresholdE",
m_transparencyThresholdE));
424 PANDORA_RETURN_RESULT_IF_AND_IF(
425 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"EnergyScaleThresholdE",
m_energyScaleThresholdE));
427 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"ScalingFactor",
m_scalingFactor));
429 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"ShowPfoVertices",
m_showPfoVertices));
431 PANDORA_RETURN_RESULT_IF_AND_IF(
432 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"ShowPfoHierarchy",
m_showPfoHierarchy));
434 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
439 const std::string pdgEnergy(*iter);
440 StringVector pdgEnergySeparated;
441 const std::string delimiter =
":";
442 XmlHelper::TokenizeString(pdgEnergy, pdgEnergySeparated, delimiter);
444 if (pdgEnergySeparated.size() != 2)
445 return STATUS_CODE_INVALID_PARAMETER;
450 if (!StringToType(pdgEnergySeparated.at(0), pdgCode) || !StringToType(pdgEnergySeparated.at(1),
energy))
451 return STATUS_CODE_INVALID_PARAMETER;
456 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.
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.
boost::graph_traits< ModuleGraph >::vertex_descriptor Vertex
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
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)