Belle II Software development
CsiGeometryPar Class Reference

The Class for CSI Geometry Parameters. More...

#include <CsiGeometryPar.h>

Public Member Functions

 CsiGeometryPar ()
 Constructor.
 
virtual ~CsiGeometryPar ()
 Destructor.
 
void clear ()
 Clears.
 
void Print (const int cid, int debuglevel=80)
 Print crystal information.
 
void PrintAll (int debuglevel=80)
 Print all crystals information.
 
void read ()
 Gets geometry parameters from gearbox.
 
int CsiVolNameToCellID (const G4String VolumeName)
 Get Cell Id.
 
G4Material * GetMaterial (int cid)
 Get pointer to the Geant4 Material.
 
ROOT::Math::XYZVector GetPosition (int cid)
 Get the position of the crystal.
 
ROOT::Math::XYZVector GetOrientation (int cid)
 Get the orientation of the crystal.
 
int GetEnclosureID (int cid)
 Get Enclosure ID from cell ID.
 
int GetSlotID (int cid)
 Get Slot ID in the Enclosure from cell ID.
 
double GetMaterialProperty (int cid, const char *propertyname)
 Get material property.
 
double GetTauFast (int cid)
 Get crystal fast time constant.
 
double GetTauSlow (int cid)
 Get crystal slow time constant.
 

Static Public Member Functions

static CsiGeometryParInstance ()
 Static method to get a reference to the CsiGeometryPar instance.
 

Private Attributes

int m_cellID
 The Cell ID information.
 
std::vector< int > m_thetaID
 The Theta ID information.
 
std::vector< int > m_phiID
 The Phi ID information.
 
std::vector< int > m_BoxID
 The index of the enclosure.
 
std::vector< int > m_SlotID
 The slot index of the crystal in the enclosure.
 
std::vector< ROOT::Math::XYZVector > m_Position
 Position of the nominal centre of the crystal.
 
std::vector< ROOT::Math::XYZVector > m_Orientation
 Orientation of the crystal.
 

Static Private Attributes

static CsiGeometryParm_B4CsiGeometryParDB = 0
 Pointer that saves the instance of this class.
 

Detailed Description

The Class for CSI Geometry Parameters.

This class provides CSI gemetry paramters for simulation, reconstruction and so on. These parameters are gotten from gearbox.

Definition at line 48 of file CsiGeometryPar.h.

Constructor & Destructor Documentation

◆ CsiGeometryPar()

Constructor.

Definition at line 32 of file CsiGeometryPar.cc.

33{
34 clear();
35 read();
36
37 PrintAll();
38}
void PrintAll(int debuglevel=80)
Print all crystals information.
void read()
Gets geometry parameters from gearbox.

◆ ~CsiGeometryPar()

~CsiGeometryPar ( )
virtual

Destructor.

Definition at line 40 of file CsiGeometryPar.cc.

41{
44 B2INFO("m_B4CsiGeometryParDB deleted ");
45 }
46}
static CsiGeometryPar * m_B4CsiGeometryParDB
Pointer that saves the instance of this class.

Member Function Documentation

◆ clear()

void clear ( )

Clears.

Definition at line 48 of file CsiGeometryPar.cc.

49{
50 m_cellID = 0;
51
52 m_Position.clear();
53 m_Orientation.clear();
54 m_BoxID.clear();
55 m_SlotID.clear();
56 m_thetaID.clear();
57 m_phiID.clear();
58
59}
std::vector< ROOT::Math::XYZVector > m_Position
Position of the nominal centre of the crystal.
std::vector< ROOT::Math::XYZVector > m_Orientation
Orientation of the crystal.
std::vector< int > m_thetaID
The Theta ID information.
int m_cellID
The Cell ID information.
std::vector< int > m_phiID
The Phi ID information.
std::vector< int > m_BoxID
The index of the enclosure.
std::vector< int > m_SlotID
The slot index of the crystal in the enclosure.

◆ CsiVolNameToCellID()

int CsiVolNameToCellID ( const G4String  VolumeName)

Get Cell Id.

Definition at line 134 of file CsiGeometryPar.cc.

135{
136 int cellID = 0;
137
138 vector< string > partName;
139 split(partName, VolumeName, is_any_of("_"));
140
141 int iEnclosure = -1;
142 int iCrystal = -1;
143 for (std::vector<string>::iterator it = partName.begin() ; it != partName.end(); ++it) {
144 if (equals(*it, "Enclosure")) iEnclosure = boost::lexical_cast<int>(*(it + 1)) - 1;
145 else if (equals(*it, "Crystal")) iCrystal = boost::lexical_cast<int>(*(it + 1)) - 1;
146 }
147
148 cellID = 3 * iEnclosure + iCrystal;
149
150 if (cellID < 0) B2WARNING("CsiGeometryPar: volume " << VolumeName << " is not a crystal");
151
152 return cellID;
153}

◆ GetEnclosureID()

int GetEnclosureID ( int  cid)
inline

Get Enclosure ID from cell ID.

Definition at line 90 of file CsiGeometryPar.h.

90{ return m_BoxID.at(cid); };

◆ GetMaterial()

G4Material * GetMaterial ( int  cid)

Get pointer to the Geant4 Material.

Definition at line 156 of file CsiGeometryPar.cc.

157{
158 int iEnclosure = GetEnclosureID(cid) + 1;
159 int iSlot = GetSlotID(cid) + 1;
160
161 GearDir content = GearDir("/Detector/DetectorComponent[@name=\"CSI\"]/Content/");
162
163 GearDir enclosureContent(content);
164 string gearPath = "Enclosures/Enclosure";
165 string enclosurePath = (format("/%1%[%2%]") % gearPath % iEnclosure).str();
166 enclosureContent.append(enclosurePath);
167
168 string slotName = (format("CrystalInSlot[%1%]") % iSlot).str();
169 int iCry = enclosureContent.getInt(slotName);
170
171
172 GearDir crystalContent(content);
173 crystalContent.append((format("/EndCapCrystals/EndCapCrystal[%1%]/") % (iCry)).str());
174 string strMatCrystal = crystalContent.getString("Material", "Air");
175
176 return geometry::Materials::get(strMatCrystal);
177
178}
GearDir is the basic class used for accessing the parameter store.
Definition: GearDir.h:31
int GetEnclosureID(int cid)
Get Enclosure ID from cell ID.
int GetSlotID(int cid)
Get Slot ID in the Enclosure from cell ID.
static G4Material * get(const std::string &name)
Find given material.
Definition: Materials.h:63

◆ GetMaterialProperty()

double GetMaterialProperty ( int  cid,
const char *  propertyname 
)

Get material property.

Definition at line 181 of file CsiGeometryPar.cc.

182{
183 G4Material* mat = GetMaterial(cid);
184 G4MaterialPropertiesTable* properties = mat->GetMaterialPropertiesTable();
185 G4MaterialPropertyVector* property = properties->GetProperty(propertyname);
186
187 return property->Value(0);
188}
G4Material * GetMaterial(int cid)
Get pointer to the Geant4 Material.

◆ GetOrientation()

ROOT::Math::XYZVector GetOrientation ( int  cid)
inline

Get the orientation of the crystal.

Definition at line 87 of file CsiGeometryPar.h.

87{ return m_Orientation.at(cid); };

◆ GetPosition()

ROOT::Math::XYZVector GetPosition ( int  cid)
inline

Get the position of the crystal.

Definition at line 84 of file CsiGeometryPar.h.

84{ return m_Position.at(cid); };

◆ GetSlotID()

int GetSlotID ( int  cid)
inline

Get Slot ID in the Enclosure from cell ID.

Definition at line 93 of file CsiGeometryPar.h.

93{ return m_SlotID.at(cid); };

◆ GetTauFast()

double GetTauFast ( int  cid)
inline

Get crystal fast time constant.

Definition at line 99 of file CsiGeometryPar.h.

99{ return GetMaterialProperty(cid, "FASTTIMECONSTANT"); };
double GetMaterialProperty(int cid, const char *propertyname)
Get material property.

◆ GetTauSlow()

double GetTauSlow ( int  cid)
inline

Get crystal slow time constant.

Definition at line 102 of file CsiGeometryPar.h.

102{ return GetMaterialProperty(cid, "SLOWTIMECONSTANT"); };

◆ Instance()

CsiGeometryPar * Instance ( )
static

Static method to get a reference to the CsiGeometryPar instance.

Returns
A reference to an instance of this class.

Definition at line 26 of file CsiGeometryPar.cc.

◆ Print()

void Print ( const int  cid,
int  debuglevel = 80 
)

Print crystal information.

Definition at line 190 of file CsiGeometryPar.cc.

191{
192 B2DEBUG(debuglevel, "Cell ID : " << cid);
193
194 B2DEBUG(debuglevel, " Position x : " << GetPosition(cid).x());
195 B2DEBUG(debuglevel, " Position y : " << GetPosition(cid).y());
196 B2DEBUG(debuglevel, " Position z : " << GetPosition(cid).z());
197
198 B2DEBUG(debuglevel, " Orientation x : " << GetOrientation(cid).x());
199 B2DEBUG(debuglevel, " Orientation y : " << GetOrientation(cid).y());
200 B2DEBUG(debuglevel, " Orientation z : " << GetOrientation(cid).z());
201
202 B2DEBUG(debuglevel, " Material : " << GetMaterial(cid)->GetName());
203
204 B2DEBUG(debuglevel, " Slow time constatnt : " << GetMaterialProperty(cid, "SLOWTIMECONSTANT"));
205 B2DEBUG(debuglevel, " Fast time constatnt : " << GetMaterialProperty(cid, "FASTTIMECONSTANT"));
206 B2DEBUG(debuglevel, " Light yield : " << GetMaterialProperty(cid, "SCINTILLATIONYIELD"));
207
208 //GetMaterial(cid)->GetMaterialPropertiesTable()->DumpTable();
209}
ROOT::Math::XYZVector GetOrientation(int cid)
Get the orientation of the crystal.
ROOT::Math::XYZVector GetPosition(int cid)
Get the position of the crystal.

◆ PrintAll()

void PrintAll ( int  debuglevel = 80)

Print all crystals information.

Definition at line 211 of file CsiGeometryPar.cc.

212{
213 for (uint i = 0; i < m_thetaID.size(); i++)
214 Print(i, debuglevel);
215}
void Print(const int cid, int debuglevel=80)
Print crystal information.

◆ read()

void read ( )

Gets geometry parameters from gearbox.

Position of the nominal centre of crystals in the box

Definition at line 61 of file CsiGeometryPar.cc.

62{
63
64 GearDir content = GearDir("/Detector/DetectorComponent[@name=\"CSI\"]/Content/");
65 string gearPath = "Enclosures/Enclosure";
66 int nEnc = content.getNumberNodes(gearPath);
67
68 int iCell = 0;
69
70 for (int iEnc = 1; iEnc <= nEnc; iEnc++) {
71 // Build the box (same for all)
72 //double length = content.getLength("Enclosures/Length") * CLHEP::cm;
73 //double thk = content.getLength("Enclosures/Thickness") * CLHEP::cm;
74 //double halflength = 15.0 * CLHEP::cm;
75 //double zshift = 0.5 * length - thk - halflength; /*< Shift of the box along z-axis (cry touches panel) **/
76
77 string enclosurePath = (boost::format("/%1%[%2%]") % gearPath % iEnc).str();
78
79 // Connect the appropriate Gearbox path
80 GearDir enclosureContent(content);
81 enclosureContent.append(enclosurePath);
82
83 // Read position
84 double PosZ = enclosureContent.getLength("PosZ") * CLHEP::cm;
85 double PosR = enclosureContent.getLength("PosR") * CLHEP::cm;
86 double PosT = enclosureContent.getAngle("PosT") ;
87
88 // Read Orientation
89 double Phi1 = enclosureContent.getAngle("AngPhi1") ;
90 double Theta = enclosureContent.getAngle("AngTheta") ;
91 double Phi2 = enclosureContent.getAngle("AngPhi2") ;
92
93 //Transform3D zsh = Translate3D(0, 0, zshift);
94 Transform3D m1 = RotateZ3D(Phi1);
95 Transform3D m2 = RotateY3D(Theta);
96 Transform3D m3 = RotateZ3D(Phi2);
97 Transform3D position = Translate3D(PosR * cos(PosT), PosR * sin(PosT), PosZ);
98
100 Transform3D Tr = position * m3 * m2 * m1;
101
102 int nSlots = enclosureContent.getNumberNodes("CrystalInSlot");
103 for (int iSlot = 1; iSlot <= nSlots; iSlot++) {
104 iCell++;
105
106 //Thread the strings
107 string slotPath = (boost::format("/Enclosures/Slot[%1%]") % iSlot).str();
108
109 GearDir slotContent(content);
110 slotContent.append(slotPath);
111
112 double SlotX = slotContent.getLength("PosX") * CLHEP::cm;
113 double SlotY = slotContent.getLength("PosY") * CLHEP::cm;
114 double SlotZ = slotContent.getLength("PosZ") * CLHEP::cm;
115 Transform3D Pos = Translate3D(SlotX, SlotY, SlotZ);
116
117 Transform3D CrystalPos = Tr * Pos;
118 RotationMatrix CrystalRot = CrystalPos.getRotation();
119
120 m_Position.push_back(ROOT::Math::XYZVector(CrystalPos.getTranslation()) * 1.0 / CLHEP::cm);
121 m_Orientation.push_back(ROOT::Math::XYZVector(CrystalRot.colZ()));
122
123 m_thetaID.push_back(CrystalPos.getTranslation().z() > 0 ? 0 : 1);
124 m_phiID.push_back(iCell - 9 * m_thetaID.back());
125
126 m_BoxID.push_back(iEnc - 1);
127 m_SlotID.push_back(iSlot - 1);
128 }
129 //
130 }
131}

Member Data Documentation

◆ m_B4CsiGeometryParDB

CsiGeometryPar * m_B4CsiGeometryParDB = 0
staticprivate

Pointer that saves the instance of this class.

Definition at line 130 of file CsiGeometryPar.h.

◆ m_BoxID

std::vector<int> m_BoxID
private

The index of the enclosure.

Definition at line 118 of file CsiGeometryPar.h.

◆ m_cellID

int m_cellID
private

The Cell ID information.

Definition at line 109 of file CsiGeometryPar.h.

◆ m_Orientation

std::vector<ROOT::Math::XYZVector> m_Orientation
private

Orientation of the crystal.

Definition at line 127 of file CsiGeometryPar.h.

◆ m_phiID

std::vector<int> m_phiID
private

The Phi ID information.

Definition at line 115 of file CsiGeometryPar.h.

◆ m_Position

std::vector<ROOT::Math::XYZVector> m_Position
private

Position of the nominal centre of the crystal.

Definition at line 124 of file CsiGeometryPar.h.

◆ m_SlotID

std::vector<int> m_SlotID
private

The slot index of the crystal in the enclosure.

Definition at line 121 of file CsiGeometryPar.h.

◆ m_thetaID

std::vector<int> m_thetaID
private

The Theta ID information.

Definition at line 112 of file CsiGeometryPar.h.


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