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 ( const FastTimeParameters ftp)

Definition at line 10 of file FastTimeDDDConstants.cc.

References initialize().

11  : ftpar_(ft) {
12 #ifdef EDM_ML_DEBUG
13  edm::LogVerbatim("HGCalGeom")
14  << "FastTimeDDDConstants::FastTimeDDDConstants "
15  << "( const FastTimeParameters* ft ) constructor";
16 #endif
17  initialize();
18 }
const FastTimeParameters * ftpar_
FastTimeDDDConstants::~FastTimeDDDConstants ( )

Definition at line 20 of file FastTimeDDDConstants.cc.

20  {
21 #ifdef EDM_ML_DEBUG
22  edm::LogVerbatim("HGCalGeom") << "FastTimeDDDConstants:destructed!!!";
23 #endif
24 }

Member Function Documentation

int FastTimeDDDConstants::getCells ( int  type) const

Definition at line 120 of file FastTimeDDDConstants.cc.

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

Referenced by initialize().

120  {
121  int numb(0);
122  if (type == 1) {
123  numb = (ftpar_->nZBarrel_) * (ftpar_->nPhiBarrel_);
124  } else if (type == 2) {
125  numb = (ftpar_->nEtaEndcap_) * (ftpar_->nPhiEndcap_);
126  }
127  return numb;
128 }
type
Definition: HCALResponse.h:21
const FastTimeParameters * ftpar_
std::vector< GlobalPoint > FastTimeDDDConstants::getCorners ( int  type,
int  izeta,
int  iphi,
int  zside 
) const

Definition at line 82 of file FastTimeDDDConstants.cc.

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

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

84  {
85  double x(0), y(0), z(0), dx(0), dz(0), r(0), phi(0);
86  if (type == 1) {
87  phi = (iphi - 0.5) * dPhiBarrel_;
88  r = ftpar_->geomParBarrel_[2];
89  x = r * cos(phi);
90  y = r * sin(phi);
91  z = ftpar_->geomParBarrel_[0] + (izeta - 0.5) * dZBarrel_;
92  dx = 0.5 * ftpar_->geomParBarrel_[3];
93  dz = 0.5 * dZBarrel_;
94  } else if (type == 2) {
95  phi = (iphi - 0.5) * dPhiEndcap_;
96  r = (izeta <= 0 || izeta >= (int)(rLimits_.size()))
97  ? 0
98  : 0.5 * (rLimits_[izeta - 1] + rLimits_[izeta]);
99  x = (zside < 0) ? -r * cos(phi) : r * cos(phi);
100  y = r * sin(phi);
101  z = ftpar_->geomParEndcap_[2];
102  dx = 0.5 * r * dPhiEndcap_;
103  dz = 0.5 * ftpar_->geomParEndcap_[3];
104  }
105  if (zside < 0) {
106  z = -z;
107  dz = -dz;
108  }
109  static const int signx[8] = {-1, -1, 1, 1, -1, -1, 1, 1};
110  static const int signy[8] = {-1, 1, 1, -1, -1, 1, 1, -1};
111  static const int signz[8] = {-1, -1, -1, -1, 1, 1, 1, 1};
112  std::vector<GlobalPoint> pts;
113  for (unsigned int i = 0; i != 8; ++i) {
114  GlobalPoint p(x + signx[i] * dx, y + signy[i] * dx, z + signz[i] * dz);
115  pts.emplace_back(p);
116  }
117  return pts;
118 }
type
Definition: HCALResponse.h:21
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_
std::pair< int, int > FastTimeDDDConstants::getEtaPhi ( double  r,
double  phi 
) const

Definition at line 40 of file FastTimeDDDConstants.cc.

References geant_units::operators::convertRadToDeg(), dPhiEndcap_, ftpar_, createfilelist::int, gen::k, FastTimeParameters::nEtaEndcap_, FastTimeParameters::nPhiEndcap_, geant_units::piRadians(), and rLimits_.

Referenced by FastTimeGeometry::getClosestCell(), and FastTimerSD::setDetUnitId().

41  {
42  if (phi < 0) 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_) iphi = 1;
52 #ifdef EDM_ML_DEBUG
53  edm::LogVerbatim("HGCalGeom") << "FastTimeDDDConstants:Endcap r|phi " << r
54  << " " << convertRadToDeg(phi) << " ir|iphi "
55  << ir << " " << iphi;
56 #endif
57  return std::pair<int, int>(ir, iphi);
58 }
constexpr NumType convertRadToDeg(NumType radians)
Definition: GeantUnits.h:98
constexpr long double piRadians(M_PI)
std::vector< double > rLimits_
int k[5][pyjets_maxn]
const FastTimeParameters * ftpar_
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, AlCaHLTBitMon_ParallelJobs::p, phi, alignCSCRings::r, rLimits_, funct::sin(), x, y, and z.

Referenced by FastTimeGeometry::getPosition().

61  {
62  double x(0), y(0), z(0);
63  if (type == 1) {
64  double phi = (iphi - 0.5) * dPhiBarrel_;
65  x = ftpar_->geomParBarrel_[2] * cos(phi);
66  y = ftpar_->geomParBarrel_[2] * sin(phi);
67  z = ftpar_->geomParBarrel_[0] + (izeta - 0.5) * dZBarrel_;
68  } else if (type == 2) {
69  double phi = (iphi - 0.5) * dPhiEndcap_;
70  double r = (izeta <= 0 || izeta >= (int)(rLimits_.size()))
71  ? 0
72  : 0.5 * (rLimits_[izeta - 1] + rLimits_[izeta]);
73  x = (zside < 0) ? -r * cos(phi) : r * cos(phi);
74  y = r * sin(phi);
75  z = ftpar_->geomParEndcap_[2];
76  }
77  if (zside < 0) z = -z;
78  GlobalPoint p(x, y, z);
79  return p;
80 }
type
Definition: HCALResponse.h:21
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_
double FastTimeDDDConstants::getRin ( int  type) const

Definition at line 130 of file FastTimeDDDConstants.cc.

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

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

130  {
131  double value(0);
132  if (type == 1) {
133  value = (ftpar_->geomParBarrel_[2]);
134  } else if (type == 2) {
135  value = (ftpar_->geomParEndcap_[0]);
136  }
137  return value;
138 }
type
Definition: HCALResponse.h:21
std::vector< double > geomParEndcap_
Definition: value.py:1
std::vector< double > geomParBarrel_
const FastTimeParameters * ftpar_
double FastTimeDDDConstants::getRout ( int  type) const

Definition at line 140 of file FastTimeDDDConstants.cc.

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

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

140  {
141  double value(0);
142  if (type == 1) {
144  } else if (type == 2) {
145  value = (ftpar_->geomParEndcap_[1]);
146  }
147  return value;
148 }
type
Definition: HCALResponse.h:21
std::vector< double > geomParEndcap_
Definition: value.py:1
std::vector< double > geomParBarrel_
const FastTimeParameters * ftpar_
double FastTimeDDDConstants::getZHalf ( int  type) const

Definition at line 150 of file FastTimeDDDConstants.cc.

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

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

150  {
151  double value(0);
152  if (type == 1) {
153  value = 0.5 * (ftpar_->geomParBarrel_[1] - ftpar_->geomParBarrel_[0]);
154  } else if (type == 2) {
155  value = (ftpar_->geomParEndcap_[3]);
156  }
157  return value;
158 }
type
Definition: HCALResponse.h:21
std::vector< double > geomParEndcap_
Definition: value.py:1
std::vector< double > geomParBarrel_
const FastTimeParameters * ftpar_
std::pair< int, int > FastTimeDDDConstants::getZPhi ( double  z,
double  phi 
) const

Definition at line 26 of file FastTimeDDDConstants.cc.

References geant_units::operators::convertRadToDeg(), dPhiBarrel_, dZBarrel_, ftpar_, createfilelist::int, FastTimeParameters::nPhiBarrel_, FastTimeParameters::nZBarrel_, and geant_units::piRadians().

Referenced by FastTimeGeometry::getClosestCell(), and FastTimerSD::setDetUnitId().

26  {
27  if (phi < 0) phi += (2*geant_units::piRadians);
28  int iz = (int)(z / dZBarrel_) + 1;
29  if (iz > ftpar_->nZBarrel_) iz = ftpar_->nZBarrel_;
30  int iphi = (int)(phi / dPhiBarrel_) + 1;
31  if (iphi > ftpar_->nPhiBarrel_) iphi = 1;
32 #ifdef EDM_ML_DEBUG
33  edm::LogVerbatim("HGCalGeom") << "FastTimeDDDConstants:Barrel z|phi " << z
34  << " " << convertRadToDeg(phi) << " iz|iphi "
35  << iz << " " << iphi;
36 #endif
37  return std::pair<int, int>(iz, iphi);
38 }
constexpr NumType convertRadToDeg(NumType radians)
Definition: GeantUnits.h:98
constexpr long double piRadians(M_PI)
const FastTimeParameters * ftpar_
double FastTimeDDDConstants::getZPos ( int  type) const

Definition at line 160 of file FastTimeDDDConstants.cc.

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

Referenced by FastTimeGeometryLoader::build().

160  {
161  double value(0);
162  if (type == 1) {
163  value = 0.5 * (ftpar_->geomParBarrel_[1] + ftpar_->geomParBarrel_[0]);
164  } else if (type == 2) {
165  value = (ftpar_->geomParEndcap_[2]);
166  }
167  return value;
168 }
type
Definition: HCALResponse.h:21
std::vector< double > geomParEndcap_
Definition: value.py:1
std::vector< double > geomParBarrel_
const FastTimeParameters * ftpar_
void FastTimeDDDConstants::initialize ( void  )
private

Definition at line 202 of file FastTimeDDDConstants.cc.

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

Referenced by FastTimeDDDConstants().

202  {
203  double thmin = atan(ftpar_->geomParEndcap_[0] / ftpar_->geomParEndcap_[2]);
204  etaMax_ = -log(0.5 * thmin);
205  double thmax = atan(ftpar_->geomParEndcap_[1] / ftpar_->geomParEndcap_[2]);
206  etaMin_ = -log(0.5 * thmax);
208 #ifdef EDM_ML_DEBUG
209  edm::LogVerbatim("HGCalGeom") << "Theta range " << convertRadToDeg(thmin)
210  << ":" << convertRadToDeg(thmax) << " Eta range "
211  << etaMin_ << ":" << etaMax_ << ":" << dEta_;
212 #endif
213  for (int k = 0; k <= ftpar_->nEtaEndcap_; ++k) {
214  double eta = etaMin_ + k * dEta_;
215  double theta = 2.0 * atan(exp(-eta));
216  double rval = (ftpar_->geomParEndcap_[2]) * tan(theta);
217  rLimits_.emplace_back(rval);
218  }
222 #ifdef EDM_ML_DEBUG
223  edm::LogVerbatim("HGCalGeom") << "FastTimeDDDConstants initialized with "
224  << ftpar_->nZBarrel_ << ":" << ftpar_->nPhiBarrel_
225  << ":" << getCells(1)
226  << " cells for barrel; dz|dphi " << dZBarrel_
227  << "|" << dPhiBarrel_ << " and "
228  << ftpar_->nEtaEndcap_ << ":"
229  << ftpar_->nPhiEndcap_ << ":" << getCells(2)
230  << " cells for endcap; dphi " << dPhiEndcap_
231  << " The Limits in R are";
232  for (unsigned int k = 0; k < rLimits_.size(); ++k)
233  edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << rLimits_[k] << " ";
234 #endif
235 }
Geom::Theta< T > theta() const
constexpr NumType convertRadToDeg(NumType radians)
Definition: GeantUnits.h:98
constexpr long double piRadians(M_PI)
std::vector< double > geomParEndcap_
#define EDM_ML_DEBUG
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
std::vector< double > rLimits_
int getCells(int type) const
int k[5][pyjets_maxn]
unsigned long long int rval
Definition: vlib.h:22
std::vector< double > geomParBarrel_
const FastTimeParameters * ftpar_
bool FastTimeDDDConstants::isValidXY ( int  type,
int  izeta,
int  iphi 
) const

Definition at line 170 of file FastTimeDDDConstants.cc.

References convertSQLiteXML::ok.

Referenced by FastTimeTopology::valid().

170  {
171  bool ok(false);
172  if (type == 1) {
173  ok = ((izeta > 0) && (izeta <= ftpar_->nZBarrel_) && (iphi > 0) &&
174  (iphi <= ftpar_->nPhiBarrel_));
175  } else if (type == 2) {
176  ok = ((izeta > 0) && (izeta <= ftpar_->nEtaEndcap_) && (iphi > 0) &&
177  (iphi <= ftpar_->nPhiEndcap_));
178  }
179  return ok;
180 }
type
Definition: HCALResponse.h:21
int FastTimeDDDConstants::numberEtaZ ( int  type) const

Definition at line 182 of file FastTimeDDDConstants.cc.

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

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

182  {
183  int numb(0);
184  if (type == 1) {
185  numb = (ftpar_->nZBarrel_);
186  } else if (type == 2) {
187  numb = (ftpar_->nEtaEndcap_);
188  }
189  return numb;
190 }
type
Definition: HCALResponse.h:21
const FastTimeParameters * ftpar_
int FastTimeDDDConstants::numberPhi ( int  type) const

Definition at line 192 of file FastTimeDDDConstants.cc.

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

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

192  {
193  int numb(0);
194  if (type == 1) {
195  numb = (ftpar_->nPhiBarrel_);
196  } else if (type == 2) {
197  numb = (ftpar_->nPhiEndcap_);
198  }
199  return numb;
200 }
type
Definition: HCALResponse.h:21
const FastTimeParameters * ftpar_

Member Data Documentation

double FastTimeDDDConstants::dEta_
private

Definition at line 42 of file FastTimeDDDConstants.h.

Referenced by initialize().

double FastTimeDDDConstants::dPhiBarrel_
private

Definition at line 43 of file FastTimeDDDConstants.h.

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

double FastTimeDDDConstants::dPhiEndcap_
private

Definition at line 43 of file FastTimeDDDConstants.h.

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

double FastTimeDDDConstants::dZBarrel_
private

Definition at line 43 of file FastTimeDDDConstants.h.

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

double FastTimeDDDConstants::etaMax_
private

Definition at line 42 of file FastTimeDDDConstants.h.

Referenced by initialize().

double FastTimeDDDConstants::etaMin_
private

Definition at line 42 of file FastTimeDDDConstants.h.

Referenced by initialize().

const FastTimeParameters* FastTimeDDDConstants::ftpar_
private
std::vector<double> FastTimeDDDConstants::rLimits_
private

Definition at line 44 of file FastTimeDDDConstants.h.

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