25 produces<TrackingRecHitCollection>();
26 produces<reco::TrackExtraCollection>();
56 multiply(revised_matrix,error_matrix);
58 return revised_matrix;
65 for(
int i = 0;
i!=5;
i++){
for(
int j =
i;j!=5;j++){
66 revised_matrix(
i,j)*=scale_matrix(
i,j);
73 for(
int i = 0;
i!=5;
i++){
for(
int j =
i;j!=5;j++){
74 if (denom_matrix(
i,j)==0)
return false;
75 num_matrix(
i,j)/=denom_matrix(
i,j);
93 <<
"\n refpos: "<<refpos
95 <<
"\n charge: "<<charge
96 <<
"\n covariance:\n"<<recotrack_orig.
covariance()
97 <<
"\n replaced by:\n"<<covariance_matrix;
99 return reco::Track(chi2,ndof,refpos,mom,charge,covariance_matrix);
112 if (trackExtra_orig.
isNull()) {
125 TEcol.push_back(
reco::TrackExtra (trackExtra_orig->outerPosition(), trackExtra_orig->outerMomentum(),
true,
126 trackExtra_orig->innerPosition(), trackExtra_orig->innerMomentum(),
true,
127 outerCov, trackExtra_orig->outerDetId(),
128 innerCov, trackExtra_orig->innerDetId(),
129 trackExtra_orig->seedDirection()));
135 return &(TEcol.back());
146 auto const firstHitIndex =
theRHi;
185 auto Toutput = std::make_unique<reco::TrackCollection>();
186 auto TRHoutput = std::make_unique<TrackingRecHitCollection>();
187 auto TEoutput = std::make_unique<reco::TrackExtraCollection>();
195 for(
unsigned int it=0;it!=tracks->size();it++)
197 const reco::Track & recotrack_orig = (*tracks)[it];
208 Toutput->push_back(recotrack);
220 if (!
attachRecHits(recotrack_orig,recotrackref,*extra,*TRHoutput, ttopo)){
225 TEoutput->pop_back();
231 LogDebug(
theCategory)<<
"writing: "<<Toutput->size()<<
" corrected reco::Track to the event.";
void produce(edm::Event &, const edm::EventSetup &) override
T getParameter(std::string const &) const
const Point & referencePoint() const
Reference point on the track.
void beginJob() override
framework method
edm::RefProd< reco::TrackExtraCollection > theRefprodTE
get reference before put track extra to the event, in order to create edm::Ref
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
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
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
bool attachRecHits(const reco::Track &recotrack_orig, reco::Track &recotrack, reco::TrackExtra &trackextra, TrackingRecHitCollection &RHcol, const TrackerTopology &ttopo)
attached rechits to the newly created reco::Track and reco::TrackExtra
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
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
~MuonErrorMatrixAdjuster() override
destructor
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
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
bool selectTrack(const reco::Track &recotrack_orig)
make a selection on the reco:Track. (dummy for the moment)
bool appendHitPattern(const TrackingRecHit &hit, const TrackerTopology &ttopo)
append a single hit to the HitPattern
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
int charge() const
track electric charge
T const * product() const
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.