ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | List of all members
LArGeo::FCALConstruction Class Reference

#include <FCALConstruction.h>

Collaboration diagram for LArGeo::FCALConstruction:

Public Member Functions

 FCALConstruction ()
 
virtual ~FCALConstruction ()
 
GeoIntrusivePtr< GeoVFullPhysVol > GetEnvelope (bool bPos)
 
void setFCALVisLimit (int maxCell)
 
void setFullGeo (bool flag)
 

Private Member Functions

 FCALConstruction (const FCALConstruction &)
 
FCALConstructionoperator= (const FCALConstruction &)
 

Private Attributes

GeoIntrusivePtr< GeoFullPhysVol > m_fcalPhysical
 
GeoIntrusivePtr< GeoFullPhysVol > m_absPhysical1 {}
 
GeoIntrusivePtr< GeoFullPhysVol > m_absPhysical2 {}
 
GeoIntrusivePtr< GeoFullPhysVol > m_absPhysical3 {}
 
int m_VisLimit
 
ISvcLocator * m_svcLocator
 
IRDBRecordset_ptr m_fcalMod
 
IRDBRecordset_ptr m_LArPosition
 
bool m_fullGeo
 

Detailed Description

Definition at line 25 of file FCALConstruction.h.

Constructor & Destructor Documentation

◆ FCALConstruction() [1/2]

FCALConstruction::FCALConstruction ( )

Definition at line 57 of file FCALConstruction.cxx.

58  : m_fcalPhysical(nullptr)
59  , m_absPhysical1(nullptr)
60  , m_absPhysical2(nullptr)
61  , m_absPhysical3(nullptr)
62  , m_VisLimit(0)
63  , m_svcLocator(nullptr)
64  , m_fullGeo(true)
65 {
66 }

◆ ~FCALConstruction()

FCALConstruction::~FCALConstruction ( )
virtualdefault

◆ FCALConstruction() [2/2]

LArGeo::FCALConstruction::FCALConstruction ( const FCALConstruction )
private

Member Function Documentation

◆ GetEnvelope()

GeoIntrusivePtr< GeoVFullPhysVol > FCALConstruction::GetEnvelope ( bool  bPos)

Gabe: New add_tube

Gabe: New add_tube

Gabe: New add_tube

Definition at line 76 of file FCALConstruction.cxx.

77 {
78  IRDBAccessSvc* rdbAccess{nullptr};
79  IGeoModelSvc * geoModel{nullptr};
80 
81 
82  if(!m_absPhysical1) {
83  // Access Geometry DB
84  m_svcLocator = Gaudi::svcLocator();
85 
86  if(m_svcLocator->service ("GeoModelSvc",geoModel) == StatusCode::FAILURE)
87  throw std::runtime_error("Error in FCALConstruction, cannot access GeoModelSvc");
88  if(m_svcLocator->service ("RDBAccessSvc",rdbAccess) == StatusCode::FAILURE)
89  throw std::runtime_error("Error in FCALConstruction, cannot access RDBAccessSvc");
90  DecodeVersionKey larVersionKey(geoModel, "LAr");
91 
92  m_fcalMod = rdbAccess->getRecordsetPtr("FCalMod", larVersionKey.tag(),larVersionKey.node());
93  if (m_fcalMod->size()==0) {
94  m_fcalMod=rdbAccess->getRecordsetPtr("FCalMod", "FCalMod-00");
95  if (m_fcalMod->size()==0) {
96  throw std::runtime_error("Error getting FCAL Module parameters from database");
97  }
98  }
99 
100  m_LArPosition = rdbAccess->getRecordsetPtr("LArPosition", larVersionKey.tag(), larVersionKey.node());
101  if (m_LArPosition->size()==0 ) {
102  m_LArPosition = rdbAccess->getRecordsetPtr("LArPosition", "LArPosition-00");
103  if (m_LArPosition->size()==0 ) {
104  throw std::runtime_error("Error, no lar position table in database!");
105  }
106  }
107 
108  }
109 
110  // Flags to turn on volumes.
111  const bool F1=true,F2=true,F3=true;
112 
114  if (m_svcLocator->service("DetectorStore", detStore, false )==StatusCode::FAILURE) {
115  throw std::runtime_error("Error in FCALConstruction, cannot access DetectorStore");
116  }
117 
118  StoredMaterialManager* materialManager = nullptr;
119  if (StatusCode::SUCCESS != detStore->retrieve(materialManager, std::string("MATERIALS"))) return nullptr;
120 
121  const GeoMaterial *Copper = materialManager->getMaterial("std::Copper");
122  if (!Copper) throw std::runtime_error("Error in FCALConstruction, std::Copper is not found.");
123 
124  const GeoMaterial *Iron = materialManager->getMaterial("std::Iron");
125  if (!Iron) throw std::runtime_error("Error in FCALConstruction, std::Iron is not found.");
126 
127  const GeoMaterial *Lead = materialManager->getMaterial("std::Lead");
128  if (!Lead) throw std::runtime_error("Error in FCALConstruction, std::Lead is not found.");
129 
130  const GeoMaterial *LAr = materialManager->getMaterial("std::LiquidArgon");
131  if (!LAr) throw std::runtime_error("Error in FCALConstruction, std::LiquidArgon is not found.");
132 
133  const GeoMaterial *Air = materialManager->getMaterial("std::Air");
134  if (!Air) throw std::runtime_error("Error in FCALConstruction, std::Air is not found.");
135 
136  const GeoMaterial *Kapton = materialManager->getMaterial("std::Kapton");
137  if (!Kapton) throw std::runtime_error("Error in FCALConstruction, std::Kapton is not found.");
138 
139  const GeoMaterial *Glue = materialManager->getMaterial("LAr::Glue");
140  if (!Glue) throw std::runtime_error("Error in FCALConstruction, LAr::Glue is not found.");
141 
142  const GeoMaterial *G10 = materialManager->getMaterial("LAr::G10");
143  if (!G10) throw std::runtime_error("Error in FCALConstruction, LAr::G10 is not found.");
144 
145 
146  const GeoMaterial *FCal1Absorber = materialManager->getMaterial("LAr::FCal1Absorber");
147  if (!FCal1Absorber) throw std::runtime_error("Error in FCALConstruction, LAr::FCal1Absorber is not found.");
148 
149  const GeoMaterial *FCal23Absorber = materialManager->getMaterial("LAr::FCal23Absorber");
150  if (!FCal23Absorber) throw std::runtime_error("Error in FCALConstruction, LAr::FCal23Absorber is not found.");
151 
152  const GeoMaterial *FCalCableHarness = materialManager->getMaterial("LAr::FCalCableHarness");
153  if (!FCalCableHarness) throw std::runtime_error("Error in FCALConstruction, LAr::FCalCableHarness is not found.");
154 
155  const GeoMaterial *FCal23Slugs = materialManager->getMaterial("LAr::FCal23Slugs");
156  if (!FCal23Slugs) throw std::runtime_error("Error in FCALConstruction, LAr::FCal23Slugs is not found.");
157 
158 
159  auto cmap = std::make_unique<FCAL_ChannelMap>(0);
160 
161  GeoIntrusivePtr<GeoFullPhysVol> fcalPhysical{nullptr};
162 
163  std::string baseName = "LAr::FCAL::";
164 
165  double startZFCal1 = (*m_fcalMod)[0]->getDouble("STARTPOSITION"); //466.85 * cm;
166  //double startZFCal2 = (*m_fcalMod)[1]->getDouble("STARTPOSITION"); //512.83 * cm;
167  double startZFCal3 = (*m_fcalMod)[2]->getDouble("STARTPOSITION"); //560.28 * cm;
168 
169  double outerModuleRadius1=(*m_fcalMod)[0]->getDouble("OUTERMODULERADIUS");
170  double outerModuleRadius2=(*m_fcalMod)[1]->getDouble("OUTERMODULERADIUS");
171  double outerModuleRadius3=(*m_fcalMod)[2]->getDouble("OUTERMODULERADIUS");
172  double innerModuleRadius1=(*m_fcalMod)[0]->getDouble("INNERMODULERADIUS");
173  double innerModuleRadius2=(*m_fcalMod)[1]->getDouble("INNERMODULERADIUS");
174  double innerModuleRadius3=(*m_fcalMod)[2]->getDouble("INNERMODULERADIUS");
175  double fullModuleDepth1=(*m_fcalMod)[0]->getDouble("FULLMODULEDEPTH");
176  double fullModuleDepth2=(*m_fcalMod)[1]->getDouble("FULLMODULEDEPTH");
177  double fullModuleDepth3=(*m_fcalMod)[2]->getDouble("FULLMODULEDEPTH");
178  double fullGapDepth1=(*m_fcalMod)[0]->getDouble("FULLGAPDEPTH");
179  double fullGapDepth2=(*m_fcalMod)[1]->getDouble("FULLGAPDEPTH");
180  double fullGapDepth3=(*m_fcalMod)[2]->getDouble("FULLGAPDEPTH");
181  double outerGapRadius1=(*m_fcalMod)[0]->getDouble("OUTERGAPRADIUS");
182  double outerGapRadius2=(*m_fcalMod)[1]->getDouble("OUTERGAPRADIUS");
183  double outerGapRadius3=(*m_fcalMod)[2]->getDouble("OUTERGAPRADIUS");
184  double innerGapRadius1=(*m_fcalMod)[0]->getDouble("INNERGAPRADIUS");
185  double innerGapRadius2=(*m_fcalMod)[1]->getDouble("INNERGAPRADIUS");
186  double innerGapRadius3=(*m_fcalMod)[2]->getDouble("INNERGAPRADIUS");
187 
188 
189  // FCAL VOLUME. IT DOES NOT INCLUDE THE COPPER PLUG, ONLY THE LAR AND MODS 1-3
190  {
191 
192  double outerRadius = std::max(outerModuleRadius1,std::max(outerModuleRadius2,outerModuleRadius3));
193  double innerRadius = std::min(innerModuleRadius1,std::min(innerModuleRadius2,innerModuleRadius3));
194  double depthZFCal3 = fullModuleDepth3;
195  double stopZFCal3 = startZFCal3 + depthZFCal3;
196 
197  double totalDepth = stopZFCal3 - startZFCal1;
198  double halfDepth = totalDepth/2.;
199 
200  std::string name = baseName + "LiquidArgonC";
201  GeoTubs *tubs = new GeoTubs(innerRadius,outerRadius,halfDepth,0,360*Gaudi::Units::deg);
202  GeoLogVol *logVol= new GeoLogVol(name, tubs, LAr);
203  fcalPhysical = new GeoFullPhysVol(logVol);
204  }
205 
206 
207 
208  if (F1)
209  {
210 
211  // Module 1
212  GeoIntrusivePtr<GeoFullPhysVol> modPhysical{nullptr};
213  {
214  double halfDepth = fullModuleDepth1/2;
215  double innerRadius = innerModuleRadius1;
216  double outerRadius = outerModuleRadius1;
217  GeoIntrusivePtr<GeoFullPhysVol>physVol;
218 
219  if(m_absPhysical1) {
220  physVol = m_absPhysical1->clone();
221  }
222  else {
223  GeoTubs *tubs = new GeoTubs( innerRadius, outerRadius, halfDepth, 0, 2*M_PI);
224  GeoLogVol *logVol = new GeoLogVol(baseName + "Module1::Absorber", tubs, FCal1Absorber);
225  physVol = new GeoFullPhysVol(logVol);
226  }
227 
228  // Alignable transform
229 
230  const IRDBRecord *posRec = GeoDBUtils::getTransformRecord(m_LArPosition, bPos ? "FCAL1_POS":"FCAL1_NEG");
231  if (!posRec) throw std::runtime_error("Error, no lar position record in the database") ;
233  GeoAlignableTransform *xfAbs1 = new GeoAlignableTransform(xfPos);
234 
235  fcalPhysical->add(xfAbs1);
236  if (!bPos) fcalPhysical->add(new GeoTransform(GeoTrf::RotateY3D(180*Gaudi::Units::deg)));
237  fcalPhysical->add(physVol);
238  modPhysical = physVol;
239 
240  std::string tag = bPos? std::string("FCAL1_POS") : std::string("FCAL1_NEG");
242 
243  StoredPhysVol *sPhysVol = new StoredPhysVol(physVol);
244  status=detStore->record(sPhysVol,tag);
245  if(!status.isSuccess()) throw std::runtime_error ((std::string("Cannot store")+tag).c_str());
246 
247  StoredAlignX *sAlignX = new StoredAlignX(xfAbs1);
248  status=detStore->record(sAlignX,tag);
249  if(!status.isSuccess()) throw std::runtime_error ((std::string("Cannot store")+tag).c_str());
250 
251  }
252  // 16 Troughs representing Cable Harnesses:
253  if(m_fullGeo && !m_absPhysical1) {
254  double troughDepth = 1.0 * Gaudi::Units::cm;
255  double outerRadius = outerModuleRadius1;
256  double innerRadius = outerRadius - troughDepth;
257  double halfLength = fullModuleDepth1/ 2.0;
258  double deltaPhi = 5.625 * Gaudi::Units::deg;
259  double startPhi = 11.25 * Gaudi::Units::deg - deltaPhi/2.0;
260  GeoTubs * tubs = new GeoTubs(innerRadius,outerRadius,halfLength,startPhi,deltaPhi );
261  GeoLogVol *logVol = new GeoLogVol(baseName+"Module1::CableTrough",tubs,FCalCableHarness);
262  GeoIntrusivePtr<GeoPhysVol>physVol = new GeoPhysVol(logVol);
263  GeoGenfun::Variable i;
264  GeoGenfun::GENFUNCTION rotationAngle = 22.5*Gaudi::Units::deg*i;
265  GeoXF::TRANSFUNCTION xf = GeoXF::Pow(GeoTrf::RotateZ3D(1.0),rotationAngle);
266  GeoSerialTransformer *st = new GeoSerialTransformer(physVol,&xf,16);
267  modPhysical->add(st);
268  }
269 
270  if(!m_absPhysical1) {
271  double halfDepth = fullGapDepth1/2.0;
272  double innerRadius = innerGapRadius1;
273  double outerRadius = outerGapRadius1;
274  GeoIntrusivePtr<GeoPhysVol>physVol{nullptr};
275  if(m_fullGeo) {
276  GeoTubs *tubs = new GeoTubs(innerRadius,outerRadius,halfDepth,0.0, 2.0*M_PI);
277  GeoLogVol *logVol = new GeoLogVol(baseName + "Module1::Gap",tubs, LAr);
278  physVol = new GeoPhysVol(logVol);
279  modPhysical->add(new GeoSerialIdentifier(0));
280  }
281 
282  int counter=0;
283  // Electrodes:
284  int myGroup=1;
285 
286  // Field names
287  unsigned fieldModNumber(2); //std::string fieldModNumber("LARFCALELECTRODES_DATA.MODNUMBER");
288  unsigned fieldTileName(1); //std::string fieldTileName("LARFCALELECTRODES_DATA.TILENAME");
289  unsigned fieldI(4); //std::string fieldI("LARFCALELECTRODES_DATA.I");
290  unsigned fieldJ(5); //std::string fieldJ("LARFCALELECTRODES_DATA.J");
291  unsigned fieldId(3); //std::string fieldId("LARFCALELECTRODES_DATA.ID");
292  unsigned fieldX(6); //std::string fieldX("LARFCALELECTRODES_DATA.X");
293  unsigned fieldY(7); //std::string fieldY("LARFCALELECTRODES_DATA.Y");
294  unsigned fieldHvFt(8); //std::string fieldHvFt("LARFCALELECTRODES_DATA.HVFEEDTHROUGHID");
295 
296  std::unique_ptr<IRDBQuery> query;
297  DecodeVersionKey larVersionKey(geoModel, "LAr");
298  query = rdbAccess->getQuery("LArFCalElectrodes", larVersionKey.tag(),larVersionKey.node());
299  if(!query) {
300  query = rdbAccess->getQuery("LArFCalElectrodes", "LArFCalElectrodes-00");
301  if(!query)
302  throw std::runtime_error("Error getting Session and Query pointers");
303  }
304  query->execute();
305  if(query->size()==0)
306  throw std::runtime_error("Error, unable to fetch fcal electrodes from the database!");
307 
308 
309  while(query->next()) {
310 
311  if(myGroup!=query->data<int>(fieldModNumber)) continue;
312 
313 // std::string thisTileStr=row["LARFCALELECTRODES_DATA.TILENAME"].data<std::string>();
314  int thisTubeI=query->data<int>(fieldI);
315  int thisTubeJ= query->data<int>(fieldJ);
316  int thisTubeID = query->data<int>(fieldId);
317  int thisTubeMod = myGroup;
318  double thisTubeX= query->data<double>(fieldX);
319  double thisTubeY= query->data<double>(fieldY);
320 // std::string thisHVft=row["LARFCALELECTRODES_DATA.HVFEEDTHROUGHID"].data<std::string>();
321 
322  cmap->add_tube(query->data<std::string>(fieldTileName),
323  thisTubeMod, thisTubeID, thisTubeI,thisTubeJ, thisTubeX, thisTubeY,
324  query->data<std::string>(fieldHvFt));
325 
326  if (m_VisLimit != -1 && (counter++ > m_VisLimit)) continue;
327  if(m_fullGeo) {
328  GeoTransform *xf = new GeoTransform(GeoTrf::Translate3D(thisTubeX*Gaudi::Units::cm, thisTubeY*Gaudi::Units::cm,0));
329  modPhysical->add(xf);
330  modPhysical->add(physVol);
331  }
332  }
333 
334  m_absPhysical1 = modPhysical;
335  query->finalize();
336  }
337  } // if (F1)
338  if (F2)
339  {
340  // Module 2
341  GeoIntrusivePtr<GeoFullPhysVol> modPhysical{nullptr};
342  {
343  double halfDepth = fullModuleDepth2/2;
344  double innerRadius = innerModuleRadius2;
345  double outerRadius = outerModuleRadius2;
346  GeoIntrusivePtr<GeoFullPhysVol>physVol;
347 
348  if(m_absPhysical2) {
349  physVol = m_absPhysical2->clone();
350  }
351  else {
352  GeoTubs *tubs = new GeoTubs( innerRadius, outerRadius, halfDepth, 0, 2*M_PI);
353  GeoLogVol *logVol = new GeoLogVol(baseName + "Module2::Absorber", tubs, FCal23Absorber);
354  physVol = new GeoFullPhysVol(logVol);
355  }
356 
357  // Alignable transform
358 
359  const IRDBRecord *posRec = GeoDBUtils::getTransformRecord(m_LArPosition, bPos ? "FCAL2_POS":"FCAL2_NEG");
360  if (!posRec) throw std::runtime_error("Error, no lar position record in the database") ;
362  GeoAlignableTransform *xfAbs2 = new GeoAlignableTransform(xfPos);
363 
364  fcalPhysical->add(xfAbs2);
365  if (!bPos) fcalPhysical->add(new GeoTransform(GeoTrf::RotateY3D(180*Gaudi::Units::deg)));
366  fcalPhysical->add(physVol);
367  modPhysical = physVol;
368 
369  std::string tag = bPos? std::string("FCAL2_POS") : std::string("FCAL2_NEG");
371 
372  StoredPhysVol *sPhysVol = new StoredPhysVol(physVol);
373  status=detStore->record(sPhysVol,tag);
374  if(!status.isSuccess()) throw std::runtime_error ((std::string("Cannot store")+tag).c_str());
375 
376  StoredAlignX *sAlignX = new StoredAlignX(xfAbs2);
377  status=detStore->record(sAlignX,tag);
378  if(!status.isSuccess()) throw std::runtime_error ((std::string("Cannot store")+tag).c_str());
379 
380  }
381  // 16 Troughs representing Cable Harnesses:
382  if(m_fullGeo && !m_absPhysical2) {
383  double troughDepth = 1.0 * Gaudi::Units::cm;
384  double outerRadius = outerModuleRadius2;
385  double innerRadius = outerRadius - troughDepth;
386  double halfLength = fullModuleDepth2/ 2.0;
387  double deltaPhi = 5.625 * Gaudi::Units::deg;
388  double startPhi = 11.25 * Gaudi::Units::deg - deltaPhi/2.0;
389  GeoTubs * tubs = new GeoTubs(innerRadius,outerRadius,halfLength,startPhi,deltaPhi );
390  GeoLogVol *logVol = new GeoLogVol(baseName+"Module2::CableTrough",tubs,FCalCableHarness);
391  GeoIntrusivePtr<GeoPhysVol>physVol = new GeoPhysVol(logVol);
392  GeoGenfun::Variable i;
393  GeoGenfun::GENFUNCTION rotationAngle = 22.5*Gaudi::Units::deg*i;
394  GeoXF::TRANSFUNCTION xf = GeoXF::Pow(GeoTrf::RotateZ3D(1.0),rotationAngle);
395  GeoSerialTransformer *st = new GeoSerialTransformer(physVol,&xf,16);
396  modPhysical->add(st);
397  }
398 
399  // Electrodes:
400  if(!m_absPhysical2) {
401  double halfDepth = fullGapDepth2/2.0;
402  double innerRadius = innerGapRadius2;
403  double outerRadius = outerGapRadius2;
404 
405  GeoIntrusivePtr<GeoPhysVol> gapPhys{nullptr};
406  GeoIntrusivePtr<GeoPhysVol> rodPhys{nullptr};
407  if(m_fullGeo) {
408  GeoTubs *gapTubs = new GeoTubs(0,outerRadius,halfDepth,0.0, 2.0*M_PI);
409  GeoLogVol *gapLog = new GeoLogVol(baseName + "Module2::Gap",gapTubs, LAr);
410  gapPhys = new GeoPhysVol(gapLog);
411 
412  GeoTubs *rodTubs = new GeoTubs(0,innerRadius,halfDepth,0.0, 2.0*M_PI);
413  GeoLogVol *rodLog = new GeoLogVol(baseName + "Module2::Rod",rodTubs, FCal23Slugs);
414  rodPhys = new GeoPhysVol(rodLog);
415  gapPhys->add(rodPhys);
416  modPhysical->add(new GeoSerialIdentifier(0));
417  }
418 
419  int counter=0;
420 
421  int myGroup=2;
422 
423  // Field names
424  unsigned fieldModNumber(2); //std::string fieldModNumber("LARFCALELECTRODES_DATA.MODNUMBER");
425  unsigned fieldTileName(1); //std::string fieldTileName("LARFCALELECTRODES_DATA.TILENAME");
426  unsigned fieldI(4); //std::string fieldI("LARFCALELECTRODES_DATA.I");
427  unsigned fieldJ(5); //std::string fieldJ("LARFCALELECTRODES_DATA.J");
428  unsigned fieldId(3); //std::string fieldId("LARFCALELECTRODES_DATA.ID");
429  unsigned fieldX(6); //std::string fieldX("LARFCALELECTRODES_DATA.X");
430  unsigned fieldY(7); //std::string fieldY("LARFCALELECTRODES_DATA.Y");
431  unsigned fieldHvFt(8); //std::string fieldHvFt("LARFCALELECTRODES_DATA.HVFEEDTHROUGHID");
432 
433  std::unique_ptr<IRDBQuery> query;
434  DecodeVersionKey larVersionKey(geoModel, "LAr");
435  query = rdbAccess->getQuery("LArFCalElectrodes", larVersionKey.tag(),larVersionKey.node());
436  if(!query) {
437  query = rdbAccess->getQuery("LArFCalElectrodes", "LArFCalElectrodes-00");
438  if(!query)
439  throw std::runtime_error("Error getting Session and Query pointers");
440  }
441  query->execute();
442  if(query->size()==0)
443  throw std::runtime_error("Error, unable to fetch fcal electrodes from the database!");
444 
445  while(query->next()) {
446 
447  if(myGroup!=query->data<int>(fieldModNumber)) continue;
448 
449 
450 // std::string thisTileStr=row["LARFCALELECTRODES_DATA.TILENAME"].data<std::string>();
451  int thisTubeI=query->data<int>(fieldI);
452  int thisTubeJ= query->data<int>(fieldJ);
453  int thisTubeID = query->data<int>(fieldId);
454  int thisTubeMod = myGroup;
455  double thisTubeX= query->data<double>(fieldX);
456  double thisTubeY= query->data<double>(fieldY);
457 // std::string thisHVft=row["LARFCALELECTRODES_DATA.HVFEEDTHROUGHID"].data<std::string>();
458 
459  cmap->add_tube(query->data<std::string>(fieldTileName),
460  thisTubeMod, thisTubeID, thisTubeI,thisTubeJ, thisTubeX, thisTubeY,
461  query->data<std::string>(fieldHvFt));
462 
463  if (m_VisLimit != -1 && (counter++ > m_VisLimit)) continue;
464  if(m_fullGeo) {
465  GeoTransform *xf = new GeoTransform(GeoTrf::Translate3D(thisTubeX*Gaudi::Units::cm, thisTubeY*Gaudi::Units::cm,0));
466  modPhysical->add(xf);
467  modPhysical->add(gapPhys);
468  }
469  }
470 
471  m_absPhysical2 = modPhysical;
472  query->finalize();
473  }
474  } // if (F2)
475 
476  if (F3)
477  {
478  // Module 3
479  GeoIntrusivePtr<GeoFullPhysVol> modPhysical{nullptr};
480  {
481  double halfDepth = fullModuleDepth3/2;
482  double innerRadius = innerModuleRadius3;
483  double outerRadius = outerModuleRadius3;
484  GeoIntrusivePtr<GeoFullPhysVol>physVol;
485 
486  if(m_absPhysical3) {
487  physVol = m_absPhysical3->clone();
488  }
489  else {
490  GeoTubs *tubs = new GeoTubs( innerRadius, outerRadius, halfDepth, 0, 2*M_PI);
491  GeoLogVol *logVol = new GeoLogVol(baseName + "Module3::Absorber", tubs, FCal23Absorber);
492  physVol = new GeoFullPhysVol(logVol);
493  }
494 
495  // Alignable transform
496  const IRDBRecord *posRec = GeoDBUtils::getTransformRecord(m_LArPosition, bPos ? "FCAL3_POS":"FCAL3_NEG");
497  if (!posRec) throw std::runtime_error("Error, no lar position record in the database") ;
499  GeoAlignableTransform *xfAbs3 = new GeoAlignableTransform(xfPos);
500 
501  fcalPhysical->add(xfAbs3);
502  if (!bPos) fcalPhysical->add(new GeoTransform(GeoTrf::RotateY3D(180*Gaudi::Units::deg)));
503  fcalPhysical->add(physVol);
504  modPhysical = physVol;
505 
506  std::string tag = bPos? std::string("FCAL3_POS") : std::string("FCAL3_NEG");
508 
509  StoredPhysVol *sPhysVol = new StoredPhysVol(physVol);
510  status=detStore->record(sPhysVol,tag);
511  if(!status.isSuccess()) throw std::runtime_error ((std::string("Cannot store")+tag).c_str());
512 
513  StoredAlignX *sAlignX = new StoredAlignX(xfAbs3);
514  status=detStore->record(sAlignX,tag);
515  if(!status.isSuccess()) throw std::runtime_error ((std::string("Cannot store")+tag).c_str());
516 
517 
518  }
519  // 16 Troughs representing Cable Harnesses:
520  if(m_fullGeo && !m_absPhysical3) {
521  static const double rotAngles[] =
522  { 11.25 * Gaudi::Units::deg,
523  22.50 * Gaudi::Units::deg,
524  45.00 * Gaudi::Units::deg,
525  56.25 * Gaudi::Units::deg,
526  67.50 * Gaudi::Units::deg,
527  90.00 * Gaudi::Units::deg, // first quarter
528  101.25 * Gaudi::Units::deg,
529  112.50 * Gaudi::Units::deg,
530  135.00 * Gaudi::Units::deg,
531  146.25 * Gaudi::Units::deg,
532  157.50 * Gaudi::Units::deg,
533  180.00 * Gaudi::Units::deg, // second quarter
534  191.25 * Gaudi::Units::deg,
535  202.50 * Gaudi::Units::deg,
536  225.00 * Gaudi::Units::deg,
537  236.25 * Gaudi::Units::deg,
538  247.50 * Gaudi::Units::deg,
539  270.00 * Gaudi::Units::deg, // third quarter
540  281.25 * Gaudi::Units::deg,
541  292.50 * Gaudi::Units::deg,
542  315.00 * Gaudi::Units::deg,
543  326.25 * Gaudi::Units::deg,
544  337.50 * Gaudi::Units::deg,
545  360.00 * Gaudi::Units::deg };
546 
547  GeoGenfun::ArrayFunction rotationAngle(rotAngles,rotAngles+24);
548  double troughDepth = 1.0 * Gaudi::Units::cm;
549  double outerRadius = outerModuleRadius3;
550  double innerRadius = outerRadius - troughDepth;
551  double halfLength = fullModuleDepth3/ 2.0;
552  double deltaPhi = 5.625 * Gaudi::Units::deg;
553  double startPhi = 11.25 * Gaudi::Units::deg - deltaPhi/2.0;
554  GeoTubs * tubs = new GeoTubs(innerRadius,outerRadius,halfLength,startPhi,deltaPhi );
555  GeoLogVol *logVol = new GeoLogVol(baseName+"Module3::CableTrough",tubs,FCalCableHarness);
556  GeoIntrusivePtr<GeoPhysVol>physVol = new GeoPhysVol(logVol);
557  GeoXF::TRANSFUNCTION xf = GeoXF::Pow(GeoTrf::RotateZ3D(1.0),rotationAngle);
558  GeoSerialTransformer *st = new GeoSerialTransformer(physVol,&xf,24);
559  modPhysical->add(st);
560  }
561 
562  // Electrodes:
563  if(!m_absPhysical3) {
564  double halfDepth = fullGapDepth3/2.0;
565  double innerRadius = innerGapRadius3;
566  double outerRadius = outerGapRadius3;
567 
568  GeoIntrusivePtr<GeoPhysVol> gapPhys{nullptr};
569  GeoIntrusivePtr<GeoPhysVol> rodPhys{nullptr};
570  if(m_fullGeo) {
571  GeoTubs *gapTubs = new GeoTubs(0,outerRadius,halfDepth,0.0, 2.0*M_PI);
572  GeoLogVol *gapLog = new GeoLogVol(baseName + "Module3::Gap",gapTubs, LAr);
573  gapPhys = new GeoPhysVol(gapLog);
574 
575  GeoTubs *rodTubs = new GeoTubs(0,innerRadius,halfDepth,0.0, 2.0*M_PI);
576  GeoLogVol *rodLog = new GeoLogVol(baseName + "Module3::Rod",rodTubs, FCal23Slugs);
577  rodPhys = new GeoPhysVol(rodLog);
578  gapPhys->add(rodPhys);
579  modPhysical->add(new GeoSerialIdentifier(0));
580  }
581 
582  int counter=0;
583 
584  int myGroup=3;
585 
586  // Field names
587  unsigned fieldModNumber(2); //std::string fieldModNumber("LARFCALELECTRODES_DATA.MODNUMBER");
588  unsigned fieldTileName(1); //std::string fieldTileName("LARFCALELECTRODES_DATA.TILENAME");
589  unsigned fieldI(4); //std::string fieldI("LARFCALELECTRODES_DATA.I");
590  unsigned fieldJ(5); //std::string fieldJ("LARFCALELECTRODES_DATA.J");
591  unsigned fieldId(3); //std::string fieldId("LARFCALELECTRODES_DATA.ID");
592  unsigned fieldX(6); //std::string fieldX("LARFCALELECTRODES_DATA.X");
593  unsigned fieldY(7); //std::string fieldY("LARFCALELECTRODES_DATA.Y");
594  unsigned fieldHvFt(8); //std::string fieldHvFt("LARFCALELECTRODES_DATA.HVFEEDTHROUGHID");
595 
596  std::unique_ptr<IRDBQuery> query;
597  DecodeVersionKey larVersionKey(geoModel, "LAr");
598  query = rdbAccess->getQuery("LArFCalElectrodes", larVersionKey.tag(),larVersionKey.node());
599  if(!query) {
600  query = rdbAccess->getQuery("LArFCalElectrodes", "LArFCalElectrodes-00");
601  if(!query)
602  throw std::runtime_error("Error getting Session and Query pointers");
603  }
604  query->execute();
605  if(query->size()==0)
606  throw std::runtime_error("Error, unable to fetch fcal electrodes from the database!");
607 
608  while(query->next()) {
609 
610  if(myGroup!=query->data<int>(fieldModNumber)) continue;
611 
612 // std::string thisTileStr=row["LARFCALELECTRODES_DATA.TILENAME"].data<std::string>();
613  int thisTubeI=query->data<int>(fieldI);
614  int thisTubeJ= query->data<int>(fieldJ);
615  int thisTubeID = query->data<int>(fieldId);
616  int thisTubeMod = myGroup;
617  double thisTubeX= query->data<double>(fieldX);
618  double thisTubeY= query->data<double>(fieldY);
619 // std::string thisHVft=row["LARFCALELECTRODES_DATA.HVFEEDTHROUGHID"].data<std::string>();
620 
621  cmap->add_tube(query->data<std::string>(fieldTileName),
622  thisTubeMod, thisTubeID, thisTubeI,thisTubeJ, thisTubeX, thisTubeY,
623  query->data<std::string>(fieldHvFt));
624 
625  if (m_VisLimit != -1 && (counter++ > m_VisLimit)) continue;
626  if(m_fullGeo) {
627  GeoTransform *xf = new GeoTransform(GeoTrf::Translate3D(thisTubeX*Gaudi::Units::cm, thisTubeY*Gaudi::Units::cm,0));
628  modPhysical->add(xf);
629  modPhysical->add(gapPhys);
630  }
631  }
632 
633  m_absPhysical3 = modPhysical;
634  query->finalize();
635  }
636  } // if (F3)
637 
638  // Did I already store it?
639  //FCAL_ChannelMap *aChannelMap(NULL);
640  // if (detStore->retrieve(aChannelMap)==StatusCode::FAILURE) {
641  if (!detStore->contains<FCAL_ChannelMap>("FCAL_ChannelMap")) {
642  cmap->finish();
643  StatusCode status=detStore->record(std::move(cmap),"FCAL_ChannelMap");
644  if(!status.isSuccess()) throw std::runtime_error ("Cannot store FCAL_ChannelMap");
645  }
646 
647  return fcalPhysical;
648 }

◆ operator=()

FCALConstruction& LArGeo::FCALConstruction::operator= ( const FCALConstruction )
private

◆ setFCALVisLimit()

void LArGeo::FCALConstruction::setFCALVisLimit ( int  maxCell)
inline

Definition at line 39 of file FCALConstruction.h.

◆ setFullGeo()

void LArGeo::FCALConstruction::setFullGeo ( bool  flag)
inline

Definition at line 42 of file FCALConstruction.h.

42 {m_fullGeo = flag;}

Member Data Documentation

◆ m_absPhysical1

GeoIntrusivePtr<GeoFullPhysVol> LArGeo::FCALConstruction::m_absPhysical1 {}
private

Definition at line 57 of file FCALConstruction.h.

◆ m_absPhysical2

GeoIntrusivePtr<GeoFullPhysVol> LArGeo::FCALConstruction::m_absPhysical2 {}
private

Definition at line 58 of file FCALConstruction.h.

◆ m_absPhysical3

GeoIntrusivePtr<GeoFullPhysVol> LArGeo::FCALConstruction::m_absPhysical3 {}
private

Definition at line 59 of file FCALConstruction.h.

◆ m_fcalMod

IRDBRecordset_ptr LArGeo::FCALConstruction::m_fcalMod
private

Definition at line 64 of file FCALConstruction.h.

◆ m_fcalPhysical

GeoIntrusivePtr<GeoFullPhysVol> LArGeo::FCALConstruction::m_fcalPhysical
private

Definition at line 54 of file FCALConstruction.h.

◆ m_fullGeo

bool LArGeo::FCALConstruction::m_fullGeo
private

Definition at line 67 of file FCALConstruction.h.

◆ m_LArPosition

IRDBRecordset_ptr LArGeo::FCALConstruction::m_LArPosition
private

Definition at line 65 of file FCALConstruction.h.

◆ m_svcLocator

ISvcLocator* LArGeo::FCALConstruction::m_svcLocator
private

Definition at line 63 of file FCALConstruction.h.

◆ m_VisLimit

int LArGeo::FCALConstruction::m_VisLimit
private

Definition at line 61 of file FCALConstruction.h.


The documentation for this class was generated from the following files:
LArGeo::FCALConstruction::m_svcLocator
ISvcLocator * m_svcLocator
Definition: FCALConstruction.h:63
max
#define max(a, b)
Definition: cfImp.cxx:41
GeoDBUtils::getTransformRecord
static const IRDBRecord * getTransformRecord(IRDBRecordset_ptr positionRecSet, const std::string &key)
Definition: GeoDBUtils.h:23
IGeoModelSvc
Definition: IGeoModelSvc.h:17
LAr
Definition: LArVolumeBuilder.h:36
xAOD::deltaPhi
setSAddress setEtaMS setDirPhiMS setDirZMS setBarrelRadius setEndcapAlpha setEndcapRadius setInterceptInner setEtaMap setEtaBin setIsTgcFailure setDeltaPt deltaPhi
Definition: L2StandAloneMuon_v1.cxx:160
FCAL_ChannelMap
This class contains the tube and tile maps for the FCAL A tile is of a set of FCAL tubes.
Definition: LArCalorimeter/LArGeoModel/LArReadoutGeometry/LArReadoutGeometry/FCAL_ChannelMap.h:34
StoredAlignX
Definition: StoredAlignX.h:23
M_PI
#define M_PI
Definition: ActiveFraction.h:11
deg
#define deg
Definition: SbPolyhedron.cxx:17
GeoDBUtils::getTransform
static GeoTrf::Transform3D getTransform(const IRDBRecord *currentRec)
Definition: GeoDBUtils.h:33
StoredPhysVol
Definition: StoredPhysVol.h:27
GeoGenfun::ArrayFunction
Definition: ArrayFunction.h:16
query
Definition: query.py:1
cm
const double cm
Definition: Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/FCAL_ChannelMap.cxx:25
LArGeo::FCALConstruction::m_absPhysical1
GeoIntrusivePtr< GeoFullPhysVol > m_absPhysical1
Definition: FCALConstruction.h:57
StoreGateSvc
The Athena Transient Store API.
Definition: StoreGateSvc.h:128
LArGeo::FCALConstruction::m_absPhysical2
GeoIntrusivePtr< GeoFullPhysVol > m_absPhysical2
Definition: FCALConstruction.h:58
LArGeo::FCALConstruction::m_LArPosition
IRDBRecordset_ptr m_LArPosition
Definition: FCALConstruction.h:65
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
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
DecodeVersionKey
This is a helper class to query the version tags from GeoModelSvc and determine the appropriate tag a...
Definition: DecodeVersionKey.h:18
master.flag
bool flag
Definition: master.py:29
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
query_example.query
query
Definition: query_example.py:15
min
#define min(a, b)
Definition: cfImp.cxx:40
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
LArGeo::FCALConstruction::m_fcalPhysical
GeoIntrusivePtr< GeoFullPhysVol > m_fcalPhysical
Definition: FCALConstruction.h:54
LArGeo::FCALConstruction::m_fcalMod
IRDBRecordset_ptr m_fcalMod
Definition: FCALConstruction.h:64
IRDBRecord
IRDBRecord is one record in the IRDBRecordset object.
Definition: IRDBRecord.h:27
LArGeo::FCALConstruction::m_VisLimit
int m_VisLimit
Definition: FCALConstruction.h:61
StoredMaterialManager::getMaterial
virtual const GeoMaterial * getMaterial(const std::string &name)=0
LArGeo::FCALConstruction::m_absPhysical3
GeoIntrusivePtr< GeoFullPhysVol > m_absPhysical3
Definition: FCALConstruction.h:59
StoredMaterialManager
This class holds one or more material managers and makes them storeable, under StoreGate.
Definition: StoredMaterialManager.h:28
merge.status
status
Definition: merge.py:17
CaloCondBlobAlgs_fillNoiseFromASCII.tag
string tag
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:24
test_pyathena.counter
counter
Definition: test_pyathena.py:15
maxCell
#define maxCell
LArGeo::FCALConstruction::m_fullGeo
bool m_fullGeo
Definition: FCALConstruction.h:67