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 (HcalDDDSimConstants *hcons)
 
HcalID unitID (int det, const CLHEP::Hep3Vector &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

HcalDDDSimConstantshcalConstants
 

Detailed Description

Definition at line 16 of file HcalNumberingFromDDD.h.

Constructor & Destructor Documentation

HcalNumberingFromDDD::HcalNumberingFromDDD ( HcalDDDSimConstants hcons)

Definition at line 17 of file HcalNumberingFromDDD.cc.

17  :
18  hcalConstants(hcons) {
19 #ifdef EDM_ML_DEBUG
20  edm::LogInfo("HCalGeom") << "Creating HcalNumberingFromDDD\n";
21 #endif
22 }
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 CLHEP::Hep3Vector &  pos,
int  depth,
int  lay = -1 
) const

Definition at line 30 of file HcalNumberingFromDDD.cc.

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

Referenced by HcalTestAnalysis::fill(), SimG4HcalValidation::fill(), HCalSD::getHitFibreBundle(), HCalSD::getHitPMT(), HcalNumberingFromDDD::HcalID::HcalID(), HCalSD::layerWeight(), HcalTestAnalysis::qieAnalysis(), HCalSD::setDetUnitId(), unitID(), and SimG4HGCalValidation::update().

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

Definition at line 72 of file HcalNumberingFromDDD.cc.

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

74  {
75  std::pair<int,double> detEta = hcalConstants->getDetEta(eta, depth);
76  return unitID(detEta.first,detEta.second,fi,depth,lay);
77 }
HcalDDDSimConstants * hcalConstants
std::pair< int, double > getDetEta(const double &eta, const int &depth)
HcalID unitID(int det, const CLHEP::Hep3Vector &pos, int depth, int lay=-1) const
HcalNumberingFromDDD::HcalID HcalNumberingFromDDD::unitID ( int  det,
double  etaR,
double  phi,
int  depth,
int  lay = -1 
) const

Definition at line 80 of file HcalNumberingFromDDD.cc.

References gather_cfg::cout, HcalDDDSimConstants::getEta(), HcalDDDSimConstants::getPhiCons(), hcalConstants, createfilelist::int, unitID(), and HcalDigiParam_cfi::zside.

84  {
85 
86  double hetaR = fabs(etaR);
87  int ieta = hcalConstants->getEta(det, lay, hetaR);
88  std::pair<double,double> ficons = hcalConstants->getPhiCons(det, ieta);
89 
90  int nphi = int((CLHEP::twopi+0.1*ficons.second)/ficons.second);
91  int zside = etaR>0 ? 1: 0;
92  double hphi = phi+ficons.first;
93  if (hphi < 0) hphi += CLHEP::twopi;
94  int iphi = int(hphi/ficons.second) + 1;
95  if (iphi > nphi) iphi = 1;
96 
97 #ifdef EDM_ML_DEBUG
98  std::cout << "HcalNumberingFromDDD: etaR = " << etaR << " : "
99  << zside << "/" << ieta << " phi " << hphi << " : "
100  << iphi << std::endl;
101 #endif
102  return unitID(det,zside,depth,ieta,iphi,lay);
103 }
HcalDDDSimConstants * hcalConstants
int getEta(const int &det, const int &lay, const double &hetaR)
HcalID unitID(int det, const CLHEP::Hep3Vector &pos, int depth, int lay=-1) 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 105 of file HcalNumberingFromDDD.cc.

References gather_cfg::cout, 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.

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

Member Data Documentation

HcalDDDSimConstants* HcalNumberingFromDDD::hcalConstants
private

Definition at line 38 of file HcalNumberingFromDDD.h.

Referenced by unitID().