Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:54:17

0001 #include "DataFormats/ParticleFlowReco/interface/PFBlockElementGsfTrack.h"
0002 #include "DataFormats/ParticleFlowReco/interface/PFRecTrack.h"
0003 #include "DataFormats/Common/interface/Ref.h"
0004 #include "DataFormats/TrackReco/interface/Track.h"
0005 #include "DataFormats/ParticleFlowReco/interface/PFTrajectoryPoint.h"
0006 
0007 #include <iomanip>
0008 
0009 using namespace reco;
0010 using namespace std;
0011 
0012 PFBlockElementGsfTrack::PFBlockElementGsfTrack(const GsfPFRecTrackRef& gsfref,
0013                                                const math::XYZTLorentzVector& Pin,
0014                                                const math::XYZTLorentzVector& Pout)
0015     : PFBlockElement(GSF),
0016       GsftrackRefPF_(gsfref),
0017       GsftrackRef_(gsfref->gsfTrackRef()),
0018       Pin_(Pin),
0019       Pout_(Pout),
0020       trackType_(0) {
0021   if (gsfref.isNull())
0022     throw cms::Exception("NullRef") << " PFBlockElementGsfTrack constructed from a null reference to PFGsfRecTrack.";
0023   const reco::PFTrajectoryPoint& atECAL = gsfref->extrapolatedPoint(reco::PFTrajectoryPoint::ECALEntrance);
0024   if (atECAL.isValid())
0025     positionAtECALEntrance_.SetCoordinates(atECAL.position().x(), atECAL.position().y(), atECAL.position().z());
0026 
0027   setTrackType(DEFAULT, true);
0028 }
0029 
0030 void PFBlockElementGsfTrack::Dump(ostream& out, const char* tab) const {
0031   if (!out)
0032     return;
0033 
0034   if (!GsftrackRefPF_.isNull()) {
0035     //    double charge = trackPF().charge;
0036     double charge = GsftrackRefPF_->charge();
0037     math::XYZTLorentzVector pin = Pin_;
0038     math::XYZTLorentzVector pout = Pout_;
0039     double ptin = pin.pt();
0040     double etain = pin.eta();
0041     double phiin = pin.phi();
0042     double ptout = pout.pt();
0043     double etaout = pout.eta();
0044     double phiout = pout.phi();
0045     out << setprecision(0);
0046     out << tab << setw(7) << "charge=" << setw(3) << charge;
0047     out << setprecision(3);
0048     out << setiosflags(ios::right);
0049     out << setiosflags(ios::fixed);
0050     out << ", Inner pT  =" << setw(7) << ptin;
0051     out << " Inner (eta,phi)= (";
0052     out << etain << ",";
0053     out << phiin << ")";
0054     out << ", Outer pT  =" << setw(7) << ptout;
0055     out << " Outer (eta,phi)= (";
0056     out << etaout << ",";
0057     out << phiout << ")";
0058     out << resetiosflags(ios::right | ios::fixed);
0059   }
0060 }