CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Member Functions | Private Attributes | Static Private Attributes
OpticalObjectMgr Class Reference

#include <OpticalObjectMgr.h>

Public Member Functions

ALIuint buildCmsSwID ()
 
void dumpOptOs (std::ostream &out=std::cout) const
 
OpticalObjectfindOptO (const ALIstring &longName, bool exists=0) const
 
std::vector< OpticalObject * > findOptOs (const ALIstring &name, bool exists=0) const
 
 OpticalObjectMgr ()
 
void registerMe (OpticalObject *opto)
 
 ~OpticalObjectMgr ()
 

Static Public Member Functions

static OpticalObjectMgrgetInstance ()
 Get the only instance. More...
 

Private Attributes

ALIuint theLastCmsSwID
 
msopto theOptODict
 

Static Private Attributes

static OpticalObjectMgrtheInstance = 0
 

Detailed Description

Definition at line 20 of file OpticalObjectMgr.h.

Constructor & Destructor Documentation

OpticalObjectMgr::OpticalObjectMgr ( )
inline

Definition at line 24 of file OpticalObjectMgr.h.

Referenced by getInstance().

24 { };
OpticalObjectMgr::~OpticalObjectMgr ( )
inline

Definition at line 25 of file OpticalObjectMgr.h.

25 { };

Member Function Documentation

ALIuint OpticalObjectMgr::buildCmsSwID ( )

Definition at line 85 of file OpticalObjectMgr.cc.

References theLastCmsSwID.

86 {
87  return theLastCmsSwID++;
88 }
void OpticalObjectMgr::dumpOptOs ( std::ostream &  out = std::cout) const

Definition at line 71 of file OpticalObjectMgr.cc.

References begin, gather_cfg::cout, ALIUtils::dump3v(), mergeVDriftHistosByStation::name, Model::OptOList(), and theOptODict.

Referenced by Fit::dumpEntryCorrelations().

72 {
73  std::cout << "OPTICALOBJECT list size " << theOptODict.size() << std::endl;
74  std::vector< OpticalObject* >::const_iterator vocite;
75  for( vocite = Model::OptOList().begin(); vocite != Model::OptOList().end(); vocite++ ) {
76  ALIstring name = (*vocite)->name();
77  ALIUtils::dump3v( (*vocite)->centreGlobal(), (name + " CENTRE GLOBAL: ").c_str() );
78  if( (*vocite)->parent() != 0 ) ALIUtils::dump3v( (*vocite)->centreLocal(), (name + " CENTRE LOCAL: ").c_str() ); //not for the 'system'
79  }
80 
81 }
static std::vector< OpticalObject * > & OptOList()
Definition: Model.h:71
static void dump3v(const CLHEP::Hep3Vector &vec, const std::string &msg)
Definition: ALIUtils.cc:61
#define begin
Definition: vmac.h:30
std::string ALIstring
Definition: CocoaGlobals.h:9
tuple cout
Definition: gather_cfg.py:121
OpticalObject * OpticalObjectMgr::findOptO ( const ALIstring longName,
bool  exists = 0 
) const

Definition at line 21 of file OpticalObjectMgr.cc.

References dtNoiseDBValidation_cfg::cerr, cmsRelvalreport::exit, and theOptODict.

22 {
23  OpticalObject* opto = 0;
24  msopto::const_iterator cite = theOptODict.find( longName );
25  if( cite == theOptODict.end() ) {
26  if( exists ) {
27  std::cerr << "!!!! EXITING: OptO not found: " << longName << std::endl;
28  exit(1);
29  } else {
30  std::cerr << "!! WARNING: OptO not found: " << longName << std::endl;
31  }
32  } else {
33  opto = (*cite).second;
34  }
35 
36  return opto;
37 
38 }
std::vector< OpticalObject * > OpticalObjectMgr::findOptOs ( const ALIstring name,
bool  exists = 0 
) const

Definition at line 42 of file OpticalObjectMgr.cc.

References dtNoiseDBValidation_cfg::cerr, cmsRelvalreport::exit, and theOptODict.

43 {
44  std::vector<OpticalObject*> vopto;
45  msopto::const_iterator cite;
46  //----- Look for OptO's that contains 'name' in its longName as the last word (after the last '/')
47  for( cite = theOptODict.begin(); cite != theOptODict.end(); cite++ ) {
48  ALIstring oname = (*cite).first;
49  int nf = oname.rfind( name );
50  int sf = oname.rfind( '/' );
51  if( nf != -1 && sf <= nf ) {
52  vopto.push_back( (*cite).second );
53  }
54  }
55 
56  if( vopto.size() == 0 ) {
57  if( exists ) {
58  std::cerr << "!!!! EXITING: OptO not found: " << name << std::endl;
59  exit(1);
60  } else {
61  std::cerr << "!! WARNING: OptO not found: " << name << std::endl;
62  }
63  }
64 
65  return vopto;
66 
67 }
std::string ALIstring
Definition: CocoaGlobals.h:9
OpticalObjectMgr * OpticalObjectMgr::getInstance ( )
static

Get the only instance.

Definition at line 9 of file OpticalObjectMgr.cc.

References OpticalObjectMgr(), theInstance, and theLastCmsSwID.

Referenced by OpticalObject::createComponentOptOs(), Fit::dumpEntryCorrelations(), and OpticalObject::OpticalObject().

10 {
11  if( !theInstance ) {
14  // theInstance->verbose = ALIUtils::verbosity();
15  }
16  return theInstance;
17 }
static OpticalObjectMgr * theInstance
void OpticalObjectMgr::registerMe ( OpticalObject opto)
inline

Definition at line 31 of file OpticalObjectMgr.h.

References OpticalObject::longName(), and theOptODict.

Referenced by OpticalObject::OpticalObject().

31  {
32  theOptODict[opto->longName()] = opto;
33  }
const ALIstring longName() const

Member Data Documentation

OpticalObjectMgr * OpticalObjectMgr::theInstance = 0
staticprivate

Definition at line 44 of file OpticalObjectMgr.h.

Referenced by getInstance().

ALIuint OpticalObjectMgr::theLastCmsSwID
private

Definition at line 46 of file OpticalObjectMgr.h.

Referenced by buildCmsSwID(), and getInstance().

msopto OpticalObjectMgr::theOptODict
private

Definition at line 45 of file OpticalObjectMgr.h.

Referenced by dumpOptOs(), findOptO(), findOptOs(), and registerMe().