CMS 3D CMS Logo

ProcSplitter.cc
Go to the documentation of this file.
1 #include <iostream>
2 #include <vector>
3 #include <string>
4 
5 #include <xercesc/dom/DOM.hpp>
6 
8 
10 
13 
15 
16 using namespace PhysicsTools;
17 
18 namespace { // anonymous
19 
20 class ProcSplitter : public TrainProcessor {
21  public:
23 
24  ProcSplitter(const char *name, const AtomicId *id,
25  MVATrainer *trainer);
26  virtual ~ProcSplitter();
27 
28  virtual void configure(DOMElement *elem) override;
29  virtual Calibration::VarProcessor *getCalibration() const override;
30 
31  private:
32  unsigned int count;
33 };
34 
35 static ProcSplitter::Registry registry("ProcSplitter");
36 
37 ProcSplitter::ProcSplitter(const char *name, const AtomicId *id,
38  MVATrainer *trainer) :
39  TrainProcessor(name, id, trainer)
40 {
41 }
42 
43 ProcSplitter::~ProcSplitter()
44 {
45 }
46 
47 void ProcSplitter::configure(DOMElement *elem)
48 {
49  DOMNode *node = elem->getFirstChild();
50  while(node && node->getNodeType() != DOMNode::ELEMENT_NODE)
51  node = node->getNextSibling();
52 
53  if (!node ||
54  std::strcmp(XMLSimpleStr(node->getNodeName()), "select") != 0)
55  throw cms::Exception("ProcSplitter")
56  << "Expected select tag in config section."
57  << std::endl;
58 
59  elem = static_cast<DOMElement*>(node);
60 
61  count = XMLDocument::readAttribute<unsigned int>(elem, "first");
62 
63  node = node->getNextSibling();
64  while(node && node->getNodeType() != DOMNode::ELEMENT_NODE)
65  node = node->getNextSibling();
66 
67  if (node)
68  throw cms::Exception("ProcSplitter")
69  << "Superfluous tags in config section."
70  << std::endl;
71 
72  trained = true;
73 }
74 
75 Calibration::VarProcessor *ProcSplitter::getCalibration() const
76 {
78  calib->nFirst = count;
79  return calib;
80 }
81 
82 } // anonymous namespace
template to generate a registry singleton for a type.
Cheap generic unique keyword identifier class.
Definition: AtomicId.h:31
MVATrainerComputer * calib
Definition: MVATrainer.cc:64
def elem(elemtype, innerHTML='', html_class='', kwargs)
Definition: HTMLExport.py:18
static Interceptor::Registry registry("Interceptor")