CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
< 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

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,
GlobalTrackingGeometryRecord
m_globTackingToken
 
const edm::ESGetToken
< MagneticField,
IdealMagneticFieldRecord
m_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

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,
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 }
const edm::ESGetToken< GlobalTrackingGeometry, GlobalTrackingGeometryRecord > m_globTackingToken
TrajectoryFactoryBase(const edm::ParameterSet &config, const edm::ConsumesCollector &iC)
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > m_MagFieldToken
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
TwoBodyDecayTrajectoryFactory::~TwoBodyDecayTrajectoryFactory ( )
override

Definition at line 93 of file TwoBodyDecayTrajectoryFactory.cc.

93 {}

Member Function Documentation

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)
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 ReferenceTrajectoryBase::Config::allowZeroMaterial, TrajectoryFactoryBase::allowZeroMaterial_, submitPVResolutionJobs::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(), HLT_FULL_cff::recHits, mps_fire::result, ReferenceTrajectoryBase::setParameterErrors(), theConstructTsosWithErrorsFlag, theSecondaryMass, theUseRefittedStateFlag, trajectories(), TwoBodyDecayTrajectoryState::trajectoryStates(), ReferenceTrajectoryBase::Config::useBeamSpot, TrajectoryFactoryBase::useBeamSpot_, and ReferenceTrajectoryBase::Config::useRefittedState.

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()) {
197  trajectories.push_back(ReferenceTrajectoryPtr(new TwoBodyDecayTrajectory()));
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) {
214  trajectories.push_back(ReferenceTrajectoryPtr(new TwoBodyDecayTrajectory()));
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());
229  trajectories.push_back(ReferenceTrajectoryPtr(result));
230  return trajectories;
231 }
bool hasError(void) const
Definition: TwoBodyDecay.h:42
MaterialEffects materialEffects(void) const
TwoBodyDecayTrajectory::ConstRecHitCollection ConstRecHitCollection
void setParameterErrors(const AlgebraicSymMatrix &error)
auto const & tracks
cannot be loose
#define input2
Definition: AMPTWrapper.h:159
bool match(const TrajectoryStateOnSurface &state, const TransientTrackingRecHit::ConstRecHitPointer &recHit) const
tuple result
Definition: mps_fire.py:311
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: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
tuple config
parse the configuration file
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 233 of file TwoBodyDecayTrajectoryFactory.cc.

References TrajectoryStateOnSurface::localPosition(), 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 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 95 of file TwoBodyDecayTrajectoryFactory.cc.

References TwoBodyDecay::chi2(), constructTrajectories(), TwoBodyDecayFitter::estimate(), edm::EventSetup::getData(), TwoBodyDecay::isValid(), m_globTackingToken, m_MagFieldToken, HLT_FULL_cff::magneticField, edm::second(), theChi2CutValue, theFitter, thePrimaryMass, thePrimaryWidth, and theSecondaryMass.

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)) {
116  trajectories.push_back(ReferenceTrajectoryPtr(new TwoBodyDecayTrajectory()));
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
const ReferenceTrajectoryCollection constructTrajectories(const ConstTrajTrackPairCollection &tracks, const TwoBodyDecay &tbd, const MagneticField *magField, const reco::BeamSpot &beamSpot, bool setParameterErrors) const
tuple magneticField
auto const & tracks
cannot be loose
virtual const TwoBodyDecay estimate(const std::vector< reco::TransientTrack > &tracks, const TwoBodyDecayVirtualMeasurement &vm) const
bool getData(T &iHolder) const
Definition: EventSetup.h:128
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.
bool isValid(void) const
Definition: TwoBodyDecay.h:46
Log< level::Info, false > LogInfo
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > m_MagFieldToken
double chi2(void) const
Definition: TwoBodyDecay.h:44
ReferenceTrajectoryBase::ReferenceTrajectoryPtr ReferenceTrajectoryPtr
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 129 of file TwoBodyDecayTrajectoryFactory.cc.

References TwoBodyDecay::chi2(), constructTrajectories(), TwoBodyDecayFitter::estimate(), edm::EventSetup::getData(), TwoBodyDecay::isValid(), sistrip::SpyUtilities::isValid(), m_globTackingToken, m_MagFieldToken, HLT_FULL_cff::magneticField, edm::second(), theChi2CutValue, theFitter, thePrimaryMass, thePrimaryWidth, theSecondaryMass, 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)) {
159  trajectories.push_back(ReferenceTrajectoryPtr(new TwoBodyDecayTrajectory()));
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
const ReferenceTrajectoryCollection constructTrajectories(const ConstTrajTrackPairCollection &tracks, const TwoBodyDecay &tbd, const MagneticField *magField, const reco::BeamSpot &beamSpot, bool setParameterErrors) const
tuple magneticField
auto const & tracks
cannot be loose
virtual const TwoBodyDecay estimate(const std::vector< reco::TransientTrack > &tracks, const TwoBodyDecayVirtualMeasurement &vm) const
bool getData(T &iHolder) const
Definition: EventSetup.h:128
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.
bool isValid(void) const
Definition: TwoBodyDecay.h:46
Log< level::Info, false > LogInfo
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > m_MagFieldToken
double chi2(void) const
Definition: TwoBodyDecay.h:44
ReferenceTrajectoryBase::ReferenceTrajectoryPtr ReferenceTrajectoryPtr
std::vector< ReferenceTrajectoryPtr > ReferenceTrajectoryCollection

Member Data Documentation

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

Definition at line 37 of file TwoBodyDecayTrajectoryFactory.cc.

Referenced by trajectories().

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

Definition at line 36 of file TwoBodyDecayTrajectoryFactory.cc.

Referenced by trajectories().

double TwoBodyDecayTrajectoryFactory::theChi2CutValue
protected

Definition at line 67 of file TwoBodyDecayTrajectoryFactory.cc.

Referenced by trajectories(), and TwoBodyDecayTrajectoryFactory().

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

Definition at line 60 of file TwoBodyDecayTrajectoryFactory.cc.

Referenced by trajectories().

double TwoBodyDecayTrajectoryFactory::theNSigmaCutValue
protected

Definition at line 66 of file TwoBodyDecayTrajectoryFactory.cc.

Referenced by match(), and TwoBodyDecayTrajectoryFactory().

double TwoBodyDecayTrajectoryFactory::thePrimaryMass
protected

Definition at line 62 of file TwoBodyDecayTrajectoryFactory.cc.

Referenced by trajectories(), and TwoBodyDecayTrajectoryFactory().

double TwoBodyDecayTrajectoryFactory::thePrimaryWidth
protected

Definition at line 63 of file TwoBodyDecayTrajectoryFactory.cc.

Referenced by trajectories(), and TwoBodyDecayTrajectoryFactory().

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