CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
FastTimeDDDConstants Class Reference

#include <FastTimeDDDConstants.h>

Public Member Functions

 FastTimeDDDConstants (const FastTimeParameters *ftp)
 
int getCells (int type) const
 
std::vector< GlobalPointgetCorners (int type, int izeta, int iphi, int zside) const
 
std::pair< int, int > getEtaPhi (double r, double phi) const
 
GlobalPoint getPosition (int type, int izeta, int iphi, int zside) const
 
double getRin (int type) const
 
double getRout (int type) const
 
double getZHalf (int type) const
 
std::pair< int, int > getZPhi (double z, double phi) const
 
double getZPos (int type) const
 
bool isValidXY (int type, int izeta, int iphi) const
 
int numberEtaZ (int type) const
 
int numberPhi (int type) const
 
 ~FastTimeDDDConstants ()
 

Private Member Functions

void initialize ()
 

Private Attributes

double dEta_
 
double dPhiBarrel_
 
double dPhiEndcap_
 
double dZBarrel_
 
double etaMax_
 
double etaMin_
 
const FastTimeParametersftpar_
 
std::vector< double > rLimits_
 

Detailed Description

this class reads the constant section of the numbering xml-file for fast timer device

Author
Sunanda Banerjee, SINP sunan.nosp@m.da.b.nosp@m.anerj.nosp@m.ee@c.nosp@m.ern.c.nosp@m.h

Definition at line 19 of file FastTimeDDDConstants.h.

Constructor & Destructor Documentation

◆ FastTimeDDDConstants()

FastTimeDDDConstants::FastTimeDDDConstants ( const FastTimeParameters ftp)

Definition at line 10 of file FastTimeDDDConstants.cc.

References initialize().

10  : ftpar_(ft) {
11 #ifdef EDM_ML_DEBUG
12  edm::LogVerbatim("HGCalGeom") << "FastTimeDDDConstants::FastTimeDDDConstants "
13  << "( const FastTimeParameters* ft ) constructor";
14 #endif
15  initialize();
16 }
Log< level::Info, true > LogVerbatim
const FastTimeParameters * ftpar_

◆ ~FastTimeDDDConstants()

FastTimeDDDConstants::~FastTimeDDDConstants ( )

Definition at line 18 of file FastTimeDDDConstants.cc.

18  {
19 #ifdef EDM_ML_DEBUG
20  edm::LogVerbatim("HGCalGeom") << "FastTimeDDDConstants:destructed!!!";
21 #endif
22 }
Log< level::Info, true > LogVerbatim

Member Function Documentation

◆ getCells()

int FastTimeDDDConstants::getCells ( int  type) const

Definition at line 114 of file FastTimeDDDConstants.cc.

References ftpar_, FastTimeParameters::nEtaEndcap_, FastTimeParameters::nPhiBarrel_, FastTimeParameters::nPhiEndcap_, and FastTimeParameters::nZBarrel_.

Referenced by initialize().

114  {
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 }
const FastTimeParameters * ftpar_

◆ getCorners()

std::vector< GlobalPoint > FastTimeDDDConstants::getCorners ( int  type,
int  izeta,
int  iphi,
int  zside 
) const

Definition at line 80 of file FastTimeDDDConstants.cc.

References funct::cos(), dPhiBarrel_, dPhiEndcap_, PVValHelper::dx, PVValHelper::dz, dZBarrel_, ftpar_, FastTimeParameters::geomParBarrel_, FastTimeParameters::geomParEndcap_, mps_fire::i, createfilelist::int, LEDCalibrationChannels::iphi, AlCaHLTBitMon_ParallelJobs::p, phi, RPCpg::pts, alignCSCRings::r, rLimits_, funct::sin(), x, y, z, and ecaldqm::zside().

Referenced by FastTimeGeometryLoader::buildGeom(), and FastTimeGeometry::getCorners().

80  {
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 constexpr int signx[8] = {-1, -1, 1, 1, -1, -1, 1, 1};
104  static constexpr int signy[8] = {-1, 1, 1, -1, -1, 1, 1, -1};
105  static constexpr 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 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
int zside(DetId const &)
std::vector< double > geomParEndcap_
static const double pts[33]
Definition: Constants.h:30
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
std::vector< double > rLimits_
std::vector< double > geomParBarrel_
const FastTimeParameters * ftpar_

◆ getEtaPhi()

std::pair< int, int > FastTimeDDDConstants::getEtaPhi ( double  r,
double  phi 
) const

Definition at line 40 of file FastTimeDDDConstants.cc.

References angle_units::operators::convertRadToDeg(), dPhiEndcap_, ftpar_, createfilelist::int, LEDCalibrationChannels::iphi, dqmdumpme::k, FastTimeParameters::nEtaEndcap_, FastTimeParameters::nPhiEndcap_, phi, angle_units::piRadians(), alignCSCRings::r, and rLimits_.

Referenced by FastTimeGeometry::getClosestCell().

40  {
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 }
Log< level::Info, true > LogVerbatim
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
std::vector< double > rLimits_
constexpr double piRadians(M_PI)
const FastTimeParameters * ftpar_

◆ getPosition()

GlobalPoint FastTimeDDDConstants::getPosition ( int  type,
int  izeta,
int  iphi,
int  zside 
) const

Definition at line 60 of file FastTimeDDDConstants.cc.

References funct::cos(), dPhiBarrel_, dPhiEndcap_, dZBarrel_, ftpar_, FastTimeParameters::geomParBarrel_, FastTimeParameters::geomParEndcap_, createfilelist::int, LEDCalibrationChannels::iphi, AlCaHLTBitMon_ParallelJobs::p, phi, alignCSCRings::r, rLimits_, funct::sin(), x, y, z, and ecaldqm::zside().

Referenced by FastTimeGeometry::getPosition().

60  {
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 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
int zside(DetId const &)
std::vector< double > geomParEndcap_
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
std::vector< double > rLimits_
std::vector< double > geomParBarrel_
const FastTimeParameters * ftpar_

◆ getRin()

double FastTimeDDDConstants::getRin ( int  type) const

Definition at line 124 of file FastTimeDDDConstants.cc.

References ftpar_, FastTimeParameters::geomParBarrel_, FastTimeParameters::geomParEndcap_, and relativeConstraints::value.

Referenced by FastTimeGeometryLoader::build(), and FastTimeGeometry::getSummary().

124  {
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 }
std::vector< double > geomParEndcap_
Definition: value.py:1
std::vector< double > geomParBarrel_
const FastTimeParameters * ftpar_

◆ getRout()

double FastTimeDDDConstants::getRout ( int  type) const

Definition at line 134 of file FastTimeDDDConstants.cc.

References ftpar_, FastTimeParameters::geomParBarrel_, FastTimeParameters::geomParEndcap_, and relativeConstraints::value.

Referenced by FastTimeGeometryLoader::build(), and FastTimeGeometry::getSummary().

134  {
135  double value(0);
136  if (type == 1) {
138  } else if (type == 2) {
139  value = (ftpar_->geomParEndcap_[1]);
140  }
141  return value;
142 }
std::vector< double > geomParEndcap_
Definition: value.py:1
std::vector< double > geomParBarrel_
const FastTimeParameters * ftpar_

◆ getZHalf()

double FastTimeDDDConstants::getZHalf ( int  type) const

Definition at line 144 of file FastTimeDDDConstants.cc.

References ftpar_, FastTimeParameters::geomParBarrel_, FastTimeParameters::geomParEndcap_, and relativeConstraints::value.

Referenced by FastTimeGeometryLoader::build(), and FastTimeGeometry::getSummary().

144  {
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 }
std::vector< double > geomParEndcap_
Definition: value.py:1
std::vector< double > geomParBarrel_
const FastTimeParameters * ftpar_

◆ getZPhi()

std::pair< int, int > FastTimeDDDConstants::getZPhi ( double  z,
double  phi 
) const

Definition at line 24 of file FastTimeDDDConstants.cc.

References angle_units::operators::convertRadToDeg(), dPhiBarrel_, dZBarrel_, ftpar_, createfilelist::int, LEDCalibrationChannels::iphi, FastTimeParameters::nPhiBarrel_, FastTimeParameters::nZBarrel_, phi, angle_units::piRadians(), and z.

Referenced by FastTimeGeometry::getClosestCell().

24  {
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 }
Log< level::Info, true > LogVerbatim
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
constexpr double piRadians(M_PI)
const FastTimeParameters * ftpar_

◆ getZPos()

double FastTimeDDDConstants::getZPos ( int  type) const

Definition at line 154 of file FastTimeDDDConstants.cc.

References ftpar_, FastTimeParameters::geomParBarrel_, FastTimeParameters::geomParEndcap_, and relativeConstraints::value.

Referenced by FastTimeGeometryLoader::build().

154  {
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 }
std::vector< double > geomParEndcap_
Definition: value.py:1
std::vector< double > geomParBarrel_
const FastTimeParameters * ftpar_

◆ initialize()

void FastTimeDDDConstants::initialize ( void  )
private

Definition at line 194 of file FastTimeDDDConstants.cc.

References angle_units::operators::convertRadToDeg(), dEta_, dPhiBarrel_, dPhiEndcap_, dZBarrel_, EDM_ML_DEBUG, PVValHelper::eta, etaMax_, etaMin_, JetChargeProducer_cfi::exp, ftpar_, FastTimeParameters::geomParBarrel_, FastTimeParameters::geomParEndcap_, getCells(), dqmdumpme::k, dqm-mbProfile::log, FastTimeParameters::nEtaEndcap_, FastTimeParameters::nPhiBarrel_, FastTimeParameters::nPhiEndcap_, FastTimeParameters::nZBarrel_, angle_units::piRadians(), rLimits_, funct::tan(), and theta().

Referenced by FastTimeDDDConstants().

194  {
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 }
Log< level::Info, true > LogVerbatim
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
std::vector< double > geomParEndcap_
#define EDM_ML_DEBUG
Definition: MPUnpacker.cc:1
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
std::vector< double > rLimits_
std::vector< double > geomParBarrel_
constexpr double piRadians(M_PI)
int getCells(int type) const
const FastTimeParameters * ftpar_
Geom::Theta< T > theta() const

◆ isValidXY()

bool FastTimeDDDConstants::isValidXY ( int  type,
int  izeta,
int  iphi 
) const

Definition at line 164 of file FastTimeDDDConstants.cc.

References LEDCalibrationChannels::iphi, and convertSQLiteXML::ok.

Referenced by FastTimeTopology::valid().

164  {
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 }

◆ numberEtaZ()

int FastTimeDDDConstants::numberEtaZ ( int  type) const

Definition at line 174 of file FastTimeDDDConstants.cc.

References ftpar_, FastTimeParameters::nEtaEndcap_, and FastTimeParameters::nZBarrel_.

Referenced by FastTimeTopology::FastTimeTopology(), and FastTimeGeometry::newCell().

174  {
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 }
const FastTimeParameters * ftpar_

◆ numberPhi()

int FastTimeDDDConstants::numberPhi ( int  type) const

Definition at line 184 of file FastTimeDDDConstants.cc.

References ftpar_, FastTimeParameters::nPhiBarrel_, and FastTimeParameters::nPhiEndcap_.

Referenced by FastTimeTopology::FastTimeTopology(), and FastTimeGeometry::newCell().

184  {
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 }
const FastTimeParameters * ftpar_

Member Data Documentation

◆ dEta_

double FastTimeDDDConstants::dEta_
private

Definition at line 41 of file FastTimeDDDConstants.h.

Referenced by initialize().

◆ dPhiBarrel_

double FastTimeDDDConstants::dPhiBarrel_
private

Definition at line 42 of file FastTimeDDDConstants.h.

Referenced by getCorners(), getPosition(), getZPhi(), and initialize().

◆ dPhiEndcap_

double FastTimeDDDConstants::dPhiEndcap_
private

Definition at line 42 of file FastTimeDDDConstants.h.

Referenced by getCorners(), getEtaPhi(), getPosition(), and initialize().

◆ dZBarrel_

double FastTimeDDDConstants::dZBarrel_
private

Definition at line 42 of file FastTimeDDDConstants.h.

Referenced by getCorners(), getPosition(), getZPhi(), and initialize().

◆ etaMax_

double FastTimeDDDConstants::etaMax_
private

Definition at line 41 of file FastTimeDDDConstants.h.

Referenced by initialize().

◆ etaMin_

double FastTimeDDDConstants::etaMin_
private

Definition at line 41 of file FastTimeDDDConstants.h.

Referenced by initialize().

◆ ftpar_

const FastTimeParameters* FastTimeDDDConstants::ftpar_
private

◆ rLimits_

std::vector<double> FastTimeDDDConstants::rLimits_
private

Definition at line 43 of file FastTimeDDDConstants.h.

Referenced by getCorners(), getEtaPhi(), getPosition(), and initialize().