ATLAS Offline Software
Loading...
Searching...
No Matches
IDTPM2::IPlotBase Class Referenceabstract

#include <IPlotBase.h>

Inheritance diagram for IDTPM2::IPlotBase:
Collaboration diagram for IDTPM2::IPlotBase:

Public Member Functions

 IPlotBase (const std::string &name, ToolHandle< GenericMonitoringTool > *m=0)
 built from dirName and anaTag
virtual ~IPlotBase ()=default
virtual void initialize ()=0
 Book the histograms.
virtual void finalize ()=0
 Finalize resolution and bias histograms should be called from the calling montools stop() method.
virtual void execute (const TrackAnalysisStore &) const =0
 this can be over ridden if need be
const std::string & name () const
 generic utilities, just in case
ToolHandle< GenericMonitoringTool > * monTool ()
 mon tool
const ToolHandle< GenericMonitoringTool > * monTool () const
void set_monTool (ToolHandle< GenericMonitoringTool > *m)
 do we need / should we have this specific setter ??
std::string realPath (const std::string &tag="")
 This is a horrific function, has to get ALL the histograms, just to be able to work out how to get the actual path to the histograms for this tool - there simply MUST be a better way ...
bool msgLvl (const MSG::Level lvl) const
 Test the output level.
MsgStream & msg () const
 The standard message stream.
MsgStream & msg (const MSG::Level lvl) const
 The standard message stream.
void setLevel (MSG::Level lvl)
 Change the current logging level.

Static Public Member Functions

template<typename Derived>
static std::unique_ptr< IPlotBase > create (const std::string &name, ToolHandle< GenericMonitoringTool > *m)
 factory creation mathod

Protected Member Functions

void copyHist (TH1 *hsrc, TH1 *hdest, bool copyoverflow=true) const
 resolution porocessing stuff these don't really even need to be class functions, they could be simply utility functions
void getHist (const std::string &hname, TH1 *hsrc)
void processResolution (const std::string &path, bool writeflag=false)
void getHist (ServiceHandle< ITHistSvc > &histsvc, const std::string &hname, TH1 *hsrc) const
void processResolution (ServiceHandle< ITHistSvc > &histsvc, const std::string &path, bool writeflag=false) const
virtual ServiceHandle< ITHistSvc > & histSvc ()
 we may well need these at some point ...

Protected Attributes

const std::string & m_name
ToolHandle< GenericMonitoringTool > * m_monTool

Private Member Functions

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

Private Attributes

std::string m_nm
 Message source name.
boost::thread_specific_ptr< MsgStream > m_msg_tls
 MsgStream instance (a std::cout like with print-out levels).
std::atomic< IMessageSvc * > m_imsg { nullptr }
 MessageSvc pointer.
std::atomic< MSG::Level > m_lvl { MSG::NIL }
 Current logging level.
std::atomic_flag m_initialized ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
 Messaging initialized (initMessaging).

Detailed Description

Definition at line 36 of file IPlotBase.h.

Constructor & Destructor Documentation

◆ IPlotBase()

IDTPM2::IPlotBase::IPlotBase ( const std::string & name,
ToolHandle< GenericMonitoringTool > * m = 0 )
inline

built from dirName and anaTag

Definition at line 41 of file IPlotBase.h.

43 { }
AthMessaging()
Default constructor:
const std::string & m_name
Definition IPlotBase.h:114
ToolHandle< GenericMonitoringTool > * m_monTool
Definition IPlotBase.h:116
const std::string & name() const
generic utilities, just in case
Definition IPlotBase.h:68

◆ ~IPlotBase()

virtual IDTPM2::IPlotBase::~IPlotBase ( )
virtualdefault

Member Function Documentation

◆ copyHist()

void IDTPM2::IPlotBase::copyHist ( TH1 * hsrc,
TH1 * hdest,
bool copyoverflow = true ) const
protected

resolution porocessing stuff these don't really even need to be class functions, they could be simply utility functions

Definition at line 20 of file IPlotBase.cxx.

20 {
21
22 if ( hsrc->GetNbinsX()!=hdest->GetNbinsX() ) return; // do we want to give an error message ?? throw and exception ??
23
24 int imin = 0;
25 int imax = hsrc->GetNbinsX()+1;
26
27 if ( !copyoverflow ) {
28 imin = 1;
29 imax = hsrc->GetNbinsX();
30 }
31
32 for ( int i=imin ; i<=imax ; i++ ) {
33 hdest->SetBinContent( i, hsrc->GetBinContent(i) );
34 hdest->SetBinError( i, hsrc->GetBinError(i) );
35 }
36
37 hdest->SetEntries( hsrc->GetEntries() );
38}
int imax(int i, int j)

◆ create()

template<typename Derived>
std::unique_ptr< IPlotBase > IDTPM2::IPlotBase::create ( const std::string & name,
ToolHandle< GenericMonitoringTool > * m )
inlinestatic

factory creation mathod

Definition at line 50 of file IPlotBase.h.

51 {
52 return std::make_unique<Derived>( name, m );
53 }

◆ execute()

virtual void IDTPM2::IPlotBase::execute ( const TrackAnalysisStore & ) const
pure virtual

◆ finalize()

virtual void IDTPM2::IPlotBase::finalize ( )
pure virtual

Finalize resolution and bias histograms should be called from the calling montools stop() method.

Implemented in IDTPM2::Efficiencies, IDTPM2::Resolutions, IDTPM2::SiHitPlots, IDTPM2::Tier0, IDTPM2::TrackParameters, IDTPM2::TRTPlots, and IDTPM2::VertexPlots.

◆ getHist() [1/2]

void IDTPM2::IPlotBase::getHist ( const std::string & hname,
TH1 * hsrc )
inlineprotected

Definition at line 88 of file IPlotBase.h.

88{ return getHist( histSvc(), hname, hsrc ); }
void getHist(const std::string &hname, TH1 *hsrc)
Definition IPlotBase.h:88
virtual ServiceHandle< ITHistSvc > & histSvc()
we may well need these at some point ...
Definition IPlotBase.h:105

◆ getHist() [2/2]

void IDTPM2::IPlotBase::getHist ( ServiceHandle< ITHistSvc > & histsvc,
const std::string & hname,
TH1 * hsrc ) const
protected

Definition at line 42 of file IPlotBase.cxx.

42 {
43 TH1* h = 0;
44 if ( histsvc->getHist( hname, h ).isFailure() ) MY_MSG_WARNING << "Could not retieve histogram: " << hname << endmsg;
45 else copyHist( hsrc, h );
46}
#define endmsg
#define MY_MSG_WARNING
Definition MsgMacros.h:23
void copyHist(TH1 *hsrc, TH1 *hdest, bool copyoverflow=true) const
resolution porocessing stuff these don't really even need to be class functions, they could be simply...
Definition IPlotBase.cxx:20
histsvc
TrigInDetMonitoring part ################################.

◆ histSvc()

virtual ServiceHandle< ITHistSvc > & IDTPM2::IPlotBase::histSvc ( )
inlineprotectedvirtual

we may well need these at some point ...

this method is dangerous - should not be used anywhere except finalise or stop

Definition at line 105 of file IPlotBase.h.

105 {
106 if ( monTool()==0 ) throw std::runtime_error("IPlotBase: monTool not set");
107 return (*monTool())->histogramService();
108 }
ToolHandle< GenericMonitoringTool > * monTool()
mon tool
Definition IPlotBase.h:71

◆ initialize()

virtual void IDTPM2::IPlotBase::initialize ( )
pure virtual

◆ 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 // If user did not set an explicit level, set a default
43 if (m_lvl == MSG::NIL) {
44 m_lvl = m_imsg ?
45 static_cast<MSG::Level>( m_imsg.load()->outputLevel(m_nm) ) :
46 MSG::INFO;
47 }
48}
std::string m_nm
Message source name.
std::atomic< IMessageSvc * > m_imsg
MessageSvc pointer.
std::atomic< MSG::Level > m_lvl
Current logging level.
IMessageSvc * getMessageSvc(bool quiet=false)
int outputLevel(const IMessageSvc *ims, const std::string &source)

◆ monTool() [1/2]

ToolHandle< GenericMonitoringTool > * IDTPM2::IPlotBase::monTool ( )
inline

mon tool

Definition at line 71 of file IPlotBase.h.

71{ return m_monTool; }

◆ monTool() [2/2]

const ToolHandle< GenericMonitoringTool > * IDTPM2::IPlotBase::monTool ( ) const
inline

Definition at line 73 of file IPlotBase.h.

73{ return m_monTool; }

◆ 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 167 of file AthMessaging.h.

168{
169 MsgStream* ms = m_msg_tls.get();
170 if (!ms) {
171 if (!m_initialized.test_and_set()) initMessaging();
172 ms = new MsgStream(m_imsg,m_nm);
173 m_msg_tls.reset( ms );
174 }
175
176 ms->setLevel (m_lvl);
177 return *ms;
178}
boost::thread_specific_ptr< MsgStream > m_msg_tls
MsgStream instance (a std::cout like with print-out levels).
void initMessaging() const
Initialize our message level and MessageSvc.

◆ 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 182 of file AthMessaging.h.

183{ return msg() << lvl; }
MsgStream & msg() const
The standard message stream.

◆ 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 user did not set explicit message level we have to initialize
154 // the messaging and retrieve the default via the MessageSvc.
155 if (m_lvl==MSG::NIL && !m_initialized.test_and_set()) initMessaging();
156
157 if (m_lvl <= lvl) {
158 msg() << lvl;
159 return true;
160 } else {
161 return false;
162 }
163}

◆ name()

const std::string & IDTPM2::IPlotBase::name ( ) const
inline

generic utilities, just in case

Definition at line 68 of file IPlotBase.h.

68{ return m_name; }

◆ processResolution() [1/2]

void IDTPM2::IPlotBase::processResolution ( const std::string & path,
bool writeflag = false )
inlineprotected

Definition at line 89 of file IPlotBase.h.

89{ return processResolution( histSvc(), path, writeflag ); }
void processResolution(const std::string &path, bool writeflag=false)
Definition IPlotBase.h:89

◆ processResolution() [2/2]

void IDTPM2::IPlotBase::processResolution ( ServiceHandle< ITHistSvc > & histsvc,
const std::string & path,
bool writeflag = false ) const
protected

process the histogramss NB: might be better if instead of adding the 2D histogram and then copying the 1D hjistograms back, we passed in the 1D histogram pointers and filled them directly in the Resplot

use the provides 1D, maan, sigme histograms etc would like to do this ...

use the provides 1D, maan, sigme histograms etc

Definition at line 49 of file IPlotBase.cxx.

49 {
50
51 TH2* hist2d = 0;
52
53 if ( histsvc->getHist( path+"2D", hist2d ).isFailure() ) MY_MSG_WARNING << "Could not retieve 2D: " << (path+"2D") << endmsg;
54 else {
55
60
61 Resplot::Resplot rp( path, hist2d );
62
63 rp.Finalise( Resplot::FitNull95 );
64
65 if ( !writeflag ) {
68 // if ( histsvc->regHist( path+"1D", rp.H1D() ).isFailure() ) MY_MSG_WARNING << "Unable to register histogram: 1D: " << name() << endmsg;
69 // if ( histsvc->regHist( path+"mean", rp.Mean() ).isFailure() ) MY_MSG_WARNING << "Unable to register histogram: mean: " << name() << endmsg;
70 // if ( histsvc->regHist( path+"sigma", rp.Sigma() ).isFailure() ) MY_MSG_WARNING << "Unable to register histogram: sigma: " << name() << endmsg;
71 // }
72 // else {
74 getHist( histsvc, path+"1D", rp.H1D() );
75 getHist( histsvc, path+"mean", rp.Mean() );
76 getHist( histsvc, path+"sigma", rp.Sigma() );
77 }
78 }
79
80}
ReadCards * rp
TF1 * FitNull95(TH1D *s, double a=0, double b=0)
Definition Resplot.cxx:1472
path
python interpreter configuration --------------------------------------—
Definition athena.py:130

◆ realPath()

std::string IDTPM2::IPlotBase::realPath ( const std::string & tag = "")

This is a horrific function, has to get ALL the histograms, just to be able to work out how to get the actual path to the histograms for this tool - there simply MUST be a better way ...

can add on our "fixed" histogram "Vertex" domain

Definition at line 86 of file IPlotBase.cxx.

86 {
87
88 std::string dir = (*monTool())->getPath();
89
91 std::string stub = dir.substr( dir.find('/', 1) + 1 ) + tag;
92
93 const std::vector<std::string>& allhists = histSvc()->getHists();
94
95 std::string basestr = "";
96
97 for ( size_t i=0 ; i<allhists.size() ; i++ ) {
98 if ( allhists[i].find(stub)!=std::string::npos ) {
99 std::string s = allhists[i];
100 basestr = s.substr(0,s.find("/"+stub)+1);
101 break;
102 }
103 }
104
105 return basestr + stub;
106
107}
bool allhists
Definition hcg.cxx:81
std::string find(const std::string &s)
return a remapped string
Definition hcg.cxx:140

◆ set_monTool()

void IDTPM2::IPlotBase::set_monTool ( ToolHandle< GenericMonitoringTool > * m)
inline

do we need / should we have this specific setter ??

Definition at line 76 of file IPlotBase.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}

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.

135{ nullptr };

◆ m_lvl

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

Current logging level.

Definition at line 138 of file AthMessaging.h.

138{ MSG::NIL };

◆ m_monTool

ToolHandle<GenericMonitoringTool>* IDTPM2::IPlotBase::m_monTool
protected

Definition at line 116 of file IPlotBase.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_name

const std::string& IDTPM2::IPlotBase::m_name
protected

Definition at line 114 of file IPlotBase.h.

◆ m_nm

std::string AthMessaging::m_nm
privateinherited

Message source name.

Definition at line 129 of file AthMessaging.h.


The documentation for this class was generated from the following files: