Geant4  10.02.p03
CCalG4Ecal Class Reference

#include <CCalG4Ecal.hh>

Inheritance diagram for CCalG4Ecal:
Collaboration diagram for CCalG4Ecal:

Public Types

enum  CMType { module1, module2 }
 

Public Member Functions

 CCalG4Ecal (const G4String &name)
 
virtual ~CCalG4Ecal ()
 
void setType (CMType ty)
 
- Public Member Functions inherited from CCalEcal
 CCalEcal (const G4String &name)
 
virtual ~CCalEcal ()
 
G4String getGenMat () const
 
double getWidBox () const
 
double getLengBox () const
 
double getXpos () const
 
double getYpos () const
 
double getZpos () const
 
double getThetaX () const
 
double getPhiX () const
 
double getThetaY () const
 
double getPhiY () const
 
double getThetaZ () const
 
double getPhiZ () const
 
G4String getLayMat () const
 
int getLayNum () const
 
double getLayRadius () const
 
double getLayAngle () const
 
double getLengFront () const
 
double getLayPar (unsigned int i) const
 
G4String getCrystMat () const
 
int getCrystNum () const
 
double getCrystLength () const
 
double getCrystTol () const
 
double getCrystPar (unsigned int i) const
 
G4String getSuppMat () const
 
double getDxSupp () const
 
double getDySupp () const
 
double getDzSupp () const
 
double getDistSupp () const
 
- Public Member Functions inherited from CCalDetector
 CCalDetector (const G4String &name)
 
virtual ~CCalDetector ()
 
void constructHierarchy ()
 
void construct ()
 
void addDetector (CCalDetector *)
 
G4String Name () const
 
G4String baseFileName () const
 
G4String File () const
 
CCalDetectorgetDaughter (int i) const
 
int getNDaughters () const
 
G4bool operator== (const CCalDetector &left) const
 
G4bool operator!= (const CCalDetector &left) const
 
- Public Member Functions inherited from CCalG4Able
 CCalG4Able (G4String name)
 
virtual ~CCalG4Able ()
 
G4VPhysicalVolumePhysicalVolume (G4VPhysicalVolume *)
 
void setVisType (CCalVisualisable::visType, G4LogicalVolume *)
 
void setSensitivity (G4bool sens=true)
 
G4bool isSensitive () const
 
G4String G4Name () const
 
void setName (const G4String &name)
 
G4bool operator== (const CCalG4Able &right) const
 

Static Public Attributes

static G4String idName = "CrystalMatrix"
 

Protected Member Functions

virtual G4VPhysicalVolumeconstructIn (G4VPhysicalVolume *)
 
virtual void constructSensitive ()
 
- Protected Member Functions inherited from CCalEcal
virtual int readFile ()
 
virtual void constructDaughters ()
 
- Protected Member Functions inherited from CCalDetector
int buildFromFile ()
 
- Protected Member Functions inherited from CCalG4Able
void AddCCalG4Able (CCalG4Able *)
 

Private Member Functions

G4LogicalVolumeconstructGlobal ()
 

Private Attributes

CMType type
 
std::vector< ptrG4LogsensitiveLogs
 

Static Private Attributes

static G4LogicalVolumecrystalmatrixLog = 0
 

Additional Inherited Members

- Protected Attributes inherited from CCalDetector
G4String detectorName
 
G4String fileName
 
G4String pathName
 
CCalDetectorTable theDetectorsInside
 
int constructFlag
 
- Protected Attributes inherited from CCalG4Able
G4VPhysicalVolumedetPhysicalVolume
 
CCalG4AbleTable theG4DetectorsInside
 
G4String g4ableName
 
G4bool sensitivity
 
CCalVisualisable visProperties
 
G4VisAttributesg4VisAtt [CCalVisualisable::TotalVisTypes]
 

Detailed Description

Definition at line 39 of file CCalG4Ecal.hh.

Member Enumeration Documentation

◆ CMType

Enumerator
module1 
module2 

Definition at line 42 of file CCalG4Ecal.hh.

Constructor & Destructor Documentation

◆ CCalG4Ecal()

CCalG4Ecal::CCalG4Ecal ( const G4String name)

Definition at line 65 of file CCalG4Ecal.cc.

65  :
66  CCalEcal(name), CCalG4Able(name), type(module1) {}
CMType type
Definition: CCalG4Ecal.hh:67
CCalG4Able(G4String name)
Definition: CCalG4Able.cc:49
CCalEcal(const G4String &name)
Definition: CCalEcal.hh:38

◆ ~CCalG4Ecal()

CCalG4Ecal::~CCalG4Ecal ( )
virtual

Definition at line 68 of file CCalG4Ecal.cc.

68 {}

Member Function Documentation

◆ constructGlobal()

G4LogicalVolume * CCalG4Ecal::constructGlobal ( )
private

Definition at line 149 of file CCalG4Ecal.cc.

149  {
150 
151  //Pointers to the Materials and Rotation Matrix factory
154 
155  G4Material* matter = matfact->findMaterial(getGenMat());
156  G4VSolid* solid = new G4Box (idName, 0.5*getWidBox()*mm, 0.5*getWidBox()*mm,
157  0.5*getLengBox()*mm);
158 #ifdef debug
159  G4cout << tab << idName << " Box made of " << getGenMat() << " of dimension "
160  << 0.5*getWidBox()*mm << ", " << 0.5*getWidBox()*mm << ", "
161  << 0.5*getLengBox()*mm << G4endl;
162 #endif
163  G4LogicalVolume* glog = new G4LogicalVolume (solid, matter, idName);
165 
166  //Now the layers
167  G4String name = idName + "Layer";
168  matter = matfact->findMaterial(getLayMat());
169  solid = new G4Trd(name, getLayPar(0)*mm, getLayPar(1)*mm, getLayPar(2)*mm,
170  getLayPar(3)*mm, getLayPar(4)*mm);
171 #ifdef debug
172  G4cout << tab << name << " Trd made of " << getLayMat() << " of dimension "
173  << getLayPar(0)*mm << ", " << getLayPar(1)*mm << ", " << getLayPar(2)*mm
174  << ", " << getLayPar(3)*mm << ", " << getLayPar(4)*mm << G4endl;
175 #endif
176  G4LogicalVolume* laylog = new G4LogicalVolume (solid, matter, name);
178 
179  G4int i = 0;
180  G4String rotstr;
181  G4double xp, yp, zp, angle;
182  G4double zshift = -0.5 * (getLengBox() - getCrystLength()) + getLengFront();
183  G4RotationMatrix* rot = 0;
184  for (i = 0; i < getLayNum(); i++) {
185  angle = 0.5 * getLayAngle() * (2*i + 1 - getLayNum());
186  xp = angle * (getLayPar(4) + getLayRadius()) * mm;
187  zp = (zshift + getLayPar(0)*std::abs(std::sin(angle))) * mm;
188  rotstr = idName + "Layer" + i;
189  rot = rotfact->findMatrix(rotstr);
190  if (!rot) {
191 #ifdef ddebug
192  G4cout << "Creating a new rotation: " << rotstr << tab
193  << (90.0*deg+angle) << "," << 0.0*deg << "," << 90.0*deg << ","
194  << 90.0*deg << "," << angle << "," << 0.0*deg << G4endl;
195 #endif
196  rot = rotfact->AddMatrix(rotstr, (90.0*deg+angle), 0.0*deg, 90.0*deg,
197  90.0*deg, angle, 0.0*deg);
198  }
199  new G4PVPlacement(rot, G4ThreeVector(xp,0.,zp), laylog, name, glog,
200  false, i+1);
201 #ifdef pdebug
202  G4cout << laylog->GetName() << " number " << i+1 << " positioned in "
203  << glog->GetName() << " at (" << xp << ", 0," << zp
204  << ") with rotation angle " << angle/deg << G4endl;
205 #endif
206  }
207 
208  //Now the crystals
209  name = idName + "Crystal";
210  matter = matfact->findMaterial(getCrystMat());
211  solid = new G4Trd(name, getCrystPar(0)*mm, getCrystPar(1)*mm,
213 #ifdef debug
214  G4cout << tab << name << " Trd made of " << getCrystMat() << " of dimension "
215  << getCrystPar(0)*mm << ", " << getCrystPar(1)*mm << ", "
216  << getCrystPar(2)*mm << ", " << getCrystPar(3)*mm << ", "
217  << getCrystPar(4)*mm << G4endl;
218 #endif
219 
220  G4LogicalVolume* detLog = new G4LogicalVolume (solid, matter, name);
222  sensitiveLogs.push_back(detLog);
223  for (i = 0; i < getCrystNum(); i++) {
224  angle = 0.5 * getLayAngle() * (2*i + 1 - getCrystNum());
225  yp = angle * (getCrystPar(4) + getLayRadius()) * mm;
226  zp = (getCrystPar(0)*std::abs(std::sin(angle)) - getCrystTol()) * mm;
227  rotstr = idName + "Crystal" + i;
228  rot = rotfact->findMatrix(rotstr);
229  if (!rot) {
230 #ifdef ddebug
231  G4cout << "Creating a new rotation: " << rotstr << tab << 90.0*deg << ","
232  << 0.0*deg << "," << (90.0*deg+angle) << "," << 0.0*deg << ","
233  << angle << "," << 90.0*deg << G4endl;
234 #endif
235  rot = rotfact->AddMatrix(rotstr, 90.0*deg, 0.0*deg, (90.0*deg+angle),
236  90.0*deg, angle, 90.0*deg);
237  }
238  new G4PVPlacement(rot, G4ThreeVector(0,yp,zp), detLog, name, laylog,
239  false, i+1);
240 #ifdef pdebug
241  G4cout << detLog->GetName() << " number " << i+1 << " positioned in "
242  << laylog->GetName() << " at (0," << yp << "," << zp
243  << ") with rotation angle " << angle/deg << G4endl;
244 #endif
245  }
246 
247  //Support boxes
248  name = idName + "Support";
249  matter = matfact->findMaterial(getSuppMat());
250  solid = new G4Box (name, 0.5*getDxSupp()*mm, 0.5*getDySupp()*mm,
251  0.5*getDzSupp()*mm);
252 #ifdef debug
253  G4cout << tab << name << " Box made of " << getSuppMat() << " of dimension "
254  << 0.5*getDxSupp()*mm << ", " << 0.5*getDySupp()*mm << ", "
255  << 0.5*getDzSupp()*mm << G4endl;
256 #endif
257  G4LogicalVolume* slog = new G4LogicalVolume (solid, matter, name);
259 
260  zp = (-0.5 * getLengBox() + getCrystLength() + getLengFront() +
261  0.5 * getDzSupp() + getDistSupp()) * mm;
262  for (i = 0; i < getCrystNum(); i++) {
263  yp = getLayPar(1) * (2*i + 1 - getCrystNum()) * mm;
264  new G4PVPlacement(0, G4ThreeVector(0,yp,zp), slog, name, glog,
265  false, i+1);
266 #ifdef pdebug
267  G4cout << slog->GetName() << " number " << i+1 << " positioned in "
268  << glog->GetName() << " at (0," << yp << "," << zp
269  << ") with no rotation" << G4endl;
270 #endif
271  }
272 
273  return glog;
274 }
CLHEP::Hep3Vector G4ThreeVector
double getLayPar(unsigned int i) const
Definition: CCalEcal.hh:60
Definition: G4Box.hh:64
G4String name
Definition: TRTMaterials.hh:40
void setVisType(CCalVisualisable::visType, G4LogicalVolume *)
Definition: CCalG4Able.cc:104
double getLengFront() const
Definition: CCalEcal.hh:59
static G4double angle[DIM]
double getDySupp() const
Definition: CCalEcal.hh:68
Definition: G4Trd.hh:72
int G4int
Definition: G4Types.hh:78
G4RotationMatrix * AddMatrix(const G4String &name, G4double th1, G4double phi1, G4double th2, G4double phi2, G4double th3, G4double phi3)
double getCrystTol() const
Definition: CCalEcal.hh:64
double getDistSupp() const
Definition: CCalEcal.hh:70
G4String getSuppMat() const
Definition: CCalEcal.hh:66
G4GLOB_DLL std::ostream G4cout
double getCrystPar(unsigned int i) const
Definition: CCalEcal.hh:65
const G4String & GetName() const
static const double deg
Definition: G4SIunits.hh:151
static G4String idName
Definition: CCalG4Ecal.hh:51
std::ostream & tab(std::ostream &)
Definition: CCalutils.cc:89
double getWidBox() const
Definition: CCalEcal.hh:44
int getLayNum() const
Definition: CCalEcal.hh:56
static CCalRotationMatrixFactory * getInstance()
double getLayRadius() const
Definition: CCalEcal.hh:57
G4String getCrystMat() const
Definition: CCalEcal.hh:61
double getDxSupp() const
Definition: CCalEcal.hh:67
G4Material * findMaterial(const G4String &) const
double getLengBox() const
Definition: CCalEcal.hh:45
std::vector< ptrG4Log > sensitiveLogs
Definition: CCalG4Ecal.hh:73
G4RotationMatrix * findMatrix(const G4String &)
int getCrystNum() const
Definition: CCalEcal.hh:62
#define G4endl
Definition: G4ios.hh:61
static CCalMaterialFactory * getInstance()
double G4double
Definition: G4Types.hh:76
double getLayAngle() const
Definition: CCalEcal.hh:58
double getDzSupp() const
Definition: CCalEcal.hh:69
static const double mm
Definition: G4SIunits.hh:114
G4String getGenMat() const
Definition: CCalEcal.hh:43
G4String getLayMat() const
Definition: CCalEcal.hh:55
double getCrystLength() const
Definition: CCalEcal.hh:63
Here is the call graph for this function:
Here is the caller graph for this function:

◆ constructIn()

G4VPhysicalVolume * CCalG4Ecal::constructIn ( G4VPhysicalVolume mother)
protectedvirtual

Implements CCalG4Able.

Definition at line 74 of file CCalG4Ecal.cc.

74  {
75  G4cout << "==>> Constructing CCalG4Ecal..." << G4endl;
76 
78  // Construction of global volume as a Box
79 
80  if (!crystalmatrixLog) {
82  }
84 
85  G4double x, y, z;
86  if (mother != 0) {
87  x = getXpos()*mm;
88  y = getYpos()*mm;
89  z = getZpos()*mm;
90  } else {
91  x = y = z = 0;
92  }
93 
94  int num;
95  if (type == module2) {
96  num = 2;
97  } else {
98  num = 1;
99  }
100 #ifdef pdebug
101  G4String name("Null");
102  if (mother != 0) name = mother->GetName();
103  G4cout << crystalmatrixLog->GetName() << " Number " << num << " positioned in "
104  << name << " at (" << x << ", " << y << ", " << z << ")";
105 #endif
106 
107  G4RotationMatrix* cmrot = 0;
108  if (mother != 0) {
109  G4String rotstr = idName + num;
110  cmrot = rotfact->findMatrix(rotstr);
111  if (!cmrot) {
112 #ifdef ddebug
113  G4cout << "Creating a new rotation: " << rotstr << tab
114  << getThetaX()*deg << "," << getPhiX()*deg << ","
115  << getThetaY()*deg << "," << getPhiY()*deg << ","
116  << getThetaZ()*deg << "," << getPhiZ()*deg << G4endl;
117 #endif
118  cmrot = rotfact->AddMatrix(rotstr, getThetaX()*deg, getPhiX()*deg,
119  getThetaY()*deg, getPhiY()*deg,
120  getThetaZ()*deg, getPhiZ()*deg);
121  } // if !cmrot
122 #ifdef pdebug
123  G4cout << " rotation by (" << getThetaX() << ", " << getPhiX() << ", "
124  << getThetaY() << "," << getPhiY() << ", " << getThetaZ() << ", "
125  << getPhiZ() << ")" << G4endl;
126 #endif
127  } else {
128 #ifdef pdebug
129  G4cout << " without rotation..." << G4endl;
130 #endif
131  }
132 
133  G4PVPlacement* crystalmatrix;
134  if (mother != 0) {
135  crystalmatrix = new G4PVPlacement(cmrot, G4ThreeVector(x,y,z),
137  mother->GetLogicalVolume(), false, num);
138  } else {
139  crystalmatrix = new G4PVPlacement(cmrot, G4ThreeVector(x,y,z),
141  mother, false, num);
142  }
143  G4cout << "<<== End of CCalG4Ecal construction ..." << G4endl;
144 
145  return crystalmatrix;
146 }
double getThetaZ() const
Definition: CCalEcal.hh:53
double getThetaX() const
Definition: CCalEcal.hh:49
CLHEP::Hep3Vector G4ThreeVector
double getPhiX() const
Definition: CCalEcal.hh:50
G4String name
Definition: TRTMaterials.hh:40
CMType type
Definition: CCalG4Ecal.hh:67
double getZpos() const
Definition: CCalEcal.hh:48
G4RotationMatrix * AddMatrix(const G4String &name, G4double th1, G4double phi1, G4double th2, G4double phi2, G4double th3, G4double phi3)
Double_t y
G4GLOB_DLL std::ostream G4cout
const G4String & GetName() const
static const double deg
Definition: G4SIunits.hh:151
static G4String idName
Definition: CCalG4Ecal.hh:51
std::ostream & tab(std::ostream &)
Definition: CCalutils.cc:89
static CCalRotationMatrixFactory * getInstance()
double getPhiY() const
Definition: CCalEcal.hh:52
double getPhiZ() const
Definition: CCalEcal.hh:54
const G4String & GetName() const
double getXpos() const
Definition: CCalEcal.hh:46
G4RotationMatrix * findMatrix(const G4String &)
#define G4endl
Definition: G4ios.hh:61
double getThetaY() const
Definition: CCalEcal.hh:51
G4LogicalVolume * constructGlobal()
Definition: CCalG4Ecal.cc:149
double G4double
Definition: G4Types.hh:76
G4LogicalVolume * GetLogicalVolume() const
static G4LogicalVolume * crystalmatrixLog
Definition: CCalG4Ecal.hh:70
double getYpos() const
Definition: CCalEcal.hh:47
static const double mm
Definition: G4SIunits.hh:114
Here is the call graph for this function:

◆ constructSensitive()

void CCalG4Ecal::constructSensitive ( )
protectedvirtual

Reimplemented from CCalG4Able.

Definition at line 276 of file CCalG4Ecal.cc.

276  {
277 
278 #ifdef debug
279  G4cout << "Now registering CrystalMatrix LogicalVolume's to SD's:" << G4endl;
280 #endif
281  if (sensitiveLogs.size()>0) {
283  G4String SDname = idName;
284  for(std::vector<ptrG4Log>::iterator iter=sensitiveLogs.begin();
285  iter<sensitiveLogs.end(); iter++) {
286  sensDets->registerVolume(SDname, (*iter));
287 #ifdef sdebug
288  G4cout << "Register volume " << (*iter)->GetName() << " for" << SDname
289  << G4endl;
290 #endif
291  }
292  }
293 
294 }
static CCalSensitiveDetectors * getInstance()
void registerVolume(const G4String &name, G4LogicalVolume *)
G4GLOB_DLL std::ostream G4cout
static G4String idName
Definition: CCalG4Ecal.hh:51
std::vector< ptrG4Log > sensitiveLogs
Definition: CCalG4Ecal.hh:73
#define G4endl
Definition: G4ios.hh:61
Here is the call graph for this function:

◆ setType()

void CCalG4Ecal::setType ( CMType  ty)
inline

Definition at line 48 of file CCalG4Ecal.hh.

48 {type = ty;}
CMType type
Definition: CCalG4Ecal.hh:67
Here is the caller graph for this function:

Member Data Documentation

◆ crystalmatrixLog

G4LogicalVolume * CCalG4Ecal::crystalmatrixLog = 0
staticprivate

Definition at line 70 of file CCalG4Ecal.hh.

◆ idName

G4String CCalG4Ecal::idName = "CrystalMatrix"
static

Definition at line 51 of file CCalG4Ecal.hh.

◆ sensitiveLogs

std::vector<ptrG4Log> CCalG4Ecal::sensitiveLogs
private

Definition at line 73 of file CCalG4Ecal.hh.

◆ type

CMType CCalG4Ecal::type
private

Definition at line 67 of file CCalG4Ecal.hh.


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