#include <AlignSetup.h>
Public Member Functions | |
AlignSetup () | |
Constructor. | |
void | dump (void) const |
Print the name of all stored data. | |
Type & | find (const std::string &name="") |
Type & | get (const std::string &name="") |
Private Types | |
typedef std::map< std::string, Type > | Container |
Private Attributes | |
Container | theStore |
A helper class to hold objects used by modules in alignment.
AlignSetup has a template parameter to specify the type of objects it holds. Objects are stored in a map<string, Type>. Users put/get an object by passing its name through the static methods put()/get(). It returns 0 if the name is not found on get(). It throws an exception if an object of the same name exists on put().
Definition at line 26 of file AlignSetup.h.
typedef std::map<std::string, Type> AlignSetup< Type >::Container [private] |
Definition at line 28 of file AlignSetup.h.
AlignSetup< Type >::AlignSetup | ( | ) | [inline] |
void AlignSetup< Type >::dump | ( | void | ) | const |
Print the name of all stored data.
Definition at line 76 of file AlignSetup.h.
{ edm::LogInfo("AlignSetup") << "Printing out AlignSetup: "; for ( typename Container::const_iterator it = theStore.begin(); it != theStore.end(); ++it ) { edm::LogVerbatim("AlignSetup") << it->first << std::endl; } }
Type & AlignSetup< Type >::find | ( | const std::string & | name = "" | ) |
Find and return an object from map using its name. Throw an exception if the name does not exist.
Definition at line 58 of file AlignSetup.h.
References Exception, and connectstrParser::o.
Referenced by AlignableBuilder::build(), AlignableTracker::buildBarrel(), AlignableTracker::buildTRK(), AlignableTracker::subStructures(), and AlignableExtras::subStructures().
{ typename Container::iterator o = theStore.find(name); if (theStore.end() == o) { std::ostringstream knownKeys; for (typename Container::const_iterator it = theStore.begin(); it != theStore.end(); ++it) { knownKeys << (it != theStore.begin() ? ", " : "") << it->first; } throw cms::Exception("AlignSetupError") << "Cannot find an object of name " << name << " in AlignSetup, know only " << knownKeys.str() << "."; } return o->second; }
Type & AlignSetup< Type >::get | ( | const std::string & | name = "" | ) |
Get an object from map using its name. A new object is default-constructed if the name does not exist.
Definition at line 52 of file AlignSetup.h.
References AlCaRecoCosmics_cfg::name.
Referenced by AlignableExtras::AlignableExtras(), AlignableBuilder::build(), AlignableTracker::buildBarrel(), AlignableTracker::buildTRK(), and AlignableTracker::detsToAlignables().
Container AlignSetup< Type >::theStore [private] |
Definition at line 47 of file AlignSetup.h.