/
githubmirror
/
cmssw
Обзор
Документация
Войти
/
githubmirror
/
cmssw
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
TrackingTools/GsfTools/src/MultiStatePropagation.icc
85 строк
3 KB
swmukher
fix the crash from assert
08 дек 2021, 19:42
08 дек 2021, 19:42
2366680
Код
Авторство
О чём код?
// #include "TrackerReco/GsfPattern/src/MultiStatePropagation.h" #include "TrackingTools/GsfTools/interface/MultiTrajectoryStateAssembler.h" #include "TrackingTools/GsfTools/interface/GetComponents.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" template <class T> std::pair<TrajectoryStateOnSurface, double> MultiStatePropagation<T>::propagateWithPath( const TrajectoryStateOnSurface& tsos, const T& surface) const { // weighted path length double sWeight(0.); double sWeightPath(0.); // decomposition of input state GetComponents comps(tsos); auto const& input = comps(); // vector of result states MultiTrajectoryStateAssembler result; // // now propagate each input state individually // bool firstPropagation(true); SurfaceSideDefinition::SurfaceSide firstSide(SurfaceSideDefinition::atCenterOfSurface); for (auto const& iTsos : input) { // // weight of component // double weight(iTsos.weight()); // // geometrical propagation (assumption: only one output state!) // TsosWP newTsosWP = thePropagator.propagateWithPath(iTsos, surface); // check validity if (!(newTsosWP.first).isValid()) { LogDebug("GsfTrackFitters") << "adding invalid state"; result.addInvalidState(weight); continue; } // set weight TrajectoryStateOnSurface weightedTsos(setWeight(newTsosWP.first, weight)); // trap mix of forward / backward propagations if (firstPropagation) { firstSide = weightedTsos.surfaceSide(); firstPropagation = false; } else { if (weightedTsos.surfaceSide() != firstSide) { edm::LogInfo("GsfTrackFitters") << "MultiStatePropagation resulted in states " << "on different sides of the target surface"; return TsosWP(TrajectoryStateOnSurface(), 0.); } } // // add state(s) to result vector // result.addState(weightedTsos); // // calculation of weighted path length // sWeight += weight; sWeightPath += weight * newTsosWP.second; } // // check validity // TrajectoryStateOnSurface propagatedState(result.combinedState()); if (!propagatedState.isValid()) return TsosWP(propagatedState, 0.); // // return with weighted path length // if (sWeight != 0.) sWeightPath /= sWeight; return TsosWP(propagatedState, sWeightPath); } template <class T> TrajectoryStateOnSurface MultiStatePropagation<T>::setWeight(const TrajectoryStateOnSurface state, const double weight) const { return TrajectoryStateOnSurface(weight, state.localParameters(), state.localError(), state.surface(), &(state.globalParameters().magneticField()), state.surfaceSide()); }