CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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();
56  success = (std::abs(position.eta()) <= hgcalHfEtaBorder_);
57  } else {
58  success = false;
59  }
60  return position;
61 }
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeo_esToken_
tuple propagator
PositionAtECalEntranceComputer(edm::ConsumesCollector &&, bool isPhase2=false)
void beginEvent(const edm::EventSetup &)
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
int getSuccess() const
Has propagation been performed and was barrel or endcap reached ?
void setPropagationConditions(double r, double z, bool firstLoop=true)
Set the propagation characteristics (rCyl, zCyl and first loop only)
RawParticle const & particle() const
The particle being propagated.
assert(be >=bs)
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > bField_esToken_
bool getData(T &iHolder) const
Definition: EventSetup.h:128
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
T z() const
Definition: PV3DBase.h:61
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
bool propagateToEcalEntrance(bool first=true)
const XYZTLorentzVector & vertex() const
the vertex fourvector
Definition: RawParticle.h:320
GlobalPoint getPositionLayer(int layer, bool nose=false) const
Definition: RecHitTools.cc:141
void setGeometry(CaloGeometry const &)
Definition: RecHitTools.cc:68
static int position[264][3]
Definition: ReadPGInfo.cc:289
math::XYZPoint Point
point in the space
Definition: Candidate.h:40
reco::Candidate::Point operator()(const reco::Candidate *particle, bool &success) const
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
virtual double eta() const =0
momentum pseudorapidity
virtual const LorentzVector & p4() const =0
four-momentum Lorentz vector