ATLAS Offline Software
RegSelRoI.h
Go to the documentation of this file.
1 // emacs: this is -*- c++ -*-
2 
3 /*
4  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 /**************************************************************************
8  **
9  ** File: RegSelRoI.h
10  **
11  ** Description: a useful RoI descriptor that can define an RoI with
12  ** arbitrary extent in z and phi, and with independent
13  ** RoI slopes at either end in z
14  **
15  ** Author: M.Sutton
16  **
17  ** Created: Thu Feb 15 00:15:26 GMT 2007
18  ** Modified:
19  **
20  **
21  **
22  **************************************************************************/
23 
24 
25 #ifndef REGSELROI_H
26 #define REGSELROI_H
27 
28 #include <iostream>
29 
30 #include <cmath>
31 
32 class RegSelRoI {
33 
34 public:
35 
36  RegSelRoI() { }
37 
38  RegSelRoI(double zMin, double zMax,
39  double phiMin, double phiMax,
40  double etaMin, double etaMax);
41 
42  ~RegSelRoI() = default;
43 
44  double getzMin() const { return m_zMin; }
45  double getzMax() const { return m_zMax; }
46  double getphiMin() const { return m_phiMin; }
47  double getphiMax() const { return m_phiMax; }
48  double getetaMin() const { return m_etaMin; }
49  double getetaMax() const { return m_etaMax; }
50  double getaMin() const { return m_aMin; }
51  double getaMax() const { return m_aMax; }
52  bool getsplit() const { return m_split; }
53 
54  double getphiWidth() const { return ( m_phiMax>=m_phiMin ? m_phiMax-m_phiMin : m_phiMax-m_phiMin+2*M_PI ); }
55  double getzWidth() const { return m_zMax-m_zMin; }
56 
57  // given a radius calculate the min and max z values of the RoI
58  double getzMin(const double r) const { return r*m_aMin+m_zMin; }
59  double getzMax(const double r) const { return r*m_aMax+m_zMax; }
60 
61  // given a z position calculate the min and max r values of the RoI
62  double getrMin(const double z) const { return (z-m_zMin)*m_invaMin; }
63  double getrMax(const double z) const { return (z-m_zMax)*m_invaMax; }
64 
65 
68  double etaMinLimit(double r) const {
69  double x = r*m_aMin-getzWidth();
70  if ( x==0 ) return 0;
71  double tantheta = r/x;
72  double theta = std::atan(tantheta);
73  if ( theta<0 ) theta += M_PI;
74  return -std::log(std::tan(0.5*theta));
75  }
76 
79  double etaMaxLimit(double r) const {
80  double x = r*m_aMax+getzWidth();
81  if ( x==0 ) return 0;
82  double tantheta = r/x;
83  double theta = std::atan(tantheta);
84  if ( theta<0 ) theta += M_PI;
85  return -std::log(std::tan(0.5*theta));
86  }
87 
88 private:
89 
90  double m_zMin, m_zMax; // z positions at front and back of RoI
91  double m_phiMin, m_phiMax; // phi at either side
92  double m_etaMin, m_etaMax; // eta at front and back
93  double m_invaMin, m_invaMax; // gradient dr/dz
94  double m_aMin, m_aMax; // gradient dz/dr
95 
96  bool m_split; // is the roi split over the pi boundary
97 
98 };
99 
100 
101 
102 std::ostream& operator<<(std::ostream& s, const RegSelRoI& r);
103 
104 
105 #endif /* REGSELROI_H */
106 
107 
108 
109 
110 
111 
112 
113 
114 
115 
beamspotman.r
def r
Definition: beamspotman.py:676
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
theta
Scalar theta() const
theta method
Definition: AmgMatrixBasePlugin.h:71
RegSelRoI::m_invaMin
double m_invaMin
Definition: RegSelRoI.h:108
operator<<
std::ostream & operator<<(std::ostream &s, const RegSelRoI &r)
Definition: RegSelRoI.cxx:77
M_PI
#define M_PI
Definition: ActiveFraction.h:11
xAOD::etaMax
etaMax
Definition: HIEventShape_v2.cxx:46
RegSelRoI::getphiWidth
double getphiWidth() const
Definition: RegSelRoI.h:69
RegSelRoI::m_zMin
double m_zMin
Definition: RegSelRoI.h:105
RegSelRoI::getetaMin
double getetaMin() const
Definition: RegSelRoI.h:63
x
#define x
drawFromPickle.atan
atan
Definition: drawFromPickle.py:36
RegSelRoI::getzWidth
double getzWidth() const
Definition: RegSelRoI.h:70
RegSelRoI::getphiMax
double getphiMax() const
Definition: RegSelRoI.h:62
RegSelRoI::getetaMax
double getetaMax() const
Definition: RegSelRoI.h:64
RegSelRoI::m_aMin
double m_aMin
Definition: RegSelRoI.h:109
z
#define z
RegSelRoI::m_invaMax
double m_invaMax
Definition: RegSelRoI.h:108
RegSelRoI::m_split
bool m_split
Definition: RegSelRoI.h:111
RegSelRoI::m_phiMin
double m_phiMin
Definition: RegSelRoI.h:106
RegSelRoI::m_aMax
double m_aMax
Definition: RegSelRoI.h:109
RegSelRoI::getzMax
double getzMax() const
Definition: RegSelRoI.h:60
drawFromPickle.tan
tan
Definition: drawFromPickle.py:36
RegSelRoI
Definition: RegSelRoI.h:32
RegSelRoI::getphiMin
double getphiMin() const
Definition: RegSelRoI.h:61
RegSelRoI::getzMin
double getzMin() const
Definition: RegSelRoI.h:59
RegSelRoI::getaMax
double getaMax() const
Definition: RegSelRoI.h:66
RegSelRoI::getrMin
double getrMin(const double z) const
Definition: RegSelRoI.h:77
RegSelRoI::m_phiMax
double m_phiMax
Definition: RegSelRoI.h:106
RegSelRoI::getsplit
bool getsplit() const
Definition: RegSelRoI.h:67
RegSelRoI::getaMin
double getaMin() const
Definition: RegSelRoI.h:65
RegSelRoI::etaMaxLimit
double etaMaxLimit(double r) const
find the max eta limits for an object fully contained within an roi, bounded with the specifed radius
Definition: RegSelRoI.h:94
RegSelRoI::~RegSelRoI
~RegSelRoI()=default
LArCellBinning.etaMin
etaMin
Definition: LArCellBinning.py:84
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
RegSelRoI::m_zMax
double m_zMax
Definition: RegSelRoI.h:105
RegSelRoI::getrMax
double getrMax(const double z) const
Definition: RegSelRoI.h:78
RegSelRoI::m_etaMin
double m_etaMin
Definition: RegSelRoI.h:107
RegSelRoI::RegSelRoI
RegSelRoI()
Definition: RegSelRoI.h:51
RegSelRoI::etaMinLimit
double etaMinLimit(double r) const
find the min eta limits for an object fully contained within an roi, bounded with the specifed radius
Definition: RegSelRoI.h:83
RegSelRoI::m_etaMax
double m_etaMax
Definition: RegSelRoI.h:107