ATLAS Offline Software
HECClampConstruction.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // HECClampConstruction.cxx 1.0.0
6 //
7 // GetClampingBar:
8 // Construct Outer Connecting Bars and Support Rails for the
9 // HEC Wheels (Front or Rear)
10 // AddClamps:
11 // Places the Bars and Rails on the HEC Wheel
12 //
13 // 25. Oct 2007 M. Fincke-Keeler
14 //
15 //====================================================================
18 
19 #include "GeoModelKernel/GeoElement.h"
20 #include "GeoModelKernel/GeoMaterial.h"
21 #include "GeoModelKernel/GeoFullPhysVol.h"
22 #include "GeoModelKernel/GeoPhysVol.h"
23 #include "GeoModelKernel/GeoVPhysVol.h"
24 #include "GeoModelKernel/GeoLogVol.h"
25 #include "GeoModelKernel/GeoPcon.h"
26 #include "GeoModelKernel/GeoTubs.h"
27 #include "GeoModelKernel/GeoNameTag.h"
28 #include "GeoModelKernel/GeoTransform.h"
29 #include "GeoModelKernel/GeoAlignableTransform.h"
30 #include "GeoModelKernel/GeoIdentifierTag.h"
31 #include "GeoModelKernel/GeoSerialTransformer.h"
32 #include "GeoModelKernel/GeoSerialIdentifier.h"
33 #include "GeoModelKernel/GeoXF.h"
34 #include "GeoModelKernel/GeoDefinitions.h"
35 #include "GeoGenericFunctions/Variable.h"
36 #include "StoreGate/StoreGateSvc.h"
38 #include "GaudiKernel/MsgStream.h"
39 #include "GaudiKernel/Bootstrap.h"
40 #include "GaudiKernel/SystemOfUnits.h"
42 
43 
48 
49 #include <string>
50 #include <cmath>
51 #include <iostream>
52 
53 using Gaudi::Units::cm;
54 using Gaudi::Units::mm;
55 using Gaudi::Units::deg;
56 using GeoTrf::RotateZ3D;
57 using GeoTrf::Translate3D;
58 using GeoTrf::TranslateZ3D;
59 
60 
61 //Constructor
63  : //m_rail(false),
64  //m_left(false),
65  m_moduleNumber(0),
66  m_moduleRouter(0),
67  m_modulePhistart(0),
68  m_rOuter(0),
69  m_moduleDeltaPhi(0)
70 {
71  m_front = front;
72  m_posZSide = posZSide;
73 }
74 
75 //~Destructor
77 = default;
78 
80 {
81 
82  ISvcLocator *svcLocator = Gaudi::svcLocator();
83 
84  MsgStream log(Athena::getMessageSvc(),"HECClampConstruction " );
85  log << MSG::DEBUG << " In HECClampConstruction " << endmsg;
86 
87 
89  if (svcLocator->service("DetectorStore", detStore, false )==StatusCode::FAILURE) {
90  throw std::runtime_error("Error in HECModuleConstruction(ClampBar), cannot access DetectorStore");
91  }
92 
93 
94  // Get access to the material manager:
95  StoredMaterialManager* materialManager = nullptr;
96  if (StatusCode::SUCCESS != detStore->retrieve(materialManager, std::string("MATERIALS"))) {
97  throw std::runtime_error("Error in HECModuleConstruction(ClampBar), cannot access Material Manager");
98  }
99  const GeoMaterial *LAr = materialManager->getMaterial("std::LiquidArgon");
100  if (!LAr) throw std::runtime_error("Error in HECModuleConstruction(ClampBar), std::LiquidArgon is not found.");
101  const GeoMaterial *Iron = materialManager->getMaterial("std::Iron");
102  if (!Iron) throw std::runtime_error("Error in HECModuleConstruction(ClampBar), std::Iron is not found.");
103 
104 
105  StatusCode sc;
106  IRDBAccessSvc *pAccessSvc;
107  sc=svcLocator->service("RDBAccessSvc",pAccessSvc);
108  if (sc != StatusCode::SUCCESS) {
109  throw std::runtime_error ("Cannot locate RDBAccessSvc!!");
110  }
111 
112  IGeoModelSvc *geoModel;
113  sc = svcLocator->service ("GeoModelSvc",geoModel);
114  if (sc != StatusCode::SUCCESS) {
115  throw std::runtime_error ("Cannot locate GeoModelSvc!!");
116  }
117 
118  std::string AtlasVersion = geoModel->atlasVersion();
119  std::string LArVersion = geoModel->LAr_VersionOverride();
120 
121  std::string detectorKey = LArVersion.empty() ? AtlasVersion : LArVersion;
122  std::string detectorNode = LArVersion.empty() ? "ATLAS" : "LAr";
123 
124  IRDBRecordset_ptr hecLongitudinalBlock = pAccessSvc->getRecordsetPtr("HecLongitudinalBlock",detectorKey, detectorNode);
125  IRDBRecordset_ptr hadronicEndcap = pAccessSvc->getRecordsetPtr("HadronicEndcap",detectorKey, detectorNode);
126 
127 
128  //----------------------------------------------------------------
129  // Collect all the numbers we need from the database:
130  //----------------------------------------------------------------
131  //
132  // NOT READY YET
133  //
134 
135  //----------------------------------------------------------------
136  // Add outer clamping bars for Atlas wheels
137  //----------------------------------------------------------------
138  // NB.: The outer clamping bars have notches for the HEC cables.
139  // that sit at different levels for Front/Rear Wheel
140  //
141  double shrinkCold = 1.0; // thermal expansion factor: 1.0 = warm
142 
143  int moduleNumber = (*hadronicEndcap)[0]->getInt("NSCT");
144  double moduleRouter = shrinkCold * (*hecLongitudinalBlock)[0]->getDouble("BLRMX")*cm;
145  double modulePhistart = 264.375*deg; // (270.-11.25/2.)*deg
146  double rOuter = shrinkCold * (*hecLongitudinalBlock)[0]->getDouble("BLRMX")*cm;
147  double moduleDeltaPhi = 2*M_PI/moduleNumber; //11.25*deg;
148  m_moduleNumber = moduleNumber;
149  m_moduleRouter = moduleRouter;
150  m_modulePhistart= modulePhistart;
151  m_rOuter = rOuter;
152  m_moduleDeltaPhi= moduleDeltaPhi ;
153 
154  std::string clampName = "LAr::HEC::Clamp";
155  std::string larName = "LAr::HEC::Clamp::LiquidArgon";
156  double g4allow = 0.01 *mm;
157  double extThick = shrinkCold * 37.*mm;
158  double extLength = shrinkCold * 84.*mm;
159  double clampWidth = shrinkCold * 147.0 *mm;
160  double clampThick = shrinkCold * 50.*mm;
161  double notchLevel = shrinkCold * 25.*mm;
162  double notchHeight = shrinkCold * 15.*mm;
163  // cppcheck-suppress duplicateAssignExpression
164  double notchWidth = shrinkCold * 20.*mm;
165  double slotWidth = shrinkCold * 20.*mm;
166  double clampLength = shrinkCold * 815.*mm;
167  double clampAngle = 2.* asin(clampWidth/(2.*(moduleRouter+clampThick/2.)));
168  double slotAngle = 2.* asin(notchWidth/(2.*(moduleRouter+clampThick/2.)));
169 
170  std::vector<double> notchLocation;
171  if (m_front){
172  if (!rail){
173 // notchLocation.push_back(shrinkCold * 201.*mm);
174 // notchLocation.push_back(shrinkCold * 469.*mm);
175 // notchLocation.push_back(shrinkCold * 737.*mm);
176  notchLocation.push_back(shrinkCold * 200.*mm); // adjust for shortened clamp
177  notchLocation.push_back(shrinkCold * 468.*mm);
178  notchLocation.push_back(shrinkCold * 736.*mm);
179  }
180  else {
181 // notchLocation.push_back(shrinkCold * 206.*mm);
182 // notchLocation.push_back(shrinkCold * 474.*mm);
183 // notchLocation.push_back(shrinkCold * 742.*mm);
184  notchLocation.push_back(shrinkCold * 201.*mm); // adjust for shortened rail
185  notchLocation.push_back(shrinkCold * 469.*mm);
186  notchLocation.push_back(shrinkCold * 737.*mm);
187  clampWidth = shrinkCold * 148.5 *mm;
188  clampThick = shrinkCold * 98.*mm; // 98.*mm (this is the total overall rail thickness)
189  clampLength = shrinkCold * 815.*mm;
190  }
191  }
192  else {
193  if (!rail){
194 // notchLocation.push_back(shrinkCold * 364.0*mm);
195 // notchLocation.push_back(shrinkCold * 832.0*mm);
196  notchLocation.push_back(shrinkCold * 363.0*mm); // adjust for shortened clamp
197  notchLocation.push_back(shrinkCold * 831.0*mm);
198  clampLength = shrinkCold * 960.*mm;
199  }
200  else {
201 // notchLocation.push_back(shrinkCold * 372.5*mm);
202 // notchLocation.push_back(shrinkCold * 840.5*mm);
203  notchLocation.push_back(shrinkCold * 364.*mm); // adjust for shortened rail
204  notchLocation.push_back(shrinkCold * 832.*mm);
205  clampWidth = shrinkCold * 148.5 *mm;
206  clampThick = shrinkCold * 98.*mm;
207  clampLength = shrinkCold * 960.*mm;
208  extLength = shrinkCold * 132.*mm;
209  }
210  notchWidth = shrinkCold * 16.*mm;
211  notchHeight = shrinkCold * 16.*mm;
212  notchLevel = shrinkCold * 0.*mm;
213  }
214 
215 
216 
217 
218  // Construct the the slots and notches here. For the support rails, they have to be inserted
219  // into the physExt[0] volume. For the regular clamps they go into physClamp.
220  std::array<GeoIntrusivePtr<GeoTubs>, 3> clampExt;
221  std::array<GeoIntrusivePtr<GeoLogVol>, 3> logExt;
222  std::array<GeoIntrusivePtr<GeoPhysVol>, 3> physExt;
223 
224  GeoIntrusivePtr<GeoTubs> Notch{new GeoTubs(moduleRouter+notchLevel+g4allow, moduleRouter+notchLevel+notchHeight-g4allow,
225  notchWidth/2.,
226  modulePhistart-(clampAngle/2.) , clampAngle)};
227  GeoIntrusivePtr<GeoLogVol> logNotch {new GeoLogVol(larName, Notch, LAr)};
228  GeoIntrusivePtr<GeoPhysVol> physiNotch{new GeoPhysVol(logNotch)};
229 
230  GeoIntrusivePtr<GeoTubs> Slot {new GeoTubs(moduleRouter+g4allow, moduleRouter+notchLevel-g4allow, slotWidth/2. ,
231  modulePhistart-(slotAngle/2.) , slotAngle)};
232  GeoIntrusivePtr<GeoLogVol> logSlot{new GeoLogVol(larName, Slot, LAr)};
233  GeoIntrusivePtr<GeoPhysVol> physiSlot{new GeoPhysVol(logSlot)};
234 
235 
236 
237  GeoIntrusivePtr<GeoTubs> clampBar{};
238  GeoIntrusivePtr<GeoLogVol> logClamp{};
239  GeoIntrusivePtr<GeoPhysVol> physClamp{};
240 
241  if(!rail){
242  clampBar = new GeoTubs(moduleRouter, moduleRouter+clampThick, clampLength/2. ,
243  modulePhistart-(clampAngle/2.) , clampAngle);
244  logClamp = new GeoLogVol(clampName, clampBar, Iron);
245  physClamp= new GeoPhysVol(logClamp);
246  }
247  else{
248 
249  //For the support rails, make the mother LAr and the place the steel inside:
250 
251  clampBar = new GeoTubs(moduleRouter, moduleRouter+clampThick, clampLength/2. ,
252  modulePhistart-(clampAngle/2.) , clampAngle);
253  logClamp = new GeoLogVol(larName, clampBar, LAr);
254  physClamp= new GeoPhysVol(logClamp);
255 
256 
257  clampExt[0] = new GeoTubs(moduleRouter+g4allow, moduleRouter+clampThick-extThick,
258  clampLength/2. , modulePhistart-(clampAngle/2.), clampAngle);
259  clampExt[1] = new GeoTubs(moduleRouter+clampThick-extThick+g4allow, moduleRouter+clampThick-g4allow,
260  clampLength/2. , modulePhistart, clampAngle/2.);
261  clampExt[2] = new GeoTubs(moduleRouter+clampThick-extThick+g4allow, moduleRouter+clampThick-g4allow,
262  extLength/2. , modulePhistart, clampAngle/2.);
263 
264 
265 
266 
267  for (int iext=0; iext<3; iext++){
268 
269  logExt[iext] = new GeoLogVol(clampName, clampExt[iext], Iron);
270  physExt[iext]= new GeoPhysVol(logExt[iext]);
271 
272 
273  if (iext==0) {
274  for ( unsigned int i = 0; i < notchLocation.size(); i++ )
275  {
276  physExt[0]->add( new GeoIdentifierTag(i) );
277  physExt[0]->add( new GeoTransform(Translate3D(0,0,-clampLength/2.+notchLocation[i])) );
278  physExt[0]->add( physiNotch );
279  if (m_front){
280  physExt[0]->add( new GeoIdentifierTag(i) );
281  physExt[0]->add( new GeoTransform(Translate3D(0,0,-clampLength/2.+notchLocation[i])) );
282  physExt[0]->add( physiSlot );
283  }
284  }
285  }
286 
287 
288  if (iext==1 && !left) physClamp->add(new GeoTransform(RotateZ3D(-clampAngle/2.)));
289  else if(iext==2 && left) physClamp->add(new GeoTransform(TranslateZ3D((clampLength-extLength)/2.)
290  *RotateZ3D(-clampAngle/2.)));
291  else if(iext==2) physClamp->add(new GeoTransform(TranslateZ3D((clampLength-extLength)/2.)
292  *RotateZ3D( 0.)));
293 
294  if (left) physClamp->add( new GeoIdentifierTag(16) );
295  else physClamp->add( new GeoIdentifierTag(32) );
296 
297 
298  physClamp->add(physExt[iext]);
299 
300  }
301 
302 
303  }
304 
305 
306  for ( unsigned int i = 0; i < notchLocation.size(); i++ )
307  {
308  if(!rail){
309  physClamp->add( new GeoIdentifierTag(i) );
310  physClamp->add( new GeoTransform(Translate3D(0,0,-clampLength/2.+notchLocation[i])) );
311  physClamp->add( physiNotch );
312  }
313  }
314 
315  if(m_front)
316  {
317  for ( unsigned int i = 0; i < notchLocation.size(); i++ )
318  {
319  if(!rail){
320  physClamp->add( new GeoIdentifierTag(i) );
321  physClamp->add( new GeoTransform(Translate3D(0,0,-clampLength/2.+notchLocation[i])) );
322  physClamp->add( physiSlot );
323  }
324  }
325 
326  }
327 
328 
329  return physClamp;
330 }
331 
332 
333 
334 void LArGeo::HECClampConstruction::AddClamps(GeoIntrusivePtr<GeoFullPhysVol> physiHECWheel)
335 {
336  //----------------------------------------------------------------
337  // Add Outer Connecting Bars to HEC Wheel
338  //----------------------------------------------------------------
339 
340  double shrinkCold = 1.0 ; // thermal expansion factor: 1.0 = warm
341 
342  std::string clampName = "LAr::HEC::Clamp";
343  std::string larName = "LAr::HEC::Clamp::LiquidArgon";
344  // cppcheck-suppress duplicateAssignExpression
345  double clampLength = shrinkCold * 815.*mm;
346  double railLength = shrinkCold * 815.*mm;
347  double railOffset = shrinkCold * 0.*mm;
348  if (!m_front) {
349  clampLength = shrinkCold * 960.*mm;
350  railLength = shrinkCold * 960.*mm;
351  railOffset = shrinkCold * 0.*mm;
352  }
353 
354  GeoIntrusivePtr<GeoVPhysVol> clampingBar = GetClampingBar(false,false);
355  GeoIntrusivePtr<GeoVPhysVol> clampingRailR = GetClampingBar(true,false);
356  GeoIntrusivePtr<GeoVPhysVol> clampingRailL = GetClampingBar(true,true);
357 
358 
359 
360  // In the below positioning sequence, the ORDER MATTERS!
361  //
362 
363  GeoIntrusivePtr<GeoTransform> xt{new GeoTransform(TranslateZ3D(clampLength/2.))};
364  physiHECWheel->add(xt);
365 
366  GeoIntrusivePtr<GeoSerialIdentifier> sIC{new GeoSerialIdentifier(0)};
367  GeoGenfun::Variable IndexC;
368 
369  if (m_posZSide)
370  {
371  GeoGenfun::GENFUNCTION ModuleRotationAngleC = -m_modulePhistart+m_moduleDeltaPhi + m_moduleDeltaPhi*IndexC;
372  GeoXF::TRANSFUNCTION tC = GeoXF::Pow(RotateZ3D(1.0),ModuleRotationAngleC);
373  GeoIntrusivePtr<GeoSerialTransformer> sTC{new GeoSerialTransformer (clampingBar,&tC,((m_moduleNumber/2)-1))};
374  physiHECWheel->add(sIC);
375  physiHECWheel->add(sTC);
376  }
377  else
378  {
379  GeoGenfun::GENFUNCTION ModuleRotationAngleC = -m_modulePhistart-m_moduleDeltaPhi+180*deg - m_moduleDeltaPhi*IndexC;
380  GeoXF::TRANSFUNCTION tC = GeoXF::Pow(RotateZ3D(1.0),ModuleRotationAngleC);
381  GeoIntrusivePtr<GeoSerialTransformer> sTC{new GeoSerialTransformer (clampingBar,&tC,((m_moduleNumber/2)-1))};
382  physiHECWheel->add(sIC);
383  physiHECWheel->add(sTC);
384  }
385 
386 
387  physiHECWheel->add(new GeoTransform(TranslateZ3D(railLength/2.-railOffset)*RotateZ3D(-m_modulePhistart-(180.*deg))));
388  //GeoSerialIdentifier *sIR = new GeoSerialIdentifier(15); // For the pos z-side this is the position of module no.15
389  //physiHECWheel->add(sIR); // No need to aplly it if we position clamps in this order
391  if (!m_posZSide)
392  {
393  GeoSerialIdentifier *sIR = new GeoSerialIdentifier(31);
394  physiHECWheel->add(sIR);
395  }
396  physiHECWheel->add(clampingRailL);
397 
398 
399  physiHECWheel->add(xt);
400  GeoGenfun::Variable IndexC2;
401 
402  if (m_posZSide)
403  {
404  GeoGenfun::GENFUNCTION ModuleRotationAngleC2 = -m_modulePhistart+m_moduleDeltaPhi-(180.*deg) + m_moduleDeltaPhi*IndexC2;
405  GeoXF::TRANSFUNCTION tC2 = GeoXF::Pow(RotateZ3D(1.0),ModuleRotationAngleC2);
406  GeoIntrusivePtr<GeoSerialTransformer> sTC2{new GeoSerialTransformer (clampingBar,&tC2,((m_moduleNumber/2)-1))};
407  physiHECWheel->add(sTC2);
408  }
409  else
410  {
411  GeoGenfun::GENFUNCTION ModuleRotationAngleC2 = -m_modulePhistart-m_moduleDeltaPhi - m_moduleDeltaPhi*IndexC2;
412  GeoXF::TRANSFUNCTION tC2 = GeoXF::Pow(RotateZ3D(1.0),ModuleRotationAngleC2);
413  GeoIntrusivePtr<GeoSerialTransformer> sTC2{new GeoSerialTransformer (clampingBar,&tC2,((m_moduleNumber/2)-1))};
414  physiHECWheel->add(sTC2);
415  }
416 
417  physiHECWheel->add(new GeoTransform(TranslateZ3D(railLength/2.)*RotateZ3D(-m_modulePhistart)));
418  if (!m_posZSide)
419  {
420  GeoSerialIdentifier *sIR = new GeoSerialIdentifier(15);
421  physiHECWheel->add(sIR);
422  }
423  physiHECWheel->add(clampingRailR);
424 
425 }
426 
427 
428 
getMessageSvc.h
singleton-like access to IMessageSvc via open function and helper
IRDBAccessSvc::getRecordsetPtr
virtual IRDBRecordset_ptr getRecordsetPtr(const std::string &node, const std::string &tag, const std::string &tag2node="", const std::string &connName="ATLASDD")=0
Provides access to the Recordset object containing HVS-tagged data.
IGeoModelSvc
Definition: IGeoModelSvc.h:17
LArGeo::HECClampConstruction::AddClamps
void AddClamps(GeoIntrusivePtr< GeoFullPhysVol > physiHECWheel)
Definition: HECClampConstruction.cxx:334
LAr
Definition: LArVolumeBuilder.h:36
LArGeo::HECClampConstruction::~HECClampConstruction
virtual ~HECClampConstruction()
LArGeo::HECClampConstruction::HECClampConstruction
HECClampConstruction(bool front=true, bool posZSide=true)
Definition: HECClampConstruction.cxx:62
M_PI
#define M_PI
Definition: ActiveFraction.h:11
deg
#define deg
Definition: SbPolyhedron.cxx:17
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
cm
const double cm
Definition: Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/FCAL_ChannelMap.cxx:25
IGeoModelSvc::LAr_VersionOverride
virtual const std::string & LAr_VersionOverride() const =0
StoreGateSvc
The Athena Transient Store API.
Definition: StoreGateSvc.h:128
xt
#define xt
EventInfoWrite.AtlasVersion
AtlasVersion
Definition: EventInfoWrite.py:17
IRDBAccessSvc.h
Definition of the abstract IRDBAccessSvc interface.
lumiFormat.i
int i
Definition: lumiFormat.py:92
IRDBAccessSvc
IRDBAccessSvc is an abstract interface to the athena service that provides the following functionalit...
Definition: IRDBAccessSvc.h:45
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
HECClampConstruction.h
LArGeo::HECClampConstruction::GetClampingBar
PVLink GetClampingBar(bool rail=false, bool left=false)
Definition: HECClampConstruction.cxx:79
IRDBRecordset_ptr
std::shared_ptr< IRDBRecordset > IRDBRecordset_ptr
Definition: IRDBAccessSvc.h:25
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
LArGeo::HECClampConstruction::m_front
bool m_front
Definition: HECClampConstruction.h:32
StoredMaterialManager.h
LArGeo::HECClampConstruction::m_posZSide
bool m_posZSide
Definition: HECClampConstruction.h:35
python.SystemOfUnits.mm
int mm
Definition: SystemOfUnits.py:83
HECModuleConstruction.h
Declaration of HECModuleConstruction class.
IRDBRecord.h
Definition of the abstract IRDBRecord interface.
DEBUG
#define DEBUG
Definition: page_access.h:11
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
StoredMaterialManager::getMaterial
virtual const GeoMaterial * getMaterial(const std::string &name)=0
StoredMaterialManager
This class holds one or more material managers and makes them storeable, under StoreGate.
Definition: StoredMaterialManager.h:28
IRDBRecordset.h
Definition of the abstract IRDBRecordset interface.
IGeoModelSvc::atlasVersion
virtual const std::string & atlasVersion() const =0
IGeoModelSvc.h
StoreGateSvc.h