CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes
TwoBodyDecayTrajectoryFactory Class Reference
Inheritance diagram for TwoBodyDecayTrajectoryFactory:
TrajectoryFactoryBase

Public Types

typedef
TwoBodyDecayTrajectory::ConstRecHitCollection 
ConstRecHitCollection
 
typedef
TwoBodyDecayTrajectoryState::TsosContainer 
TsosContainer
 
typedef
TwoBodyDecayVirtualMeasurement 
VirtualMeasurement
 
- Public Types inherited from TrajectoryFactoryBase
typedef
AlignmentAlgorithmBase::ConstTrajTrackPair 
ConstTrajTrackPair
 
typedef
AlignmentAlgorithmBase::ConstTrajTrackPairCollection 
ConstTrajTrackPairCollection
 
typedef std::vector
< TrajectoryStateOnSurface
ExternalPredictionCollection
 
typedef
ReferenceTrajectoryBase::MaterialEffects 
MaterialEffects
 
typedef std::vector
< ReferenceTrajectoryPtr
ReferenceTrajectoryCollection
 
typedef
ReferenceTrajectoryBase::ReferenceTrajectoryPtr 
ReferenceTrajectoryPtr
 
typedef std::pair
< TrajectoryStateOnSurface,
TransientTrackingRecHit::ConstRecHitContainer
TrajectoryInput
 

Public Member Functions

virtual
TwoBodyDecayTrajectoryFactory
clone () const override
 
virtual const
ReferenceTrajectoryCollection 
trajectories (const edm::EventSetup &setup, const ConstTrajTrackPairCollection &tracks, const reco::BeamSpot &beamSpot) const override
 Produce the trajectories. More...
 
virtual const
ReferenceTrajectoryCollection 
trajectories (const edm::EventSetup &setup, const ConstTrajTrackPairCollection &tracks, const ExternalPredictionCollection &external, const reco::BeamSpot &beamSpot) const override
 
 TwoBodyDecayTrajectoryFactory (const edm::ParameterSet &config)
 
 ~TwoBodyDecayTrajectoryFactory ()
 
- Public Member Functions inherited from TrajectoryFactoryBase
const edm::ParameterSetconfiguration () const
 
MaterialEffects materialEffects (void) const
 
PropagationDirection propagationDirection (void) const
 
 TrajectoryFactoryBase (const edm::ParameterSet &config)
 
virtual ~TrajectoryFactoryBase (void)
 

Protected Member Functions

const ReferenceTrajectoryCollection constructTrajectories (const ConstTrajTrackPairCollection &tracks, const TwoBodyDecay &tbd, const MagneticField *magField, const reco::BeamSpot &beamSpot, bool setParameterErrors) const
 
bool match (const TrajectoryStateOnSurface &state, const TransientTrackingRecHit::ConstRecHitPointer &recHit) const
 
- Protected Member Functions inherited from TrajectoryFactoryBase
virtual const TrajectoryInput innermostStateAndRecHits (const ConstTrajTrackPair &track) const
 
virtual const
Trajectory::DataContainer 
orderedTrajectoryMeasurements (const Trajectory &trajectory) const
 
bool sameSurface (const Surface &s1, const Surface &s2) const
 
bool useRecHit (const TransientTrackingRecHit::ConstRecHitPointer &hitPtr) const
 

Protected Attributes

double theChi2CutValue
 
bool theConstructTsosWithErrorsFlag
 
TwoBodyDecayFittertheFitter
 
double theNSigmaCutValue
 
double thePrimaryMass
 
double thePrimaryWidth
 
double theSecondaryMass
 
bool theUseRefittedStateFlag
 
- Protected Attributes inherited from TrajectoryFactoryBase
bool theUseBeamSpot
 

Detailed Description

by Edmund Widl, see CMS NOTE-2007/032. extension for BreakPoints or BrokenLines by Claus Kleinwort

Definition at line 30 of file TwoBodyDecayTrajectoryFactory.cc.

Member Typedef Documentation

Definition at line 36 of file TwoBodyDecayTrajectoryFactory.cc.

Definition at line 35 of file TwoBodyDecayTrajectoryFactory.cc.

Definition at line 34 of file TwoBodyDecayTrajectoryFactory.cc.

Constructor & Destructor Documentation

TwoBodyDecayTrajectoryFactory::TwoBodyDecayTrajectoryFactory ( const edm::ParameterSet config)

Definition at line 80 of file TwoBodyDecayTrajectoryFactory.cc.

References edm::ParameterSet::getParameter(), theChi2CutValue, theConstructTsosWithErrorsFlag, theNSigmaCutValue, thePrimaryMass, thePrimaryWidth, theSecondaryMass, and theUseRefittedStateFlag.

Referenced by clone().

81  : TrajectoryFactoryBase( config ),
82  theFitter( new TwoBodyDecayFitter( config ) )
83 {
84  const edm::ParameterSet ppc = config.getParameter< edm::ParameterSet >( "ParticleProperties" );
85  thePrimaryMass = ppc.getParameter< double >( "PrimaryMass" );
86  thePrimaryWidth = ppc.getParameter< double >( "PrimaryWidth" );
87  theSecondaryMass = ppc.getParameter< double >( "SecondaryMass" );
88 
89  theNSigmaCutValue = config.getParameter< double >( "NSigmaCut" );
90  theChi2CutValue = config.getParameter< double >( "Chi2Cut" );
91  theUseRefittedStateFlag = config.getParameter< bool >( "UseRefittedState" );
92  theConstructTsosWithErrorsFlag = config.getParameter< bool >( "ConstructTsosWithErrors" );
93 }
T getParameter(std::string const &) const
TrajectoryFactoryBase(const edm::ParameterSet &config)
TwoBodyDecayTrajectoryFactory::~TwoBodyDecayTrajectoryFactory ( )

Definition at line 95 of file TwoBodyDecayTrajectoryFactory.cc.

References theFitter.

96 {
97  delete theFitter;
98 }

Member Function Documentation

virtual TwoBodyDecayTrajectoryFactory* TwoBodyDecayTrajectoryFactory::clone ( void  ) const
inlineoverridevirtual

Implements TrajectoryFactoryBase.

Definition at line 51 of file TwoBodyDecayTrajectoryFactory.cc.

References TwoBodyDecayTrajectoryFactory().

51 { return new TwoBodyDecayTrajectoryFactory(*this); }
TwoBodyDecayTrajectoryFactory(const edm::ParameterSet &config)
const TwoBodyDecayTrajectoryFactory::ReferenceTrajectoryCollection TwoBodyDecayTrajectoryFactory::constructTrajectories ( const ConstTrajTrackPairCollection tracks,
const TwoBodyDecay tbd,
const MagneticField magField,
const reco::BeamSpot beamSpot,
bool  setParameterErrors 
) const
protected

Definition at line 198 of file TwoBodyDecayTrajectoryFactory.cc.

References TwoBodyDecay::covariance(), TwoBodyDecay::hasError(), TrajectoryFactoryBase::innermostStateAndRecHits(), input1, input2, TwoBodyDecayTrajectoryState::isValid(), match(), TrajectoryFactoryBase::materialEffects(), TrajectoryFactoryBase::propagationDirection(), HLT_50ns_5e33_v2_cff::recHits, query::result, ReferenceTrajectoryBase::setParameterErrors(), theConstructTsosWithErrorsFlag, theSecondaryMass, theUseRefittedStateFlag, trajectories(), and TwoBodyDecayTrajectoryState::trajectoryStates().

Referenced by trajectories().

203 {
205 
206  // get innermost valid trajectory state and hits from the tracks
209 
210  if ( !( input1.first.isValid() && input2.first.isValid() ) ) return trajectories;
211 
212  // produce TwoBodyDecayTrajectoryState (input for TwoBodyDecayTrajectory)
213  TsosContainer tsos( input1.first, input2.first );
214  ConstRecHitCollection recHits( input1.second, input2.second );
215  TwoBodyDecayTrajectoryState trajectoryState( tsos, tbd, theSecondaryMass, magField );
216 
217  if ( !trajectoryState.isValid() )
218  {
219  trajectories.push_back( ReferenceTrajectoryPtr( new TwoBodyDecayTrajectory() ) );
220  return trajectories;
221  }
222 
223  // always use the refitted trajectory state for matching
224  // FIXME FIXME CLONE
225  //TrackingRecHit::ConstRecHitPointer updatedRecHit1( recHits.first.front()->clone( tsos.first ) );
226  // TrackingRecHit::ConstRecHitPointer updatedRecHit2( recHits.second.front()->clone( tsos.second ) );
227 
228  TrackingRecHit::ConstRecHitPointer updatedRecHit1( recHits.first.front() );
229  TrackingRecHit::ConstRecHitPointer updatedRecHit2( recHits.second.front() );
230 
231 
232  bool valid1 = match( trajectoryState.trajectoryStates( true ).first,
233  updatedRecHit1 );
234 
235  bool valid2 = match( trajectoryState.trajectoryStates( true ).second,
236  updatedRecHit2 );
237 
238  if ( !valid1 || !valid2 )
239  {
240  trajectories.push_back( ReferenceTrajectoryPtr( new TwoBodyDecayTrajectory() ) );
241  return trajectories;
242  }
243 
244  // set the flag for reversing the RecHits to false, since they are already in the correct order.
245  TwoBodyDecayTrajectory* result = new TwoBodyDecayTrajectory( trajectoryState, recHits, magField,
247  false, beamSpot, theUseRefittedStateFlag,
249  if ( setParameterErrors && tbd.hasError() ) result->setParameterErrors( tbd.covariance() );
250  trajectories.push_back( ReferenceTrajectoryPtr( result ) );
251  return trajectories;
252 }
bool hasError(void) const
Definition: TwoBodyDecay.h:45
MaterialEffects materialEffects(void) const
TwoBodyDecayTrajectory::ConstRecHitCollection ConstRecHitCollection
void setParameterErrors(const AlgebraicSymMatrix &error)
#define input2
Definition: AMPTWrapper.h:149
bool match(const TrajectoryStateOnSurface &state, const TransientTrackingRecHit::ConstRecHitPointer &recHit) const
virtual const ReferenceTrajectoryCollection trajectories(const edm::EventSetup &setup, const ConstTrajTrackPairCollection &tracks, const reco::BeamSpot &beamSpot) const override
Produce the trajectories.
const AlgebraicSymMatrix & covariance(void) const
Definition: TwoBodyDecay.h:37
std::shared_ptr< TrackingRecHit const > ConstRecHitPointer
tuple result
Definition: query.py:137
#define input1
Definition: AMPTWrapper.h:129
virtual const TrajectoryInput innermostStateAndRecHits(const ConstTrajTrackPair &track) const
std::vector< ReferenceTrajectoryPtr > ReferenceTrajectoryCollection
tuple tracks
Definition: testEve_cfg.py:39
PropagationDirection propagationDirection(void) const
std::pair< TrajectoryStateOnSurface, TransientTrackingRecHit::ConstRecHitContainer > TrajectoryInput
ReferenceTrajectoryBase::ReferenceTrajectoryPtr ReferenceTrajectoryPtr
TwoBodyDecayTrajectoryState::TsosContainer TsosContainer
bool TwoBodyDecayTrajectoryFactory::match ( const TrajectoryStateOnSurface state,
const TransientTrackingRecHit::ConstRecHitPointer recHit 
) const
protected

Definition at line 255 of file TwoBodyDecayTrajectoryFactory.cc.

References asciidump::le, TrajectoryStateOnSurface::localPosition(), mathSSE::sqrt(), theNSigmaCutValue, PV3DBase< T, PVType, FrameType >::x(), LocalError::xx(), PV3DBase< T, PVType, FrameType >::y(), and LocalError::yy().

Referenced by constructTrajectories().

257 {
258  LocalPoint lp1 = state.localPosition();
259  LocalPoint lp2 = recHit->localPosition();
260 
261  double deltaX = lp1.x() - lp2.x();
262  double deltaY = lp1.y() - lp2.y();
263 
264  LocalError le = recHit->localPositionError();
265 
266  double varX = le.xx();
267  double varY = le.yy();
268 
269  return ( ( fabs(deltaX)/sqrt(varX) < theNSigmaCutValue ) && ( fabs(deltaY)/sqrt(varY) < theNSigmaCutValue ) );
270 }
float xx() const
Definition: LocalError.h:24
T y() const
Definition: PV3DBase.h:63
float yy() const
Definition: LocalError.h:26
T sqrt(T t)
Definition: SSEVec.h:48
T x() const
Definition: PV3DBase.h:62
const TrajectoryFactoryBase::ReferenceTrajectoryCollection TwoBodyDecayTrajectoryFactory::trajectories ( const edm::EventSetup setup,
const ConstTrajTrackPairCollection tracks,
const reco::BeamSpot beamSpot 
) const
overridevirtual

Produce the trajectories.

Implements TrajectoryFactoryBase.

Definition at line 101 of file TwoBodyDecayTrajectoryFactory.cc.

References SiPixelRawToDigiRegional_cfi::beamSpot, TwoBodyDecay::chi2(), constructTrajectories(), TwoBodyDecayFitter::estimate(), edm::false, edm::EventSetup::get(), TwoBodyDecay::isValid(), HLT_25ns14e33_v1_cff::magneticField, edm::ESHandle< class >::product(), edm::second(), reco::TransientTrack::setES(), theChi2CutValue, theFitter, thePrimaryMass, thePrimaryWidth, and theSecondaryMass.

Referenced by constructTrajectories(), and trajectories().

104 {
106 
108  setup.get< IdealMagneticFieldRecord >().get( magneticField );
109 
110  if ( tracks.size() == 2 )
111  {
112  // produce transient tracks from persistent tracks
113  std::vector< reco::TransientTrack > transientTracks( 2 );
114 
115  transientTracks[0] = reco::TransientTrack( *tracks[0].second, magneticField.product() );
116  transientTracks[0].setES( setup );
117 
118  transientTracks[1] = reco::TransientTrack( *tracks[1].second, magneticField.product() );
119  transientTracks[1].setES( setup );
120 
121  // estimate the decay parameters
123  TwoBodyDecay tbd = theFitter->estimate( transientTracks, vm );
124 
125  if ( !tbd.isValid() || ( tbd.chi2() > theChi2CutValue ) )
126  {
127  trajectories.push_back( ReferenceTrajectoryPtr( new TwoBodyDecayTrajectory() ) );
128  return trajectories;
129  }
130 
131  return constructTrajectories( tracks, tbd, magneticField.product(), beamSpot, false );
132  }
133  else
134  {
135  edm::LogInfo( "ReferenceTrajectories" ) << "@SUB=TwoBodyDecayTrajectoryFactory::trajectories"
136  << "Need 2 tracks, got " << tracks.size() << ".\n";
137  }
138 
139  return trajectories;
140 }
TwoBodyDecayVirtualMeasurement VirtualMeasurement
const ReferenceTrajectoryCollection constructTrajectories(const ConstTrajTrackPairCollection &tracks, const TwoBodyDecay &tbd, const MagneticField *magField, const reco::BeamSpot &beamSpot, bool setParameterErrors) const
virtual const TwoBodyDecay estimate(const std::vector< reco::TransientTrack > &tracks, const TwoBodyDecayVirtualMeasurement &vm) const
U second(std::pair< T, U > const &p)
virtual const ReferenceTrajectoryCollection trajectories(const edm::EventSetup &setup, const ConstTrajTrackPairCollection &tracks, const reco::BeamSpot &beamSpot) const override
Produce the trajectories.
void setES(const edm::EventSetup &es)
bool isValid(void) const
Definition: TwoBodyDecay.h:49
std::vector< ReferenceTrajectoryPtr > ReferenceTrajectoryCollection
tuple tracks
Definition: testEve_cfg.py:39
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:86
double chi2(void) const
Definition: TwoBodyDecay.h:47
volatile std::atomic< bool > shutdown_flag false
ReferenceTrajectoryBase::ReferenceTrajectoryPtr ReferenceTrajectoryPtr
const TrajectoryFactoryBase::ReferenceTrajectoryCollection TwoBodyDecayTrajectoryFactory::trajectories ( const edm::EventSetup setup,
const ConstTrajTrackPairCollection tracks,
const ExternalPredictionCollection external,
const reco::BeamSpot beamSpot 
) const
overridevirtual

Implements TrajectoryFactoryBase.

Definition at line 144 of file TwoBodyDecayTrajectoryFactory.cc.

References SiPixelRawToDigiRegional_cfi::beamSpot, TwoBodyDecay::chi2(), constructTrajectories(), TwoBodyDecayFitter::estimate(), edm::EventSetup::get(), TwoBodyDecay::isValid(), HLT_25ns14e33_v1_cff::magneticField, edm::ESHandle< class >::product(), edm::second(), reco::TransientTrack::setES(), theChi2CutValue, theFitter, thePrimaryMass, thePrimaryWidth, theSecondaryMass, trajectories(), and funct::true.

148 {
150 
152  setup.get< IdealMagneticFieldRecord >().get( magneticField );
153 
154  if ( tracks.size() == 2 && external.size() == 2 )
155  {
156  if ( external[0].isValid() && external[1].isValid() ) // Include external estimates
157  {
158  // produce transient tracks from persistent tracks
159  std::vector< reco::TransientTrack > transientTracks( 2 );
160 
161  transientTracks[0] = reco::TransientTrack( *tracks[0].second, magneticField.product() );
162  transientTracks[0].setES( setup );
163 
164  transientTracks[1] = reco::TransientTrack( *tracks[1].second, magneticField.product() );
165  transientTracks[1].setES( setup );
166 
167  // estimate the decay parameters. the transient tracks are not really associated to the
168  // the external tsos, but this is o.k., because the only information retrieved from them
169  // is the magnetic field.
171  TwoBodyDecay tbd = theFitter->estimate( transientTracks, external, vm );
172 
173  if ( !tbd.isValid() || ( tbd.chi2() > theChi2CutValue ) )
174  {
175  trajectories.push_back( ReferenceTrajectoryPtr( new TwoBodyDecayTrajectory() ) );
176  return trajectories;
177  }
178 
179  return constructTrajectories( tracks, tbd, magneticField.product(), beamSpot, true );
180  }
181  else
182  {
183  // Return without external estimate
184  trajectories = this->trajectories(setup, tracks, beamSpot);
185  }
186  }
187  else
188  {
189  edm::LogInfo( "ReferenceTrajectories" ) << "@SUB=TwoBodyDecayTrajectoryFactory::trajectories"
190  << "Need 2 tracks, got " << tracks.size() << ".\n";
191  }
192 
193  return trajectories;
194 }
TwoBodyDecayVirtualMeasurement VirtualMeasurement
const ReferenceTrajectoryCollection constructTrajectories(const ConstTrajTrackPairCollection &tracks, const TwoBodyDecay &tbd, const MagneticField *magField, const reco::BeamSpot &beamSpot, bool setParameterErrors) const
virtual const TwoBodyDecay estimate(const std::vector< reco::TransientTrack > &tracks, const TwoBodyDecayVirtualMeasurement &vm) const
U second(std::pair< T, U > const &p)
virtual const ReferenceTrajectoryCollection trajectories(const edm::EventSetup &setup, const ConstTrajTrackPairCollection &tracks, const reco::BeamSpot &beamSpot) const override
Produce the trajectories.
void setES(const edm::EventSetup &es)
bool isValid(void) const
Definition: TwoBodyDecay.h:49
std::vector< ReferenceTrajectoryPtr > ReferenceTrajectoryCollection
tuple tracks
Definition: testEve_cfg.py:39
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:86
double chi2(void) const
Definition: TwoBodyDecay.h:47
ReferenceTrajectoryBase::ReferenceTrajectoryPtr ReferenceTrajectoryPtr

Member Data Documentation

double TwoBodyDecayTrajectoryFactory::theChi2CutValue
protected

Definition at line 70 of file TwoBodyDecayTrajectoryFactory.cc.

Referenced by trajectories(), and TwoBodyDecayTrajectoryFactory().

bool TwoBodyDecayTrajectoryFactory::theConstructTsosWithErrorsFlag
protected
TwoBodyDecayFitter* TwoBodyDecayTrajectoryFactory::theFitter
protected
double TwoBodyDecayTrajectoryFactory::theNSigmaCutValue
protected

Definition at line 69 of file TwoBodyDecayTrajectoryFactory.cc.

Referenced by match(), and TwoBodyDecayTrajectoryFactory().

double TwoBodyDecayTrajectoryFactory::thePrimaryMass
protected

Definition at line 65 of file TwoBodyDecayTrajectoryFactory.cc.

Referenced by trajectories(), and TwoBodyDecayTrajectoryFactory().

double TwoBodyDecayTrajectoryFactory::thePrimaryWidth
protected

Definition at line 66 of file TwoBodyDecayTrajectoryFactory.cc.

Referenced by trajectories(), and TwoBodyDecayTrajectoryFactory().

double TwoBodyDecayTrajectoryFactory::theSecondaryMass
protected
bool TwoBodyDecayTrajectoryFactory::theUseRefittedStateFlag
protected