CMS 3D CMS Logo

DetIdFromEtaPhi.cc
Go to the documentation of this file.
9 
10 //#define EDM_ML_DEBUG
11 
12 namespace spr {
13 
14  const DetId findDetIdECAL(const CaloGeometry* geo, double eta, double phi, bool debug) {
15  double radius = 0;
16  int subdet = 0;
17  double theta = 2.0 * std::atan(exp(-eta));
18  if (std::abs(eta) > spr::etaBEEcal) {
20  subdet = EcalEndcap;
21  } else {
23  subdet = EcalBarrel;
24  }
25  const CaloSubdetectorGeometry* gECAL = geo->getSubdetectorGeometry(DetId::Ecal, subdet);
26 #ifdef EDM_ML_DEBUG
27  if (debug)
28  std::cout << "findDetIdECAL: eta " << eta << " theta " << theta << " phi " << phi << " radius " << radius
29  << " subdet " << subdet << std::endl;
30 #endif
31  return spr::findDetIdCalo(gECAL, theta, phi, radius, debug);
32  }
33 
34  const DetId findDetIdHCAL(const CaloGeometry* geo, double eta, double phi, bool debug) {
35  double radius = 0;
36  double theta = 2.0 * std::atan(exp(-eta));
39  else
42 #ifdef EDM_ML_DEBUG
43  if (debug)
44  std::cout << "findDetIdHCAL: eta " << eta << " theta " << theta << " phi " << phi << " radius " << radius
45  << std::endl;
46 #endif
47  return spr::findDetIdCalo(gHCAL, theta, phi, radius, debug);
48  }
49 
51  double theta,
52  double phi,
53  double radius,
54  bool
55 #ifdef EDM_ML_DEBUG
56  debug
57 #endif
58  ) {
59 
60  double rcyl = radius * std::sin(theta);
61  double z = radius * std::cos(theta);
62  GlobalPoint point(rcyl * std::cos(phi), rcyl * std::sin(phi), z);
63  const DetId cell = geo->getClosestCell(point);
64 #ifdef EDM_ML_DEBUG
65  if (debug) {
66  std::cout << "findDetIdCalo: rcyl " << rcyl << " z " << z << " Point " << point << " DetId ";
67  if (cell.det() == DetId::Ecal) {
68  if (cell.subdetId() == EcalBarrel)
69  std::cout << (EBDetId)(cell);
70  else
71  std::cout << (EEDetId)(cell);
72  } else {
73  std::cout << (HcalDetId)(cell);
74  }
75  std::cout << std::endl;
76  }
77 #endif
78  return cell;
79  }
80 
81 } // namespace spr
spr
Definition: CaloConstants.h:6
spr::rFrontEB
static const double rFrontEB
Definition: CaloConstants.h:10
EBDetId
Definition: EBDetId.h:17
CaloConstants.h
DetId::det
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46
gather_cfg.cout
cout
Definition: gather_cfg.py:144
EBDetId.h
EEDetId.h
DetId::Hcal
Definition: DetId.h:28
CaloGeometry::getSubdetectorGeometry
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:34
DetIdFromEtaPhi.h
HcalBarrel
Definition: HcalAssistant.h:33
EcalBarrel
Definition: EcalSubdetector.h:10
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
spr::findDetIdCalo
const DetId findDetIdCalo(const CaloSubdetectorGeometry *geo, double theta, double phi, double radius, bool debug=false)
Definition: DetIdFromEtaPhi.cc:50
DetId
Definition: DetId.h:17
CaloGeometry
Definition: CaloGeometry.h:21
debug
#define debug
Definition: HDRShower.cc:19
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
PVValHelper::eta
Definition: PVValidationHelpers.h:70
spr::zFrontEE
static const double zFrontEE
Definition: CaloConstants.h:9
theta
Geom::Theta< T > theta() const
Definition: Basic3DVectorLD.h:150
spr::etaBEEcal
static const double etaBEEcal
Definition: CaloConstants.h:12
Point3DBase< float, GlobalTag >
DetId::subdetId
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum)
Definition: DetId.h:48
EEDetId
Definition: EEDetId.h:14
EcalSubdetector.h
EcalEndcap
Definition: EcalSubdetector.h:10
HcalDetId.h
HcalDetId
Definition: HcalDetId.h:12
spr::findDetIdECAL
const DetId findDetIdECAL(const CaloGeometry *geo, double eta, double phi, bool debug=false)
Definition: DetIdFromEtaPhi.cc:14
spr::rFrontHB
static const double rFrontHB
Definition: CaloConstants.h:14
HcalSubdetector.h
CaloSubdetectorGeometry::getClosestCell
virtual DetId getClosestCell(const GlobalPoint &r) const
Definition: CaloSubdetectorGeometry.cc:44
DetId::Ecal
Definition: DetId.h:27
spr::findDetIdHCAL
const DetId findDetIdHCAL(const CaloGeometry *geo, double eta, double phi, bool debug=false)
Definition: DetIdFromEtaPhi.cc:34
spr::zFrontHE
static const double zFrontHE
Definition: CaloConstants.h:13
CosmicsPD_Skims.radius
radius
Definition: CosmicsPD_Skims.py:135
Point3D.h
CaloSubdetectorGeometry
Definition: CaloSubdetectorGeometry.h:22
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
spr::etaBEHcal
static const double etaBEHcal
Definition: CaloConstants.h:15
EDM_ML_DEBUG
#define EDM_ML_DEBUG
Definition: AnalyzerMinbias.cc:56
JetChargeProducer_cfi.exp
exp
Definition: JetChargeProducer_cfi.py:6
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