ATLAS Offline Software
Loading...
Searching...
No Matches
IDTPM2::TrackParameters Class Reference

#include <TrackParameters.h>

Inheritance diagram for IDTPM2::TrackParameters:
Collaboration diagram for IDTPM2::TrackParameters:

Classes

struct  ParHistograms

Public Member Functions

 TrackParameters (const std::string &name, ToolHandle< GenericMonitoringTool > *m)
 local include(s)
virtual ~TrackParameters ()=default
 Destructor.
void initialize ()
 Book the histograms.
void execute (const TrackAnalysisStore &collections) const
 this can be over ridden if need be
void finalize ()
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 getHist (ServiceHandle< ITHistSvc > &histsvc, const std::string &hname, TH1 *hsrc) const
void processResolution (const std::string &path, bool writeflag=false)
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

ParHistograms m_reference
ParHistograms m_test
TIDA::Histogram< float > m_invmass
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

Constructor & Destructor Documentation

◆ TrackParameters()

IDTPM2::TrackParameters::TrackParameters ( const std::string & name,
ToolHandle< GenericMonitoringTool > * m )

local include(s)

Definition at line 14 of file Trigger/TrigMonitoring/TrigIDR4Monitoring/src/TrackParameters.cxx.

15 : IPlotBase( name, m )
16{ }
const std::string & name() const
generic utilities, just in case
Definition IPlotBase.h:68
IPlotBase(const std::string &name, ToolHandle< GenericMonitoringTool > *m=0)
built from dirName and anaTag
Definition IPlotBase.h:41

◆ ~TrackParameters()

virtual IDTPM2::TrackParameters::~TrackParameters ( )
virtualdefault

Destructor.

Member Function Documentation

◆ copyHist()

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

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 )
inlinestaticinherited

factory creation mathod

Definition at line 50 of file IPlotBase.h.

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

◆ execute()

void IDTPM2::TrackParameters::execute ( const TrackAnalysisStore & collections) const
virtual

this can be over ridden if need be

do we want the matched tracks as well ?? it would be trivial to add them, or add them instead of the full set of test tracks, ie only the test tracks with a refernce match - that would be only about four extra lines.

could put this in the loop over the reference objects, but then it would call hasTagNProbe() and if (tnp) for every reference track, and even for non tag-n-probe analyses - the beuaty of using execute() methods rather than fill methods for individual tracks all called from a single restrictive loop over the tracks

Implements IDTPM2::IPlotBase.

Definition at line 90 of file Trigger/TrigMonitoring/TrigIDR4Monitoring/src/TrackParameters.cxx.

90 {
91
92 const std::vector<const TrackView*>& ref = collections.reference_tracks();
93 const std::vector<const TrackView*>& test = collections.test_tracks();
94
98
99 for ( size_t i=0 ; i<ref.size() ; i++ ) m_reference.fill( ref[i] );
100 for ( size_t i=0 ; i<test.size() ; i++ ) m_test.fill( test[i] );
101
107
108 if ( collections.hasTagNProbe() ) {
109 for ( size_t i=0 ; i<ref.size() ; i++ ) {
110 std::vector<double> masses = collections.tagNProbe()->masses( ref[i] );
111 for ( size_t j=masses.size() ; j-- ; ) m_invmass.Fill( masses[i] );
112 }
113 }
114
115}
const std::regex ref(r_ef)

◆ finalize()

void IDTPM2::TrackParameters::finalize ( )
virtual

--— finalizePlots --—

Implements IDTPM2::IPlotBase.

Definition at line 227 of file Trigger/TrigMonitoring/TrigIDR4Monitoring/src/TrackParameters.cxx.

227{ MY_MSG_DEBUG << "Finalising track parameters plots" << endmsg; }
#define endmsg
#define MY_MSG_DEBUG
Definition MsgMacros.h:25

◆ getHist() [1/2]

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

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
protectedinherited

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 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 ( )
inlineprotectedvirtualinherited

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()

void IDTPM2::TrackParameters::initialize ( )
virtual

Book the histograms.

Implements IDTPM2::IPlotBase.

Definition at line 19 of file Trigger/TrigMonitoring/TrigIDR4Monitoring/src/TrackParameters.cxx.

19 {
20 MY_MSG_DEBUG << "Booking track parameters plots in " << name() << endmsg;
21 m_reference.initialize( this, "reference" );
22 m_test.initialize( this, "test" );
23
24 m_invmass = TIDA::Histogram<float>( monTool(), "invmass" );
25}

◆ 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 ( )
inlineinherited

mon tool

Definition at line 71 of file IPlotBase.h.

71{ return m_monTool; }
ToolHandle< GenericMonitoringTool > * m_monTool
Definition IPlotBase.h:116

◆ monTool() [2/2]

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

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
inlineinherited

generic utilities, just in case

Definition at line 68 of file IPlotBase.h.

68{ return m_name; }
const std::string & m_name
Definition IPlotBase.h:114

◆ processResolution() [1/2]

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

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
protectedinherited

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 = "")
inherited

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)
inlineinherited

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_invmass

TIDA::Histogram<float> IDTPM2::TrackParameters::m_invmass
private

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

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
protectedinherited

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.

◆ m_reference

ParHistograms IDTPM2::TrackParameters::m_reference
private

◆ m_test

ParHistograms IDTPM2::TrackParameters::m_test
private

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