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

LArDetectorFactoryLite is invoked by the LArDetectorTool when the GeoModel description of LAr calorimeter is built from the SQLite database relevant 'Construction' classes (Barrel, Endcap). It also builds readout geometry. More...

#include <LArDetectorFactoryLite.h>

Inheritance diagram for LArGeo::LArDetectorFactoryLite:
Collaboration diagram for LArGeo::LArDetectorFactoryLite:

Public Member Functions

 LArDetectorFactoryLite (StoreGateSvc *detStore, IRDBAccessSvc *paramSvc, GeoModelIO::ReadGeoModel *sqliteReader, const LArHVManager *hvManager)
 
 LArDetectorFactoryLite ()=delete
 
 LArDetectorFactoryLite (const LArDetectorFactoryLite &right)=delete
 
const LArDetectorFactoryLiteoperator= (const LArDetectorFactoryLite &right)=delete
 
virtual void create (GeoPhysVol *world) override
 
virtual const LArDetectorManagergetDetectorManager () const override
 
void setBarrelSagging (bool flag)
 
void setTestBeam (int flag)
 
bool msgLvl (const MSG::Level lvl) const
 Test the output level. More...
 
MsgStream & msg () const
 The standard message stream. More...
 
MsgStream & msg (const MSG::Level lvl) const
 The standard message stream. More...
 
void setLevel (MSG::Level lvl)
 Change the current logging level. More...
 

Private Member Functions

void initMessaging () const
 Initialize our message level and MessageSvc. More...
 

Private Attributes

LArDetectorManagerm_detectorManager = nullptr
 
StoreGateSvcm_detStore = nullptr
 
IRDBAccessSvcm_paramSvc = nullptr
 
GeoModelIO::ReadGeoModel * m_sqliteReader = nullptr
 
const LArHVManagerm_hvManager = nullptr
 
bool m_barrelSagging
 
int m_testBeam
 
std::string m_nm
 Message source name. More...
 
boost::thread_specific_ptr< MsgStream > m_msg_tls
 MsgStream instance (a std::cout like with print-out levels) More...
 
std::atomic< IMessageSvc * > m_imsg { nullptr }
 MessageSvc pointer. More...
 
std::atomic< MSG::Level > m_lvl { MSG::NIL }
 Current logging level. More...
 
std::atomic_flag m_initialized ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
 Messaging initialized (initMessaging) More...
 

Detailed Description

LArDetectorFactoryLite is invoked by the LArDetectorTool when the GeoModel description of LAr calorimeter is built from the SQLite database relevant 'Construction' classes (Barrel, Endcap). It also builds readout geometry.

Definition at line 33 of file LArDetectorFactoryLite.h.

Constructor & Destructor Documentation

◆ LArDetectorFactoryLite() [1/3]

LArGeo::LArDetectorFactoryLite::LArDetectorFactoryLite ( StoreGateSvc detStore,
IRDBAccessSvc paramSvc,
GeoModelIO::ReadGeoModel *  sqliteReader,
const LArHVManager hvManager 
)

Definition at line 33 of file LArDetectorFactoryLite.cxx.

37  : AthMessaging("LArDetectorFactoryLite")
38  , m_detectorManager(nullptr)
40  , m_paramSvc(paramSvc)
41  , m_sqliteReader(sqliteReader)
42  , m_hvManager(hvManager)
43  , m_barrelSagging(false)
44  , m_testBeam(0)
45 {
46 }

◆ LArDetectorFactoryLite() [2/3]

LArGeo::LArDetectorFactoryLite::LArDetectorFactoryLite ( )
delete

◆ LArDetectorFactoryLite() [3/3]

LArGeo::LArDetectorFactoryLite::LArDetectorFactoryLite ( const LArDetectorFactoryLite right)
delete

Member Function Documentation

◆ create()

void LArGeo::LArDetectorFactoryLite::create ( GeoPhysVol *  world)
overridevirtual

Definition at line 49 of file LArDetectorFactoryLite.cxx.

50 {
51  ATH_MSG_INFO("LArDetectorFactoryLite::create()");
52 
53  std::string errorMessage{""};
54 
56  errorMessage="Failed to build FCAL Channel Map";
57  ATH_MSG_FATAL(errorMessage);
58  throw std::runtime_error(errorMessage);
59  }
60 
61  // Build Electrode straight sections in the barrel
63  , m_paramSvc
65  , m_barrelSagging) != StatusCode::SUCCESS) {
66  errorMessage="Failed to build LAr Barrel electrode sections";
67  ATH_MSG_FATAL(errorMessage);
68  throw std::runtime_error(errorMessage);
69  }
70 
71  // Get the list of alignable transforms from SQLite, and record them into DetStore
72  std::map<std::string, GeoAlignableTransform*> mapAXF = m_sqliteReader->getPublishedNodes<std::string, GeoAlignableTransform*>("LAr");
73  for( auto& [key,xf] : mapAXF) {
74  StoredAlignX *sAlignX = new StoredAlignX(xf);
75  if(m_detStore->record(sAlignX,key)!=StatusCode::SUCCESS) {
76  errorMessage="Failed to record StoredAlignX for the key: "+key;
77  ATH_MSG_FATAL(errorMessage);
78  throw std::runtime_error(errorMessage);
79  }
80  }
81  // Get the list of full phys volumes from SQLite, and record them into DetStore
82  std::map<std::string, GeoFullPhysVol*> mapFPV = m_sqliteReader->getPublishedNodes<std::string, GeoFullPhysVol*>("LAr");
83  for( auto& [key,pv] : mapFPV) {
84  StoredPhysVol *sPhysVol = new StoredPhysVol(pv);
85  if(m_detStore->record(sPhysVol,key)!=StatusCode::SUCCESS) {
86  errorMessage="Failed to record StoredPhysVol for the key: " + key;
87  ATH_MSG_FATAL(errorMessage);
88  throw std::runtime_error(errorMessage);
89  }
90  }
91 
92  // Build LAr readout geometry
93  double projectivityDisplacement{0.};
94  IRDBRecordset_ptr emecGeometry = m_paramSvc->getRecordsetPtr("EmecGeometry","");
95  projectivityDisplacement = (*emecGeometry)[0]->getDouble("ZSHIFT");
96 
97  auto subDetManagers = buildLArReadoutGeometry(m_detStore
98  , m_hvManager
100  , m_testBeam
101  , projectivityDisplacement);
102 
103  EMBDetectorManager* embDetectorManager{std::get<0>(subDetManagers)};
104  EMECDetectorManager* emecDetectorManager{std::get<1>(subDetManagers)};
105  HECDetectorManager* hecDetectorManager{std::get<2>(subDetManagers)};
106  FCALDetectorManager* fcalDetectorManager{std::get<3>(subDetManagers)};
107 
108  if(!embDetectorManager
109  || !emecDetectorManager
110  || !hecDetectorManager
111  || !fcalDetectorManager) {
112  errorMessage="Failed to build LAr Readout Geometry description";
113  ATH_MSG_FATAL(errorMessage);
114  throw std::runtime_error(errorMessage);
115  }
116 
117  m_detectorManager = new LArDetectorManager(embDetectorManager,emecDetectorManager,hecDetectorManager,fcalDetectorManager);
119 
120  // Build MBTS readout geometry
121  IRDBRecordset_ptr mbtsTrds = m_paramSvc->getRecordsetPtr("MBTSTrds","");
122  IRDBRecordset_ptr mbtsTubs = m_paramSvc->getRecordsetPtr("MBTSTubs","");
123  IRDBRecordset_ptr mbtsPcons = m_paramSvc->getRecordsetPtr("MBTSPcons","");
124  IRDBRecordset_ptr cryoPcons = m_paramSvc->getRecordsetPtr("CryoPcons","");
125 
126 
128  double zposMM = 0.;
129 
130  if(mbtsPcons->size()==0) {
131  first = mbtsTubs->begin();
132  last = mbtsTubs->end();
133  for(; first!=last; ++first) {
134  if((*first)->getString("TUBE") == "MBTS_mother") {
135  zposMM = (*first)->getDouble("ZPOS")*SYSTEM_OF_UNITS::mm;
136  break;
137  }
138  }
139  }
140  else {
141  double zStartCryoMother = 0.;
142  first = cryoPcons->begin();
143  last = cryoPcons->end();
144  for(; first!=last; ++first) {
145  if((*first)->getString("PCON")=="Endcap::CryoMother"
146  && (*first)->getInt("PLANE_ID")==0) {
147  zStartCryoMother = (*first)->getDouble("ZPLANE");
148  break;
149  }
150  }
151 
152  double zStartMM = 0.;
153  first = mbtsPcons->begin();
154  last = mbtsPcons->end();
155  for(; first!=last; ++first) {
156  if((*first)->getString("PCON")=="MBTS::Mother"
157  && (*first)->getInt("PLANE_ID")==0) {
158  zStartMM = (*first)->getDouble("ZPLANE");
159  break;
160  }
161  }
162 
163  zposMM = zStartCryoMother - zStartMM;
164  }
165 
166 
167  std::map<std::string,unsigned> trdMap;
168  for(unsigned indTrd(0);indTrd<mbtsTrds->size();++indTrd) {
169  const std::string& keyTrd = (*mbtsTrds)[indTrd]->getString("TRD");
170  trdMap[keyTrd]=indTrd;
171  }
172 
174  , m_paramSvc
176  , zposMM
177  , trdMap
178  , std::string()
179  , std::string()).isFailure()) {
180  errorMessage="Failed to build MBTS Readout Geometry description";
181  ATH_MSG_FATAL(errorMessage);
182  throw std::runtime_error(errorMessage);
183  }
184 
185  // Set Tree Tops
186  GeoVolumeCursor cursor(world);
187  while(!cursor.atEnd()) {
188  std::string volName = cursor.getName();
189  if(volName.compare(0,3,"LAr")==0) {
190  m_detectorManager->addTreeTop(cursor.getVolume());
191  }
192  cursor.next();
193  }
194 
195 }

◆ getDetectorManager()

virtual const LArDetectorManager* LArGeo::LArDetectorFactoryLite::getDetectorManager ( ) const
inlineoverridevirtual

Definition at line 49 of file LArDetectorFactoryLite.h.

49 {return m_detectorManager;}

◆ initMessaging()

void AthMessaging::initMessaging ( ) const
privateinherited

Initialize our message level and MessageSvc.

This method should only be called once.

Definition at line 39 of file AthMessaging.cxx.

40 {
42  m_lvl = m_imsg ?
43  static_cast<MSG::Level>( m_imsg.load()->outputLevel(m_nm) ) :
44  MSG::INFO;
45 }

◆ msg() [1/2]

MsgStream & AthMessaging::msg ( ) const
inlineinherited

The standard message stream.

Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.

Definition at line 164 of file AthMessaging.h.

165 {
166  MsgStream* ms = m_msg_tls.get();
167  if (!ms) {
168  if (!m_initialized.test_and_set()) initMessaging();
169  ms = new MsgStream(m_imsg,m_nm);
170  m_msg_tls.reset( ms );
171  }
172 
173  ms->setLevel (m_lvl);
174  return *ms;
175 }

◆ msg() [2/2]

MsgStream & AthMessaging::msg ( const MSG::Level  lvl) const
inlineinherited

The standard message stream.

Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.

Definition at line 179 of file AthMessaging.h.

180 { return msg() << lvl; }

◆ msgLvl()

bool AthMessaging::msgLvl ( const MSG::Level  lvl) const
inlineinherited

Test the output level.

Parameters
lvlThe message level to test against
Returns
boolean Indicating if messages at given level will be printed
Return values
trueMessages at level "lvl" will be printed

Definition at line 151 of file AthMessaging.h.

152 {
153  if (!m_initialized.test_and_set()) initMessaging();
154  if (m_lvl <= lvl) {
155  msg() << lvl;
156  return true;
157  } else {
158  return false;
159  }
160 }

◆ operator=()

const LArDetectorFactoryLite& LArGeo::LArDetectorFactoryLite::operator= ( const LArDetectorFactoryLite right)
delete

◆ setBarrelSagging()

void LArGeo::LArDetectorFactoryLite::setBarrelSagging ( bool  flag)
inline

Definition at line 51 of file LArDetectorFactoryLite.h.

◆ setLevel()

void AthMessaging::setLevel ( MSG::Level  lvl)
inherited

Change the current logging level.

Use this rather than msg().setLevel() for proper operation with MT.

Definition at line 28 of file AthMessaging.cxx.

29 {
30  m_lvl = lvl;
31 }

◆ setTestBeam()

void LArGeo::LArDetectorFactoryLite::setTestBeam ( int  flag)
inline

Definition at line 52 of file LArDetectorFactoryLite.h.

52 {m_testBeam = flag;}

Member Data Documentation

◆ ATLAS_THREAD_SAFE

std::atomic_flag m_initialized AthMessaging::ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
mutableprivateinherited

Messaging initialized (initMessaging)

Definition at line 141 of file AthMessaging.h.

◆ m_barrelSagging

bool LArGeo::LArDetectorFactoryLite::m_barrelSagging
private

Definition at line 62 of file LArDetectorFactoryLite.h.

◆ m_detectorManager

LArDetectorManager* LArGeo::LArDetectorFactoryLite::m_detectorManager = nullptr
private

Definition at line 56 of file LArDetectorFactoryLite.h.

◆ m_detStore

StoreGateSvc* LArGeo::LArDetectorFactoryLite::m_detStore = nullptr
private

Definition at line 57 of file LArDetectorFactoryLite.h.

◆ m_hvManager

const LArHVManager* LArGeo::LArDetectorFactoryLite::m_hvManager = nullptr
private

Definition at line 60 of file LArDetectorFactoryLite.h.

◆ m_imsg

std::atomic<IMessageSvc*> AthMessaging::m_imsg { nullptr }
mutableprivateinherited

MessageSvc pointer.

Definition at line 135 of file AthMessaging.h.

◆ m_lvl

std::atomic<MSG::Level> AthMessaging::m_lvl { MSG::NIL }
mutableprivateinherited

Current logging level.

Definition at line 138 of file AthMessaging.h.

◆ m_msg_tls

boost::thread_specific_ptr<MsgStream> AthMessaging::m_msg_tls
mutableprivateinherited

MsgStream instance (a std::cout like with print-out levels)

Definition at line 132 of file AthMessaging.h.

◆ m_nm

std::string AthMessaging::m_nm
privateinherited

Message source name.

Definition at line 129 of file AthMessaging.h.

◆ m_paramSvc

IRDBAccessSvc* LArGeo::LArDetectorFactoryLite::m_paramSvc = nullptr
private

Definition at line 58 of file LArDetectorFactoryLite.h.

◆ m_sqliteReader

GeoModelIO::ReadGeoModel* LArGeo::LArDetectorFactoryLite::m_sqliteReader = nullptr
private

Definition at line 59 of file LArDetectorFactoryLite.h.

◆ m_testBeam

int LArGeo::LArDetectorFactoryLite::m_testBeam
private

Definition at line 63 of file LArDetectorFactoryLite.h.


The documentation for this class was generated from the following files:
StoreGateSvc::record
StatusCode record(T *p2BRegistered, const TKEY &key)
Record an object with a key.
AthMessaging::m_lvl
std::atomic< MSG::Level > m_lvl
Current logging level.
Definition: AthMessaging.h:138
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
FCALDetectorManager
A manager class providing access to readout geometry information for the forward calorimeter.
Definition: FCALDetectorManager.h:29
LArGeo::buildMbtsReadout
StatusCode buildMbtsReadout(StoreGateSvc *detStore, IRDBAccessSvc *paramSvc, IMessageSvc *msgSvc, double zposMM, const std::map< std::string, unsigned > &trdMap, const std::string &detKey, const std::string &detNode)
Definition: MbtsReadoutBuilder.cxx:22
LArDetectorManager::isTestBeam
void isTestBeam(bool flag)
Set Test Beam flag.
Definition: LArDetectorManager.h:116
LArGeo::LArDetectorFactoryLite::m_detectorManager
LArDetectorManager * m_detectorManager
Definition: LArDetectorFactoryLite.h:56
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
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.
EMECDetectorManager
A manager class providing access to readout geometry information for the electromagnetic endcap calor...
Definition: EMECDetectorManager.h:31
StoredAlignX
Definition: StoredAlignX.h:23
LArGeo::LArDetectorFactoryLite::m_hvManager
const LArHVManager * m_hvManager
Definition: LArDetectorFactoryLite.h:60
LArGeo::LArDetectorFactoryLite::m_testBeam
int m_testBeam
Definition: LArDetectorFactoryLite.h:63
LArGeo::LArDetectorFactoryLite::m_sqliteReader
GeoModelIO::ReadGeoModel * m_sqliteReader
Definition: LArDetectorFactoryLite.h:59
LArGeo::buildElStraightSections
StatusCode buildElStraightSections(StoreGateSvc *detStore, IRDBAccessSvc *paramSvc, IMessageSvc *msgSvc, bool sagging)
Definition: ElStraightSectionBuilder.cxx:27
AthMessaging::m_imsg
std::atomic< IMessageSvc * > m_imsg
MessageSvc pointer.
Definition: AthMessaging.h:135
python.SystemOfUnits.ms
int ms
Definition: SystemOfUnits.py:132
LArGeo::LArDetectorFactoryLite::m_barrelSagging
bool m_barrelSagging
Definition: LArDetectorFactoryLite.h:62
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
LArGeo::LArDetectorFactoryLite::m_detStore
StoreGateSvc * m_detStore
Definition: LArDetectorFactoryLite.h:57
StoredPhysVol
Definition: StoredPhysVol.h:27
AthMessaging::AthMessaging
AthMessaging()
Default constructor:
EMBDetectorManager
A manager class providing access to readout geometry information for the electromagnetic barrel calor...
Definition: EMBDetectorManager.h:32
TrigConf::MSGTC::Level
Level
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:21
master.flag
bool flag
Definition: master.py:29
LArDetectorManager::addTreeTop
void addTreeTop(const PVConstLink &treeTop)
Add a Tree Top.
Definition: LArDetectorManager.cxx:31
LArDetectorManager
Stored in storegate. Provides access to EMB, EMEC, HEC and FCAL Detector Managers....
Definition: LArDetectorManager.h:26
LArGeo::buildFcalChannelMap
StatusCode buildFcalChannelMap(StoreGateSvc *detStore, IRDBAccessSvc *paramSvc, IMessageSvc *msgSvc)
Definition: FCALChannelMapBuilder.cxx:14
IRDBRecordset_ptr
std::shared_ptr< IRDBRecordset > IRDBRecordset_ptr
Definition: IRDBAccessSvc.h:25
AthMessaging::msg
MsgStream & msg() const
The standard message stream.
Definition: AthMessaging.h:164
HECDetectorManager
A manager class providing access to readout geometry information for the hadronic endcap calorimeter.
Definition: HECDetectorManager.h:28
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
python.SystemOfUnits.mm
int mm
Definition: SystemOfUnits.py:83
query_example.cursor
cursor
Definition: query_example.py:21
buildLArReadoutGeometry
std::tuple< EMBDetectorManager *,EMECDetectorManager *,HECDetectorManager *,FCALDetectorManager * > buildLArReadoutGeometry(StoreGateSvc *detStore, const LArHVManager *hvManager, IMessageSvc *msgSvc, int testbeam, double projectivityDisplacement)
Definition: LArReadoutGeometryBuilder.cxx:37
AthMessaging::m_nm
std::string m_nm
Message source name.
Definition: AthMessaging.h:129
DeMoScan.first
bool first
Definition: DeMoScan.py:536
python.changerun.pv
pv
Definition: changerun.py:81
AthMessaging::initMessaging
void initMessaging() const
Initialize our message level and MessageSvc.
Definition: AthMessaging.cxx:39
AthMessaging::m_msg_tls
boost::thread_specific_ptr< MsgStream > m_msg_tls
MsgStream instance (a std::cout like with print-out levels)
Definition: AthMessaging.h:132
LArGeo::LArDetectorFactoryLite::m_paramSvc
IRDBAccessSvc * m_paramSvc
Definition: LArDetectorFactoryLite.h:58
IRDBRecordset::const_iterator
RecordsVector::const_iterator const_iterator
Definition: IRDBRecordset.h:52
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37