CMS 3D CMS Logo

MultiRefittedTS.cc
Go to the documentation of this file.
8 #include <cfloat>
9 using namespace std;
10 
11 MultiRefittedTS::MultiRefittedTS(const std::vector<RefCountedRefittedTrackState>& prtsComp,
12  const Surface& referenceSurface)
13  : theComponents(prtsComp), ftsAvailable(false), refSurface(&referenceSurface), surf(true) {}
14 
15 MultiRefittedTS::MultiRefittedTS(const std::vector<RefCountedRefittedTrackState>& prtsComp,
16  const GlobalPoint& referencePosition)
17  : theComponents(prtsComp), ftsAvailable(false), refPosition(referencePosition), surf(false) {}
18 
24  if (!ftsAvailable)
26  return fts;
27 }
28 
30  if (surf) {
32  } else {
33  double maxWeight = -1.;
34  RTSvector::const_iterator maxIt;
35  for (RTSvector::const_iterator it = theComponents.begin(); it != theComponents.end(); it++) {
36  if ((**it).weight() > maxWeight) {
37  maxWeight = (**it).weight();
38  maxIt = it;
39  }
40  }
41 
42  TransverseImpactPointExtrapolator tipe(&((**maxIt).freeTrajectoryState().parameters().magneticField()));
43  TrajectoryStateOnSurface initialTSOS = tipe.extrapolate((**maxIt).freeTrajectoryState(), refPosition);
44 
46  }
47  ftsAvailable = true;
48 }
49 
57  throw VertexException("MultiRefittedTS::freeTrajectoryState(): Don't know how to do that yet...");
58 }
59 
65  throw VertexException("MultiRefittedTS::freeTrajectoryState(): Don't know how to do that yet...");
66 }
67 
73  throw VertexException("MultiRefittedTS::freeTrajectoryState(): Don't know how to do that yet...");
74 }
75 
82  throw VertexException("MultiRefittedTS::freeTrajectoryState(): Don't know how to do that yet...");
83 }
84 
85 double MultiRefittedTS::weight() const {
86  if (!totalWeightAvailable) {
87  totalWeight = 0.;
88  if (theComponents.empty()) {
89  cout << "Asking for weight of empty MultiRefittedTS, returning zero!" << endl;
90  }
91  for (RTSvector::const_iterator it = theComponents.begin(); it != theComponents.end(); it++) {
92  totalWeight += (**it).weight();
93  }
94  }
95  return totalWeight;
96 }
97 
99  if (weight() < DBL_MIN) {
100  throw VertexException(
101  "MultiRefittedTS::stateWithNewWeight(): Can not reweight multi-state with total weight < DBL_MIN");
102  }
103  double factor = newWeight / weight();
104 
105  RTSvector reWeightedRTSC;
106  reWeightedRTSC.reserve(theComponents.size());
107 
108  for (RTSvector::const_iterator it = theComponents.begin(); it != theComponents.end(); it++) {
109  reWeightedRTSC.push_back((**it).stateWithNewWeight((**it).weight() * factor));
110  }
111  if (surf) {
112  return RefCountedRefittedTrackState(new MultiRefittedTS(reWeightedRTSC, *refSurface));
113  } else {
114  return RefCountedRefittedTrackState(new MultiRefittedTS(reWeightedRTSC, refPosition));
115  }
116 }
117 
122  vector<TrajectoryStateOnSurface> tsosComponents;
123  tsosComponents.reserve(theComponents.size());
124  for (RTSvector::const_iterator it = theComponents.begin(); it != theComponents.end(); it++) {
125  tsosComponents.push_back((**it).trajectoryStateOnSurface(surface));
126  }
128 }
129 
131  const { //fixme... is the propagation done correctly? Is there a gsf propagator?
132  vector<TrajectoryStateOnSurface> tsosComponents;
133  tsosComponents.reserve(theComponents.size());
134  for (RTSvector::const_iterator it = theComponents.begin(); it != theComponents.end(); it++) {
135  tsosComponents.push_back((**it).trajectoryStateOnSurface(surface, propagator));
136  }
138 }
139 
142  return factory.build(freeTrajectoryState());
143 }
MultiRefittedTS(const std::vector< RefCountedRefittedTrackState > &prtsComp, const Surface &referenceSurface)
Common base class.
ROOT::Math::SVector< double, N-2 > AlgebraicVectorM
ROOT::Math::SMatrix< double, N, N, ROOT::Math::MatRepSym< double, N > > AlgebraicSymMatrixNN
double weight() const override
void computeFreeTrajectoryState() const
FreeTrajectoryState fts
ReferenceCountingPointer< RefittedTrackState< 5 > > RefCountedRefittedTrackState
std::vector< RefCountedRefittedTrackState > RTSvector
AlgebraicVectorN parameters() const override
FreeTrajectoryState freeTrajectoryState() const override
TrajectoryStateOnSurface trajectoryStateOnSurface(const Surface &surface) const override
const GlobalPoint refPosition
const SurfaceType & surface() const
reco::TransientTrack transientTrack() const override
FreeTrajectoryState const * freeTrajectoryState(bool withErrors=true) const
ReferenceCountingPointer< RefittedTrackState< 5 > > stateWithNewWeight(const double newWeight) const override
reco::TransientTrack build(const FreeTrajectoryState &fts) const
AlgebraicVectorM momentumVector() const override
GlobalPoint position() const override
TrajectoryStateOnSurface extrapolate(const FreeTrajectoryState &fts, const GlobalPoint &vtx) const
extrapolation with default (=geometrical) propagator
ROOT::Math::SVector< double, N > AlgebraicVectorN
AlgebraicSymMatrixNN covariance() const override
RTSvector theComponents
ConstReferenceCountingPointer< Surface > refSurface