Belle II Software  release-06-01-15
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 215 of file CsiCreator.cc.

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

◆ 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 66 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, GeoCDCCreator, 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, GeoCDCCreator, and GeoARICHCreator.

Definition at line 24 of file CreatorBase.cc.


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