CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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  edm::LogInfo("HCalGeom") << "Creating HcalNumberingFromDDD";
20 }
HcalDDDSimConstants * hcalConstants
HcalNumberingFromDDD::~HcalNumberingFromDDD ( )

Definition at line 22 of file HcalNumberingFromDDD.cc.

22  {
23  edm::LogInfo("HCalGeom") << "Deleting HcalNumberingFromDDD";
24 }

Member Function Documentation

HcalNumberingFromDDD::HcalID HcalNumberingFromDDD::unitID ( int  det,
const CLHEP::Hep3Vector &  pos,
int  depth,
int  lay = -1 
) const

Definition at line 26 of file HcalNumberingFromDDD.cc.

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

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

29  {
30 
31 
32  double hx = point.x();
33  double hy = point.y();
34  double hz = point.z();
35  double hR = sqrt(hx*hx+hy*hy+hz*hz);
36  double htheta = (hR == 0. ? 0. : acos(std::max(std::min(hz/hR,1.0),-1.0)));
37  double hsintheta = sin(htheta);
38  double hphi = (hR*hsintheta == 0. ? 0. :atan2(hy,hx));
39  double heta = (fabs(hsintheta) == 1.? 0. : -log(fabs(tan(htheta/2.))) );
40 
41  int hsubdet=0;
42  double etaR;
43 
44  //First eta index
45  if (det == 5) { // Forward HCal
46  hsubdet = static_cast<int>(HcalForward);
47  hR = sqrt(hx*hx+hy*hy);
48  etaR = (heta >= 0. ? hR : -hR);
49  } else { // Barrel or Endcap
50  etaR = heta;
51  if (det == 3) {
52  hsubdet = static_cast<int>(HcalBarrel);
53  etaR = hcalConstants->getEtaHO(heta,hx,hy,hz);
54  } else {
55  hsubdet = static_cast<int>(HcalEndcap);
56  }
57  }
58 
59 #ifdef DebugLog
60  LogDebug("HCalGeom") << "HcalNumberingFromDDD: point = " << point << " det "
61  << det << ":" << hsubdet << " eta/R " << etaR << " phi "
62  << hphi;
63 #endif
64  return unitID(hsubdet,etaR,hphi,depth,lay);
65 }
#define LogDebug(id)
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
double getEtaHO(double &etaR, double &x, double &y, double &z) const
HcalDDDSimConstants * hcalConstants
T sqrt(T t)
Definition: SSEVec.h:48
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
tuple log
Definition: cmsBatch.py:341
HcalNumberingFromDDD::HcalID HcalNumberingFromDDD::unitID ( double  eta,
double  phi,
int  depth = 1,
int  lay = -1 
) const

Definition at line 67 of file HcalNumberingFromDDD.cc.

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

69  {
70  std::pair<int,double> detEta = hcalConstants->getDetEta(eta, depth);
71  return unitID(detEta.first,detEta.second,fi,depth,lay);
72 }
HcalDDDSimConstants * hcalConstants
std::pair< int, double > getDetEta(double eta, 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 75 of file HcalNumberingFromDDD.cc.

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

79  {
80 
81  double hetaR = fabs(etaR);
82  int ieta = hcalConstants->getEta(det, lay, hetaR);
83  std::pair<double,double> ficons = hcalConstants->getPhiCons(det, ieta);
84 
85  int nphi = int((CLHEP::twopi+0.1*ficons.second)/ficons.second);
86  int zside = etaR>0 ? 1: 0;
87  double hphi = phi+ficons.first;
88  if (hphi < 0) hphi += CLHEP::twopi;
89  int iphi = int(hphi/ficons.second) + 1;
90  if (iphi > nphi) iphi = 1;
91 
92 #ifdef DebugLog
93  LogDebug("HCalGeom") << "HcalNumberingFromDDD: etaR = " << etaR << " : "
94  << zside << "/" << ieta << " phi " << hphi << " : "
95  << iphi;
96 #endif
97  return unitID(det,zside,depth,ieta,iphi,lay);
98 }
#define LogDebug(id)
int getEta(int det, int lay, double hetaR)
int zside(DetId const &)
HcalDDDSimConstants * hcalConstants
std::pair< double, double > getPhiCons(int det, int ieta)
HcalID unitID(int det, const CLHEP::Hep3Vector &pos, int depth, int lay=-1) const
HcalNumberingFromDDD::HcalID HcalNumberingFromDDD::unitID ( int  det,
int  zside,
int  depth,
int  etaR,
int  phi,
int  lay = -1 
) const

Definition at line 100 of file HcalNumberingFromDDD.cc.

References HcalNumberingFromDDD::HcalID::depth, HcalNumberingFromDDD::HcalID::etaR, HcalDDDSimConstants::getEtaDepth(), HcalBarrel, hcalConstants, HcalOuter, HcalNumberingFromDDD::HcalID::lay, LogDebug, HcalNumberingFromDDD::HcalID::phi, HcalDDDSimConstants::phiNumber(), HcalNumberingFromDDD::HcalID::subdet, tmp, HcalDDDSimConstants::unitPhi(), units(), and HcalNumberingFromDDD::HcalID::zside.

103  {
104 
105 
106  std::pair<int,int> etaDepth = hcalConstants->getEtaDepth(det, etaR, phi, depth, lay);
107  if (det == static_cast<int>(HcalBarrel) && etaDepth.second == 4) {
108  det = static_cast<int>(HcalOuter);
109  }
110 
111  int units = hcalConstants->unitPhi(det, etaDepth.first);
112  int iphi_skip = hcalConstants->phiNumber(phi, units);
113 
114 #ifdef DebugLog
115  LogDebug("HCalGeom") << "HcalNumberingFromDDD: phi units= " << units
116  << " iphi_skip= " << iphi_skip;
117 #endif
118  HcalNumberingFromDDD::HcalID tmp(det,zside,etaDepth.second,etaDepth.first,phi,iphi_skip,lay);
119 
120 #ifdef DebugLog
121  LogDebug("HCalGeom") << "HcalNumberingFromDDD: det = " << det << " "
122  << tmp.subdet << " zside = " << tmp.zside << " depth = "
123  << tmp.depth << " eta/R = " << tmp.etaR << " phi = "
124  << tmp.phi << " layer = " << tmp.lay;
125 #endif
126  return tmp;
127 }
#define LogDebug(id)
std::pair< int, int > getEtaDepth(int det, int etaR, int phi, int depth, int lay)
int unitPhi(int det, int etaR) const
int zside(DetId const &)
HcalDDDSimConstants * hcalConstants
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
TString units(TString variable, Char_t axis)
int phiNumber(int phi, int unit) const

Member Data Documentation

HcalDDDSimConstants* HcalNumberingFromDDD::hcalConstants
private

Definition at line 38 of file HcalNumberingFromDDD.h.

Referenced by unitID().