CMS 3D CMS Logo

PFBlockElementTrack.cc
Go to the documentation of this file.
6 
7 #include <iomanip>
8 
9 using namespace reco;
10 using namespace std;
11 
13  : PFBlockElement(TRACK), trackRefPF_(ref), trackRef_(ref->trackRef()), trackType_(0) {
14  if (ref.isNull())
15  throw cms::Exception("NullRef") << " PFBlockElementTrack constructed from a null reference to PFRecTrack.";
16 
17  const reco::PFTrajectoryPoint& atECAL = ref->extrapolatedPoint(reco::PFTrajectoryPoint::ECALEntrance);
18 
19  if (atECAL.isValid())
20  positionAtECALEntrance_.SetCoordinates(atECAL.position().x(), atECAL.position().y(), atECAL.position().z());
21  // if the position at ecal entrance is invalid,
22  // positionAtECALEntrance_ is initialized by default to 0,0,0
23 
24  setTrackType(DEFAULT, true);
25 }
26 
27 void PFBlockElementTrack::Dump(ostream& out, const char* tab) const {
28  if (!out)
29  return;
30 
31  if (!trackRef_.isNull()) {
32  double charge = trackRef_->charge();
33  double pt = trackRef_->pt();
34  double p = trackRef_->p();
35  string s = " at vertex";
36  double tracketa = trackRef_->eta();
37  double trackphi = trackRef_->phi();
38 
39  // COLIN
40  // the following lines rely on the presence of the PFRecTrack,
41  // which for most people is not there (PFRecTracks are transient)
42  // commented these lines out to remove the spurious error message
43  // for the missing PFRecTrack product
44  // const reco::PFTrajectoryPoint& atECAL
45  // = trackRefPF_->extrapolatedPoint( reco::PFTrajectoryPoint::ECALShowerMax );
46  // // check if reach ecal Shower max
47  // if( atECAL.isValid() ) {
48  // s = " at ECAL shower max";
49  // tracketa = atECAL.position().Eta();
50  // trackphi = atECAL.position().Phi();
51  // }
52 
53  out << setprecision(0);
54  out << tab << setw(7) << "charge=" << setw(3) << charge;
55  out << setprecision(3);
56  out << setiosflags(ios::right);
57  out << setiosflags(ios::fixed);
58  out << ", pT =" << setw(7) << pt;
59  out << ", p =" << setw(7) << p;
60  out << " (eta,phi)= (";
61  out << tracketa << ",";
62  out << trackphi << ")" << s;
63 
64  out << resetiosflags(ios::right | ios::fixed);
65  }
66 }
Abstract base class for a PFBlock element (track, cluster...)
ALPAKA_FN_HOST_ACC ALPAKA_FN_INLINE constexpr float charge(ConstView const &tracks, int32_t i)
Definition: TracksSoA.h:73
reco::TrackRef trackRef_
reference to the corresponding track
void setTrackType(TrackType trType, bool value) override
the trackType
bool isValid() const
is this point valid ?
bool isNull() const
Checks for null.
Definition: Ref.h:229
void Dump(std::ostream &out=std::cout, const char *tab=" ") const override
print the object inside the element
const math::XYZPoint & position() const
cartesian position (x, y, z)
fixed size matrix
A PFTrack holds several trajectory points, which basically contain the position and momentum of a tra...
math::XYZPointF positionAtECALEntrance_
position at ECAL entrance