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::momentumVector
AlgebraicVectorM momentumVector() const override
Definition: MultiRefittedTS.cc:81
TrajectoryStateOnSurface.h
RefittedTrackState< 5 >::AlgebraicVectorM
ROOT::Math::SVector< double, N - 2 > AlgebraicVectorM
Definition: RefittedTrackState.h:25
TrajectoryStateOnSurface::freeTrajectoryState
FreeTrajectoryState const * freeTrajectoryState(bool withErrors=true) const
Definition: TrajectoryStateOnSurface.h:60
RefittedTrackState< 5 >::AlgebraicSymMatrixNN
ROOT::Math::SMatrix< double, N, N, ROOT::Math::MatRepSym< double, N > > AlgebraicSymMatrixNN
Definition: RefittedTrackState.h:28
FreeTrajectoryState.h
funct::false
false
Definition: Factorize.h:29
MultiRefittedTS::RTSvector
std::vector< RefCountedRefittedTrackState > RTSvector
Definition: MultiRefittedTS.h:109
VertexException
Common base class.
Definition: VertexException.h:12
BasicMultiTrajectoryState
Definition: BasicMultiTrajectoryState.h:17
MultiRefittedTS::weight
double weight() const override
Definition: MultiRefittedTS.cc:85
gather_cfg.cout
cout
Definition: gather_cfg.py:144
MultiRefittedTS::fts
FreeTrajectoryState fts
Definition: MultiRefittedTS.h:114
MultiRefittedTS::theComponents
RTSvector theComponents
Definition: MultiRefittedTS.h:111
Surface
Definition: Surface.h:36
ReferenceCountingPointer
Definition: ReferenceCounted.h:60
TransverseImpactPointExtrapolator
Definition: TransverseImpactPointExtrapolator.h:26
MultiRefittedTS.h
Propagator
Definition: Propagator.h:44
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
TransientTrackFromFTSFactory.h
TrackCandidateProducer_cfi.propagator
propagator
Definition: TrackCandidateProducer_cfi.py:17
DQMScaleToClient_cfi.factor
factor
Definition: DQMScaleToClient_cfi.py:8
Point3DBase< float, GlobalTag >
MultiRefittedTS::parameters
AlgebraicVectorN parameters() const override
Definition: MultiRefittedTS.cc:56
MultiRefittedTS::transientTrack
reco::TransientTrack transientTrack() const override
Definition: MultiRefittedTS.cc:140
MultiRefittedTS::covariance
AlgebraicSymMatrixNN covariance() const override
Definition: MultiRefittedTS.cc:64
MultiRefittedTS::freeTrajectoryState
FreeTrajectoryState freeTrajectoryState() const override
Definition: MultiRefittedTS.cc:23
MultiRefittedTS::surf
const bool surf
Definition: MultiRefittedTS.h:117
funct::true
true
Definition: Factorize.h:173
TransientTrackFromFTSFactory::build
reco::TransientTrack build(const FreeTrajectoryState &fts) const
Definition: TransientTrackFromFTSFactory.cc:7
MultiRefittedTS::totalWeight
double totalWeight
Definition: MultiRefittedTS.h:113
RefittedTrackState< 5 >::AlgebraicVectorN
ROOT::Math::SVector< double, N > AlgebraicVectorN
Definition: RefittedTrackState.h:24
MultiRefittedTS::position
GlobalPoint position() const override
Definition: MultiRefittedTS.cc:72
BasicTrajectoryState
Definition: BasicTrajectoryState.h:66
MultiRefittedTS::refPosition
const GlobalPoint refPosition
Definition: MultiRefittedTS.h:115
std
Definition: JetResolutionObject.h:76
reco::TransientTrack
Definition: TransientTrack.h:19
FreeTrajectoryState
Definition: FreeTrajectoryState.h:27
MultiRefittedTS::computeFreeTrajectoryState
void computeFreeTrajectoryState() const
Definition: MultiRefittedTS.cc:29
MultiRefittedTS::refSurface
ConstReferenceCountingPointer< Surface > refSurface
Definition: MultiRefittedTS.h:116
TransverseImpactPointExtrapolator.h
MultiRefittedTS::stateWithNewWeight
ReferenceCountingPointer< RefittedTrackState< 5 > > stateWithNewWeight(const double newWeight) const override
Definition: MultiRefittedTS.cc:98
TransientTrackFromFTSFactory
Definition: TransientTrackFromFTSFactory.h:10
TransverseImpactPointExtrapolator::extrapolate
TrajectoryStateOnSurface extrapolate(const FreeTrajectoryState &fts, const GlobalPoint &vtx) const
extrapolation with default (=geometrical) propagator
Definition: TransverseImpactPointExtrapolator.cc:23
VertexException.h
TrajectoryStateOnSurface::surface
const SurfaceType & surface() const
Definition: TrajectoryStateOnSurface.h:78
MultiRefittedTS::RefCountedRefittedTrackState
ReferenceCountingPointer< RefittedTrackState< 5 > > RefCountedRefittedTrackState
Definition: MultiRefittedTS.h:19
BasicMultiTrajectoryState.h
MultiRefittedTS::trajectoryStateOnSurface
TrajectoryStateOnSurface trajectoryStateOnSurface(const Surface &surface) const override
Definition: MultiRefittedTS.cc:121
MultiRefittedTS::totalWeightAvailable
bool totalWeightAvailable
Definition: MultiRefittedTS.h:112
MultiRefittedTS::MultiRefittedTS
MultiRefittedTS(const std::vector< RefCountedRefittedTrackState > &prtsComp, const Surface &referenceSurface)
Definition: MultiRefittedTS.cc:11
MultiRefittedTS::ftsAvailable
bool ftsAvailable
Definition: MultiRefittedTS.h:112