6 using namespace SurfaceSideDefinition;
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 (std::vector<TSOS>::iterator it =
theStates.begin(); it !=
theStates.end(); it++) {
50 it->rescaleError(factor);
57 const std::vector<TrajectoryStateOnSurface>& tsos =
theStates;
61 <<
"Trying to collapse empty set of trajectory states!";
65 double pzSign = tsos.front().localParameters().pzSign();
66 for (std::vector<TrajectoryStateOnSurface>::const_iterator it = tsos.begin();
67 it != tsos.end(); it++) {
68 if unlikely(it->localParameters().pzSign() != pzSign) {
70 <<
"Trying to collapse trajectory states with different signs on p_z!";
77 tsos.front().localParameters(),
78 tsos.front().localError(),
79 tsos.front().surface(),
80 tsos.front().magneticField(),
81 tsos.front().surfaceSide()
90 for (
auto it1 = tsos.begin(); it1 != tsos.end(); it1++) {
91 double weight = it1->weight();
94 mean += weight * param;
95 covarPart1 += weight * it1->localError().matrix();
96 for (
auto it2 = it1 + 1; it2 != tsos.end(); it2++) {
98 ROOT::Math::AssignSym::Evaluate(covtmp,ROOT::Math::TensorProd(diff,diff));
99 covarPart2 += (weight * it2->weight()) * covtmp;
102 double sumwI = 1.0/sumw;
104 covarPart1 *= sumwI; covarPart2 *= (sumwI*sumwI);
110 tsos.front().surface(),
111 tsos.front().magneticField(),
112 tsos.front().surfaceSide()
124 "BasicMultiTrajectoryState::update(LocalTrajectoryParameters, Surface, ...) called even if canUpdateLocalParameters() is false");
137 "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)
virtual 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
std::vector< TSOS > theStates