LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
reco::shower::ShowerElementHolder Class Reference

#include "ShowerElementHolder.hh"

Public Member Functions

template<class T >
int GetElement (const std::string &Name, T &Element) const
 
template<class T >
int GetEventElement (const std::string &Name, T &Element) const
 
template<class T >
const T & GetEventElement (std::string const &Name)
 
template<class T >
GetElement (const std::string &Name) const
 
template<class T , class T2 >
int GetElementAndError (const std::string &Name, T &Element, T2 &ElementErr) const
 
template<class T >
void SetElement (T &dataproduct, const std::string &Name, bool checktag=false)
 
template<class T , class T2 >
void SetElement (T &propertyval, T2 &propertyvalerror, const std::string &Name)
 
template<class T >
void SetEventElement (T &dataproduct, const std::string &Name)
 
bool CheckEventElement (const std::string &Name) const
 
bool CheckElement (const std::string &Name) const
 
bool CheckAllElements () const
 
void ClearElement (const std::string &Name)
 
void ClearShower ()
 
void ClearEvent ()
 
void ClearAll ()
 
bool CheckElementTag (const std::string &Name) const
 
void DeleteElement (const std::string &Name)
 
void SetElementTag (const std::string &Name, bool checkelement)
 
bool CheckAllElementTags () const
 
void SetShowerNumber (int &shower_iter)
 
int GetShowerNumber () const
 
void PrintElements () const
 
template<class T >
std::string getType (T object) const
 
template<class T >
std::string getType () const
 
template<class T1 , class T2 >
const art::FindManyP< T1 > & GetFindManyP (const art::ValidHandle< std::vector< T2 >> &handle, const art::Event &evt, const art::InputTag &moduleTag)
 
template<class T1 , class T2 >
const art::FindOneP< T1 > & GetFindOneP (const art::ValidHandle< std::vector< T2 >> &handle, const art::Event &evt, const art::InputTag &moduleTag)
 

Private Attributes

std::map< std::string, std::unique_ptr< reco::shower::ShowerElementBase > > showerproperties
 
std::map< std::string, std::unique_ptr< reco::shower::ShowerElementBase > > showerdataproducts
 
std::map< std::string, std::unique_ptr< reco::shower::ShowerElementBase > > eventdataproducts
 
int showernumber
 

Detailed Description

Definition at line 214 of file ShowerElementHolder.hh.

Member Function Documentation

bool reco::shower::ShowerElementHolder::CheckAllElements ( ) const
inline

Definition at line 488 of file ShowerElementHolder.hh.

489  {
490  bool checked = true;
491  for (auto const& showerprop : showerproperties) {
492  checked = checked && showerprop.second->CheckShowerElement();
493  }
494  for (auto const& showerdataprod : showerdataproducts) {
495  checked = checked && showerdataprod.second->CheckShowerElement();
496  }
497  return checked;
498  }
std::map< std::string, std::unique_ptr< reco::shower::ShowerElementBase > > showerdataproducts
std::map< std::string, std::unique_ptr< reco::shower::ShowerElementBase > > showerproperties
bool reco::shower::ShowerElementHolder::CheckAllElementTags ( ) const
inline

Definition at line 581 of file ShowerElementHolder.hh.

Referenced by reco::shower::LArPandoraModularShowerCreation::produce().

582  {
583  bool checked = true;
584  for (auto const& showerdataproduct : showerdataproducts) {
585  bool check = showerdataproduct.second->CheckTag();
586  if (check) {
587  bool elementset = showerdataproduct.second->CheckShowerElement();
588  if (!elementset) {
589  mf::LogError("ShowerElementHolder")
590  << "The following element is not set and was asked to be checked: "
591  << showerdataproduct.first << std::endl;
592  checked = false;
593  }
594  }
595  }
596  return checked;
597  }
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
std::map< std::string, std::unique_ptr< reco::shower::ShowerElementBase > > showerdataproducts
bool reco::shower::ShowerElementHolder::CheckElement ( const std::string &  Name) const
inline

Definition at line 470 of file ShowerElementHolder.hh.

Referenced by ShowerRecoTools::ShowerExampleTool::AddAssociations(), ShowerRecoTools::ShowerPandoraSlidingFitTrackFinder::AddAssociations(), ShowerRecoTools::ShowerPCADirection::AddAssociations(), reco::shower::ShowerUniqueProductPtr< std::vector< T > >::AddDataProduct(), ShowerRecoTools::ShowerPCAEigenvalueLength::CalculateElement(), ShowerRecoTools::ShowerExampleTool::CalculateElement(), ShowerRecoTools::ShowerTrackStartPosition::CalculateElement(), ShowerRecoTools::ShowerTrackTrajPointDirection::CalculateElement(), ShowerRecoTools::ShowerLengthPercentile::CalculateElement(), ShowerRecoTools::ShowerTrackDirection::CalculateElement(), ShowerRecoTools::ShowerDirectionTopologyDecisionTool::CalculateElement(), ShowerRecoTools::ShowerTrackTrajToSpacePoint::CalculateElement(), ShowerRecoTools::ShowerTrackSpacePointDirection::CalculateElement(), ShowerRecoTools::ShowerUnidirectiondEdx::CalculateElement(), ShowerRecoTools::ShowerTrackFinderCheater::CalculateElement(), ShowerRecoTools::Shower3DCylinderTrackHitFinder::CalculateElement(), ShowerRecoTools::ShowerTrackHitDirection::CalculateElement(), ShowerRecoTools::ShowerPCAPropergationStartPosition::CalculateElement(), ShowerRecoTools::Shower2DLinearRegressionTrackHitFinder::CalculateElement(), ShowerRecoTools::ShowerPFPVertexStartPosition::CalculateElement(), ShowerRecoTools::ShowerDirectionCheater::CalculateElement(), ShowerRecoTools::ShowerTrackColinearTrajPointDirection::CalculateElement(), ShowerRecoTools::ShowerTrackPCADirection::CalculateElement(), ShowerRecoTools::ShowerPandoraSlidingFitTrackFinder::CalculateElement(), ShowerRecoTools::ShowerBayesianTrucatingdEdx::CalculateElement(), ShowerRecoTools::ShowerPCADirection::CalculateElement(), ShowerRecoTools::ShowerIncrementalTrackHitFinder::CalculateElement(), ShowerRecoTools::ShowerTrajPointdEdx::CalculateElement(), shower::LArPandoraShowerCheatingAlg::CheatDebugEVD(), reco::shower::ShowerProducedPtrsHolder::CheckAllProducedElements(), shower::LArPandoraShowerAlg::DebugEVD(), reco::shower::LArPandoraModularShowerCreation::GetProducedElementPtr(), ShowerRecoTools::IShowerTool::GetProducedElementPtr(), and reco::shower::LArPandoraModularShowerCreation::produce().

471  {
472  auto const showerPropertiesIt = showerproperties.find(Name);
473  if (showerPropertiesIt != showerproperties.end()) {
474  return showerPropertiesIt->second->CheckShowerElement();
475  }
476  auto const showerDataProductsIt = showerdataproducts.find(Name);
477  if (showerDataProductsIt != showerdataproducts.end()) {
478  return showerDataProductsIt->second->CheckShowerElement();
479  }
480  auto const eventDataProductsIt = eventdataproducts.find(Name);
481  if (eventDataProductsIt != eventdataproducts.end()) {
482  return eventDataProductsIt->second->CheckShowerElement();
483  }
484  return false;
485  }
std::map< std::string, std::unique_ptr< reco::shower::ShowerElementBase > > eventdataproducts
std::map< std::string, std::unique_ptr< reco::shower::ShowerElementBase > > showerdataproducts
std::map< std::string, std::unique_ptr< reco::shower::ShowerElementBase > > showerproperties
bool reco::shower::ShowerElementHolder::CheckElementTag ( const std::string &  Name) const
inline

Definition at line 542 of file ShowerElementHolder.hh.

Referenced by ShowerRecoTools::ShowerExampleTool::CalculateElement().

543  {
544  auto const showerDataProductsIt = showerdataproducts.find(Name);
545  if (showerDataProductsIt != showerdataproducts.end()) {
546  return showerDataProductsIt->second->CheckTag();
547  }
548  return false;
549  }
std::map< std::string, std::unique_ptr< reco::shower::ShowerElementBase > > showerdataproducts
bool reco::shower::ShowerElementHolder::CheckEventElement ( const std::string &  Name) const
inline

Definition at line 461 of file ShowerElementHolder.hh.

462  {
463  auto const eventDataProductsIt = eventdataproducts.find(Name);
464  return eventDataProductsIt == eventdataproducts.end() ?
465  false :
466  eventDataProductsIt->second->CheckShowerElement();
467  }
std::map< std::string, std::unique_ptr< reco::shower::ShowerElementBase > > eventdataproducts
void reco::shower::ShowerElementHolder::ClearAll ( )
inline

Definition at line 535 of file ShowerElementHolder.hh.

void reco::shower::ShowerElementHolder::ClearElement ( const std::string &  Name)
inline

Definition at line 501 of file ShowerElementHolder.hh.

502  {
503  auto const showerPropertiesIt = showerproperties.find(Name);
504  if (showerPropertiesIt != showerproperties.end()) {
505  return showerPropertiesIt->second->Clear();
506  }
507  auto const showerDataProductsIt = showerdataproducts.find(Name);
508  if (showerDataProductsIt != showerdataproducts.end()) {
509  return showerDataProductsIt->second->Clear();
510  }
511  mf::LogError("ShowerElementHolder")
512  << "Trying to clear Element: " << Name
513  << ". This element does not exist in the element holder" << std::endl;
514  return;
515  }
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
std::map< std::string, std::unique_ptr< reco::shower::ShowerElementBase > > showerdataproducts
std::map< std::string, std::unique_ptr< reco::shower::ShowerElementBase > > showerproperties
void reco::shower::ShowerElementHolder::ClearEvent ( )
inline

Definition at line 528 of file ShowerElementHolder.hh.

References reco::shower::ShowerElementBase::Clear().

529  {
530  for (auto const& eventdataproduct : eventdataproducts) {
531  (eventdataproduct.second)->Clear();
532  }
533  }
std::map< std::string, std::unique_ptr< reco::shower::ShowerElementBase > > eventdataproducts
void reco::shower::ShowerElementHolder::ClearShower ( )
inline

Definition at line 518 of file ShowerElementHolder.hh.

References reco::shower::ShowerElementBase::Clear().

Referenced by reco::shower::LArPandoraModularShowerCreation::produce().

519  {
520  for (auto const& showerprop : showerproperties) {
521  (showerprop.second)->Clear();
522  }
523  for (auto const& showerdataproduct : showerdataproducts) {
524  (showerdataproduct.second)->Clear();
525  }
526  }
std::map< std::string, std::unique_ptr< reco::shower::ShowerElementBase > > showerdataproducts
std::map< std::string, std::unique_ptr< reco::shower::ShowerElementBase > > showerproperties
void reco::shower::ShowerElementHolder::DeleteElement ( const std::string &  Name)
inline

Definition at line 552 of file ShowerElementHolder.hh.

553  {
554  auto const showerPropertiesIt = showerproperties.find(Name);
555  if (showerPropertiesIt != showerproperties.end()) {
556  return showerPropertiesIt->second.reset(nullptr);
557  }
558  auto const showerDataProductsIt = showerdataproducts.find(Name);
559  if (showerDataProductsIt != showerdataproducts.end()) {
560  return showerDataProductsIt->second.reset(nullptr);
561  }
562  mf::LogError("ShowerElementHolder")
563  << "Trying to delete Element: " << Name
564  << ". This element does not exist in the element holder" << std::endl;
565  return;
566  }
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
std::map< std::string, std::unique_ptr< reco::shower::ShowerElementBase > > showerdataproducts
std::map< std::string, std::unique_ptr< reco::shower::ShowerElementBase > > showerproperties
template<class T >
int reco::shower::ShowerElementHolder::GetElement ( const std::string &  Name,
T &  Element 
) const
inline

Definition at line 219 of file ShowerElementHolder.hh.

References reco::shower::ShowerElementAccessor< T >::GetShowerElement().

Referenced by reco::shower::ShowerUniqueProductPtr< std::vector< T > >::AddDataProduct(), ShowerRecoTools::ShowerExampleTool::CalculateElement(), ShowerRecoTools::ShowerTrackStartPosition::CalculateElement(), ShowerRecoTools::ShowerPCAEigenvalueLength::CalculateElement(), ShowerRecoTools::ShowerTrackDirection::CalculateElement(), ShowerRecoTools::ShowerTrackTrajPointDirection::CalculateElement(), ShowerRecoTools::ShowerLengthPercentile::CalculateElement(), ShowerRecoTools::ShowerTrackSpacePointDirection::CalculateElement(), ShowerRecoTools::ShowerTrackTrajToSpacePoint::CalculateElement(), ShowerRecoTools::ShowerTrackHitDirection::CalculateElement(), ShowerRecoTools::Shower3DCylinderTrackHitFinder::CalculateElement(), ShowerRecoTools::ShowerTrackFinderCheater::CalculateElement(), ShowerRecoTools::ShowerUnidirectiondEdx::CalculateElement(), ShowerRecoTools::ShowerPCAPropergationStartPosition::CalculateElement(), ShowerRecoTools::ShowerPFPVertexStartPosition::CalculateElement(), ShowerRecoTools::Shower2DLinearRegressionTrackHitFinder::CalculateElement(), ShowerRecoTools::ShowerDirectionCheater::CalculateElement(), ShowerRecoTools::ShowerTrackColinearTrajPointDirection::CalculateElement(), ShowerRecoTools::ShowerTrackPCADirection::CalculateElement(), ShowerRecoTools::ShowerBayesianTrucatingdEdx::CalculateElement(), ShowerRecoTools::ShowerPandoraSlidingFitTrackFinder::CalculateElement(), ShowerRecoTools::ShowerPCADirection::CalculateElement(), ShowerRecoTools::ShowerIncrementalTrackHitFinder::CalculateElement(), ShowerRecoTools::ShowerTrajPointdEdx::CalculateElement(), shower::LArPandoraShowerCheatingAlg::CheatDebugEVD(), shower::LArPandoraShowerAlg::DebugEVD(), and reco::shower::LArPandoraModularShowerCreation::produce().

220  {
221  auto const showerPropertiesIt = showerproperties.find(Name);
222  if (showerPropertiesIt != showerproperties.end()) {
223  if (showerPropertiesIt->second->CheckShowerElement()) {
225  dynamic_cast<reco::shower::ShowerElementAccessor<T>*>(showerPropertiesIt->second.get());
226  if (showerprop == nullptr) {
227  throw cet::exception("ShowerElementHolder")
228  << "Trying to get Element: " << Name
229  << ". This element you are filling is not the correct type" << std::endl;
230  }
231  showerprop->GetShowerElement(Element);
232  return 0;
233  }
234  else {
235  mf::LogWarning("ShowerElementHolder")
236  << "Trying to get Element " << Name << ". This elment has not been filled" << std::endl;
237  return 1;
238  }
239  }
240 
241  auto const showerDataProductsIt = showerdataproducts.find(Name);
242  if (showerDataProductsIt != showerdataproducts.end()) {
243  if (showerDataProductsIt->second->CheckShowerElement()) {
245  dynamic_cast<reco::shower::ShowerElementAccessor<T>*>(showerDataProductsIt->second.get());
246  if (showerprop == nullptr) {
247  throw cet::exception("ShowerElementHolder")
248  << "Trying to get Element: " << Name
249  << ". This element you are filling is not the correct type" << std::endl;
250  }
251  showerprop->GetShowerElement(Element);
252  return 0;
253  }
254  else {
255  mf::LogWarning("ShowerElementHolder")
256  << "Trying to get Element " << Name << ". This elment has not been filled" << std::endl;
257  return 1;
258  }
259  }
260 
261  auto const eventDataProductsIt = eventdataproducts.find(Name);
262  if (eventDataProductsIt != eventdataproducts.end()) {
263  if (eventDataProductsIt->second->CheckShowerElement()) {
265  dynamic_cast<reco::shower::ShowerElementAccessor<T>*>(eventDataProductsIt->second.get());
266  if (eventprop == nullptr) {
267  throw cet::exception("ShowerElementHolder")
268  << "Trying to get Element: " << Name
269  << ". This element you are filling is not the correct type" << std::endl;
270  }
271  eventprop->GetShowerElement(Element);
272  return 0;
273  }
274  else {
275  mf::LogWarning("ShowerElementHolder")
276  << "Trying to get Element " << Name << ". This elment has not been filled" << std::endl;
277  return 1;
278  }
279  }
280  throw cet::exception("ShowerElementHolder")
281  << "Trying to get Element: " << Name << ". This element does not exist in the element holder"
282  << std::endl;
283  }
std::map< std::string, std::unique_ptr< reco::shower::ShowerElementBase > > eventdataproducts
std::map< std::string, std::unique_ptr< reco::shower::ShowerElementBase > > showerdataproducts
std::map< std::string, std::unique_ptr< reco::shower::ShowerElementBase > > showerproperties
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
template<class T >
T reco::shower::ShowerElementHolder::GetElement ( const std::string &  Name) const
inline

Definition at line 336 of file ShowerElementHolder.hh.

References reco::shower::ShowerElementAccessor< T >::GetShowerElement().

337  {
338  auto const showerPropertiesIt = showerproperties.find(Name);
339  if (showerPropertiesIt != showerproperties.end()) {
340  if (showerPropertiesIt->second->CheckShowerElement()) {
342  dynamic_cast<reco::shower::ShowerElementAccessor<T>*>(showerPropertiesIt->second.get());
343  if (showerprop == nullptr) {
344  throw cet::exception("ShowerElementHolder")
345  << "Trying to get Element: " << Name
346  << ". This element you are filling is not the correct type" << std::endl;
347  }
348  return showerprop->GetShowerElement();
349  }
350  }
351 
352  auto const showerDataProductsIt = showerdataproducts.find(Name);
353  if (showerDataProductsIt != showerdataproducts.end()) {
354  if (showerDataProductsIt->second->CheckShowerElement()) {
356  dynamic_cast<reco::shower::ShowerElementAccessor<T>*>(showerDataProductsIt->second.get());
357  if (showerprop == nullptr) {
358  throw cet::exception("ShowerElementHolder")
359  << "Trying to get Element: " << Name
360  << ". This element you are filling is not the correct type" << std::endl;
361  }
362  return showerprop->GetShowerElement();
363  }
364  }
365 
366  auto const eventDataProductsIt = eventdataproducts.find(Name);
367  if (eventDataProductsIt != eventdataproducts.end()) {
368  if (eventDataProductsIt->second->CheckShowerElement()) {
370  dynamic_cast<reco::shower::ShowerElementAccessor<T>*>(eventDataProductsIt->second.get());
371  if (eventprop == nullptr) {
372  throw cet::exception("ShowerElementHolder")
373  << "Trying to get Element: " << Name
374  << ". This element you are filling is not the correct type" << std::endl;
375  }
376  return eventprop->GetShowerElement();
377  }
378  }
379  throw cet::exception("ShowerElementHolder")
380  << "Trying to get Element: " << Name << ". This element does not exist in the element holder"
381  << std::endl;
382  }
std::map< std::string, std::unique_ptr< reco::shower::ShowerElementBase > > eventdataproducts
std::map< std::string, std::unique_ptr< reco::shower::ShowerElementBase > > showerdataproducts
std::map< std::string, std::unique_ptr< reco::shower::ShowerElementBase > > showerproperties
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
template<class T , class T2 >
int reco::shower::ShowerElementHolder::GetElementAndError ( const std::string &  Name,
T &  Element,
T2 &  ElementErr 
) const
inline

Definition at line 386 of file ShowerElementHolder.hh.

References reco::shower::ShowerElementAccessor< T >::GetShowerElement(), and reco::shower::ShowerProperty< T, T2 >::GetShowerPropertyError().

Referenced by ShowerRecoTools::ShowerDirectionTopologyDecisionTool::CalculateElement(), and reco::shower::LArPandoraModularShowerCreation::produce().

387  {
388  auto const showerPropertiesIt = showerproperties.find(Name);
389  if (showerPropertiesIt == showerproperties.end()) {
390  mf::LogError("ShowerElementHolder")
391  << "Trying to get Element Error: " << Name
392  << ". This elment does not exist in the element holder" << std::endl;
393  return 1;
394  }
396  dynamic_cast<reco::shower::ShowerProperty<T, T2>*>(showerPropertiesIt->second.get());
397  showerprop->GetShowerElement(Element);
398  showerprop->GetShowerPropertyError(ElementErr);
399  return 0;
400  }
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
std::map< std::string, std::unique_ptr< reco::shower::ShowerElementBase > > showerproperties
int GetShowerPropertyError(T2 &ElementErr) const
template<class T >
int reco::shower::ShowerElementHolder::GetEventElement ( const std::string &  Name,
T &  Element 
) const
inline

Definition at line 286 of file ShowerElementHolder.hh.

References reco::shower::ShowerElementAccessor< T >::GetShowerElement().

287  {
288  auto const eventDataProductsIt = eventdataproducts.find(Name);
289  if (eventDataProductsIt != eventdataproducts.end()) {
290  if (eventDataProductsIt->second->CheckShowerElement()) {
292  dynamic_cast<reco::shower::ShowerElementAccessor<T>*>(eventDataProductsIt->second.get());
293  if (eventprop == nullptr) {
294  throw cet::exception("ShowerElementHolder")
295  << "Trying to get Element: " << Name
296  << ". This element you are filling is not the correct type" << std::endl;
297  }
298  eventprop->GetShowerElement(Element);
299  return 0;
300  }
301  else {
302  mf::LogWarning("ShowerElementHolder")
303  << "Trying to get Element " << Name << ". This elment has not been filled" << std::endl;
304  return 1;
305  }
306  }
307  throw cet::exception("ShowerElementHolder")
308  << "Trying to get Element: " << Name << ". This element does not exist in the element holder"
309  << std::endl;
310  }
std::map< std::string, std::unique_ptr< reco::shower::ShowerElementBase > > eventdataproducts
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
template<class T >
const T& reco::shower::ShowerElementHolder::GetEventElement ( std::string const &  Name)
inline

Definition at line 314 of file ShowerElementHolder.hh.

References reco::shower::ShowerElementAccessor< T >::GetShowerElementRef().

315  {
316  auto const eventDataProductsIt = eventdataproducts.find(Name);
317  if (eventDataProductsIt != eventdataproducts.end()) {
318  if (eventDataProductsIt->second->CheckShowerElement()) {
320  dynamic_cast<reco::shower::ShowerElementAccessor<T>*>(eventDataProductsIt->second.get());
321  if (eventprop == nullptr) {
322  throw cet::exception("ShowerElementHolder")
323  << "Trying to get Element: " << Name
324  << ". This element you are filling is not the correct type" << std::endl;
325  }
326  return eventprop->GetShowerElementRef();
327  }
328  }
329  throw cet::exception("ShowerElementHolder")
330  << "Trying to get Element: " << Name << ". This element does not exist in the element holder"
331  << std::endl;
332  }
std::map< std::string, std::unique_ptr< reco::shower::ShowerElementBase > > eventdataproducts
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
template<class T1 , class T2 >
const art::FindManyP<T1>& reco::shower::ShowerElementHolder::GetFindManyP ( const art::ValidHandle< std::vector< T2 >> &  handle,
const art::Event evt,
const art::InputTag moduleTag 
)
inline

Definition at line 673 of file ShowerElementHolder.hh.

References art::InputTag::label().

Referenced by ShowerRecoTools::ShowerLengthPercentile::CalculateElement(), ShowerRecoTools::Shower3DCylinderTrackHitFinder::CalculateElement(), ShowerRecoTools::ShowerTrackHitDirection::CalculateElement(), ShowerRecoTools::ShowerPCAPropergationStartPosition::CalculateElement(), ShowerRecoTools::ShowerPFPVertexStartPosition::CalculateElement(), ShowerRecoTools::Shower2DLinearRegressionTrackHitFinder::CalculateElement(), ShowerRecoTools::ShowerLinearEnergy::CalculateElement(), ShowerRecoTools::ShowerTrackPCADirection::CalculateElement(), ShowerRecoTools::ShowerPCADirection::CalculateElement(), ShowerRecoTools::ShowerNumElectronsEnergy::CalculateElement(), ShowerRecoTools::ShowerIncrementalTrackHitFinder::CalculateElement(), ShowerRecoTools::ShowerTrajPointdEdx::CalculateElement(), and reco::shower::LArPandoraModularShowerCreation::produce().

676  {
677 
678  const std::string name("FMP_" + moduleTag.label() + "_" + getType<T1>() + "_" + getType<T2>());
679 
680  if (CheckEventElement(name)) { return GetEventElement<art::FindManyP<T1>>(name); }
681  else {
682  art::FindManyP<T1> findManyP(handle, evt, moduleTag);
683  if (findManyP.isValid()) {
684  SetEventElement(findManyP, name);
685  return GetEventElement<art::FindManyP<T1>>(name);
686  }
687  else {
688  throw cet::exception("ShowerElementHolder")
689  << "FindManyP is not valid: " << name << std::endl;
690  }
691  }
692  }
void SetEventElement(T &dataproduct, const std::string &Name)
std::string const & label() const noexcept
Definition: InputTag.cc:79
bool CheckEventElement(const std::string &Name) const
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
template<class T1 , class T2 >
const art::FindOneP<T1>& reco::shower::ShowerElementHolder::GetFindOneP ( const art::ValidHandle< std::vector< T2 >> &  handle,
const art::Event evt,
const art::InputTag moduleTag 
)
inline

Definition at line 695 of file ShowerElementHolder.hh.

References art::InputTag::label().

Referenced by ShowerRecoTools::ShowerTrackTrajToSpacePoint::CalculateElement().

698  {
699 
700  const std::string name("FOP_" + moduleTag.label() + "_" + getType<T1>() + "_" + getType<T2>());
701 
702  if (CheckEventElement(name)) { return GetEventElement<art::FindOneP<T1>>(name); }
703  else {
704  art::FindOneP<T1> findOneP(handle, evt, moduleTag);
705  if (findOneP.isValid()) {
706  SetEventElement(findOneP, name);
707  return GetEventElement<art::FindOneP<T1>>(name);
708  }
709  else {
710  throw cet::exception("ShowerElementHolder")
711  << "FindOneP is not valid: " << name << std::endl;
712  }
713  }
714  }
void SetEventElement(T &dataproduct, const std::string &Name)
std::string const & label() const noexcept
Definition: InputTag.cc:79
bool CheckEventElement(const std::string &Name) const
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
template<class T >
std::string reco::shower::ShowerElementHolder::getType ( object) const
inline

Definition at line 661 of file ShowerElementHolder.hh.

662  {
663  return cet::demangle_symbol(typeid(object).name());
664  }
template<class T >
std::string reco::shower::ShowerElementHolder::getType ( ) const
inline

Definition at line 667 of file ShowerElementHolder.hh.

668  {
669  return cet::demangle_symbol(typeid(T).name());
670  }
void reco::shower::ShowerElementHolder::PrintElements ( ) const
inline

Definition at line 606 of file ShowerElementHolder.hh.

References reco::shower::ShowerElementBase::GetType(), art::left(), and n.

Referenced by ShowerRecoTools::ShowerExampleTool::CalculateElement(), and reco::shower::LArPandoraModularShowerCreation::produce().

607  {
608 
609  unsigned int maxname = 0;
610  for (auto const& showerprop : showerproperties) {
611  if (showerprop.first.size() > maxname) { maxname = showerprop.first.size(); }
612  }
613  for (auto const& showerdataprod : showerdataproducts) {
614  if (showerdataprod.first.size() > maxname) { maxname = showerdataprod.first.size(); }
615  }
616 
617  std::map<std::string, std::string> Type_showerprops;
618  std::map<std::string, std::string> Type_showerdataprods;
619  for (auto const& showerprop : showerproperties) {
620  std::string Type = (showerprop.second)->GetType();
621  Type_showerprops[showerprop.first] = Type;
622  }
623  for (auto const& showerdataprod : showerdataproducts) {
624  std::string Type = (showerdataprod.second)->GetType();
625  Type_showerdataprods[showerdataprod.first] = Type;
626  }
627 
628  unsigned int maxtype = 0;
629  for (auto const& Type_showerprop : Type_showerprops) {
630  if (Type_showerprop.second.size() > maxtype) { maxtype = Type_showerprop.second.size(); }
631  }
632  for (auto const& Type_showerdataprod : Type_showerdataprods) {
633  if (Type_showerdataprod.second.size() > maxtype) {
634  maxtype = Type_showerdataprod.second.size();
635  }
636  }
637 
638  unsigned int n = maxname + maxtype + 33;
639  std::cout << std::left << std::setfill('*') << std::setw(n - 1) << "*" << std::endl;
640  std::cout << "Elements in the element holder" << std::endl;
641  std::cout << std::left << std::setfill('*') << std::setw(n - 1) << "*" << std::endl;
642  for (auto const& Type_showerprop : Type_showerprops) {
643  std::cout << std::left << std::setfill(' ') << std::setw(21)
644  << "* Property Name: " << std::setw(maxname) << Type_showerprop.first;
645  std::cout << std::left << std::setfill(' ') << " * Type: " << std::setw(maxtype)
646  << Type_showerprop.second << " * " << std::endl;
647  }
648  for (auto const& Type_showerdataprod : Type_showerdataprods) {
649  std::cout << std::left << std::setfill(' ') << std::setw(maxname) << std::setw(21)
650  << "* Data Product Name: " << std::setw(maxname) << Type_showerdataprod.first;
651  std::cout << std::left << std::setfill(' ') << " * Type: " << std::setw(maxtype)
652  << Type_showerdataprod.second << " *" << std::endl;
653  }
654  std::cout << std::left << std::setfill('*') << std::setw(n - 1) << "*" << std::endl;
655  std::cout << std::setfill(' ');
656  std::cout << std::setw(0);
657  return;
658  }
std::map< std::string, std::unique_ptr< reco::shower::ShowerElementBase > > showerdataproducts
std::map< std::string, std::unique_ptr< reco::shower::ShowerElementBase > > showerproperties
constexpr auto const & left(const_AssnsIter< L, R, D, Dir > const &a, const_AssnsIter< L, R, D, Dir > const &b)
Definition: AssnsIter.h:94
Char_t n[5]
template<class T >
void reco::shower::ShowerElementHolder::SetElement ( T &  dataproduct,
const std::string &  Name,
bool  checktag = false 
)
inline

Definition at line 405 of file ShowerElementHolder.hh.

References reco::shower::ShowerDataProduct< T >::SetCheckTag(), and reco::shower::ShowerElementAccessor< T >::SetShowerElement().

Referenced by ShowerRecoTools::ShowerExampleTool::CalculateElement(), ShowerRecoTools::ShowerPCAEigenvalueLength::CalculateElement(), ShowerRecoTools::ShowerTrackStartPosition::CalculateElement(), ShowerRecoTools::ShowerDirectionTopologyDecisionTool::CalculateElement(), ShowerRecoTools::ShowerLengthPercentile::CalculateElement(), ShowerRecoTools::ShowerTrackDirection::CalculateElement(), ShowerRecoTools::ShowerTrackTrajPointDirection::CalculateElement(), ShowerRecoTools::ShowerTrackSpacePointDirection::CalculateElement(), ShowerRecoTools::ShowerTrackTrajToSpacePoint::CalculateElement(), ShowerRecoTools::ShowerStartPositionCheater::CalculateElement(), ShowerRecoTools::ShowerTrackFinderCheater::CalculateElement(), ShowerRecoTools::ShowerTrackHitDirection::CalculateElement(), ShowerRecoTools::Shower3DCylinderTrackHitFinder::CalculateElement(), ShowerRecoTools::ShowerUnidirectiondEdx::CalculateElement(), ShowerRecoTools::ShowerPCAPropergationStartPosition::CalculateElement(), ShowerRecoTools::ShowerPFPVertexStartPosition::CalculateElement(), ShowerRecoTools::ShowerLinearEnergy::CalculateElement(), ShowerRecoTools::Shower2DLinearRegressionTrackHitFinder::CalculateElement(), ShowerRecoTools::ShowerDirectionCheater::CalculateElement(), ShowerRecoTools::ShowerTrackColinearTrajPointDirection::CalculateElement(), ShowerRecoTools::ShowerTrackPCADirection::CalculateElement(), ShowerRecoTools::ShowerPandoraSlidingFitTrackFinder::CalculateElement(), ShowerRecoTools::ShowerBayesianTrucatingdEdx::CalculateElement(), ShowerRecoTools::ShowerPCADirection::CalculateElement(), ShowerRecoTools::ShowerNumElectronsEnergy::CalculateElement(), ShowerRecoTools::ShowerIncrementalTrackHitFinder::CalculateElement(), ShowerRecoTools::ShowerTrajPointdEdx::CalculateElement(), and reco::shower::LArPandoraModularShowerCreation::produce().

406  {
407 
408  auto const showerDataProductsIt = showerdataproducts.find(Name);
409  if (showerDataProductsIt != showerdataproducts.end()) {
410  reco::shower::ShowerDataProduct<T>* showerdataprod =
411  dynamic_cast<reco::shower::ShowerDataProduct<T>*>(showerDataProductsIt->second.get());
412  showerdataprod->SetShowerElement(dataproduct);
413  showerdataprod->SetCheckTag(checktag);
414  return;
415  }
416  else {
417  showerdataproducts[Name] = std::make_unique<ShowerDataProduct<T>>(dataproduct, checktag);
418  return;
419  }
420  }
std::map< std::string, std::unique_ptr< reco::shower::ShowerElementBase > > showerdataproducts
template<class T , class T2 >
void reco::shower::ShowerElementHolder::SetElement ( T &  propertyval,
T2 &  propertyvalerror,
const std::string &  Name 
)
inline

Definition at line 425 of file ShowerElementHolder.hh.

References reco::shower::ShowerProperty< T, T2 >::SetShowerProperty().

426  {
427 
428  auto const showerPropertiesIt = showerproperties.find(Name);
429  if (showerPropertiesIt != showerproperties.end()) {
431  dynamic_cast<reco::shower::ShowerProperty<T, T2>*>(showerPropertiesIt->second.get());
432  showerprop->SetShowerProperty(propertyval, propertyvalerror);
433  return;
434  }
435  else {
436  showerproperties[Name] =
437  std::make_unique<ShowerProperty<T, T2>>(propertyval, propertyvalerror);
438  return;
439  }
440  }
std::map< std::string, std::unique_ptr< reco::shower::ShowerElementBase > > showerproperties
void SetShowerProperty(T &Element, T2 &ElementErr)
void reco::shower::ShowerElementHolder::SetElementTag ( const std::string &  Name,
bool  checkelement 
)
inline

Definition at line 569 of file ShowerElementHolder.hh.

Referenced by ShowerRecoTools::ShowerExampleTool::CalculateElement().

570  {
571  auto const showerDataProductsIt = showerdataproducts.find(Name);
572  if (showerDataProductsIt != showerdataproducts.end()) {
573  return showerDataProductsIt->second->SetCheckTag(checkelement);
574  }
575  mf::LogError("ShowerElementHolder")
576  << "Trying set the checking of the data product: " << Name
577  << ". This data product does not exist in the element holder" << std::endl;
578  return;
579  }
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
std::map< std::string, std::unique_ptr< reco::shower::ShowerElementBase > > showerdataproducts
template<class T >
void reco::shower::ShowerElementHolder::SetEventElement ( T &  dataproduct,
const std::string &  Name 
)
inline

Definition at line 445 of file ShowerElementHolder.hh.

References reco::shower::ShowerElementAccessor< T >::SetShowerElement().

446  {
447 
448  auto const eventDataProductsIt = eventdataproducts.find(Name);
449  if (eventDataProductsIt != eventdataproducts.end()) {
450  reco::shower::EventDataProduct<T>* eventdataprod =
451  dynamic_cast<reco::shower::EventDataProduct<T>*>(eventDataProductsIt->second.get());
452  eventdataprod->SetShowerElement(dataproduct);
453  return;
454  }
455  else {
456  eventdataproducts[Name] = std::make_unique<EventDataProduct<T>>(dataproduct);
457  return;
458  }
459  }
std::map< std::string, std::unique_ptr< reco::shower::ShowerElementBase > > eventdataproducts
void reco::shower::ShowerElementHolder::SetShowerNumber ( int &  shower_iter)
inline

Member Data Documentation

std::map<std::string, std::unique_ptr<reco::shower::ShowerElementBase> > reco::shower::ShowerElementHolder::eventdataproducts
private

Definition at line 724 of file ShowerElementHolder.hh.

std::map<std::string, std::unique_ptr<reco::shower::ShowerElementBase> > reco::shower::ShowerElementHolder::showerdataproducts
private

Definition at line 721 of file ShowerElementHolder.hh.

int reco::shower::ShowerElementHolder::showernumber
private

Definition at line 727 of file ShowerElementHolder.hh.

std::map<std::string, std::unique_ptr<reco::shower::ShowerElementBase> > reco::shower::ShowerElementHolder::showerproperties
private

Definition at line 718 of file ShowerElementHolder.hh.


The documentation for this class was generated from the following file: