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
 
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  m_storeGate(nullptr),
37 {}

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 39 of file TRRegionXMLHandler.cxx.

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

◆ 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
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
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
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
AthMessaging::AthMessaging
AthMessaging()
Default constructor:
StoreGateSvc
The Athena Transient Store API.
Definition: StoreGateSvc.h:128
TrigConf::MSGTC::Level
Level
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:21
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
TRTTransitionRadiation::AddRadiatorParameters
void AddRadiatorParameters(TRTRadiatorParameters p)
Definition: TRTTransitionRadiation.cxx:81
TRRegionXMLHandler::m_initialLayoutIdDict
bool m_initialLayoutIdDict
Definition: TRRegionXMLHandler.h:22
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.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:195
IdDictManager
IdDictManager is the interface to identifier dictionaries.
Definition: IdDictManager.h:36
TRTRadiatorParameters
Definition: TRTRadiatorParameters.h:12
python.PyAthena.v
v
Definition: PyAthena.py:157
AthMessaging::m_nm
std::string m_nm
Message source name.
Definition: AthMessaging.h:129
IdDictManager::manager
const IdDictMgr * manager(void) const
Definition: IdDictManager.cxx:37
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
IdDictMgr::tag
const std::string & tag() const
Version tag.
Definition: IdDictMgr.cxx:92
python.SystemOfUnits.rad
int rad
Definition: SystemOfUnits.py:111