ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | List of all members
TRRegionXMLHandler Class Reference

#include <TRRegionXMLHandler.h>

Inheritance diagram for TRRegionXMLHandler:
Collaboration diagram for TRRegionXMLHandler:

Public Member Functions

 TRRegionXMLHandler (TRTTransitionRadiation *)
 
void Process (const std::string &name)
 
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

TRTTransitionRadiationm_theProcess {}
 
StoreGateSvcm_storeGate {}
 
bool m_initialLayoutIdDict {false}
 
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

Definition at line 14 of file TRRegionXMLHandler.h.

Constructor & Destructor Documentation

◆ TRRegionXMLHandler()

TRRegionXMLHandler::TRRegionXMLHandler ( TRTTransitionRadiation tr)

Definition at line 32 of file TRRegionXMLHandler.cxx.

32  :
33  AthMessaging("TRRegionXMLHandler"),
34  m_theProcess(tr)
35 {}

Member Function Documentation

◆ 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 }

◆ Process()

void TRRegionXMLHandler::Process ( const std::string &  name)

Definition at line 37 of file TRRegionXMLHandler.cxx.

38 {
39  ISvcLocator * svcLocator = Gaudi::svcLocator(); // from Bootstrap
40 
41  ATH_MSG_DEBUG("This is TRRegionXMLHandler. Handler called");
42 
43  SmartIF<StoreGateSvc> smartSG{svcLocator->service("StoreGateSvc")};
44  if (smartSG) { m_storeGate = smartSG.get(); }
45  if( !m_storeGate ) {
46  ATH_MSG_ERROR("Unable to locate StoreGate! Stopping!");
47  throw std::runtime_error("Unable to locate StoreGate!");
48  }
49  SmartIF<StoreGateSvc> detStore{svcLocator->service( "DetectorStore")};
50  if( !detStore ) {
51  ATH_MSG_ERROR("Unable to locate DetectorStore! Leaving!");
52  throw std::runtime_error("Unable to locate DetectorStore!");
53  }
54 
55  const IdDictManager * idDictMgr{};
56  if (StatusCode::SUCCESS == detStore->retrieve(idDictMgr, "IdDict")) {
57  if (idDictMgr) {
58  std::string tag = idDictMgr->manager()->tag();
60  (tag == "initial_layout" || tag == "destaged_layout");
61  }
62  } else {
63  ATH_MSG_FATAL("Could not retrieve geometry layout. TR process is not to be trusted in the following");
64  throw std::runtime_error("Could not retrieve geometry layout!");
65  }
66 
67  // Crack open the XML file
68  std::filebuf fb;
69  if (!fb.open(name,std::ios::in)){
70  ATH_MSG_FATAL("Could not open file " << name << " bombing out");
71  throw std::runtime_error("Could not open file!");
72  }
73  std::istream is(&fb);
75  read_xml(is, pt);
76 
77  for( boost::property_tree::ptree::value_type const& v : pt.get_child("FADS") ) {
78  if( v.first == "TRRegionParameters" ) {
79 
80  std::string volName=v.second.get<std::string>("<xmlattr>.RadiatorName");
81  double foilThickness=v.second.get<double>("<xmlattr>.RadiatorFoilThickness");
82  double gasThickness=v.second.get<double>("<xmlattr>.RadiatorGasThickness");
83  int regionFlag=v.second.get<int>("<xmlattr>.RadiatorBARRELorENDCAP");
84  std::string detectorPart=v.second.get<std::string>("<xmlattr>.DetectorPart");
85 
86  G4LogicalVolumeStore *g4lvs = G4LogicalVolumeStore::GetInstance();
87  unsigned int numberOfVolumes = 0;
88  for (const auto log_vol : *g4lvs){
89  if (volName == static_cast<const std::string&>(log_vol->GetName())) {
90  TRTRadiatorParameters rad( log_vol,
91  foilThickness,gasThickness,
92  (BEflag)regionFlag );
94  ++numberOfVolumes;
95  }
96  }
97 
98  if( numberOfVolumes == 0 ) {
99  // In case of destaged geometry (no C wheels) any missing volume
100  // except the radiators corresponding to the C wheels will cause
101  // the code to abort
102  if ( m_initialLayoutIdDict != 0 ) {
103  if ( ( volName!="TRT::MainRadiatorC" ) &&
104  ( volName!="TRT::ThinRadiatorC" ) ) {
105  ATH_MSG_FATAL(" Volume-name " << volName
106  <<" not found! Geometry layout "
108  std::abort();
109  }
110  }
111  } // Didn't get any volumes
112  } // Loop over region parameters objects
113  } // Loop over FADS things in the XML file
114 
115 }

◆ 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 }

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_imsg

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

MessageSvc pointer.

Definition at line 135 of file AthMessaging.h.

◆ m_initialLayoutIdDict

bool TRRegionXMLHandler::m_initialLayoutIdDict {false}
private

Definition at line 22 of file TRRegionXMLHandler.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_storeGate

StoreGateSvc* TRRegionXMLHandler::m_storeGate {}
private

Definition at line 21 of file TRRegionXMLHandler.h.

◆ m_theProcess

TRTTransitionRadiation* TRRegionXMLHandler::m_theProcess {}
private

Definition at line 20 of file TRRegionXMLHandler.h.


The documentation for this class was generated from the following files:
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
TRTTransitionRadiation::AddRadiatorParameters
void AddRadiatorParameters(const TRTRadiatorParameters &p)
Definition: TRTTransitionRadiation.cxx:81
TRRegionXMLHandler::m_theProcess
TRTTransitionRadiation * m_theProcess
Definition: TRRegionXMLHandler.h:20
test_pyathena.pt
pt
Definition: test_pyathena.py:11
AthMessaging::m_imsg
std::atomic< IMessageSvc * > m_imsg
MessageSvc pointer.
Definition: AthMessaging.h:135
python.SystemOfUnits.ms
int ms
Definition: SystemOfUnits.py:132
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
AthMessaging::AthMessaging
AthMessaging()
Default constructor:
TrigConf::MSGTC::Level
Level
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:21
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
TRRegionXMLHandler::m_initialLayoutIdDict
bool m_initialLayoutIdDict
Definition: TRRegionXMLHandler.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
BEflag
BEflag
Definition: TRTRadiatorParameters.h:10
AthMessaging::msg
MsgStream & msg() const
The standard message stream.
Definition: AthMessaging.h:164
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
ptree
boost::property_tree::ptree ptree
Definition: JsonFileLoader.cxx:16
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
IdDictManager
IdDictManager is the interface to identifier dictionaries.
Definition: IdDictManager.h:36
TRTRadiatorParameters
Definition: TRTRadiatorParameters.h:12
python.PyAthena.v
v
Definition: PyAthena.py:154
AthMessaging::m_nm
std::string m_nm
Message source name.
Definition: AthMessaging.h:129
TRRegionXMLHandler::m_storeGate
StoreGateSvc * m_storeGate
Definition: TRRegionXMLHandler.h:21
CaloCondBlobAlgs_fillNoiseFromASCII.tag
string tag
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:24
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
python.SystemOfUnits.rad
int rad
Definition: SystemOfUnits.py:111