All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
evgen::LightSource::MaterialPointFilter Class Reference

Filters a point according to the material at that point. More...

Public Member Functions

 MaterialPointFilter (geo::GeometryCore const &geom, std::set< std::string > const &materialNames)
 Constructor: sets up the filter configuration. More...
 
 ~MaterialPointFilter ()
 
bool accept (geo::Point_t const &point)
 Returns whether the specified point can be accepted. More...
 
bool operator() (geo::Point_t const &point)
 

Private Member Functions

TGeoMaterial const * materialAt (geo::Point_t const &point)
 Returns a pointer to the material of the volume at specified point. More...
 
TGeoMaterial const * findMaterial (std::string const &name) const
 Returns a pointer to the material with the specified name. More...
 

Private Attributes

TGeoManager * fManager = nullptr
 ROOT geometry manager. More...
 
TGeoNavigator * fNavigator = nullptr
 Our own ROOT geometry navigator. More...
 
std::set< std::string > const & fMaterials
 Names of materials to select. More...
 

Detailed Description

Filters a point according to the material at that point.

Definition at line 140 of file LightSource_module.cc.

Constructor & Destructor Documentation

evgen::LightSource::MaterialPointFilter::MaterialPointFilter ( geo::GeometryCore const &  geom,
std::set< std::string > const &  materialNames 
)

Constructor: sets up the filter configuration.

Definition at line 583 of file LightSource_module.cc.

585  : fManager(geom.ROOTGeoManager())
586  , fNavigator(fManager->AddNavigator())
587  , fMaterials(materialNames)
588  {
589  assert(fManager);
590  assert(fNavigator);
591  }
TGeoNavigator * fNavigator
Our own ROOT geometry navigator.
std::set< std::string > const & fMaterials
Names of materials to select.
TGeoManager * fManager
ROOT geometry manager.
evgen::LightSource::MaterialPointFilter::~MaterialPointFilter ( )

Definition at line 594 of file LightSource_module.cc.

595  {
596  fManager->RemoveNavigator(fNavigator); // this deletes the navigator
597  fNavigator = nullptr;
598  } // LightSource::MaterialPointFilter::~MaterialPointFilter()
TGeoNavigator * fNavigator
Our own ROOT geometry navigator.
TGeoManager * fManager
ROOT geometry manager.

Member Function Documentation

bool evgen::LightSource::MaterialPointFilter::accept ( geo::Point_t const &  point)

Returns whether the specified point can be accepted.

Definition at line 610 of file LightSource_module.cc.

611  {
612  if (fMaterials.empty()) return true;
613  TGeoMaterial const* material = materialAt(point);
614  MF_LOG_TRACE("LightSource") << "Material at " << point << ": "
615  << (material ? material->GetName() : "not found");
616  return material ? (fMaterials.count(material->GetName()) > 0) : false;
617  } // LightSource::MaterialPointFilter::accept()
std::set< std::string > const & fMaterials
Names of materials to select.
TGeoMaterial const * materialAt(geo::Point_t const &point)
Returns a pointer to the material of the volume at specified point.
TGeoMaterial const* evgen::LightSource::MaterialPointFilter::findMaterial ( std::string const &  name) const
private

Returns a pointer to the material with the specified name.

TGeoMaterial const * evgen::LightSource::MaterialPointFilter::materialAt ( geo::Point_t const &  point)
private

Returns a pointer to the material of the volume at specified point.

Definition at line 602 of file LightSource_module.cc.

603  {
604  TGeoNode const* node = fNavigator->FindNode(point.X(), point.Y(), point.Z());
605  return node ? node->GetVolume()->GetMaterial() : nullptr;
606  } // LightSource::MaterialPointFilter::materialAt()
TGeoNavigator * fNavigator
Our own ROOT geometry navigator.
bool evgen::LightSource::MaterialPointFilter::operator() ( geo::Point_t const &  point)
inline

Definition at line 152 of file LightSource_module.cc.

153  {
154  return accept(point);
155  }
bool accept(geo::Point_t const &point)
Returns whether the specified point can be accepted.

Member Data Documentation

TGeoManager* evgen::LightSource::MaterialPointFilter::fManager = nullptr
private

ROOT geometry manager.

Definition at line 159 of file LightSource_module.cc.

std::set<std::string> const& evgen::LightSource::MaterialPointFilter::fMaterials
private

Names of materials to select.

Definition at line 163 of file LightSource_module.cc.

TGeoNavigator* evgen::LightSource::MaterialPointFilter::fNavigator = nullptr
private

Our own ROOT geometry navigator.

Definition at line 160 of file LightSource_module.cc.


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