ATLAS Offline Software
Loading...
Searching...
No Matches
AnalysisR4.h
Go to the documentation of this file.
1/* emacs: this is -*- c++ -*- */
12
13
14#ifndef IDTPM2_AnalysisR4_H
15#define IDTPM2_AnalysisR4_H
16
17#include "GaudiKernel/ToolHandle.h"
19
22
23#include "TrackAnalysisStore.h"
24
25#include "IPlotBase.h"
26
27#include <map>
28#include <stdexcept>
29
30
31namespace IDTPM2 {
32
34
35public:
36
37 AnalysisR4(const std::string& name);
38
39 virtual void initialise();
40
41 virtual void execute( TrackAnalysisStore& collections ) const;
42
43 virtual void finalize();
44
45 const std::string& name() const { return m_name; }
46
47 void set_monTool( ToolHandle<GenericMonitoringTool>* m ) { m_monTool=m; }
48
49 ToolHandle<GenericMonitoringTool>* monTool() { return m_monTool; }
50
53 void addFillTool( const std::string& toolname ) { m_tools.emplace_back( create( toolname ) ); }
54
55protected:
56
58
59 std::unique_ptr<IPlotBase> create( const std::string& key ) {
60 std::map<std::string, FactoryFn>::const_iterator itr = m_factory.find(key);
61 if (itr == m_factory.end()) throw std::runtime_error("IPlotBase Factory: No class of type " + key );
62 return itr->second( key+"-"+name(), monTool() );
63 }
64
65
66protected:
67
69
70 using FactoryFn = std::unique_ptr<IPlotBase>(*)( const std::string&, ToolHandle<GenericMonitoringTool>* );
71
73 void registerCreator( const std::string& key, FactoryFn builder ) {
74 m_factory.insert( std::map<std::string, FactoryFn>::value_type( key, builder ) );
75 }
76
84 std::map<std::string, FactoryFn> m_factory;
85
86private:
87
88 std::string m_name;
89
91 ToolHandle<GenericMonitoringTool>* m_monTool;
92
94 std::vector<std::unique_ptr<IPlotBase>> m_tools;
95
96};
97
98}
99
100#endif // IDTPM2_AnalysisR4_H
emacs: this is -* c++ -*-
emacs: this is -*- c++ -*-
AnalysisR4(const std::string &name)
ToolHandle< GenericMonitoringTool > * m_monTool
the parent montool
Definition AnalysisR4.h:91
std::vector< std::unique_ptr< IPlotBase > > m_tools
the tool children
Definition AnalysisR4.h:94
void registerCreator(const std::string &key, FactoryFn builder)
do we want this to be public ??
Definition AnalysisR4.h:73
virtual void initialise()
std::string m_name
Definition AnalysisR4.h:88
ToolHandle< GenericMonitoringTool > * monTool()
Definition AnalysisR4.h:49
const std::string & name() const
Definition AnalysisR4.h:45
std::unique_ptr< IPlotBase > create(const std::string &key)
factory stuff ..
Definition AnalysisR4.h:59
void set_monTool(ToolHandle< GenericMonitoringTool > *m)
Definition AnalysisR4.h:47
std::map< std::string, FactoryFn > m_factory
initialise the factory in the constructor, so the header does not need to be modified to add a tool A...
Definition AnalysisR4.h:84
std::unique_ptr< IPlotBase >(*)(const std::string &, ToolHandle< GenericMonitoringTool > *) FactoryFn
factory stuff ..
Definition AnalysisR4.h:70
virtual void finalize()
virtual void execute(TrackAnalysisStore &collections) const
void addFillTool(const std::string &toolname)
add a fill tool = this is called from the parent class, otherwise there are no fill tools booked
Definition AnalysisR4.h:53
Search the ancestor history, looking for an ancestor that satifies the predicate ....
Definition AnalysisR4.h:31