CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
PFGsfHelper Class Reference

#include <PFGsfHelper.h>

Public Member Functions

GlobalVector computeP (bool ComputeMode) const
 
double fittedDP () const
 
bool isValid () const
 
 PFGsfHelper (const TrajectoryMeasurement &)
 
double sigmafittedDP () const
 
 ~PFGsfHelper ()
 

Private Member Functions

void computeQpMode (const TrajectoryStateOnSurface tsos, AlgebraicVector5 &parameters, AlgebraicSymMatrix55 &covariance) const
 

Private Attributes

double dp
 
float mode_Px
 
float mode_Py
 
float mode_Pz
 
double sigmaDp
 
TrajectoryStateOnSurface theBackwardState
 
TrajectoryStateOnSurface theForwardState
 
TrajectoryStateOnSurface theUpdateState
 
bool Valid
 

Detailed Description

Definition at line 29 of file PFGsfHelper.h.

Constructor & Destructor Documentation

◆ PFGsfHelper()

PFGsfHelper::PFGsfHelper ( const TrajectoryMeasurement tm)

Definition at line 32 of file PFGsfHelper.cc.

32  {
33  /* LogInfo("PFGsfHelper")<<" PFGsfHelper built"; */
34 
35  // TrajectoryStateOnSurface theUpdateState = tm.forwardPredictedState();
39 
40  Valid = true;
42  Valid = false;
43 
44  if (Valid) {
45  mode_Px = 0.;
46  mode_Py = 0.;
47  mode_Pz = 0.;
49  auto const& components = comps();
50  auto numb = components.size();
51  std::vector<SingleGaussianState1D> pxStates;
52  pxStates.reserve(numb);
53  std::vector<SingleGaussianState1D> pyStates;
54  pyStates.reserve(numb);
55  std::vector<SingleGaussianState1D> pzStates;
56  pzStates.reserve(numb);
57  for (auto ic = components.begin(); ic != components.end(); ++ic) {
58  GlobalVector momentum(ic->globalMomentum());
59  AlgebraicSymMatrix66 cov(ic->cartesianError().matrix());
60  pxStates.push_back(SingleGaussianState1D(momentum.x(), cov(3, 3), ic->weight()));
61  pyStates.push_back(SingleGaussianState1D(momentum.y(), cov(4, 4), ic->weight()));
62  pzStates.push_back(SingleGaussianState1D(momentum.z(), cov(5, 5), ic->weight()));
63  // cout<<"COMP "<<momentum<<endl;
64  }
65  MultiGaussianState1D pxState(pxStates);
66  MultiGaussianState1D pyState(pyStates);
67  MultiGaussianState1D pzState(pzStates);
68  GaussianSumUtilities1D pxUtils(pxState);
69  GaussianSumUtilities1D pyUtils(pyState);
70  GaussianSumUtilities1D pzUtils(pzState);
71  mode_Px = pxUtils.mode().mean();
72  mode_Py = pyUtils.mode().mean();
73  mode_Pz = pzUtils.mode().mean();
74 
75  dp = 0.;
76  sigmaDp = 0.;
77 
78  //
79  // prepare input parameter vectors and covariance matrices
80  //
81 
84  computeQpMode(theForwardState, fwdPars, fwdCov);
87  computeQpMode(theBackwardState, bwdPars, bwdCov);
88  LocalPoint hitPos(0., 0., 0.);
89  LocalError hitErr(-1., -1., -1.);
90  if (tm.recHit()->isValid()) {
91  hitPos = tm.recHit()->localPosition();
92  hitErr = tm.recHit()->localPositionError();
93  }
94 
95  CollinearFitAtTM collinearFit;
97  CollinearFitAtTM::ResultMatrix fitCovariance;
98  double fitChi2;
99  bool CollFit = true;
100  if (!collinearFit.fit(fwdPars, fwdCov, bwdPars, bwdCov, hitPos, hitErr, fitParameters, fitCovariance, fitChi2))
101  CollFit = false;
102 
103  if (CollFit) {
104  double qpIn = fitParameters(0);
105  double sig2In = fitCovariance(0, 0);
106  double qpOut = fitParameters(1);
107  double sig2Out = fitCovariance(1, 1);
108  double corrInOut = fitCovariance(0, 1);
109  double pIn = 1. / fabs(qpIn);
110  double pOut = 1. / fabs(qpOut);
111  double sig2DeltaP = pIn / qpIn * pIn / qpIn * sig2In - 2 * pIn / qpIn * pOut / qpOut * corrInOut +
112  pOut / qpOut * pOut / qpOut * sig2Out;
113  // std::cout << "fitted delta p = " << pOut-pIn << " sigma = "
114  // << sqrt(sig2DeltaP) << std::endl;
115  dp = pOut - pIn;
116  sigmaDp = sqrt(sig2DeltaP);
117  }
118  }
119 }

References TrajectoryMeasurement::backwardPredictedState(), makeMuonMisalignmentScenario::components, Calorimetry_cff::dp, CollinearFitAtTM::fit(), fitChi2(), L1TRate_cfi::fitParameters, TrajectoryMeasurement::forwardPredictedState(), SingleGaussianState1D::mean(), GaussianSumUtilities1D::mode(), L1TrackObjectNtupleMaker_cfg::pOut, TrajectoryMeasurement::recHit(), mathSSE::sqrt(), and TrajectoryMeasurement::updatedState().

◆ ~PFGsfHelper()

PFGsfHelper::~PFGsfHelper ( )

Definition at line 121 of file PFGsfHelper.cc.

121 {}

Member Function Documentation

◆ computeP()

GlobalVector PFGsfHelper::computeP ( bool  ComputeMode) const

Definition at line 122 of file PFGsfHelper.cc.

122  {
123  GlobalVector gsfp;
124  if (ComputeMode)
126  else
128  return gsfp;
129 }

Referenced by PFTrackTransformer::addPointsAndBrems().

◆ computeQpMode()

void PFGsfHelper::computeQpMode ( const TrajectoryStateOnSurface  tsos,
AlgebraicVector5 parameters,
AlgebraicSymMatrix55 covariance 
) const
private

Definition at line 134 of file PFGsfHelper.cc.

136  {
137  //
138  // parameters and errors from combined state
139  //
140  parameters = tsos.localParameters().vector();
141  covariance = tsos.localError().matrix();
142  //
143  // mode for parameter 0 (q/p)
144  //
146  GaussianSumUtilities1D qpGS(qpState);
147  if (!qpGS.modeIsValid())
148  return;
149  double qp = qpGS.mode().mean();
150  double varQp = qpGS.mode().variance();
151  //
152  // replace q/p value and variance, rescale correlation terms
153  // (heuristic procedure - alternative would be mode in 5D ...)
154  //
155  double VarQpRatio = sqrt(varQp / covariance(0, 0));
156  parameters(0) = qp;
157  covariance(0, 0) = varQp;
158  for (int i = 1; i < 5; ++i)
159  covariance(i, 0) *= VarQpRatio;
160  // std::cout << "covariance " << VarQpRatio << " "
161  // << covariance(1,0) << " " << covariance(0,1) << std::endl;
162 }

References mps_fire::i, TrajectoryStateOnSurface::localError(), TrajectoryStateOnSurface::localParameters(), LocalTrajectoryError::matrix(), SingleGaussianState1D::mean(), GaussianSumUtilities1D::mode(), GaussianSumUtilities1D::modeIsValid(), MultiGaussianStateTransform::multiState1D(), mathSSE::sqrt(), SingleGaussianState1D::variance(), and LocalTrajectoryParameters::vector().

◆ fittedDP()

double PFGsfHelper::fittedDP ( ) const

Definition at line 130 of file PFGsfHelper.cc.

130 { return dp; }

References Calorimetry_cff::dp.

Referenced by PFTrackTransformer::addPointsAndBrems().

◆ isValid()

bool PFGsfHelper::isValid ( void  ) const

Definition at line 132 of file PFGsfHelper.cc.

132 { return Valid; }

Referenced by ntupleDataFormat._Object::_checkIsValid(), and core.AutoHandle.AutoHandle::ReallyLoad().

◆ sigmafittedDP()

double PFGsfHelper::sigmafittedDP ( ) const

Definition at line 131 of file PFGsfHelper.cc.

131 { return sigmaDp; }

Referenced by PFTrackTransformer::addPointsAndBrems().

Member Data Documentation

◆ dp

double PFGsfHelper::dp
private

Definition at line 48 of file PFGsfHelper.h.

◆ mode_Px

float PFGsfHelper::mode_Px
private

Definition at line 44 of file PFGsfHelper.h.

◆ mode_Py

float PFGsfHelper::mode_Py
private

Definition at line 45 of file PFGsfHelper.h.

◆ mode_Pz

float PFGsfHelper::mode_Pz
private

Definition at line 46 of file PFGsfHelper.h.

◆ sigmaDp

double PFGsfHelper::sigmaDp
private

Definition at line 49 of file PFGsfHelper.h.

◆ theBackwardState

TrajectoryStateOnSurface PFGsfHelper::theBackwardState
private

Definition at line 52 of file PFGsfHelper.h.

◆ theForwardState

TrajectoryStateOnSurface PFGsfHelper::theForwardState
private

Definition at line 51 of file PFGsfHelper.h.

◆ theUpdateState

TrajectoryStateOnSurface PFGsfHelper::theUpdateState
private

Definition at line 50 of file PFGsfHelper.h.

◆ Valid

bool PFGsfHelper::Valid
private

Definition at line 47 of file PFGsfHelper.h.

Vector3DBase
Definition: Vector3DBase.h:8
CollinearFitAtTM
Definition: CollinearFitAtTM.h:17
BeamSpotPI::parameters
parameters
Definition: BeamSpotPayloadInspectorHelper.h:30
mps_fire.i
i
Definition: mps_fire.py:428
L1TrackObjectNtupleMaker_cfg.pOut
pOut
Definition: L1TrackObjectNtupleMaker_cfg.py:172
TrajectoryMeasurement::updatedState
TrajectoryStateOnSurface const & updatedState() const
Definition: TrajectoryMeasurement.h:184
LocalTrajectoryError::matrix
const AlgebraicSymMatrix55 & matrix() const
Definition: LocalTrajectoryError.h:60
GlobalVector
Global3DVector GlobalVector
Definition: GlobalVector.h:10
PFGsfHelper::sigmaDp
double sigmaDp
Definition: PFGsfHelper.h:49
PFGsfHelper::computeQpMode
void computeQpMode(const TrajectoryStateOnSurface tsos, AlgebraicVector5 &parameters, AlgebraicSymMatrix55 &covariance) const
Definition: PFGsfHelper.cc:134
GetComponents
Definition: GetComponents.h:4
TrajectoryMeasurement::backwardPredictedState
TrajectoryStateOnSurface const & backwardPredictedState() const
Access to backward predicted state (from smoother)
Definition: TrajectoryMeasurement.h:179
TrajectoryMeasurement::forwardPredictedState
TrajectoryStateOnSurface const & forwardPredictedState() const
Access to forward predicted state (from fitter or builder)
Definition: TrajectoryMeasurement.h:177
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
AlgebraicSymMatrix66
ROOT::Math::SMatrix< double, 6, 6, ROOT::Math::MatRepSym< double, 6 > > AlgebraicSymMatrix66
Definition: AlgebraicROOTObjects.h:24
MultiGaussianState1D
Definition: MultiGaussianState1D.h:12
LocalTrajectoryParameters::vector
AlgebraicVector5 vector() const
Definition: LocalTrajectoryParameters.h:120
Point3DBase< float, LocalTag >
TrajectoryStateOnSurface::localParameters
const LocalTrajectoryParameters & localParameters() const
Definition: TrajectoryStateOnSurface.h:73
LocalError
Definition: LocalError.h:12
SingleGaussianState1D
Definition: SingleGaussianState1D.h:10
CollinearFitAtTM::ResultMatrix
ROOT::Math::SMatrix< double, 6, 6, ROOT::Math::MatRepSym< double, 6 > > ResultMatrix
Definition: CollinearFitAtTM.h:25
AlgebraicVector5
ROOT::Math::SVector< double, 5 > AlgebraicVector5
Definition: AlgebraicROOTObjects.h:14
TrajectoryMeasurement::recHit
ConstRecHitPointer const & recHit() const
Definition: TrajectoryMeasurement.h:190
PFGsfHelper::mode_Pz
float mode_Pz
Definition: PFGsfHelper.h:46
TrajectoryStateOnSurface::globalMomentum
GlobalVector globalMomentum() const
Definition: TrajectoryStateOnSurface.h:66
PFGsfHelper::theForwardState
TrajectoryStateOnSurface theForwardState
Definition: PFGsfHelper.h:51
PFGsfHelper::mode_Py
float mode_Py
Definition: PFGsfHelper.h:45
makeMuonMisalignmentScenario.components
string components
Definition: makeMuonMisalignmentScenario.py:58
PFGsfHelper::mode_Px
float mode_Px
Definition: PFGsfHelper.h:44
GaussianSumUtilities1D
Definition: GaussianSumUtilities1D.h:16
CollinearFitAtTM::fit
bool fit(const TrajectoryMeasurement &tm, ResultVector &parameters, ResultMatrix &covariance, double &chi2)
Fit for one TM. Return value "true" for success.
Definition: CollinearFitAtTM.cc:19
PFGsfHelper::theUpdateState
TrajectoryStateOnSurface theUpdateState
Definition: PFGsfHelper.h:50
PFGsfHelper::dp
double dp
Definition: PFGsfHelper.h:48
fitChi2
static double fitChi2(const CachingVertex< 5 > &vtx)
Definition: GhostTrackVertexFinder.cc:638
MultiGaussianStateTransform::multiState1D
MultiGaussianState1D multiState1D(const std::vector< MultiGaussianState< N >::Vector > &, const std::vector< MultiGaussianState< N >::Matrix > &, const std::vector< double > &, unsigned int)
Definition: MultiGaussianStateTransform.cc:54
L1TRate_cfi.fitParameters
fitParameters
Offline oracleDB = cms.string("oracle://cms_orcon_adg/CMS_COND_31X_L1T"), # For offline pathCondDB = ...
Definition: L1TRate_cfi.py:69
TrajectoryStateOnSurface::localError
const LocalTrajectoryError & localError() const
Definition: TrajectoryStateOnSurface.h:77
AlgebraicSymMatrix55
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
Definition: AlgebraicROOTObjects.h:23
CollinearFitAtTM::ResultVector
ROOT::Math::SVector< double, 6 > ResultVector
Definition: CollinearFitAtTM.h:24
TrajectoryStateOnSurface::isValid
bool isValid() const
Definition: TrajectoryStateOnSurface.h:54
PFGsfHelper::theBackwardState
TrajectoryStateOnSurface theBackwardState
Definition: PFGsfHelper.h:52
PFGsfHelper::Valid
bool Valid
Definition: PFGsfHelper.h:47