31 #include "GeoModelKernel/GeoElement.h"   
   32 #include "GeoModelKernel/GeoMaterial.h"   
   33 #include "GeoModelKernel/GeoFullPhysVol.h"   
   34 #include "GeoModelKernel/GeoPhysVol.h"   
   35 #include "GeoModelKernel/GeoVPhysVol.h"   
   36 #include "GeoModelKernel/GeoLogVol.h"   
   37 #include "GeoModelKernel/GeoPcon.h"   
   38 #include "GeoModelKernel/GeoTubs.h"   
   39 #include "GeoModelKernel/GeoNameTag.h"   
   40 #include "GeoModelKernel/GeoTransform.h"   
   41 #include "GeoModelKernel/GeoAlignableTransform.h"   
   42 #include "GeoModelKernel/GeoIdentifierTag.h"   
   43 #include "GeoModelKernel/GeoSerialTransformer.h" 
   44 #include "GeoModelKernel/GeoSerialIdentifier.h" 
   45 #include "GeoModelKernel/GeoXF.h" 
   46 #include "GeoModelKernel/GeoDefinitions.h" 
   47 #include "GeoGenericFunctions/Variable.h" 
   52 #include "GaudiKernel/MsgStream.h" 
   53 #include "GaudiKernel/Bootstrap.h" 
   54 #include "GaudiKernel/SystemOfUnits.h" 
   72 using GeoTrf::Translate3D;
 
   81   ISvcLocator *svcLocator = Gaudi::svcLocator();
 
   93   SmartIF<StoreGateSvc> 
detStore{svcLocator->service(
"DetectorStore")};
 
   95     throw std::runtime_error(
"Error in HEC2WheelConstruction, cannot access DetectorStore");
 
   99   if (StatusCode::SUCCESS != 
detStore->retrieve(materialManager, std::string(
"MATERIALS"))) {
 
  100     throw std::runtime_error(
"Error in HEC2WheelConstruction, cannot access Material Manager");
 
  103   SmartIF<IRDBAccessSvc> pAccessSvc{svcLocator->service(
"RDBAccessSvc")};
 
  104   if(!pAccessSvc.isValid()) {
 
  105     throw std::runtime_error (
"Cannot locate RDBAccessSvc!!");
 
  108   SmartIF<IGeoModelSvc> geoModel{svcLocator->service(
"GeoModelSvc")};
 
  109   if(!geoModel.isValid()) {
 
  110     throw std::runtime_error (
"Cannot locate GeoModelSvc!!");
 
  114   std::string LArVersion = geoModel->LAr_VersionOverride();
 
  115   std::string detectorKey  = LArVersion.empty() ? 
AtlasVersion : LArVersion;
 
  116   std::string detectorNode = LArVersion.empty() ? 
"ATLAS" : 
"LAr";
 
  118   IRDBRecordset_ptr hadronicEndcap = pAccessSvc->getRecordsetPtr(
"HadronicEndcap",detectorKey, detectorNode); 
 
  119   if(hadronicEndcap->size()>0)
 
  120     log << 
MSG::ALWAYS << 
"Using numbers from HadronicEndcap tag:  " << hadronicEndcap->tagName() << 
endmsg;
 
  122     throw std::runtime_error(
"Error in HECConstruction:  hadronicEendcap not found");
 
  124   IRDBRecordset_ptr hecLongitudinalBlock = pAccessSvc->getRecordsetPtr(
"HecLongitudinalBlock",detectorKey, detectorNode); 
 
  125   if(hecLongitudinalBlock->size()>0) 
 
  126     log << 
MSG::ALWAYS << 
"Using numbers from HecLongitudinalBlock tag:  " << hecLongitudinalBlock->tagName() << 
endmsg;
 
  128     throw std::runtime_error(
"Error in HECConstruction:  hecLongitudinalBlock not found");
 
  130   IRDBRecordset_ptr larPosition  =  pAccessSvc->getRecordsetPtr(
"LArPosition",detectorKey, detectorNode);
 
  131   if (larPosition->size()==0 ) {
 
  132     larPosition = pAccessSvc->getRecordsetPtr(
"LArPosition", 
"LArPosition-00");
 
  133     if (larPosition->size()==0 ) {
 
  134       throw std::runtime_error(
"Error, no lar position table in database!");
 
  139   double shrinkCold            = 1.0 ; 
 
  141   double rInner1               = shrinkCold * (*hecLongitudinalBlock)[0]->getDouble(
"BLRMN")*
cm;
 
  142   double rInner2               = shrinkCold * (*hecLongitudinalBlock)[1]->getDouble(
"BLRMN")*
cm;
 
  143   double rOuter                = shrinkCold * (*hecLongitudinalBlock)[0]->getDouble(
"BLRMX")*
cm;
 
  144   double wheelGap              = shrinkCold * (*hadronicEndcap)[0]->getDouble(
"GAPWHL")*
cm;
 
  147   const GeoMaterial *
LAr  = materialManager->
getMaterial(
"std::LiquidArgon");
 
  148   if (!
LAr) 
throw std::runtime_error(
"Error in HEC2WheelConstruction, std::LiquidArgon is not found.");
 
  151   const GeoLogVol*   logicHEC;     
 
  152   GeoIntrusivePtr<GeoFullPhysVol>    physiHEC;     
 
  158   if (rOuter<2100.*
mm) rOuter  = shrinkCold *2130*
mm;  
 
  161   double     HEC1length = shrinkCold * 816.5*
mm;
 
  162   double     HEC2length = shrinkCold * 961.0*
mm;
 
  163   double     TotalWarmHEC = HEC1length + wheelGap + HEC2length ;  
 
  164   double     TotalHECLength = TotalWarmHEC;                      
 
  166   double     zCoordinate[4];
 
  167   zCoordinate[0]=shrinkCold * 0.0*
cm; 
 
  168   zCoordinate[1]=shrinkCold * 28.05*
cm; 
 
  169   zCoordinate[2]=shrinkCold * 28.051*
cm; 
 
  170   zCoordinate[3]=shrinkCold * (181.9*
cm+4.0*
mm); 
 
  173   solidHEC = 
new GeoPcon(0., 2.*
M_PI);
 
  174   for (
int i=0; 
i< 4; 
i++) 
 
  176       if (
i<2) solidHEC->addPlane(zCoordinate[
i],rInner1 - shrinkCold*1.*
mm,rOuter);
 
  177       else     solidHEC->addPlane(zCoordinate[
i],rInner2 - shrinkCold*1.*
mm,rOuter);
 
  180   std::string hecName = 
"LAr::HEC::Mother";
 
  181   logicHEC = 
new GeoLogVol(hecName, solidHEC , 
LAr);
 
  182   physiHEC = 
new GeoFullPhysVol(logicHEC);
 
  188   GeoAlignableTransform *xfHec1 = 
new GeoAlignableTransform(xfPosHec1);
 
  190   std::string 
tag1 = 
m_posZSide? std::string(
"HEC1_POS") : std::string(
"HEC1_NEG");
 
  193   GeoIntrusivePtr<GeoFullPhysVol> EnvelopeF = theFrontHEC.
GetEnvelope();
 
  197   if(!
sc.isSuccess()) 
throw std::runtime_error ((std::string(
"Cannot store")+
tag1).c_str());
 
  201   if(!
sc.isSuccess()) 
throw std::runtime_error ((std::string(
"Cannot store")+
tag1).c_str());
 
  203   physiHEC->add(xfHec1);
 
  204   physiHEC->add(
new GeoIdentifierTag(0));
 
  205   physiHEC->add(EnvelopeF);
 
  209   double Zpos = TotalHECLength - HEC2length  ;  
 
  214   GeoAlignableTransform *xfHec2 = 
new GeoAlignableTransform(xfPosHec2);
 
  216   std::string 
tag2 = 
m_posZSide? std::string(
"HEC2_POS") : std::string(
"HEC2_NEG");
 
  219   GeoIntrusivePtr<GeoFullPhysVol> EnvelopeR = theRearHEC.
GetEnvelope();
 
  223   if(!
sc.isSuccess()) 
throw std::runtime_error ((std::string(
"Cannot store")+
tag2).c_str());
 
  227   if(!
sc.isSuccess()) 
throw std::runtime_error ((std::string(
"Cannot store")+
tag2).c_str());
 
  229   physiHEC->add(xfHec2);
 
  230   physiHEC->add(
new GeoIdentifierTag(1));
 
  231   physiHEC->add(EnvelopeR);