Belle II Software  release-08-01-10
CsiCreator Class Reference

The creator for the CSI geometry. More...

#include <CsiCreator.h>

Inheritance diagram for CsiCreator:
Collaboration diagram for CsiCreator:

Public Member Functions

 CsiCreator ()
 Constructor.
 
virtual ~CsiCreator ()
 Destructor.
 
virtual void create (const GearDir &content, G4LogicalVolume &topVolume, geometry::GeometryTypes type)
 Creation of the detector geometry from Gearbox (XML). More...
 
 BELLE2_DEFINE_EXCEPTION (DBNotImplemented, "Cannot create geometry from Database.")
 Exception that will be thrown in createFromDB if member is not yet implemented by creator.
 
virtual void createFromDB (const std::string &name, G4LogicalVolume &topVolume, GeometryTypes type)
 Function to create the geometry from the Database. More...
 
virtual void createPayloads (const GearDir &content, const IntervalOfValidity &iov)
 Function to create the geometry database. More...
 

Protected Member Functions

void BuildEnclosure (const GearDir &content, G4AssemblyVolume *assembly, std::string side, int iEnclosure)
 Builds the crystals enclosures. More...
 
void PutCrystal (const GearDir &content, G4AssemblyVolume *assembly, G4Transform3D position, int iEnclosure, int iCry)
 Builds the crystals and their wrapping (foil)
 

Protected Attributes

SensitiveDetectorm_sensitive
 SensitiveDetector CSI.
 

Detailed Description

The creator for the CSI geometry.

Definition at line 30 of file CsiCreator.h.

Member Function Documentation

◆ BuildEnclosure()

void BuildEnclosure ( const GearDir content,
G4AssemblyVolume *  assembly,
std::string  side,
int  iEnclosure 
)
protected

Builds the crystals enclosures.

< Position of the nominal centre of crystals in the box

< Nominal position of the centre of the box

Definition at line 213 of file CsiCreator.cc.

214  {
215 
216  string gearPath = "Enclosures/Enclosure";
217  int nEnclosures = content.getNumberNodes(gearPath);
218 
219  if (iEnclosure > nEnclosures) {
220  B2ERROR("Enclosure index too high");
221  return ;
222  }
223 
224  // Build the box (same for all)
225  double width = content.getLength("Enclosures/Width") * CLHEP::cm;
226  double length = content.getLength("Enclosures/Length") * CLHEP::cm;
227  double depth = content.getLength("Enclosures/Depth") * CLHEP::cm;
228  double thk = content.getLength("Enclosures/Thickness") * CLHEP::cm;
229  double fold = content.getLength("Enclosures/Fold") * CLHEP::cm;
230  double lidthk = content.getLength("Enclosures/LidThickness") * CLHEP::cm;
231  double halflength = 15.0 * CLHEP::cm;
232  double zshift = 0.5 * length - thk - halflength; /*< Shift of the box along z-axis to make crystal touch the panel **/
233 
234  string strMatEnclosure = content.getString("Enclosures/Material", "5052-Alloy");
235  G4Material* EnclosureMat = geometry::Materials::get(strMatEnclosure);
236 
237  string strMatEncloLid = content.getString("Enclosures/LidMaterial", "5052-Alloy");
238  G4Material* EncloLidMat = geometry::Materials::get(strMatEncloLid);
239 
240  G4Box* outer = new G4Box("Outer", 0.5 * width, 0.5 * depth, 0.5 * length);
241  G4Box* inner = new G4Box("Inner", 0.5 * width - thk, 0.5 * depth - thk, 0.5 * length - thk);
242  G4Box* opening = new G4Box("Opening", 0.5 * width - fold, 0.5 * depth, 0.5 * length - fold);
243  G4Box* lid = new G4Box("Lid", 0.5 * width, 0.5 * lidthk, 0.5 * length);
244 
245  G4ThreeVector translation(0, thk, 0);
246  G4Translate3D transform(translation);
247  G4SubtractionSolid* enclosureShapeT = new G4SubtractionSolid("EnclosureShapeT", outer, inner);
248  G4SubtractionSolid* enclosureShape = new G4SubtractionSolid("EnclosureShape",
249  enclosureShapeT, opening, transform);
250 
251  //Thread the strings
252  string enclosurePath = (format("/%1%[%2%]") % gearPath % iEnclosure).str();
253  string logiVolName = (format("%1%Enclosure_%2%") % side % iEnclosure).str();
254  string logiLidVolName = (format("%1%EnclosureLid_%2%") % side % iEnclosure).str();
255 
256  // Connect the appropriate Gearbox path
257  GearDir enclosureContent(content);
258  enclosureContent.append(enclosurePath);
259 
260  // Create logical volumes
261  G4LogicalVolume* logiEnclosure = new G4LogicalVolume(enclosureShape, EnclosureMat, logiVolName, 0, 0, 0);
262  G4LogicalVolume* logiEncloLid = new G4LogicalVolume(lid, EncloLidMat, logiLidVolName, 0, 0, 0);
263 
264  // Read position
265  double PosZ = enclosureContent.getLength("PosZ") * CLHEP::cm;
266  double PosR = enclosureContent.getLength("PosR") * CLHEP::cm;
267  double PosT = enclosureContent.getAngle("PosT") ;
268 
269  // Read Orientation
270  double Phi1 = enclosureContent.getAngle("AngPhi1") ;
271  double Theta = enclosureContent.getAngle("AngTheta") ;
272  double Phi2 = enclosureContent.getAngle("AngPhi2") ;
273 
274  //Read position adjustments from nominal
275  double AdjX = enclosureContent.getLength("ShiftX") * CLHEP::cm;
276  double AdjY = enclosureContent.getLength("ShiftY") * CLHEP::cm;
277  double AdjZ = enclosureContent.getLength("ShiftZ") * CLHEP::cm;
278 
279  G4Transform3D zsh = G4Translate3D(0, 0, zshift);
280  //G4Transform3D invzsh = G4Translate3D(0, 0, -zshift);
281  G4Transform3D m1 = G4RotateZ3D(Phi1);
282  G4Transform3D m2 = G4RotateY3D(Theta);
283  G4Transform3D m3 = G4RotateZ3D(Phi2);
284  G4Transform3D position = G4Translate3D(PosR * cos(PosT), PosR * sin(PosT), PosZ);
285  G4Transform3D adjust = G4Translate3D(AdjX, AdjY, AdjZ);
286  G4Transform3D lidpos = G4Translate3D(0, 0.5 * (depth + lidthk), 0);
287 
288  G4Transform3D Tr = position * m3 * m2 * m1;
289  G4Transform3D ZshTr = Tr * zsh;
290  G4Transform3D ZshTrAdj = adjust * ZshTr;
291  G4Transform3D LidTr = ZshTr * lidpos;
292  G4Transform3D LidTrAdj = adjust * LidTr;
293 
294  G4VisAttributes* VisAtt = new G4VisAttributes(G4Colour(1.0, 0.5, 0.0, 0.5));
295  logiEnclosure->SetVisAttributes(VisAtt);
296 
297  G4VisAttributes* LidVisAtt = new G4VisAttributes(G4Colour(0.8, 1.0, 0.4, 0.5));
298  logiEncloLid->SetVisAttributes(LidVisAtt);
299  //logiEncloLid->SetVisAttributes(G4VisAttributes::GetInvisible());
300 
301  B2INFO("CsIBox No. " << iEnclosure << " Nominal pos. (mm): " << ZshTr.getTranslation());
302  B2INFO(" Installed pos. (mm): " << ZshTrAdj.getTranslation());
303  B2INFO(" Rotation matrix : " << ZshTrAdj.getRotation());
304  B2INFO(" ");
305 
306  assembly->AddPlacedVolume(logiEnclosure, ZshTrAdj);
307  assembly->AddPlacedVolume(logiEncloLid, LidTrAdj);
308 
309 
310  int nSlots = enclosureContent.getNumberNodes("CrystalInSlot");
311 
312  for (int iSlot = 1; iSlot <= nSlots; iSlot++) {
313  //Thread the strings
314  string slotPath = (format("/Enclosures/Slot[%1%]") % iSlot).str();
315 
316  GearDir slotContent(content);
317  slotContent.append(slotPath);
318 
319  double SlotX = slotContent.getLength("PosX") * CLHEP::cm;
320  double SlotY = slotContent.getLength("PosY") * CLHEP::cm;
321  double SlotZ = slotContent.getLength("PosZ") * CLHEP::cm;
322 
323 
324  G4Transform3D Pos = G4Translate3D(SlotX, SlotY, SlotZ);
325 
326  int CryID = enclosureContent.getInt((format("/CrystalInSlot[%1%]") % iSlot).str());
327 
328  PutCrystal(content, assembly, adjust * Tr * Pos, iEnclosure, CryID);
329  }
330 
331  return;
332 
333  }
void PutCrystal(const GearDir &content, G4AssemblyVolume *assembly, G4Transform3D position, int iEnclosure, int iCry)
Builds the crystals and their wrapping (foil)
Definition: CsiCreator.cc:112
static G4Material * get(const std::string &name)
Find given material.
Definition: Materials.h:63
void fold(double xu, double A, double &x, double &kx, int &nx)
fold a coordinate (inverse of unfold).
Definition: func.h:59

◆ create()

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

Creation of the detector geometry from Gearbox (XML).

Parameters
[in]contentXML data directory.
[in]topVolumeGeant world volume.
[in]typeGeometry type.

Implements CreatorBase.

Definition at line 64 of file CsiCreator.cc.

◆ createFromDB()

void createFromDB ( const std::string &  name,
G4LogicalVolume &  topVolume,
GeometryTypes  type 
)
virtualinherited

Function to create the geometry from the Database.

Parameters
namename of the component in the database, could be used to disambiguate multiple components created with the same creator
topVolumeTop volume in which the geometry has to be placed
typeType of geometry to be build

Reimplemented in GeoVXDServiceCreator, GeoHeavyMetalShieldCreator, GeoTOPCreator, GeoSVDCreator, GeoSTRCreator, GeoServiceMaterialCreator, GeoCOILCreator, GeoPXDCreator, GeoKLMCreator, GeoEKLMCreator, GeoBKLMCreator, GeoFarBeamLineCreator, GeoCryostatCreator, GeoBeamPipeCreator, MyDBCreator, GeoECLCreator, GeoCDCCreatorReducedCDC, GeoCDCCreator, BeamabortCreator, GeoARICHCreator, and GeoMagneticField.

Definition at line 17 of file CreatorBase.cc.

◆ createPayloads()

void createPayloads ( const GearDir content,
const IntervalOfValidity iov 
)
virtualinherited

Function to create the geometry database.

This function should be implemented to convert Gearbox parameters to one ore more database payloads

Parameters
contentGearDir pointing to the parameters which should be used for construction
iovinterval of validity to use when generating payloads

Reimplemented in GeoVXDServiceCreator, GeoHeavyMetalShieldCreator, GeoTOPCreator, GeoSVDCreator, GeoSTRCreator, GeoServiceMaterialCreator, GeoCOILCreator, GeoPXDCreator, GeoKLMCreator, GeoEKLMCreator, GeoBKLMCreator, GeoFarBeamLineCreator, GeoCryostatCreator, GeoBeamPipeCreator, MyDBCreator, GeoMagneticField, GeoECLCreator, GeoCDCCreatorReducedCDC, GeoCDCCreator, BeamabortCreator, and GeoARICHCreator.

Definition at line 24 of file CreatorBase.cc.


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