Public Member Functions | Private Member Functions | Private Attributes | List of all members
CosmicFilter Class Reference
Inheritance diagram for CosmicFilter:
art::EDFilter art::detail::Filter art::detail::LegacyModule art::Modifier art::ModuleBase art::ProductRegistryHelper

Public Member Functions

 CosmicFilter (fhicl::ParameterSet const &p)
 
 CosmicFilter (CosmicFilter const &)=delete
 
 CosmicFilter (CosmicFilter &&)=delete
 
CosmicFilteroperator= (CosmicFilter const &)=delete
 
CosmicFilteroperator= (CosmicFilter &&)=delete
 
bool filter (art::Event &e) override
 
- Public Member Functions inherited from art::EDFilter
 EDFilter (fhicl::ParameterSet const &pset)
 
template<typename Config >
 EDFilter (Table< Config > const &config)
 
std::string workerType () const
 
- Public Member Functions inherited from art::detail::Filter
virtual ~Filter () noexcept
 
 Filter (fhicl::ParameterSet const &)
 
 Filter (Filter const &)=delete
 
 Filter (Filter &&)=delete
 
Filteroperator= (Filter const &)=delete
 
Filteroperator= (Filter &&)=delete
 
void doBeginJob (SharedResources const &resources)
 
void doEndJob ()
 
void doRespondToOpenInputFile (FileBlock const &fb)
 
void doRespondToCloseInputFile (FileBlock const &fb)
 
void doRespondToOpenOutputFiles (FileBlock const &fb)
 
void doRespondToCloseOutputFiles (FileBlock const &fb)
 
bool doBeginRun (RunPrincipal &rp, ModuleContext const &)
 
bool doEndRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doBeginSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEndSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEvent (EventPrincipal &ep, ModuleContext const &mc, std::atomic< std::size_t > &counts_run, std::atomic< std::size_t > &counts_passed, std::atomic< std::size_t > &counts_failed)
 
- Public Member Functions inherited from art::Modifier
 ~Modifier () noexcept
 
 Modifier ()
 
 Modifier (Modifier const &)=delete
 
 Modifier (Modifier &&)=delete
 
Modifieroperator= (Modifier const &)=delete
 
Modifieroperator= (Modifier &&)=delete
 
- Public Member Functions inherited from art::ModuleBase
virtual ~ModuleBase () noexcept
 
 ModuleBase ()
 
ModuleDescription const & moduleDescription () const
 
void setModuleDescription (ModuleDescription const &)
 
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables () const
 
void sortConsumables (std::string const &current_process_name)
 
template<typename T , BranchType BT>
ViewToken< T > consumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< T > mayConsumeView (InputTag const &tag)
 

Private Member Functions

bool intersectsVolume (const simb::MCParticle &particle, const char *volumeName) const
 

Private Attributes

art::ServiceHandle< geo::Geometrygeom
 

Additional Inherited Members

- Public Types inherited from art::EDFilter
using ModuleType = EDFilter
 
using WorkerType = WorkerT< EDFilter >
 
- Public Types inherited from art::detail::Filter
template<typename UserConfig >
using Table = Modifier::Table< UserConfig >
 
- Public Types inherited from art::Modifier
template<typename UserConfig , typename UserKeysToIgnore = void>
using Table = ProducerTable< UserConfig, detail::ModuleConfig, UserKeysToIgnore >
 
- Static Public Attributes inherited from art::detail::Filter
static constexpr bool Pass {true}
 
static constexpr bool Fail {false}
 
- Protected Member Functions inherited from art::ModuleBase
ConsumesCollectorconsumesCollector ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > consumes (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > mayConsume (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 

Detailed Description

Definition at line 34 of file CosmicFilter_module.cc.

Constructor & Destructor Documentation

CosmicFilter::CosmicFilter ( fhicl::ParameterSet const &  p)
explicit

Definition at line 61 of file CosmicFilter_module.cc.

62  : EDFilter{p}
63 // Initialize member data here.
64 {
65  // Call appropriate produces<>() functions here.
66 }
p
Definition: test.py:223
EDFilter(fhicl::ParameterSet const &pset)
Definition: EDFilter.h:21
CosmicFilter::CosmicFilter ( CosmicFilter const &  )
delete
CosmicFilter::CosmicFilter ( CosmicFilter &&  )
delete

Member Function Documentation

bool CosmicFilter::filter ( art::Event e)
overridevirtual

Implements art::EDFilter.

Definition at line 68 of file CosmicFilter_module.cc.

69 {
70  auto const& mctruths =
71  *e.getValidHandle<std::vector<simb::MCTruth>>(art::InputTag{"generator"});
72 
73  const simb::MCTruth& truth=mctruths.at(0);
74  const simb::MCParticle& cosmic_particle=truth.GetParticle(0);
75  return intersectsVolume(cosmic_particle, "volDetEnclosure_0");
76 }
bool intersectsVolume(const simb::MCParticle &particle, const char *volumeName) const
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
Definition: DataViewImpl.h:441
Event generator information.
Definition: MCTruth.h:32
bool CosmicFilter::intersectsVolume ( const simb::MCParticle particle,
const char *  volumeName 
) const
private

Definition at line 78 of file CosmicFilter_module.cc.

79 {
80  TGeoManager* geoManager=geom->ROOTGeoManager();
81  geoManager->SetCurrentPoint(particle.Vx(), particle.Vy(), particle.Vz());
82  TVector3 unitMom=particle.Momentum().Vect().Unit();
83  geoManager->SetCurrentDirection(unitMom.X(), unitMom.Y(), unitMom.Z());
84  geoManager->FindNextBoundaryAndStep();
85 
86  while(!geoManager->IsOutside()){
87  geoManager->FindNextBoundaryAndStep();
88  if(TString(geoManager->GetPath()).Contains(volumeName)) return true;
89  }
90  return false;
91 }
TGeoManager * ROOTGeoManager() const
Access to the ROOT geometry description manager.
double Vx(const int i=0) const
Definition: MCParticle.h:221
const TLorentzVector & Momentum(const int i=0) const
Definition: MCParticle.h:220
double Vz(const int i=0) const
Definition: MCParticle.h:223
art::ServiceHandle< geo::Geometry > geom
double Vy(const int i=0) const
Definition: MCParticle.h:222
CosmicFilter& CosmicFilter::operator= ( CosmicFilter const &  )
delete
CosmicFilter& CosmicFilter::operator= ( CosmicFilter &&  )
delete

Member Data Documentation

art::ServiceHandle<geo::Geometry> CosmicFilter::geom
private

Definition at line 57 of file CosmicFilter_module.cc.


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