14 #include "GeoModelKernel/GeoMaterial.h"
15 #include "GeoModelKernel/GeoBox.h"
16 #include "GeoModelKernel/GeoPcon.h"
17 #include "GeoModelKernel/GeoTube.h"
18 #include "GeoModelKernel/GeoTubs.h"
19 #include "GeoModelKernel/GeoTrd.h"
20 #include "GeoModelKernel/GeoCons.h"
21 #include "GeoModelKernel/GeoLogVol.h"
22 #include "GeoModelKernel/GeoShapeShift.h"
23 #include "GeoModelKernel/GeoShapeIntersection.h"
24 #include "GeoModelKernel/GeoShapeSubtraction.h"
25 #include "GeoModelKernel/GeoNameTag.h"
26 #include "GeoModelKernel/GeoPhysVol.h"
27 #include "GeoModelKernel/GeoFullPhysVol.h"
28 #include "GeoModelKernel/GeoVFullPhysVol.h"
29 #include "GeoModelKernel/GeoTransform.h"
30 #include "GeoModelKernel/GeoSerialDenominator.h"
31 #include "GeoModelKernel/GeoSerialIdentifier.h"
32 #include "GeoModelKernel/GeoAlignableTransform.h"
33 #include "GeoModelKernel/GeoSerialTransformer.h"
34 #include "GeoModelKernel/GeoIdentifierTag.h"
35 #include "GeoModelKernel/GeoShapeUnion.h"
36 #include "GeoModelKernel/GeoDefinitions.h"
37 #include "GeoModelKernel/Units.h"
38 #include "GeoGenericFunctions/AbsFunction.h"
39 #include "GeoGenericFunctions/Variable.h"
40 #include "GeoGenericFunctions/Sin.h"
41 #include "GeoGenericFunctions/Cos.h"
46 #include "GaudiKernel/MsgStream.h"
47 #include "GaudiKernel/Bootstrap.h"
48 #include "GaudiKernel/SystemOfUnits.h"
136 ISvcLocator* svcLocator = Gaudi::svcLocator();
137 if (svcLocator->service(
"DetectorStore",
m_detectorStore,
false )==StatusCode::FAILURE) {
138 throw std::runtime_error(
"Error in ModulesConstruction, cannot access DetectorStore");
143 if(!
status.isSuccess() ) {
144 std::cout <<
"ModulesConstructionH62004:\tCan't access LArGeoTB2004Options, using default values\n";
153 if (StatusCode::SUCCESS != m_detectorStore->retrieve(materialManager, std::string(
"MATERIALS"))) {
154 throw std::runtime_error(
"Error in ModulesConstruction, cannot access Material manager");
157 if (m_ModulesPhys)
return (m_ModulesPhys);
158 ISvcLocator *svcLocator = Gaudi::svcLocator();
160 if (svcLocator->service(
"MessageSvc",
msgSvc,
true )==StatusCode::FAILURE) {
161 throw std::runtime_error(
"Error in ModulesConstructionH62004, cannot access MessageSvc");
163 MsgStream
log(
msgSvc,
"ModulesConstructionH62004");
165 log <<
"++++++++++++++++++++++++++++++++++++++++++++++++++++" << std::endl;
166 log <<
"+ +" << std::endl;
167 log <<
"+ Start of H62004 GeoModel definition +" << std::endl;
168 log <<
"+ +" << std::endl;
169 log <<
"++++++++++++++++++++++++++++++++++++++++++++++++++++" << std::endl;
171 const GeoMaterial *
LAr = materialManager->
getMaterial(
"std::LiquidArgon");
172 if (!
LAr)
throw std::runtime_error(
"Error in ModulesConstruction, std::LiquidArgon is not found.");
181 const GeoElement* C=materialManager->
getElement(
"Carbon");
182 const GeoElement*
H=materialManager->
getElement(
"Hydrogen");
183 const GeoElement* O=materialManager->
getElement(
"Oxygen");
184 const GeoElement*
N=materialManager->
getElement(
"Nitrogen");
186 Rohacell->add(C,0.6465);
187 Rohacell->add(
H,0.07836);
188 Rohacell->add(O,0.19137);
189 Rohacell->add(
N,0.08377);
199 const GeoMaterial *Alu = materialManager->
getMaterial(
"std::Aluminium");
200 if (!Alu)
throw std::runtime_error(
"Error in ModulesConstruction, std::Aluminium is not found.");
220 double bepo_y_ex = bcry_rlar-bepo_excluder_shift;
230 double bepo_y_e = bcry_rlar-bepo_emec_shift;
233 std::string baseName =
"LArGeoTB::LeakageDet::";
236 if(m_Options && m_Options->isRun1()) {
241 GeoTubs *shapeMother =
new GeoTubs( 0.0*
Gaudi::Units::cm, bcry_rlar, ylen, bcry_phistart,bcry_phiend);
242 GeoLogVol *logMother =
new GeoLogVol(baseName +
"LAr", shapeMother,
LAr);
244 m_ModulesPhys =
new GeoFullPhysVol(logMother);
246 std::string
tag = std::string(
"MODULES_POS");
249 status=m_detectorStore->record(sPhysVol,
tag);
250 if(!
status.isSuccess())
throw std::runtime_error ((std::string(
"Cannot store")+
tag).c_str());
280 GeoIntrusivePtr<GeoVFullPhysVol> excluderEnvelope = excluder.
GetEnvelope();
282 GeoTrf::Transform3D rot2 = GeoTrf::RotateX3D(bepo_Beta) * GeoTrf::RotateX3D(bepo_ty) * GeoTrf::RotateZ3D(bepo_tz);
283 m_ModulesPhys->add(
new GeoSerialIdentifier(0));
285 m_ModulesPhys->add(excluderEnvelope);
296 GeoIntrusivePtr<GeoVFullPhysVol> fcexcluderEnvelope = fcexcluder.
GetEnvelope();
297 if(fcexcluderEnvelope ){
298 GeoTrf::Transform3D rot2 = GeoTrf::RotateX3D(0.8*bepo_Beta) * GeoTrf::RotateX3D(-bepo_ty) * GeoTrf::RotateZ3D(bepo_tx);
299 m_ModulesPhys->add(
new GeoSerialIdentifier(0));
302 m_ModulesPhys->add(fcexcluderEnvelope);
312 GeoIntrusivePtr<GeoVFullPhysVol> frontexcluderEnvelope = frontexcluder.
GetEnvelope();
313 if(frontexcluderEnvelope ){
315 m_ModulesPhys->add(
new GeoSerialIdentifier(0));
317 m_ModulesPhys->add(frontexcluderEnvelope);
337 GeoIntrusivePtr<GeoVFullPhysVol> backexcluderEnvelope = backexcluder.
GetEnvelope();
338 if(backexcluderEnvelope ){
340 m_ModulesPhys->add(
new GeoSerialIdentifier(0));
342 m_ModulesPhys->add(backexcluderEnvelope);
362 GeoTrf::Transform3D rota = GeoTrf::RotateX3D(bepo_Beta) * GeoTrf::RotateX3D(bepo_ty) * GeoTrf::RotateZ3D(-bepo_pz);
374 if((!m_Options) || m_Options->isEmec()){
375 GeoTrf::RotateZ3D MrotEmec(bepo_tz_e);
381 , (bepo_x_e + bepo_y_emecshift )/2./
sin(bepo_tz_e)
390 GeoIntrusivePtr<GeoVFullPhysVol> emecEnvelope = emecConstruction.
GetEnvelope();
391 m_ModulesPhys->add(
new GeoNameTag(
"LAr"));
392 m_ModulesPhys->add(
new GeoTransform(trans) );
393 m_ModulesPhys->add(
new GeoTransform( pos3Emec * MrotEmec ));
394 m_ModulesPhys->add(emecEnvelope);
399 if((!m_Options) || m_Options->isHec()){
417 m_ModulesPhys->add(
new GeoTransform(trans));
418 m_ModulesPhys->add(
new GeoTransform(GeoTrf::Translate3D((bepo_x - bepo_y_hecshift)/2./
sin(bepo_tz_e)
419 , (bepo_x + bepo_y_hecshift)/2./
sin(bepo_tz_e)
420 , HECzStart-EMECzStart)) );
421 m_ModulesPhys->add(hecEnvelope);
428 if((!m_Options) || m_Options->isFcal()){
440 m_ModulesPhys->add(
new GeoTransform(trans));
441 m_ModulesPhys->add(
new GeoTransform(GeoTrf::Translate3D(9.*
Gaudi::Units::mm
443 ,FCALzStart-EMECzStart+(FCALzEnd-FCALzStart)/2.)) );
444 m_ModulesPhys->add(fcalEnvelope);
449 if((!m_Options) || m_Options->isColdnose()){
473 GeoBox* Box1 =
new GeoBox(box_x, box_y, box_z);
474 double alpha = acos(box_x/tub_r);
475 double ax =
M_PI - 2*alpha;
476 GeoTubs* Tub=
new GeoTubs(0., tub_r, box_z, alpha,
ax);
479 GeoTrf::Translate3D TubTrans(0.,btot-box_y-tub_r,0.);
480 const GeoShapeUnion &uSolid = (*Box1).add((*Tub)<<TubTrans);
482 GeoTubs* Tub1 =
new GeoTubs(tub_r, tub_r+tub1_dr, tub1_z, alpha,
ax);
487 const GeoShapeUnion &uSolid2 = uSolid.add((*Tub1)<<UnTrans);
489 GeoCons* Cone =
new GeoCons(cyl_r2, cyl_r1, cyl_r2+cyl_dr, cyl_r1+cyl_dr, cyl_z,
M_PI/4.,
M_PI/2.);
496 const GeoShapeUnion &uSolid3 = uSolid2.add((*Cone)<<CylTrans);
498 GeoLogVol* Cnose =
new GeoLogVol(
"LArGeoTB::LeakageDet::ColdNose", &uSolid3 , Alu);
499 GeoIntrusivePtr<GeoPhysVol>PhysCnose =
new GeoPhysVol(Cnose);
506 m_ModulesPhys->add(
new GeoTransform(trans) ) ;
507 m_ModulesPhys->add(
new GeoTransform(CTrans));
508 m_ModulesPhys->add(PhysCnose);
529 return m_ModulesPhys;
535 if(calo<0 || calo >5)
return 0;
536 if(side<0 || side >1)
return 0;
540 if(calo<=2)
i=1;
else i=5-calo;
541 return 3*calo+
i+
side;
544 if(
side==1)
return 0;
545 if(calo==2)
return 10;
546 else if(calo==5)
return 18;
550 if(
side==1)
return 0;
551 if(calo==3 || calo==4)
return 0;
552 if(calo==5)
i=2;
else i=3;
573 const GeoMaterial* Vacuum = materialManager->
getMaterial(
"std::Vacuum");
574 if (!Vacuum)
throw std::runtime_error(
"Error in ModulesConstruction, std::Vacuum is not found.");
578 if(myID == 0 || myID >
NUM_LEAK)
return nullptr;
579 if(s_leakGeom.m_dX[myID-1] == 0 && s_leakGeom.m_dY[myID-1] == 0 && s_leakGeom.m_dZ[myID-1] == 0)
return nullptr;
580 name =
"LArGeoTB::LeakageDet::";
601 std::cerr <<
"Wrong calo for leakage !!" << std::endl;
615 std::cerr <<
"Wrong direction for leakage !!" << std::endl;
627 std::cerr <<
"Wrong side for leakage !!" << std::endl;
635 GeoLogVol *volume_log;
636 if(myID == 6 || myID == 9 || myID == 17) {
638 volume_log =
new GeoLogVol(
name,tub,Vacuum);
639 }
else if(myID == 3) {
641 volume_log =
new GeoLogVol(
name,tub,Vacuum);
642 #if 0 // impossible case...
643 }
else if(myID == 19) {
644 GeoTrd *trd =
new GeoTrd(s_leakGeom.m_dX[myID-1]-16.*
Gaudi::Units::cm,s_leakGeom.m_dX[myID-1],s_leakGeom.m_dY[myID-1],s_leakGeom.m_dY[myID-1],s_leakGeom.m_dZ[myID-1]);
645 volume_log =
new GeoLogVol(
name,trd,Vacuum);
648 GeoBox *mbox =
new GeoBox(s_leakGeom.m_dX[myID-1], s_leakGeom.m_dY[myID-1], s_leakGeom.m_dZ[myID-1]);
649 volume_log =
new GeoLogVol(
name,mbox,Vacuum);
660 std::cerr <<
"Error! First construct the leakage detector !!" << std::endl;
663 if(myID >
NUM_LEAK)
return leak_position;
665 GeoTrf::Transform3D rotM = GeoTrf::RotateX3D(s_leakGeom.m_angleX[myID-1]) * GeoTrf::RotateY3D(s_leakGeom.m_angleY[myID-1]) * GeoTrf::RotateZ3D(s_leakGeom.m_angleZ[myID-1]);
669 return leak_position;