CMS 3D CMS Logo

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< TrajectoryStateOnSurfaceExternalPredictionCollection
 
typedef ReferenceTrajectoryBase::MaterialEffects MaterialEffects
 
typedef std::vector< ReferenceTrajectoryPtrReferenceTrajectoryCollection
 
typedef ReferenceTrajectoryBase::ReferenceTrajectoryPtr ReferenceTrajectoryPtr
 
typedef std::pair< TrajectoryStateOnSurface, TransientTrackingRecHit::ConstRecHitContainerTrajectoryInput
 

Public Member Functions

TwoBodyDecayTrajectoryFactoryclone () const override
 
const ReferenceTrajectoryCollection trajectories (const edm::EventSetup &setup, const ConstTrajTrackPairCollection &tracks, const reco::BeamSpot &beamSpot) const override
 Produce the trajectories. More...
 
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 () override
 
- Public Member Functions inherited from TrajectoryFactoryBase
const edm::ParameterSetconfiguration () const
 
MaterialEffects materialEffects (void) const
 
PropagationDirection propagationDirection (void) const
 
unsigned int tracksPerTrajectory () const
 
 TrajectoryFactoryBase (const edm::ParameterSet &config)
 
 TrajectoryFactoryBase (const edm::ParameterSet &config, unsigned int tracksPerTrajectory)
 
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
 
TwoBodyDecayFitter theFitter
 
double theNSigmaCutValue
 
double thePrimaryMass
 
double thePrimaryWidth
 
double theSecondaryMass
 
bool theUseRefittedStateFlag
 
- Protected Attributes inherited from TrajectoryFactoryBase
const bool allowZeroMaterial_
 
const bool includeAPEs_
 
const bool useBeamSpot_
 

Detailed Description

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

Definition at line 28 of file TwoBodyDecayTrajectoryFactory.cc.

Member Typedef Documentation

Definition at line 32 of file TwoBodyDecayTrajectoryFactory.cc.

Definition at line 31 of file TwoBodyDecayTrajectoryFactory.cc.

Definition at line 30 of file TwoBodyDecayTrajectoryFactory.cc.

Constructor & Destructor Documentation

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

Definition at line 74 of file TwoBodyDecayTrajectoryFactory.cc.

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

Referenced by clone().

75  : TrajectoryFactoryBase(config, 2), theFitter(config) {
76  const edm::ParameterSet ppc = config.getParameter<edm::ParameterSet>("ParticleProperties");
77  thePrimaryMass = ppc.getParameter<double>("PrimaryMass");
78  thePrimaryWidth = ppc.getParameter<double>("PrimaryWidth");
79  theSecondaryMass = ppc.getParameter<double>("SecondaryMass");
80 
81  theNSigmaCutValue = config.getParameter<double>("NSigmaCut");
82  theChi2CutValue = config.getParameter<double>("Chi2Cut");
83  theUseRefittedStateFlag = config.getParameter<bool>("UseRefittedState");
84  theConstructTsosWithErrorsFlag = config.getParameter<bool>("ConstructTsosWithErrors");
85 }
T getParameter(std::string const &) const
TrajectoryFactoryBase(const edm::ParameterSet &config)
TwoBodyDecayTrajectoryFactory::~TwoBodyDecayTrajectoryFactory ( )
override

Definition at line 87 of file TwoBodyDecayTrajectoryFactory.cc.

87 {}

Member Function Documentation

TwoBodyDecayTrajectoryFactory* TwoBodyDecayTrajectoryFactory::clone ( void  ) const
inlineoverridevirtual
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 170 of file TwoBodyDecayTrajectoryFactory.cc.

References ReferenceTrajectoryBase::Config::allowZeroMaterial, TrajectoryFactoryBase::allowZeroMaterial_, looper::config, ReferenceTrajectoryBase::Config::constructTsosWithErrors, TwoBodyDecay::covariance(), TwoBodyDecay::hasError(), ReferenceTrajectoryBase::Config::hitsAreReverse, ReferenceTrajectoryBase::Config::includeAPEs, TrajectoryFactoryBase::includeAPEs_, TrajectoryFactoryBase::innermostStateAndRecHits(), input1, input2, TwoBodyDecayTrajectoryState::isValid(), match(), TrajectoryFactoryBase::materialEffects(), TrajectoryFactoryBase::propagationDirection(), FastTrackerRecHitMaskProducer_cfi::recHits, mps_fire::result, ReferenceTrajectoryBase::setParameterErrors(), theConstructTsosWithErrorsFlag, theSecondaryMass, theUseRefittedStateFlag, trajectories(), TwoBodyDecayTrajectoryState::trajectoryStates(), ReferenceTrajectoryBase::Config::useBeamSpot, TrajectoryFactoryBase::useBeamSpot_, and ReferenceTrajectoryBase::Config::useRefittedState.

Referenced by clone(), and trajectories().

175  {
177 
178  // get innermost valid trajectory state and hits from the tracks
181 
182  if (!(input1.first.isValid() && input2.first.isValid()))
183  return trajectories;
184 
185  // produce TwoBodyDecayTrajectoryState (input for TwoBodyDecayTrajectory)
186  TsosContainer tsos(input1.first, input2.first);
187  ConstRecHitCollection recHits(input1.second, input2.second);
188  TwoBodyDecayTrajectoryState trajectoryState(tsos, tbd, theSecondaryMass, magField);
189 
190  if (!trajectoryState.isValid()) {
191  trajectories.push_back(ReferenceTrajectoryPtr(new TwoBodyDecayTrajectory()));
192  return trajectories;
193  }
194 
195  // always use the refitted trajectory state for matching
196  // FIXME FIXME CLONE
197  //TrackingRecHit::ConstRecHitPointer updatedRecHit1( recHits.first.front()->clone( tsos.first ) );
198  // TrackingRecHit::ConstRecHitPointer updatedRecHit2( recHits.second.front()->clone( tsos.second ) );
199 
200  TrackingRecHit::ConstRecHitPointer updatedRecHit1(recHits.first.front());
201  TrackingRecHit::ConstRecHitPointer updatedRecHit2(recHits.second.front());
202 
203  bool valid1 = match(trajectoryState.trajectoryStates(true).first, updatedRecHit1);
204 
205  bool valid2 = match(trajectoryState.trajectoryStates(true).second, updatedRecHit2);
206 
207  if (!valid1 || !valid2) {
208  trajectories.push_back(ReferenceTrajectoryPtr(new TwoBodyDecayTrajectory()));
209  return trajectories;
210  }
211 
213  config.useBeamSpot = useBeamSpot_;
214  config.includeAPEs = includeAPEs_;
215  config.allowZeroMaterial = allowZeroMaterial_;
216  config.useRefittedState = theUseRefittedStateFlag;
217  config.constructTsosWithErrors = theConstructTsosWithErrorsFlag;
218  // set the flag for reversing the RecHits to false, since they are already in the correct order.
219  config.hitsAreReverse = false;
220  TwoBodyDecayTrajectory *result = new TwoBodyDecayTrajectory(trajectoryState, recHits, magField, beamSpot, config);
221  if (setParameterErrors && tbd.hasError())
222  result->setParameterErrors(tbd.covariance());
223  trajectories.push_back(ReferenceTrajectoryPtr(result));
224  return trajectories;
225 }
bool hasError(void) const
Definition: TwoBodyDecay.h:42
const ReferenceTrajectoryCollection trajectories(const edm::EventSetup &setup, const ConstTrajTrackPairCollection &tracks, const reco::BeamSpot &beamSpot) const override
Produce the trajectories.
MaterialEffects materialEffects(void) const
TwoBodyDecayTrajectory::ConstRecHitCollection ConstRecHitCollection
void setParameterErrors(const AlgebraicSymMatrix &error)
Definition: config.py:1
#define input2
Definition: AMPTWrapper.h:159
bool match(const TrajectoryStateOnSurface &state, const TransientTrackingRecHit::ConstRecHitPointer &recHit) const
config
Definition: looper.py:291
const AlgebraicSymMatrix & covariance(void) const
Definition: TwoBodyDecay.h:34
std::shared_ptr< TrackingRecHit const > ConstRecHitPointer
#define input1
Definition: AMPTWrapper.h:139
std::pair< TrajectoryStateOnSurface, TransientTrackingRecHit::ConstRecHitContainer > TrajectoryInput
virtual const TrajectoryInput innermostStateAndRecHits(const ConstTrajTrackPair &track) const
PropagationDirection propagationDirection(void) const
ReferenceTrajectoryBase::ReferenceTrajectoryPtr ReferenceTrajectoryPtr
std::vector< ReferenceTrajectoryPtr > ReferenceTrajectoryCollection
TwoBodyDecayTrajectoryState::TsosContainer TsosContainer
bool TwoBodyDecayTrajectoryFactory::match ( const TrajectoryStateOnSurface state,
const TransientTrackingRecHit::ConstRecHitPointer recHit 
) const
protected

Definition at line 227 of file TwoBodyDecayTrajectoryFactory.cc.

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

Referenced by clone(), and constructTrajectories().

228  {
229  LocalPoint lp1 = state.localPosition();
230  LocalPoint lp2 = recHit->localPosition();
231 
232  double deltaX = lp1.x() - lp2.x();
233  double deltaY = lp1.y() - lp2.y();
234 
235  LocalError le = recHit->localPositionError();
236 
237  double varX = le.xx();
238  double varY = le.yy();
239 
240  return ((fabs(deltaX) / sqrt(varX) < theNSigmaCutValue) && (fabs(deltaY) / sqrt(varY) < theNSigmaCutValue));
241 }
float xx() const
Definition: LocalError.h:22
T y() const
Definition: PV3DBase.h:60
float yy() const
Definition: LocalError.h:24
T sqrt(T t)
Definition: SSEVec.h:19
T x() const
Definition: PV3DBase.h:59
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 89 of file TwoBodyDecayTrajectoryFactory.cc.

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

Referenced by constructTrajectories(), and trajectories().

90  {
92 
94  setup.get<IdealMagneticFieldRecord>().get(magneticField);
95 
96  if (tracks.size() == 2) {
97  // produce transient tracks from persistent tracks
98  std::vector<reco::TransientTrack> transientTracks(2);
99 
100  transientTracks[0] = reco::TransientTrack(*tracks[0].second, magneticField.product());
101  transientTracks[0].setES(setup);
102 
103  transientTracks[1] = reco::TransientTrack(*tracks[1].second, magneticField.product());
104  transientTracks[1].setES(setup);
105 
106  // estimate the decay parameters
108  TwoBodyDecay tbd = theFitter.estimate(transientTracks, vm);
109 
110  if (!tbd.isValid() || (tbd.chi2() > theChi2CutValue)) {
111  trajectories.push_back(ReferenceTrajectoryPtr(new TwoBodyDecayTrajectory()));
112  return trajectories;
113  }
114 
115  return constructTrajectories(tracks, tbd, magneticField.product(), beamSpot, false);
116  } else {
117  edm::LogInfo("ReferenceTrajectories") << "@SUB=TwoBodyDecayTrajectoryFactory::trajectories"
118  << "Need 2 tracks, got " << tracks.size() << ".\n";
119  }
120 
121  return trajectories;
122 }
const ReferenceTrajectoryCollection trajectories(const edm::EventSetup &setup, const ConstTrajTrackPairCollection &tracks, const reco::BeamSpot &beamSpot) const override
Produce the trajectories.
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)
void setES(const edm::EventSetup &es)
bool isValid(void) const
Definition: TwoBodyDecay.h:46
double chi2(void) const
Definition: TwoBodyDecay.h:44
T get() const
Definition: EventSetup.h:73
ReferenceTrajectoryBase::ReferenceTrajectoryPtr ReferenceTrajectoryPtr
T const * product() const
Definition: ESHandle.h:86
std::vector< ReferenceTrajectoryPtr > ReferenceTrajectoryCollection
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 124 of file TwoBodyDecayTrajectoryFactory.cc.

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

128  {
130 
132  setup.get<IdealMagneticFieldRecord>().get(magneticField);
133 
134  if (tracks.size() == 2 && external.size() == 2) {
135  if (external[0].isValid() && external[1].isValid()) // Include external estimates
136  {
137  // produce transient tracks from persistent tracks
138  std::vector<reco::TransientTrack> transientTracks(2);
139 
140  transientTracks[0] = reco::TransientTrack(*tracks[0].second, magneticField.product());
141  transientTracks[0].setES(setup);
142 
143  transientTracks[1] = reco::TransientTrack(*tracks[1].second, magneticField.product());
144  transientTracks[1].setES(setup);
145 
146  // estimate the decay parameters. the transient tracks are not really associated to the
147  // the external tsos, but this is o.k., because the only information retrieved from them
148  // is the magnetic field.
150  TwoBodyDecay tbd = theFitter.estimate(transientTracks, external, vm);
151 
152  if (!tbd.isValid() || (tbd.chi2() > theChi2CutValue)) {
153  trajectories.push_back(ReferenceTrajectoryPtr(new TwoBodyDecayTrajectory()));
154  return trajectories;
155  }
156 
157  return constructTrajectories(tracks, tbd, magneticField.product(), beamSpot, true);
158  } else {
159  // Return without external estimate
160  trajectories = this->trajectories(setup, tracks, beamSpot);
161  }
162  } else {
163  edm::LogInfo("ReferenceTrajectories") << "@SUB=TwoBodyDecayTrajectoryFactory::trajectories"
164  << "Need 2 tracks, got " << tracks.size() << ".\n";
165  }
166 
167  return trajectories;
168 }
const ReferenceTrajectoryCollection trajectories(const edm::EventSetup &setup, const ConstTrajTrackPairCollection &tracks, const reco::BeamSpot &beamSpot) const override
Produce the trajectories.
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)
void setES(const edm::EventSetup &es)
bool isValid(void) const
Definition: TwoBodyDecay.h:46
double chi2(void) const
Definition: TwoBodyDecay.h:44
T get() const
Definition: EventSetup.h:73
ReferenceTrajectoryBase::ReferenceTrajectoryPtr ReferenceTrajectoryPtr
T const * product() const
Definition: ESHandle.h:86
std::vector< ReferenceTrajectoryPtr > ReferenceTrajectoryCollection

Member Data Documentation

double TwoBodyDecayTrajectoryFactory::theChi2CutValue
protected

Definition at line 65 of file TwoBodyDecayTrajectoryFactory.cc.

Referenced by trajectories(), and TwoBodyDecayTrajectoryFactory().

bool TwoBodyDecayTrajectoryFactory::theConstructTsosWithErrorsFlag
protected
TwoBodyDecayFitter TwoBodyDecayTrajectoryFactory::theFitter
protected

Definition at line 58 of file TwoBodyDecayTrajectoryFactory.cc.

Referenced by trajectories().

double TwoBodyDecayTrajectoryFactory::theNSigmaCutValue
protected

Definition at line 64 of file TwoBodyDecayTrajectoryFactory.cc.

Referenced by match(), and TwoBodyDecayTrajectoryFactory().

double TwoBodyDecayTrajectoryFactory::thePrimaryMass
protected

Definition at line 60 of file TwoBodyDecayTrajectoryFactory.cc.

Referenced by trajectories(), and TwoBodyDecayTrajectoryFactory().

double TwoBodyDecayTrajectoryFactory::thePrimaryWidth
protected

Definition at line 61 of file TwoBodyDecayTrajectoryFactory.cc.

Referenced by trajectories(), and TwoBodyDecayTrajectoryFactory().

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