ATLAS Offline Software
Loading...
Searching...
No Matches
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
32class RegSelRoI {
33
34public:
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
88private:
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
102std::ostream& operator<<(std::ostream& s, const RegSelRoI& r);
103
104
105#endif /* REGSELROI_H */
106
107
108
109
110
111
112
113
114
115
#define M_PI
Scalar theta() const
theta method
std::ostream & operator<<(std::ostream &s, const RegSelRoI &r)
Definition RegSelRoI.cxx:77
#define x
#define z
double getzMin() const
Definition RegSelRoI.h:44
double m_etaMin
Definition RegSelRoI.h:92
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:68
double getaMax() const
Definition RegSelRoI.h:51
double getetaMin() const
Definition RegSelRoI.h:48
double getaMin() const
Definition RegSelRoI.h:50
~RegSelRoI()=default
double m_aMin
Definition RegSelRoI.h:94
double m_zMax
Definition RegSelRoI.h:90
double m_phiMax
Definition RegSelRoI.h:91
double m_aMax
Definition RegSelRoI.h:94
double getzMax() const
Definition RegSelRoI.h:45
double getrMin(const double z) const
Definition RegSelRoI.h:62
double getetaMax() const
Definition RegSelRoI.h:49
double getphiWidth() const
Definition RegSelRoI.h:54
bool getsplit() const
Definition RegSelRoI.h:52
double m_invaMax
Definition RegSelRoI.h:93
double m_invaMin
Definition RegSelRoI.h:93
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:79
bool m_split
Definition RegSelRoI.h:96
double m_zMin
Definition RegSelRoI.h:90
double getzMax(const double r) const
Definition RegSelRoI.h:59
double getzMin(const double r) const
Definition RegSelRoI.h:58
double m_etaMax
Definition RegSelRoI.h:92
double getphiMin() const
Definition RegSelRoI.h:46
double m_phiMin
Definition RegSelRoI.h:91
double getzWidth() const
Definition RegSelRoI.h:55
double getphiMax() const
Definition RegSelRoI.h:47
double getrMax(const double z) const
Definition RegSelRoI.h:63
int r
Definition globals.cxx:22