ATLAS Offline Software
Loading...
Searching...
No Matches
TIDARoiDescriptor.cxx
Go to the documentation of this file.
1
11
12
13
15#include <sstream>
16
18
19
20#ifndef M_2PI
21#define M_2PI 6.283185307179586476925286766559005768394
22#endif
23
24#ifndef M_PIF
25static const float M_PIF = float(M_PI);
26#endif
27
28const double TIDARoiDescriptor::maxRadius = 1000;
29const double TIDARoiDescriptor::maxZed = 2700;
30
31
32double TIDARoiDescriptor::exitpoint( double tz0, double teta, double& zexit, double& rexit ) {
33
34 if ( teta<0 ) zexit = -maxZed;
35 else if ( teta>0 ) zexit = maxZed;
36 else {
37 zexit = tz0;
38 rexit = maxRadius;
39 return 1e16; // don't really want to use nan
40 }
41
43
44 double tantheta = std::tan( 2*std::atan( std::exp( -teta ) ) );
45
46 rexit = (zexit-tz0) * tantheta;
47
49 if ( std::fabs(rexit)>maxRadius ) {
54 zexit = maxRadius / tantheta + tz0;
55 rexit = maxRadius;
56
57 }
58
59 return tantheta;
60}
61
62
63
65 : m_fullscan(fullscan),
66 m_l1Id(0), m_roiId(0), m_roiWord(0),
67 m_cached(false), m_dphi(0),
68 m_zedPlusR(0),
69 m_zedMinusR(0),
70 m_rPlusZed(0),
72{
73 if ( m_fullscan ) {
74 m_params = TIDARoiParameters( 0, -5, 5, 0, -M_PI, M_PI, 0, -225, 225 );
77 } else {
78 m_tanthetaPlus = 0.0;
79 m_tanthetaMinus = 0.0;
80 }
81}
82
83
85 double phi, double phiMinus, double phiPlus,
86 double zed, double zedMinus, double zedPlus )
89 zed, zedMinus, zedPlus ),
90 m_fullscan(false),
91 m_l1Id(0), m_roiId(0), m_roiWord(0)
92{
93 // calculate z limits at radius maxRadius
94
97}
98
99
100TIDARoiDescriptor::TIDARoiDescriptor( unsigned int l1id, int id,
101 double eta, double etaMinus, double etaPlus,
102 double phi, double phiMinus, double phiPlus,
103 double zed, double zedMinus, double zedPlus )
104 : m_params( eta, etaMinus, etaPlus,
105 phi, phiMinus, phiPlus,
106 zed, zedMinus, zedPlus ),
107 m_fullscan(false),
108 m_l1Id(l1id), m_roiId(id), m_roiWord(0),
109 m_cached(false), m_dphi(0)
110{
111 // calculate z limits at radius maxRadius
112
115}
116
117
118TIDARoiDescriptor::TIDARoiDescriptor(unsigned int roiword, unsigned int l1id, int id,
119 double eta, double etaMinus, double etaPlus,
120 double phi, double phiMinus, double phiPlus,
121 double zed, double zedMinus, double zedPlus )
122 : m_params( eta, etaMinus, etaPlus,
123 phi, phiMinus, phiPlus,
124 zed, zedMinus, zedPlus ),
125 m_fullscan(false),
126 m_l1Id(l1id), m_roiId(id), m_roiWord(roiword),
127 m_cached(false), m_dphi(0)
128{
129 // calculate z limits at radius maxRadius
132}
133
134
146
147
149{
150 if (this != &a) {
151 TObject::operator= (a);
152 m_params = a.m_params;
153 m_fullscan = a.m_fullscan;
154 m_l1Id = a.m_l1Id;
155 m_roiId = a.m_roiId;
156 m_roiWord = a.m_roiWord;
157 m_rois = a.m_rois;
158 m_cached = a.m_cached;
159 m_dphi = a.m_dphi;
162 }
163 return *this;
164}
165
166
168
169
170TIDARoiDescriptor::operator std::string() const {
171 std::stringstream s;
172 s << " z: " << zed() << " (" << zedMinus() << " - " << zedPlus() << ")"
173 << " eta: " << eta() << " (" << etaMinus() << " - " << etaPlus() << ")"
174 << " phi: " << phi() << " (" << phiMinus() << " - " << phiPlus() << ")";
175 if ( m_fullscan ) s << " (fullscan)";
176 s << " RoIid: " << roiId() << " RoIword: " << roiWord() << " (size " << size() << ")";
177 for ( unsigned i=0 ; i<size() ; i++ ) s << "\n\t\t" << i << ": " << (std::string)*at(i);
178 return s.str();
179}
180
181
182
184 if ( !(phi > -M_PIF && phi < M_PIF ) ) { // use ! of range rather than range to also catch nan etc
185 if ( phi < -M_PIF ) phi += M_2PI;
186 else phi -= M_2PI;
187 // std::cerr << "TIDARoiDescriptor constructed with phi smaller than -PI (allowed range -PI / +PI) PhiRange" << std::endl;
188 // std::cerr << "TIDARoiDescriptor constructed with phi greater than PI (allowed range -PI / +PI) PhiRange" << std::endl;
189 }
190 return phi;
191}
192
193
195 if ( !(eta > -100 && eta < 100) ) { // check also for nan
196 std::cerr << "TIDARoiDescriptor constructed with eta outside range -100 < eta <100 EtaRange" << std::endl;
197 }
198 return eta;
199}
200
201
203 if ( !(zed > -100000 && zed < 100000 ) ) { // check also for nan
204 std::cerr << "TIDARoiDescriptor constructed with eta outside range -100000 < sed <100000 ZedRange" << std::endl;
205 }
206 return zed;
207}
208
209
210
#define M_PI
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define M_2PI
static Double_t a
ClassImp(TIDARoiDescriptor) static const float M_PIF
static const float M_PIF
Describes the Region of Ineterest geometry It has basically 8 parameters.
double m_rPlusZed
don't save - transient zMinus at radius R
unsigned roiWord() const
double m_rMinusZed
don't save - transient zPlus at radius R
double m_zedMinusR
don't save - transient zPlus at radius R
TIDARoiParameters m_params
don't save
double etaMinus() const
double m_zedPlusR
cached value -
const TIDARoiDescriptor * at(int i) const
gets phi half-width
double zedPlus() const
double m_tanthetaPlus
don't save - transient zMinus at radius R
std::vector< TIDARoiDescriptor > m_rois
static const double maxZed
don't save
static double exitpoint(double tz0, double teta, double &zexit, double &rexit)
static const double maxRadius
TIDARoiDescriptor(bool fullscan=false)
default constructor
TIDARoiDescriptor & operator=(const TIDARoiDescriptor &r)
assignment
double etaPlus() const
double zedMinus() const
double phiPlus() const
unsigned roiId() const
identifier methods
double m_tanthetaMinus
don't save - transient roi edge gradients
double etacheck(double eta)
helper function to check if eta range was violated
double phiMinus() const
double m_dphi
cache flag - these should be mutable
double zedcheck(double zed)
helper function to check if zed range was violated
double phicheck(double phi)
helper function to check if phi range was violated