ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
StandaloneL1TopoHistSvc::StandaloneL1TopoHistSvcImpl Class Reference
Inheritance diagram for StandaloneL1TopoHistSvc::StandaloneL1TopoHistSvcImpl:
Collaboration diagram for StandaloneL1TopoHistSvc::StandaloneL1TopoHistSvcImpl:

Public Member Functions

 StandaloneL1TopoHistSvcImpl ()
 
 ~StandaloneL1TopoHistSvcImpl ()
 
void registerHist (TH1 *h)
 
void registerHist (TH2 *h)
 
TH1 * findHist (const std::string &histName)
 
void fillHist1D (const std::string &histName, double x)
 
void fillHist2D (const std::string &histName, double x, double y)
 
void setBaseDir (const std::string &baseDir)
 
void save ()
 
bool msgLvl (const MSGTC::Level lvl) const
 Test the output level. More...
 
MsgStreamTC & msg () const
 The standard message stream. More...
 
MsgStreamTC & msg (const MSGTC::Level lvl) const
 The standard message stream. More...
 

Private Attributes

std::map< std::string, TH1 * > m_hists1D
 
std::map< std::string, TH2 * > m_hists2D
 
std::string m_baseDir {""}
 
boost::thread_specific_ptr< MsgStreamTC > m_msg_tls
 MsgStreamTC instance (a std::cout like with print-out levels) More...
 
std::string m_name
 

Detailed Description

Definition at line 15 of file StandaloneL1TopoHistSvc.cxx.

Constructor & Destructor Documentation

◆ StandaloneL1TopoHistSvcImpl()

StandaloneL1TopoHistSvc::StandaloneL1TopoHistSvcImpl::StandaloneL1TopoHistSvcImpl ( )
inline

Definition at line 19 of file StandaloneL1TopoHistSvc.cxx.

19  :
20  TrigConfMessaging("StandaloneL1TopoHistSvc")
21  {}

◆ ~StandaloneL1TopoHistSvcImpl()

StandaloneL1TopoHistSvc::StandaloneL1TopoHistSvcImpl::~StandaloneL1TopoHistSvcImpl ( )
inline

Definition at line 23 of file StandaloneL1TopoHistSvc.cxx.

23  {
24  for( auto h : m_hists1D ) {
25  delete h.second;
26  }
27  for( auto h : m_hists2D ) {
28  delete h.second;
29  }
30  }

Member Function Documentation

◆ fillHist1D()

void StandaloneL1TopoHistSvc::StandaloneL1TopoHistSvcImpl::fillHist1D ( const std::string &  histName,
double  x 
)
inline

Definition at line 69 of file StandaloneL1TopoHistSvc.cxx.

69  {
70  auto h = m_hists1D.find(histName);
71  if( h == end(m_hists1D) ) {
72  TRG_MSG_WARNING("No histogram found for " << histName);
73  } else
74  h->second->Fill(x);
75  }

◆ fillHist2D()

void StandaloneL1TopoHistSvc::StandaloneL1TopoHistSvcImpl::fillHist2D ( const std::string &  histName,
double  x,
double  y 
)
inline

Definition at line 77 of file StandaloneL1TopoHistSvc.cxx.

77  {
78  auto h = m_hists2D.find(histName);
79  if( h == end(m_hists2D) ) {
80  TRG_MSG_WARNING("No histogram found for " << histName);
81  } else
82  h->second->Fill(x,y);
83  }

◆ findHist()

TH1* StandaloneL1TopoHistSvc::StandaloneL1TopoHistSvcImpl::findHist ( const std::string &  histName)
inline

Definition at line 58 of file StandaloneL1TopoHistSvc.cxx.

58  {
59  auto colPos = histName.find_first_of('/');
60  std::string realhistName = histName.substr(colPos+1);
61  auto h = m_hists1D.find(realhistName);
62  if( h == end(m_hists1D) ) {
63  return nullptr;
64  } else {
65  return h->second;
66  }
67  }

◆ msg() [1/2]

MsgStreamTC & TrigConf::TrigConfMessaging::msg ( ) const
inlineinherited

The standard message stream.

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

Definition at line 81 of file TrigConfMessaging.h.

82  {
83  MsgStreamTC* ms = m_msg_tls.get();
84  if (!ms) {
85  ms = new MsgStreamTC(m_name);
86  m_msg_tls.reset(ms);
87  }
88  return *ms;
89  }

◆ msg() [2/2]

MsgStreamTC & TrigConf::TrigConfMessaging::msg ( const MSGTC::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 91 of file TrigConfMessaging.h.

92  {
93  return msg() << lvl;
94  }

◆ msgLvl()

bool TrigConf::TrigConfMessaging::msgLvl ( const MSGTC::Level  lvl) const
inlineinherited

Test the output level.

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

Definition at line 70 of file TrigConfMessaging.h.

71  {
72  if (msg().level() <= lvl) {
73  msg() << lvl;
74  return true;
75  }
76  else {
77  return false;
78  }
79  }

◆ registerHist() [1/2]

void StandaloneL1TopoHistSvc::StandaloneL1TopoHistSvcImpl::registerHist ( TH1 *  h)
inline

Definition at line 32 of file StandaloneL1TopoHistSvc.cxx.

32  {
33  if(h != nullptr) {
34  TRG_MSG_DEBUG("Registering histogram " << h->GetName());
35  const std::string key = h->GetName();
36  if( m_hists1D.find(key) == end(m_hists1D) ) {
37  m_hists1D[key] = h;
38  } else {
39  TRG_MSG_WARNING("StandaloneL1TopoHistSvc::registerHist: a histogram " << key << " exists already. Will keep the first one and delete the newly requested.");
40  delete h;
41  }
42  }
43  }

◆ registerHist() [2/2]

void StandaloneL1TopoHistSvc::StandaloneL1TopoHistSvcImpl::registerHist ( TH2 *  h)
inline

Definition at line 45 of file StandaloneL1TopoHistSvc.cxx.

45  {
46  if(h != nullptr) {
47  TRG_MSG_DEBUG("Registering histogram " << h->GetName());
48  const std::string key = h->GetName();
49  if( m_hists2D.find(key) == end(m_hists2D) ) {
50  m_hists2D[key] = h;
51  } else {
52  TRG_MSG_WARNING("StandaloneL1TopoHistSvc::registerHist: a histogram " << key << " exists already. Will keep the first one and delete the newly requested.");
53  delete h;
54  }
55  }
56  }

◆ save()

void StandaloneL1TopoHistSvc::StandaloneL1TopoHistSvcImpl::save ( )
inline

Definition at line 89 of file StandaloneL1TopoHistSvc.cxx.

89  {
90 
91  std::string filename = "L1Topo.root";
92  std::string basepath = "";
93 
94  std::string opt = "RECREATE";
95 
96  auto colPos = m_baseDir.find_last_of(':');
97  if( colPos != std::string::npos ) {
98  filename = m_baseDir.substr(0, colPos);
99  basepath = m_baseDir.substr(colPos+1);
100  } else {
102  }
103 
104 
105  TFile * f = TFile::Open(filename.c_str(),opt.c_str());
106  for( auto h : m_hists1D ) {
107 
108  std::string fullName(h.second->GetName());
109  std::string path(basepath);
110 
111  auto slashPos = fullName.find_last_of('/');
112  if(slashPos != std::string::npos) {
113  if(path!="")
114  path += "/";
115  path += fullName.substr(0,slashPos);
116  // set the name
117  h.second->SetName( fullName.substr(slashPos+1).c_str() );
118  }
119 
120  const char* dir = path.c_str();
121  if( ! f->GetDirectory(dir)) {
122  f->mkdir(dir);
123  }
124  f->cd(dir);
125  h.second->Write();
126  }
127  for( auto h : m_hists2D ) {
128 
129  std::string fullName(h.second->GetName());
130  std::string path(basepath);
131 
132  auto slashPos = fullName.find_last_of('/');
133  if(slashPos != std::string::npos) {
134  if(path!="")
135  path += "/";
136  path += fullName.substr(0,slashPos);
137  // set the name
138  h.second->SetName( fullName.substr(slashPos+1).c_str() );
139  }
140 
141  const char* dir = path.c_str();
142  if( ! f->GetDirectory(dir)) {
143  f->mkdir(dir);
144  }
145  f->cd(dir);
146  h.second->Write();
147  }
148  f->Write();
149  f->Close();
150  TRG_MSG_INFO("Wrote " << m_hists1D.size()+m_hists2D.size() << " l1topo algorithm histograms to file " << filename);
151  }

◆ setBaseDir()

void StandaloneL1TopoHistSvc::StandaloneL1TopoHistSvcImpl::setBaseDir ( const std::string &  baseDir)
inline

Definition at line 85 of file StandaloneL1TopoHistSvc.cxx.

85  {
86  m_baseDir = baseDir;
87  }

Member Data Documentation

◆ m_baseDir

std::string StandaloneL1TopoHistSvc::StandaloneL1TopoHistSvcImpl::m_baseDir {""}
private

Definition at line 157 of file StandaloneL1TopoHistSvc.cxx.

◆ m_hists1D

std::map<std::string,TH1*> StandaloneL1TopoHistSvc::StandaloneL1TopoHistSvcImpl::m_hists1D
private

Definition at line 155 of file StandaloneL1TopoHistSvc.cxx.

◆ m_hists2D

std::map<std::string,TH2*> StandaloneL1TopoHistSvc::StandaloneL1TopoHistSvcImpl::m_hists2D
private

Definition at line 156 of file StandaloneL1TopoHistSvc.cxx.

◆ m_msg_tls

boost::thread_specific_ptr<MsgStreamTC> TrigConf::TrigConfMessaging::m_msg_tls
mutableprivateinherited

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

Definition at line 66 of file TrigConfMessaging.h.

◆ m_name

std::string TrigConf::TrigConfMessaging::m_name
privateinherited

Definition at line 67 of file TrigConfMessaging.h.


The documentation for this class was generated from the following file:
athena.path
path
python interpreter configuration --------------------------------------—
Definition: athena.py:128
AddEmptyComponent.histName
string histName
Definition: AddEmptyComponent.py:64
TrigConf::TrigConfMessaging::m_msg_tls
boost::thread_specific_ptr< MsgStreamTC > m_msg_tls
MsgStreamTC instance (a std::cout like with print-out levels)
Definition: TrigConfMessaging.h:66
make_coralServer_rep.opt
opt
Definition: make_coralServer_rep.py:19
WriteCellNoiseToCool.fullName
fullName
Definition: WriteCellNoiseToCool.py:461
StandaloneL1TopoHistSvc::StandaloneL1TopoHistSvcImpl::m_baseDir
std::string m_baseDir
Definition: StandaloneL1TopoHistSvc.cxx:157
x
#define x
python.SystemOfUnits.ms
int ms
Definition: SystemOfUnits.py:132
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
python.iconfTool.models.loaders.level
level
Definition: loaders.py:20
TrigConf::TrigConfMessaging::m_name
std::string m_name
Definition: TrigConfMessaging.h:67
TrigConf::TrigConfMessaging::msg
MsgStreamTC & msg() const
The standard message stream.
Definition: TrigConfMessaging.h:81
extractSporadic.h
list h
Definition: extractSporadic.py:97
TrigConf::TrigConfMessaging::TrigConfMessaging
TrigConfMessaging()=delete
hist_file_dump.f
f
Definition: hist_file_dump.py:135
StandaloneL1TopoHistSvc::StandaloneL1TopoHistSvcImpl::m_hists2D
std::map< std::string, TH2 * > m_hists2D
Definition: StandaloneL1TopoHistSvc.cxx:156
StandaloneL1TopoHistSvc::StandaloneL1TopoHistSvcImpl::m_hists1D
std::map< std::string, TH1 * > m_hists1D
Definition: StandaloneL1TopoHistSvc.cxx:155
TRG_MSG_INFO
#define TRG_MSG_INFO(x)
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStreamMacros.h:27
beamspotman.dir
string dir
Definition: beamspotman.py:623
beamspotman.basepath
string basepath
Definition: beamspotman.py:1018
TRG_MSG_WARNING
#define TRG_MSG_WARNING(x)
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStreamMacros.h:28
y
#define y
h
CaloCellTimeCorrFiller.filename
filename
Definition: CaloCellTimeCorrFiller.py:24
TRG_MSG_DEBUG
#define TRG_MSG_DEBUG(x)
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStreamMacros.h:25
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37