CMS 3D CMS Logo

PositionAtECalEntranceComputer.cc
Go to the documentation of this file.
2 
8 
9 #include <cassert>
10 
12  : bField_esToken_(cc.esConsumes<MagneticField, IdealMagneticFieldRecord>()),
13  caloGeo_esToken_(cc.esConsumes<CaloGeometry, CaloGeometryRecord>()),
14  bField_z_(-1.),
15  isPhase2_(isPhase2) {}
16 
18  : bField_esToken_(cc.esConsumes<MagneticField, IdealMagneticFieldRecord>()),
19  caloGeo_esToken_(cc.esConsumes<CaloGeometry, CaloGeometryRecord>()),
20  bField_z_(-1.),
21  isPhase2_(isPhase2) {}
22 
24 
26  bField_z_ = es.getData(bField_esToken_).inTesla(GlobalPoint(0., 0., 0.)).z();
27  if (isPhase2_) {
29  hgcalFace_z_ = recHitTools_.getPositionLayer(1).z(); // HGCal 1st layer
30  }
31 }
32 
34  bool& success) const {
35  assert(bField_z_ != -1.);
38  RawParticle(particle->p4(),
39  math::XYZTLorentzVector(particle->vertex().x(), particle->vertex().y(), particle->vertex().z(), 0.),
40  particle->charge()),
41  0.,
42  0.,
43  bField_z_);
44  if (!isPhase2_ || std::abs(particle->eta()) < ecalBarrelEndcapEtaBorder_) { // ECal
45  propagator.propagateToEcalEntrance(false);
46  } else { // HGCal
47  if (std::abs(particle->vertex().z()) >= hgcalFace_z_) {
48  success = false;
49  return position;
50  }
51  propagator.setPropagationConditions(152.6, hgcalFace_z_, false);
52  propagator.propagate();
53  }
54  if (propagator.getSuccess() != 0) {
55  position = propagator.particle().vertex().Vect();
57  } else {
58  success = false;
59  }
60  return position;
61 }
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeo_esToken_
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
PositionAtECalEntranceComputer(edm::ConsumesCollector &&, bool isPhase2=false)
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
void beginEvent(const edm::EventSetup &)
T z() const
Definition: PV3DBase.h:61
uint32_t cc[maxCellsPerHit]
Definition: gpuFishbone.h:49
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
assert(be >=bs)
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > bField_esToken_
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
reco::Candidate::Point operator()(const reco::Candidate *particle, bool &success) const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
virtual const Point & vertex() const =0
vertex position
virtual int charge() const =0
electric charge
GlobalPoint getPositionLayer(int layer, bool nose=false) const
Definition: RecHitTools.cc:152
void setGeometry(CaloGeometry const &)
Definition: RecHitTools.cc:79
static int position[264][3]
Definition: ReadPGInfo.cc:289
math::XYZPoint Point
point in the space
Definition: Candidate.h:40
virtual double eta() const =0
momentum pseudorapidity
virtual const LorentzVector & p4() const =0
four-momentum Lorentz vector