CMS 3D CMS Logo

HcalNumberingFromDDD.cc
Go to the documentation of this file.
1 // File: HcalNumberingFromDDD.cc
3 // Description: Usage of DDD to get to numbering scheme for hadron calorimeter
5 
9 
11 
12 #include <iostream>
13 
14 //#define EDM_ML_DEBUG
15 using namespace geant_units;
16 using namespace geant_units::operators;
17 
19 #ifdef EDM_ML_DEBUG
20  edm::LogInfo("HCalGeom") << "Creating HcalNumberingFromDDD\n";
21 #endif
22 }
23 
25 #ifdef EDM_ML_DEBUG
26  edm::LogInfo("HCalGeom") << "Deleting HcalNumberingFromDDD\n";
27 #endif
28 }
29 
31  const math::XYZVectorD& point,
32  int depth,
33  int lay) const {
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 }
67 
68 HcalNumberingFromDDD::HcalID HcalNumberingFromDDD::unitID(double eta, double fi, int depth, int lay) const {
69  std::pair<int, double> detEta = hcalConstants->getDetEta(eta, depth);
70  return unitID(detEta.first, detEta.second, fi, depth, lay);
71 }
72 
73 HcalNumberingFromDDD::HcalID HcalNumberingFromDDD::unitID(int det, double etaR, double phi, int depth, int lay) const {
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 }
93 
95  int det, int zside, int depth, int etaR, int phi, int lay) const {
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 }
MessageLogger.h
HcalNumberingFromDDD::HcalID
Definition: HcalNumberingFromDDD.h:21
HcalDDDSimConstants::getEta
int getEta(const int &det, const int &lay, const double &hetaR) const
Definition: HcalDDDSimConstants.cc:225
min
T min(T a, T b)
Definition: MathUtil.h:58
ecaldqm::zside
int zside(DetId const &)
Definition: EcalDQMCommonUtils.cc:189
edm::LogInfo
Definition: MessageLogger.h:254
HcalParameters.h
HcalNumberingFromDDD::~HcalNumberingFromDDD
~HcalNumberingFromDDD()
Definition: HcalNumberingFromDDD.cc:24
HcalDDDSimConstants::getDetEta
std::pair< int, double > getDetEta(const double &eta, const int &depth) const
Definition: HcalDDDSimConstants.cc:201
geant_units::operators
Definition: GeantUnits.h:18
HcalBarrel
Definition: HcalAssistant.h:33
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
HcalNumberingFromDDD.h
HcalNumberingFromDDD::hcalConstants
const HcalDDDSimConstants * hcalConstants
Definition: HcalNumberingFromDDD.h:33
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
units
TString units(TString variable, Char_t axis)
LEDCalibrationChannels.iphi
iphi
Definition: LEDCalibrationChannels.py:64
HcalDDDSimConstants
Definition: HcalDDDSimConstants.h:24
nphi
const int nphi
Definition: CMTRawAnalyzer.h:424
HcalDDDSimConstants::getEtaHO
double getEtaHO(const double &etaR, const double &x, const double &y, const double &z) const
Definition: HcalDDDSimConstants.cc:295
PVValHelper::eta
Definition: PVValidationHelpers.h:69
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
HcalOuter
Definition: HcalAssistant.h:35
LEDCalibrationChannels.depth
depth
Definition: LEDCalibrationChannels.py:65
HcalDDDSimConstants::unitPhi
int unitPhi(const int &det, const int &etaR) const
Definition: HcalDDDSimConstants.cc:729
math::XYZVectorD
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > XYZVectorD
spatial vector with cartesian internal representation
Definition: Vector3D.h:8
HcalDDDSimConstants::getEtaDepth
std::pair< int, int > getEtaDepth(const int &det, int etaR, const int &phi, const int &zside, int depth, const int &lay) const
Definition: HcalDDDSimConstants.cc:252
LEDCalibrationChannels.ieta
ieta
Definition: LEDCalibrationChannels.py:63
PVValHelper::phi
Definition: PVValidationHelpers.h:68
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
GeantUnits.h
funct::tan
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
createfilelist.int
int
Definition: createfilelist.py:10
edm::LogVerbatim
Definition: MessageLogger.h:297
HcalDDDSimConstants::phiNumber
int phiNumber(const int &phi, const int &unit) const
Definition: HcalDDDSimConstants.cc:684
HcalForward
Definition: HcalAssistant.h:36
DDAxes::phi
HcalEndcap
Definition: HcalAssistant.h:34
HcalDDDSimConstants::getPhiCons
std::pair< double, double > getPhiCons(const int &det, const int &ieta) const
Definition: HcalDDDSimConstants.cc:465
HcalNumberingFromDDD::unitID
HcalID unitID(int det, const math::XYZVectorD &pos, int depth, int lay=-1) const
Definition: HcalNumberingFromDDD.cc:30
HcalNumberingFromDDD::HcalNumberingFromDDD
HcalNumberingFromDDD(const HcalDDDSimConstants *hcons)
Definition: HcalNumberingFromDDD.cc:18
dqm-mbProfile.log
log
Definition: dqm-mbProfile.py:17
geant_units
Definition: GeantUnits.h:11
point
*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