CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Static Public Attributes | Protected Member Functions | Private Types | Private Member Functions | Private Attributes
CTPPSPixelDAQMappingESSourceXML Class Reference

Loads CTPPSPixelDAQMapping and CTPPSPixelAnalysisMask from two XML files. More...

Inheritance diagram for CTPPSPixelDAQMappingESSourceXML:
edm::ESProducer edm::EventSetupRecordIntervalFinder edm::ESProxyFactoryProducer edm::eventsetup::DataProxyProvider

Classes

struct  ConfigBlock
 

Public Member Functions

 CTPPSPixelDAQMappingESSourceXML (const edm::ParameterSet &)
 
std::unique_ptr< CTPPSPixelAnalysisMaskproduceCTPPSPixelAnalysisMask (const CTPPSPixelAnalysisMaskRcd &)
 
std::unique_ptr< CTPPSPixelDAQMappingproduceCTPPSPixelDAQMapping (const CTPPSPixelDAQMappingRcd &)
 
 ~CTPPSPixelDAQMappingESSourceXML () override
 
- Public Member Functions inherited from edm::ESProducer
 ESProducer ()
 
 ~ESProducer ()(false) override
 
- Public Member Functions inherited from edm::ESProxyFactoryProducer
 ESProxyFactoryProducer ()
 
void newInterval (const eventsetup::EventSetupRecordKey &iRecordType, const ValidityInterval &iInterval) override
 overrides DataProxyProvider method More...
 
 ~ESProxyFactoryProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::eventsetup::DataProxyProvider
 DataProxyProvider ()
 
const ComponentDescriptiondescription () const
 
bool isUsingRecord (const EventSetupRecordKey &) const
 
const KeyedProxieskeyedProxies (const EventSetupRecordKey &iRecordKey) const
 
void resetProxies (const EventSetupRecordKey &iRecordType)
 
void resetProxiesIfTransient (const EventSetupRecordKey &iRecordType)
 
void setAppendToDataLabel (const edm::ParameterSet &)
 
void setDescription (const ComponentDescription &iDescription)
 
std::set< EventSetupRecordKeyusingRecords () const
 
virtual ~DataProxyProvider () noexcept(false)
 
- Public Member Functions inherited from edm::EventSetupRecordIntervalFinder
const eventsetup::ComponentDescriptiondescriptionForFinder () const
 
 EventSetupRecordIntervalFinder ()
 
std::set< eventsetup::EventSetupRecordKeyfindingForRecords () const
 
const ValidityIntervalfindIntervalFor (const eventsetup::EventSetupRecordKey &, const IOVSyncValue &)
 
void setDescriptionForFinder (const eventsetup::ComponentDescription &iDescription)
 
virtual ~EventSetupRecordIntervalFinder () noexcept(false)
 

Static Public Attributes

static const std::string tagAnalysisMask ="analysisMask"
 
static const std::string tagArm = "arm"
 Common position tags. More...
 
static const std::string tagPixel ="pixel"
 
static const std::string tagROC ="roc"
 
static const std::string tagRPixPlane = "rpix_plane"
 
static const std::string tagRPPot = "rp_detector_set"
 
static const std::string tagRPStation = "station"
 RP XML tags. More...
 

Protected Member Functions

void setIntervalFor (const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &) override
 sets infinite validity of this data More...
 
- Protected Member Functions inherited from edm::ESProducer
template<typename T >
void setWhatProduced (T *iThis, const es::Label &iLabel=es::Label())
 
template<typename T >
void setWhatProduced (T *iThis, const char *iLabel)
 
template<typename T >
void setWhatProduced (T *iThis, const std::string &iLabel)
 
template<typename T , typename TDecorator >
void setWhatProduced (T *iThis, const TDecorator &iDec, const es::Label &iLabel=es::Label())
 
template<typename T , typename TReturn , typename TRecord >
void setWhatProduced (T *iThis, TReturn(T::*iMethod)(const TRecord &), const es::Label &iLabel=es::Label())
 
template<typename T , typename TReturn , typename TRecord , typename TArg >
void setWhatProduced (T *iThis, TReturn(T::*iMethod)(const TRecord &), const TArg &iDec, const es::Label &iLabel=es::Label())
 
- Protected Member Functions inherited from edm::ESProxyFactoryProducer
template<class TFactory >
void registerFactory (std::unique_ptr< TFactory > iFactory, const std::string &iLabel=std::string())
 
virtual void registerFactoryWithKey (const eventsetup::EventSetupRecordKey &iRecord, std::unique_ptr< eventsetup::ProxyFactoryBase > iFactory, const std::string &iLabel=std::string())
 
void registerProxies (const eventsetup::EventSetupRecordKey &iRecord, KeyedProxies &aProxyList) override
 override DataProxyProvider method More...
 
- Protected Member Functions inherited from edm::eventsetup::DataProxyProvider
void eraseAll (const EventSetupRecordKey &iRecordKey)
 deletes all the Proxies in aStream More...
 
void invalidateProxies (const EventSetupRecordKey &iRecordKey)
 
template<class T >
void usingRecord ()
 
void usingRecordWithKey (const EventSetupRecordKey &)
 
- Protected Member Functions inherited from edm::EventSetupRecordIntervalFinder
template<class T >
void findingRecord ()
 
void findingRecordWithKey (const eventsetup::EventSetupRecordKey &)
 

Private Types

enum  NodeType {
  nUnknown, nSkip, nTop, nArm,
  nRPStation, nRPPot, nRPixPlane, nROC,
  nPixel
}
 enumeration of XML node types More...
 
enum  ParseType { pMapping, pMask }
 whether to parse a mapping of a mask XML More...
 

Private Member Functions

CTPPSPixelFramePosition ChipFramePosition (xercesc::DOMNode *chipnode)
 extracts VFAT's DAQ channel from XML attributes More...
 
string CompleteFileName (const string &fn)
 adds the path prefix, if needed More...
 
string GetNodeContent (xercesc::DOMNode *parent)
 returns the content of the node More...
 
NodeType GetNodeType (xercesc::DOMNode *)
 determines node type More...
 
string GetNodeValue (xercesc::DOMNode *node)
 returns the value of the node More...
 
void GetPixels (xercesc::DOMNode *n, std::set< std::pair< unsigned char, unsigned char > > &pixels)
 
void ParseTreePixel (ParseType, xercesc::DOMNode *, NodeType, unsigned int parentID, const std::unique_ptr< CTPPSPixelDAQMapping > &, const std::unique_ptr< CTPPSPixelAnalysisMask > &)
 recursive method to extract Pixel-related information from the DOM tree More...
 
void ParseXML (ParseType, const string &file, const std::unique_ptr< CTPPSPixelDAQMapping > &, const std::unique_ptr< CTPPSPixelAnalysisMask > &)
 parses XML file More...
 
bool PixelNode (NodeType type)
 
bool Test (xercesc::DOMNode *node, const std::string &name)
 returns true iff the node is of the given name More...
 

Private Attributes

vector< ConfigBlockconfiguration
 
unsigned int currentBlock
 index of the current block in 'configuration' array More...
 
bool currentBlockValid
 flag whether the 'currentBlock' index is valid More...
 
std::vector< std::string > mappingFileNames
 the mapping files More...
 
string subSystemName
 label of the CTPPS sub-system More...
 
unsigned int verbosity
 

Additional Inherited Members

- Public Types inherited from edm::eventsetup::DataProxyProvider
typedef std::vector< std::pair< DataKey, edm::propagate_const< std::shared_ptr< DataProxy > > > > KeyedProxies
 
typedef std::vector< EventSetupRecordKeyKeys
 
typedef std::map< EventSetupRecordKey, KeyedProxiesRecordProxies
 
- Static Public Member Functions inherited from edm::eventsetup::DataProxyProvider
static void prevalidate (ConfigurationDescriptions &)
 

Detailed Description

Loads CTPPSPixelDAQMapping and CTPPSPixelAnalysisMask from two XML files.

Definition at line 51 of file CTPPSPixelDAQMappingESSourceXML.cc.

Member Enumeration Documentation

whether to parse a mapping of a mask XML

Enumerator
pMapping 
pMask 

Definition at line 106 of file CTPPSPixelDAQMappingESSourceXML.cc.

Constructor & Destructor Documentation

CTPPSPixelDAQMappingESSourceXML::CTPPSPixelDAQMappingESSourceXML ( const edm::ParameterSet conf)

Definition at line 180 of file CTPPSPixelDAQMappingESSourceXML.cc.

References b, configuration, edm::ParameterSet::getParameter(), CTPPSPixelDAQMappingESSourceXML::ConfigBlock::mappingFileNames, CTPPSPixelDAQMappingESSourceXML::ConfigBlock::maskFileNames, produceCTPPSPixelAnalysisMask(), produceCTPPSPixelDAQMapping(), edm::ESProducer::setWhatProduced(), subSystemName, and CTPPSPixelDAQMappingESSourceXML::ConfigBlock::validityRange.

180  :
181  verbosity(conf.getUntrackedParameter<unsigned int>("verbosity", 0)),
182  subSystemName(conf.getUntrackedParameter<string>("subSystem")),
183  currentBlock(0),
184  currentBlockValid(false)
185 {
186  for (const auto it : conf.getParameter<vector<ParameterSet>>("configuration"))
187  {
188  ConfigBlock b;
189  b.validityRange = it.getParameter<EventRange>("validityRange");
190  b.mappingFileNames = it.getParameter< vector<string> >("mappingFileNames");
191  b.maskFileNames = it.getParameter< vector<string> >("maskFileNames");
192  configuration.push_back(b);
193  }
194 
196  findingRecord<CTPPSPixelAnalysisMaskRcd>();
197 
199  findingRecord<CTPPSPixelDAQMappingRcd>();
200 
201 
202  LogVerbatim("CTPPSPixelDAQMappingESSourceXML") << " Inside CTPPSPixelDAQMappingESSourceXML";
203 
204 
205 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
string subSystemName
label of the CTPPS sub-system
std::unique_ptr< CTPPSPixelAnalysisMask > produceCTPPSPixelAnalysisMask(const CTPPSPixelAnalysisMaskRcd &)
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
Definition: ESProducer.h:115
std::unique_ptr< CTPPSPixelDAQMapping > produceCTPPSPixelDAQMapping(const CTPPSPixelDAQMappingRcd &)
unsigned int currentBlock
index of the current block in &#39;configuration&#39; array
bool currentBlockValid
flag whether the &#39;currentBlock&#39; index is valid
double b
Definition: hdecay.h:120
CTPPSPixelDAQMappingESSourceXML::~CTPPSPixelDAQMappingESSourceXML ( )
override

Definition at line 251 of file CTPPSPixelDAQMappingESSourceXML.cc.

252 {
253 }

Member Function Documentation

CTPPSPixelFramePosition CTPPSPixelDAQMappingESSourceXML::ChipFramePosition ( xercesc::DOMNode *  chipnode)
private

extracts VFAT's DAQ channel from XML attributes

Definition at line 473 of file CTPPSPixelDAQMappingESSourceXML.cc.

References a, CTPPSPixelFramePosition::checkXMLAttributeFlag(), Exception, CTPPSPixelFramePosition::setXMLAttribute(), and cms::xerces::toString().

Referenced by ParseTreePixel().

474 {
476  unsigned char attributeFlag = 0;
477 
478  DOMNamedNodeMap* attr = chipnode->getAttributes();
479  for (unsigned int j = 0; j < attr->getLength(); j++)
480  {
481  DOMNode *a = attr->item(j);
482 
483  if (fp.setXMLAttribute(cms::xerces::toString(a->getNodeName()), cms::xerces::toString(a->getNodeValue()), attributeFlag) > 1)
484  {
485  throw cms::Exception("CTPPSPixelDAQMappingESSourceXML") <<
486  "Unrecognized tag `" << cms::xerces::toString(a->getNodeName()) <<
487  "' or incompatible value `" << cms::xerces::toString(a->getNodeValue()) <<
488  "'." << endl;
489  }
490  }
491 
492  if (!fp.checkXMLAttributeFlag(attributeFlag))
493  {
494  throw cms::Exception("CTPPSPixelDAQMappingESSourceXML") <<
495  "Wrong/incomplete DAQ channel specification (attributeFlag = " << attributeFlag << ")." << endl;
496  }
497 
498  return fp;
499 }
unsigned char setXMLAttribute(const std::string &attribute, const std::string &value, unsigned char &flag)
std::string toString(XMLCh const *toTranscode)
static bool checkXMLAttributeFlag(unsigned char flag)
returns true if all attributes have been set
double a
Definition: hdecay.h:121
string CTPPSPixelDAQMappingESSourceXML::CompleteFileName ( const string &  fn)
private

adds the path prefix, if needed

Definition at line 257 of file CTPPSPixelDAQMappingESSourceXML.cc.

References edm::FileInPath::fullPath().

Referenced by produceCTPPSPixelAnalysisMask(), and produceCTPPSPixelDAQMapping().

258 {
259  FileInPath fip(fn);
260  return fip.fullPath();
261 }
string CTPPSPixelDAQMappingESSourceXML::GetNodeContent ( xercesc::DOMNode *  parent)
inlineprivate

returns the content of the node

Definition at line 131 of file CTPPSPixelDAQMappingESSourceXML.cc.

References cms::xerces::toString().

132  {
133  return cms::xerces::toString(parent->getTextContent());
134  }
std::string toString(XMLCh const *toTranscode)
CTPPSPixelDAQMappingESSourceXML::NodeType CTPPSPixelDAQMappingESSourceXML::GetNodeType ( xercesc::DOMNode *  n)
private

determines node type

Definition at line 503 of file CTPPSPixelDAQMappingESSourceXML.cc.

References Exception, nArm, nROC, nRPixPlane, nRPPot, nRPStation, tagArm, tagROC, tagRPixPlane, tagRPPot, tagRPStation, Test(), and cms::xerces::toString().

Referenced by ParseTreePixel().

504 {
505 // common node types
506  if (Test(n, tagArm)) return nArm;
507  if (Test(n, tagROC)) return nROC;
508 
509 // RP node types
510  if (Test(n, tagRPStation)) return nRPStation;
511  if (Test(n, tagRPPot)) return nRPPot;
512  if (Test(n, tagRPixPlane)) return nRPixPlane;
513 
514  throw cms::Exception("CTPPSPixelDAQMappingESSourceXML::GetNodeType") << "Unknown tag `"
515  << cms::xerces::toString(n->getNodeName()) << "'.\n";
516 }
std::string toString(XMLCh const *toTranscode)
static const std::string tagRPStation
RP XML tags.
bool Test(xercesc::DOMNode *node, const std::string &name)
returns true iff the node is of the given name
static const std::string tagArm
Common position tags.
string CTPPSPixelDAQMappingESSourceXML::GetNodeValue ( xercesc::DOMNode *  node)
inlineprivate

returns the value of the node

Definition at line 137 of file CTPPSPixelDAQMappingESSourceXML.cc.

References gen::n, and cms::xerces::toString().

138  {
139  return cms::xerces::toString(node->getNodeValue());
140  }
std::string toString(XMLCh const *toTranscode)
void CTPPSPixelDAQMappingESSourceXML::GetPixels ( xercesc::DOMNode *  n,
std::set< std::pair< unsigned char, unsigned char > > &  pixels 
)
private

Definition at line 520 of file CTPPSPixelDAQMappingESSourceXML.cc.

References a, class-composition::children, cuy::col, DEFINE_FWK_EVENTSETUP_SOURCE, Exception, mps_fire::i, Test(), and cms::xerces::toString().

Referenced by ParseTreePixel().

521 {
522  DOMNodeList *children = n->getChildNodes();
523  for (unsigned int i = 0; i < children->getLength(); i++)
524  {
525  DOMNode *n = children->item(i);
526  if (n->getNodeType() != DOMNode::ELEMENT_NODE || !Test(n, "pixel"))
527  continue;
528 
529  DOMNamedNodeMap* attr = n->getAttributes();
530  bool pixelSet = false;
531  bool rowSet = false;
532  bool colSet = false;
533  std::pair<unsigned int, unsigned int> currentPixel;
534  for (unsigned int j = 0; j < attr->getLength(); j++)
535  {
536  DOMNode *a = attr->item(j);
537 
538  if (!strcmp(cms::xerces::toString(a->getNodeName()).c_str(), "row"))
539  {
540  unsigned int row = 0;
541  sscanf(cms::xerces::toString(a->getNodeValue()).c_str(), "%u", &row);
542  currentPixel.first = row;
543  rowSet = true;
544  }
545  if (!strcmp(cms::xerces::toString(a->getNodeName()).c_str(), "col"))
546  {
547  unsigned int col = 0;
548  sscanf(cms::xerces::toString(a->getNodeValue()).c_str(), "%u", &col);
549  currentPixel.second = col;
550  colSet = true;
551  }
552 
553  pixelSet = rowSet & colSet;
554  if(pixelSet){
555  pixels.insert(currentPixel);
556  break;
557  }
558  }
559 
560 
561 
562  if (!pixelSet)
563  {
564  throw cms::Exception("CTPPSPixelDAQMappingESSourceXML::GetChannels") <<
565  "Channel tags must have a row or col attribute.";
566  }
567  }
568 }
std::string toString(XMLCh const *toTranscode)
bool Test(xercesc::DOMNode *node, const std::string &name)
returns true iff the node is of the given name
double a
Definition: hdecay.h:121
col
Definition: cuy.py:1009
void CTPPSPixelDAQMappingESSourceXML::ParseTreePixel ( ParseType  pType,
xercesc::DOMNode *  parent,
NodeType  parentType,
unsigned int  parentID,
const std::unique_ptr< CTPPSPixelDAQMapping > &  mapping,
const std::unique_ptr< CTPPSPixelAnalysisMask > &  mask 
)
private

recursive method to extract Pixel-related information from the DOM tree

Definition at line 345 of file CTPPSPixelDAQMappingESSourceXML.cc.

References a, class-composition::children, ChipFramePosition(), Exception, CTPPSPixelROCAnalysisMask::fullMask, GetNodeType(), GetPixels(), mps_fire::i, triggerObjects_cff::id, CTPPSPixelROCInfo::iD, CTPPSPixelROCAnalysisMask::maskedPixels, gen::n, nArm, nPixel, nROC, nRPixPlane, nRPPot, nRPStation, nTop, nUnknown, offsetROCinDetId, PixelNode(), pMapping, pMask, CTPPSPixelROCInfo::roc, and cms::xerces::toString().

Referenced by ParseXML().

348 {
349 #ifdef DEBUG
350  printf(">> CTPPSPixelDAQMappingESSourceXML::ParseTreeRP(%s, %u, %u)\n", cms::xerces::toString(parent->getNodeName()),
351  parentType, parentID);
352 #endif
353 
354  DOMNodeList *children = parent->getChildNodes();
355 
356  for (unsigned int i = 0; i < children->getLength(); i++)
357  {
358  DOMNode *n = children->item(i);
359  if (n->getNodeType() != DOMNode::ELEMENT_NODE)
360  continue;
361 
363 
364 #ifdef DEBUG
365  printf("\tname = %s, type = %u\n", cms::xerces::toString(n->getNodeName()), type);
366 #endif
367 
368  // structure control
369  if (!PixelNode(type))
370  continue;
371 
372  NodeType expectedParentType;
373  switch (type)
374  {
375  case nArm: expectedParentType = nTop; break;
376  case nRPStation: expectedParentType = nArm; break;
377  case nRPPot: expectedParentType = nRPStation; break;
378  case nRPixPlane: expectedParentType = nRPPot; break;
379  case nROC: expectedParentType = nRPixPlane; break;
380  case nPixel: expectedParentType = nROC; break;
381  default: expectedParentType = nUnknown; break;
382  }
383 
384  if (expectedParentType != parentType)
385  {
386  throw cms::Exception("CTPPSPixelDAQMappingESSourceXML") << "Node " << cms::xerces::toString(n->getNodeName())
387  << " not allowed within " << cms::xerces::toString(parent->getNodeName()) << " block.\n";
388  }
389 
390  // parse tag attributes
391  unsigned int id = 0;
392  bool id_set = false;
393  bool fullMask = false;
394  DOMNamedNodeMap* attr = n->getAttributes();
395 
396  for (unsigned int j = 0; j < attr->getLength(); j++)
397  {
398  DOMNode *a = attr->item(j);
399 
400  if (!strcmp(cms::xerces::toString(a->getNodeName()).c_str(), "id"))
401  {
402  sscanf(cms::xerces::toString(a->getNodeValue()).c_str(), "%u", &id);
403  id_set = true;
404  }
405 
406  if (!strcmp(cms::xerces::toString(a->getNodeName()).c_str(), "full_mask"))
407  fullMask = (strcmp(cms::xerces::toString(a->getNodeValue()).c_str(), "no") != 0);
408  }
409 
410  // content control
411  if (!id_set)
412  throw cms::Exception("CTPPSPixelDAQMappingESSourceXML::ParseTreePixel") << "id not given for element `"
413  << cms::xerces::toString(n->getNodeName()) << "'" << endl;
414 
415  if (type == nRPixPlane && id > 5)
416  throw cms::Exception("CTPPSPixelDAQMappingESSourceXML::ParseTreePixel") <<
417  "Plane IDs range from 0 to 5. id = " << id << " is invalid." << endl;
418 
419 #ifdef DEBUG
420  printf("\tID found: %u\n", id);
421 #endif
422 
423  // store mapping data
424  if (pType == pMapping && type == nROC)
425  {
426  const CTPPSPixelFramePosition &framepos = ChipFramePosition(n);
427  CTPPSPixelROCInfo rocInfo;
428  rocInfo.roc = id;
429 
430  const unsigned int armIdx = (parentID / 1000) % 10;
431  const unsigned int stIdx = (parentID / 100) % 10;
432  const unsigned int rpIdx = (parentID / 10) % 10;
433  const unsigned int plIdx = parentID % 10;
434 
435  rocInfo.iD = CTPPSPixelDetId(armIdx, stIdx, rpIdx, plIdx);
436 
437  mapping->insert(framepos, rocInfo);
438 
439  continue;
440  }
441 
442  // store mask data
443  if (pType == pMask && type == nROC)
444  {
445  const unsigned int armIdx = (parentID / 1000) % 10;
446  const unsigned int stIdx = (parentID / 100) % 10;
447  const unsigned int rpIdx = (parentID / 10) % 10;
448  const unsigned int plIdx = parentID % 10;
449 
450 
451  uint32_t symbId = (id << offsetROCinDetId);
452 
453  symbId |= CTPPSPixelDetId(armIdx, stIdx, rpIdx, plIdx);
454 
455 
457  am.fullMask = fullMask;
458  GetPixels(n, am.maskedPixels);
459 
460  mask->insert(symbId, am);
461 
462  continue;
463  }
464 
465  // recursion (deeper in the tree)
466  ParseTreePixel(pType, n, type, parentID * 10 + id, mapping, mask);
467  }
468 }
type
Definition: HCALResponse.h:21
Contains mappind data related to a ROC.
void ParseTreePixel(ParseType, xercesc::DOMNode *, NodeType, unsigned int parentID, const std::unique_ptr< CTPPSPixelDAQMapping > &, const std::unique_ptr< CTPPSPixelAnalysisMask > &)
recursive method to extract Pixel-related information from the DOM tree
static const unsigned int offsetROCinDetId
CTPPSPixelFramePosition ChipFramePosition(xercesc::DOMNode *chipnode)
extracts VFAT&#39;s DAQ channel from XML attributes
Contains data on masked channels of a ROC.
uint32_t iD
the symbolic id
std::string toString(XMLCh const *toTranscode)
bool fullMask
whether all channels of the ROC shall be masked
void GetPixels(xercesc::DOMNode *n, std::set< std::pair< unsigned char, unsigned char > > &pixels)
double a
Definition: hdecay.h:121
std::set< std::pair< unsigned char, unsigned char > > maskedPixels
list of channels to be masked
NodeType GetNodeType(xercesc::DOMNode *)
determines node type
void CTPPSPixelDAQMappingESSourceXML::ParseXML ( ParseType  pType,
const string &  file,
const std::unique_ptr< CTPPSPixelDAQMapping > &  mapping,
const std::unique_ptr< CTPPSPixelAnalysisMask > &  mask 
)
private

parses XML file

Definition at line 320 of file CTPPSPixelDAQMappingESSourceXML.cc.

References Exception, nTop, createfilelist::parser, and ParseTreePixel().

Referenced by produceCTPPSPixelAnalysisMask(), and produceCTPPSPixelDAQMapping().

322 {
323  unique_ptr<XercesDOMParser> parser(new XercesDOMParser());
324  parser->parse(file.c_str());
325 
326  DOMDocument* domDoc = parser->getDocument();
327 
328  if (!domDoc)
329  throw cms::Exception("CTPPSPixelDAQMappingESSourceXML::ParseXML") << "Cannot parse file `" << file
330  << "' (domDoc = NULL)." << endl;
331 
332  DOMElement* elementRoot = domDoc->getDocumentElement();
333 
334  if (!elementRoot)
335  throw cms::Exception("CTPPSPixelDAQMappingESSourceXML::ParseXML") << "File `" <<
336  file << "' is empty." << endl;
337 
338  ParseTreePixel(pType, elementRoot, nTop, 0, mapping, mask);
339 
340 
341 }
void ParseTreePixel(ParseType, xercesc::DOMNode *, NodeType, unsigned int parentID, const std::unique_ptr< CTPPSPixelDAQMapping > &, const std::unique_ptr< CTPPSPixelAnalysisMask > &)
recursive method to extract Pixel-related information from the DOM tree
bool CTPPSPixelDAQMappingESSourceXML::PixelNode ( NodeType  type)
inlineprivate
std::unique_ptr< CTPPSPixelAnalysisMask > CTPPSPixelDAQMappingESSourceXML::produceCTPPSPixelAnalysisMask ( const CTPPSPixelAnalysisMaskRcd )

Definition at line 291 of file CTPPSPixelDAQMappingESSourceXML.cc.

References CompleteFileName(), configuration, currentBlock, currentBlockValid, taus_updatedMVAIds_cff::mapping, mappingFileNames, RecoTauDiscriminantConfiguration::mask, ParseXML(), pMapping, pMask, cms::concurrency::xercesInitialize(), and cms::concurrency::xercesTerminate().

Referenced by CTPPSPixelDAQMappingESSourceXML().

292 {
293  assert(currentBlockValid);
294 
295  auto mapping = std::make_unique<CTPPSPixelDAQMapping>();
296  auto mask = std::make_unique<CTPPSPixelAnalysisMask>();
297 
298 // initialize Xerces
299 
301 
302 // load mapping files
303  for (const auto &fn : configuration[currentBlock].mappingFileNames)
305 
306 // load mask files
307  for (const auto &fn : configuration[currentBlock].maskFileNames)
308  ParseXML(pMask, CompleteFileName(fn), mapping, mask);
309 
310 // release Xerces
312 
313 // commit the products
314 //return edm::es::products(mapping, mask);
315  return mask;
316 }
std::vector< std::string > mappingFileNames
the mapping files
void xercesTerminate()
Definition: Xerces.cc:23
string CompleteFileName(const string &fn)
adds the path prefix, if needed
void xercesInitialize()
Definition: Xerces.cc:18
unsigned int currentBlock
index of the current block in &#39;configuration&#39; array
void ParseXML(ParseType, const string &file, const std::unique_ptr< CTPPSPixelDAQMapping > &, const std::unique_ptr< CTPPSPixelAnalysisMask > &)
parses XML file
bool currentBlockValid
flag whether the &#39;currentBlock&#39; index is valid
std::unique_ptr< CTPPSPixelDAQMapping > CTPPSPixelDAQMappingESSourceXML::produceCTPPSPixelDAQMapping ( const CTPPSPixelDAQMappingRcd )

Definition at line 265 of file CTPPSPixelDAQMappingESSourceXML.cc.

References CompleteFileName(), configuration, currentBlock, currentBlockValid, taus_updatedMVAIds_cff::mapping, mappingFileNames, RecoTauDiscriminantConfiguration::mask, ParseXML(), pMapping, pMask, cms::concurrency::xercesInitialize(), and cms::concurrency::xercesTerminate().

Referenced by CTPPSPixelDAQMappingESSourceXML().

266 {
267  assert(currentBlockValid);
268 
269  auto mapping = std::make_unique<CTPPSPixelDAQMapping>();
270  auto mask = std::make_unique<CTPPSPixelAnalysisMask>();
271 
272 // initialize Xerces
273 
275 
276 // load mapping files
277  for (const auto &fn : configuration[currentBlock].mappingFileNames)
279 
280 // load mask files
281  for (const auto &fn : configuration[currentBlock].maskFileNames)
282  ParseXML(pMask, CompleteFileName(fn), mapping, mask);
283 
284 // release Xerces
286 
287 // commit the product
288  return mapping;
289 }
std::vector< std::string > mappingFileNames
the mapping files
void xercesTerminate()
Definition: Xerces.cc:23
string CompleteFileName(const string &fn)
adds the path prefix, if needed
void xercesInitialize()
Definition: Xerces.cc:18
unsigned int currentBlock
index of the current block in &#39;configuration&#39; array
void ParseXML(ParseType, const string &file, const std::unique_ptr< CTPPSPixelDAQMapping > &, const std::unique_ptr< CTPPSPixelAnalysisMask > &)
parses XML file
bool currentBlockValid
flag whether the &#39;currentBlock&#39; index is valid
void CTPPSPixelDAQMappingESSourceXML::setIntervalFor ( const edm::eventsetup::EventSetupRecordKey key,
const edm::IOVSyncValue iosv,
edm::ValidityInterval oValidity 
)
overrideprotectedvirtual

sets infinite validity of this data

Implements edm::EventSetupRecordIntervalFinder.

Definition at line 207 of file CTPPSPixelDAQMappingESSourceXML.cc.

References begin, configuration, currentBlock, currentBlockValid, end, edm::EventID::event(), edm::IOVSyncValue::eventID(), Exception, training_settings::idx, edm::eventsetup::EventSetupRecordKey::name(), and edm::EventID::run().

209 {
210  LogVerbatim("CTPPSPixelDAQMappingESSourceXML")
211  << ">> CTPPSPixelDAQMappingESSourceXML::setIntervalFor(" << key.name() << ")";
212 
213  LogVerbatim("CTPPSPixelDAQMappingESSourceXML")
214  << " run=" << iosv.eventID().run() << ", event=" << iosv.eventID().event();
215 
216  currentBlockValid = false;
217  for (unsigned int idx = 0; idx < configuration.size(); ++idx)
218  {
219  const auto &bl = configuration[idx];
220 
221  EventID startEventID = bl.validityRange.startEventID();
222  if (startEventID == EventID(1, 0, 1))
223  startEventID = EventID(1, 0, 0);
224 
225  if (startEventID <= iosv.eventID() && iosv.eventID() <= bl.validityRange.endEventID())
226  {
227  currentBlockValid = true;
228  currentBlock = idx;
229 
230  const IOVSyncValue begin(startEventID);
231  const IOVSyncValue end(bl.validityRange.endEventID());
232  oValidity = ValidityInterval(begin, end);
233 
234  LogVerbatim("CTPPSPixelDAQMappingESSourceXML")
235  << " block found: index=" << currentBlock
236  << ", interval=(" << startEventID << " - " << bl.validityRange.endEventID() << ")";
237 
238  return;
239  }
240  }
241 
242  if (!currentBlockValid)
243  {
244  throw cms::Exception("CTPPSPixelDAQMappingESSourceXML::setIntervalFor") <<
245  "No configuration for event " << iosv.eventID();
246  }
247 }
RunNumber_t run() const
Definition: EventID.h:39
EventNumber_t event() const
Definition: EventID.h:41
const EventID & eventID() const
Definition: IOVSyncValue.h:42
std::pair< Time_t, Time_t > ValidityInterval
Definition: Time.h:19
unsigned int currentBlock
index of the current block in &#39;configuration&#39; array
#define end
Definition: vmac.h:39
bool currentBlockValid
flag whether the &#39;currentBlock&#39; index is valid
#define begin
Definition: vmac.h:32
bool CTPPSPixelDAQMappingESSourceXML::Test ( xercesc::DOMNode *  node,
const std::string &  name 
)
inlineprivate

returns true iff the node is of the given name

Definition at line 122 of file CTPPSPixelDAQMappingESSourceXML.cc.

References cms::xerces::toString().

Referenced by GetNodeType(), and GetPixels().

123  {
124  return !(name.compare(cms::xerces::toString(node->getNodeName())));
125  }
std::string toString(XMLCh const *toTranscode)

Member Data Documentation

vector<ConfigBlock> CTPPSPixelDAQMappingESSourceXML::configuration
private
unsigned int CTPPSPixelDAQMappingESSourceXML::currentBlock
private

index of the current block in 'configuration' array

Definition at line 97 of file CTPPSPixelDAQMappingESSourceXML.cc.

Referenced by produceCTPPSPixelAnalysisMask(), produceCTPPSPixelDAQMapping(), and setIntervalFor().

bool CTPPSPixelDAQMappingESSourceXML::currentBlockValid
private

flag whether the 'currentBlock' index is valid

Definition at line 100 of file CTPPSPixelDAQMappingESSourceXML.cc.

Referenced by produceCTPPSPixelAnalysisMask(), produceCTPPSPixelDAQMapping(), and setIntervalFor().

std::vector<std::string> CTPPSPixelDAQMappingESSourceXML::mappingFileNames
private

the mapping files

Definition at line 80 of file CTPPSPixelDAQMappingESSourceXML.cc.

Referenced by produceCTPPSPixelAnalysisMask(), and produceCTPPSPixelDAQMapping().

string CTPPSPixelDAQMappingESSourceXML::subSystemName
private

label of the CTPPS sub-system

Definition at line 77 of file CTPPSPixelDAQMappingESSourceXML.cc.

Referenced by CTPPSPixelDAQMappingESSourceXML().

const string CTPPSPixelDAQMappingESSourceXML::tagAnalysisMask ="analysisMask"
static

Definition at line 55 of file CTPPSPixelDAQMappingESSourceXML.cc.

Referenced by PixelNode().

const string CTPPSPixelDAQMappingESSourceXML::tagArm = "arm"
static

Common position tags.

Definition at line 60 of file CTPPSPixelDAQMappingESSourceXML.cc.

Referenced by GetNodeType(), and PixelNode().

const string CTPPSPixelDAQMappingESSourceXML::tagPixel ="pixel"
static

Definition at line 58 of file CTPPSPixelDAQMappingESSourceXML.cc.

Referenced by PixelNode().

const string CTPPSPixelDAQMappingESSourceXML::tagROC ="roc"
static

Definition at line 57 of file CTPPSPixelDAQMappingESSourceXML.cc.

Referenced by GetNodeType(), and PixelNode().

const string CTPPSPixelDAQMappingESSourceXML::tagRPixPlane = "rpix_plane"
static

Definition at line 56 of file CTPPSPixelDAQMappingESSourceXML.cc.

Referenced by GetNodeType(), and PixelNode().

const string CTPPSPixelDAQMappingESSourceXML::tagRPPot = "rp_detector_set"
static

Definition at line 64 of file CTPPSPixelDAQMappingESSourceXML.cc.

Referenced by GetNodeType(), and PixelNode().

const string CTPPSPixelDAQMappingESSourceXML::tagRPStation = "station"
static

RP XML tags.

Definition at line 63 of file CTPPSPixelDAQMappingESSourceXML.cc.

Referenced by GetNodeType(), and PixelNode().

unsigned int CTPPSPixelDAQMappingESSourceXML::verbosity
private

Definition at line 74 of file CTPPSPixelDAQMappingESSourceXML.cc.