CMS 3D CMS Logo

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=false) const
 
std::vector< OpticalObject * > findOptOs (const ALIstring &name, bool exists=false) 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 = nullptr
 

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.

References getInstance().

25 { };

Member Function Documentation

ALIuint OpticalObjectMgr::buildCmsSwID ( )

Definition at line 85 of file OpticalObjectMgr.cc.

References theLastCmsSwID.

Referenced by registerMe().

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(), dataset::name, nullptr, Model::OptOList(), and theOptODict.

Referenced by Fit::dumpEntryCorrelations(), and registerMe().

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: " );
78  if( (*vocite)->parent() != nullptr ) ALIUtils::dump3v( (*vocite)->centreLocal(), name + " CENTRE LOCAL: " ); //not for the 'system'
79  }
80 
81 }
#define nullptr
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:32
std::string ALIstring
Definition: CocoaGlobals.h:9
OpticalObject * OpticalObjectMgr::findOptO ( const ALIstring longName,
bool  exists = false 
) const

Definition at line 21 of file OpticalObjectMgr.cc.

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

Referenced by registerMe().

22 {
23  OpticalObject* opto = nullptr;
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 = false 
) const

Definition at line 42 of file OpticalObjectMgr.cc.

References MessageLogger_cfi::cerr, cmsRelvalreport::exit, heppy_report::oname, and theOptODict.

Referenced by registerMe().

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.empty() ) {
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(), OpticalObject::OpticalObject(), and ~OpticalObjectMgr().

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

Member Data Documentation

OpticalObjectMgr * OpticalObjectMgr::theInstance = nullptr
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().