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 );
75
78 }
79}
80
81
83 double phi, double phiMinus, double phiPlus,
84 double zed, double zedMinus, double zedPlus )
87 zed, zedMinus, zedPlus ),
88 m_fullscan(false),
89 m_l1Id(0), m_roiId(0), m_roiWord(0)
90{
91 // calculate z limits at radius maxRadius
92
95}
96
97
98TIDARoiDescriptor::TIDARoiDescriptor( unsigned int l1id, int id,
99 double eta, double etaMinus, double etaPlus,
100 double phi, double phiMinus, double phiPlus,
101 double zed, double zedMinus, double zedPlus )
102 : m_params( eta, etaMinus, etaPlus,
103 phi, phiMinus, phiPlus,
104 zed, zedMinus, zedPlus ),
105 m_fullscan(false),
106 m_l1Id(l1id), m_roiId(id), m_roiWord(0)
107{
108 // calculate z limits at radius maxRadius
109
112}
113
114
115TIDARoiDescriptor::TIDARoiDescriptor(unsigned int roiword, unsigned int l1id, int id,
116 double eta, double etaMinus, double etaPlus,
117 double phi, double phiMinus, double phiPlus,
118 double zed, double zedMinus, double zedPlus )
119 : m_params( eta, etaMinus, etaPlus,
120 phi, phiMinus, phiPlus,
121 zed, zedMinus, zedPlus ),
122 m_fullscan(false),
123 m_l1Id(l1id), m_roiId(id), m_roiWord(roiword)
124{
125 // calculate z limits at radius maxRadius
126
129}
130
131
142
143
145{
146 if (this != &a) {
147 TObject::operator= (a);
148 m_params = a.m_params;
149 m_fullscan = a.m_fullscan;
150 m_l1Id = a.m_l1Id;
151 m_roiId = a.m_roiId;
152 m_roiWord = a.m_roiWord;
153 m_rois = a.m_rois;
156 }
157 return *this;
158}
159
160
162
163
164TIDARoiDescriptor::operator std::string() const {
165 std::stringstream s;
166 s << " z: " << zed() << " (" << zedMinus() << " - " << zedPlus() << ")"
167 << " eta: " << eta() << " (" << etaMinus() << " - " << etaPlus() << ")"
168 << " phi: " << phi() << " (" << phiMinus() << " - " << phiPlus() << ")";
169 if ( m_fullscan ) s << " (fullscan)";
170 s << " RoIid: " << roiId() << " RoIword: " << roiWord() << " (size " << size() << ")";
171 for ( unsigned i=0 ; i<size() ; i++ ) s << "\n\t\t" << i << ": " << (std::string)*at(i);
172 return s.str();
173}
174
175
176
178 if ( !(phi > -M_PIF && phi < M_PIF ) ) { // use ! of range rather than range to also catch nan etc
179 if ( phi < -M_PIF ) phi += M_2PI;
180 else phi -= M_2PI;
181 // std::cerr << "TIDARoiDescriptor constructed with phi smaller than -PI (allowed range -PI / +PI) PhiRange" << std::endl;
182 // std::cerr << "TIDARoiDescriptor constructed with phi greater than PI (allowed range -PI / +PI) PhiRange" << std::endl;
183 }
184 return phi;
185}
186
187
189 if ( !(eta > -100 && eta < 100) ) { // check also for nan
190 std::cerr << "TIDARoiDescriptor constructed with eta outside range -100 < eta <100 EtaRange" << std::endl;
191 }
192 return eta;
193}
194
195
197 if ( !(zed > -100000 && zed < 100000 ) ) { // check also for nan
198 std::cerr << "TIDARoiDescriptor constructed with eta outside range -100000 < sed <100000 ZedRange" << std::endl;
199 }
200 return zed;
201}
202
203
204
#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