CMS 3D CMS Logo

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 <iostream>
12 
13 //#define EDM_ML_DEBUG
14 
15 namespace spr {
16 
17  double timeOfFlight(DetId id, const CaloGeometry* geo, bool debug) {
18  GlobalPoint point = (id.det() == DetId::Hcal)
19  ? (static_cast<const HcalGeometry*>(geo->getSubdetectorGeometry(id)))->getPosition(id)
20  : geo->getPosition(id);
21  double R = point.mag();
22  double tmp = R / CLHEP::c_light / CLHEP::ns;
23 #ifdef EDM_ML_DEBUG
24  if (debug) {
25  DetId::Detector det = id.det();
26  int subdet = id.subdetId();
27  double eta = point.eta();
28  double theta = 2.0 * atan(exp(-std::abs(eta)));
29  double dist = 0;
30  if (det == DetId::Ecal) {
31  if (subdet == static_cast<int>(EcalBarrel)) {
32  const double rEB = spr::rFrontEB * CLHEP::cm;
33  dist = rEB / sin(theta);
34  } else if (subdet == static_cast<int>(EcalEndcap)) {
35  const double zEE = spr::zFrontEE * CLHEP::cm;
36  dist = zEE / cos(theta);
37  } else {
38  const double zES = spr::zFrontES * CLHEP::cm;
39  dist = zES / cos(theta);
40  }
41  } else if (det == DetId::Hcal) {
42  if (subdet == static_cast<int>(HcalBarrel)) {
43  const double rHB = spr::rFrontHB * CLHEP::cm;
44  dist = rHB / sin(theta);
45  } else if (subdet == static_cast<int>(HcalEndcap)) {
46  const double zHE = spr::zFrontHE * CLHEP::cm;
47  dist = zHE / cos(theta);
48  } else if (subdet == static_cast<int>(HcalOuter)) {
49  const double rHO = spr::rFrontHO * CLHEP::cm;
50  dist = rHO / sin(theta);
51  } else {
52  const double zHF = spr::zFrontHF * CLHEP::cm;
53  dist = zHF / cos(theta);
54  }
55  }
56  double tmp1 = dist / CLHEP::c_light / CLHEP::ns;
57 
58  std::cout << "Detector " << det << "/" << subdet << " Eta/Theta " << eta << "/" << theta / CLHEP::deg << " Dist "
59  << dist / CLHEP::cm << " R " << R << " TOF " << tmp << ":" << tmp1 << std::endl;
60  }
61 #endif
62  return tmp;
63  }
64 
65 } // namespace spr
spr::zFrontHF
static const double zFrontHF
Definition: CaloConstants.h:19
spr
Definition: CaloConstants.h:6
spr::rFrontEB
static const double rFrontEB
Definition: CaloConstants.h:10
spr::zFrontES
static const double zFrontES
Definition: CaloConstants.h:11
CaloGeometry::getPosition
GlobalPoint getPosition(const DetId &id) const
Get the position of a given detector id.
Definition: CaloGeometry.cc:50
CaloConstants.h
gather_cfg.cout
cout
Definition: gather_cfg.py:144
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
HcalBarrel
Definition: HcalAssistant.h:33
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
spr::rFrontHO
static const double rFrontHO
Definition: CaloConstants.h:18
EcalBarrel
Definition: EcalSubdetector.h:10
HcalGeometry.h
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
DetId
Definition: DetId.h:17
spr::timeOfFlight
double timeOfFlight(DetId id, const CaloGeometry *geo, bool debug=false)
Definition: CaloSimInfo.cc: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:69
spr::zFrontEE
static const double zFrontEE
Definition: CaloConstants.h:9
HcalOuter
Definition: HcalAssistant.h:35
theta
Geom::Theta< T > theta() const
Definition: Basic3DVectorLD.h:150
Point3DBase< float, GlobalTag >
EcalSubdetector.h
EcalEndcap
Definition: EcalSubdetector.h:10
spr::rFrontHB
static const double rFrontHB
Definition: CaloConstants.h:14
DetId::Detector
Detector
Definition: DetId.h:24
HcalSubdetector.h
DetId::Ecal
Definition: DetId.h:27
CaloSimInfo.h
HcalEndcap
Definition: HcalAssistant.h:34
DetId.h
spr::zFrontHE
static const double zFrontHE
Definition: CaloConstants.h:13
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
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
dttmaxenums::R
Definition: DTTMax.h:29