CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
CaloSimInfo.cc
Go to the documentation of this file.
7 
8 #include "CLHEP/Units/PhysicalConstants.h"
9 #include "CLHEP/Units/SystemOfUnits.h"
10 
11 #include <sstream>
12 
13 namespace spr {
14 
15  double timeOfFlight(DetId id, const CaloGeometry* geo, bool debug) {
16  GlobalPoint point = (id.det() == DetId::Hcal)
17  ? (static_cast<const HcalGeometry*>(geo->getSubdetectorGeometry(id)))->getPosition(id)
18  : geo->getPosition(id);
19  double R = point.mag();
20  double tmp = R / CLHEP::c_light / CLHEP::ns;
21  if (debug) {
22  DetId::Detector det = id.det();
23  int subdet = id.subdetId();
24  double eta = point.eta();
25  double theta = 2.0 * atan(exp(-std::abs(eta)));
26  double dist = 0;
27  if (det == DetId::Ecal) {
28  if (subdet == static_cast<int>(EcalBarrel)) {
29  const double rEB = spr::rFrontEB * CLHEP::cm;
30  dist = rEB / sin(theta);
31  } else if (subdet == static_cast<int>(EcalEndcap)) {
32  const double zEE = spr::zFrontEE * CLHEP::cm;
33  dist = zEE / cos(theta);
34  } else {
35  const double zES = spr::zFrontES * CLHEP::cm;
36  dist = zES / cos(theta);
37  }
38  } else if (det == DetId::Hcal) {
39  if (subdet == static_cast<int>(HcalBarrel)) {
40  const double rHB = spr::rFrontHB * CLHEP::cm;
41  dist = rHB / sin(theta);
42  } else if (subdet == static_cast<int>(HcalEndcap)) {
43  const double zHE = spr::zFrontHE * CLHEP::cm;
44  dist = zHE / cos(theta);
45  } else if (subdet == static_cast<int>(HcalOuter)) {
46  const double rHO = spr::rFrontHO * CLHEP::cm;
47  dist = rHO / sin(theta);
48  } else {
49  const double zHF = spr::zFrontHF * CLHEP::cm;
50  dist = zHF / cos(theta);
51  }
52  }
53  double tmp1 = dist / CLHEP::c_light / CLHEP::ns;
54 
55  edm::LogVerbatim("IsoTrack") << "Detector " << det << "/" << subdet << " Eta/Theta " << eta << "/"
56  << theta / CLHEP::deg << " Dist " << dist / CLHEP::cm << " R " << R << " TOF " << tmp
57  << ":" << tmp1;
58  }
59  return tmp;
60  }
61 
62 } // namespace spr
Log< level::Info, true > LogVerbatim
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:34
static const double zFrontHE
Definition: CaloConstants.h:13
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Geom::Theta< T > theta() const
static const double zFrontHF
Definition: CaloConstants.h:19
Exp< T >::type exp(const T &t)
Definition: Exp.h:22
static const double rFrontHB
Definition: CaloConstants.h:14
static const double zFrontEE
Definition: CaloConstants.h:9
T mag() const
Definition: PV3DBase.h:64
static const double rFrontEB
Definition: CaloConstants.h:10
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
GlobalPoint getPosition(const DetId &id) const
Get the position of a given detector id.
Definition: CaloGeometry.cc:50
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static const double zFrontES
Definition: CaloConstants.h:11
Definition: DetId.h:17
#define debug
Definition: HDRShower.cc:19
Detector
Definition: DetId.h:24
T eta() const
Definition: PV3DBase.h:73
static const double rFrontHO
Definition: CaloConstants.h:18
tmp
align.sh
Definition: createJobs.py:716
double timeOfFlight(DetId id, const CaloGeometry *geo, bool debug=false)
Definition: CaloSimInfo.cc:15
*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