ATLAS Offline Software
TrackAnalysis.h
Go to the documentation of this file.
1 /* emacs: this is -*- c++ -*- */
12 #ifndef TIDA_TRACKANALYSIS_H
13 #define TIDA_TRACKANALYSIS_H
14 
15 #include <iostream>
16 #include <vector>
17 #include <string>
18 #include <map>
19 
20 
28 
29 #include "TH1.h"
30 
31 
32 class TrackAnalysis {
33 
34 public:
35 
38  TrackAnalysis( const std::string& name ) :
39  m_name(name),
42  m_event(0), m_roi(0)
43  { }
44 
45  virtual ~TrackAnalysis() { }
46 
47  // no copy allowed/necessary
48  TrackAnalysis(const TrackAnalysis&) = delete;
50 
52  std::string name() const { return m_name; }
53 
55  virtual void initialise() = 0;
56 
57  virtual void execute( const std::vector<TIDA::Track*>& tracks1,
58  const std::vector<TIDA::Track*>& tracks2,
59  TrackAssociator* matcher ) = 0;
60 
61  virtual void execute( const std::vector<TIDA::Track*>& tracks1,
62  const std::vector<TIDA::Track*>& tracks2,
63  TrackAssociator* matcher,
64  TrigObjectMatcher* /* objects */ ) {
65  execute( tracks1, tracks2, matcher );
66  }
67 
68  virtual void execute( const std::vector<TIDA::Track*>& ,
69  const std::vector<TIDA::Track*>& ,
70  TrackAssociator* ,
71  const TIDA::Event* ) { }
72 
73  virtual void execute( const std::vector<TIDA::Track*>& tracks1,
74  const std::vector<TIDA::Track*>& tracks2,
75  TrackAssociator* matcher,
76  const TIDA::Event* event,
77  double* ) {
78  execute( tracks1, tracks2, matcher, event );
79  }
80 
81  virtual void execute( const std::vector<TIDA::Track*>& ,
82  const std::vector<TIDA::Track*>& ,
83  TrackAssociator* ,
84  const TIDA::Event* ,
85  double* ,
86  TIDARoiDescriptor* ) { }
87 
88 
89  virtual void execute_vtx( const std::vector<TIDA::Vertex*>& ,
90  const std::vector<TIDA::Vertex*>& ,
91  const TIDA::Event* =0 ) { }
92 
93 
94  virtual void finalise() = 0;
95 
96  // histogram map access - add a histogram
97  void addHistogram( TH1* h ) {
98  std::string name = h->GetName();
99  m_histos.insert( std::map<std::string, TH1*>::value_type( name, h) );
100  }
101 
103  const std::map<std::string, TH1*>& getHistograms() const { return m_histos; }
104 
105  std::map<std::string, TH1*>::const_iterator begin() const { return m_histos.begin(); }
106  std::map<std::string, TH1*>::const_iterator end() const { return m_histos.end(); }
107 
109  void setBeamRef( double x, double y, double z=0 ) { m_xBeamReference = x; m_yBeamReference = y; m_zBeamReference = z; }
110  void setBeamTest( double x, double y, double z=0 ) { m_xBeamTest = x; m_yBeamTest = y; m_zBeamTest = z; }
111 
112  void setBeamRef( const std::vector<double>& v ) {
113  if ( v.size()>0 ) m_xBeamReference = v[0];
114  if ( v.size()>1 ) m_yBeamReference = v[1];
115  if ( v.size()>2 ) m_zBeamReference = v[2];
116  }
117 
118  void setBeamTest( const std::vector<double>& v ) {
119  if ( v.size()>0 ) m_xBeamTest = v[0];
120  if ( v.size()>1 ) m_yBeamTest = v[1];
121  if ( v.size()>2 ) m_zBeamTest = v[2];
122  }
123 
124  double beamRefx() const { return m_xBeamReference; }
125  double beamRefy() const { return m_yBeamReference; }
126  double beamRefz() const { return m_zBeamReference; }
127 
128  double beamTestx() const { return m_xBeamTest; }
129  double beamTesty() const { return m_yBeamTest; }
130  double beamTestz() const { return m_zBeamTest; }
131 
132 
134 
135  const TIDA::Event* event() const { return m_event; }
137 
138  const TIDARoiDescriptor* roi() const { return m_roi; }
140 
141 protected:
142 
145  std::string m_name;
146 
149  std::map<std::string, TH1*> m_histos;
150 
156 
158  double m_xBeamTest;
159  double m_yBeamTest;
160  double m_zBeamTest;
161 
163 
166 
167 };
168 
169 
170 inline std::ostream& operator<<(std::ostream& s, const TrackAnalysis& ta) {
171  return s << ta.name();
172 }
173 
174 
175 #endif // TIDA_TRACKANALYSIS_H
176 
177 
178 
179 
180 
181 
182 
183 
184 
185 
TrackAnalysis::m_roi
TIDARoiDescriptor * m_roi
Definition: TrackAnalysis.h:165
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
TrackAnalysis::setBeamRef
void setBeamRef(const std::vector< double > &v)
Definition: TrackAnalysis.h:112
TrackAnalysis::setBeamTest
void setBeamTest(double x, double y, double z=0)
Definition: TrackAnalysis.h:110
beamspotman.r
def r
Definition: beamspotman.py:676
TrackAnalysis::initialise
virtual void initialise()=0
standard operation interface
TIDA::Associator
Definition: TIDAAssociator.h:24
Track.h
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
TrackAnalysis::beamTesty
double beamTesty() const
Definition: TrackAnalysis.h:129
TrackAnalysis::finalise
virtual void finalise()=0
TIDAEvent.h
Basic event class to contain a vector of chains for trigger analysis
TrackAnalysis::beamRefy
double beamRefy() const
Definition: TrackAnalysis.h:125
TIDA::FeatureStore
Definition: TIDAFeatureStore.h:26
TrackAnalysis::execute
virtual void execute(const std::vector< TIDA::Track * > &tracks1, const std::vector< TIDA::Track * > &tracks2, TrackAssociator *matcher, const TIDA::Event *event, double *)
Definition: TrackAnalysis.h:73
TrackAnalysis::execute
virtual void execute(const std::vector< TIDA::Track * > &tracks1, const std::vector< TIDA::Track * > &tracks2, TrackAssociator *matcher)=0
TrackAnalysis::getHistograms
const std::map< std::string, TH1 * > & getHistograms() const
access the histograms
Definition: TrackAnalysis.h:103
TIDAVertex.h
TrackAnalysis::execute_vtx
virtual void execute_vtx(const std::vector< TIDA::Vertex * > &, const std::vector< TIDA::Vertex * > &, const TIDA::Event *=0)
Definition: TrackAnalysis.h:89
TIDARoiDescriptor
Describes the Region of Ineterest geometry It has basically 8 parameters.
Definition: TIDARoiDescriptor.h:42
TIDARoiDescriptor.h
TrackAnalysis::execute
virtual void execute(const std::vector< TIDA::Track * > &, const std::vector< TIDA::Track * > &, TrackAssociator *, const TIDA::Event *)
Definition: TrackAnalysis.h:68
TrackAnalysis::roi
const TIDARoiDescriptor * roi() const
Definition: TrackAnalysis.h:138
TIDA::Event
Definition: TIDAEvent.h:33
x
#define x
TrackAnalysis::beamTestz
double beamTestz() const
Definition: TrackAnalysis.h:130
TrackAnalysis::setBeamTest
void setBeamTest(const std::vector< double > &v)
Definition: TrackAnalysis.h:118
TrackAnalysis::setevent
void setevent(TIDA::Event *e)
Definition: TrackAnalysis.h:136
TrigObjectMatcher
Definition: TrigObjectMatcher.h:24
TrackAnalysis::beamRefz
double beamRefz() const
Definition: TrackAnalysis.h:126
z
#define z
TIDAFeatureStore.h
Generic storage container - to contain objects wrapped as Features
TrackAnalysis::execute
virtual void execute(const std::vector< TIDA::Track * > &tracks1, const std::vector< TIDA::Track * > &tracks2, TrackAssociator *matcher, TrigObjectMatcher *)
Definition: TrackAnalysis.h:61
TrackAnalysis
Definition: TrackAnalysis.h:32
TrackAnalysis::name
std::string name() const
return identifier
Definition: TrackAnalysis.h:52
TrackAnalysis::beamRefx
double beamRefx() const
Definition: TrackAnalysis.h:124
TrackAnalysis::setBeamRef
void setBeamRef(double x, double y, double z=0)
set the beamline positions
Definition: TrackAnalysis.h:109
TrackAssociator.h
TrackAnalysis::event
const TIDA::Event * event() const
Definition: TrackAnalysis.h:135
TrackAnalysis::m_histos
std::map< std::string, TH1 * > m_histos
lookup table for the histograms by name - does this need to be in the base class?
Definition: TrackAnalysis.h:149
TrackAnalysis::m_yBeamReference
double m_yBeamReference
Definition: TrackAnalysis.h:154
TrackAnalysis::m_event
TIDA::Event * m_event
Definition: TrackAnalysis.h:164
TrackAnalysis::m_zBeamTest
double m_zBeamTest
Definition: TrackAnalysis.h:160
TrackAnalysis::m_store
TIDA::FeatureStore m_store
Definition: TrackAnalysis.h:162
TrackAnalysis::TrackAnalysis
TrackAnalysis(const std::string &name)
the beam test parts are not really usable in a multithreaded environment
Definition: TrackAnalysis.h:38
TrackAnalysis::end
std::map< std::string, TH1 * >::const_iterator end() const
Definition: TrackAnalysis.h:106
TrackAnalysis::begin
std::map< std::string, TH1 * >::const_iterator begin() const
Definition: TrackAnalysis.h:105
TrigObjectMatcher.h
operator<<
std::ostream & operator<<(std::ostream &s, const TrackAnalysis &ta)
Definition: TrackAnalysis.h:170
TrackAnalysis::setroi
void setroi(TIDARoiDescriptor *r)
Definition: TrackAnalysis.h:139
python.PyAthena.v
v
Definition: PyAthena.py:154
TrackAnalysis::addHistogram
void addHistogram(TH1 *h)
Definition: TrackAnalysis.h:97
y
#define y
h
TrackAnalysis::m_xBeamTest
double m_xBeamTest
test sample
Definition: TrackAnalysis.h:158
TrackAnalysis::execute
virtual void execute(const std::vector< TIDA::Track * > &, const std::vector< TIDA::Track * > &, TrackAssociator *, const TIDA::Event *, double *, TIDARoiDescriptor *)
Definition: TrackAnalysis.h:81
TrackAnalysis::beamTestx
double beamTestx() const
Definition: TrackAnalysis.h:128
TrackAnalysis::m_yBeamTest
double m_yBeamTest
Definition: TrackAnalysis.h:159
TrackAnalysis::operator=
TrackAnalysis & operator=(const TrackAnalysis &)=delete
TrackAnalysis::~TrackAnalysis
virtual ~TrackAnalysis()
Definition: TrackAnalysis.h:45
TrackAnalysis::m_zBeamReference
double m_zBeamReference
Definition: TrackAnalysis.h:155
TrackAnalysis::TrackAnalysis
TrackAnalysis(const TrackAnalysis &)=delete
TrackAnalysis::m_name
std::string m_name
identifier of the of the analysis - also used for the root directory into which the histograms are pu...
Definition: TrackAnalysis.h:145
TrackAnalysis::store
TIDA::FeatureStore & store()
Definition: TrackAnalysis.h:133
TrackAnalysis::m_xBeamReference
double m_xBeamReference
beamline positions reference sample
Definition: TrackAnalysis.h:153