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 20 of file FastTimeDDDConstants.h.

Constructor & Destructor Documentation

FastTimeDDDConstants::FastTimeDDDConstants ( const FastTimeParameters ftp)

Definition at line 11 of file FastTimeDDDConstants.cc.

References gather_cfg::cout, and initialize().

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

Definition at line 20 of file FastTimeDDDConstants.cc.

References gather_cfg::cout.

20  {
21 #ifdef EDM_ML_DEBUG
22  std::cout << "FastTimeDDDConstants:destructed!!!" << std::endl;
23 #endif
24 }

Member Function Documentation

int FastTimeDDDConstants::getCells ( int  type) const

Definition at line 115 of file FastTimeDDDConstants.cc.

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

Referenced by initialize().

115  {
116  int numb(0);
117  if (type == 1) {
118  numb = (ftpar_->nZBarrel_)*(ftpar_->nPhiBarrel_);
119  } else if (type == 2) {
120  numb = (ftpar_->nEtaEndcap_)*(ftpar_->nPhiEndcap_);
121  }
122  return numb;
123 }
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 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, AlCaHLTBitMon_ParallelJobs::p, phi, RPCpg::pts, alignCSCRings::r, rLimits_, funct::sin(), x, y, and z.

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

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

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

40  {
41 
42  if (phi < 0) phi += CLHEP::twopi;
43  int ir(ftpar_->nEtaEndcap_);
44  for (unsigned int k=1; k<rLimits_.size(); ++k) {
45  if (r > rLimits_[k]) {
46  ir = k; break;
47  }
48  }
49  int iphi = (int)(phi/dPhiEndcap_) + 1;
50  if (iphi > ftpar_->nPhiEndcap_) iphi = 1;
51 #ifdef EDM_ML_DEBUG
52  std::cout << "FastTimeDDDConstants:Endcap r|phi " << r << " "
53  << phi/CLHEP::deg << " ir|iphi " << ir << " " << iphi << std::endl;
54 #endif
55  return std::pair<int,int>(ir,iphi);
56 }
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 58 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().

59  {
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 :
70  0.5*(rLimits_[izeta-1]+rLimits_[izeta]);
71  x = (zside < 0) ? -r*cos(phi) : r*cos(phi);
72  y = r*sin(phi);
73  z = ftpar_->geomParEndcap_[2];
74  }
75  if (zside < 0) z = -z;
76  GlobalPoint p(x,y,z);
77  return p;
78 }
type
Definition: HCALResponse.h:21
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
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 125 of file FastTimeDDDConstants.cc.

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

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

125  {
126  double value(0);
127  if (type == 1) {
128  value = (ftpar_->geomParBarrel_[2]);
129  } else if (type == 2) {
130  value = (ftpar_->geomParEndcap_[0]);
131  }
132  return value;
133 }
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 135 of file FastTimeDDDConstants.cc.

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

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

135  {
136  double value(0);
137  if (type == 1) {
139  } else if (type == 2) {
140  value = (ftpar_->geomParEndcap_[1]);
141  }
142  return value;
143 }
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 145 of file FastTimeDDDConstants.cc.

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

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

145  {
146  double value(0);
147  if (type == 1) {
149  } else if (type == 2) {
150  value = (ftpar_->geomParEndcap_[3]);
151  }
152  return value;
153 }
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 gather_cfg::cout, dPhiBarrel_, dZBarrel_, ftpar_, createfilelist::int, FastTimeParameters::nPhiBarrel_, and FastTimeParameters::nZBarrel_.

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

26  {
27 
28  if (phi < 0) phi += CLHEP::twopi;
29  int iz = (int)(z/dZBarrel_) + 1;
30  if (iz > ftpar_->nZBarrel_) iz = ftpar_->nZBarrel_;
31  int iphi = (int)(phi/dPhiBarrel_) + 1;
32  if (iphi > ftpar_->nPhiBarrel_) iphi = 1;
33 #ifdef EDM_ML_DEBUG
34  std::cout << "FastTimeDDDConstants:Barrel z|phi " << z << " "
35  << phi/CLHEP::deg << " iz|iphi " << iz << " " << iphi << std::endl;
36 #endif
37  return std::pair<int,int>(iz,iphi);
38 }
const FastTimeParameters * ftpar_
double FastTimeDDDConstants::getZPos ( int  type) const

Definition at line 155 of file FastTimeDDDConstants.cc.

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

Referenced by FastTimeGeometryLoader::build().

155  {
156  double value(0);
157  if (type == 1) {
159  } else if (type == 2) {
160  value = (ftpar_->geomParEndcap_[2]);
161  }
162  return value;
163 }
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 197 of file FastTimeDDDConstants.cc.

References gather_cfg::cout, 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_, rLimits_, funct::tan(), and theta().

Referenced by FastTimeDDDConstants().

197  {
198 
199  double thmin = atan(ftpar_->geomParEndcap_[0]/ftpar_->geomParEndcap_[2]);
200  etaMax_ = -log(0.5*thmin);
201  double thmax = atan(ftpar_->geomParEndcap_[1]/ftpar_->geomParEndcap_[2]);
202  etaMin_ = -log(0.5*thmax);
204 #ifdef EDM_ML_DEBUG
205  std::cout << "Theta range " << thmin/CLHEP::deg << ":" << thmax/CLHEP::deg
206  << " Eta range " << etaMin_ << ":" << etaMax_ << ":" << dEta_
207  << std::endl;
208 #endif
209  for (int k=0; k<=ftpar_->nEtaEndcap_; ++k) {
210  double eta = etaMin_ + k*dEta_;
211  double theta = 2.0*atan(exp(-eta));
212  double rval = (ftpar_->geomParEndcap_[2])*tan(theta);
213  rLimits_.emplace_back(rval);
214  }
216  dPhiBarrel_ = CLHEP::twopi/ftpar_->nPhiBarrel_;
217  dPhiEndcap_ = CLHEP::twopi/ftpar_->nPhiEndcap_;
218 #ifdef EDM_ML_DEBUG
219  std::cout << "FastTimeDDDConstants initialized with " << ftpar_->nZBarrel_
220  << ":" << ftpar_->nPhiBarrel_ << ":" << getCells(1)
221  << " cells for barrel; dz|dphi " << dZBarrel_ << "|" << dPhiBarrel_
222  << " and " << ftpar_->nEtaEndcap_ << ":" << ftpar_->nPhiEndcap_
223  << ":" << getCells(2) << " cells for endcap; dphi " << dPhiEndcap_
224  << " The Limits in R are" << std::endl;
225  for (unsigned int k=0; k<rLimits_.size(); ++k) {
226  std::cout << "[" << k << "] " << rLimits_[k] << " ";
227  if (k%8 == 7) std::cout << std::endl;
228  }
229  if ((rLimits_.size()-1)%8 != 7) std::cout << std::endl;
230 #endif
231 }
Geom::Theta< T > theta() const
std::vector< double > geomParEndcap_
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_
#define EDM_ML_DEBUG
const FastTimeParameters * ftpar_
bool FastTimeDDDConstants::isValidXY ( int  type,
int  izeta,
int  iphi 
) const

Definition at line 165 of file FastTimeDDDConstants.cc.

References convertSQLiteXML::ok.

Referenced by FastTimeTopology::valid().

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

Definition at line 177 of file FastTimeDDDConstants.cc.

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

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

177  {
178  int numb(0);
179  if (type == 1) {
180  numb = (ftpar_->nZBarrel_);
181  } else if (type == 2) {
182  numb = (ftpar_->nEtaEndcap_);
183  }
184  return numb;
185 }
type
Definition: HCALResponse.h:21
const FastTimeParameters * ftpar_
int FastTimeDDDConstants::numberPhi ( int  type) const

Definition at line 187 of file FastTimeDDDConstants.cc.

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

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

187  {
188  int numb(0);
189  if (type == 1) {
190  numb = (ftpar_->nPhiBarrel_);
191  } else if (type == 2) {
192  numb = (ftpar_->nPhiEndcap_);
193  }
194  return numb;
195 }
type
Definition: HCALResponse.h:21
const FastTimeParameters * ftpar_

Member Data Documentation

double FastTimeDDDConstants::dEta_
private

Definition at line 46 of file FastTimeDDDConstants.h.

Referenced by initialize().

double FastTimeDDDConstants::dPhiBarrel_
private

Definition at line 47 of file FastTimeDDDConstants.h.

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

double FastTimeDDDConstants::dPhiEndcap_
private

Definition at line 47 of file FastTimeDDDConstants.h.

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

double FastTimeDDDConstants::dZBarrel_
private

Definition at line 47 of file FastTimeDDDConstants.h.

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

double FastTimeDDDConstants::etaMax_
private

Definition at line 46 of file FastTimeDDDConstants.h.

Referenced by initialize().

double FastTimeDDDConstants::etaMin_
private

Definition at line 46 of file FastTimeDDDConstants.h.

Referenced by initialize().

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

Definition at line 48 of file FastTimeDDDConstants.h.

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