ATLAS Offline Software
Loading...
Searching...
No Matches
TIDARoiDescriptor.cxx
Go to the documentation of this file.
1
11
12
13#include <cmath>
14
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_zedPlusR(0),
68 m_zedMinusR(0),
69 m_rPlusZed(0),
71{
72 if ( m_fullscan ) {
73 m_params = TIDARoiParameters( 0, -5, 5, 0, -M_PI, M_PI, 0, -225, 225 );
74
77 }
78}
79
80
82 double phi, double phiMinus, double phiPlus,
83 double zed, double zedMinus, double zedPlus )
86 zed, zedMinus, zedPlus ),
87 m_fullscan(false),
88 m_l1Id(0), m_roiId(0), m_roiWord(0)
89{
90 // calculate z limits at radius maxRadius
91
94}
95
96
97TIDARoiDescriptor::TIDARoiDescriptor( unsigned int l1id, int id,
98 double eta, double etaMinus, double etaPlus,
99 double phi, double phiMinus, double phiPlus,
100 double zed, double zedMinus, double zedPlus )
101 : m_params( eta, etaMinus, etaPlus,
102 phi, phiMinus, phiPlus,
103 zed, zedMinus, zedPlus ),
104 m_fullscan(false),
105 m_l1Id(l1id), m_roiId(id), m_roiWord(0)
106{
107 // calculate z limits at radius maxRadius
108
111}
112
113
114TIDARoiDescriptor::TIDARoiDescriptor(unsigned int roiword, unsigned int l1id, int id,
115 double eta, double etaMinus, double etaPlus,
116 double phi, double phiMinus, double phiPlus,
117 double zed, double zedMinus, double zedPlus )
118 : m_params( eta, etaMinus, etaPlus,
119 phi, phiMinus, phiPlus,
120 zed, zedMinus, zedPlus ),
121 m_fullscan(false),
122 m_l1Id(l1id), m_roiId(id), m_roiWord(roiword)
123{
124 // calculate z limits at radius maxRadius
125
128}
129
130
141
142
144{
145 if (this != &a) {
146 TObject::operator= (a);
147 m_params = a.m_params;
148 m_fullscan = a.m_fullscan;
149 m_l1Id = a.m_l1Id;
150 m_roiId = a.m_roiId;
151 m_roiWord = a.m_roiWord;
152 m_rois = a.m_rois;
155 }
156 return *this;
157}
158
159
161
162
163TIDARoiDescriptor::operator std::string() const {
164 std::stringstream s;
165 s << " z: " << zed() << " (" << zedMinus() << " - " << zedPlus() << ")"
166 << " eta: " << eta() << " (" << etaMinus() << " - " << etaPlus() << ")"
167 << " phi: " << phi() << " (" << phiMinus() << " - " << phiPlus() << ")";
168 if ( m_fullscan ) s << " (fullscan)";
169 s << " RoIid: " << roiId() << " RoIword: " << roiWord() << " (size " << size() << ")";
170 for ( unsigned i=0 ; i<size() ; i++ ) s << "\n\t\t" << i << ": " << (std::string)*at(i);
171 return s.str();
172}
173
174
175
177 if ( !(phi > -M_PIF && phi < M_PIF ) ) { // use ! of range rather than range to also catch nan etc
178 if ( phi < -M_PIF ) phi += M_2PI;
179 else phi -= M_2PI;
180 // std::cerr << "TIDARoiDescriptor constructed with phi smaller than -PI (allowed range -PI / +PI) PhiRange" << std::endl;
181 // std::cerr << "TIDARoiDescriptor constructed with phi greater than PI (allowed range -PI / +PI) PhiRange" << std::endl;
182 }
183 return phi;
184}
185
186
188 if ( !(eta > -100 && eta < 100) ) { // check also for nan
189 std::cerr << "TIDARoiDescriptor constructed with eta outside range -100 < eta <100 EtaRange" << std::endl;
190 }
191 return eta;
192}
193
194
196 if ( !(zed > -100000 && zed < 100000 ) ) { // check also for nan
197 std::cerr << "TIDARoiDescriptor constructed with eta outside range -100000 < sed <100000 ZedRange" << std::endl;
198 }
199 return zed;
200}
201
202
203
#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 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