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::ESProductResolverFactoryProducer edm::eventsetup::ESProductResolverProvider

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 (const ESProducer &)=delete
 
 ESProducer (ESProducer &&)=delete
 
ESResolverIndex const * getTokenIndices (unsigned int iIndex) const
 
ESRecordIndex const * getTokenRecordIndices (unsigned int iIndex) const
 
bool hasMayConsumes () const noexcept
 
size_t numberOfTokenIndices (unsigned int iIndex) const
 
ESProduceroperator= (const ESProducer &)=delete
 
ESProduceroperator= (ESProducer &&)=delete
 
SerialTaskQueueChainqueue ()
 
template<typename Record >
std::optional< std::vector< ESResolverIndex > > updateFromMayConsumes (unsigned int iIndex, const Record &iRecord) const
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &) final
 
 ~ESProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::ESProductResolverFactoryProducer
 ESProductResolverFactoryProducer ()
 
 ESProductResolverFactoryProducer (const ESProductResolverFactoryProducer &)=delete
 
const ESProductResolverFactoryProduceroperator= (const ESProductResolverFactoryProducer &)=delete
 
 ~ESProductResolverFactoryProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::eventsetup::ESProductResolverProvider
void createKeyedResolvers (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
const ComponentDescriptiondescription () const
 
 ESProductResolverProvider ()
 
 ESProductResolverProvider (const ESProductResolverProvider &)=delete
 
void fillRecordsNotAllowingConcurrentIOVs (std::set< EventSetupRecordKey > &recordsNotAllowingConcurrentIOVs) const
 
virtual void initConcurrentIOVs (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
bool isUsingRecord (const EventSetupRecordKey &key) const
 
KeyedResolverskeyedResolvers (const EventSetupRecordKey &iRecordKey, unsigned int iovIndex=0)
 
const ESProductResolverProvideroperator= (const ESProductResolverProvider &)=delete
 
void setAppendToDataLabel (const edm::ParameterSet &)
 
void setDescription (const ComponentDescription &iDescription)
 
std::set< EventSetupRecordKeyusingRecords () const
 
virtual ~ESProductResolverProvider () noexcept(false)
 
- Public Member Functions inherited from edm::EventSetupRecordIntervalFinder
bool concurrentFinder () const
 
const eventsetup::ComponentDescriptiondescriptionForFinder () const
 
 EventSetupRecordIntervalFinder ()
 
 EventSetupRecordIntervalFinder (const EventSetupRecordIntervalFinder &)=delete
 
std::set< eventsetup::EventSetupRecordKeyfindingForRecords () const
 
const ValidityIntervalfindIntervalFor (const eventsetup::EventSetupRecordKey &, const IOVSyncValue &)
 
bool nonconcurrentAndIOVNeedsUpdate (const eventsetup::EventSetupRecordKey &key, const IOVSyncValue &syncValue) const
 
const EventSetupRecordIntervalFinderoperator= (const EventSetupRecordIntervalFinder &)=delete
 
void resetInterval (const eventsetup::EventSetupRecordKey &)
 
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
ESConsumesInfoconsumesInfoPushBackNew ()
 
unsigned int consumesInfoSize () const
 
template<typename CallbackT , typename TList , typename TRecord >
void registerProducts (std::shared_ptr< std::pair< unsigned int, std::shared_ptr< CallbackT >>> iCallback, const TList *, const TRecord *iRecord, const es::Label &iLabel)
 
template<typename CallbackT , typename TRecord >
void registerProducts (std::shared_ptr< std::pair< unsigned int, std::shared_ptr< CallbackT >>>, const eventsetup::produce::Null *, const TRecord *, const es::Label &)
 
template<typename T >
auto setWhatProduced (T *iThis, const es::Label &iLabel={})
 
template<typename T >
auto setWhatProduced (T *iThis, const char *iLabel)
 
template<typename T >
auto setWhatProduced (T *iThis, const std::string &iLabel)
 
template<typename T , typename TDecorator >
auto setWhatProduced (T *iThis, const TDecorator &iDec, const es::Label &iLabel={})
 
template<typename T , typename TReturn , typename TRecord >
auto setWhatProduced (T *iThis, TReturn(T::*iMethod)(const TRecord &), const es::Label &iLabel={})
 
template<typename T , typename TReturn , typename TRecord , typename TDecorator >
auto setWhatProduced (T *iThis, TReturn(T ::*iMethod)(const TRecord &), const TDecorator &iDec, const es::Label &iLabel={})
 
template<typename TFunc >
auto setWhatProduced (TFunc &&func, const es::Label &iLabel={})
 
template<typename TReturn , typename TRecord , typename TFunc , typename TDecorator >
ESConsumesCollectorT< TRecord > setWhatProduced (TFunc &&func, TDecorator &&iDec, const es::Label &iLabel={})
 
void usesResources (std::vector< std::string > const &)
 
- Protected Member Functions inherited from edm::ESProductResolverFactoryProducer
template<class TFactory >
void registerFactory (std::unique_ptr< TFactory > iFactory, const std::string &iLabel=std::string())
 
virtual void registerFactoryWithKey (const EventSetupRecordKey &iRecord, std::unique_ptr< eventsetup::ESProductResolverFactoryBase > iFactory, const std::string &iLabel=std::string())
 
KeyedResolversVector registerResolvers (const EventSetupRecordKey &, unsigned int iovIndex) override
 
- Protected Member Functions inherited from edm::eventsetup::ESProductResolverProvider
template<class T >
void usingRecord ()
 
void usingRecordWithKey (const EventSetupRecordKey &key)
 
- 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

- Static Public Member Functions inherited from edm::eventsetup::ESProductResolverProvider
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Types inherited from edm::ESProductResolverFactoryProducer
using EventSetupRecordKey = eventsetup::EventSetupRecordKey
 
- Protected Types inherited from edm::eventsetup::ESProductResolverProvider
using KeyedResolversVector = std::vector< std::pair< DataKey, std::shared_ptr< ESProductResolver > >>
 

Detailed Description

Loads CTPPSPixelDAQMapping and CTPPSPixelAnalysisMask from two XML files.

Definition at line 49 of file CTPPSPixelDAQMappingESSourceXML.cc.

Member Enumeration Documentation

◆ NodeType

◆ ParseType

whether to parse a mapping of a mask XML

Enumerator
pMapping 
pMask 

Definition at line 100 of file CTPPSPixelDAQMappingESSourceXML.cc.

Constructor & Destructor Documentation

◆ CTPPSPixelDAQMappingESSourceXML()

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

Definition at line 171 of file CTPPSPixelDAQMappingESSourceXML.cc.

References b, configuration, edm::ParameterSet::getParameter(), produceCTPPSPixelAnalysisMask(), produceCTPPSPixelDAQMapping(), edm::ESProducer::setWhatProduced(), and subSystemName.

172  : verbosity(conf.getUntrackedParameter<unsigned int>("verbosity", 0)),
173  subSystemName(conf.getUntrackedParameter<string>("subSystem")),
174  currentBlock(0),
175  currentBlockValid(false) {
176  for (const auto &it : conf.getParameter<vector<ParameterSet>>("configuration")) {
177  ConfigBlock b;
178  b.validityRange = it.getParameter<EventRange>("validityRange");
179  b.mappingFileNames = it.getParameter<vector<string>>("mappingFileNames");
180  b.maskFileNames = it.getParameter<vector<string>>("maskFileNames");
181  configuration.push_back(b);
182  }
183 
185  findingRecord<CTPPSPixelAnalysisMaskRcd>();
186 
188  findingRecord<CTPPSPixelDAQMappingRcd>();
189 
190  LogVerbatim("CTPPSPixelDAQMappingESSourceXML") << " Inside CTPPSPixelDAQMappingESSourceXML";
191 }
Log< level::Info, true > LogVerbatim
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:166
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
string subSystemName
label of the CTPPS sub-system
std::unique_ptr< CTPPSPixelAnalysisMask > produceCTPPSPixelAnalysisMask(const CTPPSPixelAnalysisMaskRcd &)
T getUntrackedParameter(std::string const &, T const &) const
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::~CTPPSPixelDAQMappingESSourceXML ( )
override

Definition at line 231 of file CTPPSPixelDAQMappingESSourceXML.cc.

231 {}

Member Function Documentation

◆ ChipFramePosition()

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

extracts VFAT's DAQ channel from XML attributes

Definition at line 453 of file CTPPSPixelDAQMappingESSourceXML.cc.

References a, Exception, personalPlayback::fp, dqmiolumiharvest::j, and cms::xerces::toString().

Referenced by ParseTreePixel().

453  {
455  unsigned char attributeFlag = 0;
456 
457  DOMNamedNodeMap *attr = chipnode->getAttributes();
458  for (unsigned int j = 0; j < attr->getLength(); j++) {
459  DOMNode *a = attr->item(j);
460 
461  if (fp.setXMLAttribute(
462  cms::xerces::toString(a->getNodeName()), cms::xerces::toString(a->getNodeValue()), attributeFlag) > 1) {
463  throw cms::Exception("CTPPSPixelDAQMappingESSourceXML")
464  << "Unrecognized tag `" << cms::xerces::toString(a->getNodeName()) << "' or incompatible value `"
465  << cms::xerces::toString(a->getNodeValue()) << "'." << endl;
466  }
467  }
468 
469  if (!fp.checkXMLAttributeFlag(attributeFlag)) {
470  throw cms::Exception("CTPPSPixelDAQMappingESSourceXML")
471  << "Wrong/incomplete DAQ channel specification (attributeFlag = " << attributeFlag << ")." << endl;
472  }
473 
474  return fp;
475 }
std::string toString(XMLCh const *toTranscode)
double a
Definition: hdecay.h:121

◆ CompleteFileName()

string CTPPSPixelDAQMappingESSourceXML::CompleteFileName ( const string &  fn)
private

adds the path prefix, if needed

Definition at line 233 of file CTPPSPixelDAQMappingESSourceXML.cc.

References personalPlayback::fn, and edm::FileInPath::fullPath().

Referenced by produceCTPPSPixelAnalysisMask(), and produceCTPPSPixelDAQMapping().

233  {
234  FileInPath fip(fn);
235  return fip.fullPath();
236 }

◆ GetNodeContent()

string CTPPSPixelDAQMappingESSourceXML::GetNodeContent ( xercesc::DOMNode *  parent)
inlineprivate

returns the content of the node

Definition at line 129 of file CTPPSPixelDAQMappingESSourceXML.cc.

References class-composition::parent, and cms::xerces::toString().

129 { return cms::xerces::toString(parent->getTextContent()); }
std::string toString(XMLCh const *toTranscode)

◆ GetNodeType()

CTPPSPixelDAQMappingESSourceXML::NodeType CTPPSPixelDAQMappingESSourceXML::GetNodeType ( xercesc::DOMNode *  n)
private

determines node type

Definition at line 479 of file CTPPSPixelDAQMappingESSourceXML.cc.

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

Referenced by ParseTreePixel().

479  {
480  // common node types
481  if (Test(n, tagArm))
482  return nArm;
483  if (Test(n, tagROC))
484  return nROC;
485 
486  // RP node types
487  if (Test(n, tagRPStation))
488  return nRPStation;
489  if (Test(n, tagRPPot))
490  return nRPPot;
491  if (Test(n, tagRPixPlane))
492  return nRPixPlane;
493 
494  throw cms::Exception("CTPPSPixelDAQMappingESSourceXML::GetNodeType")
495  << "Unknown tag `" << cms::xerces::toString(n->getNodeName()) << "'.\n";
496 }
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.

◆ GetNodeValue()

string CTPPSPixelDAQMappingESSourceXML::GetNodeValue ( xercesc::DOMNode *  node)
inlineprivate

returns the value of the node

Definition at line 132 of file CTPPSPixelDAQMappingESSourceXML.cc.

References cms::xerces::toString().

132 { return cms::xerces::toString(node->getNodeValue()); }
std::string toString(XMLCh const *toTranscode)

◆ GetPixels()

void CTPPSPixelDAQMappingESSourceXML::GetPixels ( xercesc::DOMNode *  n,
std::set< std::pair< unsigned char, unsigned char >> &  pixels 
)
private

Definition at line 500 of file CTPPSPixelDAQMappingESSourceXML.cc.

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

Referenced by ParseTreePixel().

501  {
502  DOMNodeList *children = n->getChildNodes();
503  for (unsigned int i = 0; i < children->getLength(); i++) {
504  DOMNode *n = children->item(i);
505  if (n->getNodeType() != DOMNode::ELEMENT_NODE || !Test(n, "pixel"))
506  continue;
507 
508  DOMNamedNodeMap *attr = n->getAttributes();
509  bool pixelSet = false;
510  bool rowSet = false;
511  bool colSet = false;
512  std::pair<unsigned int, unsigned int> currentPixel;
513  for (unsigned int j = 0; j < attr->getLength(); j++) {
514  DOMNode *a = attr->item(j);
515 
516  if (!strcmp(cms::xerces::toString(a->getNodeName()).c_str(), "row")) {
517  unsigned int row = 0;
518  sscanf(cms::xerces::toString(a->getNodeValue()).c_str(), "%u", &row);
519  currentPixel.first = row;
520  rowSet = true;
521  }
522  if (!strcmp(cms::xerces::toString(a->getNodeName()).c_str(), "col")) {
523  unsigned int col = 0;
524  sscanf(cms::xerces::toString(a->getNodeValue()).c_str(), "%u", &col);
525  currentPixel.second = col;
526  colSet = true;
527  }
528 
529  pixelSet = rowSet & colSet;
530  if (pixelSet) {
531  pixels.insert(currentPixel);
532  break;
533  }
534  }
535 
536  if (!pixelSet) {
537  throw cms::Exception("CTPPSPixelDAQMappingESSourceXML::GetChannels")
538  << "Channel tags must have a row or col attribute.";
539  }
540  }
541 }
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

◆ ParseTreePixel()

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 316 of file CTPPSPixelDAQMappingESSourceXML.cc.

References a, class-composition::children, ChipFramePosition(), Exception, CTPPSPixelROCAnalysisMask::fullMask, GetNodeType(), GetPixels(), mps_fire::i, CTPPSPixelROCInfo::iD, l1ctLayer2EG_cff::id, dqmiolumiharvest::j, taus_updatedMVAIds_cff::mapping, gpuClustering::pixelStatus::mask, CTPPSPixelROCAnalysisMask::maskedPixels, dqmiodumpmetadata::n, nArm, nPixel, nROC, nRPixPlane, nRPPot, nRPStation, nTop, nUnknown, offsetROCinDetId, class-composition::parent, PixelNode(), pMapping, pMask, CTPPSPixelROCInfo::roc, and cms::xerces::toString().

Referenced by ParseXML().

321  {
322 #ifdef DEBUG
323  printf(">> CTPPSPixelDAQMappingESSourceXML::ParseTreeRP(%s, %u, %u)\n",
324  cms::xerces::toString(parent->getNodeName()),
325  parentType,
326  parentID);
327 #endif
328 
329  DOMNodeList *children = parent->getChildNodes();
330 
331  for (unsigned int i = 0; i < children->getLength(); i++) {
332  DOMNode *n = children->item(i);
333  if (n->getNodeType() != DOMNode::ELEMENT_NODE)
334  continue;
335 
337 
338 #ifdef DEBUG
339  printf("\tname = %s, type = %u\n", cms::xerces::toString(n->getNodeName()), type);
340 #endif
341 
342  // structure control
343  if (!PixelNode(type))
344  continue;
345 
346  NodeType expectedParentType;
347  switch (type) {
348  case nArm:
349  expectedParentType = nTop;
350  break;
351  case nRPStation:
352  expectedParentType = nArm;
353  break;
354  case nRPPot:
355  expectedParentType = nRPStation;
356  break;
357  case nRPixPlane:
358  expectedParentType = nRPPot;
359  break;
360  case nROC:
361  expectedParentType = nRPixPlane;
362  break;
363  case nPixel:
364  expectedParentType = nROC;
365  break;
366  default:
367  expectedParentType = nUnknown;
368  break;
369  }
370 
371  if (expectedParentType != parentType) {
372  throw cms::Exception("CTPPSPixelDAQMappingESSourceXML")
373  << "Node " << cms::xerces::toString(n->getNodeName()) << " not allowed within "
374  << cms::xerces::toString(parent->getNodeName()) << " block.\n";
375  }
376 
377  // parse tag attributes
378  unsigned int id = 0;
379  bool id_set = false;
380  bool fullMask = false;
381  DOMNamedNodeMap *attr = n->getAttributes();
382 
383  for (unsigned int j = 0; j < attr->getLength(); j++) {
384  DOMNode *a = attr->item(j);
385 
386  if (!strcmp(cms::xerces::toString(a->getNodeName()).c_str(), "id")) {
387  sscanf(cms::xerces::toString(a->getNodeValue()).c_str(), "%u", &id);
388  id_set = true;
389  }
390 
391  if (!strcmp(cms::xerces::toString(a->getNodeName()).c_str(), "full_mask"))
392  fullMask = (strcmp(cms::xerces::toString(a->getNodeValue()).c_str(), "no") != 0);
393  }
394 
395  // content control
396  if (!id_set)
397  throw cms::Exception("CTPPSPixelDAQMappingESSourceXML::ParseTreePixel")
398  << "id not given for element `" << cms::xerces::toString(n->getNodeName()) << "'" << endl;
399 
400  if (type == nRPixPlane && id > 5)
401  throw cms::Exception("CTPPSPixelDAQMappingESSourceXML::ParseTreePixel")
402  << "Plane IDs range from 0 to 5. id = " << id << " is invalid." << endl;
403 
404 #ifdef DEBUG
405  printf("\tID found: %u\n", id);
406 #endif
407 
408  // store mapping data
409  if (pType == pMapping && type == nROC) {
410  const CTPPSPixelFramePosition &framepos = ChipFramePosition(n);
411  CTPPSPixelROCInfo rocInfo;
412  rocInfo.roc = id;
413 
414  const unsigned int armIdx = (parentID / 1000) % 10;
415  const unsigned int stIdx = (parentID / 100) % 10;
416  const unsigned int rpIdx = (parentID / 10) % 10;
417  const unsigned int plIdx = parentID % 10;
418 
419  rocInfo.iD = CTPPSPixelDetId(armIdx, stIdx, rpIdx, plIdx);
420 
421  mapping->insert(framepos, rocInfo);
422 
423  continue;
424  }
425 
426  // store mask data
427  if (pType == pMask && type == nROC) {
428  const unsigned int armIdx = (parentID / 1000) % 10;
429  const unsigned int stIdx = (parentID / 100) % 10;
430  const unsigned int rpIdx = (parentID / 10) % 10;
431  const unsigned int plIdx = parentID % 10;
432 
433  uint32_t symbId = (id << offsetROCinDetId);
434 
435  symbId |= CTPPSPixelDetId(armIdx, stIdx, rpIdx, plIdx);
436 
438  am.fullMask = fullMask;
439  GetPixels(n, am.maskedPixels);
440 
441  mask->insert(symbId, am);
442 
443  continue;
444  }
445 
446  // recursion (deeper in the tree)
447  ParseTreePixel(pType, n, type, parentID * 10 + id, mapping, mask);
448  }
449 }
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
constexpr uint32_t mask
Definition: gpuClustering.h:26
Contains data on masked channels of a ROC.
uint32_t iD
the symbolic id
std::string toString(XMLCh const *toTranscode)
void GetPixels(xercesc::DOMNode *n, std::set< std::pair< unsigned char, unsigned char >> &pixels)
bool fullMask
whether all channels of the ROC shall be masked
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

◆ ParseXML()

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 293 of file CTPPSPixelDAQMappingESSourceXML.cc.

References Exception, geometryDiff::file, taus_updatedMVAIds_cff::mapping, gpuClustering::pixelStatus::mask, nTop, writedatasetfile::parser, and ParseTreePixel().

Referenced by produceCTPPSPixelAnalysisMask(), and produceCTPPSPixelDAQMapping().

296  {
297  unique_ptr<XercesDOMParser> parser(new XercesDOMParser());
298  parser->parse(file.c_str());
299 
300  DOMDocument *domDoc = parser->getDocument();
301 
302  if (!domDoc)
303  throw cms::Exception("CTPPSPixelDAQMappingESSourceXML::ParseXML")
304  << "Cannot parse file `" << file << "' (domDoc = NULL)." << endl;
305 
306  DOMElement *elementRoot = domDoc->getDocumentElement();
307 
308  if (!elementRoot)
309  throw cms::Exception("CTPPSPixelDAQMappingESSourceXML::ParseXML") << "File `" << file << "' is empty." << endl;
310 
311  ParseTreePixel(pType, elementRoot, nTop, 0, mapping, mask);
312 }
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
constexpr uint32_t mask
Definition: gpuClustering.h:26

◆ PixelNode()

bool CTPPSPixelDAQMappingESSourceXML::PixelNode ( NodeType  type)
inlineprivate

◆ produceCTPPSPixelAnalysisMask()

std::unique_ptr< CTPPSPixelAnalysisMask > CTPPSPixelDAQMappingESSourceXML::produceCTPPSPixelAnalysisMask ( const CTPPSPixelAnalysisMaskRcd )

Definition at line 264 of file CTPPSPixelDAQMappingESSourceXML.cc.

References cms::cuda::assert(), CompleteFileName(), configuration, currentBlock, currentBlockValid, personalPlayback::fn, taus_updatedMVAIds_cff::mapping, mappingFileNames, gpuClustering::pixelStatus::mask, ctppsRawToDigi_cff::maskFileNames, ParseXML(), pMapping, pMask, cms::concurrency::xercesInitialize(), and cms::concurrency::xercesTerminate().

Referenced by CTPPSPixelDAQMappingESSourceXML().

265  {
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)
282 
283  // release Xerces
285 
286  // commit the products
287  //return edm::es::products(mapping, mask);
288  return mask;
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
assert(be >=bs)
constexpr uint32_t mask
Definition: gpuClustering.h:26
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

◆ produceCTPPSPixelDAQMapping()

std::unique_ptr< CTPPSPixelDAQMapping > CTPPSPixelDAQMappingESSourceXML::produceCTPPSPixelDAQMapping ( const CTPPSPixelDAQMappingRcd )

Definition at line 238 of file CTPPSPixelDAQMappingESSourceXML.cc.

References cms::cuda::assert(), CompleteFileName(), configuration, currentBlock, currentBlockValid, personalPlayback::fn, taus_updatedMVAIds_cff::mapping, mappingFileNames, gpuClustering::pixelStatus::mask, ctppsRawToDigi_cff::maskFileNames, ParseXML(), pMapping, pMask, cms::concurrency::xercesInitialize(), and cms::concurrency::xercesTerminate().

Referenced by CTPPSPixelDAQMappingESSourceXML().

239  {
241 
242  auto mapping = std::make_unique<CTPPSPixelDAQMapping>();
243  auto mask = std::make_unique<CTPPSPixelAnalysisMask>();
244 
245  // initialize Xerces
246 
248 
249  // load mapping files
250  for (const auto &fn : configuration[currentBlock].mappingFileNames)
252 
253  // load mask files
254  for (const auto &fn : configuration[currentBlock].maskFileNames)
256 
257  // release Xerces
259 
260  // commit the product
261  return mapping;
262 }
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
assert(be >=bs)
constexpr uint32_t mask
Definition: gpuClustering.h:26
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

◆ setIntervalFor()

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 193 of file CTPPSPixelDAQMappingESSourceXML.cc.

References configuration, currentBlock, currentBlockValid, mps_fire::end, edm::EventID::event(), edm::IOVSyncValue::eventID(), Exception, heavyIonCSV_trainingSettings::idx, crabWrapper::key, and edm::EventID::run().

195  {
196  LogVerbatim("CTPPSPixelDAQMappingESSourceXML")
197  << ">> CTPPSPixelDAQMappingESSourceXML::setIntervalFor(" << key.name() << ")";
198 
199  LogVerbatim("CTPPSPixelDAQMappingESSourceXML")
200  << " run=" << iosv.eventID().run() << ", event=" << iosv.eventID().event();
201 
202  currentBlockValid = false;
203  for (unsigned int idx = 0; idx < configuration.size(); ++idx) {
204  const auto &bl = configuration[idx];
205 
206  EventID startEventID = bl.validityRange.startEventID();
207  if (startEventID == EventID(1, 0, 1))
208  startEventID = EventID(1, 0, 0);
209 
210  if (startEventID <= iosv.eventID() && iosv.eventID() <= bl.validityRange.endEventID()) {
211  currentBlockValid = true;
212  currentBlock = idx;
213 
214  const IOVSyncValue begin(startEventID);
215  const IOVSyncValue end(bl.validityRange.endEventID());
216  oValidity = ValidityInterval(begin, end);
217 
218  LogVerbatim("CTPPSPixelDAQMappingESSourceXML") << " block found: index=" << currentBlock << ", interval=("
219  << startEventID << " - " << bl.validityRange.endEventID() << ")";
220 
221  return;
222  }
223  }
224 
225  if (!currentBlockValid) {
226  throw cms::Exception("CTPPSPixelDAQMappingESSourceXML::setIntervalFor")
227  << "No configuration for event " << iosv.eventID();
228  }
229 }
Log< level::Info, true > LogVerbatim
std::pair< Time_t, Time_t > ValidityInterval
Definition: Time.h:17
unsigned int currentBlock
index of the current block in &#39;configuration&#39; array
RunNumber_t run() const
Definition: EventID.h:38
bool currentBlockValid
flag whether the &#39;currentBlock&#39; index is valid
const EventID & eventID() const
Definition: IOVSyncValue.h:40
EventNumber_t event() const
Definition: EventID.h:40

◆ Test()

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.

References Skims_PA_cff::name, and cms::xerces::toString().

Referenced by GetNodeType(), and GetPixels().

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

Member Data Documentation

◆ configuration

vector<ConfigBlock> CTPPSPixelDAQMappingESSourceXML::configuration
private

◆ currentBlock

unsigned int CTPPSPixelDAQMappingESSourceXML::currentBlock
private

index of the current block in 'configuration' array

Definition at line 91 of file CTPPSPixelDAQMappingESSourceXML.cc.

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

◆ currentBlockValid

bool CTPPSPixelDAQMappingESSourceXML::currentBlockValid
private

flag whether the 'currentBlock' index is valid

Definition at line 94 of file CTPPSPixelDAQMappingESSourceXML.cc.

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

◆ mappingFileNames

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

the mapping files

Definition at line 75 of file CTPPSPixelDAQMappingESSourceXML.cc.

Referenced by produceCTPPSPixelAnalysisMask(), and produceCTPPSPixelDAQMapping().

◆ subSystemName

string CTPPSPixelDAQMappingESSourceXML::subSystemName
private

label of the CTPPS sub-system

Definition at line 72 of file CTPPSPixelDAQMappingESSourceXML.cc.

Referenced by CTPPSPixelDAQMappingESSourceXML().

◆ tagAnalysisMask

const string CTPPSPixelDAQMappingESSourceXML::tagAnalysisMask = "analysisMask"
static

Definition at line 51 of file CTPPSPixelDAQMappingESSourceXML.cc.

◆ tagArm

const string CTPPSPixelDAQMappingESSourceXML::tagArm = "arm"
static

Common position tags.

Definition at line 56 of file CTPPSPixelDAQMappingESSourceXML.cc.

Referenced by GetNodeType().

◆ tagPixel

const string CTPPSPixelDAQMappingESSourceXML::tagPixel = "pixel"
static

Definition at line 54 of file CTPPSPixelDAQMappingESSourceXML.cc.

◆ tagROC

const string CTPPSPixelDAQMappingESSourceXML::tagROC = "roc"
static

Definition at line 53 of file CTPPSPixelDAQMappingESSourceXML.cc.

Referenced by GetNodeType().

◆ tagRPixPlane

const string CTPPSPixelDAQMappingESSourceXML::tagRPixPlane = "rpix_plane"
static

Definition at line 52 of file CTPPSPixelDAQMappingESSourceXML.cc.

Referenced by GetNodeType().

◆ tagRPPot

const string CTPPSPixelDAQMappingESSourceXML::tagRPPot = "rp_detector_set"
static

Definition at line 60 of file CTPPSPixelDAQMappingESSourceXML.cc.

Referenced by GetNodeType().

◆ tagRPStation

const string CTPPSPixelDAQMappingESSourceXML::tagRPStation = "station"
static

RP XML tags.

Definition at line 59 of file CTPPSPixelDAQMappingESSourceXML.cc.

Referenced by GetNodeType().

◆ verbosity

unsigned int CTPPSPixelDAQMappingESSourceXML::verbosity
private

Definition at line 69 of file CTPPSPixelDAQMappingESSourceXML.cc.