Belle II Software  release-05-02-19
OverlapCheckerModule.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2010 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Thomas Kuhr *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #ifndef OVERLAPCHECKERMODULE_H
12 #define OVERLAPCHECKERMODULE_H
13 
14 #include <framework/core/Module.h>
15 #include <framework/datastore/StoreObjPtr.h>
16 #include <framework/dataobjects/DisplayData.h>
17 #include <G4NavigationHistory.hh>
18 
19 #include <string>
20 #include <vector>
21 #include <set>
22 
23 class G4VPhysicalVolume;
24 
25 namespace Belle2 {
42  class OverlapCheckerModule: public Module {
43 
44  public:
45 
48 
50  void initialize() override;
51 
53  void event() override;
54 
55  private:
56 
67  bool checkVolume(G4VPhysicalVolume* volume, const std::string& path, int depth = 0);
68 
70  void handleOverlap(const std::string& geant4Message);
71 
72  int m_points{10000};
73  int m_maxErrors{0};
74  int m_maxDepth{0};
75  double m_tolerance{0.};
76  std::string m_prefix{""};
77  std::vector<std::string> m_overlaps;
78  std::set<G4VPhysicalVolume*> m_seen;
79  G4NavigationHistory m_nav;
81  };
83 } //Belle2 namespace
84 #endif
Belle2::OverlapCheckerModule::m_maxErrors
int m_maxErrors
maximum number of errors before skipping current volume
Definition: OverlapCheckerModule.h:73
Belle2::OverlapCheckerModule::initialize
void initialize() override
Initialize the module.
Definition: OverlapCheckerModule.cc:69
Belle2::OverlapCheckerModule::checkVolume
bool checkVolume(G4VPhysicalVolume *volume, const std::string &path, int depth=0)
Check a volume for overlaps.
Definition: OverlapCheckerModule.cc:163
Belle2::OverlapCheckerModule::m_nav
G4NavigationHistory m_nav
navigation history to remember coordinate transformations
Definition: OverlapCheckerModule.h:79
Belle2::OverlapCheckerModule::event
void event() override
event function: this runs the overlap checker for each event
Definition: OverlapCheckerModule.cc:75
Belle2::OverlapCheckerModule::m_points
int m_points
number of test points
Definition: OverlapCheckerModule.h:72
Belle2::Module
Base class for Modules.
Definition: Module.h:74
Belle2::OverlapCheckerModule::m_overlaps
std::vector< std::string > m_overlaps
list of overlapping volumes
Definition: OverlapCheckerModule.h:77
Belle2::OverlapCheckerModule::m_seen
std::set< G4VPhysicalVolume * > m_seen
set of logical volumes we already checked
Definition: OverlapCheckerModule.h:78
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::StoreObjPtr
Type-safe access to single objects in the data store.
Definition: ParticleList.h:33
Belle2::OverlapCheckerModule
The geometry overlap check module.
Definition: OverlapCheckerModule.h:42
Belle2::OverlapCheckerModule::m_prefix
std::string m_prefix
check only volumes beginning with prefix
Definition: OverlapCheckerModule.h:76
Belle2::OverlapCheckerModule::OverlapCheckerModule
OverlapCheckerModule()
Constructor of the module.
Definition: OverlapCheckerModule.cc:48
Belle2::OverlapCheckerModule::m_maxDepth
int m_maxDepth
maximum depth to check
Definition: OverlapCheckerModule.h:74
Belle2::OverlapCheckerModule::m_displayData
StoreObjPtr< DisplayData > m_displayData
Pointer to the DisplayData where we add the overlap points for rendering.
Definition: OverlapCheckerModule.h:80
Belle2::OverlapCheckerModule::m_tolerance
double m_tolerance
tolerance of overlap check
Definition: OverlapCheckerModule.h:75
Belle2::OverlapCheckerModule::handleOverlap
void handleOverlap(const std::string &geant4Message)
Handle a G4Exception with the overlap message issued by Geant4.
Definition: OverlapCheckerModule.cc:104