24 produces<TrackingRecHitCollection>();
25 produces<reco::TrackExtraCollection>();
50 multiply(revised_matrix, error_matrix);
52 return revised_matrix;
60 for (
int i = 0;
i != 5;
i++) {
61 for (
int j =
i;
j != 5;
j++) {
62 revised_matrix(
i,
j) *= scale_matrix(
i,
j);
71 for (
int i = 0;
i != 5;
i++) {
72 for (
int j =
i;
j != 5;
j++) {
73 if (denom_matrix(
i,
j) == 0)
75 num_matrix(
i,
j) /= denom_matrix(
i,
j);
92 LogDebug(
theCategory) <<
"chi2: " << chi2 <<
"\n ndof: " << ndof <<
"\n refpos: " << refpos <<
"\n mom: " << mom
93 <<
"\n charge: " << charge <<
"\n covariance:\n" 94 << recotrack_orig.
covariance() <<
"\n replaced by:\n" 97 return reco::Track(chi2, ndof, refpos, mom, charge, covariance_matrix);
111 if (trackExtra_orig.
isNull()) {
126 trackExtra_orig->outerMomentum(),
128 trackExtra_orig->innerPosition(),
129 trackExtra_orig->innerMomentum(),
132 trackExtra_orig->outerDetId(),
134 trackExtra_orig->innerDetId(),
135 trackExtra_orig->seedDirection()));
141 return &(TEcol.back());
151 auto const firstHitIndex =
theRHi;
178 LogDebug(
theCategory) <<
"considering: " << tracks->size() <<
" uncorrected reco::Track from the event.(" 189 auto Toutput = std::make_unique<reco::TrackCollection>();
190 auto TRHoutput = std::make_unique<TrackingRecHitCollection>();
191 auto TEoutput = std::make_unique<reco::TrackExtraCollection>();
197 for (
unsigned int it = 0; it != tracks->size(); it++) {
212 Toutput->push_back(recotrack);
225 if (!
attachRecHits(recotrack_orig, recotrackref, *extra, *TRHoutput, ttopo)) {
230 TEoutput->pop_back();
237 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
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.