16 #include "G4VPhysicalVolume.hh" 17 #include "G4LogicalVolume.hh" 18 #include "G4NavigationHistory.hh" 19 #include "G4TransportationManager.hh" 35 int dumpTouch(G4VPhysicalVolume *
pv,
unsigned int leafDepth,
int ns);
50 names_ =
p.getUntrackedParameter<std::vector<std::string>>(
"Name");
55 G4cout <<
"PrintMTDSens:: Print position of MTD Sensitive Touchables: " << G4endl;
56 for (
const auto &thisName :
names_) {
57 G4cout <<
" for name " << thisName <<
"\n";
59 G4cout <<
" Total of " <<
names_.size() <<
" sensitive volume types" << G4endl;
65 G4VPhysicalVolume *theTopPV =
getTopPV();
67 G4cout <<
"\nTotal number of sensitive detector volumes for MTD is " <<
ntotal << G4endl;
82 G4ThreeVector globalpoint =
fHistory.GetTopTransform().Inverse().TransformPoint(G4ThreeVector(0, 0, 0));
83 G4LogicalVolume *lv =
pv->GetLogicalVolume();
87 if (
pv->GetMotherLogical()) {
88 mother =
pv->GetMotherLogical()->GetName();
91 for (
const auto &thisName :
names_) {
92 G4String g4name(thisName);
100 if (lv->GetSensitiveDetector() &&
printIt) {
101 std::stringstream sunitt;
107 sunitt << theId.
rawId();
109 G4cout << theId << G4endl;
113 sunitt << theId.
rawId();
115 G4cout << theId << G4endl;
119 auto fround = [&](
double in) {
120 std::stringstream
ss;
125 G4Box *thisSens =
static_cast<G4Box *
>(lv->GetSolid());
126 G4ThreeVector cn1Global =
fHistory.GetTopTransform().Inverse().TransformPoint(
127 G4ThreeVector(thisSens->GetXHalfLength(), thisSens->GetYHalfLength(), thisSens->GetZHalfLength()));
129 sunitt << fround(globalpoint.x()) << fround(globalpoint.y()) << fround(globalpoint.z()) << fround(cn1Global.x())
130 << fround(cn1Global.y()) << fround(cn1Global.z());
134 int NoDaughters = lv->GetNoDaughters();
135 while ((NoDaughters--) > 0) {
136 G4VPhysicalVolume *pvD = lv->GetDaughter(NoDaughters);
137 if (!pvD->IsReplicated())
147 return G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking()->GetWorldVolume();
154 int theSize =
fHistory.GetDepth() + 1;
160 G4cout <<
"Building MTD basenumber:" << G4endl;
162 for (
int ii = theSize;
ii-- > 0;) {
165 G4cout <<
"PrintMTDSens::getBaseNumber(): Adding level " << theSize - 1 -
ii <<
": "
Log< level::Info, true > LogVerbatim
int dumpTouch(G4VPhysicalVolume *pv, unsigned int leafDepth, int ns)
#define DEFINE_SIMWATCHER(type)
bool contains(EventRange const &lh, EventID const &rh)
ETLNumberingScheme etlNS_
std::vector< size_t > nsens_
G4NavigationHistory fHistory
void addLevel(const std::string_view name, const int copyNumber)
PrintMTDSens(edm::ParameterSet const &p)
std::vector< std::string > names_
G4VPhysicalVolume * getTopPV()
BTLNumberingScheme btlNS_
constexpr valType roundIfNear0(valType value, double tolerance=1.e-7)
uint32_t getUnitID(const MTDBaseNumber &baseNumber) const override
constexpr uint32_t rawId() const
get the raw id
ALPAKA_FN_ACC void printIt(const TAcc &acc, C *m, const char *prefix="")
Detector identifier class for the Endcap Timing Layer.
uint32_t getUnitID(const MTDBaseNumber &baseNumber) const override
Detector identifier class for the Barrel Timing Layer. The crystal count must start from 0...
void update(const BeginOfRun *run) override
This routine will be called when the appropriate signal arrives.
void setSize(const int size)