ATLAS Offline Software
Loading...
Searching...
No Matches
RegSelModule.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
5
6/**************************************************************************
7 **
8 ** File: RegSelModule.cxx
9 **
10 ** Description:
11 **
12 **
13 **
14 ** Author: M.Sutton
15 **
16 ** Created: Tue Apr 3 11:16:12 BST 2007
17 ** Modified:
18 **
19 **
20 **
21 **************************************************************************/
22
23
24
26
27#include <iostream>
28#include <cmath>
29
30
32 ZRObject( 0, 0, 0, 0 ),
33 m_phiMin(0), m_phiMax(0),
34 m_layer(0), m_detector(0),
35 m_robID(0), m_hashID(0) { }
36
37
38
39RegSelModule::RegSelModule(double zmin, double zmax,
40 double rmin, double rmax,
41 double phimin, double phimax,
42 int layer,
43 int detector,
44 uint32_t robid,
45 IdentifierHash hashid) :
46 // ZRObject( std::sqrt(rmin), std::sqrt(rmax), // zmin, zmax ),
47 // ( zmin<0 ? -1 : 1 )*std::sqrt(std::fabs(zmin)),
48 // ( zmax<0 ? -1 : 1 )*std::sqrt(std::fabs(zmax)) ),
49 // ZRObject( std::log10(rmin)-1.6, std::log10(rmax)-1.6, // zmin, zmax ),
50 // ( zmin<0 ? -1 : 1 )*std::log10(std::fabs(zmin)),
51 // ( zmax<0 ? -1 : 1 )*std::log10(std::fabs(zmax)) ),
52 ZRObject( rmin, rmax, zmin, zmax ),
53 m_phiMin(phimin), m_phiMax(phimax),
55 m_robID(robid), m_hashID(hashid)
56{
57 while ( m_phiMax> M_PI ) m_phiMax-=2*M_PI;
58 while ( m_phiMax<-M_PI ) m_phiMax+=2*M_PI;
59 while ( m_phiMin> M_PI ) m_phiMin-=2*M_PI;
60 while ( m_phiMin<-M_PI ) m_phiMin+=2*M_PI;
61 // std::cout << "RegSelModule() " << *this << std::endl;
62}
63
64
65
66
67RegSelModule::RegSelModule(double zmin, double zmax,
68 double z2min, double z2max,
69 double rmin, double rmax,
70 double phimin, double phimax,
71 int layer,
72 int detector,
73 uint32_t robid,
74 IdentifierHash hashid) :
75 // ZRObject( std::sqrt(rmin), std::sqrt(rmax), // zmin, zmax ),
76 // ( zmin<0 ? -1 : 1 )*std::sqrt(std::fabs(zmin)),
77 // ( zmax<0 ? -1 : 1 )*std::sqrt(std::fabs(zmax)) ),
78 // ZRObject( std::log10(rmin)-1.6, std::log10(rmax)-1.6, // zmin, zmax ),
79 // ( zmin<0 ? -1 : 1 )*std::log10(std::fabs(zmin)),
80 // ( zmax<0 ? -1 : 1 )*std::log10(std::fabs(zmax)) ),
81 ZRObject( rmin, rmax, zmin, zmax, z2min, z2max ),
82 m_phiMin(phimin), m_phiMax(phimax),
84 m_robID(robid), m_hashID(hashid)
85{
86 while ( m_phiMax> M_PI ) m_phiMax-=2*M_PI;
87 while ( m_phiMax<-M_PI ) m_phiMax+=2*M_PI;
88 while ( m_phiMin> M_PI ) m_phiMin-=2*M_PI;
89 while ( m_phiMin<-M_PI ) m_phiMin+=2*M_PI;
90 // std::cout << "RegSelModule() " << *this << std::endl;
91}
92
93
94
95std::ostream& operator<<(std::ostream& s, const RegSelModule& m)
96{
97 s << "[ lyr= " << m.layer()
98 << " ,\tdet= " << m.detector()
99 << " ,\tr= " << m.rMin() << " - " << m.rMax()
100 << " ,\tphi= " << m.phiMin()*180/M_PI << " - " << m.phiMax()*180/M_PI
101 << " ,\tz= " << m.zMin() << " - " << m.zMax();
102 if ( m.zMin()!=m.z2Min() || m.zMax()!=m.z2Max() ) s << " ,\tz2= " << m.z2Min() << " - " << m.z2Max();
103 s << " ,\trob= 0x" << std::hex << m.robID()
104 << " ,\thash= 0x" << std::hex << m.hashID() << std::dec << ( m.enabled() ? " ]" : " (disabled)]");
105 return s;
106}
107
108
109
110bool getModule(std::istream& ss, RegSelModule& m)
111{
112 char s[128], s1[128], s2[128];
113
114 int layer;
115 int detector;
116
117 double rMin, rMax;
118 double zMin, zMax;
119 double z2Min, z2Max;
120 double phiMin, phiMax;
121
122 uint32_t robid;
123 // IdentifierHash hash;
124 unsigned int hashint;
125
126 ss >> s >> s >> std::dec >> layer
127 >> s >> s >> std::dec >> detector
128 >> s >> s >> rMin >> s >> rMax
129 >> s >> s >> phiMin >> s >> phiMax
130 >> s >> s >> zMin >> s >> zMax;
131
133 z2Min = zMin;
134 z2Max = zMax;
135
136 ss >> s1 >> s2;
137
139 if ( std::string(s2)=="z2=" ) {
140 ss >> z2Min >> s >> z2Max;
141 ss >> s >> s;
142 }
143
144 ss >> std::hex >> robid
145 >> s >> s >> std::hex >> hashint >> std::dec >> s;
146
147 if ( ss.fail() ) return false;
148
149 // std::cout << "s.fail() " << s.fail() << std::endl;
150
151 phiMin *= M_PI/180;
152 phiMax *= M_PI/180;
153
154 RegSelModule tm( zMin, zMax,
155 z2Min, z2Max,
156 rMin, rMax,
157 phiMin, phiMax,
158 layer,
159 detector,
160 robid,
161 IdentifierHash(hashint));
162
163 m=tm;
164
165 return true;
166}
167
168
#define M_PI
static Double_t ss
bool getModule(std::istream &ss, RegSelModule &m)
std::ostream & operator<<(std::ostream &s, const RegSelModule &m)
This is a "hash" representation of an Identifier.
IdentifierHash m_hashID
int detector() const
uint32_t m_robID
int layer() const
ZRObject()
Definition ZRObject.h:45