00001 #include "DataFormats/ParticleFlowReco/interface/PFBlockElementTrack.h"
00002 #include "DataFormats/ParticleFlowReco/interface/PFRecTrack.h"
00003 #include "DataFormats/Common/interface/Ref.h"
00004 #include "DataFormats/TrackReco/interface/Track.h"
00005 #include "DataFormats/ParticleFlowReco/interface/PFTrajectoryPoint.h"
00006
00007 #include <iomanip>
00008
00009 using namespace reco;
00010 using namespace std;
00011
00012
00013 PFBlockElementTrack::PFBlockElementTrack(const PFRecTrackRef& ref) :
00014 PFBlockElement( TRACK ),
00015 trackRefPF_( ref ),
00016 trackRef_( ref->trackRef() ),
00017 trackType_(0) {
00018
00019
00020 if( ref.isNull() )
00021 throw cms::Exception("NullRef")<<" PFBlockElementTrack constructed from a null reference to PFRecTrack.";
00022
00023 const reco::PFTrajectoryPoint& atECAL
00024 = ref->extrapolatedPoint( reco::PFTrajectoryPoint::ECALEntrance );
00025
00026 if( atECAL.isValid() )
00027 positionAtECALEntrance_.SetCoordinates( atECAL.position().x(),
00028 atECAL.position().y(),
00029 atECAL.position().z() );
00030
00031
00032
00033 setTrackType( DEFAULT, true );
00034 }
00035
00036
00037 void PFBlockElementTrack::Dump(ostream& out,
00038 const char* tab ) const {
00039
00040 if(! out ) return;
00041
00042 if( !trackRef_.isNull() ) {
00043
00044 double charge = trackRef_->charge();
00045 double pt = trackRef_->pt();
00046 double p = trackRef_->p();
00047 string s = " at vertex";
00048 double tracketa = trackRef_->eta();
00049 double trackphi = trackRef_->phi();
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065 out<<setprecision(0);
00066 out<<tab<<setw(7)<<"charge="<<setw(3)<<charge;
00067 out<<setprecision(3);
00068 out<<setiosflags(ios::right);
00069 out<<setiosflags(ios::fixed);
00070 out<<", pT ="<<setw(7)<<pt;
00071 out<<", p ="<<setw(7)<<p;
00072 out<<" (eta,phi)= (";
00073 out<<tracketa<<",";
00074 out<<trackphi<<")" << s;
00075
00076 out<<resetiosflags(ios::right|ios::fixed);
00077 }
00078 }