14 const bool materialBeforeUpdate,
16 thePropagator(aPropagator.
clone()),
19 theUpdator(aUpdator.
clone()),
20 theEstimator(aEstimator.
clone()),
21 theMerger(aMerger.
clone()),
22 theMatBeforeUpdate(materialBeforeUpdate),
23 theErrorRescaling(errorRescaling),
24 theGeometry(detLayerGeometry)
26 if ( !theMatBeforeUpdate ) {
31 if(!theGeometry) theGeometry = &dummyGeometry;
37 GsfTrajectorySmoother::~GsfTrajectorySmoother() {
39 delete theGeomPropagator;
47 GsfTrajectorySmoother::trajectory(
const Trajectory& aTraj)
const {
71 TSOS predTsos = avtm.back().forwardPredictedState();
76 <<
"GsfTrajectorySmoother: predicted tsos of last measurement not valid!";
82 if(avtm.back().recHit()->isValid()) {
85 currTsos = updator()->
update(predTsos, *avtm.back().recHit());
89 edm::LogInfo(
"GsfTrajectorySmoother") <<
"GsfTrajectorySmoother: tsos not valid after update!";
94 if (!avtm.back().forwardPredictedState().isValid() || !predTsos.
isValid() || !avtm.back().updatedState().isValid()){
99 myTraj.push(TM(avtm.back().forwardPredictedState(),
101 avtm.back().updatedState(),
102 avtm.back().recHit(),
103 avtm.back().estimate(),
104 theGeometry->idToLayer(avtm.back().recHit()->geographicalId()) ),
105 avtm.back().estimate());
109 if (!avtm.back().forwardPredictedState().isValid()){
114 myTraj.push(TM(avtm.back().forwardPredictedState(),
115 avtm.back().recHit(),
117 theGeometry->idToLayer(avtm.back().recHit()->geographicalId() ) ));
122 for(std::vector<TM>::const_reverse_iterator itm = avtm.rbegin() + 1;
123 itm < avtm.rend() - 1; ++itm) {
145 if ( predTsos.
isValid() && theConvolutor && theMatBeforeUpdate )
146 predTsos = (*theConvolutor)(predTsos,
149 edm::LogInfo(
"GsfTrajectorySmoother") <<
"GsfTrajectorySmoother: predicted tsos not valid!";
152 if ( theMerger ) predTsos = theMerger->merge(predTsos);
154 if((*itm).recHit()->isValid()) {
158 currTsos = updator()->
update(predTsos, *(*itm).recHit());
160 if ( currTsos.
isValid() && theConvolutor && !theMatBeforeUpdate )
161 currTsos = (*theConvolutor)(currTsos,
165 <<
"GsfTrajectorySmoother: tsos not valid after update / material effects!";
172 TSOS combTsos =
combiner(predTsos, (*itm).forwardPredictedState());
174 LogDebug(
"GsfTrajectorySmoother") <<
175 "KFTrajectorySmoother: combined tsos not valid!\n"<<
178 "TrackingRecHit: "<<(*itm).recHit()->surface()->toGlobal((*itm).recHit()->localPosition())<<
"\n" ;
182 TSOS smooTsos =
combiner((*itm).updatedState(), predTsos);
185 LogDebug(
"GsfTrajectorySmoother") <<
186 "KFTrajectorySmoother: smoothed tsos not valid!";
190 if (!(*itm).forwardPredictedState().isValid() || !predTsos.
isValid() || !smooTsos.
isValid() ){
191 edm::LogError(
"InvalidState")<<
"inside hits with combination.";
196 myTraj.push(TM((*itm).forwardPredictedState(),
200 estimator()->estimate(combTsos, *(*itm).recHit()).
second,
201 theGeometry->idToLayer((*itm).recHit()->geographicalId() ) ),
206 TSOS combTsos =
combiner(predTsos, (*itm).forwardPredictedState());
209 LogDebug(
"GsfTrajectorySmoother") <<
210 "KFTrajectorySmoother: combined tsos not valid!";
214 if (!(*itm).forwardPredictedState().isValid() || !predTsos.
isValid() || !combTsos.
isValid() ){
215 edm::LogError(
"InvalidState")<<
"inside hits with invalid rechit.";
219 myTraj.push(TM((*itm).forwardPredictedState(),
224 theGeometry->idToLayer((*itm).recHit()->geographicalId()) ));
226 if ( theMerger ) currTsos = theMerger->merge(currTsos);
233 *avtm.front().recHit()->
surface());
235 if ( predTsos.
isValid() && theConvolutor && theMatBeforeUpdate )
236 predTsos = (*theConvolutor)(predTsos,
239 edm::LogInfo(
"GsfTrajectorySmoother") <<
"GsfTrajectorySmoother: predicted tsos not valid!";
242 if ( theMerger ) predTsos = theMerger->merge(predTsos);
244 if(avtm.front().recHit()->isValid()) {
248 currTsos = updator()->
update(predTsos, *avtm.front().recHit());
250 if ( currTsos.
isValid() && theConvolutor && !theMatBeforeUpdate )
251 currTsos = (*theConvolutor)(currTsos,
255 <<
"GsfTrajectorySmoother: tsos not valid after update / material effects!";
259 if (!avtm.front().forwardPredictedState().isValid() || !predTsos.
isValid() || !currTsos.
isValid() ){
264 myTraj.push(TM(avtm.front().forwardPredictedState(),
267 avtm.front().recHit(),
268 estimator()->estimate(predTsos, *avtm.front().recHit()).
second,
269 theGeometry->idToLayer(avtm.front().recHit()->geographicalId() )),
270 avtm.front().estimate());
274 if (!avtm.front().forwardPredictedState().isValid()){
278 myTraj.push(TM(avtm.front().forwardPredictedState(),
279 avtm.front().recHit(),
281 theGeometry->idToLayer(avtm.front().recHit()->geographicalId()) ));
bool empty() const
True if trajectory has no measurements.
void rescaleError(double factor)
TrajectorySeed const & seed() const
Access to the seed used to reconstruct the Trajectory.
GlobalPoint globalPosition() const
FullConvolutionWithMaterial * clone() const
Clone.
PropagationDirection const & direction() const
U second(std::pair< T, U > const &p)
DataContainer const & measurements() const
const SurfaceType & surface() const
void update(const LocalTrajectoryParameters &p, const SurfaceType &aSurface, const MagneticField *field, const SurfaceSide side=SurfaceSideDefinition::atCenterOfSurface)
DeepCopyPointerByClone< FullConvolutionWithMaterial > theConvolutor
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
tuple GsfTrajectorySmoother
GlobalVector globalMomentum() const