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 ()
 
- Public Member Functions inherited from edm::ESProducer
 ESProducer ()
 
virtual ~ESProducer ()(false)
 
- Public Member Functions inherited from edm::ESProxyFactoryProducer
 ESProxyFactoryProducer ()
 
virtual void newInterval (const eventsetup::EventSetupRecordKey &iRecordType, const ValidityInterval &iInterval)
 overrides DataProxyProvider method More...
 
virtual ~ESProxyFactoryProducer () noexcept(false)
 
- 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

virtual void setIntervalFor (const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &)
 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())
 
virtual void registerProxies (const eventsetup::EventSetupRecordKey &iRecord, KeyedProxies &aProxyList)
 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 50 of file CTPPSPixelDAQMappingESSourceXML.cc.

Member Enumeration Documentation

whether to parse a mapping of a mask XML

Enumerator
pMapping 
pMask 

Definition at line 105 of file CTPPSPixelDAQMappingESSourceXML.cc.

Constructor & Destructor Documentation

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

Definition at line 179 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.

179  :
180  verbosity(conf.getUntrackedParameter<unsigned int>("verbosity", 0)),
181  subSystemName(conf.getUntrackedParameter<string>("subSystem")),
182  currentBlock(0),
183  currentBlockValid(false)
184 {
185  for (const auto it : conf.getParameter<vector<ParameterSet>>("configuration"))
186  {
187  ConfigBlock b;
188  b.validityRange = it.getParameter<EventRange>("validityRange");
189  b.mappingFileNames = it.getParameter< vector<string> >("mappingFileNames");
190  b.maskFileNames = it.getParameter< vector<string> >("maskFileNames");
191  configuration.push_back(b);
192  }
193 
195  findingRecord<CTPPSPixelAnalysisMaskRcd>();
196 
198  findingRecord<CTPPSPixelDAQMappingRcd>();
199 
200 
201  LogVerbatim("CTPPSPixelDAQMappingESSourceXML") << " Inside CTPPSPixelDAQMappingESSourceXML";
202 
203 
204 }
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 ( )

Definition at line 250 of file CTPPSPixelDAQMappingESSourceXML.cc.

251 {
252 }

Member Function Documentation

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

extracts VFAT's DAQ channel from XML attributes

Definition at line 472 of file CTPPSPixelDAQMappingESSourceXML.cc.

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

Referenced by ParseTreePixel().

473 {
475  unsigned char attributeFlag = 0;
476 
477  DOMNamedNodeMap* attr = chipnode->getAttributes();
478  for (unsigned int j = 0; j < attr->getLength(); j++)
479  {
480  DOMNode *a = attr->item(j);
481 
482  if (fp.setXMLAttribute(XMLString::transcode(a->getNodeName()), XMLString::transcode(a->getNodeValue()), attributeFlag) > 1)
483  {
484  throw cms::Exception("CTPPSPixelDAQMappingESSourceXML") <<
485  "Unrecognized tag `" << XMLString::transcode(a->getNodeName()) <<
486  "' or incompatible value `" << XMLString::transcode(a->getNodeValue()) <<
487  "'." << endl;
488  }
489  }
490 
491  if (!fp.checkXMLAttributeFlag(attributeFlag))
492  {
493  throw cms::Exception("CTPPSPixelDAQMappingESSourceXML") <<
494  "Wrong/incomplete DAQ channel specification (attributeFlag = " << attributeFlag << ")." << endl;
495  }
496 
497  return fp;
498 }
unsigned char setXMLAttribute(const std::string &attribute, const std::string &value, unsigned char &flag)
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 256 of file CTPPSPixelDAQMappingESSourceXML.cc.

References edm::FileInPath::fullPath().

Referenced by produceCTPPSPixelAnalysisMask(), and produceCTPPSPixelDAQMapping().

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

returns the content of the node

Definition at line 130 of file CTPPSPixelDAQMappingESSourceXML.cc.

References AlCaHLTBitMon_QueryRunRegistry::string.

131  {
132  return string(xercesc::XMLString::transcode(parent->getTextContent()));
133  }
CTPPSPixelDAQMappingESSourceXML::NodeType CTPPSPixelDAQMappingESSourceXML::GetNodeType ( xercesc::DOMNode *  n)
private

determines node type

Definition at line 502 of file CTPPSPixelDAQMappingESSourceXML.cc.

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

Referenced by ParseTreePixel().

503 {
504 // common node types
505  if (Test(n, tagArm)) return nArm;
506  if (Test(n, tagROC)) return nROC;
507 
508 // RP node types
509  if (Test(n, tagRPStation)) return nRPStation;
510  if (Test(n, tagRPPot)) return nRPPot;
511  if (Test(n, tagRPixPlane)) return nRPixPlane;
512 
513  throw cms::Exception("CTPPSPixelDAQMappingESSourceXML::GetNodeType") << "Unknown tag `"
514  << XMLString::transcode(n->getNodeName()) << "'.\n";
515 }
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 136 of file CTPPSPixelDAQMappingESSourceXML.cc.

References gen::n, Digi_Phase1_R30F12_HCal_cff::pixels, and AlCaHLTBitMon_QueryRunRegistry::string.

137  {
138  return string(xercesc::XMLString::transcode(node->getNodeValue()));
139  }
void CTPPSPixelDAQMappingESSourceXML::GetPixels ( xercesc::DOMNode *  n,
std::set< std::pair< unsigned char, unsigned char > > &  pixels 
)
private

Definition at line 519 of file CTPPSPixelDAQMappingESSourceXML.cc.

References a, class-composition::children, cuy::col, DEFINE_FWK_EVENTSETUP_SOURCE, Exception, mps_fire::i, Digi_Phase1_R30F12_HCal_cff::pixels, and Test().

Referenced by ParseTreePixel().

520 {
521  DOMNodeList *children = n->getChildNodes();
522  for (unsigned int i = 0; i < children->getLength(); i++)
523  {
524  DOMNode *n = children->item(i);
525  if (n->getNodeType() != DOMNode::ELEMENT_NODE || !Test(n, "pixel"))
526  continue;
527 
528  DOMNamedNodeMap* attr = n->getAttributes();
529  bool pixelSet = false;
530  bool rowSet = false;
531  bool colSet = false;
532  std::pair<unsigned int, unsigned int> currentPixel;
533  for (unsigned int j = 0; j < attr->getLength(); j++)
534  {
535  DOMNode *a = attr->item(j);
536 
537  if (!strcmp(XMLString::transcode(a->getNodeName()), "row"))
538  {
539  unsigned int row = 0;
540  sscanf(XMLString::transcode(a->getNodeValue()), "%u", &row);
541  currentPixel.first = row;
542  rowSet = true;
543  }
544  if (!strcmp(XMLString::transcode(a->getNodeName()), "col"))
545  {
546  unsigned int col = 0;
547  sscanf(XMLString::transcode(a->getNodeValue()), "%u", &col);
548  currentPixel.second = col;
549  colSet = true;
550  }
551 
552  pixelSet = rowSet & colSet;
553  if(pixelSet){
554  pixels.insert(currentPixel);
555  break;
556  }
557  }
558 
559 
560 
561  if (!pixelSet)
562  {
563  throw cms::Exception("CTPPSPixelDAQMappingESSourceXML::GetChannels") <<
564  "Channel tags must have a row or col attribute.";
565  }
566  }
567 }
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:1008
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 344 of file CTPPSPixelDAQMappingESSourceXML.cc.

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

Referenced by ParseXML().

347 {
348 #ifdef DEBUG
349  printf(">> CTPPSPixelDAQMappingESSourceXML::ParseTreeRP(%s, %u, %u)\n", XMLString::transcode(parent->getNodeName()),
350  parentType, parentID);
351 #endif
352 
353  DOMNodeList *children = parent->getChildNodes();
354 
355  for (unsigned int i = 0; i < children->getLength(); i++)
356  {
357  DOMNode *n = children->item(i);
358  if (n->getNodeType() != DOMNode::ELEMENT_NODE)
359  continue;
360 
362 
363 #ifdef DEBUG
364  printf("\tname = %s, type = %u\n", XMLString::transcode(n->getNodeName()), type);
365 #endif
366 
367  // structure control
368  if (!PixelNode(type))
369  continue;
370 
371  NodeType expectedParentType;
372  switch (type)
373  {
374  case nArm: expectedParentType = nTop; break;
375  case nRPStation: expectedParentType = nArm; break;
376  case nRPPot: expectedParentType = nRPStation; break;
377  case nRPixPlane: expectedParentType = nRPPot; break;
378  case nROC: expectedParentType = nRPixPlane; break;
379  case nPixel: expectedParentType = nROC; break;
380  default: expectedParentType = nUnknown; break;
381  }
382 
383  if (expectedParentType != parentType)
384  {
385  throw cms::Exception("CTPPSPixelDAQMappingESSourceXML") << "Node " << XMLString::transcode(n->getNodeName())
386  << " not allowed within " << XMLString::transcode(parent->getNodeName()) << " block.\n";
387  }
388 
389  // parse tag attributes
390  unsigned int id = 0;
391  bool id_set = false;
392  bool fullMask = false;
393  DOMNamedNodeMap* attr = n->getAttributes();
394 
395  for (unsigned int j = 0; j < attr->getLength(); j++)
396  {
397  DOMNode *a = attr->item(j);
398 
399  if (!strcmp(XMLString::transcode(a->getNodeName()), "id"))
400  {
401  sscanf(XMLString::transcode(a->getNodeValue()), "%u", &id);
402  id_set = true;
403  }
404 
405  if (!strcmp(XMLString::transcode(a->getNodeName()), "full_mask"))
406  fullMask = (strcmp(XMLString::transcode(a->getNodeValue()), "no") != 0);
407  }
408 
409  // content control
410  if (!id_set)
411  throw cms::Exception("CTPPSPixelDAQMappingESSourceXML::ParseTreePixel") << "id not given for element `"
412  << XMLString::transcode(n->getNodeName()) << "'" << endl;
413 
414  if (type == nRPixPlane && id > 5)
415  throw cms::Exception("CTPPSPixelDAQMappingESSourceXML::ParseTreePixel") <<
416  "Plane IDs range from 0 to 5. id = " << id << " is invalid." << endl;
417 
418 #ifdef DEBUG
419  printf("\tID found: %u\n", id);
420 #endif
421 
422  // store mapping data
423  if (pType == pMapping && type == nROC)
424  {
425  const CTPPSPixelFramePosition &framepos = ChipFramePosition(n);
426  CTPPSPixelROCInfo rocInfo;
427  rocInfo.roc = id;
428 
429  const unsigned int armIdx = (parentID / 1000) % 10;
430  const unsigned int stIdx = (parentID / 100) % 10;
431  const unsigned int rpIdx = (parentID / 10) % 10;
432  const unsigned int plIdx = parentID % 10;
433 
434  rocInfo.iD = CTPPSPixelDetId(armIdx, stIdx, rpIdx, plIdx);
435 
436  mapping->insert(framepos, rocInfo);
437 
438  continue;
439  }
440 
441  // store mask data
442  if (pType == pMask && type == nROC)
443  {
444  const unsigned int armIdx = (parentID / 1000) % 10;
445  const unsigned int stIdx = (parentID / 100) % 10;
446  const unsigned int rpIdx = (parentID / 10) % 10;
447  const unsigned int plIdx = parentID % 10;
448 
449 
450  uint32_t symbId = (id << offsetROCinDetId);
451 
452  symbId |= CTPPSPixelDetId(armIdx, stIdx, rpIdx, plIdx);
453 
454 
456  am.fullMask = fullMask;
457  GetPixels(n, am.maskedPixels);
458 
459  mask->insert(symbId, am);
460 
461  continue;
462  }
463 
464  // recursion (deeper in the tree)
465  ParseTreePixel(pType, n, type, parentID * 10 + id, mapping, mask);
466  }
467 }
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
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 319 of file CTPPSPixelDAQMappingESSourceXML.cc.

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

Referenced by produceCTPPSPixelAnalysisMask(), and produceCTPPSPixelDAQMapping().

321 {
322  unique_ptr<XercesDOMParser> parser(new XercesDOMParser());
323  parser->parse(file.c_str());
324 
325  DOMDocument* domDoc = parser->getDocument();
326 
327  if (!domDoc)
328  throw cms::Exception("CTPPSPixelDAQMappingESSourceXML::ParseXML") << "Cannot parse file `" << file
329  << "' (domDoc = NULL)." << endl;
330 
331  DOMElement* elementRoot = domDoc->getDocumentElement();
332 
333  if (!elementRoot)
334  throw cms::Exception("CTPPSPixelDAQMappingESSourceXML::ParseXML") << "File `" <<
335  file << "' is empty." << endl;
336 
337  ParseTreePixel(pType, elementRoot, nTop, 0, mapping, mask);
338 
339 
340 }
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 290 of file CTPPSPixelDAQMappingESSourceXML.cc.

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

Referenced by CTPPSPixelDAQMappingESSourceXML().

291 {
292  assert(currentBlockValid);
293 
294  auto mapping = std::make_unique<CTPPSPixelDAQMapping>();
295  auto mask = std::make_unique<CTPPSPixelAnalysisMask>();
296 
297 // initialize Xerces
298 
300 
301 // load mapping files
302  for (const auto &fn : configuration[currentBlock].mappingFileNames)
304 
305 // load mask files
306  for (const auto &fn : configuration[currentBlock].maskFileNames)
307  ParseXML(pMask, CompleteFileName(fn), mapping, mask);
308 
309 // release Xerces
311 
312 // commit the products
313 //return edm::es::products(mapping, mask);
314  return mask;
315 }
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 264 of file CTPPSPixelDAQMappingESSourceXML.cc.

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

Referenced by CTPPSPixelDAQMappingESSourceXML().

265 {
266  assert(currentBlockValid);
267 
268  auto mapping = std::make_unique<CTPPSPixelDAQMapping>();
269  auto mask = std::make_unique<CTPPSPixelAnalysisMask>();
270 
271 // initialize Xerces
272 
274 
275 // load mapping files
276  for (const auto &fn : configuration[currentBlock].mappingFileNames)
278 
279 // load mask files
280  for (const auto &fn : configuration[currentBlock].maskFileNames)
281  ParseXML(pMask, CompleteFileName(fn), mapping, mask);
282 
283 // release Xerces
285 
286 // commit the product
287  return mapping;
288 }
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 
)
protectedvirtual

sets infinite validity of this data

Implements edm::EventSetupRecordIntervalFinder.

Definition at line 206 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().

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

returns true iff the node is of the given name

Definition at line 121 of file CTPPSPixelDAQMappingESSourceXML.cc.

Referenced by GetNodeType(), and GetPixels().

122  {
123  return !(name.compare(xercesc::XMLString::transcode(node->getNodeName())));
124  }

Member Data Documentation

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

index of the current block in 'configuration' array

Definition at line 96 of file CTPPSPixelDAQMappingESSourceXML.cc.

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

bool CTPPSPixelDAQMappingESSourceXML::currentBlockValid
private

flag whether the 'currentBlock' index is valid

Definition at line 99 of file CTPPSPixelDAQMappingESSourceXML.cc.

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

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

the mapping files

Definition at line 79 of file CTPPSPixelDAQMappingESSourceXML.cc.

Referenced by produceCTPPSPixelAnalysisMask(), and produceCTPPSPixelDAQMapping().

string CTPPSPixelDAQMappingESSourceXML::subSystemName
private

label of the CTPPS sub-system

Definition at line 76 of file CTPPSPixelDAQMappingESSourceXML.cc.

Referenced by CTPPSPixelDAQMappingESSourceXML().

const string CTPPSPixelDAQMappingESSourceXML::tagAnalysisMask ="analysisMask"
static

Definition at line 54 of file CTPPSPixelDAQMappingESSourceXML.cc.

Referenced by PixelNode().

const string CTPPSPixelDAQMappingESSourceXML::tagArm = "arm"
static

Common position tags.

Definition at line 59 of file CTPPSPixelDAQMappingESSourceXML.cc.

Referenced by GetNodeType(), and PixelNode().

const string CTPPSPixelDAQMappingESSourceXML::tagPixel ="pixel"
static

Definition at line 57 of file CTPPSPixelDAQMappingESSourceXML.cc.

Referenced by PixelNode().

const string CTPPSPixelDAQMappingESSourceXML::tagROC ="roc"
static

Definition at line 56 of file CTPPSPixelDAQMappingESSourceXML.cc.

Referenced by GetNodeType(), and PixelNode().

const string CTPPSPixelDAQMappingESSourceXML::tagRPixPlane = "rpix_plane"
static

Definition at line 55 of file CTPPSPixelDAQMappingESSourceXML.cc.

Referenced by GetNodeType(), and PixelNode().

const string CTPPSPixelDAQMappingESSourceXML::tagRPPot = "rp_detector_set"
static

Definition at line 63 of file CTPPSPixelDAQMappingESSourceXML.cc.

Referenced by GetNodeType(), and PixelNode().

const string CTPPSPixelDAQMappingESSourceXML::tagRPStation = "station"
static

RP XML tags.

Definition at line 62 of file CTPPSPixelDAQMappingESSourceXML.cc.

Referenced by GetNodeType(), and PixelNode().

unsigned int CTPPSPixelDAQMappingESSourceXML::verbosity
private

Definition at line 73 of file CTPPSPixelDAQMappingESSourceXML.cc.