CMS 3D CMS Logo

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

#include <MuonUpdatorAtVertex.h>

Public Member Functions

 MuonUpdatorAtVertex (const edm::ParameterSet &pset, const MuonServiceProxy *service)
 Constructor. More...
 
std::pair< bool, FreeTrajectoryStatepropagate (const TrajectoryStateOnSurface &tsos, const reco::BeamSpot &beamSpot) const
 Propagate the state to the 2D-PCA. More...
 
std::pair< bool, FreeTrajectoryStatepropagate (const TrajectoryStateOnSurface &tsos) const __attribute__((deprecated))
 Propagate the state to the 2D-PCA (nominal CMS axis) - DEPRECATED -. More...
 
std::pair< bool, FreeTrajectoryStatepropagateToNominalLine (const TrajectoryStateOnSurface &tsos) const
 Propagate the state to the 2D-PCA (nominal CMS axis) More...
 
std::pair< bool, FreeTrajectoryStatepropagateWithUpdate (const TrajectoryStateOnSurface &tsos, const reco::BeamSpot &beamSpot) const
 Propagate to the 2D-PCA and apply the vertex constraint. More...
 
std::pair< bool, FreeTrajectoryStateupdate (const reco::TransientTrack &track, const reco::BeamSpot &beamSpot) const
 Applies the vertex constraint. More...
 
std::pair< bool, FreeTrajectoryStateupdate (const FreeTrajectoryState &ftsAtVtx, const reco::BeamSpot &beamSpot) const
 Applies the vertex constraint. More...
 
virtual ~MuonUpdatorAtVertex ()
 Destructor. More...
 

Private Attributes

double theChi2Cut
 
SingleTrackVertexConstraint theConstrictor
 
GlobalError thePositionErrors
 
std::string thePropagatorName
 
const MuonServiceProxytheService
 
TransientTrackFromFTSFactory theTransientTrackFactory
 

Detailed Description

This class do the extrapolation of a TrajectoryStateOnSurface to the PCA and can apply, with a different method, the vertex constraint. The vertex constraint is applyed using the Kalman Filter tools used for the vertex reconstruction.

For the time being the propagator is the SteppingHelixPropagator because the method propagate(TSOS,GlobalPoint) it is in its specific interface. Once the interface of the Propagator base class will be updated, then propagator will become generic.

For what concern the beam spot, it is possible set via cff the relevant parameters:

BeamSpotPosition[0] <=> x BeamSpotPosition[1] <=> y BeamSpotPosition[2] <=> z

BeamSpotPositionErrors[0] = sigma(x) BeamSpotPositionErrors[1] = sigma(y) BeamSpotPositionErrors[2] = sigma(z)

Author
R. Bellan - INFN Torino ricca.nosp@m.rdo..nosp@m.bella.nosp@m.n@ce.nosp@m.rn.ch

This class do the extrapolation of a TrajectoryStateOnSurface to the PCA and can apply, with a different method, the vertex constraint. The vertex constraint is applyed using the Kalman Filter tools used for the vertex reconstruction.

Author
R. Bellan - INFN Torino ricca.nosp@m.rdo..nosp@m.bella.nosp@m.n@ce.nosp@m.rn.ch

Definition at line 42 of file MuonUpdatorAtVertex.h.

Constructor & Destructor Documentation

◆ MuonUpdatorAtVertex()

MuonUpdatorAtVertex::MuonUpdatorAtVertex ( const edm::ParameterSet pset,
const MuonServiceProxy service 
)

Constructor.

Definition at line 28 of file MuonUpdatorAtVertex.cc.

References muonDTDigis_cfi::pset, theChi2Cut, thePositionErrors, and thePropagatorName.

29  : theService(service) {
30  thePropagatorName = pset.getParameter<string>("Propagator");
31 
32  // Errors on the Beam spot position
33  vector<double> errors = pset.getParameter<vector<double> >("BeamSpotPositionErrors");
34  if (errors.size() != 3)
35  edm::LogError("Muon|RecoMuon|MuonUpdatorAtVertex")
36  << "MuonUpdatorAtVertex::BeamSpotPositionErrors wrong number of parameters!!";
37 
38  // assume:
39  // errors[0] = sigma(x)
40  // errors[1] = sigma(y)
41  // errors[2] = sigma(z)
42 
44  mat(0, 0) = errors[0] * errors[0];
45  mat(1, 1) = errors[1] * errors[1];
46  mat(2, 2) = errors[2] * errors[2];
47  GlobalError glbErrPos(mat);
48 
49  thePositionErrors = glbErrPos;
50 
51  // cut on chi^2
52  theChi2Cut = pset.getParameter<double>("MaxChi2");
53 }
ROOT::Math::SMatrix< double, 3, 3, ROOT::Math::MatRepSym< double, 3 > > AlgebraicSymMatrix33
Definition: errors.py:1
const MuonServiceProxy * theService

◆ ~MuonUpdatorAtVertex()

MuonUpdatorAtVertex::~MuonUpdatorAtVertex ( )
virtual

Destructor.

Definition at line 56 of file MuonUpdatorAtVertex.cc.

56 {}

Member Function Documentation

◆ propagate() [1/2]

pair< bool, FreeTrajectoryState > MuonUpdatorAtVertex::propagate ( const TrajectoryStateOnSurface tsos,
const reco::BeamSpot beamSpot 
) const

Propagate the state to the 2D-PCA.

Propagate the state to the PCA in 2D, i.e. to the beam line.

Definition at line 61 of file MuonUpdatorAtVertex.cc.

References pwdgSkimBPark_cfi::beamSpot, TrajectoryStateOnSurface::freeState(), TrajectoryStateOnSurface::globalPosition(), TrackerBounds::isInside(), TrajectoryStateClosestToBeamLine::isValid(), LogTrace, metname, mps_fire::result, thePropagatorName, theService, and TrajectoryStateClosestToBeamLine::trackStateAtPCA().

Referenced by AlignmentMonitorTracksFromTrajectories::event(), and propagateWithUpdate().

62  {
63  const string metname = "Muon|RecoMuon|MuonUpdatorAtVertex";
64 
66  LogTrace(metname) << "Trajectory inside the Tracker";
67 
68  TSCBLBuilderNoMaterial tscblBuilder;
69  TrajectoryStateClosestToBeamLine tscbl = tscblBuilder(*(tsos.freeState()), beamSpot);
70 
71  if (tscbl.isValid())
72  return pair<bool, FreeTrajectoryState>(true, tscbl.trackStateAtPCA());
73  else
74  edm::LogWarning(metname) << "Propagation to the PCA using TSCPBuilderNoMaterial failed!"
75  << " This can cause a severe bug.";
76  } else {
77  LogTrace(metname) << "Trajectory inside the muon system";
78 
79  FreeTrajectoryState result = theService->propagator(thePropagatorName)->propagate(*tsos.freeState(), beamSpot);
80 
81  LogTrace(metname) << "MuonUpdatorAtVertex::propagate, path: " << result << " parameters: " << result.parameters();
82 
83  if (result.hasError())
84  return pair<bool, FreeTrajectoryState>(true, result);
85  else
86  edm::LogInfo(metname) << "Propagation to the PCA failed!";
87  }
88  return pair<bool, FreeTrajectoryState>(false, FreeTrajectoryState());
89 }
static bool isInside(const GlobalPoint &)
const std::string metname
#define LogTrace(id)
GlobalPoint globalPosition() const
Log< level::Info, false > LogInfo
FreeTrajectoryState const * freeState(bool withErrors=true) const
Log< level::Warning, false > LogWarning
const MuonServiceProxy * theService

◆ propagate() [2/2]

std::pair< bool, FreeTrajectoryState > MuonUpdatorAtVertex::propagate ( const TrajectoryStateOnSurface tsos) const

Propagate the state to the 2D-PCA (nominal CMS axis) - DEPRECATED -.

Definition at line 177 of file MuonUpdatorAtVertex.cc.

References propagateToNominalLine().

177  {
178  return propagateToNominalLine(tsos);
179 }
std::pair< bool, FreeTrajectoryState > propagateToNominalLine(const TrajectoryStateOnSurface &tsos) const
Propagate the state to the 2D-PCA (nominal CMS axis)

◆ propagateToNominalLine()

std::pair< bool, FreeTrajectoryState > MuonUpdatorAtVertex::propagateToNominalLine ( const TrajectoryStateOnSurface tsos) const

Propagate the state to the 2D-PCA (nominal CMS axis)

Definition at line 141 of file MuonUpdatorAtVertex.cc.

References TrajectoryStateOnSurface::freeState(), TrajectoryStateOnSurface::globalPosition(), TrackerBounds::isInside(), TrajectoryStateClosestToPoint::isValid(), LogTrace, metname, LaserDQM_cfg::p1, SiStripOfflineCRack_cfg::p2, mps_fire::result, thePropagatorName, theService, and TrajectoryStateClosestToPoint::theState().

Referenced by propagate().

142  {
143  const string metname = "Muon|RecoMuon|MuonUpdatorAtVertex";
144 
146  LogTrace(metname) << "Trajectory inside the Tracker";
147 
148  TSCPBuilderNoMaterial tscpBuilder;
149  TrajectoryStateClosestToPoint tscp = tscpBuilder(*(tsos.freeState()), GlobalPoint(0., 0., 0.));
150 
151  if (tscp.isValid())
152  return pair<bool, FreeTrajectoryState>(true, tscp.theState());
153  else
154  edm::LogWarning(metname) << "Propagation to the PCA using TSCPBuilderNoMaterial failed!"
155  << " This can cause a severe bug.";
156  } else {
157  LogTrace(metname) << "Trajectory inside the muon system";
158 
159  // Define a line using two 3D-points
160  GlobalPoint p1(0., 0., -1500);
161  GlobalPoint p2(0., 0., 1500);
162 
163  pair<FreeTrajectoryState, double> result =
164  theService->propagator(thePropagatorName)->propagateWithPath(*tsos.freeState(), p1, p2);
165 
166  LogTrace(metname) << "MuonUpdatorAtVertex::propagate, path: " << result.second
167  << " parameters: " << result.first.parameters();
168 
169  if (result.first.hasError())
170  return pair<bool, FreeTrajectoryState>(true, result.first);
171  else
172  edm::LogInfo(metname) << "Propagation to the PCA failed! Path: " << result.second;
173  }
174  return pair<bool, FreeTrajectoryState>(false, FreeTrajectoryState());
175 }
static bool isInside(const GlobalPoint &)
const std::string metname
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
#define LogTrace(id)
GlobalPoint globalPosition() const
Log< level::Info, false > LogInfo
const FreeTrajectoryState & theState() const
FreeTrajectoryState const * freeState(bool withErrors=true) const
Log< level::Warning, false > LogWarning
const MuonServiceProxy * theService

◆ propagateWithUpdate()

pair< bool, FreeTrajectoryState > MuonUpdatorAtVertex::propagateWithUpdate ( const TrajectoryStateOnSurface tsos,
const reco::BeamSpot beamSpot 
) const

Propagate to the 2D-PCA and apply the vertex constraint.

Definition at line 129 of file MuonUpdatorAtVertex.cc.

References pwdgSkimBPark_cfi::beamSpot, propagate(), and update().

Referenced by AlignmentMonitorTracksFromTrajectories::event().

130  {
131  pair<bool, FreeTrajectoryState> propagationResult = propagate(tsos, beamSpot);
132 
133  if (propagationResult.first) {
134  return update(propagationResult.second, beamSpot);
135  } else {
136  edm::LogInfo("Muon|RecoMuon|MuonUpdatorAtVertex") << "Constraint at vertex failed";
137  return pair<bool, FreeTrajectoryState>(false, FreeTrajectoryState());
138  }
139 }
std::pair< bool, FreeTrajectoryState > update(const reco::TransientTrack &track, const reco::BeamSpot &beamSpot) const
Applies the vertex constraint.
std::pair< bool, FreeTrajectoryState > propagate(const TrajectoryStateOnSurface &tsos, const reco::BeamSpot &beamSpot) const
Propagate the state to the 2D-PCA.
Log< level::Info, false > LogInfo

◆ update() [1/2]

pair< bool, FreeTrajectoryState > MuonUpdatorAtVertex::update ( const reco::TransientTrack track,
const reco::BeamSpot beamSpot 
) const

Applies the vertex constraint.

Definition at line 91 of file MuonUpdatorAtVertex.cc.

References pwdgSkimBPark_cfi::beamSpot, SingleTrackVertexConstraint::constrain(), MillePedeFileConverter_cfg::e, LogTrace, metname, mps_fire::result, AlCaHLTBitMon_QueryRunRegistry::string, theChi2Cut, theConstrictor, thePositionErrors, and HLT_2022v14_cff::track.

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), progressbar.ProgressBar::finish(), MatrixUtil.Steps::overwrite(), propagateWithUpdate(), and update().

92  {
93  const std::string metname = "Muon|RecoMuon|MuonUpdatorAtVertex";
94 
95  pair<bool, FreeTrajectoryState> result(false, FreeTrajectoryState());
96 
97  GlobalPoint spotPos(beamSpot.x0(), beamSpot.y0(), beamSpot.z0());
98 
99  SingleTrackVertexConstraint::BTFtuple constrainedTransientTrack;
100 
101  // Temporary hack here. A fix in the SingleTrackVertexConstraint code
102  // is needed. Once available try&catch will be removed
103  try {
104  constrainedTransientTrack = theConstrictor.constrain(track, spotPos, thePositionErrors);
105  } catch (cms::Exception &e) {
106  edm::LogWarning(metname) << "cms::Exception caught in MuonUpdatorAtVertex::update\n"
107  << "Exception from SingleTrackVertexConstraint\n"
108  << e.explainSelf();
109  return result;
110  }
111 
112  if (std::get<0>(constrainedTransientTrack))
113  if (std::get<2>(constrainedTransientTrack) <= theChi2Cut) {
114  result.first = true;
115  result.second = *std::get<1>(constrainedTransientTrack).impactPointState().freeState();
116  } else
117  LogTrace(metname) << "Constraint at vertex failed: too large chi2";
118  else
119  LogTrace(metname) << "Constraint at vertex failed";
120 
121  return result;
122 }
std::tuple< bool, reco::TransientTrack, float > BTFtuple
const std::string metname
#define LogTrace(id)
BTFtuple constrain(const reco::TransientTrack &track, const GlobalPoint &priorPos, const GlobalError &priorError) const
SingleTrackVertexConstraint theConstrictor
Log< level::Warning, false > LogWarning

◆ update() [2/2]

pair< bool, FreeTrajectoryState > MuonUpdatorAtVertex::update ( const FreeTrajectoryState ftsAtVtx,
const reco::BeamSpot beamSpot 
) const

Applies the vertex constraint.

Definition at line 124 of file MuonUpdatorAtVertex.cc.

References pwdgSkimBPark_cfi::beamSpot, TransientTrackFromFTSFactory::build(), theTransientTrackFactory, and update().

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), progressbar.ProgressBar::finish(), and MatrixUtil.Steps::overwrite().

125  {
126  return update(theTransientTrackFactory.build(ftsAtVtx), beamSpot);
127 }
reco::TransientTrack build(const FreeTrajectoryState &fts) const
std::pair< bool, FreeTrajectoryState > update(const reco::TransientTrack &track, const reco::BeamSpot &beamSpot) const
Applies the vertex constraint.
TransientTrackFromFTSFactory theTransientTrackFactory

Member Data Documentation

◆ theChi2Cut

double MuonUpdatorAtVertex::theChi2Cut
private

Definition at line 81 of file MuonUpdatorAtVertex.h.

Referenced by MuonUpdatorAtVertex(), and update().

◆ theConstrictor

SingleTrackVertexConstraint MuonUpdatorAtVertex::theConstrictor
private

Definition at line 80 of file MuonUpdatorAtVertex.h.

Referenced by update().

◆ thePositionErrors

GlobalError MuonUpdatorAtVertex::thePositionErrors
private

Definition at line 83 of file MuonUpdatorAtVertex.h.

Referenced by MuonUpdatorAtVertex(), and update().

◆ thePropagatorName

std::string MuonUpdatorAtVertex::thePropagatorName
private

Definition at line 77 of file MuonUpdatorAtVertex.h.

Referenced by MuonUpdatorAtVertex(), propagate(), and propagateToNominalLine().

◆ theService

const MuonServiceProxy* MuonUpdatorAtVertex::theService
private

Definition at line 76 of file MuonUpdatorAtVertex.h.

Referenced by propagate(), and propagateToNominalLine().

◆ theTransientTrackFactory

TransientTrackFromFTSFactory MuonUpdatorAtVertex::theTransientTrackFactory
private

Definition at line 79 of file MuonUpdatorAtVertex.h.

Referenced by update().