Belle II Software development
OverlapCheckerModule.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#pragma once
10
11#include <framework/core/Module.h>
12#include <framework/datastore/StoreObjPtr.h>
13#include <framework/dataobjects/DisplayData.h>
14#include <G4NavigationHistory.hh>
15
16#include <string>
17#include <vector>
18#include <set>
19
20class G4VPhysicalVolume;
21
22namespace Belle2 {
37
38 public:
39
42
44 void initialize() override;
45
47 void event() override;
48
49 private:
50
62 bool checkVolume(G4VPhysicalVolume* volume, const std::string& path, int depth = 0);
63
65 void handleOverlap(const std::string& geant4Message);
66
67 int m_points{10000};
68 int m_maxErrors{0};
69 int m_maxDepth{0};
70 double m_tolerance{0.};
71 std::string m_prefix{""};
72 std::vector<std::string> m_overlaps;
73 std::set<G4VPhysicalVolume*> m_seen;
74 G4NavigationHistory m_nav;
76 };
78} //Belle2 namespace
Base class for Modules.
Definition: Module.h:72
The geometry overlap check module.
OverlapCheckerModule()
Constructor of the module.
double m_tolerance
tolerance of overlap check
void initialize() override
Initialize the module.
std::string m_prefix
check only volumes beginning with prefix
void event() override
event function: this runs the overlap checker for each event
bool checkVolume(G4VPhysicalVolume *volume, const std::string &path, int depth=0)
Check a volume for overlaps.
int m_points
number of test points
int m_maxErrors
maximum number of errors before skipping current volume
void handleOverlap(const std::string &geant4Message)
Handle a G4Exception with the overlap message issued by Geant4.
std::vector< std::string > m_overlaps
list of overlapping volumes
int m_maxDepth
maximum depth to check
std::set< G4VPhysicalVolume * > m_seen
set of logical volumes we already checked
G4NavigationHistory m_nav
navigation history to remember coordinate transformations
StoreObjPtr< DisplayData > m_displayData
Pointer to the DisplayData where we add the overlap points for rendering.
Type-safe access to single objects in the data store.
Definition: StoreObjPtr.h:96
Abstract base class for different kinds of events.