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 19 of file OpticalObjectMgr.h.

Constructor & Destructor Documentation

◆ OpticalObjectMgr()

OpticalObjectMgr::OpticalObjectMgr ( )
inline

Definition at line 21 of file OpticalObjectMgr.h.

21 {};

Referenced by getInstance().

◆ ~OpticalObjectMgr()

OpticalObjectMgr::~OpticalObjectMgr ( )
inline

Definition at line 22 of file OpticalObjectMgr.h.

22 {};

Member Function Documentation

◆ buildCmsSwID()

ALIuint OpticalObjectMgr::buildCmsSwID ( )

Definition at line 75 of file OpticalObjectMgr.cc.

75 { return theLastCmsSwID++; }

References theLastCmsSwID.

◆ dumpOptOs()

void OpticalObjectMgr::dumpOptOs ( std::ostream &  out = std::cout) const

Definition at line 63 of file OpticalObjectMgr.cc.

63  {
64  std::cout << "OPTICALOBJECT list size " << theOptODict.size() << std::endl;
65  std::vector<OpticalObject*>::const_iterator vocite;
66  for (vocite = Model::OptOList().begin(); vocite != Model::OptOList().end(); ++vocite) {
67  ALIstring name = (*vocite)->name();
68  ALIUtils::dump3v((*vocite)->centreGlobal(), name + " CENTRE GLOBAL: ");
69  if ((*vocite)->parent() != nullptr)
70  ALIUtils::dump3v((*vocite)->centreLocal(), name + " CENTRE LOCAL: "); //not for the 'system'
71  }
72 }

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

Referenced by Fit::dumpEntryCorrelations().

◆ findOptO()

OpticalObject * OpticalObjectMgr::findOptO ( const ALIstring longName,
bool  exists = false 
) const

Definition at line 19 of file OpticalObjectMgr.cc.

19  {
20  OpticalObject* opto = nullptr;
21  msopto::const_iterator cite = theOptODict.find(longName);
22  if (cite == theOptODict.end()) {
23  if (exists) {
24  std::cerr << "!!!! EXITING: OptO not found: " << longName << std::endl;
25  exit(1);
26  } else {
27  std::cerr << "!! WARNING: OptO not found: " << longName << std::endl;
28  }
29  } else {
30  opto = (*cite).second;
31  }
32 
33  return opto;
34 }

References EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0::cerr, beamvalidation::exit(), and theOptODict.

◆ findOptOs()

std::vector< OpticalObject * > OpticalObjectMgr::findOptOs ( const ALIstring name,
bool  exists = false 
) const

Definition at line 37 of file OpticalObjectMgr.cc.

37  {
38  std::vector<OpticalObject*> vopto;
39  msopto::const_iterator cite;
40  //----- Look for OptO's that contains 'name' in its longName as the last word (after the last '/')
41  for (cite = theOptODict.begin(); cite != theOptODict.end(); ++cite) {
42  ALIstring oname = (*cite).first;
43  int nf = oname.rfind(name);
44  int sf = oname.rfind('/');
45  if (nf != -1 && sf <= nf) {
46  vopto.push_back((*cite).second);
47  }
48  }
49 
50  if (vopto.empty()) {
51  if (exists) {
52  std::cerr << "!!!! EXITING: OptO not found: " << name << std::endl;
53  exit(1);
54  } else {
55  std::cerr << "!! WARNING: OptO not found: " << name << std::endl;
56  }
57  }
58 
59  return vopto;
60 }

References EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0::cerr, beamvalidation::exit(), Skims_PA_cff::name, heppy_report::oname, and theOptODict.

◆ getInstance()

OpticalObjectMgr * OpticalObjectMgr::getInstance ( )
static

Get the only instance.

Definition at line 9 of file OpticalObjectMgr.cc.

9  {
10  if (!theInstance) {
13  // theInstance->verbose = ALIUtils::verbosity();
14  }
15  return theInstance;
16 }

References OpticalObjectMgr(), theInstance, and theLastCmsSwID.

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

◆ registerMe()

void OpticalObjectMgr::registerMe ( OpticalObject opto)
inline

Definition at line 28 of file OpticalObjectMgr.h.

28 { theOptODict[opto->longName()] = opto; }

References OpticalObject::longName(), and theOptODict.

Referenced by OpticalObject::OpticalObject().

Member Data Documentation

◆ theInstance

OpticalObjectMgr * OpticalObjectMgr::theInstance = nullptr
staticprivate

Definition at line 39 of file OpticalObjectMgr.h.

Referenced by getInstance().

◆ theLastCmsSwID

ALIuint OpticalObjectMgr::theLastCmsSwID
private

Definition at line 41 of file OpticalObjectMgr.h.

Referenced by buildCmsSwID(), and getInstance().

◆ theOptODict

msopto OpticalObjectMgr::theOptODict
private

Definition at line 40 of file OpticalObjectMgr.h.

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

OpticalObject::longName
const ALIstring longName() const
Definition: OpticalObject.h:196
gather_cfg.cout
cout
Definition: gather_cfg.py:144
ALIstring
std::string ALIstring
Definition: CocoaGlobals.h:9
OpticalObject
Definition: OpticalObject.h:35
OpticalObjectMgr::theOptODict
msopto theOptODict
Definition: OpticalObjectMgr.h:40
Model::OptOList
static std::vector< OpticalObject * > & OptOList()
Definition: Model.h:84
OpticalObjectMgr::OpticalObjectMgr
OpticalObjectMgr()
Definition: OpticalObjectMgr.h:21
OpticalObjectMgr::theInstance
static OpticalObjectMgr * theInstance
Definition: OpticalObjectMgr.h:39
ALIUtils::dump3v
static void dump3v(const CLHEP::Hep3Vector &vec, const std::string &msg)
Definition: ALIUtils.cc:58
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
beamvalidation.exit
def exit(msg="")
Definition: beamvalidation.py:52
OpticalObjectMgr::theLastCmsSwID
ALIuint theLastCmsSwID
Definition: OpticalObjectMgr.h:41
EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.cerr
cerr
Definition: EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.py:8
heppy_report.oname
oname
Definition: heppy_report.py:57