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
33double TIDARoiDescriptor::exitpoint( double tz0, double teta, double& zexit, double& rexit ) {
34
35 if ( teta<0 ) zexit = -maxZed;
36 else if ( teta>0 ) zexit = maxZed;
37 else {
38 zexit = tz0;
39 rexit = maxRadius;
40 return 1e16; // don't really want to use nan
41 }
42
44
45 double tantheta = std::tan( 2*std::atan( std::exp( -teta ) ) );
46
47 rexit = (zexit-tz0) * tantheta;
48
50 if ( std::fabs(rexit)>maxRadius ) {
55 zexit = maxRadius / tantheta + tz0;
56 rexit = maxRadius;
57
58 }
59
60 return tantheta;
61}
62
63
64
66 : m_fullscan(fullscan),
67 m_l1Id(0), m_roiId(0), m_roiWord(0),
68 m_cached(false), m_dphi(0),
69 m_zedPlusR(0),
70 m_zedMinusR(0),
71 m_rPlusZed(0),
73{
74 if ( m_fullscan ) {
75 m_params = TIDARoiParameters( 0, -5, 5, 0, -M_PI, M_PI, 0, -225, 225 );
78 } else {
79 m_tanthetaPlus = 0.0;
80 m_tanthetaMinus = 0.0;
81 }
82}
83
84
86 double phi, double phiMinus, double phiPlus,
87 double zed, double zedMinus, double zedPlus )
90 zed, zedMinus, zedPlus ),
91 m_fullscan(false),
92 m_l1Id(0), m_roiId(0), m_roiWord(0),
93 m_cached(false), m_dphi(0)
94{
95 // calculate z limits at radius maxRadius
96
99}
100
101
102TIDARoiDescriptor::TIDARoiDescriptor( unsigned int l1id, int id,
103 double eta, double etaMinus, double etaPlus,
104 double phi, double phiMinus, double phiPlus,
105 double zed, double zedMinus, double zedPlus )
106 : m_params( eta, etaMinus, etaPlus,
107 phi, phiMinus, phiPlus,
108 zed, zedMinus, zedPlus ),
109 m_fullscan(false),
110 m_l1Id(l1id), m_roiId(id), m_roiWord(0),
111 m_cached(false), m_dphi(0)
112{
113 // calculate z limits at radius maxRadius
114
117}
118
119
120TIDARoiDescriptor::TIDARoiDescriptor(unsigned int roiword, unsigned int l1id, int id,
121 double eta, double etaMinus, double etaPlus,
122 double phi, double phiMinus, double phiPlus,
123 double zed, double zedMinus, double zedPlus )
124 : m_params( eta, etaMinus, etaPlus,
125 phi, phiMinus, phiPlus,
126 zed, zedMinus, zedPlus ),
127 m_fullscan(false),
128 m_l1Id(l1id), m_roiId(id), m_roiWord(roiword),
129 m_cached(false), m_dphi(0)
130{
131 // calculate z limits at radius maxRadius
134}
135
136
148
149
151{
152 if (this != &a) {
153 TObject::operator= (a);
154 m_params = a.m_params;
155 m_fullscan = a.m_fullscan;
156 m_l1Id = a.m_l1Id;
157 m_roiId = a.m_roiId;
158 m_roiWord = a.m_roiWord;
159 m_rois = a.m_rois;
160 m_cached = a.m_cached;
161 m_dphi = a.m_dphi;
164 }
165 return *this;
166}
167
169 if (this != &a) {
170 TObject::operator=(a); // TObject may not have a move assignment
171 m_params = std::move(a.m_params);
172 m_fullscan = a.m_fullscan;
173 m_l1Id = a.m_l1Id;
174 m_roiId = a.m_roiId;
175 m_roiWord = a.m_roiWord;
176 m_rois = std::move(a.m_rois);
177 m_cached = a.m_cached;
178 m_dphi = a.m_dphi;
179 m_zedPlusR = a.m_zedPlusR;
180 m_zedMinusR = a.m_zedMinusR;
181 m_rPlusZed = a.m_rPlusZed;
182 m_rMinusZed = a.m_rMinusZed;
183 m_tanthetaPlus = a.m_tanthetaPlus;
184 m_tanthetaMinus = a.m_tanthetaMinus;
185 }
186 return *this;
187}
188
189
190
192
193
194TIDARoiDescriptor::operator std::string() const {
195 std::stringstream s;
196 s << " z: " << zed() << " (" << zedMinus() << " - " << zedPlus() << ")"
197 << " eta: " << eta() << " (" << etaMinus() << " - " << etaPlus() << ")"
198 << " phi: " << phi() << " (" << phiMinus() << " - " << phiPlus() << ")";
199 if ( m_fullscan ) s << " (fullscan)";
200 s << " RoIid: " << roiId() << " RoIword: " << roiWord() << " (size " << size() << ")";
201 for ( unsigned i=0 ; i<size() ; i++ ) s << "\n\t\t" << i << ": " << (std::string)*at(i);
202 return s.str();
203}
204
205
206
208 if ( !(phi > -M_PIF && phi < M_PIF ) ) { // use ! of range rather than range to also catch nan etc
209 if ( phi < -M_PIF ) phi += M_2PI;
210 else phi -= M_2PI;
211 // std::cerr << "TIDARoiDescriptor constructed with phi smaller than -PI (allowed range -PI / +PI) PhiRange" << std::endl;
212 // std::cerr << "TIDARoiDescriptor constructed with phi greater than PI (allowed range -PI / +PI) PhiRange" << std::endl;
213 }
214 return phi;
215}
216
217
219 if ( !(eta > -100 && eta < 100) ) { // check also for nan
220 std::cerr << "TIDARoiDescriptor constructed with eta outside range -100 < eta <100 EtaRange" << std::endl;
221 }
222 return eta;
223}
224
225
227 if ( !(zed > -100000 && zed < 100000 ) ) { // check also for nan
228 std::cerr << "TIDARoiDescriptor constructed with eta outside range -100000 < sed <100000 ZedRange" << std::endl;
229 }
230 return zed;
231}
232
233
234
#define M_PI
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define M_2PI
static Double_t a
size_t size() const
Number of registered mappings.
ClassImp(TIDARoiDescriptor) static const float M_PIF
static const float M_PIF
Describes the Region of Interest 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)
returns the tantheta for the limits and the r and z exit points from the ID volume
static const double maxRadius
TIDARoiDescriptor(bool fullscan=false)
default constructor
TIDARoiDescriptor & operator=(const TIDARoiDescriptor &r)
copy 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