CMS 3D CMS Logo

DDLAlgorithm.cc
Go to the documentation of this file.
11 
12 #include <cstddef>
13 #include <map>
14 #include <utility>
15 
16 class DDCompactView;
17 
19 
21  myRegistry_->getElement("Vector")->clear();
22 }
23 
25  auto myNumeric = myRegistry_->getElement("Numeric");
26  auto myString = myRegistry_->getElement("String");
27  auto myVector = myRegistry_->getElement("Vector");
28  auto myMap = myRegistry_->getElement("Map");
29  auto myrParent = myRegistry_->getElement("rParent");
30 
31  DDName algoName(getDDName(nmspace));
32  DDLogicalPart lp(DDName(myrParent->getDDName(nmspace)));
33  DDXMLAttribute atts;
34 
35  // handle all Numeric elements in the Algorithm.
36  DDNumericArguments nArgs;
37  size_t i = 0;
38  for (; i < myNumeric->size(); ++i) {
39  atts = myNumeric->getAttributeSet(i);
40  nArgs[atts.find("name")->second] = myRegistry_->evaluator().eval(nmspace, atts.find("value")->second);
41  }
42 
43  DDStringArguments sArgs;
44  for (i = 0; i < myString->size(); ++i) {
45  atts = myString->getAttributeSet(i);
46  sArgs[atts.find("name")->second] = atts.find("value")->second;
47  }
48 
49  DDAlgorithmHandler handler;
50  atts = getAttributeSet();
51  handler.initialize(algoName,
52  lp,
53  nArgs,
54  static_cast<DDLVector*>(myVector.get())->getMapOfVectors(),
55  static_cast<DDLMap*>(myMap.get())->getMapOfMaps(),
56  sArgs,
57  static_cast<DDLVector*>(myVector.get())->getMapOfStrVectors());
58  handler.execute(cpv);
59 
60  // clear used/referred to elements.
61  myString->clear();
62  myNumeric->clear();
63  myVector->clear();
64  myMap->clear();
65  myrParent->clear();
66  clear();
67 }
DDXMLElement::clear
virtual void clear(void)
clear this element's contents.
Definition: DDXMLElement.cc:40
mps_fire.i
i
Definition: mps_fire.py:428
DDLMap.h
DDName
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:15
ClhepEvaluator.h
DDLAlgorithm::DDLAlgorithm
DDLAlgorithm(DDLElementRegistry *myreg)
Definition: DDLAlgorithm.cc:18
HIPAlignmentAlgorithm_cfi.algoName
algoName
Definition: HIPAlignmentAlgorithm_cfi.py:5
DDLElementRegistry
The main class for processing parsed elements.
Definition: DDLElementRegistry.h:23
DDLAlgorithm.h
DDAlgorithmHandler::execute
void execute(DDCompactView &)
executes the wrapped algorithm algo_; some pre- and post-processing (exception handling)
Definition: DDAlgorithmHandler.cc:20
DDAlgorithmHandler.h
DDXMLElement::getAttributeSet
virtual const DDXMLAttribute & getAttributeSet(size_t aIndex=0) const
Get a "row" of attributes, i.e. one attribute set.
Definition: DDXMLElement.cc:54
DDLElementRegistry::evaluator
ClhepEvaluator & evaluator()
Definition: DDLElementRegistry.h:42
DDCompactView
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:81
DDXMLAttribute
std::map< std::string, std::string > DDXMLAttribute
Definition: DDXMLElement.h:45
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
DDAlgorithmHandler
wrapper around a DDAlgorithm
Definition: DDAlgorithmHandler.h:15
DDLAlgorithm::preProcessElement
void preProcessElement(const std::string &name, const std::string &nmspace, DDCompactView &cpv) override
Called by loadAttributes AFTER attributes are loaded.
Definition: DDLAlgorithm.cc:20
DDLogicalPart
A DDLogicalPart aggregates information concerning material, solid and sensitveness ....
Definition: DDLogicalPart.h:93
DDTypes.h
DDXMLElement
This is a base class for processing XML elements in the DDD.
Definition: DDXMLElement.h:48
DDLVector.h
DDLElementRegistry.h
DDLogicalPart.h
DDXMLElement::getDDName
const virtual DDName getDDName(const std::string &defaultNS, const std::string &attname=std::string("name"), size_t aIndex=0)
Definition: DDXMLElement.cc:56
ReadMapType< double >
DDLElementRegistry::getElement
std::shared_ptr< DDXMLElement > getElement(const std::string &name)
THE most important part. Getting the pointer to a given element type.
Definition: DDLElementRegistry.cc:42
DDLAlgorithm::processElement
void processElement(const std::string &name, const std::string &nmspace, DDCompactView &cpv) override
Processing the element.
Definition: DDLAlgorithm.cc:24
DDXMLElement.h
DDName.h
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
DDXMLElement::myRegistry_
DDLElementRegistry * myRegistry_
Definition: DDXMLElement.h:173
DDAlgorithmHandler::initialize
void initialize(const DDName &algoName, const DDLogicalPart &parent, const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &svArgs)
initializes the wrapped algorithm algo_ and does some pre- and post-processing
Definition: DDAlgorithmHandler.cc:8
ClhepEvaluator::eval
double eval(const std::string &ns, const std::string &expr)
Definition: ClhepEvaluator.cc:85