14 throw cms::Exception(
"LogicError") <<
"MultiTrajectoryState constructed on cylinder";
16 for (
auto i=tsvec.begin();
i!=tsvec.end();
i++) {
18 throw cms::Exception(
"LogicError") <<
"MultiTrajectoryState constructed with invalid state";
20 if UNLIKELY(
i->hasError() != tsvec.front().hasError()) {
21 throw cms::Exception(
"LogicError") <<
"MultiTrajectoryState mixes states with and without errors";
23 if UNLIKELY( &
i->surface() != &tsvec.front().surface()) {
24 throw cms::Exception(
"LogicError") <<
"MultiTrajectoryState mixes states with different surfaces";
26 if UNLIKELY(
i->surfaceSide() != tsvec.front().surfaceSide()) {
28 <<
"MultiTrajectoryState mixes states defined before and after material";
30 if UNLIKELY(
i->localParameters().pzSign()*tsvec.front().localParameters().pzSign()<0. ) {
32 <<
"MultiTrajectoryState mixes states with different signs of local p_z";
45 edm::LogError(
"BasicMultiTrajectoryState") <<
"Trying to rescale errors of empty MultiTrajectoryState!";
49 for (
auto & is :
theStates) is.rescaleError(factor);
55 const std::vector<TrajectoryStateOnSurface>& tsos =
theStates;
59 <<
"Trying to collapse empty set of trajectory states!";
63 double pzSign = tsos.front().localParameters().pzSign();
64 for (std::vector<TrajectoryStateOnSurface>::const_iterator it = tsos.begin();
65 it != tsos.end(); it++) {
66 if UNLIKELY(it->localParameters().pzSign() != pzSign) {
68 <<
"Trying to collapse trajectory states with different signs on p_z!";
75 tsos.front().localParameters(),
76 tsos.front().localError(),
77 tsos.front().surface(),
78 tsos.front().magneticField(),
79 tsos.front().surfaceSide()
88 for (
auto it1 = tsos.begin(); it1 != tsos.end(); it1++) {
89 auto weight = it1->weight();
90 auto const & param = it1->localParameters().vector();
93 covarPart1 +=
weight * it1->localError().matrix();
94 for (
auto it2 = it1 + 1; it2 != tsos.end(); it2++) {
96 ROOT::Math::AssignSym::Evaluate(covtmp,ROOT::Math::TensorProd(diff,diff));
97 covarPart2 += (
weight * it2->weight()) * covtmp;
100 double sumwI = 1.0/sumw;
102 covarPart1 *= sumwI; covarPart2 *= (sumwI*sumwI);
108 tsos.front().surface(),
109 tsos.front().magneticField(),
110 tsos.front().surfaceSide()
122 "BasicMultiTrajectoryState::update(LocalTrajectoryParameters, Surface, ...) called even if canUpdateLocalParameters() is false");
135 "BasicMultiTrajectoryState::update(LocalTrajectoryParameters, LocalTrajectoryError, ...) called even if canUpdateLocalParameters() is false");
virtual void update(const LocalTrajectoryParameters &p, const SurfaceType &aSurface, const MagneticField *field, const SurfaceSide side)
void update(const LocalTrajectoryParameters &p, const Surface &aSurface, const MagneticField *field, const SurfaceSide side) override
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
BasicMultiTrajectoryState()
void rescaleError(double factor)
ROOT::Math::SVector< double, 5 > AlgebraicVector5