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 m_cached(false), m_dphi(0)
93{
94 // calculate z limits at radius maxRadius
95
98}
99
100
101TIDARoiDescriptor::TIDARoiDescriptor( unsigned int l1id, int id,
102 double eta, double etaMinus, double etaPlus,
103 double phi, double phiMinus, double phiPlus,
104 double zed, double zedMinus, double zedPlus )
105 : m_params( eta, etaMinus, etaPlus,
106 phi, phiMinus, phiPlus,
107 zed, zedMinus, zedPlus ),
108 m_fullscan(false),
109 m_l1Id(l1id), m_roiId(id), m_roiWord(0),
110 m_cached(false), m_dphi(0)
111{
112 // calculate z limits at radius maxRadius
113
116}
117
118
119TIDARoiDescriptor::TIDARoiDescriptor(unsigned int roiword, unsigned int l1id, int id,
120 double eta, double etaMinus, double etaPlus,
121 double phi, double phiMinus, double phiPlus,
122 double zed, double zedMinus, double zedPlus )
123 : m_params( eta, etaMinus, etaPlus,
124 phi, phiMinus, phiPlus,
125 zed, zedMinus, zedPlus ),
126 m_fullscan(false),
127 m_l1Id(l1id), m_roiId(id), m_roiWord(roiword),
128 m_cached(false), m_dphi(0)
129{
130 // calculate z limits at radius maxRadius
133}
134
135
147
148
150{
151 if (this != &a) {
152 TObject::operator= (a);
153 m_params = a.m_params;
154 m_fullscan = a.m_fullscan;
155 m_l1Id = a.m_l1Id;
156 m_roiId = a.m_roiId;
157 m_roiWord = a.m_roiWord;
158 m_rois = a.m_rois;
159 m_cached = a.m_cached;
160 m_dphi = a.m_dphi;
163 }
164 return *this;
165}
166
167
169
170
171TIDARoiDescriptor::operator std::string() const {
172 std::stringstream s;
173 s << " z: " << zed() << " (" << zedMinus() << " - " << zedPlus() << ")"
174 << " eta: " << eta() << " (" << etaMinus() << " - " << etaPlus() << ")"
175 << " phi: " << phi() << " (" << phiMinus() << " - " << phiPlus() << ")";
176 if ( m_fullscan ) s << " (fullscan)";
177 s << " RoIid: " << roiId() << " RoIword: " << roiWord() << " (size " << size() << ")";
178 for ( unsigned i=0 ; i<size() ; i++ ) s << "\n\t\t" << i << ": " << (std::string)*at(i);
179 return s.str();
180}
181
182
183
185 if ( !(phi > -M_PIF && phi < M_PIF ) ) { // use ! of range rather than range to also catch nan etc
186 if ( phi < -M_PIF ) phi += M_2PI;
187 else phi -= M_2PI;
188 // std::cerr << "TIDARoiDescriptor constructed with phi smaller than -PI (allowed range -PI / +PI) PhiRange" << std::endl;
189 // std::cerr << "TIDARoiDescriptor constructed with phi greater than PI (allowed range -PI / +PI) PhiRange" << std::endl;
190 }
191 return phi;
192}
193
194
196 if ( !(eta > -100 && eta < 100) ) { // check also for nan
197 std::cerr << "TIDARoiDescriptor constructed with eta outside range -100 < eta <100 EtaRange" << std::endl;
198 }
199 return eta;
200}
201
202
204 if ( !(zed > -100000 && zed < 100000 ) ) { // check also for nan
205 std::cerr << "TIDARoiDescriptor constructed with eta outside range -100000 < sed <100000 ZedRange" << std::endl;
206 }
207 return zed;
208}
209
210
211
#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