11 const BoundPlane* bp = dynamic_cast<const BoundPlane*>(&tsvec.begin()->surface());
13 throw cms::Exception(
"LogicError") <<
"MultiTrajectoryState constructed on cylinder";
15 for (
auto i = tsvec.begin();
i != tsvec.end();
i++) {
17 throw cms::Exception(
"LogicError") <<
"MultiTrajectoryState constructed with invalid state";
19 if UNLIKELY (
i->hasError() != tsvec.front().hasError()) {
20 throw cms::Exception(
"LogicError") <<
"MultiTrajectoryState mixes states with and without errors";
22 if UNLIKELY (&
i->surface() != &tsvec.front().surface()) {
23 throw cms::Exception(
"LogicError") <<
"MultiTrajectoryState mixes states with different surfaces";
25 if UNLIKELY (
i->surfaceSide() != tsvec.front().surfaceSide()) {
26 throw cms::Exception(
"LogicError") <<
"MultiTrajectoryState mixes states defined before and after material";
28 if UNLIKELY (
i->localParameters().pzSign() * tsvec.front().localParameters().pzSign() < 0.) {
29 throw cms::Exception(
"LogicError") <<
"MultiTrajectoryState mixes states with different signs of local p_z";
38 edm::LogError(
"BasicMultiTrajectoryState") <<
"Trying to rescale errors of empty MultiTrajectoryState!";
48 const std::vector<TrajectoryStateOnSurface>& tsos =
theStates;
51 edm::LogError(
"MultiTrajectoryStateCombiner") <<
"Trying to collapse empty set of trajectory states!";
55 double pzSign = tsos.front().localParameters().pzSign();
56 for (std::vector<TrajectoryStateOnSurface>::const_iterator it = tsos.begin(); it != tsos.end(); it++) {
57 if UNLIKELY (it->localParameters().pzSign() != pzSign) {
59 <<
"Trying to collapse trajectory states with different signs on p_z!";
66 tsos.front().localParameters(),
67 tsos.front().localError(),
68 tsos.front().surface(),
69 tsos.front().magneticField(),
70 tsos.front().surfaceSide());
78 for (
auto it1 = tsos.begin(); it1 != tsos.end(); it1++) {
79 auto weight = it1->weight();
80 auto const& param = it1->localParameters().vector();
83 covarPart1 +=
weight * it1->localError().matrix();
84 for (
auto it2 = it1 + 1; it2 != tsos.end(); it2++) {
86 ROOT::Math::AssignSym::Evaluate(covtmp, ROOT::Math::TensorProd(
diff,
diff));
87 covarPart2 += (
weight * it2->weight()) * covtmp;
90 double sumwI = 1.0 / sumw;
93 covarPart2 *= (sumwI * sumwI);
99 tsos.front().surface(),
100 tsos.front().magneticField(),
101 tsos.front().surfaceSide());
109 "BasicMultiTrajectoryState::update(LocalTrajectoryParameters, Surface, ...) called even if "
110 "canUpdateLocalParameters() is false");
120 "BasicMultiTrajectoryState::update(LocalTrajectoryParameters, LocalTrajectoryError, ...) called "
121 "even if canUpdateLocalParameters() is false");