ATLAS Offline Software
TIDARoiDescriptor.cxx
Go to the documentation of this file.
1 
13 #include <cmath>
14 
16 
18 
19 
20 #ifndef M_2PI
21 #define M_2PI 6.283185307179586476925286766559005768394
22 #endif
23 
24 #ifndef M_PIF
25 static const float M_PIF = float(M_PI);
26 #endif
27 
28 const double TIDARoiDescriptor::maxRadius = 1000;
29 const double TIDARoiDescriptor::maxZed = 2700;
30 
31 
32 double 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),
70  m_rMinusZed(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 
81 TIDARoiDescriptor::TIDARoiDescriptor( double eta, double etaMinus, double etaPlus,
82  double phi, double phiMinus, double phiPlus,
83  double zed, double zedMinus, double zedPlus )
84  : m_params( eta, etaMinus, etaPlus,
85  phi, phiMinus, phiPlus,
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 
97 TIDARoiDescriptor::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 
114 TIDARoiDescriptor::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 
132  TObject(*this),
133  m_params(a.m_params),
134  m_fullscan(a.m_fullscan),
135  m_l1Id(a.m_l1Id), m_roiId(a.m_roiId), m_roiWord(a.m_roiWord),
136  m_rois(a.m_rois)
137 {
140 }
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 
163 TIDARoiDescriptor::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 
195 double TIDARoiDescriptor::zedcheck(double zed) {
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 
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
TIDARoiDescriptor::phi
double phi() const
Definition: TIDARoiDescriptor.h:133
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:64
TIDARoiDescriptor::zedMinus
double zedMinus() const
Definition: TIDARoiDescriptor.h:143
TIDARoiDescriptor::maxRadius
static const double maxRadius
Definition: TIDARoiDescriptor.h:269
TIDARoiDescriptor::m_rois
std::vector< TIDARoiDescriptor > m_rois
Definition: TIDARoiDescriptor.h:282
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
TIDARoiDescriptor::zedcheck
double zedcheck(double zed)
helper function to check if zed range was violated
Definition: TIDARoiDescriptor.cxx:195
TIDARoiDescriptor::m_zedMinusR
double m_zedMinusR
don't save - transient zPlus at radius R
Definition: TIDARoiDescriptor.h:288
TIDARoiDescriptor::m_rMinusZed
double m_rMinusZed
don't save - transient zPlus at radius R
Definition: TIDARoiDescriptor.h:291
TIDARoiDescriptor::etaPlus
double etaPlus() const
Definition: TIDARoiDescriptor.h:138
TIDARoiDescriptor::etaMinus
double etaMinus() const
Definition: TIDARoiDescriptor.h:137
TIDARoiDescriptor::exitpoint
static double exitpoint(double tz0, double teta, double &zexit, double &rexit)
Definition: TIDARoiDescriptor.cxx:32
M_PI
#define M_PI
Definition: ActiveFraction.h:11
TIDARoiParameters
Definition: TIDARoiParameters.h:29
TIDARoiDescriptor
Describes the Region of Ineterest geometry It has basically 8 parameters.
Definition: TIDARoiDescriptor.h:42
TIDARoiDescriptor.h
TIDARoiDescriptor::m_roiId
unsigned int m_roiId
Definition: TIDARoiDescriptor.h:279
TIDARoiDescriptor::zedPlus
double zedPlus() const
Definition: TIDARoiDescriptor.h:144
drawFromPickle.exp
exp
Definition: drawFromPickle.py:36
TIDARoiDescriptor::maxZed
static const double maxZed
don't save
Definition: TIDARoiDescriptor.h:270
drawFromPickle.atan
atan
Definition: drawFromPickle.py:36
TIDARoiDescriptor::m_rPlusZed
double m_rPlusZed
don't save - transient zMinus at radius R
Definition: TIDARoiDescriptor.h:290
xAOD::roiWord
roiWord
Definition: TrigMissingET_v1.cxx:36
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
M_2PI
#define M_2PI
lumiFormat.i
int i
Definition: lumiFormat.py:92
xAOD::roiId
setTeId setLumiBlock roiId
Definition: L2StandAloneMuon_v1.cxx:331
TIDARoiDescriptor::m_tanthetaMinus
double m_tanthetaMinus
don't save - transient roi edge gradients
Definition: TIDARoiDescriptor.h:294
TIDARoiDescriptor::m_params
TIDARoiParameters m_params
don't save
Definition: TIDARoiDescriptor.h:274
drawFromPickle.tan
tan
Definition: drawFromPickle.py:36
ClassImp
ClassImp(TIDARoiDescriptor) static const float M_PIF
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:194
TIDARoiDescriptor::eta
double eta() const
Definition: TIDARoiDescriptor.h:134
TIDARoiDescriptor::m_zedPlusR
double m_zedPlusR
cached value -
Definition: TIDARoiDescriptor.h:287
TIDARoiDescriptor::~TIDARoiDescriptor
virtual ~TIDARoiDescriptor()
Definition: TIDARoiDescriptor.cxx:160
a
TList * a
Definition: liststreamerinfos.cxx:10
TIDARoiDescriptor::operator=
TIDARoiDescriptor & operator=(const TIDARoiDescriptor &r)
assignment
Definition: TIDARoiDescriptor.cxx:143
TIDARoiDescriptor::etacheck
double etacheck(double eta)
helper function to check if eta range was violated
Definition: TIDARoiDescriptor.cxx:187
TIDARoiDescriptor::phicheck
double phicheck(double phi)
helper function to check if phi range was violated
Definition: TIDARoiDescriptor.cxx:176
TIDARoiDescriptor::TIDARoiDescriptor
TIDARoiDescriptor(bool fullscan=false)
default constructor
Definition: TIDARoiDescriptor.cxx:64
TIDARoiDescriptor::m_tanthetaPlus
double m_tanthetaPlus
don't save - transient zMinus at radius R
Definition: TIDARoiDescriptor.h:293
TIDARoiDescriptor::m_roiWord
unsigned int m_roiWord
Definition: TIDARoiDescriptor.h:280
TIDARoiDescriptor::m_l1Id
unsigned int m_l1Id
Definition: TIDARoiDescriptor.h:278
readCCLHist.float
float
Definition: readCCLHist.py:83
TIDARoiDescriptor::zed
double zed() const
Definition: TIDARoiDescriptor.h:135
TIDARoiDescriptor::m_fullscan
bool m_fullscan
Definition: TIDARoiDescriptor.h:276