CMS 3D CMS Logo

CombinedTrajectoryFactory Class Reference

A factory that can combine the functionality of several 'trajectory factories'. More...

#include <Alignment/ReferenceTrajectories/plugins/CombinedTrajectoryFactory.h>

Inheritance diagram for CombinedTrajectoryFactory:

TrajectoryFactoryBase

List of all members.

Public Member Functions

virtual CombinedTrajectoryFactoryclone (void) const
 CombinedTrajectoryFactory (const edm::ParameterSet &config)
virtual const
ReferenceTrajectoryCollection 
trajectories (const edm::EventSetup &setup, const ConstTrajTrackPairCollection &tracks, const ExternalPredictionCollection &external) const
virtual const
ReferenceTrajectoryCollection 
trajectories (const edm::EventSetup &setup, const ConstTrajTrackPairCollection &tracks) const
virtual ~CombinedTrajectoryFactory (void)

Private Attributes

std::vector
< TrajectoryFactoryBase * > 
theFactories
bool theUseAllFactories


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 20 of file CombinedTrajectoryFactory.h.


Constructor & Destructor Documentation

CombinedTrajectoryFactory::CombinedTrajectoryFactory ( const edm::ParameterSet config  ) 

Definition at line 13 of file CombinedTrajectoryFactory.cc.

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

Referenced by clone().

00013                                                                                      :
00014   TrajectoryFactoryBase( config ), theUseAllFactories(config.getParameter<bool>("useAllFactories"))
00015 {
00016   vector<string> factoryNames = config.getParameter< vector<string> >( "TrajectoryFactoryNames" );
00017   vector<string>::iterator itFactoryName;
00018   for ( itFactoryName = factoryNames.begin(); itFactoryName != factoryNames.end(); ++itFactoryName )
00019   {
00020     TObjArray *namePset = TString((*itFactoryName).c_str()).Tokenize(",");
00021     if (namePset->GetEntriesFast() != 2) {
00022       throw cms::Exception("BadConfig") << "@SUB=CombinedTrajectoryFactory"
00023                                         << "TrajectoryFactoryNames must contain 2 comma "
00024                                         << "separated strings, but is '" << *itFactoryName << "'";
00025     }
00026     const edm::ParameterSet factoryCfg 
00027       = config.getParameter<edm::ParameterSet>(namePset->At(1)->GetName());
00028     theFactories.push_back(TrajectoryFactoryPlugin::get()->create(namePset->At(0)->GetName(),
00029                                                                   factoryCfg));
00030 
00031     delete namePset;
00032   }
00033 }

CombinedTrajectoryFactory::~CombinedTrajectoryFactory ( void   )  [virtual]

Definition at line 36 of file CombinedTrajectoryFactory.cc.

00036 {}


Member Function Documentation

virtual CombinedTrajectoryFactory* CombinedTrajectoryFactory::clone ( void   )  const [inline, virtual]

Implements TrajectoryFactoryBase.

Definition at line 35 of file CombinedTrajectoryFactory.h.

References CombinedTrajectoryFactory().

00035 { return new CombinedTrajectoryFactory( *this ); }

const CombinedTrajectoryFactory::ReferenceTrajectoryCollection CombinedTrajectoryFactory::trajectories ( const edm::EventSetup setup,
const ConstTrajTrackPairCollection tracks,
const ExternalPredictionCollection external 
) const [virtual]

Definition at line 59 of file CombinedTrajectoryFactory.cc.

References theFactories, theUseAllFactories, and trajectories().

00062 {
00063   ReferenceTrajectoryCollection trajectories;
00064   ReferenceTrajectoryCollection tmpTrajectories; // outside loop for efficiency
00065 
00066   vector< TrajectoryFactoryBase* >::const_iterator itFactory;
00067   for ( itFactory = theFactories.begin(); itFactory != theFactories.end(); ++itFactory )
00068   {
00069     tmpTrajectories = ( *itFactory )->trajectories( setup, tracks, external );
00070     trajectories.insert(trajectories.end(), tmpTrajectories.begin(), tmpTrajectories.end());
00071 
00072     if (!theUseAllFactories && !trajectories.empty()) break;
00073   }
00074 
00075   return trajectories;
00076 }

const CombinedTrajectoryFactory::ReferenceTrajectoryCollection CombinedTrajectoryFactory::trajectories ( const edm::EventSetup setup,
const ConstTrajTrackPairCollection tracks 
) const [virtual]

Definition at line 40 of file CombinedTrajectoryFactory.cc.

References theFactories, and theUseAllFactories.

Referenced by trajectories().

00042 {
00043   ReferenceTrajectoryCollection trajectories;
00044   ReferenceTrajectoryCollection tmpTrajectories; // outside loop for efficiency
00045 
00046   vector< TrajectoryFactoryBase* >::const_iterator itFactory;
00047   for ( itFactory = theFactories.begin(); itFactory != theFactories.end(); ++itFactory )
00048   {
00049     tmpTrajectories = ( *itFactory )->trajectories( setup, tracks );
00050     trajectories.insert(trajectories.end(), tmpTrajectories.begin(), tmpTrajectories.end());
00051 
00052     if (!theUseAllFactories && !trajectories.empty()) break;
00053   }
00054 
00055   return trajectories;
00056 }


Member Data Documentation

std::vector<TrajectoryFactoryBase*> CombinedTrajectoryFactory::theFactories [private]

Definition at line 39 of file CombinedTrajectoryFactory.h.

Referenced by CombinedTrajectoryFactory(), and trajectories().

bool CombinedTrajectoryFactory::theUseAllFactories [private]

Definition at line 40 of file CombinedTrajectoryFactory.h.

Referenced by trajectories().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:16:31 2009 for CMSSW by  doxygen 1.5.4