CMS 3D CMS Logo

FastTimeDDDConstants.cc
Go to the documentation of this file.
2 
6 
7 #define EDM_ML_DEBUG
8 using namespace geant_units::operators;
9 
11 #ifdef EDM_ML_DEBUG
12  edm::LogVerbatim("HGCalGeom") << "FastTimeDDDConstants::FastTimeDDDConstants "
13  << "( const FastTimeParameters* ft ) constructor";
14 #endif
15  initialize();
16 }
17 
19 #ifdef EDM_ML_DEBUG
20  edm::LogVerbatim("HGCalGeom") << "FastTimeDDDConstants:destructed!!!";
21 #endif
22 }
23 
24 std::pair<int, int> FastTimeDDDConstants::getZPhi(double z, double phi) const {
25  if (phi < 0)
26  phi += (2 * geant_units::piRadians);
27  int iz = (int)(z / dZBarrel_) + 1;
28  if (iz > ftpar_->nZBarrel_)
29  iz = ftpar_->nZBarrel_;
30  int iphi = (int)(phi / dPhiBarrel_) + 1;
31  if (iphi > ftpar_->nPhiBarrel_)
32  iphi = 1;
33 #ifdef EDM_ML_DEBUG
34  edm::LogVerbatim("HGCalGeom") << "FastTimeDDDConstants:Barrel z|phi " << z << " " << convertRadToDeg(phi)
35  << " iz|iphi " << iz << " " << iphi;
36 #endif
37  return std::pair<int, int>(iz, iphi);
38 }
39 
40 std::pair<int, int> FastTimeDDDConstants::getEtaPhi(double r, double phi) const {
41  if (phi < 0)
42  phi += (2 * geant_units::piRadians);
43  int ir(ftpar_->nEtaEndcap_);
44  for (unsigned int k = 1; k < rLimits_.size(); ++k) {
45  if (r > rLimits_[k]) {
46  ir = k;
47  break;
48  }
49  }
50  int iphi = (int)(phi / dPhiEndcap_) + 1;
51  if (iphi > ftpar_->nPhiEndcap_)
52  iphi = 1;
53 #ifdef EDM_ML_DEBUG
54  edm::LogVerbatim("HGCalGeom") << "FastTimeDDDConstants:Endcap r|phi " << r << " " << convertRadToDeg(phi)
55  << " ir|iphi " << ir << " " << iphi;
56 #endif
57  return std::pair<int, int>(ir, iphi);
58 }
59 
60 GlobalPoint FastTimeDDDConstants::getPosition(int type, int izeta, int iphi, int zside) const {
61  double x(0), y(0), z(0);
62  if (type == 1) {
63  double phi = (iphi - 0.5) * dPhiBarrel_;
64  x = ftpar_->geomParBarrel_[2] * cos(phi);
65  y = ftpar_->geomParBarrel_[2] * sin(phi);
66  z = ftpar_->geomParBarrel_[0] + (izeta - 0.5) * dZBarrel_;
67  } else if (type == 2) {
68  double phi = (iphi - 0.5) * dPhiEndcap_;
69  double r = (izeta <= 0 || izeta >= (int)(rLimits_.size())) ? 0 : 0.5 * (rLimits_[izeta - 1] + rLimits_[izeta]);
70  x = (zside < 0) ? -r * cos(phi) : r * cos(phi);
71  y = r * sin(phi);
72  z = ftpar_->geomParEndcap_[2];
73  }
74  if (zside < 0)
75  z = -z;
76  GlobalPoint p(x, y, z);
77  return p;
78 }
79 
80 std::vector<GlobalPoint> FastTimeDDDConstants::getCorners(int type, int izeta, int iphi, int zside) const {
81  double x(0), y(0), z(0), dx(0), dz(0), r(0), phi(0);
82  if (type == 1) {
83  phi = (iphi - 0.5) * dPhiBarrel_;
84  r = ftpar_->geomParBarrel_[2];
85  x = r * cos(phi);
86  y = r * sin(phi);
87  z = ftpar_->geomParBarrel_[0] + (izeta - 0.5) * dZBarrel_;
88  dx = 0.5 * ftpar_->geomParBarrel_[3];
89  dz = 0.5 * dZBarrel_;
90  } else if (type == 2) {
91  phi = (iphi - 0.5) * dPhiEndcap_;
92  r = (izeta <= 0 || izeta >= (int)(rLimits_.size())) ? 0 : 0.5 * (rLimits_[izeta - 1] + rLimits_[izeta]);
93  x = (zside < 0) ? -r * cos(phi) : r * cos(phi);
94  y = r * sin(phi);
95  z = ftpar_->geomParEndcap_[2];
96  dx = 0.5 * r * dPhiEndcap_;
97  dz = 0.5 * ftpar_->geomParEndcap_[3];
98  }
99  if (zside < 0) {
100  z = -z;
101  dz = -dz;
102  }
103  static const int signx[8] = {-1, -1, 1, 1, -1, -1, 1, 1};
104  static const int signy[8] = {-1, 1, 1, -1, -1, 1, 1, -1};
105  static const int signz[8] = {-1, -1, -1, -1, 1, 1, 1, 1};
106  std::vector<GlobalPoint> pts;
107  for (unsigned int i = 0; i != 8; ++i) {
108  GlobalPoint p(x + signx[i] * dx, y + signy[i] * dx, z + signz[i] * dz);
109  pts.emplace_back(p);
110  }
111  return pts;
112 }
113 
115  int numb(0);
116  if (type == 1) {
117  numb = (ftpar_->nZBarrel_) * (ftpar_->nPhiBarrel_);
118  } else if (type == 2) {
119  numb = (ftpar_->nEtaEndcap_) * (ftpar_->nPhiEndcap_);
120  }
121  return numb;
122 }
123 
125  double value(0);
126  if (type == 1) {
127  value = (ftpar_->geomParBarrel_[2]);
128  } else if (type == 2) {
129  value = (ftpar_->geomParEndcap_[0]);
130  }
131  return value;
132 }
133 
135  double value(0);
136  if (type == 1) {
138  } else if (type == 2) {
139  value = (ftpar_->geomParEndcap_[1]);
140  }
141  return value;
142 }
143 
145  double value(0);
146  if (type == 1) {
147  value = 0.5 * (ftpar_->geomParBarrel_[1] - ftpar_->geomParBarrel_[0]);
148  } else if (type == 2) {
149  value = (ftpar_->geomParEndcap_[3]);
150  }
151  return value;
152 }
153 
155  double value(0);
156  if (type == 1) {
157  value = 0.5 * (ftpar_->geomParBarrel_[1] + ftpar_->geomParBarrel_[0]);
158  } else if (type == 2) {
159  value = (ftpar_->geomParEndcap_[2]);
160  }
161  return value;
162 }
163 
164 bool FastTimeDDDConstants::isValidXY(int type, int izeta, int iphi) const {
165  bool ok(false);
166  if (type == 1) {
167  ok = ((izeta > 0) && (izeta <= ftpar_->nZBarrel_) && (iphi > 0) && (iphi <= ftpar_->nPhiBarrel_));
168  } else if (type == 2) {
169  ok = ((izeta > 0) && (izeta <= ftpar_->nEtaEndcap_) && (iphi > 0) && (iphi <= ftpar_->nPhiEndcap_));
170  }
171  return ok;
172 }
173 
175  int numb(0);
176  if (type == 1) {
177  numb = (ftpar_->nZBarrel_);
178  } else if (type == 2) {
179  numb = (ftpar_->nEtaEndcap_);
180  }
181  return numb;
182 }
183 
185  int numb(0);
186  if (type == 1) {
187  numb = (ftpar_->nPhiBarrel_);
188  } else if (type == 2) {
189  numb = (ftpar_->nPhiEndcap_);
190  }
191  return numb;
192 }
193 
195  double thmin = atan(ftpar_->geomParEndcap_[0] / ftpar_->geomParEndcap_[2]);
196  etaMax_ = -log(0.5 * thmin);
197  double thmax = atan(ftpar_->geomParEndcap_[1] / ftpar_->geomParEndcap_[2]);
198  etaMin_ = -log(0.5 * thmax);
200 #ifdef EDM_ML_DEBUG
201  edm::LogVerbatim("HGCalGeom") << "Theta range " << convertRadToDeg(thmin) << ":" << convertRadToDeg(thmax)
202  << " Eta range " << etaMin_ << ":" << etaMax_ << ":" << dEta_;
203 #endif
204  for (int k = 0; k <= ftpar_->nEtaEndcap_; ++k) {
205  double eta = etaMin_ + k * dEta_;
206  double theta = 2.0 * atan(exp(-eta));
207  double rval = (ftpar_->geomParEndcap_[2]) * tan(theta);
208  rLimits_.emplace_back(rval);
209  }
213 #ifdef EDM_ML_DEBUG
214  edm::LogVerbatim("HGCalGeom") << "FastTimeDDDConstants initialized with " << ftpar_->nZBarrel_ << ":"
215  << ftpar_->nPhiBarrel_ << ":" << getCells(1) << " cells for barrel; dz|dphi "
216  << dZBarrel_ << "|" << dPhiBarrel_ << " and " << ftpar_->nEtaEndcap_ << ":"
217  << ftpar_->nPhiEndcap_ << ":" << getCells(2) << " cells for endcap; dphi "
218  << dPhiEndcap_ << " The Limits in R are";
219  for (unsigned int k = 0; k < rLimits_.size(); ++k)
220  edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << rLimits_[k] << " ";
221 #endif
222 }
223 
225 
DDAxes::y
FastTimeDDDConstants::getRout
double getRout(int type) const
Definition: FastTimeDDDConstants.cc:134
FastTimeDDDConstants::rLimits_
std::vector< double > rLimits_
Definition: FastTimeDDDConstants.h:43
mps_fire.i
i
Definition: mps_fire.py:428
MessageLogger.h
detailsBasic3DVector::z
float float float z
Definition: extBasic3DVector.h:14
FastTimeDDDConstants::etaMax_
double etaMax_
Definition: FastTimeDDDConstants.h:41
ecaldqm::zside
int zside(DetId const &)
Definition: EcalDQMCommonUtils.cc:189
angle_units::operators::convertRadToDeg
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
FastTimeParameters::geomParBarrel_
std::vector< double > geomParBarrel_
Definition: FastTimeParameters.h:18
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
FastTimeDDDConstants::initialize
void initialize()
Definition: FastTimeDDDConstants.cc:194
typelookup.h
FastTimeDDDConstants::dZBarrel_
double dZBarrel_
Definition: FastTimeDDDConstants.h:42
DDAxes::x
geant_units::operators
Definition: GeantUnits.h:18
FastTimeDDDConstants
Definition: FastTimeDDDConstants.h:19
convertSQLiteXML.ok
bool ok
Definition: convertSQLiteXML.py:98
FastTimeDDDConstants::getZPos
double getZPos(int type) const
Definition: FastTimeDDDConstants.cc:154
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
LEDCalibrationChannels.iphi
iphi
Definition: LEDCalibrationChannels.py:64
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
FastTimeDDDConstants::getRin
double getRin(int type) const
Definition: FastTimeDDDConstants.cc:124
FastTimeDDDConstants::~FastTimeDDDConstants
~FastTimeDDDConstants()
Definition: FastTimeDDDConstants.cc:18
PVValHelper::eta
Definition: PVValidationHelpers.h:69
FastTimeDDDConstants::getZPhi
std::pair< int, int > getZPhi(double z, double phi) const
Definition: FastTimeDDDConstants.cc:24
DDAxes::z
theta
Geom::Theta< T > theta() const
Definition: Basic3DVectorLD.h:150
FastTimeDDDConstants::dEta_
double dEta_
Definition: FastTimeDDDConstants.h:41
dqmdumpme.k
k
Definition: dqmdumpme.py:60
Point3DBase< float, GlobalTag >
FastTimeDDDConstants::FastTimeDDDConstants
FastTimeDDDConstants(const FastTimeParameters *ftp)
Definition: FastTimeDDDConstants.cc:10
FastTimeDDDConstants::getCells
int getCells(int type) const
Definition: FastTimeDDDConstants.cc:114
angle_units::piRadians
constexpr long double piRadians(M_PIl)
FastTimeParameters::nPhiBarrel_
int nPhiBarrel_
Definition: FastTimeParameters.h:15
PVValHelper::phi
Definition: PVValidationHelpers.h:68
FastTimeDDDConstants::numberPhi
int numberPhi(int type) const
Definition: FastTimeDDDConstants.cc:184
GeantUnits.h
FastTimeParameters::nEtaEndcap_
int nEtaEndcap_
Definition: FastTimeParameters.h:16
type
type
Definition: SiPixelVCal_PayloadInspector.cc:37
FastTimeParameters::nZBarrel_
int nZBarrel_
Definition: FastTimeParameters.h:14
FastTimeDDDConstants.h
funct::tan
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
FastTimeDDDConstants::etaMin_
double etaMin_
Definition: FastTimeDDDConstants.h:41
createfilelist.int
int
Definition: createfilelist.py:10
value
Definition: value.py:1
FastTimeDDDConstants::numberEtaZ
int numberEtaZ(int type) const
Definition: FastTimeDDDConstants.cc:174
FastTimeDDDConstants::getEtaPhi
std::pair< int, int > getEtaPhi(double r, double phi) const
Definition: FastTimeDDDConstants.cc:40
EDM_ML_DEBUG
#define EDM_ML_DEBUG
Definition: FastTimeDDDConstants.cc:7
RPCpg::pts
static const double pts[33]
Definition: Constants.h:30
TYPELOOKUP_DATA_REG
#define TYPELOOKUP_DATA_REG(_dataclass_)
Definition: typelookup.h:102
FastTimeParameters
Definition: FastTimeParameters.h:9
alignCSCRings.r
r
Definition: alignCSCRings.py:93
DDAxes::phi
PVValHelper::dz
Definition: PVValidationHelpers.h:50
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
relativeConstraints.value
value
Definition: relativeConstraints.py:53
FastTimeDDDConstants::dPhiBarrel_
double dPhiBarrel_
Definition: FastTimeDDDConstants.h:42
FastTimeParameters::geomParEndcap_
std::vector< double > geomParEndcap_
Definition: FastTimeParameters.h:19
FastTimeDDDConstants::ftpar_
const FastTimeParameters * ftpar_
Definition: FastTimeDDDConstants.h:40
FastTimeDDDConstants::isValidXY
bool isValidXY(int type, int izeta, int iphi) const
Definition: FastTimeDDDConstants.cc:164
Exception.h
dqm-mbProfile.log
log
Definition: dqm-mbProfile.py:17
FastTimeDDDConstants::dPhiEndcap_
double dPhiEndcap_
Definition: FastTimeDDDConstants.h:42
FastTimeDDDConstants::getZHalf
double getZHalf(int type) const
Definition: FastTimeDDDConstants.cc:144
FastTimeDDDConstants::getCorners
std::vector< GlobalPoint > getCorners(int type, int izeta, int iphi, int zside) const
Definition: FastTimeDDDConstants.cc:80
JetChargeProducer_cfi.exp
exp
Definition: JetChargeProducer_cfi.py:6
FastTimeDDDConstants::getPosition
GlobalPoint getPosition(int type, int izeta, int iphi, int zside) const
Definition: FastTimeDDDConstants.cc:60
edm::Log
Definition: MessageLogger.h:70
PVValHelper::dx
Definition: PVValidationHelpers.h:48
FastTimeParameters::nPhiEndcap_
int nPhiEndcap_
Definition: FastTimeParameters.h:17