#include <Alignment/ReferenceTrajectories/plugins/CombinedTrajectoryFactory.h>
Public Member Functions | |
virtual CombinedTrajectoryFactory * | clone (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 |
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.
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] |
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 }
std::vector<TrajectoryFactoryBase*> CombinedTrajectoryFactory::theFactories [private] |
Definition at line 39 of file CombinedTrajectoryFactory.h.
Referenced by CombinedTrajectoryFactory(), and trajectories().