CMS 3D CMS Logo

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

#include <HcalNumberingFromDDD.h>

Classes

struct  HcalID
 

Public Member Functions

 HcalNumberingFromDDD (const HcalDDDSimConstants *hcons)
 
HcalID unitID (int det, const math::XYZVectorD &pos, int depth, int lay=-1) const
 
HcalID unitID (double eta, double phi, int depth=1, int lay=-1) const
 
HcalID unitID (int det, double etaR, double phi, int depth, int lay=-1) const
 
HcalID unitID (int det, int zside, int depth, int etaR, int phi, int lay=-1) const
 
 ~HcalNumberingFromDDD ()
 

Private Attributes

const HcalDDDSimConstantshcalConstants
 

Detailed Description

Definition at line 16 of file HcalNumberingFromDDD.h.

Constructor & Destructor Documentation

◆ HcalNumberingFromDDD()

HcalNumberingFromDDD::HcalNumberingFromDDD ( const HcalDDDSimConstants hcons)

Definition at line 18 of file HcalNumberingFromDDD.cc.

18  : hcalConstants(hcons) {
19 #ifdef EDM_ML_DEBUG
20  edm::LogVerbatim("HCalGeom") << "Creating HcalNumberingFromDDD";
21 #endif
22 }
Log< level::Info, true > LogVerbatim
const HcalDDDSimConstants * hcalConstants

◆ ~HcalNumberingFromDDD()

HcalNumberingFromDDD::~HcalNumberingFromDDD ( )

Definition at line 24 of file HcalNumberingFromDDD.cc.

24  {
25 #ifdef EDM_ML_DEBUG
26  edm::LogVerbatim("HCalGeom") << "Deleting HcalNumberingFromDDD";
27 #endif
28 }
Log< level::Info, true > LogVerbatim

Member Function Documentation

◆ unitID() [1/4]

HcalNumberingFromDDD::HcalID HcalNumberingFromDDD::unitID ( int  det,
const math::XYZVectorD pos,
int  depth,
int  lay = -1 
) const

Definition at line 30 of file HcalNumberingFromDDD.cc.

References Matriplex::atan2(), hcalRecHitTable_cff::depth, HcalDDDSimConstants::getEtaHO(), HcalBarrel, hcalConstants, HcalEndcap, HcalForward, CrabHelper::log, WZElectronSkims53X_cff::max, SiStripPI::min, point, funct::sin(), mathSSE::sqrt(), and funct::tan().

Referenced by HcalDumpGeometry::dumpTouch(), and unitID().

33  {
34  double hx = point.x();
35  double hy = point.y();
36  double hz = point.z();
37  double hR = sqrt(hx * hx + hy * hy + hz * hz);
38  double htheta = (hR == 0. ? 0. : acos(std::max(std::min(hz / hR, 1.0), -1.0)));
39  double hsintheta = sin(htheta);
40  double hphi = (hR * hsintheta == 0. ? 0. : atan2(hy, hx));
41  double heta = (fabs(hsintheta) == 1. ? 0. : -log(fabs(tan(htheta / 2.))));
42 
43  int hsubdet = 0;
44  double etaR;
45 
46  //First eta index
47  if (det == 5) { // Forward HCal
48  hsubdet = static_cast<int>(HcalForward);
49  hR = sqrt(hx * hx + hy * hy);
50  etaR = (heta >= 0. ? hR : -hR);
51  } else { // Barrel or Endcap
52  etaR = heta;
53  if (det == 3) {
54  hsubdet = static_cast<int>(HcalBarrel);
55  etaR = hcalConstants->getEtaHO(heta, hx, hy, hz);
56  } else {
57  hsubdet = static_cast<int>(HcalEndcap);
58  }
59  }
60 
61 #ifdef EDM_ML_DEBUG
62  edm::LogVerbatim("HCalGeom") << "HcalNumberingFromDDD: point = " << point << " det " << det << ":" << hsubdet
63  << " eta/R " << etaR << " phi " << hphi << " depth " << depth << " layer " << lay;
64 #endif
65  return unitID(hsubdet, etaR, hphi, depth, lay);
66 }
Log< level::Info, true > LogVerbatim
double getEtaHO(const double &etaR, const double &x, const double &y, const double &z) const
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
T sqrt(T t)
Definition: SSEVec.h:23
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
const HcalDDDSimConstants * hcalConstants
HcalID unitID(int det, const math::XYZVectorD &pos, int depth, int lay=-1) const
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5
MPlex< T, D1, D2, N > atan2(const MPlex< T, D1, D2, N > &y, const MPlex< T, D1, D2, N > &x)
Definition: Matriplex.h:648

◆ unitID() [2/4]

HcalNumberingFromDDD::HcalID HcalNumberingFromDDD::unitID ( double  eta,
double  phi,
int  depth = 1,
int  lay = -1 
) const

Definition at line 68 of file HcalNumberingFromDDD.cc.

References hcalRecHitTable_cff::depth, PVValHelper::eta, HcalDDDSimConstants::getDetEta(), hcalConstants, and unitID().

68  {
69  std::pair<int, double> detEta = hcalConstants->getDetEta(eta, depth);
70  return unitID(detEta.first, detEta.second, fi, depth, lay);
71 }
std::pair< int, double > getDetEta(const double &eta, const int &depth) const
const HcalDDDSimConstants * hcalConstants
HcalID unitID(int det, const math::XYZVectorD &pos, int depth, int lay=-1) const

◆ unitID() [3/4]

HcalNumberingFromDDD::HcalID HcalNumberingFromDDD::unitID ( int  det,
double  etaR,
double  phi,
int  depth,
int  lay = -1 
) const

Definition at line 73 of file HcalNumberingFromDDD.cc.

References hcalRecHitTable_cff::depth, HcalDDDSimConstants::getEta(), HcalDDDSimConstants::getPhiCons(), hcalConstants, hcalRecHitTable_cff::ieta, createfilelist::int, hcalRecHitTable_cff::iphi, nphi, phi, unitID(), and ecaldqm::zside().

73  {
74  double hetaR = fabs(etaR);
75  int ieta = hcalConstants->getEta(det, lay, hetaR);
76  std::pair<double, double> ficons = hcalConstants->getPhiCons(det, ieta);
77 
78  int nphi = int((2._pi + 0.1 * ficons.second) / ficons.second);
79  int zside = etaR > 0 ? 1 : 0;
80  double hphi = phi + ficons.first;
81  if (hphi < 0)
82  hphi += (2._pi);
83  int iphi = int(hphi / ficons.second) + 1;
84  if (iphi > nphi)
85  iphi = 1;
86 
87 #ifdef EDM_ML_DEBUG
88  edm::LogVerbatim("HCalGeom") << "HcalNumberingFromDDD: etaR = " << etaR << " : " << zside << "/" << ieta << " phi "
89  << hphi << " : " << iphi;
90 #endif
91  return unitID(det, zside, depth, ieta, iphi, lay);
92 }
Log< level::Info, true > LogVerbatim
const int nphi
int getEta(const int &det, const int &lay, const double &hetaR) const
int zside(DetId const &)
std::pair< double, double > getPhiCons(const int &det, const int &ieta) const
const HcalDDDSimConstants * hcalConstants
HcalID unitID(int det, const math::XYZVectorD &pos, int depth, int lay=-1) const

◆ unitID() [4/4]

HcalNumberingFromDDD::HcalID HcalNumberingFromDDD::unitID ( int  det,
int  zside,
int  depth,
int  etaR,
int  phi,
int  lay = -1 
) const

Definition at line 94 of file HcalNumberingFromDDD.cc.

References hcalRecHitTable_cff::depth, HcalDDDSimConstants::getEtaDepth(), HcalBarrel, hcalConstants, HcalOuter, phi, HcalDDDSimConstants::phiNumber(), createJobs::tmp, HcalDDDSimConstants::unitPhi(), units(), and ecaldqm::zside().

95  {
96  if (det == static_cast<int>(HcalBarrel) && lay > 17)
97  det = static_cast<int>(HcalOuter);
98 
99  int units = hcalConstants->unitPhi(det, etaR);
100  int iphi_skip = hcalConstants->phiNumber(phi, units);
101 
102  if ((lay == 1) && (etaR == 16))
103  etaR = 15;
104 
105  std::pair<int, int> etaDepth = hcalConstants->getEtaDepth(det, etaR, iphi_skip, zside, depth, lay);
106 
107 #ifdef EDM_ML_DEBUG
108  edm::LogVerbatim("HCalGeom") << "HcalNumberingFromDDD: phi units= " << units << " iphi_skip= " << iphi_skip;
109 #endif
110  HcalNumberingFromDDD::HcalID tmp(det, zside, etaDepth.second, etaDepth.first, phi, iphi_skip, lay);
111 
112 #ifdef EDM_ML_DEBUG
113  edm::LogVerbatim("HCalGeom") << "HcalNumberingFromDDD: det = " << det << " " << tmp.subdet << " zside = " << tmp.zside
114  << " depth = " << tmp.depth << " eta/R = " << tmp.etaR << " phi = " << tmp.phi
115  << " layer = " << tmp.lay;
116 #endif
117  return tmp;
118 }
Log< level::Info, true > LogVerbatim
int zside(DetId const &)
int phiNumber(const int &phi, const int &unit) const
std::pair< int, int > getEtaDepth(const int &det, int etaR, const int &phi, const int &zside, int depth, const int &lay) const
int unitPhi(const int &det, const int &etaR) const
const HcalDDDSimConstants * hcalConstants
TString units(TString variable, Char_t axis)
tmp
align.sh
Definition: createJobs.py:716

Member Data Documentation

◆ hcalConstants

const HcalDDDSimConstants* HcalNumberingFromDDD::hcalConstants
private

Definition at line 33 of file HcalNumberingFromDDD.h.

Referenced by unitID().