CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_14/src/DataFormats/ParticleFlowReco/src/PFBlockElementGsfTrack.cc

Go to the documentation of this file.
00001 #include "DataFormats/ParticleFlowReco/interface/PFBlockElementGsfTrack.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 PFBlockElementGsfTrack::PFBlockElementGsfTrack(const GsfPFRecTrackRef& gsfref, 
00014                                                const math::XYZTLorentzVector& Pin, 
00015                                                const math::XYZTLorentzVector& Pout ) : 
00016   PFBlockElement( GSF ),
00017   GsftrackRefPF_( gsfref ), 
00018   GsftrackRef_( gsfref->gsfTrackRef() ),
00019   Pin_(Pin),
00020   Pout_(Pout),
00021   trackType_(0){
00022 
00023   if(gsfref.isNull() )
00024     throw cms::Exception("NullRef")
00025       <<" PFBlockElementGsfTrack constructed from a null reference to PFGsfRecTrack.";
00026   const reco::PFTrajectoryPoint& atECAL 
00027     = gsfref->extrapolatedPoint( reco::PFTrajectoryPoint::ECALEntrance );
00028   if( atECAL.isValid() ) 
00029     positionAtECALEntrance_.SetCoordinates( atECAL.position().x(),
00030                                             atECAL.position().y(),
00031                                             atECAL.position().z() );
00032 
00033   
00034   setTrackType( DEFAULT, true );      
00035 }
00036 
00037 void PFBlockElementGsfTrack::Dump(ostream& out, 
00038                                const char* tab ) const {
00039   
00040   if(! out ) return;
00041  
00042   if( !GsftrackRefPF_.isNull() ) {
00043 
00044     //    double charge = trackPF().charge;
00045     double charge = GsftrackRefPF_->charge();
00046     math::XYZTLorentzVector pin = Pin_;
00047     math::XYZTLorentzVector pout = Pout_;
00048     double ptin = pin.pt();
00049     double etain = pin.eta();
00050     double phiin = pin.phi();
00051     double ptout = pout.pt();
00052     double etaout = pout.eta();
00053     double phiout = pout.phi();
00054     out<<setprecision(0);
00055     out<<tab<<setw(7)<<"charge="<<setw(3)<<charge;
00056     out<<setprecision(3);
00057     out<<setiosflags(ios::right);
00058     out<<setiosflags(ios::fixed);
00059     out<<", Inner pT  ="<<setw(7)<<ptin;
00060     out<<" Inner (eta,phi)= (";
00061     out<< etain <<",";
00062     out<< phiin <<")";
00063     out<<", Outer pT  ="<<setw(7)<<ptout;
00064     out<<" Outer (eta,phi)= (";
00065     out<< etaout <<",";
00066     out<< phiout <<")";
00067     out<<resetiosflags(ios::right|ios::fixed); }
00068 
00069 }
00070