CMS 3D CMS Logo

OpticalObjectMgr.cc
Go to the documentation of this file.
4 #include <cstdlib>
5 
7 
8 //-----------------------------------------------------------------------
10  if (!theInstance) {
13  // theInstance->verbose = ALIUtils::verbosity();
14  }
15  return theInstance;
16 }
17 
18 //-----------------------------------------------------------------------
19 OpticalObject* OpticalObjectMgr::findOptO(const ALIstring& longName, bool exists) const {
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 }
35 
36 //-----------------------------------------------------------------------
37 std::vector<OpticalObject*> OpticalObjectMgr::findOptOs(const ALIstring& name, bool exists) const {
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 }
61 
62 //-----------------------------------------------------------------------
63 void OpticalObjectMgr::dumpOptOs(std::ostream& out) const {
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 }
73 
74 //-----------------------------------------------------------------------
OpticalObjectMgr::buildCmsSwID
ALIuint buildCmsSwID()
Definition: OpticalObjectMgr.cc:75
Model.h
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
OpticalObjectMgr
Definition: OpticalObjectMgr.h:19
Model::OptOList
static std::vector< OpticalObject * > & OptOList()
Definition: Model.h:84
OpticalObjectMgr::OpticalObjectMgr
OpticalObjectMgr()
Definition: OpticalObjectMgr.h:21
ALIUtils.h
OpticalObjectMgr::getInstance
static OpticalObjectMgr * getInstance()
Get the only instance.
Definition: OpticalObjectMgr.cc:9
beam_dqm_sourceclient-live_cfg.cerr
cerr
Definition: beam_dqm_sourceclient-live_cfg.py:17
OpticalObjectMgr::theInstance
static OpticalObjectMgr * theInstance
Definition: OpticalObjectMgr.h:39
ALIuint
unsigned int ALIuint
Definition: CocoaGlobals.h:17
OpticalObjectMgr::findOptOs
std::vector< OpticalObject * > findOptOs(const ALIstring &name, bool exists=false) const
Definition: OpticalObjectMgr.cc:37
ALIUtils::dump3v
static void dump3v(const CLHEP::Hep3Vector &vec, const std::string &msg)
Definition: ALIUtils.cc:58
OpticalObjectMgr::dumpOptOs
void dumpOptOs(std::ostream &out=std::cout) const
Definition: OpticalObjectMgr.cc:63
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
OpticalObjectMgr::findOptO
OpticalObject * findOptO(const ALIstring &longName, bool exists=false) const
Definition: OpticalObjectMgr.cc:19
beamvalidation.exit
def exit(msg="")
Definition: beamvalidation.py:53
OpticalObjectMgr::theLastCmsSwID
ALIuint theLastCmsSwID
Definition: OpticalObjectMgr.h:41
OpticalObjectMgr.h
heppy_report.oname
oname
Definition: heppy_report.py:58
begin
#define begin
Definition: vmac.h:32