External Detector
@gcorti @bsiddi @adavis @kreps
This package provides all the necessary tools to embed an external sensitive detector inside any of the geo services (should work with GaussGeo
, DD4hepCnvSvc
(in the future), or any other, custom geo service). This is done using a configurable ExternalDetectorEmbedder
.
In the code, you'll find an implementation of a cuboid-shaped detector (should be enough for the majority of cases) and also a standalone world constructor where you can import your external detector and write it to a GDML file.
Configuration
In order to create an external detector, you have to first add a configurable:
from Configurables import ExternalDetectorEmbedder
external = ExternalDetectorEmbedder("YourEmbedderName")
Now you can start configuring the detectors you'd like to embed in your geometry:
from GaudiKernel.SystemOfUnits import m
external.Shapes = {
"YourShape1": {
"Type": "Cuboid", # required, this calls the right embedder
"xPos": 0. * m, # default
"yPos": 0. * m, # default
"zPos": 0. * m, # default
"xSize": 1. * m,
"ySize": 1. * m,
"zSize": 1. * m,
},
"YourShape2": {
"Type": "Cuboid", # required, this calls the right embedder
"xPos": 1. * m,
"yPos": 1. * m,
"zPos": 1. * m,
"xSize": 1. * m,
"ySize": 1. * m,
"zSize": 1. * m,
},
}
# not required, only if you want to make your volumes sensitive
external.Sensitive = {
"YourShape2": {
"Type": "GiGaSensDetTracker", # required, this calls the right factory
},
}
# not required, only if you want to add a hit extraction algorithm
external.Hit = {
"YourShape2": {
"Type": "GetTrackerHitsAlg",
"ExtendedInfo": True, # anothe available property
},
}
ExternalDetectorWorldCreator
activating in This is a Gaudi::Algorithm
that creates sth similar to a parallel world. This is useful for testing purposes. Basically, the structure is the following: external world + your embedded volumes. YOu can also write this geometry to a GDML file and later load it with GaussGeo.
from Configurables import ExternalDetectorWorldCreator
from Gaudi.Configuration import DEBUG
creator = ExternalDetectorWorldCreator()
# creator.WriteGDML = True # possibility to write to a GDML file
# embedding your detectors in that geometry
external.embed(creator)
GaussGeo
activating in from Configurables import Gauss
Gauss().ExternalDetectorEmbedder = "YourEmbedderName"
Embedding your own, custom shape
ExternalDetector::Embedder
is responsible for building and placing your detector in the mother volume. You have to inherit from it and override ExternalDetector::Embedder::build()
method that creates a G4Box
of your detector.
You can then import your detector by following :
- Inherit directly from
ExternalDetector::Embedder
and then callExternalDetector::Embedder::embed()
in your code. - Inherit also from
IGDMLReader
and then append your fake GDML reader to the list of GDML readers in GeoService for example.
class YourShapeGDMLEmbedder : public extends<YourShapeEmbedder, IGDMLReader> {
public:
using extends::extends;
virtual ~YourShapeGDMLEmbedder() = default;
StatusCode import(G4VPhysicalVolume* world) override {
return embed(world);
}
};
Tests
external_cube.qmt
This test builds a 1m x 1m x 1m cube detector and embeds it in an external world at (0, 0, 0). Here's a graphical visualization:
gauss_geo_planes.qmt
This test build PLANES_NO=4
10m x 10m x 0.01m planes inside LHCb geometry with no other detectors. Each plane is a sensitive detecto of type GiGaSensDetTracker
.