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 ( const HcalDDDSimConstants hcons)

Definition at line 18 of file HcalNumberingFromDDD.cc.

18  : hcalConstants(hcons) {
19 #ifdef EDM_ML_DEBUG
20  edm::LogInfo("HCalGeom") << "Creating HcalNumberingFromDDD\n";
21 #endif
22 }
const HcalDDDSimConstants * hcalConstants
HcalNumberingFromDDD::~HcalNumberingFromDDD ( )

Definition at line 24 of file HcalNumberingFromDDD.cc.

24  {
25 #ifdef EDM_ML_DEBUG
26  edm::LogInfo("HCalGeom") << "Deleting HcalNumberingFromDDD\n";
27 #endif
28 }

Member Function Documentation

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 HcalDDDSimConstants::getEtaHO(), HcalBarrel, hcalConstants, HcalEndcap, HcalForward, dqm-mbProfile::log, SiStripPI::max, min(), funct::sin(), mathSSE::sqrt(), and funct::tan().

Referenced by SimG4HcalValidation::fill(), HcalNumberingFromDDD::HcalID::HcalID(), unitID(), and SimG4HGCalValidation::update().

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 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
double getEtaHO(const double &etaR, const double &x, const double &y, const double &z) const
T sqrt(T t)
Definition: SSEVec.h:19
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
T min(T a, T b)
Definition: MathUtil.h:58
HcalID unitID(int det, const math::XYZVectorD &pos, int depth, int lay=-1) const
const HcalDDDSimConstants * hcalConstants
*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
HcalNumberingFromDDD::HcalID HcalNumberingFromDDD::unitID ( double  eta,
double  phi,
int  depth = 1,
int  lay = -1 
) const

Definition at line 68 of file HcalNumberingFromDDD.cc.

References 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
HcalID unitID(int det, const math::XYZVectorD &pos, int depth, int lay=-1) const
const HcalDDDSimConstants * hcalConstants
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 HcalDDDSimConstants::getEta(), HcalDDDSimConstants::getPhiCons(), hcalConstants, LEDCalibrationChannels::ieta, createfilelist::int, LEDCalibrationChannels::iphi, 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 << std::endl;
90 #endif
91  return unitID(det, zside, depth, ieta, iphi, lay);
92 }
int zside(DetId const &)
HcalID unitID(int det, const math::XYZVectorD &pos, int depth, int lay=-1) const
const HcalDDDSimConstants * hcalConstants
int getEta(const int &det, const int &lay, const double &hetaR) const
std::pair< double, double > getPhiCons(const int &det, const int &ieta) const
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 HcalNumberingFromDDD::HcalID::depth, HcalNumberingFromDDD::HcalID::etaR, HcalDDDSimConstants::getEtaDepth(), HcalBarrel, hcalConstants, HcalOuter, HcalNumberingFromDDD::HcalID::lay, HcalNumberingFromDDD::HcalID::phi, HcalDDDSimConstants::phiNumber(), HcalNumberingFromDDD::HcalID::subdet, createJobs::tmp, HcalDDDSimConstants::unitPhi(), units(), and HcalNumberingFromDDD::HcalID::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  std::pair<int, int> etaDepth = hcalConstants->getEtaDepth(det, etaR, iphi_skip, zside, depth, lay);
103 
104 #ifdef EDM_ML_DEBUG
105  edm::LogVerbatim("HCalGeom") << "HcalNumberingFromDDD: phi units= " << units << " iphi_skip= " << iphi_skip;
106 #endif
107  HcalNumberingFromDDD::HcalID tmp(det, zside, etaDepth.second, etaDepth.first, phi, iphi_skip, lay);
108 
109 #ifdef EDM_ML_DEBUG
110  edm::LogVerbatim("HCalGeom") << "HcalNumberingFromDDD: det = " << det << " " << tmp.subdet << " zside = " << tmp.zside
111  << " depth = " << tmp.depth << " eta/R = " << tmp.etaR << " phi = " << tmp.phi
112  << " layer = " << tmp.lay;
113 #endif
114  return tmp;
115 }
int phiNumber(const int &phi, const int &unit) const
int zside(DetId const &)
int unitPhi(const int &det, const int &etaR) const
const HcalDDDSimConstants * hcalConstants
TString units(TString variable, Char_t axis)
std::pair< int, int > getEtaDepth(const int &det, int etaR, const int &phi, const int &zside, int depth, const int &lay) const
tmp
align.sh
Definition: createJobs.py:716

Member Data Documentation

const HcalDDDSimConstants* HcalNumberingFromDDD::hcalConstants
private

Definition at line 33 of file HcalNumberingFromDDD.h.

Referenced by unitID().