test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DetIdFromEtaPhi.cc
Go to the documentation of this file.
9 
10 namespace spr{
11 
12  const DetId findDetIdECAL( const CaloGeometry* geo, double eta, double phi, bool debug) {
13  double radius=0;
14  int subdet=0;
15  double theta=2.0*std::atan(exp(-eta));
16  if (std::abs(eta) > spr::etaBEEcal) {
17  radius = spr::zFrontEE/std::abs(std::cos(theta));
18  subdet = EcalEndcap;
19  } else {
20  radius = spr::rFrontEB/std::sin(theta);
21  subdet = EcalBarrel;
22  }
24  if (debug) std::cout << "findDetIdECAL: eta " << eta << " theta " << theta <<" phi " << phi << " radius " << radius << " subdet " << subdet << std::endl;
25  return spr::findDetIdCalo (gECAL, theta, phi, radius, debug);
26  }
27 
28  const DetId findDetIdHCAL( const CaloGeometry* geo, double eta, double phi, bool debug) {
29  double radius=0;
30  double theta=2.0*std::atan(exp(-eta));
31  if (std::abs(eta) > spr::etaBEHcal)
32  radius = spr::zFrontHE/std::abs(std::cos(theta));
33  else
34  radius = spr::rFrontHB/std::sin(theta);
36  if (debug) std::cout << "findDetIdHCAL: eta " << eta <<" theta "<<theta<< " phi " << phi << " radius " << radius << std::endl;
37  return spr::findDetIdCalo (gHCAL, theta, phi, radius, debug);
38  }
39 
40  const DetId findDetIdCalo( const CaloSubdetectorGeometry* geo, double theta, double phi, double radius, bool debug) {
41 
42  double rcyl = radius*std::sin(theta);
43  double z = radius*std::cos(theta);
44  GlobalPoint point (rcyl*std::cos(phi),rcyl*std::sin(phi),z);
45  const DetId cell = geo->getClosestCell(point);
46  if (debug) {
47  std::cout << "findDetIdCalo: rcyl " << rcyl << " z " << z << " Point " << point << " DetId ";
48  if (cell.det() == DetId::Ecal) {
49  if (cell.subdetId() == EcalBarrel) std::cout << (EBDetId)(cell);
50  else std::cout << (EEDetId)(cell);
51  } else {
52  std::cout << (HcalDetId)(cell);
53  }
54  std::cout << std::endl;
55  }
56  return cell;
57  }
58 
59 }
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:43
static const double etaBEEcal
Definition: CaloConstants.h:12
const DetId findDetIdCalo(const CaloSubdetectorGeometry *geo, double theta, double phi, double radius, bool debug=false)
static const double etaBEHcal
Definition: CaloConstants.h:15
static const double zFrontHE
Definition: CaloConstants.h:13
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Geom::Theta< T > theta() const
const DetId findDetIdHCAL(const CaloGeometry *geo, double eta, double phi, bool debug=false)
static const double rFrontHB
Definition: CaloConstants.h:14
static const double zFrontEE
Definition: CaloConstants.h:9
static const double rFrontEB
Definition: CaloConstants.h:10
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const DetId findDetIdECAL(const CaloGeometry *geo, double eta, double phi, bool debug=false)
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
virtual DetId getClosestCell(const GlobalPoint &r) const
Definition: DetId.h:18
#define debug
Definition: HDRShower.cc:19
tuple cout
Definition: gather_cfg.py:145
Detector det() const
get the detector field from this detid
Definition: DetId.h:35
*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