ATLAS Offline Software
Loading...
Searching...
No Matches
IPlotBase.h
Go to the documentation of this file.
1/* emacs: this is -*- c++ -*- */
13
14
15#ifndef IDTPM2_IPLOTBASE_H
16#define IDTPM2_IPLOTBASE_H
17
18#include "GaudiKernel/ToolHandle.h"
19#include "GaudiKernel/ServiceHandle.h"
20
24
26
27#include "TrackAnalysisStore.h"
28
29#include <memory>
30#include <string>
31#include <stdexcept>
32
33
34namespace IDTPM2 {
35
36class IPlotBase : public AthMessaging {
37
38public:
39
41 IPlotBase( const std::string& name, ToolHandle<GenericMonitoringTool>* m=0 )
43 { }
44
45 virtual ~IPlotBase() = default;
46
47
49 template<typename Derived>
50 static std::unique_ptr<IPlotBase> create( const std::string& name,
51 ToolHandle<GenericMonitoringTool>* m ) {
52 return std::make_unique<Derived>( name, m );
53 }
54
56 virtual void initialize() = 0; // needed to override IPlotBase
57
61 virtual void finalize() = 0;
62
64 virtual void execute( const TrackAnalysisStore& /* collections */ ) const=0;
65
67
68 const std::string& name() const { return m_name; }
69
71 ToolHandle<GenericMonitoringTool>* monTool() { return m_monTool; }
72
73 const ToolHandle<GenericMonitoringTool>* monTool() const { return m_monTool; }
74
76 void set_monTool( ToolHandle<GenericMonitoringTool>* m ) { m_monTool=m; }
77
78 std::string realPath( const std::string& tag="" );
79
80protected:
81
85
86 void copyHist( TH1* hsrc, TH1* hdest, bool copyoverflow=true ) const;
87
88 void getHist( const std::string& hname, TH1* hsrc ) { return getHist( histSvc(), hname, hsrc ); }
89 void processResolution( const std::string& path, bool writeflag=false){ return processResolution( histSvc(), path, writeflag ); }
90
91 void getHist( ServiceHandle<ITHistSvc>& histsvc, const std::string& hname, TH1* hsrc ) const;
92
93 void processResolution( ServiceHandle<ITHistSvc>& histsvc, const std::string& path, bool writeflag=false ) const;
94
96
97 // void binWidthNormalise( TH1* h ) const;
98
99 // void binWidthNormalise( ServiceHandle<ITHistSvc>& histsvc, const std::string& hname ) const;
100
101protected:
102
106 if ( monTool()==0 ) throw std::runtime_error("IPlotBase: monTool not set");
107 return (*monTool())->histogramService();
108 }
109
110
111
112protected:
113
114 const std::string& m_name;
115
116 ToolHandle<GenericMonitoringTool>* m_monTool;
117
118};
119
120
121}
122
123
124inline std::ostream& operator<<( std::ostream& s, const IDTPM2::IPlotBase& ) {
125 return s;
126}
127
128
129#endif // IDTPM2_IPLOTBASE_H
130
131
132
133
134
135
136
137
138
139
std::ostream & operator<<(std::ostream &s, const IDTPM2::IPlotBase &)
Definition IPlotBase.h:124
emacs: this is -* c++ -*-
emacs: this is -*- c++ -*-
AthMessaging(IMessageSvc *msgSvc, const std::string &name)
Constructor.
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
void getHist(const std::string &hname, TH1 *hsrc)
Definition IPlotBase.h:88
virtual void initialize()=0
Book the histograms.
void processResolution(const std::string &path, bool writeflag=false)
Definition IPlotBase.h:89
const std::string & m_name
Definition IPlotBase.h:114
ToolHandle< GenericMonitoringTool > * monTool()
mon tool
Definition IPlotBase.h:71
ToolHandle< GenericMonitoringTool > * m_monTool
Definition IPlotBase.h:116
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 th...
Definition IPlotBase.cxx:86
const ToolHandle< GenericMonitoringTool > * monTool() const
Definition IPlotBase.h:73
virtual void finalize()=0
Finalize resolution and bias histograms should be called from the calling montools stop() method.
const std::string & name() const
generic utilities, just in case
Definition IPlotBase.h:68
virtual ~IPlotBase()=default
virtual void execute(const TrackAnalysisStore &) const =0
this can be over ridden if need be
static std::unique_ptr< IPlotBase > create(const std::string &name, ToolHandle< GenericMonitoringTool > *m)
factory creation mathod
Definition IPlotBase.h:50
virtual ServiceHandle< ITHistSvc > & histSvc()
we may well need these at some point ...
Definition IPlotBase.h:105
void set_monTool(ToolHandle< GenericMonitoringTool > *m)
do we need / should we have this specific setter ??
Definition IPlotBase.h:76
IPlotBase(const std::string &name, ToolHandle< GenericMonitoringTool > *m=0)
built from dirName and anaTag
Definition IPlotBase.h:41
Search the ancestor history, looking for an ancestor that satifies the predicate ....
Definition AnalysisR4.h:31