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  :
19  hcalConstants(hcons) {
20 #ifdef EDM_ML_DEBUG
21  edm::LogInfo("HCalGeom") << "Creating HcalNumberingFromDDD\n";
22 #endif
23 }
const HcalDDDSimConstants * hcalConstants
HcalNumberingFromDDD::~HcalNumberingFromDDD ( )

Definition at line 25 of file HcalNumberingFromDDD.cc.

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

Member Function Documentation

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

Definition at line 31 of file HcalNumberingFromDDD.cc.

References HcalDDDSimConstants::getEtaHO(), HcalBarrel, hcalConstants, HcalEndcap, HcalForward, cmsBatch::log, SiStripPI::max, min(), funct::sin(), mathSSE::sqrt(), and funct::tan().

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

34  {
35 
36 
37  double hx = point.x();
38  double hy = point.y();
39  double hz = point.z();
40  double hR = sqrt(hx*hx+hy*hy+hz*hz);
41  double htheta = (hR == 0. ? 0. : acos(std::max(std::min(hz/hR,1.0),-1.0)));
42  double hsintheta = sin(htheta);
43  double hphi = (hR*hsintheta == 0. ? 0. :atan2(hy,hx));
44  double heta = (fabs(hsintheta) == 1.? 0. : -log(fabs(tan(htheta/2.))) );
45 
46  int hsubdet=0;
47  double etaR;
48 
49  //First eta index
50  if (det == 5) { // Forward HCal
51  hsubdet = static_cast<int>(HcalForward);
52  hR = sqrt(hx*hx+hy*hy);
53  etaR = (heta >= 0. ? hR : -hR);
54  } else { // Barrel or Endcap
55  etaR = heta;
56  if (det == 3) {
57  hsubdet = static_cast<int>(HcalBarrel);
58  etaR = hcalConstants->getEtaHO(heta,hx,hy,hz);
59  } else {
60  hsubdet = static_cast<int>(HcalEndcap);
61  }
62  }
63 
64 #ifdef EDM_ML_DEBUG
65  edm::LogVerbatim("HCalGeom") << "HcalNumberingFromDDD: point = " << point
66  << " det " << det << ":" << hsubdet << " eta/R "
67  << etaR << " phi " << hphi << " depth " << depth
68  << " layer " << lay;
69 #endif
70  return unitID(hsubdet,etaR,hphi,depth,lay);
71 }
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:18
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 73 of file HcalNumberingFromDDD.cc.

References HcalDDDSimConstants::getDetEta(), hcalConstants, and unitID().

75  {
76  std::pair<int,double> detEta = hcalConstants->getDetEta(eta, depth);
77  return unitID(detEta.first,detEta.second,fi,depth,lay);
78 }
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 81 of file HcalNumberingFromDDD.cc.

References HcalDDDSimConstants::getEta(), HcalDDDSimConstants::getPhiCons(), hcalConstants, createfilelist::int, unitID(), and ecaldqm::zside().

85  {
86 
87  double hetaR = fabs(etaR);
88  int ieta = hcalConstants->getEta(det, lay, hetaR);
89  std::pair<double,double> ficons = hcalConstants->getPhiCons(det, ieta);
90 
91  int nphi = int((2._pi+0.1*ficons.second)/ficons.second);
92  int zside = etaR>0 ? 1: 0;
93  double hphi = phi+ficons.first;
94  if (hphi < 0) hphi += (2._pi);
95  int iphi = int(hphi/ficons.second) + 1;
96  if (iphi > nphi) iphi = 1;
97 
98 #ifdef EDM_ML_DEBUG
99  edm::LogVerbatim("HCalGeom") << "HcalNumberingFromDDD: etaR = " << etaR
100  << " : " << zside << "/" << ieta << " phi "
101  << hphi << " : " << iphi << std::endl;
102 #endif
103  return unitID(det,zside,depth,ieta,iphi,lay);
104 }
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 106 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, tmp, HcalDDDSimConstants::unitPhi(), units(), and HcalNumberingFromDDD::HcalID::zside.

109  {
110 
111 
112  if (det == static_cast<int>(HcalBarrel) && lay > 17)
113  det = static_cast<int>(HcalOuter);
114 
115  int units = hcalConstants->unitPhi(det, etaR);
116  int iphi_skip = hcalConstants->phiNumber(phi, units);
117 
118  std::pair<int,int> etaDepth = hcalConstants->getEtaDepth(det, etaR, iphi_skip, zside, depth, lay);
119 
120 #ifdef EDM_ML_DEBUG
121  edm::LogVerbatim("HCalGeom") << "HcalNumberingFromDDD: phi units= " << units
122  << " iphi_skip= " << iphi_skip;
123 #endif
124  HcalNumberingFromDDD::HcalID tmp(det,zside,etaDepth.second,etaDepth.first,phi,iphi_skip,lay);
125 
126 #ifdef EDM_ML_DEBUG
127  edm::LogVerbatim("HCalGeom") << "HcalNumberingFromDDD: det = " << det << " "
128  << tmp.subdet << " zside = " << tmp.zside
129  << " depth = " << tmp.depth << " eta/R = "
130  << tmp.etaR << " phi = " << tmp.phi
131  << " layer = " << tmp.lay;
132 #endif
133  return tmp;
134 }
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
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
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

Member Data Documentation

const HcalDDDSimConstants* HcalNumberingFromDDD::hcalConstants
private

Definition at line 38 of file HcalNumberingFromDDD.h.

Referenced by unitID().