CMS 3D CMS Logo

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

Public Member Functions

CombinedTrajectoryFactoryclone () const override
 
 CombinedTrajectoryFactory (const edm::ParameterSet &config, edm::ConsumesCollector &iC)
 
const ReferenceTrajectoryCollection trajectories (const edm::EventSetup &setup, const ConstTrajTrackPairCollection &tracks, const reco::BeamSpot &beamSpot) const override
 
const ReferenceTrajectoryCollection trajectories (const edm::EventSetup &setup, const ConstTrajTrackPairCollection &tracks, const ExternalPredictionCollection &external, const reco::BeamSpot &beamSpot) const override
 
 ~CombinedTrajectoryFactory () 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)
 

Private Member Functions

 CombinedTrajectoryFactory (const CombinedTrajectoryFactory &other)
 

Private Attributes

std::vector< std::unique_ptr
< TrajectoryFactoryBase > > 
theFactories
 
bool theUseAllFactories
 

Additional Inherited Members

- 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
 
- 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 inherited from TrajectoryFactoryBase
const bool allowZeroMaterial_
 
const bool includeAPEs_
 
const bool useBeamSpot_
 

Detailed Description

A factory that can combine the functionality of several 'trajectory factories'. At construction time, it is given an ordered list of what kinds factories it should use. When called, all the factories are called one after each other,

Example: Combine TwoBodyDecayTrajectoryFactory and ReferenceTrajectoryFactory with useAllFactories = false. In case the former can't produce a trajectory from two given tracks, the tracks can still be used for 'ordinary' reference trajectories (see also TrajectoryFactories.cff).

Definition at line 24 of file CombinedTrajectoryFactory.cc.

Constructor & Destructor Documentation

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

Definition at line 59 of file CombinedTrajectoryFactory.cc.

References beamerCreator::create(), Exception, get, edm::ParameterSet::getParameter(), and theFactories.

Referenced by clone().

60  : TrajectoryFactoryBase(config, iC), theUseAllFactories(config.getParameter<bool>("useAllFactories")) {
61  vector<string> factoryNames = config.getParameter<vector<string>>("TrajectoryFactoryNames");
62  for (auto const &factoryName : factoryNames) {
63  // auto_ptr to avoid missing a delete due to throw...
64  std::unique_ptr<TObjArray> namePset(TString(factoryName.c_str()).Tokenize(","));
65  if (namePset->GetEntriesFast() != 2) {
66  throw cms::Exception("BadConfig") << "@SUB=CombinedTrajectoryFactory"
67  << "TrajectoryFactoryNames must contain 2 comma "
68  << "separated strings, but is '" << factoryName << "'";
69  }
70  const edm::ParameterSet factoryCfg = config.getParameter<edm::ParameterSet>(namePset->At(1)->GetName());
71  theFactories.emplace_back(TrajectoryFactoryPlugin::get()->create(namePset->At(0)->GetName(), factoryCfg, iC));
72  }
73 }
std::vector< std::unique_ptr< TrajectoryFactoryBase > > theFactories
TrajectoryFactoryBase(const edm::ParameterSet &config, const edm::ConsumesCollector &iC)
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
#define get
CombinedTrajectoryFactory::~CombinedTrajectoryFactory ( void  )
override

Definition at line 75 of file CombinedTrajectoryFactory.cc.

75 {}
CombinedTrajectoryFactory::CombinedTrajectoryFactory ( const CombinedTrajectoryFactory other)
inlineprivate

Definition at line 41 of file CombinedTrajectoryFactory.cc.

References theUseAllFactories.

43  theFactories.reserve(other.theFactories.size());
44  for (const auto &f : other.theFactories) {
45  theFactories.emplace_back(f->clone());
46  }
47  }
std::vector< std::unique_ptr< TrajectoryFactoryBase > > theFactories
TrajectoryFactoryBase(const edm::ParameterSet &config, const edm::ConsumesCollector &iC)

Member Function Documentation

CombinedTrajectoryFactory* CombinedTrajectoryFactory::clone ( void  ) const
inlineoverridevirtual

Implements TrajectoryFactoryBase.

Definition at line 38 of file CombinedTrajectoryFactory.cc.

References CombinedTrajectoryFactory().

38 { return new CombinedTrajectoryFactory(*this); }
CombinedTrajectoryFactory(const edm::ParameterSet &config, edm::ConsumesCollector &iC)
const CombinedTrajectoryFactory::ReferenceTrajectoryCollection CombinedTrajectoryFactory::trajectories ( const edm::EventSetup setup,
const ConstTrajTrackPairCollection tracks,
const reco::BeamSpot beamSpot 
) const
overridevirtual

Implements TrajectoryFactoryBase.

Definition at line 77 of file CombinedTrajectoryFactory.cc.

References theFactories, and theUseAllFactories.

Referenced by trajectories().

78  {
80  ReferenceTrajectoryCollection tmpTrajectories; // outside loop for efficiency
81 
82  for (auto const &factory : theFactories) {
83  tmpTrajectories = factory->trajectories(setup, tracks, beamSpot);
84  trajectories.insert(trajectories.end(), tmpTrajectories.begin(), tmpTrajectories.end());
85 
86  if (!theUseAllFactories && !trajectories.empty())
87  break;
88  }
89 
90  return trajectories;
91 }
auto const & tracks
cannot be loose
std::vector< std::unique_ptr< TrajectoryFactoryBase > > theFactories
const ReferenceTrajectoryCollection trajectories(const edm::EventSetup &setup, const ConstTrajTrackPairCollection &tracks, const reco::BeamSpot &beamSpot) const override
std::vector< ReferenceTrajectoryPtr > ReferenceTrajectoryCollection
const CombinedTrajectoryFactory::ReferenceTrajectoryCollection CombinedTrajectoryFactory::trajectories ( const edm::EventSetup setup,
const ConstTrajTrackPairCollection tracks,
const ExternalPredictionCollection external,
const reco::BeamSpot beamSpot 
) const
overridevirtual

Implements TrajectoryFactoryBase.

Definition at line 93 of file CombinedTrajectoryFactory.cc.

References theFactories, theUseAllFactories, and trajectories().

97  {
99  ReferenceTrajectoryCollection tmpTrajectories; // outside loop for efficiency
100 
101  for (auto const &factory : theFactories) {
102  tmpTrajectories = factory->trajectories(setup, tracks, external, beamSpot);
103  trajectories.insert(trajectories.end(), tmpTrajectories.begin(), tmpTrajectories.end());
104 
105  if (!theUseAllFactories && !trajectories.empty())
106  break;
107  }
108 
109  return trajectories;
110 }
auto const & tracks
cannot be loose
std::vector< std::unique_ptr< TrajectoryFactoryBase > > theFactories
const ReferenceTrajectoryCollection trajectories(const edm::EventSetup &setup, const ConstTrajTrackPairCollection &tracks, const reco::BeamSpot &beamSpot) const override
std::vector< ReferenceTrajectoryPtr > ReferenceTrajectoryCollection

Member Data Documentation

std::vector<std::unique_ptr<TrajectoryFactoryBase> > CombinedTrajectoryFactory::theFactories
private

Definition at line 49 of file CombinedTrajectoryFactory.cc.

Referenced by CombinedTrajectoryFactory(), and trajectories().

bool CombinedTrajectoryFactory::theUseAllFactories
private

Definition at line 50 of file CombinedTrajectoryFactory.cc.

Referenced by CombinedTrajectoryFactory(), and trajectories().