CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Public Attributes | 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, edm::ConsumesCollector &iC)
 
 ~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, const edm::ConsumesCollector &iC)
 
 TrajectoryFactoryBase (const edm::ParameterSet &config, unsigned int tracksPerTrajectory, const edm::ConsumesCollector &iC)
 
virtual ~TrajectoryFactoryBase (void)
 

Public Attributes

const edm::ESGetToken< GlobalTrackingGeometry, GlobalTrackingGeometryRecordm_globTackingToken
 
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecordm_MagFieldToken
 

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

◆ ConstRecHitCollection

Definition at line 32 of file TwoBodyDecayTrajectoryFactory.cc.

◆ TsosContainer

Definition at line 31 of file TwoBodyDecayTrajectoryFactory.cc.

◆ VirtualMeasurement

Definition at line 30 of file TwoBodyDecayTrajectoryFactory.cc.

Constructor & Destructor Documentation

◆ TwoBodyDecayTrajectoryFactory()

TwoBodyDecayTrajectoryFactory::TwoBodyDecayTrajectoryFactory ( const edm::ParameterSet config,
edm::ConsumesCollector iC 
)

Definition at line 76 of file TwoBodyDecayTrajectoryFactory.cc.

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

Referenced by clone().

78  : TrajectoryFactoryBase(config, 2, iC),
81  theFitter(config) {
82  const edm::ParameterSet ppc = config.getParameter<edm::ParameterSet>("ParticleProperties");
83  thePrimaryMass = ppc.getParameter<double>("PrimaryMass");
84  thePrimaryWidth = ppc.getParameter<double>("PrimaryWidth");
85  theSecondaryMass = ppc.getParameter<double>("SecondaryMass");
86 
87  theNSigmaCutValue = config.getParameter<double>("NSigmaCut");
88  theChi2CutValue = config.getParameter<double>("Chi2Cut");
89  theUseRefittedStateFlag = config.getParameter<bool>("UseRefittedState");
90  theConstructTsosWithErrorsFlag = config.getParameter<bool>("ConstructTsosWithErrors");
91 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const edm::ESGetToken< GlobalTrackingGeometry, GlobalTrackingGeometryRecord > m_globTackingToken
Definition: config.py:1
TrajectoryFactoryBase(const edm::ParameterSet &config, const edm::ConsumesCollector &iC)
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > m_MagFieldToken

◆ ~TwoBodyDecayTrajectoryFactory()

TwoBodyDecayTrajectoryFactory::~TwoBodyDecayTrajectoryFactory ( )
override

Definition at line 93 of file TwoBodyDecayTrajectoryFactory.cc.

93 {}

Member Function Documentation

◆ clone()

TwoBodyDecayTrajectoryFactory* TwoBodyDecayTrajectoryFactory::clone ( void  ) const
inlineoverridevirtual

Implements TrajectoryFactoryBase.

Definition at line 49 of file TwoBodyDecayTrajectoryFactory.cc.

References TwoBodyDecayTrajectoryFactory().

49 { return new TwoBodyDecayTrajectoryFactory(*this); }
TwoBodyDecayTrajectoryFactory(const edm::ParameterSet &config, edm::ConsumesCollector &iC)

◆ constructTrajectories()

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 176 of file TwoBodyDecayTrajectoryFactory.cc.

References TrajectoryFactoryBase::allowZeroMaterial_, pwdgSkimBPark_cfi::beamSpot, submitPVResolutionJobs::config, TwoBodyDecay::covariance(), TwoBodyDecay::hasError(), TrajectoryFactoryBase::includeAPEs_, TrajectoryFactoryBase::innermostStateAndRecHits(), input1, input2, TwoBodyDecayTrajectoryState::isValid(), match(), TrajectoryFactoryBase::materialEffects(), TrajectoryFactoryBase::propagationDirection(), FastTrackerRecHitMaskProducer_cfi::recHits, mps_fire::result, theConstructTsosWithErrorsFlag, theSecondaryMass, theUseRefittedStateFlag, trajectories(), TwoBodyDecayTrajectoryState::trajectoryStates(), and TrajectoryFactoryBase::useBeamSpot_.

Referenced by trajectories().

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

◆ match()

bool TwoBodyDecayTrajectoryFactory::match ( const TrajectoryStateOnSurface state,
const TransientTrackingRecHit::ConstRecHitPointer recHit 
) const
protected

Definition at line 233 of file TwoBodyDecayTrajectoryFactory.cc.

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

Referenced by constructTrajectories().

234  {
235  LocalPoint lp1 = state.localPosition();
236  LocalPoint lp2 = recHit->localPosition();
237 
238  double deltaX = lp1.x() - lp2.x();
239  double deltaY = lp1.y() - lp2.y();
240 
241  LocalError le = recHit->localPositionError();
242 
243  double varX = le.xx();
244  double varY = le.yy();
245 
246  return ((fabs(deltaX) / sqrt(varX) < theNSigmaCutValue) && (fabs(deltaY) / sqrt(varY) < theNSigmaCutValue));
247 }
float yy() const
Definition: LocalError.h:24
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
T sqrt(T t)
Definition: SSEVec.h:19
float xx() const
Definition: LocalError.h:22

◆ trajectories() [1/2]

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 95 of file TwoBodyDecayTrajectoryFactory.cc.

References pwdgSkimBPark_cfi::beamSpot, TwoBodyDecay::chi2(), constructTrajectories(), TwoBodyDecayFitter::estimate(), TwoBodyDecay::isValid(), m_globTackingToken, m_MagFieldToken, HLT_2022v12_cff::magneticField, edm::second(), singleTopDQM_cfi::setup, theChi2CutValue, theFitter, thePrimaryMass, thePrimaryWidth, theSecondaryMass, and tracks.

Referenced by constructTrajectories(), and trajectories().

96  {
98 
100  const GlobalTrackingGeometry *trackingGeometry = &setup.getData(m_globTackingToken);
101  if (tracks.size() == 2) {
102  // produce transient tracks from persistent tracks
103  std::vector<reco::TransientTrack> transientTracks(2);
104 
105  transientTracks[0] = reco::TransientTrack(*tracks[0].second, magneticField);
106  transientTracks[0].setTrackingGeometry(trackingGeometry);
107 
108  transientTracks[1] = reco::TransientTrack(*tracks[1].second, magneticField);
109  transientTracks[1].setTrackingGeometry(trackingGeometry);
110 
111  // estimate the decay parameters
113  TwoBodyDecay tbd = theFitter.estimate(transientTracks, vm);
114 
115  if (!tbd.isValid() || (tbd.chi2() > theChi2CutValue)) {
117  return trajectories;
118  }
119 
120  return constructTrajectories(tracks, tbd, magneticField, beamSpot, false);
121  } else {
122  edm::LogInfo("ReferenceTrajectories") << "@SUB=TwoBodyDecayTrajectoryFactory::trajectories"
123  << "Need 2 tracks, got " << tracks.size() << ".\n";
124  }
125 
126  return trajectories;
127 }
const edm::ESGetToken< GlobalTrackingGeometry, GlobalTrackingGeometryRecord > m_globTackingToken
TwoBodyDecayVirtualMeasurement VirtualMeasurement
U second(std::pair< T, U > const &p)
const ReferenceTrajectoryCollection trajectories(const edm::EventSetup &setup, const ConstTrajTrackPairCollection &tracks, const reco::BeamSpot &beamSpot) const override
Produce the trajectories.
const ReferenceTrajectoryCollection constructTrajectories(const ConstTrajTrackPairCollection &tracks, const TwoBodyDecay &tbd, const MagneticField *magField, const reco::BeamSpot &beamSpot, bool setParameterErrors) const
Log< level::Info, false > LogInfo
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > m_MagFieldToken
auto const & tracks
cannot be loose
double chi2(void) const
Definition: TwoBodyDecay.h:44
bool isValid(void) const
Definition: TwoBodyDecay.h:46
ReferenceTrajectoryBase::ReferenceTrajectoryPtr ReferenceTrajectoryPtr
virtual const TwoBodyDecay estimate(const std::vector< reco::TransientTrack > &tracks, const TwoBodyDecayVirtualMeasurement &vm) const
std::vector< ReferenceTrajectoryPtr > ReferenceTrajectoryCollection

◆ trajectories() [2/2]

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 129 of file TwoBodyDecayTrajectoryFactory.cc.

References pwdgSkimBPark_cfi::beamSpot, TwoBodyDecay::chi2(), constructTrajectories(), TwoBodyDecayFitter::estimate(), TwoBodyDecay::isValid(), sistrip::SpyUtilities::isValid(), m_globTackingToken, m_MagFieldToken, HLT_2022v12_cff::magneticField, edm::second(), singleTopDQM_cfi::setup, theChi2CutValue, theFitter, thePrimaryMass, thePrimaryWidth, theSecondaryMass, tracks, and trajectories().

133  {
135 
137 
138  const GlobalTrackingGeometry *trackingGeometry = &setup.getData(m_globTackingToken);
139 
140  if (tracks.size() == 2 && external.size() == 2) {
141  if (external[0].isValid() && external[1].isValid()) // Include external estimates
142  {
143  // produce transient tracks from persistent tracks
144  std::vector<reco::TransientTrack> transientTracks(2);
145 
146  transientTracks[0] = reco::TransientTrack(*tracks[0].second, magneticField);
147  transientTracks[0].setTrackingGeometry(trackingGeometry);
148 
149  transientTracks[1] = reco::TransientTrack(*tracks[1].second, magneticField);
150  transientTracks[1].setTrackingGeometry(trackingGeometry);
151 
152  // estimate the decay parameters. the transient tracks are not really associated to the
153  // the external tsos, but this is o.k., because the only information retrieved from them
154  // is the magnetic field.
156  TwoBodyDecay tbd = theFitter.estimate(transientTracks, external, vm);
157 
158  if (!tbd.isValid() || (tbd.chi2() > theChi2CutValue)) {
160  return trajectories;
161  }
162 
163  return constructTrajectories(tracks, tbd, magneticField, beamSpot, true);
164  } else {
165  // Return without external estimate
166  trajectories = this->trajectories(setup, tracks, beamSpot);
167  }
168  } else {
169  edm::LogInfo("ReferenceTrajectories") << "@SUB=TwoBodyDecayTrajectoryFactory::trajectories"
170  << "Need 2 tracks, got " << tracks.size() << ".\n";
171  }
172 
173  return trajectories;
174 }
const bool isValid(const Frame &aFrame, const FrameQuality &aQuality, const uint16_t aExpectedPos)
const edm::ESGetToken< GlobalTrackingGeometry, GlobalTrackingGeometryRecord > m_globTackingToken
TwoBodyDecayVirtualMeasurement VirtualMeasurement
U second(std::pair< T, U > const &p)
const ReferenceTrajectoryCollection trajectories(const edm::EventSetup &setup, const ConstTrajTrackPairCollection &tracks, const reco::BeamSpot &beamSpot) const override
Produce the trajectories.
const ReferenceTrajectoryCollection constructTrajectories(const ConstTrajTrackPairCollection &tracks, const TwoBodyDecay &tbd, const MagneticField *magField, const reco::BeamSpot &beamSpot, bool setParameterErrors) const
Log< level::Info, false > LogInfo
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > m_MagFieldToken
auto const & tracks
cannot be loose
double chi2(void) const
Definition: TwoBodyDecay.h:44
bool isValid(void) const
Definition: TwoBodyDecay.h:46
ReferenceTrajectoryBase::ReferenceTrajectoryPtr ReferenceTrajectoryPtr
virtual const TwoBodyDecay estimate(const std::vector< reco::TransientTrack > &tracks, const TwoBodyDecayVirtualMeasurement &vm) const
std::vector< ReferenceTrajectoryPtr > ReferenceTrajectoryCollection

Member Data Documentation

◆ m_globTackingToken

const edm::ESGetToken<GlobalTrackingGeometry, GlobalTrackingGeometryRecord> TwoBodyDecayTrajectoryFactory::m_globTackingToken

Definition at line 37 of file TwoBodyDecayTrajectoryFactory.cc.

Referenced by trajectories().

◆ m_MagFieldToken

const edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> TwoBodyDecayTrajectoryFactory::m_MagFieldToken

Definition at line 36 of file TwoBodyDecayTrajectoryFactory.cc.

Referenced by trajectories().

◆ theChi2CutValue

double TwoBodyDecayTrajectoryFactory::theChi2CutValue
protected

Definition at line 67 of file TwoBodyDecayTrajectoryFactory.cc.

Referenced by trajectories(), and TwoBodyDecayTrajectoryFactory().

◆ theConstructTsosWithErrorsFlag

bool TwoBodyDecayTrajectoryFactory::theConstructTsosWithErrorsFlag
protected

◆ theFitter

TwoBodyDecayFitter TwoBodyDecayTrajectoryFactory::theFitter
protected

Definition at line 60 of file TwoBodyDecayTrajectoryFactory.cc.

Referenced by trajectories().

◆ theNSigmaCutValue

double TwoBodyDecayTrajectoryFactory::theNSigmaCutValue
protected

Definition at line 66 of file TwoBodyDecayTrajectoryFactory.cc.

Referenced by match(), and TwoBodyDecayTrajectoryFactory().

◆ thePrimaryMass

double TwoBodyDecayTrajectoryFactory::thePrimaryMass
protected

Definition at line 62 of file TwoBodyDecayTrajectoryFactory.cc.

Referenced by trajectories(), and TwoBodyDecayTrajectoryFactory().

◆ thePrimaryWidth

double TwoBodyDecayTrajectoryFactory::thePrimaryWidth
protected

Definition at line 63 of file TwoBodyDecayTrajectoryFactory.cc.

Referenced by trajectories(), and TwoBodyDecayTrajectoryFactory().

◆ theSecondaryMass

double TwoBodyDecayTrajectoryFactory::theSecondaryMass
protected

◆ theUseRefittedStateFlag

bool TwoBodyDecayTrajectoryFactory::theUseRefittedStateFlag
protected