Belle II Software development
GeoPXDCreator Class Reference

The creator for the PXD geometry of the Belle II detector. More...

#include <GeoPXDCreator.h>

Inheritance diagram for GeoPXDCreator:
GeoVXDCreator CreatorBase

Public Member Functions

 GeoPXDCreator ()
 Constructor of the GeoPXDCreator class.
 
virtual ~GeoPXDCreator ()
 The destructor of the GeoPXDCreator class.
 
virtual void create (const GearDir &content, G4LogicalVolume &topVolume, geometry::GeometryTypes type) override
 The old create member: create the configuration object(s) on the fly and call the geometry creation routine.
 
virtual void createPayloads (const GearDir &content, const IntervalOfValidity &iov) override
 Create the configuration objects and save them in the Database.
 
virtual void createFromDB (const std::string &name, G4LogicalVolume &topVolume, geometry::GeometryTypes type) override
 Create the geometry from the Database.
 
virtual VXD::GeoVXDAssembly createLayerSupport ()
 Create support structure for a PXD Layer.
 
virtual VXD::GeoVXDAssembly createLadderSupport ()
 Create support structure for a PXD Ladder.
 
virtual VXD::GeoVXDAssembly createHalfShellSupport (const PXDGeometryPar &parameters)
 Create support structure for PXD Half Shell, that means everything that does not depend on layer or sensor alignment.
 
virtual VXD::SensorInfoBasecreateSensorInfo (const VXDGeoSensorPar &sensor) override
 Read the sensor definitions from the database.
 
PXDSensorInfoParreadSensorInfo (const GearDir &sensor)
 Read the sensor definitions from the gearbox.
 
virtual VXD::SensitiveDetectorBasecreateSensitiveDetector (VxdID sensorID, const VXDGeoSensor &sensor, const VXDGeoSensorPlacement &placement) override
 Return a SensitiveDetector implementation for a given sensor.
 
void readHalfShellSupport (const GearDir &support, PXDGeometryPar &pxdGeometryPar)
 Create support structure for VXD Half Shell, that means everything that does not depend on layer or sensor alignment.
 
virtual void setCurrentLayer (int layer, const VXDGeometryPar &parameters)
 Read parameters for given layer and store in m_ladder.
 
G4Transform3D placeLadder (int ladderID, double phi, G4LogicalVolume *volume, const G4Transform3D &placement, const VXDGeometryPar &parameters)
 Place ladder corresponding to the given ladder id into volume setLayer has to be called first to set the correct layer id.
 
G4Transform3D getPosition (const VXDGeoComponent &mother, const VXDGeoComponent &daughter, const VXDGeoPlacement &placement, bool originCenter)
 Return the position where a daughter component is to be placed.
 
G4Transform3D getAlignment (const VXDAlignmentPar &params)
 Get Alignment from paylead object.
 
GeoVXDAssembly createSubComponents (const std::string &name, VXDGeoComponent &component, std::vector< VXDGeoPlacement > placements, bool originCenter=true, bool allowOutside=false)
 Place a list of subcomponents into an component.
 
G4VSolid * createTrapezoidal (const std::string &name, double width, double width2, double length, double &height, double angle=0)
 Create a trapezoidal solid.
 
void createDiamonds (const VXDGeoRadiationSensorsPar &params, G4LogicalVolume &topVolume, G4LogicalVolume &envelopeVolume)
 Create diamond radiation sensors.
 
std::vector< VXDGeoPlacementPargetSubComponents (const GearDir &path)
 Return vector of VXDGeoPlacements with all the components defined inside a given path.
 
virtual void readLadder (int layer, GearDir components, VXDGeometryPar &geoparameters)
 Read parameters for a ladder in layer with given ID from gearbox and layer store them in payload.
 
virtual void readLadderComponents (int layerID, int ladderID, GearDir content, VXDGeometryPar &vxdGeometryPar)
 Read parameters for ladder components and their alignment corresponding to the given ladder id.
 
void readComponent (const std::string &name, GearDir components, VXDGeometryPar &vxdGeometryPar)
 Read parameters for component name from Gearbox into geometry payload.
 
void readSubComponents (const std::vector< VXDGeoPlacementPar > &placements, const GearDir &componentsDir, VXDGeometryPar &vxdGeometryPar)
 Read parameters for all components in placement container from Gearbox into payload.
 
 BELLE2_DEFINE_EXCEPTION (DBNotImplemented, "Cannot create geometry from Database.")
 Exception that will be thrown in createFromDB if member is not yet implemented by creator.
 

Protected Attributes

std::string m_prefix
 Prefix to prepend to all volume names.
 
GearDir m_alignment
 GearDir pointing to the alignment parameters.
 
GearDir m_components
 GearDir pointing to the toplevel of the components.
 
std::map< std::string, VXDGeoComponentm_componentCache
 Cache of all previously created components.
 
std::map< std::string, VXDGeoSensorm_sensorMap
 Map containing Information about all defined sensor types.
 
VXDGeoLadder m_ladder
 Parameters of the currently active ladder.
 
std::vector< Simulation::SensitiveDetectorBase * > m_sensitive
 List to all created sensitive detector instances.
 
GeoVXDRadiationSensors m_radiationsensors
 Diamond radiation sensor "sub creator".
 
std::string m_defaultMaterial
 Name of the Material to be used for Air.
 
float m_distanceTolerance {(float)(5 * Unit::um)}
 tolerance for Geant4 steps to be merged to a single step
 
float m_electronTolerance {100}
 tolerance for the energy deposition in electrons to be merged in a single step
 
float m_minimumElectrons {10}
 minimum number of electrons to be deposited by a particle to be saved
 
double m_activeStepSize {5 * Unit::um}
 Stepsize to be used inside active volumes.
 
bool m_activeChips {false}
 Make also chips sensitive.
 
bool m_seeNeutrons {false}
 Make sensitive detectors also see neutrons.
 
bool m_onlyPrimaryTrueHits {false}
 If true only create TrueHits from primary particles and ignore secondaries.
 
bool m_onlyActiveMaterial {false}
 If this is true, only active Materials will be placed for tracking studies.
 
std::vector< G4UserLimits * > m_UserLimits
 Vector of G4UserLimit pointers.
 
std::string m_currentHalfShell {""}
 Current half-shell being processed (need to know ladder parent for hierarchy)
 
std::map< std::string, Belle2::VxdIDm_halfShellVxdIDs
 Used for translation of half-shell name into a VxdID to consitently handle it in hierarchy.
 

Private Member Functions

PXDGeometryPar createConfiguration (const GearDir &param)
 Create a parameter object from the Gearbox XML parameters.
 
void createGeometry (const PXDGeometryPar &parameters, G4LogicalVolume &topVolume, geometry::GeometryTypes type)
 Create the geometry from a parameter object.
 

Private Attributes

std::vector< SensorInfo * > m_SensorInfo
 Vector of points to SensorInfo objects.
 

Detailed Description

The creator for the PXD geometry of the Belle II detector.


Definition at line 27 of file GeoPXDCreator.h.

Constructor & Destructor Documentation

◆ GeoPXDCreator()

GeoPXDCreator ( )
inline

Constructor of the GeoPXDCreator class.

Definition at line 36 of file GeoPXDCreator.h.

36: VXD::GeoVXDCreator("PXD") {};

◆ ~GeoPXDCreator()

~GeoPXDCreator ( )
virtual

The destructor of the GeoPXDCreator class.

Definition at line 51 of file GeoPXDCreator.cc.

52 {
53 for (SensorInfo* sensorInfo : m_SensorInfo) delete sensorInfo;
54 m_SensorInfo.clear();
55 }
std::vector< SensorInfo * > m_SensorInfo
Vector of points to SensorInfo objects.

Member Function Documentation

◆ create()

virtual void create ( const GearDir content,
G4LogicalVolume &  topVolume,
geometry::GeometryTypes  type 
)
inlineoverridevirtual

The old create member: create the configuration object(s) on the fly and call the geometry creation routine.

Implements CreatorBase.

Definition at line 43 of file GeoPXDCreator.h.

44 {
45 PXDGeometryPar config = createConfiguration(content);
46 createGeometry(config, topVolume, type);
47 }
void createGeometry(const PXDGeometryPar &parameters, G4LogicalVolume &topVolume, geometry::GeometryTypes type)
Create the geometry from a parameter object.
PXDGeometryPar createConfiguration(const GearDir &param)
Create a parameter object from the Gearbox XML parameters.

◆ createConfiguration()

PXDGeometryPar createConfiguration ( const GearDir param)
private

Create a parameter object from the Gearbox XML parameters.

Definition at line 132 of file GeoPXDCreator.cc.

133 {
134 // Create an empty payload
135 PXDGeometryPar pxdGeometryPar;
136
137 //Read prefix ('SVD' or 'PXD')
138 pxdGeometryPar.setPrefix(m_prefix);
139
140 //Read some global parameters
141 VXDGlobalPar globals((float)content.getDouble("ElectronTolerance", 100),
142 (float)content.getDouble("MinimumElectrons", 10),
143 content.getLength("ActiveStepSize", 0.005),
144 content.getBool("ActiveChips", false),
145 content.getBool("SeeNeutrons", false),
146 content.getBool("OnlyPrimaryTrueHits", false),
147 content.getBool("OnlyActiveMaterial", false),
148 (float)content.getLength("DistanceTolerance", 0.005),
149 content.getString("DefaultMaterial", "Air")
150 );
151 pxdGeometryPar.setGlobalParams(globals);
152
153 //Read envelope parameters
154 GearDir envelopeParams(content, "Envelope/");
155 VXDEnvelopePar envelope(envelopeParams.getString("Name", ""),
156 envelopeParams.getString("Material", "Air"),
157 envelopeParams.getString("Color", ""),
158 envelopeParams.getAngle("minPhi", 0),
159 envelopeParams.getAngle("maxPhi", 2 * M_PI),
160 (envelopeParams.getNodes("InnerPoints/point").size() > 0)
161 );
162
163 for (const GearDir& point : envelopeParams.getNodes("InnerPoints/point")) {
164 pair<double, double> ZXPoint(point.getLength("z"), point.getLength("x"));
165 envelope.getInnerPoints().push_back(ZXPoint);
166 }
167 for (const GearDir& point : envelopeParams.getNodes("OuterPoints/point")) {
168 pair<double, double> ZXPoint(point.getLength("z"), point.getLength("x"));
169 envelope.getOuterPoints().push_back(ZXPoint);
170 }
171 pxdGeometryPar.setEnvelope(envelope);
172
173 // Read alignment for detector m_prefix ('PXD' or 'SVD')
174 string pathAlign = (boost::format("Align[@component='%1%']/") % m_prefix).str();
175 GearDir paramsAlign(GearDir(content, "Alignment/"), pathAlign);
176 if (!paramsAlign) {
177 B2WARNING("Could not find alignment parameters for component " << m_prefix);
178 return pxdGeometryPar;
179 }
180 pxdGeometryPar.getAlignmentMap()[m_prefix] = VXDAlignmentPar(paramsAlign.getLength("du"),
181 paramsAlign.getLength("dv"),
182 paramsAlign.getLength("dw"),
183 paramsAlign.getAngle("alpha"),
184 paramsAlign.getAngle("beta"),
185 paramsAlign.getAngle("gamma")
186 );
187
188 //Read the definition of all sensor types
189 GearDir components(content, "Components/");
190 for (const GearDir& paramsSensor : components.getNodes("Sensor")) {
191 string sensorTypeID = paramsSensor.getString("@type");
192
193 VXDGeoSensorPar sensor(paramsSensor.getString("Material"),
194 paramsSensor.getString("Color", ""),
195 paramsSensor.getLength("width"),
196 paramsSensor.getLength("width2", 0),
197 paramsSensor.getLength("length"),
198 paramsSensor.getLength("height"),
199 paramsSensor.getAngle("angle", 0),
200 paramsSensor.getBool("@slanted", false)
201 );
202 sensor.setActive(VXDGeoComponentPar(
203 paramsSensor.getString("Material"),
204 paramsSensor.getString("Active/Color", "#f00"),
205 paramsSensor.getLength("Active/width"),
206 paramsSensor.getLength("Active/width2", 0),
207 paramsSensor.getLength("Active/length"),
208 paramsSensor.getLength("Active/height")
209 ), VXDGeoPlacementPar(
210 "Active",
211 paramsSensor.getLength("Active/u"),
212 paramsSensor.getLength("Active/v"),
213 paramsSensor.getString("Active/w", "center"),
214 paramsSensor.getLength("Active/woffset", 0)
215 ));
216
217 PXDSensorInfoPar* pxdInfo = readSensorInfo(GearDir(paramsSensor, "Active"));
218 sensor.setSensorInfo(pxdInfo);
219 sensor.setComponents(getSubComponents(paramsSensor));
220 pxdGeometryPar.getSensorMap()[sensorTypeID] = sensor;
221 pxdGeometryPar.getSensorInfos().push_back(pxdInfo);
222 }
223
224 //Build all ladders including Sensors
225 GearDir support(content, "Support/");
226 readHalfShellSupport(support, pxdGeometryPar);
227
228 for (const GearDir& shell : content.getNodes("HalfShell")) {
229
230 string shellName = m_prefix + "." + shell.getString("@name");
231 string pathShell = (boost::format("Align[@component='%1%']/") % shellName).str();
232 GearDir paramsShell(GearDir(content, "Alignment/"), pathShell);
233 if (!paramsShell) {
234 B2WARNING("Could not find alignment parameters for component " << shellName);
235 return pxdGeometryPar;
236 }
237 pxdGeometryPar.getAlignmentMap()[shellName] = VXDAlignmentPar(paramsShell.getLength("du"),
238 paramsShell.getLength("dv"),
239 paramsShell.getLength("dw"),
240 paramsShell.getAngle("alpha"),
241 paramsShell.getAngle("beta"),
242 paramsShell.getAngle("gamma")
243 );
244
245 VXDHalfShellPar halfShell(shell.getString("@name"), shell.getAngle("shellAngle", 0));
246
247 for (const GearDir& layer : shell.getNodes("Layer")) {
248 int layerID = layer.getInt("@id");
249
250 readLadder(layerID, components, pxdGeometryPar);
251
252 //Loop over defined ladders
253 for (const GearDir& ladder : layer.getNodes("Ladder")) {
254 int ladderID = ladder.getInt("@id");
255 double phi = ladder.getAngle("phi", 0);
256 readLadderComponents(layerID, ladderID, content, pxdGeometryPar);
257 halfShell.addLadder(layerID, ladderID, phi);
258 }
259 }
260 pxdGeometryPar.getHalfShells().push_back(halfShell);
261 }
262
263 //Create diamond radiation sensors if defined and in background mode
264 GearDir radiationDir(content, "RadiationSensors");
265 if (pxdGeometryPar.getGlobalParams().getActiveChips() && radiationDir) {
266 VXDGeoRadiationSensorsPar radiationSensors(
267 m_prefix,
268 radiationDir.getBool("insideEnvelope"),
269 radiationDir.getLength("width"),
270 radiationDir.getLength("length"),
271 radiationDir.getLength("height"),
272 radiationDir.getString("material")
273 );
274
275 //Add radiation sensor positions
276 for (GearDir& position : radiationDir.getNodes("position")) {
277 VXDGeoRadiationSensorsPositionPar diamonds(position.getLength("z"),
278 position.getLength("radius"),
279 position.getAngle("theta")
280 );
281
282 //Loop over all phi positions
283 for (GearDir& sensor : position.getNodes("phi")) {
284 //Add sensor with angle and id
285 diamonds.addSensor(sensor.getInt("@id"), sensor.getAngle());
286 }
287 radiationSensors.addPosition(diamonds);
288 }
289 pxdGeometryPar.setRadiationSensors(radiationSensors);
290 }
291
292 return pxdGeometryPar;
293 }
void readHalfShellSupport(const GearDir &support, PXDGeometryPar &pxdGeometryPar)
Create support structure for VXD Half Shell, that means everything that does not depend on layer or s...
PXDSensorInfoPar * readSensorInfo(const GearDir &sensor)
Read the sensor definitions from the gearbox.
virtual void readLadderComponents(int layerID, int ladderID, GearDir content, VXDGeometryPar &vxdGeometryPar)
Read parameters for ladder components and their alignment corresponding to the given ladder id.
std::string m_prefix
Prefix to prepend to all volume names.
virtual void readLadder(int layer, GearDir components, VXDGeometryPar &geoparameters)
Read parameters for a ladder in layer with given ID from gearbox and layer store them in payload.
std::vector< VXDGeoPlacementPar > getSubComponents(const GearDir &path)
Return vector of VXDGeoPlacements with all the components defined inside a given path.

◆ createDiamonds()

void createDiamonds ( const VXDGeoRadiationSensorsPar params,
G4LogicalVolume &  topVolume,
G4LogicalVolume &  envelopeVolume 
)
inherited

Create diamond radiation sensors.

Definition at line 209 of file GeoVXDCreator.cc.

211 {
212 //Set the correct top volume to either global top or detector envelope
213 G4LogicalVolume* top = &topVolume;
214 if (params.getInsideEnvelope()) {
215 top = &envelopeVolume;
216 }
217
218 //shape and material are the same for all sensors so create them now
219 const double width = params.getWidth();
220 const double length = params.getLength();
221 const double height = params.getHeight();
222 G4Box* shape = 0;
223 G4Material* material = geometry::Materials::get(params.getMaterial());
224
225 //Now loop over all positions
226 const std::vector<VXDGeoRadiationSensorsPositionPar>& Positions = params.getPositions();
227 for (const VXDGeoRadiationSensorsPositionPar& position : Positions) {
228 //get the radial and z position
229 const double r = position.getRadius();
230 const double z = position.getZ();
231 const double theta = position.getTheta();
232 //and loop over all phi positions
233 const std::map<int, double>& Sensors = position.getSensors();
234 for (const std::pair<const int, double>& sensor : Sensors) {
235 //for (GearDir& sensor : position.getNodes("phi")) {
236 //we need angle and Id
237 const double phi = sensor.second;
238 const int id = sensor.first;
239 //then we create a nice name
240 const std::string name = params.getSubDetector() + ".DiamondSensor." + std::to_string(id);
241 //and create the sensor volume
242 if (not shape) shape = new G4Box("radiationSensorDiamond", width / 2 * CLHEP::cm, length / 2 * CLHEP::cm, height / 2 * CLHEP::cm);
243 G4LogicalVolume* volume = new G4LogicalVolume(shape, material, name);
244 //add a sensitive detector implementation
245 BkgSensitiveDetector* sensitive = new BkgSensitiveDetector(params.getSubDetector().c_str(), id);
246 volume->SetSensitiveDetector(sensitive);
247 //and place it at the correct position
248 G4Transform3D transform = G4RotateZ3D(phi - M_PI / 2) * G4Translate3D(0, r * CLHEP::cm,
249 z * CLHEP::cm) * G4RotateX3D(-M_PI / 2 - theta);
250 new G4PVPlacement(transform, volume, name, top, false, 1);
251 }
252 }
253 }
static G4Material * get(const std::string &name)
Find given material.
Definition: Materials.h:63
std::map< VxdID, Sensor > Sensors
Map of all hits in all Sensors.

◆ createFromDB()

virtual void createFromDB ( const std::string &  name,
G4LogicalVolume &  topVolume,
geometry::GeometryTypes  type 
)
inlineoverridevirtual

Create the geometry from the Database.

Reimplemented from CreatorBase.

Definition at line 60 of file GeoPXDCreator.h.

61 {
62 DBObjPtr<PXDGeometryPar> dbObj;
63 if (!dbObj) {
64 // Check that we found the object and if not report the problem
65 B2FATAL("No configuration for " << name << " found.");
66 }
67 createGeometry(*dbObj, topVolume, type);
68 }

◆ createGeometry()

void createGeometry ( const PXDGeometryPar parameters,
G4LogicalVolume &  topVolume,
geometry::GeometryTypes  type 
)
private

Create the geometry from a parameter object.

Definition at line 344 of file GeoPXDCreator.cc.

345 {
346
347 m_activeStepSize = parameters.getGlobalParams().getActiveStepSize() / Unit::mm;
348 m_activeChips = parameters.getGlobalParams().getActiveChips();
349 m_seeNeutrons = parameters.getGlobalParams().getSeeNeutrons();
350 m_onlyPrimaryTrueHits = parameters.getGlobalParams().getOnlyPrimaryTrueHits();
351 m_distanceTolerance = parameters.getGlobalParams().getDistanceTolerance();
352 m_electronTolerance = parameters.getGlobalParams().getElectronTolerance();
353 m_minimumElectrons = parameters.getGlobalParams().getMinimumElectrons();
354 m_onlyActiveMaterial = parameters.getGlobalParams().getOnlyActiveMaterial();
355 m_defaultMaterial = parameters.getGlobalParams().getDefaultMaterial();
356
357 G4Material* material = Materials::get(m_defaultMaterial);
358 if (!material) B2FATAL("Default Material of VXD, '" << m_defaultMaterial << "', could not be found");
359
360
361 //Build envelope
362 G4LogicalVolume* envelope(0);
363 G4VPhysicalVolume* physEnvelope{nullptr};
364 if (!parameters.getEnvelope().getExists()) {
365 B2INFO("Could not find definition for " + m_prefix + " Envelope, placing directly in top volume");
366 envelope = &topVolume;
367 } else {
368 double minZ(0), maxZ(0);
369 G4Polycone* envelopeCone = geometry::createRotationSolid("Envelope",
370 parameters.getEnvelope().getInnerPoints(),
371 parameters.getEnvelope().getOuterPoints(),
372 parameters.getEnvelope().getMinPhi(),
373 parameters.getEnvelope().getMaxPhi(),
374 minZ, maxZ
375 );
376 envelope = new G4LogicalVolume(envelopeCone, material, m_prefix + ".Envelope");
377 setVisibility(*envelope, false);
378 physEnvelope = new G4PVPlacement(getAlignment(parameters.getAlignment(m_prefix)), envelope, m_prefix + ".Envelope",
379 &topVolume, false, 1);
380
381 // Set up region for production cuts
382 G4Region* aRegion = new G4Region("PXDEnvelope");
383 envelope->SetRegion(aRegion);
384 aRegion->AddRootLogicalVolume(envelope);
385 }
386
387 //Read the definition of all sensor types
388 for (const pair<const string, VXDGeoSensorPar>& typeAndSensor : parameters.getSensorMap()) {
389 const string& sensorTypeID = typeAndSensor.first;
390 const VXDGeoSensorPar& paramsSensor = typeAndSensor.second;
391 VXDGeoSensor sensor(
392 paramsSensor.getMaterial(),
393 paramsSensor.getColor(),
394 paramsSensor.getWidth() / Unit::mm,
395 paramsSensor.getWidth2() / Unit::mm,
396 paramsSensor.getLength() / Unit::mm,
397 paramsSensor.getHeight() / Unit::mm,
398 paramsSensor.getSlanted()
399 );
400 sensor.setActive(VXDGeoComponent(
401 paramsSensor.getMaterial(),
402 paramsSensor.getActiveArea().getColor(),
403 paramsSensor.getActiveArea().getWidth() / Unit::mm,
404 paramsSensor.getActiveArea().getWidth2() / Unit::mm,
405 paramsSensor.getActiveArea().getLength() / Unit::mm,
406 paramsSensor.getActiveArea().getHeight() / Unit::mm
407 ), VXDGeoPlacement(
408 "Active",
409 paramsSensor.getActivePlacement().getU() / Unit::mm,
410 paramsSensor.getActivePlacement().getV() / Unit::mm,
411 paramsSensor.getActivePlacement().getW(),
412 paramsSensor.getActivePlacement().getWOffset() / Unit::mm
413 ));
414 sensor.setSensorInfo(createSensorInfo(paramsSensor));
415
416 vector<VXDGeoPlacement> subcomponents;
417 const auto& components = paramsSensor.getComponents();
418 subcomponents.reserve(components.size());
419 std::transform(components.begin(), components.end(), std::back_inserter(subcomponents),
420 [](auto const & component) {
421 return VXDGeoPlacement(component.getName(),
422 component.getU() / Unit::mm,
423 component.getV() / Unit::mm,
424 component.getW(),
425 component.getWOffset() / Unit::mm
426 );
427 });
428 sensor.setComponents(subcomponents);
429 m_sensorMap[sensorTypeID] = sensor;
430 }
431
432 //Read the component cache from DB
433 for (const string& name : parameters.getComponentInsertOder()) {
434 if (m_componentCache.find(name) != m_componentCache.end()) {
435 // already created due to being a sub component of a previous
436 // component. Seems fishy since the information of this component
437 // is in the db at least twice so we could run into
438 // inconsistencies.
439 B2WARNING("Component " << name << " already created from previous subcomponents, should not be here");
440 continue;
441 }
442 const VXDGeoComponentPar& paramsComponent = parameters.getComponent(name);
443 VXDGeoComponent c(
444 paramsComponent.getMaterial(),
445 paramsComponent.getColor(),
446 paramsComponent.getWidth() / Unit::mm,
447 paramsComponent.getWidth2() / Unit::mm,
448 paramsComponent.getLength() / Unit::mm,
449 paramsComponent.getHeight() / Unit::mm
450 );
451 double angle = paramsComponent.getAngle();
452
453
454 if (c.getWidth() <= 0 || c.getLength() <= 0 || c.getHeight() <= 0) {
455 B2DEBUG(100, "One dimension empty, using auto resize for component");
456 } else {
457 G4VSolid* solid = createTrapezoidal(m_prefix + "." + name, c.getWidth(), c.getWidth2(), c.getLength(), c.getHeight(), angle);
458 c.setVolume(new G4LogicalVolume(solid, Materials::get(c.getMaterial()), m_prefix + "." + name));
459 }
460
461 vector<VXDGeoPlacement> subComponents;
462 const auto& paramsSubComponents = paramsComponent.getSubComponents();
463 subComponents.reserve(paramsSubComponents.size());
464 std::transform(paramsSubComponents.begin(), paramsSubComponents.end(), std::back_inserter(subComponents),
465 [](auto const & paramsSubComponent) {
466 return VXDGeoPlacement(paramsSubComponent.getName(),
467 paramsSubComponent.getU() / Unit::mm,
468 paramsSubComponent.getV() / Unit::mm,
469 paramsSubComponent.getW(),
470 paramsSubComponent.getWOffset() / Unit::mm
471 );
472 });
473 createSubComponents(m_prefix + "." + name, c, subComponents);
474 if (m_activeChips && parameters.getSensitiveChipID(name) >= 0) {
475 int chipID = parameters.getSensitiveChipID(name);
476 B2DEBUG(50, "Creating BkgSensitiveDetector for component " << name << " with chipID " << chipID);
477 BkgSensitiveDetector* sensitive = new BkgSensitiveDetector(m_prefix.c_str(), chipID);
478 c.getVolume()->SetSensitiveDetector(sensitive);
479 m_sensitive.push_back(sensitive);
480 }
481
482 m_componentCache[name] = c;
483 }
484
485 //Build all ladders including Sensors
486 VXD::GeoVXDAssembly shellSupport = createHalfShellSupport(parameters);
487
488 //const std::vector<VXDHalfShellPar>& HalfShells = parameters.getHalfShells();
489 for (const VXDHalfShellPar& shell : parameters.getHalfShells()) {
490 string shellName = shell.getName();
491 m_currentHalfShell = m_prefix + "." + shellName;
492 G4Transform3D shellAlignment = getAlignment(parameters.getAlignment(m_currentHalfShell));
493
494 // Remember shell coordinate system (into which ladders are inserted)
496
497 //Place shell support
498 double shellAngle = shell.getShellAngle(); // Only used to move support, not active volumes!
499 if (!m_onlyActiveMaterial) shellSupport.place(envelope, shellAlignment * G4RotateZ3D(shellAngle));
500
501 //const std::map< int, std::vector<std::pair<int, double>> >& Layers = shell.getLayers();
502 for (const std::pair<const int, std::vector<std::pair<int, double>> >& layer : shell.getLayers()) {
503 int layerID = layer.first;
504 const std::vector<std::pair<int, double>>& Ladders = layer.second;
505
506
507 setCurrentLayer(layerID, parameters);
508
509 //Place Layer support
510 VXD::GeoVXDAssembly layerSupport = createLayerSupport();
511 if (!m_onlyActiveMaterial) layerSupport.place(envelope, shellAlignment * G4RotateZ3D(shellAngle));
512 VXD::GeoVXDAssembly ladderSupport = createLadderSupport();
513
514 //Loop over defined ladders
515 for (const std::pair<int, double>& ladder : Ladders) {
516 int ladderID = ladder.first;
517 double phi = ladder.second;
518
519 G4Transform3D ladderPlacement = placeLadder(ladderID, phi, envelope, shellAlignment, parameters);
520 if (!m_onlyActiveMaterial) ladderSupport.place(envelope, ladderPlacement);
521 }
522
523 }
524 }
525
526 //Now build cache with all transformations
527 if (physEnvelope) {
529 } else {
530 //create a temporary placement of the top volume.
531 G4PVPlacement topPlacement(nullptr, G4ThreeVector(0, 0, 0), &topVolume,
532 "temp_Top", nullptr, false, 1, false);
533 //and search for all VXD sensitive sensors within
535 }
536
537 //Create diamond radiation sensors if defined and in background mode
538 if (m_activeChips) {
539 if (parameters.getRadiationSensors().getSubDetector() == "") {
540 B2DEBUG(10, "Apparently no radiation sensors defined, skipping");
541 } else {
542 createDiamonds(parameters.getRadiationSensors(), topVolume, *envelope);
543 }
544 }
545 }
virtual VXD::GeoVXDAssembly createLayerSupport()
Create support structure for a PXD Layer.
virtual VXD::GeoVXDAssembly createLadderSupport()
Create support structure for a PXD Ladder.
virtual VXD::GeoVXDAssembly createHalfShellSupport(const PXDGeometryPar &parameters)
Create support structure for PXD Half Shell, that means everything that does not depend on layer or s...
virtual VXD::SensorInfoBase * createSensorInfo(const VXDGeoSensorPar &sensor) override
Read the sensor definitions from the database.
static const double mm
[millimeters]
Definition: Unit.h:70
void findVolumes(G4VPhysicalVolume *envelope)
Search a given Geometry for Sensors.
Definition: GeoCache.cc:78
static GeoCache & getInstance()
Return a reference to the singleton instance.
Definition: GeoCache.cc:214
void addHalfShellPlacement(VxdID halfShell, const G4Transform3D &placement)
Remember how half-shell is placed into world volume.
Definition: GeoCache.cc:232
std::map< std::string, VXDGeoSensor > m_sensorMap
Map containing Information about all defined sensor types.
float m_minimumElectrons
minimum number of electrons to be deposited by a particle to be saved
G4VSolid * createTrapezoidal(const std::string &name, double width, double width2, double length, double &height, double angle=0)
Create a trapezoidal solid.
void createDiamonds(const VXDGeoRadiationSensorsPar &params, G4LogicalVolume &topVolume, G4LogicalVolume &envelopeVolume)
Create diamond radiation sensors.
std::vector< Simulation::SensitiveDetectorBase * > m_sensitive
List to all created sensitive detector instances.
bool m_onlyActiveMaterial
If this is true, only active Materials will be placed for tracking studies.
double m_activeStepSize
Stepsize to be used inside active volumes.
float m_distanceTolerance
tolerance for Geant4 steps to be merged to a single step
std::map< std::string, Belle2::VxdID > m_halfShellVxdIDs
Used for translation of half-shell name into a VxdID to consitently handle it in hierarchy.
bool m_onlyPrimaryTrueHits
If true only create TrueHits from primary particles and ignore secondaries.
float m_electronTolerance
tolerance for the energy deposition in electrons to be merged in a single step
G4Transform3D getAlignment(const VXDAlignmentPar &params)
Get Alignment from paylead object.
GeoVXDAssembly createSubComponents(const std::string &name, VXDGeoComponent &component, std::vector< VXDGeoPlacement > placements, bool originCenter=true, bool allowOutside=false)
Place a list of subcomponents into an component.
std::map< std::string, VXDGeoComponent > m_componentCache
Cache of all previously created components.
G4Transform3D placeLadder(int ladderID, double phi, G4LogicalVolume *volume, const G4Transform3D &placement, const VXDGeometryPar &parameters)
Place ladder corresponding to the given ladder id into volume setLayer has to be called first to set ...
virtual void setCurrentLayer(int layer, const VXDGeometryPar &parameters)
Read parameters for given layer and store in m_ladder.
bool m_seeNeutrons
Make sensitive detectors also see neutrons.
std::string m_defaultMaterial
Name of the Material to be used for Air.
bool m_activeChips
Make also chips sensitive.
std::string m_currentHalfShell
Current half-shell being processed (need to know ladder parent for hierarchy)
G4Polycone * createRotationSolid(const std::string &name, const GearDir &params, double &minZ, double &maxZ)
Create a solid by roating two polylines around the Z-Axis.
Definition: utilities.cc:203
void setVisibility(G4LogicalVolume &volume, bool visible)
Helper function to quickly set the visibility of a given volume.
Definition: utilities.cc:108

◆ createHalfShellSupport()

VXD::GeoVXDAssembly createHalfShellSupport ( const PXDGeometryPar parameters)
virtual

Create support structure for PXD Half Shell, that means everything that does not depend on layer or sensor alignment.

Parameters
parametersReference to the database containing the parameters

Definition at line 561 of file GeoPXDCreator.cc.

562 {
563 VXD::GeoVXDAssembly supportAssembly;
564
565 if (!parameters.getBuildSupport()) return supportAssembly;
566
567
568 // Create the Endlanges
569 const std::vector<VXDPolyConePar> Endflanges = parameters.getEndflanges();
570 for (const VXDPolyConePar& endflange : Endflanges) {
571
572 double minZ(0), maxZ(0);
573 string name = endflange.getName();
574
575 // Create a polycone
576 double minPhi = endflange.getMinPhi();
577 double dPhi = endflange.getMaxPhi() - minPhi;
578 int nPlanes = endflange.getPlanes().size();
579 if (nPlanes < 2) {
580 B2ERROR("Polycone needs at least two planes");
581 return supportAssembly;
582 }
583 std::vector<double> z(nPlanes, 0);
584 std::vector<double> rMin(nPlanes, 0);
585 std::vector<double> rMax(nPlanes, 0);
586 int index(0);
587 minZ = numeric_limits<double>::infinity();
588 maxZ = -numeric_limits<double>::infinity();
589
590 const std::vector<VXDPolyConePlanePar> Planes = endflange.getPlanes();
591 for (const VXDPolyConePlanePar& plane : Planes) {
592 z[index] = plane.getPosZ() / Unit::mm;
593 minZ = min(minZ, z[index]);
594 maxZ = max(maxZ, z[index]);
595 rMin[index] = plane.getInnerRadius() / Unit::mm;
596 rMax[index] = plane.getOuterRadius() / Unit::mm;
597 ++index;
598 }
599
600 G4VSolid* supportCone = new G4Polycone(name, minPhi, dPhi, nPlanes, z.data(), rMin.data(), rMax.data());
601
602
603 //Cutout boxes to make place for modules
604
605 //We have the z dimensions of the polycon. Let's
606 //add 1mm on each side to make sure we don't run into problems when the
607 //surfaces match
608 minZ -= 1. / Unit::mm;
609 maxZ += 1. / Unit::mm;
610
611
612 //Now get the number of cutouts and their size/position/angle
613 int nCutouts = parameters.getNCutOuts();
614 double sizeX = parameters.getCutOutWidth() / Unit::mm / 2.;
615 double sizeY = parameters.getCutOutHeight() / Unit::mm / 2.;
616 double sizeZ = (maxZ - minZ) / 2.;
617 G4ThreeVector origin(
618 parameters.getCutOutShift() / Unit::mm,
619 parameters.getCutOutRPhi() / Unit::mm,
620 minZ + sizeZ
621 );
622
623 double phi0 = parameters.getCutOutStartPhi();
624 double dphi = parameters.getCutOutDeltaPhi();
625 for (int i = 0; i < nCutouts; ++i) {
626 G4Box* box = new G4Box("Cutout", sizeX, sizeY, sizeZ);
627 G4Transform3D placement = G4RotateZ3D(phi0 + i * dphi) * G4Translate3D(origin);
628 G4VSolid* supportConeOld = supportCone;
629 supportCone = new G4SubtractionSolid("PXD Support endflange", supportConeOld, box, placement);
630 }
631
632
633 string materialName = endflange.getMaterial();
634 G4Material* material = geometry::Materials::get(materialName);
635 if (!material) B2FATAL("Material '" << materialName << "', required by PXD component " << name << ", could not be found");
636
637 G4LogicalVolume* volume = new G4LogicalVolume(supportCone, material, name);
638 geometry::setColor(*volume, "#ccc4");
639 supportAssembly.add(volume);
640
641 }
642
643
644 //Create Carbon cooling tubes
645 {
646 int nTubes = parameters.getNTubes();
647 double minZ = parameters.getTubesMinZ() / Unit::mm;
648 double maxZ = parameters.getTubesMaxZ() / Unit::mm;
649 double minR = parameters.getTubesMinR() / Unit::mm;
650 double maxR = parameters.getTubesMaxR() / Unit::mm;
651 double sizeZ = (maxZ - minZ) / 2.;
652 double shiftX = parameters.getTubesRPhi() / Unit::mm;
653 double shiftY = 0;
654 double shiftZ = minZ + sizeZ;
655 double phi0 = parameters.getTubesStartPhi();
656 double dphi = parameters.getTubesDeltaPhi();
657 string material = parameters.getTubesMaterial();
658
659 G4Tubs* tube = new G4Tubs("CarbonTube", minR, maxR, sizeZ, 0, 2 * M_PI);
660 G4LogicalVolume* tubeVol = new G4LogicalVolume(tube, geometry::Materials::get(material), "CarbonTube");
661 geometry::setColor(*tubeVol, "#000");
662 for (int i = 0; i < nTubes; ++i) {
663 G4Transform3D placement = G4RotateZ3D(phi0 + i * dphi) * G4Translate3D(shiftX, shiftY, shiftZ);
664 supportAssembly.add(tubeVol, placement);
665 }
666 }
667
668 return supportAssembly;
669 }
void setColor(G4LogicalVolume &volume, const std::string &color)
Set the color of a logical volume.
Definition: utilities.cc:100

◆ createLadderSupport()

VXD::GeoVXDAssembly createLadderSupport ( )
virtual

Create support structure for a PXD Ladder.

Definition at line 559 of file GeoPXDCreator.cc.

559{ return VXD::GeoVXDAssembly(); }

◆ createLayerSupport()

VXD::GeoVXDAssembly createLayerSupport ( )
virtual

Create support structure for a PXD Layer.

Definition at line 557 of file GeoPXDCreator.cc.

557{ return VXD::GeoVXDAssembly(); }

◆ createPayloads()

virtual void createPayloads ( const GearDir content,
const IntervalOfValidity iov 
)
inlineoverridevirtual

Create the configuration objects and save them in the Database.

If more than one object is needed adjust accordingly

Reimplemented from CreatorBase.

Definition at line 51 of file GeoPXDCreator.h.

52 {
53 DBImportObjPtr<PXDGeometryPar> importObj;
54 PXDGeometryPar config = createConfiguration(content);
55 importObj.construct(config);
56 importObj.import(iov);
57 }

◆ createSensitiveDetector()

VXD::SensitiveDetectorBase * createSensitiveDetector ( VxdID  sensorID,
const VXDGeoSensor sensor,
const VXDGeoSensorPlacement placement 
)
overridevirtual

Return a SensitiveDetector implementation for a given sensor.

Parameters
sensorIDSensorID for the sensor
sensorInformation about the sensor to create the Sensitive Detector for
placementInformation on how to place the sensor

Implements GeoVXDCreator.

Definition at line 547 of file GeoPXDCreator.cc.

549 {
550 SensorInfo* sensorInfo = new SensorInfo(dynamic_cast<const SensorInfo&>(*sensor.getSensorInfo()));
551 sensorInfo->setID(sensorID);
552 if (placement.getFlipV()) sensorInfo->flipVSegmentation();
553 SensitiveDetector* sensitive = new SensitiveDetector(sensorInfo);
554 return sensitive;
555 }
VXD::SensitiveDetector< PXDSimHit, PXDTrueHit > SensitiveDetector
The PXD Sensitive Detector class.

◆ createSensorInfo()

VXD::SensorInfoBase * createSensorInfo ( const VXDGeoSensorPar sensor)
overridevirtual

Read the sensor definitions from the database.

Parameters
sensorReference to the database containing the parameters

Implements GeoVXDCreator.

Definition at line 57 of file GeoPXDCreator.cc.

58 {
59
60 const PXDSensorInfoPar& infoPar = dynamic_cast<const PXDSensorInfoPar&>(*sensor.getSensorInfo());
61
62 SensorInfo* info = new SensorInfo(
63 VxdID(0, 0, 0),
64 infoPar.getWidth(),
65 infoPar.getLength(),
66 infoPar.getThickness(),
67 infoPar.getUCells(),
68 infoPar.getVCells1(),
69 infoPar.getSplitLength(),
70 infoPar.getVCells2()
71 );
72 info->setDEPFETParams(
73 infoPar.getBulkDoping() / (Unit::um * Unit::um * Unit::um),
74 infoPar.getBackVoltage(),
75 infoPar.getTopVoltage(),
76 infoPar.getSourceBorderSmallPitch(),
77 infoPar.getClearBorderSmallPitch(),
78 infoPar.getDrainBorderSmallPitch(),
79 infoPar.getSourceBorderLargePitch(),
80 infoPar.getClearBorderLargePitch(),
81 infoPar.getDrainBorderLargePitch(),
82 infoPar.getGateDepth(),
83 infoPar.getDoublePixel(),
84 infoPar.getChargeThreshold(),
85 infoPar.getNoiseFraction()
86 );
87 info->setIntegrationWindow(
88 infoPar.getIntegrationStart(),
89 infoPar.getIntegrationEnd()
90 );
91
92 m_SensorInfo.push_back(info);
93 return info;
94 }
static const double um
[micrometers]
Definition: Unit.h:71

◆ createSubComponents()

GeoVXDAssembly createSubComponents ( const std::string &  name,
VXDGeoComponent component,
std::vector< VXDGeoPlacement placements,
bool  originCenter = true,
bool  allowOutside = false 
)
inherited

Place a list of subcomponents into an component.

If the volume of the given component is NULL, a new container will be created to fit all subcomponents. It will have air as medium. If at least one subcomponent with this placement is found the whole component is wrapped in a container volume with Air medium which extends above and below to fit the subcomponents

Parameters
nameName for the potential new volume or as prefix for the container to extend the component
componentComponent to fit the subcomponents into
placementsPlacement information for all subcomponents
originCenterbool
allowOutsidebool
Returns
offset in w which was applied to the component when extending it

Definition at line 74 of file GeoVXDCreator.cc.

76 {
77 GeoVXDAssembly assembly;
78 B2DEBUG(100, "Creating component " << name);
79 vector<VXDGeoComponent> subComponents;
80 subComponents.reserve(placements.size());
81 //Go over all subcomponents and check if they will fit inside.
82 //If component.volume is zero we will create one so sum up needed space
83 bool widthResize = component.getWidth() <= 0;
84 bool lengthResize = component.getLength() <= 0;
85 bool heightResize = component.getHeight() <= 0;
86
87 for (VXDGeoPlacement& p : placements) {
88 //Test component already exists
89 if (m_componentCache.find(p.getName()) == m_componentCache.end()) {
90 B2FATAL("A component is requested that was not created before!");
91 }
92 VXDGeoComponent sub = m_componentCache[p.getName()];
93
94 B2DEBUG(100, "SubComponent " << p.getName());
95 B2DEBUG(100, boost::format("Placement: u:%1% cm, v:%2% cm, w:%3% + %4% cm") % p.getU() % p.getV() % p.getW() % p.getWOffset());
96 B2DEBUG(100, boost::format("Dimensions: %1%x%2%x%3% cm") % sub.getWidth() % sub.getLength() % sub.getHeight());
97
98 if (p.getW() == VXDGeoPlacement::c_above || p.getW() == VXDGeoPlacement::c_below) {
99 //Below placement only valid if we are allowed to create a container around component
100 if (!allowOutside) B2FATAL("Cannot place component " << p.getName() << " outside of component " << name);
101 } else if (sub.getHeight() + p.getWOffset() > component.getHeight()) {
102 //Component will not fit heightwise. If we resize the volume anyway than we don't have problems
103 if (!heightResize) {
104 B2FATAL("Subcomponent " << p.getName() << " does not fit into volume: "
105 << "height " << sub.getHeight() << " > " << component.getHeight());
106 }
107 component.getHeight() = sub.getHeight() + p.getWOffset();
108 }
109
110 //Check if compoent will fit inside width,length. If we can resize do it if needed, otherwise bail
111 double minWidth = max(abs(p.getU() + sub.getWidth() / 2.0), abs(p.getU() - sub.getWidth() / 2.0));
112 double minLength = max(abs(p.getV() + sub.getLength() / 2.0), abs(p.getV() - sub.getLength() / 2.0));
113 if (minWidth > component.getWidth() + component.getWidth() * numeric_limits<double>::epsilon()) {
114 if (!widthResize) {
115 B2FATAL("Subcomponent " << p.getName() << " does not fit into volume: "
116 << "minWidth " << minWidth << " > " << component.getWidth());
117 }
118 component.setWidth(minWidth * 2.0);
119 }
120 if (minLength > component.getLength() + component.getLength() * numeric_limits<double>::epsilon()) {
121 if (!lengthResize) {
122 B2FATAL("Subcomponent " << p.getName() << " does not fit into volume: "
123 << "minLength " << minLength << " > " << component.getLength());
124 }
125 component.setLength(minLength * 2.0);
126 }
127 subComponents.push_back(sub);
128 }
129
130 //zero dimensions are fine mathematically but we don't want them in the simulation
131 if (component.getWidth() <= 0 || component.getLength() <= 0 || component.getHeight() <= 0) {
132 B2FATAL("At least one dimension of component " << name << " is zero which does not make sense");
133 }
134
135 //No volume yet, create a new one automatically assuming air material
136 if (!component.getVolume()) {
137 G4VSolid* componentShape = createTrapezoidal(name, component.getWidth(), component.getWidth2(), component.getLength(),
138 component.getHeight());
139 component.setVolume(new G4LogicalVolume(componentShape, Materials::get(component.getMaterial()), name));
140 }
141
142 B2DEBUG(100, boost::format("Component %1% dimensions: %2%x%3%x%4% cm") % name % component.getWidth() % component.getLength() %
143 component.getHeight());
144
145 //Ok, all volumes set up, now add them together
146 for (size_t i = 0; i < placements.size(); ++i) {
147 VXDGeoPlacement& p = placements[i];
148 VXDGeoComponent& s = subComponents[i];
149
150 G4Transform3D transform = getPosition(component, s, p, originCenter);
151 if (p.getW() == VXDGeoPlacement::c_below || p.getW() == VXDGeoPlacement::c_above) {
152 //Add to selected mother (either component or container around component
153 assembly.add(s.getVolume(), transform);
154 } else {
155 new G4PVPlacement(transform, s.getVolume(), name + "." + p.getName(), component.getVolume(), false, i);
156 }
157 }
158
159 //Set some visibility options for volume. Done here because all components including sensor go through here
160 if (component.getColor().empty()) {
161 B2DEBUG(200, "Component " << name << " is an Air volume, setting invisible");
162 setVisibility(*component.getVolume(), false);
163 } else {
164 B2DEBUG(200, "Component " << name << " color: " << component.getColor());
165 setColor(*component.getVolume(), component.getColor());
166 }
167 B2DEBUG(100, "--> Created component " << name);
168 //Return the difference in W between the origin of the original component and the including container
169 return assembly;
170 }
@ c_above
Place the component above the mother.
@ c_below
Place the component below the mother.
G4Transform3D getPosition(const VXDGeoComponent &mother, const VXDGeoComponent &daughter, const VXDGeoPlacement &placement, bool originCenter)
Return the position where a daughter component is to be placed.

◆ createTrapezoidal()

G4VSolid * createTrapezoidal ( const std::string &  name,
double  width,
double  width2,
double  length,
double &  height,
double  angle = 0 
)
inherited

Create a trapezoidal solid.

Parameters
namename of the Geant4 solid
widthfull forward width of the shape in mm
width2full backward width of the shape in mm
lengthlength of the shape in mm
[in,out]heightof the shape in mm. If angle is not 0 this value might be changed if the actual height will be smaller due to the slanted edges
angleangle of the sides along w with respect to to the uv plane. 0 means normal box shaped, !=0 means the upper endcap of the solid will be smaller since all edges will be slanted by angle
Returns
A G4VShape which could be a G4Box, a G4Trd or a G4Trap depending on the parameters

Definition at line 255 of file GeoVXDCreator.cc.

257 {
258 double offset(0);
259 if (angle > 0) {
260 const double tana = tan(angle);
261 height = min(tana * length, min(tana * width, height));
262 offset = height / tana;
263 }
264 const double hwidth = width / 2.0;
265 const double hwidth2 = width2 / 2.0;
266 const double hlength = length / 2.0;
267 const double hheight = height / 2.0;
268
269 if (width2 <= 0 || width == width2) {
270 if (angle <= 0) {
271 return new G4Box(name, hwidth, hlength, hheight);
272 } else {
273 return new G4Trd(name, hwidth, hwidth - offset, hlength, hlength - offset, hheight);
274 }
275 }
276 //FIXME: offset not working, g4 complains about nonplanarity of face -X. But we do not need that shape at the moment
277 //so lets ignore it for now
278 return new G4Trap(name, hheight, 0, 0, hlength, hwidth, hwidth2, 0, hlength - offset, hwidth - offset, hwidth2 - offset, 0);
279 }

◆ getAlignment()

G4Transform3D getAlignment ( const VXDAlignmentPar params)
inherited

Get Alignment from paylead object.

Parameters
paramsPayload object
Returns
Transformation matrix for component

Definition at line 172 of file GeoVXDCreator.cc.

173 {
174 G4RotationMatrix rotation(params.getAlpha(), params.getBeta(), params.getGamma());
175 G4ThreeVector translation(params.getDU() / Unit::mm, params.getDV() / Unit::mm, params.getDW() / Unit::mm);
176 return G4Transform3D(rotation, translation);
177 }

◆ getPosition()

G4Transform3D getPosition ( const VXDGeoComponent mother,
const VXDGeoComponent daughter,
const VXDGeoPlacement placement,
bool  originCenter 
)
inherited

Return the position where a daughter component is to be placed.

Parameters
motherMother component
daughterDaughter component
placementVXDGeoPlacement
originCenterbool
Returns
Transformation matrix to place the daughter relative to the origin to the mother

Definition at line 179 of file GeoVXDCreator.cc.

181 {
182 double u(placement.getU()), v(placement.getV()), w(0);
183 switch (placement.getW()) {
184 case VXDGeoPlacement::c_below: //Place below component
185 w = - mother.getHeight() / 2.0 - daughter.getHeight() / 2.0;
186 break;
187 case VXDGeoPlacement::c_bottom: //Place inside, at bottom of component
188 w = - mother.getHeight() / 2.0 + daughter.getHeight() / 2.0;
189 break;
190 case VXDGeoPlacement::c_center: //Place inside, centered
191 w = 0;
192 break;
193 case VXDGeoPlacement::c_top: //Place inside, at top of mother
194 w = mother.getHeight() / 2.0 - daughter.getHeight() / 2.0;
195 break;
196 case VXDGeoPlacement::c_above: //Place above mother
197 w = mother.getHeight() / 2.0 + daughter.getHeight() / 2.0;
198 break;
199 }
200 if (!originCenter) { //Sensor has coordinate origin in the corner, all submothers at their center
201 u -= mother.getWidth() / 2.0;
202 v -= mother.getLength() / 2.0;
203 }
204 return G4Translate3D(u, v, w + placement.getWOffset());
205 }
@ c_bottom
Place the component at the bottom of the mother.
@ c_center
Place the component at the center of the mother.
@ c_top
Place the component at the top of the mother.

◆ getSubComponents()

std::vector< VXDGeoPlacementPar > getSubComponents ( const GearDir path)
inherited

Return vector of VXDGeoPlacements with all the components defined inside a given path.

Definition at line 606 of file GeoVXDCreator.cc.

607 {
608 vector<VXDGeoPlacementPar> result;
609 for (const GearDir& component : path.getNodes("Component")) {
610 string type;
611 if (!component.exists("@type")) {
612 type = component.getString("@name");
613 } else {
614 type = component.getString("@type");
615 }
616 int nPos = max(component.getNumberNodes("u"), component.getNumberNodes("v"));
617 nPos = max(nPos, component.getNumberNodes("w"));
618 nPos = max(nPos, component.getNumberNodes("woffset"));
619 for (int iPos = 1; iPos <= nPos; ++iPos) {
620 string index = (boost::format("[%1%]") % iPos).str();
621 result.push_back(VXDGeoPlacementPar(
622 type,
623 component.getLength("u" + index, 0),
624 component.getLength("v" + index, 0),
625 component.getString("w" + index, "bottom"),
626 component.getLength("woffset" + index, 0)
627 ));
628 }
629 }
630 return result;
631 }

◆ placeLadder()

G4Transform3D placeLadder ( int  ladderID,
double  phi,
G4LogicalVolume *  volume,
const G4Transform3D &  placement,
const VXDGeometryPar parameters 
)
inherited

Place ladder corresponding to the given ladder id into volume setLayer has to be called first to set the correct layer id.

Definition at line 281 of file GeoVXDCreator.cc.

284 {
285 VxdID ladder(m_ladder.getLayerID(), ladderID, 0);
286
287 G4Translate3D ladderPos(m_ladder.getRadius(), m_ladder.getShift(), 0);
288 G4Transform3D ladderPlacement = placement * G4RotateZ3D(phi) * ladderPos * getAlignment(parameters.getAlignment(ladder));
289 // The actuall coordinate system of ladder (w still points to Z, there is only phi rotation + move to correct radius + shift)
291
292
293 vector<G4Point3D> lastSensorEdge;
294 for (const VXDGeoSensorPlacement& p : m_ladder.getSensors()) {
295 VxdID sensorID(ladder);
296 sensorID.setSensorNumber(p.getSensorID());
297
298
299 std::map<string, VXDGeoSensor>::iterator it = m_sensorMap.find(p.getSensorTypeID());
300 if (it == m_sensorMap.end()) {
301 B2FATAL("Invalid SensorTypeID " << p.getSensorTypeID() << ", please check the definition of " << sensorID);
302 }
303 VXDGeoSensor& s = it->second;
304 string name = m_prefix + "." + (string)sensorID;
305
306 //Calculate the reflection transformation needed. Since we want the
307 //active area to be non reflected we apply this transformation on the
308 //sensor and on the active area
309 G4Transform3D reflection;
310 if (p.getFlipU()) reflection = reflection * G4ReflectX3D();
311 if (p.getFlipV()) reflection = reflection * G4ReflectY3D();
312 if (p.getFlipW()) reflection = reflection * G4ReflectZ3D();
313
314 G4VSolid* sensorShape = createTrapezoidal(name, s.getWidth(), s.getWidth2(), s.getLength(),
315 s.getHeight());
316 G4Material* sensorMaterial = Materials::get(s.getMaterial());
318 s.setVolume(new G4LogicalVolume(sensorShape, Materials::get(m_defaultMaterial), name));
319 } else {
320 s.setVolume(new G4LogicalVolume(sensorShape, sensorMaterial, name));
321 }
322
323 // Create sensitive Area: this Part is created separately since we want full control over the coordinate system:
324 // local x (called u) should point in RPhi direction
325 // local y (called v) should point in global z
326 // local z (called w) should away from the origin
327 G4VSolid* activeShape = createTrapezoidal(name + ".Active", s.getActiveArea().getWidth(), s.getActiveArea().getWidth2(),
328 s.getActiveArea().getLength(), s.getActiveArea().getHeight());
329
330 //Create appropriate sensitive detector instance
331 SensitiveDetectorBase* sensitive = createSensitiveDetector(sensorID, s, p);
332
333 sensitive->setOptions(m_seeNeutrons, m_onlyPrimaryTrueHits,
335 m_sensitive.push_back(sensitive);
336 G4LogicalVolume* active = new G4LogicalVolume(activeShape, sensorMaterial, name + ".Active",
337 0, sensitive);
338 m_UserLimits.push_back(new G4UserLimits(m_activeStepSize));
339 active->SetUserLimits(m_UserLimits.back());
340
341 setColor(*active, s.getActiveArea().getColor());
342
343 //The coordinates of the active region are given as the distance between the corners, not to the center
344 //Place the active area
345 G4Transform3D activePosition = G4Translate3D(s.getActiveArea().getWidth() / 2.0, s.getActiveArea().getLength() / 2.0, 0) *
346 getPosition(s, s.getActiveArea(), s.getActivePlacement(), false);
347
348 G4ReflectionFactory::Instance()->Place(activePosition * reflection, name + ".Active", active, s.getVolume(),
349 false, (int)sensorID, false);
350
351 //Now create all the other components and place the Sensor
352 GeoVXDAssembly assembly;
353 if (!m_onlyActiveMaterial) assembly = createSubComponents(name, s, s.getComponents(), false, true);
354
355 G4RotationMatrix rotation(0, -M_PI / 2.0, -M_PI / 2.0);
356 G4Transform3D sensorAlign = getAlignment(parameters.getAlignment(sensorID));
357 G4Transform3D sensorPlacement = G4Rotate3D(rotation) * sensorAlign * reflection;
358
359 if (s.getSlanted()) {
360 sensorPlacement = G4TranslateX3D(m_ladder.getSlantedRadius() - m_ladder.getRadius()) * G4RotateY3D(
361 -m_ladder.getSlantedAngle()) * sensorPlacement;
362 }
363 sensorPlacement = G4Translate3D(0.0, 0.0, p.getZ()) * sensorPlacement;
364 // Remember the placement of sensor into ladder
365 VXD::GeoCache::getInstance().addSensorPlacement(ladder, sensorID, sensorPlacement * activePosition * reflection);
366 sensorPlacement = ladderPlacement * sensorPlacement;
367
368 assembly.add(s.getVolume());
369 assembly.place(volume, sensorPlacement);
370
371 //See if we want to glue the modules together
372 if (!m_ladder.getGlueMaterial().empty() && !m_onlyActiveMaterial) {
373 double u = s.getWidth() / 2.0 + m_ladder.getGlueSize();
374 double v = s.getLength() / 2.0;
375 double w = s.getHeight() / 2.0 + m_ladder.getGlueSize();
376 std::vector<G4Point3D> curSensorEdge(4);
377 //Lets get the forward corners of the sensor by applying the unreflected placement matrix
378 curSensorEdge[0] = sensorPlacement * reflection * G4Point3D(u, v, + w);
379 curSensorEdge[1] = sensorPlacement * reflection * G4Point3D(u, v, - w);
380 curSensorEdge[2] = sensorPlacement * reflection * G4Point3D(-u, v, - w);
381 curSensorEdge[3] = sensorPlacement * reflection * G4Point3D(-u, v, + w);
382 //If we already have backward edges this is not the first module so we can apply the glue
383 if (lastSensorEdge.size()) {
384 //Check that the modules don't overlap in z
385 bool glueOK = true;
386 for (int i = 0; i < 4; ++i) glueOK &= curSensorEdge[i].z() <= lastSensorEdge[i].z();
387 if (!glueOK) {
388 B2WARNING("Cannot place Glue at sensor " + (string)sensorID +
389 " since it overlaps with the last module in z");
390 } else {
391 //Create Glue which spans from last sensor to this sensor
392 G4TessellatedSolid* solidTarget = new G4TessellatedSolid(m_prefix + ".Glue." + (string)sensorID);
393
394 //Face at end of last Sensor
395 solidTarget->AddFacet(new G4QuadrangularFacet(
396 curSensorEdge[3], curSensorEdge[2], curSensorEdge[1], curSensorEdge[0], ABSOLUTE));
397 //Face at begin of current Sensor
398 solidTarget->AddFacet(new G4QuadrangularFacet(
399 lastSensorEdge[0], lastSensorEdge[1], lastSensorEdge[2], lastSensorEdge[3], ABSOLUTE));
400
401 //Top faces
402 solidTarget->AddFacet(new G4TriangularFacet(
403 curSensorEdge[3], curSensorEdge[0], lastSensorEdge[0], ABSOLUTE));
404 solidTarget->AddFacet(new G4TriangularFacet(
405 lastSensorEdge[0], lastSensorEdge[3], curSensorEdge[3], ABSOLUTE));
406 //Bottom faces
407 solidTarget->AddFacet(new G4TriangularFacet(
408 curSensorEdge[1], curSensorEdge[2], lastSensorEdge[2], ABSOLUTE));
409 solidTarget->AddFacet(new G4TriangularFacet(
410 lastSensorEdge[2], lastSensorEdge[1], curSensorEdge[1], ABSOLUTE));
411 //Right faces
412 solidTarget->AddFacet(new G4TriangularFacet(
413 curSensorEdge[0], curSensorEdge[1], lastSensorEdge[1], ABSOLUTE));
414 solidTarget->AddFacet(new G4TriangularFacet(
415 lastSensorEdge[1], lastSensorEdge[0], curSensorEdge[0], ABSOLUTE));
416 //Left faces
417 solidTarget->AddFacet(new G4TriangularFacet(
418 curSensorEdge[2], curSensorEdge[3], lastSensorEdge[3], ABSOLUTE));
419 solidTarget->AddFacet(new G4TriangularFacet(
420 lastSensorEdge[3], lastSensorEdge[2], curSensorEdge[2], ABSOLUTE));
421
422 solidTarget->SetSolidClosed(true);
423
424 G4LogicalVolume* glue = new G4LogicalVolume(solidTarget, Materials::get(m_ladder.getGlueMaterial()),
425 m_prefix + ".Glue." + (string)sensorID);
426 setColor(*glue, "#097");
427 new G4PVPlacement(G4Transform3D(), glue, m_prefix + ".Glue." + (string)sensorID, volume, false, 1);
428 }
429 }
430 //Remember the backward edge of this sensor to be glued to.
431 lastSensorEdge.resize(4);
432 lastSensorEdge[0] = sensorPlacement * reflection * G4Point3D(u, -v, + w);
433 lastSensorEdge[1] = sensorPlacement * reflection * G4Point3D(u, -v, - w);
434 lastSensorEdge[2] = sensorPlacement * reflection * G4Point3D(-u, -v, - w);
435 lastSensorEdge[3] = sensorPlacement * reflection * G4Point3D(-u, -v, + w);
436 }
437 }
438
439 return ladderPlacement;
440 }
const std::vector< VXDGeoSensorPlacement > & getSensors() const
get list of sensors
int getLayerID() const
get the layer id
const std::string & getGlueMaterial() const
get the glue material
double getSlantedAngle() const
get the slant angle for slanted sensors
double getRadius() const
get the radius of all sensors except slanted ones
double getShift() const
get the shift along the u coordinate for all sensors in the ladder
double getSlantedRadius() const
get the radius for slanted sensors
double getGlueSize() const
get the additional glue size, e.g.
void addSensorPlacement(VxdID ladder, VxdID sensor, const G4Transform3D &placement)
Remember how sensor is placed into ladder.
Definition: GeoCache.cc:220
void addLadderPlacement(VxdID halfShell, VxdID ladder, const G4Transform3D &placement)
Remember how ladder is placed into half-shell.
Definition: GeoCache.cc:225
VXDGeoLadder m_ladder
Parameters of the currently active ladder.
std::vector< G4UserLimits * > m_UserLimits
Vector of G4UserLimit pointers.
virtual SensitiveDetectorBase * createSensitiveDetector(VxdID sensorID, const VXDGeoSensor &sensor, const VXDGeoSensorPlacement &placement)=0
Return a SensitiveDetector implementation for a given sensor.

◆ readComponent()

void readComponent ( const std::string &  name,
GearDir  components,
VXDGeometryPar vxdGeometryPar 
)
inherited

Read parameters for component name from Gearbox into geometry payload.

The name is assumed to be unique and Volumes are cached.

Parameters
nameName of the component
componentsPath to components
vxdGeometryParVXD geometry parameters

Definition at line 533 of file GeoVXDCreator.cc.

534 {
535
536
537 //Check if component already exists
538 if (vxdGeometryPar.getComponentMap().find(name) != vxdGeometryPar.getComponentMap().end()) {
539 return; // nothing to do
540 }
541
542 //Component does not exist, so lets create a new one
543 string path = (boost::format("descendant::Component[@name='%1%']/") % name).str();
544 GearDir params(componentsDir, path);
545 if (!params) {
546 B2FATAL("Could not find definition for component " << name);
547 return;
548 }
549
550 VXDGeoComponentPar c(
551 params.getString("Material", vxdGeometryPar.getGlobalParams().getDefaultMaterial()),
552 params.getString("Color", ""),
553 params.getLength("width", 0),
554 params.getLength("width2", 0),
555 params.getLength("length", 0),
556 params.getLength("height", 0),
557 params.getAngle("angle", 0)
558 );
559
560 if (c.getWidth() <= 0 || c.getLength() <= 0 || c.getHeight() <= 0) {
561 B2DEBUG(100, "One dimension empty, using auto resize for component");
562 }
563
564 c.setSubComponents(getSubComponents(params));
565 readSubComponents(c.getSubComponents(), componentsDir, vxdGeometryPar);
566
567 if (vxdGeometryPar.getGlobalParams().getActiveChips() && params.exists("activeChipID")) {
568 int chipID = params.getInt("activeChipID");
569 vxdGeometryPar.getSensitiveChipIdMap()[name] = chipID;
570 }
571 vxdGeometryPar.getComponentMap()[name] = c;
572 vxdGeometryPar.getComponentInsertOder().push_back(name);
573 }
void readSubComponents(const std::vector< VXDGeoPlacementPar > &placements, const GearDir &componentsDir, VXDGeometryPar &vxdGeometryPar)
Read parameters for all components in placement container from Gearbox into payload.

◆ readHalfShellSupport()

void readHalfShellSupport ( const GearDir support,
PXDGeometryPar pxdGeometryPar 
)

Create support structure for VXD Half Shell, that means everything that does not depend on layer or sensor alignment.

Parameters
supportReference to the database containing the parameters
pxdGeometryParPXD geometry

Definition at line 295 of file GeoPXDCreator.cc.

296 {
297 for (const GearDir& endflange : support.getNodes("Endflange")) {
298 VXDPolyConePar endflangePar(
299 endflange.getString("@name"),
300 endflange.getString("Material", "Air"),
301 endflange.getAngle("minPhi", 0),
302 endflange.getAngle("maxPhi", 2 * M_PI),
303 (endflange.getNodes("Cutout").size() > 0),
304 endflange.getLength("Cutout/width1", 0.),
305 endflange.getLength("Cutout/width2", 0.),
306 endflange.getLength("Cutout/height", 0.),
307 endflange.getLength("Cutout/depth", 0.)
308 );
309
310 for (const GearDir& plane : endflange.getNodes("Plane")) {
311 VXDPolyConePlanePar planePar(
312 plane.getLength("posZ"),
313 plane.getLength("innerRadius"),
314 plane.getLength("outerRadius")
315 );
316 endflangePar.getPlanes().push_back(planePar);
317 }
318 pxdGeometryPar.getEndflanges().push_back(endflangePar);
319 }
320
321 // Cout outs for endflanges
322 pxdGeometryPar.setNCutOuts(support.getInt("Cutout/count"));
323 pxdGeometryPar.setCutOutWidth(support.getLength("Cutout/width"));
324 pxdGeometryPar.setCutOutHeight(support.getLength("Cutout/height"));
325 pxdGeometryPar.setCutOutShift(support.getLength("Cutout/shift"));
326 pxdGeometryPar.setCutOutRPhi(support.getLength("Cutout/rphi"));
327 pxdGeometryPar.setCutOutStartPhi(support.getAngle("Cutout/startPhi"));
328 pxdGeometryPar.setCutOutDeltaPhi(support.getAngle("Cutout/deltaPhi"));
329
330 //Create Carbon cooling tubes
331 pxdGeometryPar.setNTubes(support.getInt("CarbonTubes/count"));
332 pxdGeometryPar.setTubesMinZ(support.getLength("CarbonTubes/minZ"));
333 pxdGeometryPar.setTubesMaxZ(support.getLength("CarbonTubes/maxZ"));
334 pxdGeometryPar.setTubesMinR(support.getLength("CarbonTubes/innerRadius"));
335 pxdGeometryPar.setTubesMaxR(support.getLength("CarbonTubes/outerRadius"));
336 pxdGeometryPar.setTubesRPhi(support.getLength("CarbonTubes/rphi"));
337 pxdGeometryPar.setTubesStartPhi(support.getAngle("CarbonTubes/startPhi"));
338 pxdGeometryPar.setTubesDeltaPhi(support.getAngle("CarbonTubes/deltaPhi"));
339 pxdGeometryPar.setTubesMaterial(support.getString("CarbonTubes/Material", "Carbon"));
340
341 return;
342 }

◆ readLadder()

void readLadder ( int  layer,
GearDir  components,
VXDGeometryPar geoparameters 
)
virtualinherited

Read parameters for a ladder in layer with given ID from gearbox and layer store them in payload.

Definition at line 575 of file GeoVXDCreator.cc.

576 {
577 string path = (boost::format("Ladder[@layer=%1%]/") % layer).str();
578 GearDir paramsLadder(components, path);
579 if (!paramsLadder) {
580 B2FATAL("Could not find Ladder definition for layer " << layer);
581 }
582
583 geoparameters.getLadderMap()[layer] = VXDGeoLadderPar(
584 layer,
585 paramsLadder.getLength("shift"),
586 paramsLadder.getLength("radius"),
587 paramsLadder.getAngle("slantedAngle", 0),
588 paramsLadder.getLength("slantedRadius", 0),
589 paramsLadder.getLength("Glue/oversize", 0),
590 paramsLadder.getString("Glue/Material", "")
591 );
592
593 for (const GearDir& sensorInfo : paramsLadder.getNodes("Sensor")) {
594
595 geoparameters.getLadderMap()[layer].addSensor(VXDGeoSensorPlacementPar(
596 sensorInfo.getInt("@id"),
597 sensorInfo.getString("@type"),
598 sensorInfo.getLength("."),
599 sensorInfo.getBool("@flipU", false),
600 sensorInfo.getBool("@flipV", false),
601 sensorInfo.getBool("@flipW", false)
602 ));
603 }
604 }

◆ readLadderComponents()

void readLadderComponents ( int  layerID,
int  ladderID,
GearDir  content,
VXDGeometryPar vxdGeometryPar 
)
virtualinherited

Read parameters for ladder components and their alignment corresponding to the given ladder id.

Definition at line 471 of file GeoVXDCreator.cc.

472 {
473 VxdID ladder(layerID, ladderID, 0);
474
475 // Read alignment for ladder
476 string path = (boost::format("Align[@component='%1%']/") % ladder).str();
477 GearDir params(GearDir(content, "Alignment/"), path);
478 if (!params) {
479 B2WARNING("Could not find alignment parameters for ladder " << ladder);
480 return;
481 }
482 vxdGeometryPar.getAlignmentMap()[ladder] = VXDAlignmentPar(params.getLength("du"),
483 params.getLength("dv"),
484 params.getLength("dw"),
485 params.getAngle("alpha"),
486 params.getAngle("beta"),
487 params.getAngle("gamma")
488 );
489
490
491
492 for (const VXDGeoSensorPlacementPar& p : vxdGeometryPar.getLadderMap()[layerID].getSensors()) {
493 VxdID sensorID(ladder);
494 sensorID.setSensorNumber(p.getSensorID());
495
496 std::map<string, VXDGeoSensorPar>::iterator it = vxdGeometryPar.getSensorMap().find(p.getSensorTypeID());
497 if (it == vxdGeometryPar.getSensorMap().end()) {
498 B2FATAL("Invalid SensorTypeID " << p.getSensorTypeID() << ", please check the definition of " << sensorID);
499 }
500
501 //Now create all the other components and place the Sensor
502 if (!vxdGeometryPar.getGlobalParams().getOnlyActiveMaterial()) {
503 VXDGeoSensorPar& s = it->second;
504 readSubComponents(s.getComponents(), GearDir(content, "Components/"), vxdGeometryPar);
505 }
506 // Read alignment for sensor
507 string pathSensor = (boost::format("Align[@component='%1%']/") % sensorID).str();
508 GearDir paramsSensor(GearDir(content, "Alignment/"), pathSensor);
509 if (!paramsSensor) {
510 B2WARNING("Could not find alignment parameters for sensorID " << sensorID);
511 return;
512 }
513 vxdGeometryPar.getAlignmentMap()[sensorID] = VXDAlignmentPar(paramsSensor.getLength("du"),
514 paramsSensor.getLength("dv"),
515 paramsSensor.getLength("dw"),
516 paramsSensor.getAngle("alpha"),
517 paramsSensor.getAngle("beta"),
518 paramsSensor.getAngle("gamma")
519 );
520 }
521 return;
522 }

◆ readSensorInfo()

PXDSensorInfoPar * readSensorInfo ( const GearDir sensor)

Read the sensor definitions from the gearbox.

Parameters
sensorReference to the database containing the parameters

Definition at line 96 of file GeoPXDCreator.cc.

97 {
98 PXDSensorInfoPar* info = new PXDSensorInfoPar(
99 VxdID(0, 0, 0),
100 sensor.getLength("width"),
101 sensor.getLength("length"),
102 sensor.getLength("height"),
103 sensor.getInt("pixelsU"),
104 sensor.getInt("pixelsV[1]"),
105 sensor.getLength("splitLength", 0),
106 sensor.getInt("pixelsV[2]", 0)
107 );
108
109 info->setDEPFETParams(
110 sensor.getDouble("BulkDoping"),
111 sensor.getWithUnit("BackVoltage"),
112 sensor.getWithUnit("TopVoltage"),
113 sensor.getLength("SourceBorderSmallPixel"),
114 sensor.getLength("ClearBorderSmallPixel"),
115 sensor.getLength("DrainBorderSmallPixel"),
116 sensor.getLength("SourceBorderLargePixel"),
117 sensor.getLength("ClearBorderLargePixel"),
118 sensor.getLength("DrainBorderLargePixel"),
119 sensor.getLength("GateDepth"),
120 sensor.getBool("DoublePixel"),
121 sensor.getDouble("ChargeThreshold"),
122 sensor.getDouble("NoiseFraction")
123 );
124 info->setIntegrationWindow(
125 sensor.getTime("IntegrationStart"),
126 sensor.getTime("IntegrationEnd")
127 );
128 return info;
129 }

◆ readSubComponents()

void readSubComponents ( const std::vector< VXDGeoPlacementPar > &  placements,
const GearDir componentsDir,
VXDGeometryPar vxdGeometryPar 
)
inherited

Read parameters for all components in placement container from Gearbox into payload.

Parameters
placementscontainer holding names of all components to be cached
componentsDirPath to Gearbox where parameters are to be found
vxdGeometryPar

Definition at line 524 of file GeoVXDCreator.cc.

526 {
527 for (const VXDGeoPlacementPar& p : placements) {
528 readComponent(p.getName(), componentsDir, vxdGeometryPar);
529 }
530 return;
531 }
void readComponent(const std::string &name, GearDir components, VXDGeometryPar &vxdGeometryPar)
Read parameters for component name from Gearbox into geometry payload.

◆ setCurrentLayer()

void setCurrentLayer ( int  layer,
const VXDGeometryPar parameters 
)
virtualinherited

Read parameters for given layer and store in m_ladder.

Definition at line 442 of file GeoVXDCreator.cc.

443 {
444 const VXDGeoLadderPar& paramsLadder = parameters.getLadder(layer);
445
446 m_ladder = VXDGeoLadder(
447 layer,
448 paramsLadder.getShift() / Unit::mm,
449 paramsLadder.getRadius() / Unit::mm,
450 paramsLadder.getSlantedAngle(),
451 paramsLadder.getSlantedRadius() / Unit::mm,
452 paramsLadder.getGlueSize() / Unit::mm,
453 paramsLadder.getGlueMaterial()
454 );
455
456
457 for (const VXDGeoSensorPlacementPar& sensorInfo : paramsLadder.getSensors()) {
458 m_ladder.addSensor(VXDGeoSensorPlacement(
459 sensorInfo.getSensorID(),
460 sensorInfo.getSensorTypeID(),
461 sensorInfo.getZ() / Unit::mm,
462 sensorInfo.getFlipU(),
463 sensorInfo.getFlipV(),
464 sensorInfo.getFlipW()
465 ));
466 }
467 }
void addSensor(const VXDGeoSensorPlacement &sensor)
add a sensor to the list of sensors in the ladder

Member Data Documentation

◆ m_activeChips

bool m_activeChips {false}
protectedinherited

Make also chips sensitive.

Definition at line 209 of file GeoVXDCreator.h.

◆ m_activeStepSize

double m_activeStepSize {5 * Unit::um}
protectedinherited

Stepsize to be used inside active volumes.

Definition at line 207 of file GeoVXDCreator.h.

◆ m_alignment

GearDir m_alignment
protectedinherited

GearDir pointing to the alignment parameters.

Definition at line 183 of file GeoVXDCreator.h.

◆ m_componentCache

std::map<std::string, VXDGeoComponent> m_componentCache
protectedinherited

Cache of all previously created components.

Definition at line 188 of file GeoVXDCreator.h.

◆ m_components

GearDir m_components
protectedinherited

GearDir pointing to the toplevel of the components.

Definition at line 185 of file GeoVXDCreator.h.

◆ m_currentHalfShell

std::string m_currentHalfShell {""}
protectedinherited

Current half-shell being processed (need to know ladder parent for hierarchy)

Definition at line 220 of file GeoVXDCreator.h.

◆ m_defaultMaterial

std::string m_defaultMaterial
protectedinherited

Name of the Material to be used for Air.

Definition at line 199 of file GeoVXDCreator.h.

◆ m_distanceTolerance

float m_distanceTolerance {(float)(5 * Unit::um)}
protectedinherited

tolerance for Geant4 steps to be merged to a single step

Definition at line 201 of file GeoVXDCreator.h.

◆ m_electronTolerance

float m_electronTolerance {100}
protectedinherited

tolerance for the energy deposition in electrons to be merged in a single step

Definition at line 203 of file GeoVXDCreator.h.

◆ m_halfShellVxdIDs

std::map<std::string, Belle2::VxdID> m_halfShellVxdIDs
protectedinherited
Initial value:
{
{{"PXD.Ying"}, {Belle2::VxdID(1, 0, 0, 1)}},
{{"PXD.Yang"}, {Belle2::VxdID(1, 0, 0, 2)}},
{{"SVD.Pat"}, {Belle2::VxdID(3, 0, 0, 1)}},
{{"SVD.Mat"}, {Belle2::VxdID(3, 0, 0, 2)}}
}
Class to uniquely identify a any structure of the PXD and SVD.
Definition: VxdID.h:33

Used for translation of half-shell name into a VxdID to consitently handle it in hierarchy.

Definition at line 222 of file GeoVXDCreator.h.

◆ m_ladder

VXDGeoLadder m_ladder
protectedinherited

Parameters of the currently active ladder.

Definition at line 192 of file GeoVXDCreator.h.

◆ m_minimumElectrons

float m_minimumElectrons {10}
protectedinherited

minimum number of electrons to be deposited by a particle to be saved

Definition at line 205 of file GeoVXDCreator.h.

◆ m_onlyActiveMaterial

bool m_onlyActiveMaterial {false}
protectedinherited

If this is true, only active Materials will be placed for tracking studies.

Dead Material will be ignored

Definition at line 216 of file GeoVXDCreator.h.

◆ m_onlyPrimaryTrueHits

bool m_onlyPrimaryTrueHits {false}
protectedinherited

If true only create TrueHits from primary particles and ignore secondaries.

Definition at line 213 of file GeoVXDCreator.h.

◆ m_prefix

std::string m_prefix
protectedinherited

Prefix to prepend to all volume names.

Definition at line 181 of file GeoVXDCreator.h.

◆ m_radiationsensors

GeoVXDRadiationSensors m_radiationsensors
protectedinherited

Diamond radiation sensor "sub creator".

Definition at line 196 of file GeoVXDCreator.h.

◆ m_seeNeutrons

bool m_seeNeutrons {false}
protectedinherited

Make sensitive detectors also see neutrons.

Definition at line 211 of file GeoVXDCreator.h.

◆ m_sensitive

std::vector<Simulation::SensitiveDetectorBase*> m_sensitive
protectedinherited

List to all created sensitive detector instances.

Definition at line 194 of file GeoVXDCreator.h.

◆ m_SensorInfo

std::vector<SensorInfo*> m_SensorInfo
private

Vector of points to SensorInfo objects.

Definition at line 119 of file GeoPXDCreator.h.

◆ m_sensorMap

std::map<std::string, VXDGeoSensor> m_sensorMap
protectedinherited

Map containing Information about all defined sensor types.

Definition at line 190 of file GeoVXDCreator.h.

◆ m_UserLimits

std::vector<G4UserLimits*> m_UserLimits
protectedinherited

Vector of G4UserLimit pointers.

Definition at line 218 of file GeoVXDCreator.h.


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