ATLAS Offline Software
TIDARoiDescriptor.h
Go to the documentation of this file.
1 /* emacs: this is -*- c++ -*- */
28 #ifndef TIDA_ROIDESCRIPTOR_H
29 #define TIDA_ROIDESCRIPTOR_H
30 
31 #include <iostream>
32 #include <sstream>
33 #include <cmath>
34 #include <vector>
35 
36 #include "TObject.h"
37 
38 // #include "TrigInDetAnalysis/IRoiDescriptor.h"
40 
41 
42 class TIDARoiDescriptor : public TObject { //, public IRoiDescriptor {
43 
44 public:
45 
49  TIDARoiDescriptor(bool fullscan=false);
50 
51 
60  TIDARoiDescriptor( double eta, double etaMinus, double etaPlus,
61  double phi, double phiMinus, double phiPlus,
62  double zed, double zedMinus, double zedPlus );
63 
64 
74  TIDARoiDescriptor(unsigned l1id, int id,
75  double eta, double etaMinus, double etaPlus,
76  double phi, double phiMinus, double phiPlus,
77  double zed, double zedMinus, double zedPlus );
78 
89  TIDARoiDescriptor(unsigned roiWord, unsigned l1id, int id,
90  double eta, double etaMinus, double etaPlus,
91  double phi, double phiMinus, double phiPlus,
92  double zed, double zedMinus, double zedPlus );
93 
99 
100 
106 
107 
108  // Destructor
109  virtual ~TIDARoiDescriptor();
110 
111  // Methods to set data members
112  // void phi(const double phi) { m_phi = phi; } //!< set phi of RoI
113  // void eta(const double eta) { m_eta = eta; } //!< set eta of RoI
114  // void zed(const double zed) { m_zed = zed; } //!< set eta of RoI
115 
116  void set_roiId(const unsigned int id) { m_roiId=id; }
117  void set_l1Id(const unsigned int l1id) { m_l1Id=l1id; }
118  void set_roiWord(const unsigned int roiWord) { m_roiWord=roiWord; }
119 
120  // void phiHalfWidth(double x) { m_phiHalfWidth=x; } //!< sets phi half-width
121  // void etaHalfWidth(double x) { m_etaHalfWidth=x; } //!< sets eta half-width
122  // void zedHalfWidth(double x) { m_zedHalfWidth=x; } //!< sets zed half-width
123 
124  // void etaPlus(double x) { m_etaPlus = x; } //!< sets eta at z+zwidth
125  // void etaMinus(double x) { m_etaMinus = x; } //!< sets eta at z-zwidth
126 
127  // Methods to retrieve data members
128 
129  // double phi0() const { return m_params.phi(); }
130  // double eta0() const { return m_params.eta(); }
131  // double zed0() const { return m_params.zed(); }
132 
133  double phi() const { return m_params.phi(); }
134  double eta() const { return m_params.eta(); }
135  double zed() const { return m_params.zed(); }
136 
137  double etaMinus() const { return m_params.etaMinus(); }
138  double etaPlus() const { return m_params.etaPlus(); }
139 
140  double phiMinus() const { return m_params.phiMinus(); }
141  double phiPlus() const { return m_params.phiPlus(); }
142 
143  double zedMinus() const { return m_params.zedMinus(); }
144  double zedPlus() const { return m_params.zedPlus(); }
145 
146 
148 
149  double zedPlusR() const { return m_zedPlusR; }
150  double zedMinusR() const { return m_zedMinusR; }
151 
152  double rPlusZed() const { return m_rPlusZed; }
153  double rMinusZed() const { return m_rMinusZed; }
154 
155  double maxR() const { return maxRadius; }
156  double maxZ() const { return maxZed; }
157 
158  static double exitpoint( double tz0, double teta, double& zexit, double& rexit );
159 
161 
162  unsigned roiId() const { return m_roiId; }
163  unsigned l1Id() const { return m_l1Id; }
164  unsigned roiWord() const { return m_roiWord; }
165 
166  int version() const { return 4; }
167 
168  operator std::string() const;
169 
170  bool isFullscan() const { return m_fullscan; }
171 
173 
174  bool composite() const { return !m_rois.empty(); }
175 
176  size_t size() const { return m_rois.size(); }
177 
178  const TIDARoiDescriptor* operator[](int i) const { return &m_rois.at(i); }
179  const TIDARoiDescriptor* at(int i) const { return &m_rois.at(i); }
180 
182  double phiHalfWidth() const {
183  double dphi = 0.5*(params().phiPlus()-params().phiMinus());
184  if ( params().phiMinus()>params().phiPlus() ) dphi += M_PI;
185  return dphi;
186  }
187 
188  double etaHalfWidth() const { return 0.5*(params().etaPlus()-params().etaMinus()); }
189  double zedHalfWidth() const { return 0.5*(params().zedPlus()-params().zedMinus()); }
190 
191  // double zedPlus() const { return m_zed+m_zedHalfWidth; } //!< gets phi half-width
192  // double zedMinus() const { return m_zed-m_zedHalfWidth; } //!< gets phi half-width
193 
194  // double etaPlus() const { return m_etaPlus; } //!< gets eta at z+zwidth
195  // double etaMinus() const { return m_etaMinus; } //!< gets eta at z-zwidth
196 
198 
199 
200  bool operator==( const TIDARoiDescriptor& b ) const {
201  if ( roiWord() != b.roiWord() ) return false;
202  double epsilon=0.001; // arbitrary , but seems to be reasnable
203  if ( std::fabs( phi() - b.phi()) > epsilon ) return false;
204  if ( std::fabs( eta() - b.eta()) > epsilon ) return false;
205  if ( std::fabs( zed() - b.zed()) > epsilon ) return false;
206  return true;
207  }
208 
209  bool operator!=( const TIDARoiDescriptor& b ) const { return !((*this)==b); }
210 
211 
212  void push_back( const TIDARoiDescriptor& roi ) { m_rois.push_back( roi ); }
213  void push_back( const TIDARoiDescriptor* roi ) { m_rois.push_back( *roi ); }
214 
215 
216 
217 #if 0
218 
220 
221  virtual double zedMin(double r) const { return 0; }
222  virtual double zedMax(double r) const { return 0; }
223 
224  virtual double rhoMin(double z) const { return 0; }
225  virtual double rhoMax(double z) const { return 0; }
226 
228  virtual double dzdrMinus() const { return 0; }
229  virtual double dzdrPlus() const { return 0; }
230 
231  virtual double drdzMinus() const { return 0; }
232  virtual double drdzPlus() const { return 0; }
233 
234  virtual bool contains( double z0, double dzdr ) const { return false; }
235  virtual bool contains_internal( double z0, double zouter ) const { return false; }
236 
238  virtual bool contains( double _z, double _r, double _phi ) const { return false; }
239  virtual bool containsPhi( double _phi ) const { return false; }
240  virtual bool containsZed( double _z, double _r ) const { return false; }
241 
242 #endif
243 
244 protected:
245 
247  const TIDARoiParameters& params() const { return m_params; };
248 
252  void reset() {
254  // m_phi=0.0; m_eta=0.0; m_zed=0.0;
255  // m_phiHalfWidth=0.1; m_etaHalfWidth=0.1; m_zedHalfWidth=168;
256  // m_etaPlus=m_eta; m_etaMinus=m_eta;
257  m_l1Id=0;
258  m_roiId=0;
259  m_roiWord=0;
260  m_rois.clear();
261  }
262 
263  double phicheck(double phi);
264  double etacheck(double eta);
265  double zedcheck(double zed);
266 
267 protected:
268 
269  static const double maxRadius;
270  static const double maxZed;
271 
272 protected:
273 
274  TIDARoiParameters m_params; // actual roi values
275 
277 
278  unsigned int m_l1Id; //< lvl1 event number
279  unsigned int m_roiId; //< RoI number
280  unsigned int m_roiWord; //< lvl1 RoI word from which this RoI was initially constructed
281 
282  std::vector<TIDARoiDescriptor> m_rois; //< actual roi descriptors - mot pointers as online
283 
284  bool m_cached;
285  double m_dphi;
286 
287  double m_zedPlusR;
288  double m_zedMinusR;
289 
290  double m_rPlusZed;
291  double m_rMinusZed;
292 
293  double m_tanthetaPlus;
295 
296 
297  ClassDef( TIDARoiDescriptor, 2 )
298 
299 };
300 
301 
302 inline std::ostream& operator<<( std::ostream& s, const TIDARoiDescriptor& d ) {
303  return s << (std::string)d;
304 }
305 
306 #endif // TIDA_ROIDESCRIPTOR_H
beamspotman.r
def r
Definition: beamspotman.py:676
operator<<
std::ostream & operator<<(std::ostream &s, const TIDARoiDescriptor &d)
Definition: TIDARoiDescriptor.h:302
TIDARoiParameters::eta
float eta() const
Definition: TIDARoiParameters.h:46
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
TIDARoiDescriptor::phi
double phi() const
Definition: TIDARoiDescriptor.h:133
TIDARoiDescriptor::zedMinus
double zedMinus() const
Definition: TIDARoiDescriptor.h:143
TIDARoiDescriptor::maxRadius
static const double maxRadius
Definition: TIDARoiDescriptor.h:269
TIDARoiDescriptor::m_rois
std::vector< TIDARoiDescriptor > m_rois
Definition: TIDARoiDescriptor.h:282
TIDARoiDescriptor::zedcheck
double zedcheck(double zed)
helper function to check if zed range was violated
Definition: TIDARoiDescriptor.cxx:195
TIDARoiParameters::phi
float phi() const
Definition: TIDARoiParameters.h:47
hist_file_dump.d
d
Definition: hist_file_dump.py:137
TIDARoiDescriptor::m_zedMinusR
double m_zedMinusR
don't save - transient zPlus at radius R
Definition: TIDARoiDescriptor.h:288
TIDARoiDescriptor::rPlusZed
double rPlusZed() const
Definition: TIDARoiDescriptor.h:152
TIDARoiDescriptor::m_rMinusZed
double m_rMinusZed
don't save - transient zPlus at radius R
Definition: TIDARoiDescriptor.h:291
TIDARoiDescriptor::etaPlus
double etaPlus() const
Definition: TIDARoiDescriptor.h:138
TIDARoiDescriptor::etaMinus
double etaMinus() const
Definition: TIDARoiDescriptor.h:137
TIDARoiParameters::zedMinus
float zedMinus() const
Definition: TIDARoiParameters.h:56
RoiUtil::containsPhi
bool containsPhi(const IRoiDescriptor &roi, double phi)
test whether a stub is contained within the roi
Definition: RoiUtil.cxx:79
RoiUtil::containsZed
bool containsZed(const IRoiDescriptor &roi, double z, double r)
Definition: RoiUtil.cxx:94
TIDARoiDescriptor::exitpoint
static double exitpoint(double tz0, double teta, double &zexit, double &rexit)
Definition: TIDARoiDescriptor.cxx:32
M_PI
#define M_PI
Definition: ActiveFraction.h:11
TIDARoiDescriptor::m_dphi
double m_dphi
cache flag - these should be mutable
Definition: TIDARoiDescriptor.h:285
TIDARoiParameters
Definition: TIDARoiParameters.h:29
TIDARoiDescriptor
Describes the Region of Ineterest geometry It has basically 8 parameters.
Definition: TIDARoiDescriptor.h:42
TIDARoiDescriptor::m_roiId
unsigned int m_roiId
Definition: TIDARoiDescriptor.h:279
TIDARoiDescriptor::version
int version() const
Definition: TIDARoiDescriptor.h:166
TIDARoiDescriptor::zedPlus
double zedPlus() const
Definition: TIDARoiDescriptor.h:144
TIDARoiDescriptor::operator[]
const TIDARoiDescriptor * operator[](int i) const
Definition: TIDARoiDescriptor.h:178
TIDARoiDescriptor::isFullscan
bool isFullscan() const
Definition: TIDARoiDescriptor.h:170
TIDARoiDescriptor::zedPlusR
double zedPlusR() const
full containment methods
Definition: TIDARoiDescriptor.h:149
TIDARoiDescriptor::params
const TIDARoiParameters & params() const
access the internal parameter class
Definition: TIDARoiDescriptor.h:247
TIDARoiDescriptor::l1Id
unsigned l1Id() const
Definition: TIDARoiDescriptor.h:163
TIDARoiDescriptor::maxZed
static const double maxZed
don't save
Definition: TIDARoiDescriptor.h:270
TIDARoiDescriptor::size
size_t size() const
Definition: TIDARoiDescriptor.h:176
TIDARoiDescriptor::phiPlus
double phiPlus() const
Definition: TIDARoiDescriptor.h:141
TIDARoiDescriptor::m_rPlusZed
double m_rPlusZed
don't save - transient zMinus at radius R
Definition: TIDARoiDescriptor.h:290
TIDARoiDescriptor::operator==
bool operator==(const TIDARoiDescriptor &b) const
operators
Definition: TIDARoiDescriptor.h:200
TIDARoiDescriptor::rMinusZed
double rMinusZed() const
Definition: TIDARoiDescriptor.h:153
TIDARoiDescriptor::maxZ
double maxZ() const
Definition: TIDARoiDescriptor.h:156
TIDARoiParameters::etaMinus
float etaMinus() const
Definition: TIDARoiParameters.h:50
TIDARoiParameters::zedPlus
float zedPlus() const
Definition: TIDARoiParameters.h:57
TIDARoiDescriptor::set_roiId
void set_roiId(const unsigned int id)
set roiId
Definition: TIDARoiDescriptor.h:116
TIDARoiDescriptor::composite
bool composite() const
composite RoI methods
Definition: TIDARoiDescriptor.h:174
lumiFormat.i
int i
Definition: lumiFormat.py:85
z
#define z
TIDARoiDescriptor::roiId
unsigned roiId() const
identifier methods
Definition: TIDARoiDescriptor.h:162
TIDARoiDescriptor::m_tanthetaMinus
double m_tanthetaMinus
don't save - transient roi edge gradients
Definition: TIDARoiDescriptor.h:294
contains
bool contains(const std::string &s, const std::string &regx)
does a string contain the substring
Definition: hcg.cxx:111
TIDARoiParameters::phiMinus
float phiMinus() const
Definition: TIDARoiParameters.h:53
TIDARoiDescriptor::m_params
TIDARoiParameters m_params
don't save
Definition: TIDARoiDescriptor.h:274
TIDARoiDescriptor::TIDARoiDescriptor
TIDARoiDescriptor(unsigned l1id, int id, double eta, double etaMinus, double etaPlus, double phi, double phiMinus, double phiPlus, double zed, double zedMinus, double zedPlus)
constructor
TIDARoiDescriptor::set_roiWord
void set_roiWord(const unsigned int roiWord)
sets RoI word
Definition: TIDARoiDescriptor.h:118
TIDARoiDescriptor::roiWord
unsigned roiWord() const
Definition: TIDARoiDescriptor.h:164
TRT::Track::z0
@ z0
Definition: InnerDetector/InDetCalibEvent/TRT_CalibData/TRT_CalibData/TrackInfo.h:63
TIDARoiDescriptor::set_l1Id
void set_l1Id(const unsigned int l1id)
set event number
Definition: TIDARoiDescriptor.h:117
TIDARoiDescriptor::etaHalfWidth
double etaHalfWidth() const
gets eta half-width
Definition: TIDARoiDescriptor.h:188
TIDARoiParameters::etaPlus
float etaPlus() const
Definition: TIDARoiParameters.h:51
TIDARoiDescriptor::TIDARoiDescriptor
TIDARoiDescriptor(unsigned roiWord, unsigned l1id, int id, double eta, double etaMinus, double etaPlus, double phi, double phiMinus, double phiPlus, double zed, double zedMinus, double zedPlus)
constructor
TIDARoiDescriptor::maxR
double maxR() const
Definition: TIDARoiDescriptor.h:155
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:227
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
TIDARoiDescriptor::eta
double eta() const
Definition: TIDARoiDescriptor.h:134
TIDARoiDescriptor::m_zedPlusR
double m_zedPlusR
cached value -
Definition: TIDARoiDescriptor.h:287
TIDARoiDescriptor::~TIDARoiDescriptor
virtual ~TIDARoiDescriptor()
Definition: TIDARoiDescriptor.cxx:160
TIDARoiDescriptor::m_cached
bool m_cached
Definition: TIDARoiDescriptor.h:284
TIDARoiDescriptor::zedHalfWidth
double zedHalfWidth() const
gets eta half-width
Definition: TIDARoiDescriptor.h:189
TIDARoiDescriptor::at
const TIDARoiDescriptor * at(int i) const
gets phi half-width
Definition: TIDARoiDescriptor.h:179
TIDARoiParameters::zed
float zed() const
Definition: TIDARoiParameters.h:48
TIDARoiDescriptor::push_back
void push_back(const TIDARoiDescriptor &roi)
Definition: TIDARoiDescriptor.h:212
TIDARoiDescriptor::phiHalfWidth
double phiHalfWidth() const
Definition: TIDARoiDescriptor.h:182
TIDARoiParameters.h
Class to store the eta, phi, zed, parameters and ranges for the TIDARoiDescriptor class.
TIDARoiDescriptor::operator=
TIDARoiDescriptor & operator=(const TIDARoiDescriptor &r)
assignment
Definition: TIDARoiDescriptor.cxx:143
TIDARoiDescriptor::etacheck
double etacheck(double eta)
helper function to check if eta range was violated
Definition: TIDARoiDescriptor.cxx:187
TIDARoiDescriptor::phicheck
double phicheck(double phi)
helper function to check if phi range was violated
Definition: TIDARoiDescriptor.cxx:176
TIDARoiDescriptor::TIDARoiDescriptor
TIDARoiDescriptor(bool fullscan=false)
default constructor
Definition: TIDARoiDescriptor.cxx:64
TIDARoiDescriptor::push_back
void push_back(const TIDARoiDescriptor *roi)
Definition: TIDARoiDescriptor.h:213
TIDARoiDescriptor::operator!=
bool operator!=(const TIDARoiDescriptor &b) const
Definition: TIDARoiDescriptor.h:209
TIDARoiDescriptor::m_tanthetaPlus
double m_tanthetaPlus
don't save - transient zMinus at radius R
Definition: TIDARoiDescriptor.h:293
TIDARoiDescriptor::m_roiWord
unsigned int m_roiWord
Definition: TIDARoiDescriptor.h:280
TIDARoiDescriptor::reset
void reset()
internal parameters
Definition: TIDARoiDescriptor.h:252
TIDARoiDescriptor::m_l1Id
unsigned int m_l1Id
Definition: TIDARoiDescriptor.h:278
TIDARoiDescriptor::zedMinusR
double zedMinusR() const
Definition: TIDARoiDescriptor.h:150
TIDARoiDescriptor::phiMinus
double phiMinus() const
Definition: TIDARoiDescriptor.h:140
TIDARoiDescriptor::zed
double zed() const
Definition: TIDARoiDescriptor.h:135
TIDARoiDescriptor::m_fullscan
bool m_fullscan
Definition: TIDARoiDescriptor.h:276
TIDARoiParameters::phiPlus
float phiPlus() const
Definition: TIDARoiParameters.h:54