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.
8 
9 namespace spr{
10 
11  const DetId findDetIdECAL( const CaloGeometry* geo, double eta, double phi, bool debug) {
12  double radius=0;
13  int subdet=0;
14  double theta=2.0*std::atan(exp(-eta));
15  if (std::abs(eta) > 1.479) {
16  radius = 319.2/std::abs(std::cos(theta));
17  subdet = EcalEndcap;
18  } else {
19  radius = 129.4/std::sin(theta);
20  subdet = EcalBarrel;
21  }
23  if (debug) std::cout << "findDetIdECAL: eta " << eta << " theta " << theta <<" phi " << phi << " radius " << radius << " subdet " << subdet << std::endl;
24  return spr::findDetIdCalo (gECAL, theta, phi, radius, debug);
25  }
26 
27  const DetId findDetIdHCAL( const CaloGeometry* geo, double eta, double phi, bool debug) {
28  double radius=0;
29  double theta=2.0*std::atan(exp(-eta));
30  if (std::abs(eta) > 1.392) radius = 402.7/std::abs(std::cos(theta));
31  else radius = 180.7/std::sin(theta);
33  if (debug) std::cout << "findDetIdHCAL: eta " << eta <<" theta "<<theta<< " phi " << phi << " radius " << radius << std::endl;
34  return spr::findDetIdCalo (gHCAL, theta, phi, radius, debug);
35  }
36 
37  const DetId findDetIdCalo( const CaloSubdetectorGeometry* geo, double theta, double phi, double radius, bool debug) {
38 
39  double rcyl = radius*std::sin(theta);
40  double z = radius*std::cos(theta);
41  GlobalPoint point (rcyl*std::cos(phi),rcyl*std::sin(phi),z);
42  const DetId cell = geo->getClosestCell(point);
43  if (debug) {
44  std::cout << "findDetIdCalo: rcyl " << rcyl << " z " << z << " Point " << point << " DetId ";
45  if (cell.det() == DetId::Ecal) {
46  if (cell.subdetId() == EcalBarrel) std::cout << (EBDetId)(cell);
47  else std::cout << (EEDetId)(cell);
48  } else {
49  std::cout << (HcalDetId)(cell);
50  }
51  std::cout << std::endl;
52  }
53  return cell;
54  }
55 
56 }
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:43
const DetId findDetIdCalo(const CaloSubdetectorGeometry *geo, double theta, double phi, double radius, bool debug=false)
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Geom::Theta< T > theta() const
T eta() const
const DetId findDetIdHCAL(const CaloGeometry *geo, double eta, double phi, bool debug=false)
float float float z
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:121
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
Definition: DDAxes.h:10