22 produces<TrackingRecHitCollection>();
23 produces<reco::TrackExtraCollection>();
53 multiply(revised_matrix,error_matrix);
55 return revised_matrix;
62 for(
int i = 0;
i!=5;
i++){
for(
int j =
i;
j!=5;
j++){
63 revised_matrix(
i,
j)*=scale_matrix(
i,
j);
70 for(
int i = 0;
i!=5;
i++){
for(
int j =
i;
j!=5;
j++){
71 if (denom_matrix(
i,
j)==0)
return false;
72 num_matrix(
i,
j)/=denom_matrix(
i,
j);
80 double chi2 = recotrack_orig.
chi2();
81 double ndof = recotrack_orig.
ndof();
90 <<
"\n refpos: "<<refpos
92 <<
"\n charge: "<<charge
93 <<
"\n covariance:\n"<<recotrack_orig.
covariance()
94 <<
"\n replaced by:\n"<<covariance_matrix;
96 return reco::Track(chi2,ndof,refpos,mom,charge,covariance_matrix);
109 if (trackExtra_orig.
isNull()) {
122 TEcol.push_back(
reco::TrackExtra (trackExtra_orig->outerPosition(), trackExtra_orig->outerMomentum(),
true,
123 trackExtra_orig->innerPosition(), trackExtra_orig->innerMomentum(),
true,
124 outerCov, trackExtra_orig->outerDetId(),
125 innerCov, trackExtra_orig->innerDetId(),
126 trackExtra_orig->seedDirection()));
132 return &(TEcol.back());
142 auto const firstHitIndex =
theRHi;
143 for (; recHit!=recotrack_orig.
recHitsEnd();++recHit){
187 for(
unsigned int it=0;it!=
tracks->size();it++)
189 const reco::Track & recotrack_orig = (*tracks)[it];
200 Toutput->push_back(recotrack);
212 if (!
attachRecHits(recotrack_orig,recotrackref,*extra,*TRHoutput)){
217 TEoutput->pop_back();
223 LogDebug(
theCategory)<<
"writing: "<<Toutput->size()<<
" corrected reco::Track to the event.";
226 iEvent.
put(TEoutput);
227 iEvent.
put(TRHoutput);
T getParameter(std::string const &) const
const Point & referencePoint() const
Reference point on the track.
edm::RefProd< reco::TrackExtraCollection > theRefprodTE
get reference before put track extra to the event, in order to create edm::Ref
virtual void beginJob()
framework method
const TrackExtraRef & extra() const
reference to "extra" object
reco::TrackBase::CovarianceMatrix fix_cov_matrix(const reco::TrackBase::CovarianceMatrix &error_matrix, const GlobalVector &momentum)
return a corrected error matrix
virtual void produce(edm::Event &, const edm::EventSetup &)
std::vector< Track > TrackCollection
collection of Tracks
bool attachRecHits(const reco::Track &recotrack_orig, reco::Track &recotrack, reco::TrackExtra &trackextra, TrackingRecHitCollection &RHcol)
attached rechits to the newly created reco::Track and reco::TrackExtra
CurvilinearTrajectoryError get(GlobalVector momentum, bool convolute=true)
main method to be used. Retrieve a 5x5 symetrical matrix according to parametrization of error or sca...
std::string theInstanceName
instrance name of the created track collecion. rechit and trackextra have no instance name ...
const Vector & momentum() const
track momentum vector
edm::InputTag theTrackLabel
input tag of the reco::Track collection to be corrected
std::string theCategory
log category: MuonErrorMatrixAdjuster
void multiply(reco::TrackBase::CovarianceMatrix &revised_matrix, const reco::TrackBase::CovarianceMatrix &scale_matrix)
mutliply revised_matrix (first argument) by second matrix TERM by TERM
edm::ESHandle< MagneticField > theField
hold on to the magnetic field
MuonErrorMatrixAdjuster(const edm::ParameterSet &)
constructor
MuonErrorMatrix * theMatrixProvider
double chi2() const
chi-squared of the fit
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
bool divide(reco::TrackBase::CovarianceMatrix &num_matrix, const reco::TrackBase::CovarianceMatrix &denom_matrix)
divide the num_matrix (first argument) by second matrix, TERM by TERM
double ndof() const
number of degrees of freedom of the fit
CovarianceMatrix covariance() const
return track covariance matrix
bool appendHitPattern(const TrackingRecHit &hit)
append a single hit to the HitPattern
edm::Ref< reco::TrackExtraCollection >::key_type theTEi
edm::RefProd< TrackingRecHitCollection > theRefprodRH
get reference before put rechit to the event, in order to create edm::Ref
trackingRecHit_iterator recHitsBegin() const
Iterator to first hit on the track.
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
bool isNull() const
Checks for null.
GlobalVector momentum() const
RefProd< PROD > getRefBeforePut()
edm::ParameterSet theMatrixProvider_pset
holds the error matrix parametrization
GlobalPoint position() const
std::vector< TrackExtra > TrackExtraCollection
collection of TrackExtra objects
edm::OwnVector< TrackingRecHit > TrackingRecHitCollection
collection of TrackingRecHits
void setExtra(const TrackExtraRef &ref)
set reference to "extra" object
reco::TrackExtra * makeTrackExtra(const reco::Track &recotrack_orig, reco::Track &recotrack, reco::TrackExtraCollection &TEcol)
create a track extra for the newly created recotrack, scaling the outer/inner measurment error matrix...
XYZVectorD XYZVector
spatial vector with cartesian internal representation
XYZPointD XYZPoint
point in space with cartesian internal representation
T const * product() const
bool selectTrack(const reco::Track &recotrack_orig)
make a selection on the reco:Track. (dummy for the moment)
reco::Track makeTrack(const reco::Track &recotrack_orig, const FreeTrajectoryState &PCAstate)
create a corrected reco::Track from itself and trajectory state (redundant information) ...
bool theRescale
select the rescaling or replacing method to correct the error matrix
~MuonErrorMatrixAdjuster()
destructor
int charge() const
track electric charge
TrackingRecHitCollection::base::const_iterator trackingRecHit_iterator
iterator over a vector of reference to TrackingRecHit in the same collection
math::Error< dimension >::type CovarianceMatrix
5 parameter covariance matrix
edm::Ref< TrackingRecHitCollection >::key_type theRHi
trackingRecHit_iterator recHitsEnd() const
Iterator to last hit on the track.