CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MultiRefittedTS.cc
Go to the documentation of this file.
8 #include <cfloat>
9 using namespace std;
10 
11 
12 MultiRefittedTS::MultiRefittedTS(const std::vector<RefCountedRefittedTrackState> & prtsComp,
13  const Surface & referenceSurface) :
14  theComponents(prtsComp), ftsAvailable(false), refSurface(&referenceSurface),
15  surf(true) {}
16 
17 
18 MultiRefittedTS::MultiRefittedTS(const std::vector<RefCountedRefittedTrackState> & prtsComp,
19  const GlobalPoint & referencePosition) :
20  theComponents(prtsComp), ftsAvailable(false), refPosition(referencePosition),
21  surf(false) {}
22 
28 {
30  return fts;
31 }
32 
34 {
35  if (surf) {
37  } else {
38  double maxWeight = -1.;
39  RTSvector::const_iterator maxIt;
40  for (RTSvector::const_iterator it = theComponents.begin();
41  it != theComponents.end(); it++) {
42  if ( (**it).weight() > maxWeight ) {
43  maxWeight = (**it).weight();
44  maxIt = it;
45  }
46  }
47 
48  TransverseImpactPointExtrapolator tipe(&((**maxIt).freeTrajectoryState().parameters().magneticField()));
49  TrajectoryStateOnSurface initialTSOS = tipe.extrapolate((**maxIt).freeTrajectoryState(), refPosition);
50 
52  }
53  ftsAvailable = true;
54 }
55 
63 {
64  throw VertexException
65  ("MultiRefittedTS::freeTrajectoryState(): Don't know how to do that yet...");
66 }
67 
73 {
74  throw VertexException
75  ("MultiRefittedTS::freeTrajectoryState(): Don't know how to do that yet...");
76 }
77 
83 {
84  throw VertexException
85  ("MultiRefittedTS::freeTrajectoryState(): Don't know how to do that yet...");
86 }
87 
94 {
95  throw VertexException
96  ("MultiRefittedTS::freeTrajectoryState(): Don't know how to do that yet...");
97 }
98 
100 {
102  {
103  totalWeight = 0.;
104  if (theComponents.empty()) {
105  cout << "Asking for weight of empty MultiRefittedTS, returning zero!" << endl;
106  }
107  for (RTSvector::const_iterator it = theComponents.begin();
108  it != theComponents.end(); it++) {
109  totalWeight += (**it).weight();
110  }
111  }
112  return totalWeight;
113 }
114 
115 
117 MultiRefittedTS::stateWithNewWeight(const double newWeight) const
118 {
119  if (weight() < DBL_MIN) {
120  throw VertexException
121  ("MultiRefittedTS::stateWithNewWeight(): Can not reweight multi-state with total weight < DBL_MIN");
122  }
123  double factor = newWeight/weight();
124 
125  RTSvector reWeightedRTSC;
126  reWeightedRTSC.reserve(theComponents.size());
127 
128  for (RTSvector::const_iterator it = theComponents.begin();
129  it != theComponents.end(); it++) {
130  reWeightedRTSC.push_back((**it).stateWithNewWeight((**it).weight()*factor));
131  }
132  if (surf) {
133  return RefCountedRefittedTrackState(new MultiRefittedTS(reWeightedRTSC, *refSurface));
134  } else {
135  return RefCountedRefittedTrackState(new MultiRefittedTS(reWeightedRTSC, refPosition));
136  }
137 }
138 
143  const Surface & surface) const
144 {
145  vector<TrajectoryStateOnSurface> tsosComponents;
146  tsosComponents.reserve(theComponents.size());
147  for (RTSvector::const_iterator it = theComponents.begin();
148  it != theComponents.end(); it++) {
149  tsosComponents.push_back((**it).trajectoryStateOnSurface(surface));
150  }
151  return TrajectoryStateOnSurface((BasicTrajectoryState*)new BasicMultiTrajectoryState(tsosComponents));
152 }
153 
155  const Surface & surface, const Propagator & propagator) const
156 { //fixme... is the propagation done correctly? Is there a gsf propagator?
157  vector<TrajectoryStateOnSurface> tsosComponents;
158  tsosComponents.reserve(theComponents.size());
159  for (RTSvector::const_iterator it = theComponents.begin();
160  it != theComponents.end(); it++) {
161  tsosComponents.push_back((**it).trajectoryStateOnSurface(surface, propagator));
162  }
163  return TrajectoryStateOnSurface((BasicTrajectoryState*)new BasicMultiTrajectoryState(tsosComponents));
164 }
165 
167 {
169  return factory.build(freeTrajectoryState());
170 }
virtual TrajectoryStateOnSurface trajectoryStateOnSurface(const Surface &surface) const
virtual AlgebraicVectorM momentumVector() const
MultiRefittedTS(const std::vector< RefCountedRefittedTrackState > &prtsComp, const Surface &referenceSurface)
virtual double weight() const
Common base class.
virtual AlgebraicSymMatrixNN covariance() const
void computeFreeTrajectoryState() const
FreeTrajectoryState fts
ReferenceCountingPointer< RefittedTrackState< 5 > > RefCountedRefittedTrackState
virtual AlgebraicVectorN parameters() const
virtual ReferenceCountingPointer< RefittedTrackState< 5 > > stateWithNewWeight(const double newWeight) const
ROOT::Math::SVector< double, N-2 > AlgebraicVectorM
const GlobalPoint refPosition
const SurfaceType & surface() const
ROOT::Math::SVector< double, N > AlgebraicVectorN
FreeTrajectoryState const * freeTrajectoryState(bool withErrors=true) const
virtual reco::TransientTrack transientTrack() const
ROOT::Math::SMatrix< double, N, N, ROOT::Math::MatRepSym< double, N > > AlgebraicSymMatrixNN
std::vector< RefCountedRefittedTrackState > RTSvector
reco::TransientTrack build(const FreeTrajectoryState &fts) const
TrajectoryStateOnSurface extrapolate(const FreeTrajectoryState &fts, const GlobalPoint &vtx) const
extrapolation with default (=geometrical) propagator
tuple cout
Definition: gather_cfg.py:121
volatile std::atomic< bool > shutdown_flag false
virtual FreeTrajectoryState freeTrajectoryState() const
virtual GlobalPoint position() const
RTSvector theComponents
ConstReferenceCountingPointer< Surface > refSurface