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
TotemDAQMappingESSourceXML Class Reference

Loads TotemDAQMapping and TotemAnalysisMask from two XML files. More...

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

Classes

struct  ConfigBlock
 

Public Member Functions

edm::ESProducts< std::unique_ptr< TotemDAQMapping >, std::unique_ptr< TotemAnalysisMask > > produce (const TotemReadoutRcd &)
 
 TotemDAQMappingESSourceXML (const edm::ParameterSet &)
 
 ~TotemDAQMappingESSourceXML () override
 
- Public Member Functions inherited from edm::ESProducer
 ESProducer ()
 
 ESProducer (const ESProducer &)=delete
 
ESProxyIndex const * getTokenIndices (unsigned int iIndex) const
 
ESRecordIndex const * getTokenRecordIndices (unsigned int iIndex) const
 
bool hasMayConsumes () const noexcept
 
size_t numberOfTokenIndices (unsigned int iIndex) const
 
ESProducer const & operator= (const ESProducer &)=delete
 
SerialTaskQueueChainqueue ()
 
template<typename Record >
std::optional< std::vector< ESProxyIndex > > updateFromMayConsumes (unsigned int iIndex, const Record &iRecord) const
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &) final
 
 ~ESProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::ESProxyFactoryProducer
 ESProxyFactoryProducer ()
 
 ESProxyFactoryProducer (const ESProxyFactoryProducer &)=delete
 
const ESProxyFactoryProduceroperator= (const ESProxyFactoryProducer &)=delete
 
 ~ESProxyFactoryProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::eventsetup::DataProxyProvider
void createKeyedProxies (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
 DataProxyProvider ()
 
 DataProxyProvider (const DataProxyProvider &)=delete
 
const ComponentDescriptiondescription () const
 
void fillRecordsNotAllowingConcurrentIOVs (std::set< EventSetupRecordKey > &recordsNotAllowingConcurrentIOVs) const
 
virtual void initConcurrentIOVs (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
bool isUsingRecord (const EventSetupRecordKey &key) const
 
KeyedProxieskeyedProxies (const EventSetupRecordKey &iRecordKey, unsigned int iovIndex=0)
 
const DataProxyProvideroperator= (const DataProxyProvider &)=delete
 
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
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 tagChannel = "channel"
 
static const std::string tagChip1 = "vfat"
 COMMON Chip XML tags. More...
 
static const std::string tagChip2 = "test_vfat"
 
static const std::string tagDiamondCh = "diamond_channel"
 
static const std::string tagDiamondPlane = "rp_plane_diamond"
 diamond specific tags More...
 
static const std::string tagRPPlane = "rp_plane"
 
static const std::string tagRPPot = "rp_detector_set"
 
static const std::string tagRPStation = "station"
 RP XML tags. More...
 
static const std::string tagSampicBoard = "rp_sampic_board"
 totem timing specific tags More...
 
static const std::string tagSampicCh = "rp_sampic_channel"
 
static const std::string tagTotemT2Plane = "nt2_plane"
 TOTEM nT2 specific tags. More...
 
static const std::string tagTotemT2Tile = "nt2_tile"
 
static const std::string tagTotemTimingCh = "timing_channel"
 
static const std::string tagTotemTimingPlane = "timing_plane"
 
static const std::string tagVFAT = "vfat"
 

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 >
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 TArg >
ESConsumesCollectorT< TRecord > setWhatProduced (T *iThis, TReturn(T ::*iMethod)(const TRecord &), const TArg &iDec, const es::Label &iLabel={})
 
void usesResources (std::vector< std::string > const &)
 
- 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 EventSetupRecordKey &iRecord, std::unique_ptr< eventsetup::ProxyFactoryBase > iFactory, const std::string &iLabel=std::string())
 
KeyedProxiesVector registerProxies (const EventSetupRecordKey &, unsigned int iovIndex) override
 
- Protected Member Functions inherited from edm::eventsetup::DataProxyProvider
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, nRPPlane, nDiamondPlane,
  nChip, nDiamondCh, nChannel, nSampicBoard,
  nSampicChannel, nTotemTimingPlane, nTotemTimingCh, nTotemT2Plane,
  nTotemT2Tile
}
 enumeration of XML node types More...
 
enum  ParseType { pMapping, pMask }
 whether to parse a mapping of a mask XML More...
 

Private Member Functions

TotemFramePosition ChipFramePosition (xercesc::DOMNode *chipnode)
 extracts VFAT's DAQ channel from XML attributes More...
 
bool CommonNode (NodeType type)
 
string CompleteFileName (const string &fn)
 adds the path prefix, if needed More...
 
bool DiamondNode (NodeType type)
 
void GetChannels (xercesc::DOMNode *n, std::set< unsigned char > &channels)
 
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 ParseTreeDiamond (ParseType, xercesc::DOMNode *, NodeType, unsigned int parentID, const std::unique_ptr< TotemDAQMapping > &, const std::unique_ptr< TotemAnalysisMask > &)
 recursive method to extract RP-related information from the DOM tree More...
 
void ParseTreeRP (ParseType, xercesc::DOMNode *, NodeType, unsigned int parentID, const std::unique_ptr< TotemDAQMapping > &, const std::unique_ptr< TotemAnalysisMask > &)
 recursive method to extract RP-related information from the DOM tree More...
 
void ParseTreeTotemT2 (ParseType, xercesc::DOMNode *, NodeType, unsigned int parentID, const std::unique_ptr< TotemDAQMapping > &, const std::unique_ptr< TotemAnalysisMask > &)
 recursive method to extract nT2-related information from the DOM tree More...
 
void ParseTreeTotemTiming (ParseType, xercesc::DOMNode *, NodeType, unsigned int parentID, const std::unique_ptr< TotemDAQMapping > &, const std::unique_ptr< TotemAnalysisMask > &)
 recursive method to extract RP-related information from the DOM tree More...
 
void ParseXML (ParseType, const string &file, const std::unique_ptr< TotemDAQMapping > &, const std::unique_ptr< TotemAnalysisMask > &)
 parses XML file More...
 
bool RPNode (NodeType type)
 
bool Test (xercesc::DOMNode *node, const std::string &name)
 returns true iff the node is of the given name More...
 
bool TotemT2Node (NodeType type)
 
bool TotemTimingNode (NodeType type)
 

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...
 
unsigned int sampicSubDetId
 
string subSystemName
 label of the CTPPS sub-system More...
 
unsigned int verbosity
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::eventsetup::DataProxyProvider
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Types inherited from edm::ESProxyFactoryProducer
using EventSetupRecordKey = eventsetup::EventSetupRecordKey
 
- Protected Types inherited from edm::eventsetup::DataProxyProvider
using KeyedProxiesVector = std::vector< std::pair< DataKey, std::shared_ptr< DataProxy > >>
 

Detailed Description

Loads TotemDAQMapping and TotemAnalysisMask from two XML files.

Definition at line 53 of file TotemDAQMappingESSourceXML.cc.

Member Enumeration Documentation

◆ NodeType

enumeration of XML node types

Enumerator
nUnknown 
nSkip 
nTop 
nArm 
nRPStation 
nRPPot 
nRPPlane 
nDiamondPlane 
nChip 
nDiamondCh 
nChannel 
nSampicBoard 
nSampicChannel 
nTotemTimingPlane 
nTotemTimingCh 
nTotemT2Plane 
nTotemT2Tile 

Definition at line 122 of file TotemDAQMappingESSourceXML.cc.

122  {
123  nUnknown,
124  nSkip,
125  nTop,
126  nArm,
127  nRPStation,
128  nRPPot,
129  nRPPlane,
131  nChip,
132  nDiamondCh,
133  nChannel,
134  nSampicBoard,
140  };

◆ ParseType

whether to parse a mapping of a mask XML

Enumerator
pMapping 
pMask 

Definition at line 143 of file TotemDAQMappingESSourceXML.cc.

Constructor & Destructor Documentation

◆ TotemDAQMappingESSourceXML()

TotemDAQMappingESSourceXML::TotemDAQMappingESSourceXML ( const edm::ParameterSet conf)

Definition at line 269 of file TotemDAQMappingESSourceXML.cc.

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

270  : verbosity(conf.getUntrackedParameter<unsigned int>("verbosity", 0)),
271  subSystemName(conf.getUntrackedParameter<string>("subSystem")),
272  sampicSubDetId(conf.getParameter<unsigned int>("sampicSubDetId")),
273  currentBlock(0),
274  currentBlockValid(false) {
275  for (const auto &it : conf.getParameter<vector<ParameterSet>>("configuration")) {
276  ConfigBlock b;
277  b.validityRange = it.getParameter<EventRange>("validityRange");
278  b.mappingFileNames = it.getParameter<vector<string>>("mappingFileNames");
279  b.maskFileNames = it.getParameter<vector<string>>("maskFileNames");
280  configuration.push_back(b);
281  }
282 
284  findingRecord<TotemReadoutRcd>();
285 }
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:163
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
bool currentBlockValid
flag whether the &#39;currentBlock&#39; index is valid
string subSystemName
label of the CTPPS sub-system
T getUntrackedParameter(std::string const &, T const &) const
double b
Definition: hdecay.h:118
unsigned int currentBlock
index of the current block in &#39;configuration&#39; array

◆ ~TotemDAQMappingESSourceXML()

TotemDAQMappingESSourceXML::~TotemDAQMappingESSourceXML ( )
override

Definition at line 332 of file TotemDAQMappingESSourceXML.cc.

332 {}

Member Function Documentation

◆ ChipFramePosition()

TotemFramePosition TotemDAQMappingESSourceXML::ChipFramePosition ( xercesc::DOMNode *  chipnode)
private

extracts VFAT's DAQ channel from XML attributes

Definition at line 899 of file TotemDAQMappingESSourceXML.cc.

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

Referenced by ParseTreeDiamond(), ParseTreeRP(), ParseTreeTotemT2(), and ParseTreeTotemTiming().

899  {
901  unsigned char attributeFlag = 0;
902 
903  DOMNamedNodeMap *attr = chipnode->getAttributes();
904  for (unsigned int j = 0; j < attr->getLength(); j++) {
905  DOMNode *a = attr->item(j);
906  if (fp.setXMLAttribute(
907  cms::xerces::toString(a->getNodeName()), cms::xerces::toString(a->getNodeValue()), attributeFlag) > 1) {
908  throw cms::Exception("TotemDAQMappingESSourceXML")
909  << "Unrecognized tag `" << cms::xerces::toString(a->getNodeName()) << "' or incompatible value `"
910  << cms::xerces::toString(a->getNodeValue()) << "'.";
911  }
912  }
913 
914  if (!fp.checkXMLAttributeFlag(attributeFlag)) {
915  throw cms::Exception("TotemDAQMappingESSourceXML")
916  << "Wrong/incomplete DAQ channel specification (attributeFlag = " << attributeFlag << ").";
917  }
918 
919  return fp;
920 }
std::string toString(XMLCh const *toTranscode)
double a
Definition: hdecay.h:119

◆ CommonNode()

bool TotemDAQMappingESSourceXML::CommonNode ( NodeType  type)
inlineprivate

◆ CompleteFileName()

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

adds the path prefix, if needed

Definition at line 336 of file TotemDAQMappingESSourceXML.cc.

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

Referenced by produce().

336  {
337  FileInPath fip(fn);
338  return fip.fullPath();
339 }

◆ DiamondNode()

bool TotemDAQMappingESSourceXML::DiamondNode ( NodeType  type)
inlineprivate

◆ GetChannels()

void TotemDAQMappingESSourceXML::GetChannels ( xercesc::DOMNode *  n,
std::set< unsigned char > &  channels 
)
private

Definition at line 973 of file TotemDAQMappingESSourceXML.cc.

References a, ewkTauDQM_cfi::channels, class-composition::children, Exception, mps_fire::i, l1ctLayer2EG_cff::id, dqmiolumiharvest::j, dqmiodumpmetadata::n, Test(), and cms::xerces::toString().

Referenced by ParseTreeRP().

973  {
974  DOMNodeList *children = n->getChildNodes();
975  for (unsigned int i = 0; i < children->getLength(); i++) {
976  DOMNode *n = children->item(i);
977  if (n->getNodeType() != DOMNode::ELEMENT_NODE || !Test(n, "channel"))
978  continue;
979 
980  DOMNamedNodeMap *attr = n->getAttributes();
981  bool idSet = false;
982  for (unsigned int j = 0; j < attr->getLength(); j++) {
983  DOMNode *a = attr->item(j);
984 
985  if (!strcmp(cms::xerces::toString(a->getNodeName()).c_str(), "id")) {
986  unsigned int id = 0;
987  sscanf(cms::xerces::toString(a->getNodeValue()).c_str(), "%u", &id);
988  channels.insert(id);
989  idSet = true;
990  break;
991  }
992  }
993 
994  if (!idSet) {
995  throw cms::Exception("TotemDAQMappingESSourceXML::GetChannels") << "Channel tags must have an `id' attribute.";
996  }
997  }
998 }
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:119

◆ GetNodeContent()

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

returns the content of the node

Definition at line 196 of file TotemDAQMappingESSourceXML.cc.

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

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

◆ GetNodeType()

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

determines node type

Definition at line 924 of file TotemDAQMappingESSourceXML.cc.

References Exception, dqmiodumpmetadata::n, nArm, nChip, nDiamondCh, nDiamondPlane, nRPPlane, nRPPot, nRPStation, nSampicBoard, nSampicChannel, nSkip, nTotemT2Plane, nTotemT2Tile, nTotemTimingCh, nTotemTimingPlane, tagArm, tagChip1, tagChip2, tagDiamondCh, tagDiamondPlane, tagRPPlane, tagRPPot, tagRPStation, tagSampicBoard, tagSampicCh, tagTotemT2Plane, tagTotemT2Tile, tagTotemTimingCh, tagTotemTimingPlane, Test(), and cms::xerces::toString().

Referenced by ParseTreeDiamond(), ParseTreeRP(), ParseTreeTotemT2(), and ParseTreeTotemTiming().

924  {
925  // common node types
926  if (Test(n, tagArm))
927  return nArm;
928  if (Test(n, tagChip1))
929  return nChip;
930  if (Test(n, tagChip2))
931  return nChip;
932 
933  // RP node types
934  if (Test(n, tagRPStation))
935  return nRPStation;
936  if (Test(n, tagRPPot))
937  return nRPPot;
938  if (Test(n, tagRPPlane))
939  return nRPPlane;
940 
941  //diamond specifics
942  if (Test(n, tagDiamondCh))
943  return nDiamondCh;
944  if (Test(n, tagDiamondPlane))
945  return nDiamondPlane;
946 
947  //totem timing specifics
948  if (Test(n, tagSampicBoard))
949  return nSampicBoard;
950  if (Test(n, tagSampicCh))
951  return nSampicChannel;
952  if (Test(n, tagTotemTimingCh))
953  return nTotemTimingCh;
954  if (Test(n, tagTotemTimingPlane))
955  return nTotemTimingPlane;
956 
957  // TOTEM nT2 specifics
958  if (Test(n, tagTotemT2Plane))
959  return nTotemT2Plane;
960  if (Test(n, tagTotemT2Tile))
961  return nTotemT2Tile;
962 
963  // for backward compatibility
964  if (Test(n, "trigger_vfat"))
965  return nSkip;
966 
967  throw cms::Exception("TotemDAQMappingESSourceXML::GetNodeType")
968  << "Unknown tag `" << cms::xerces::toString(n->getNodeName()) << "'.\n";
969 }
static const std::string tagDiamondPlane
diamond specific tags
static const std::string tagTotemT2Tile
static const std::string tagSampicCh
static const std::string tagChip1
COMMON Chip XML tags.
std::string toString(XMLCh const *toTranscode)
static const std::string tagTotemT2Plane
TOTEM nT2 specific tags.
static const std::string tagTotemTimingPlane
static const std::string tagDiamondCh
static const std::string tagRPStation
RP XML tags.
static const std::string tagArm
Common position tags.
bool Test(xercesc::DOMNode *node, const std::string &name)
returns true iff the node is of the given name
static const std::string tagSampicBoard
totem timing specific tags
static const std::string tagRPPlane
static const std::string tagTotemTimingCh

◆ GetNodeValue()

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

returns the value of the node

Definition at line 199 of file TotemDAQMappingESSourceXML.cc.

References cms::xerces::toString().

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

◆ ParseTreeDiamond()

void TotemDAQMappingESSourceXML::ParseTreeDiamond ( ParseType  pType,
xercesc::DOMNode *  parent,
NodeType  parentType,
unsigned int  parentID,
const std::unique_ptr< TotemDAQMapping > &  mapping,
const std::unique_ptr< TotemAnalysisMask > &  mask 
)
private

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

Definition at line 544 of file TotemDAQMappingESSourceXML.cc.

References a, class-composition::children, ChipFramePosition(), DiamondNode(), Exception, GetNodeType(), TotemVFATInfo::hwID, mps_fire::i, l1ctLayer2EG_cff::id, dqmiolumiharvest::j, taus_updatedMVAIds_cff::mapping, gpuClustering::pixelStatus::mask, dqmiodumpmetadata::n, nArm, nDiamondCh, nDiamondPlane, nRPPot, nRPStation, nTop, nUnknown, class-composition::parent, pMapping, TotemSymbID::symbolicID, TotemVFATInfo::symbolicID, and cms::xerces::toString().

Referenced by ParseXML().

549  {
550 #ifdef DEBUG
551  printf(">> TotemDAQMappingESSourceXML::ParseTreeDiamond(%s, %u, %u)\n",
552  cms::xerces::toString(parent->getNodeName()),
553  parentType,
554  parentID);
555 #endif
556 
557  DOMNodeList *children = parent->getChildNodes();
558 
559  for (unsigned int i = 0; i < children->getLength(); i++) {
560  DOMNode *n = children->item(i);
561  if (n->getNodeType() != DOMNode::ELEMENT_NODE)
562  continue;
563 
565 #ifdef DEBUG
566  printf("\tname = %s, type = %u\n", cms::xerces::toString(n->getNodeName()), type);
567 #endif
568 
569  // structure control
570  if (!DiamondNode(type))
571  continue;
572 
573  NodeType expectedParentType;
574  switch (type) {
575  case nArm:
576  expectedParentType = nTop;
577  break;
578  case nRPStation:
579  expectedParentType = nArm;
580  break;
581  case nRPPot:
582  expectedParentType = nRPStation;
583  break;
584  case nDiamondPlane:
585  expectedParentType = nRPPot;
586  break;
587  case nDiamondCh:
588  expectedParentType = nDiamondPlane;
589  break;
590  default:
591  expectedParentType = nUnknown;
592  break;
593  }
594 
595  if (expectedParentType != parentType) {
596  throw cms::Exception("TotemDAQMappingESSourceXML")
597  << "Node " << cms::xerces::toString(n->getNodeName()) << " not allowed within "
598  << cms::xerces::toString(parent->getNodeName()) << " block.\n";
599  }
600 
601  // parse tag attributes
602  unsigned int id = 0, hw_id = 0;
603  bool id_set = false, hw_id_set = false;
604  DOMNamedNodeMap *attr = n->getAttributes();
605 
606  for (unsigned int j = 0; j < attr->getLength(); j++) {
607  DOMNode *a = attr->item(j);
608 
609  if (!strcmp(cms::xerces::toString(a->getNodeName()).c_str(), "id")) {
610  sscanf(cms::xerces::toString(a->getNodeValue()).c_str(), "%u", &id);
611  id_set = true;
612  }
613 
614  if (!strcmp(cms::xerces::toString(a->getNodeName()).c_str(), "hw_id")) {
615  sscanf(cms::xerces::toString(a->getNodeValue()).c_str(), "%x", &hw_id);
616  hw_id_set = true;
617  }
618  }
619 
620  // content control
621  if (!id_set)
622  throw cms::Exception("TotemDAQMappingESSourceXML::ParseTreeDiamond")
623  << "id not given for element `" << cms::xerces::toString(n->getNodeName()) << "'";
624 
625  if (!hw_id_set && type == nDiamondCh && pType == pMapping)
626  throw cms::Exception("TotemDAQMappingESSourceXML::ParseTreeDiamond")
627  << "hw_id not given for element `" << cms::xerces::toString(n->getNodeName()) << "'";
628 
629  if (type == nDiamondPlane && id > 3)
630  throw cms::Exception("TotemDAQMappingESSourceXML::ParseTreeDiamond")
631  << "Plane IDs range from 0 to 3. id = " << id << " is invalid.";
632 
633 #ifdef DEBUG
634  printf("\tID found: 0x%x\n", id);
635 #endif
636 
637  // store mapping data
638  if (pType == pMapping && type == nDiamondCh) {
639  const TotemFramePosition &framepos = ChipFramePosition(n);
640 
641  TotemVFATInfo vfatInfo;
642  vfatInfo.hwID = hw_id;
643 
644  if (type == nDiamondCh) {
645  unsigned int ArmNum = (parentID / 10000) % 10;
646  unsigned int StationNum = (parentID / 1000) % 10;
647  unsigned int RpNum = (parentID / 100) % 10;
648  unsigned int PlaneNum = (parentID % 100);
649 
650  vfatInfo.symbolicID.symbolicID = CTPPSDiamondDetId(ArmNum, StationNum, RpNum, PlaneNum, id);
651  }
652 
653  mapping->insert(framepos, vfatInfo);
654 
655  continue;
656  }
657 
658  unsigned int childId;
659  if (pType == pMapping && type == nDiamondPlane)
660  childId = parentID * 100 + id;
661  else
662  childId = parentID * 10 + id;
663 
664  ParseTreeDiamond(pType, n, type, childId, mapping, mask);
665  }
666 }
NodeType
enumeration of XML node types
TotemSymbID symbolicID
the symbolic id
NodeType GetNodeType(xercesc::DOMNode *)
determines node type
constexpr uint32_t mask
Definition: gpuClustering.h:24
std::string toString(XMLCh const *toTranscode)
TotemFramePosition ChipFramePosition(xercesc::DOMNode *chipnode)
extracts VFAT&#39;s DAQ channel from XML attributes
void ParseTreeDiamond(ParseType, xercesc::DOMNode *, NodeType, unsigned int parentID, const std::unique_ptr< TotemDAQMapping > &, const std::unique_ptr< TotemAnalysisMask > &)
recursive method to extract RP-related information from the DOM tree
unsigned int symbolicID
chip ID, raw integer representation of DetId class
Definition: TotemSymbId.h:20
unsigned int hwID
the hardware ID (16 bit)
double a
Definition: hdecay.h:119
Detector ID class for CTPPS Timing Diamond detectors. Bits [19:31] : Assigend in CTPPSDetId Calss Bit...
Contains mappind data related to a VFAT.

◆ ParseTreeRP()

void TotemDAQMappingESSourceXML::ParseTreeRP ( ParseType  pType,
xercesc::DOMNode *  parent,
NodeType  parentType,
unsigned int  parentID,
const std::unique_ptr< TotemDAQMapping > &  mapping,
const std::unique_ptr< TotemAnalysisMask > &  mask 
)
private

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

Definition at line 399 of file TotemDAQMappingESSourceXML.cc.

References a, class-composition::children, ChipFramePosition(), Exception, TotemVFATAnalysisMask::fullMask, GetChannels(), GetNodeType(), TotemVFATInfo::hwID, mps_fire::i, l1ctLayer2EG_cff::id, dqmiolumiharvest::j, taus_updatedMVAIds_cff::mapping, gpuClustering::pixelStatus::mask, TotemVFATAnalysisMask::maskedChannels, dqmiodumpmetadata::n, nArm, nChannel, nChip, nRPPlane, nRPPot, nRPStation, nTop, nUnknown, class-composition::parent, pMapping, pMask, RPNode(), TotemSymbID::symbolicID, TotemVFATInfo::symbolicID, and cms::xerces::toString().

Referenced by ParseXML().

404  {
405 #ifdef DEBUG
406  printf(">> TotemDAQMappingESSourceXML::ParseTreeRP(%s, %u, %u)\n",
407  cms::xerces::toString(parent->getNodeName()),
408  parentType,
409  parentID);
410 #endif
411 
412  DOMNodeList *children = parent->getChildNodes();
413 
414  for (unsigned int i = 0; i < children->getLength(); i++) {
415  DOMNode *n = children->item(i);
416  if (n->getNodeType() != DOMNode::ELEMENT_NODE)
417  continue;
418 
420 
421 #ifdef DEBUG
422  printf("\tname = %s, type = %u\n", cms::xerces::toString(n->getNodeName()), type);
423 #endif
424 
425  // structure control
426  if (!RPNode(type))
427  continue;
428 
429  NodeType expectedParentType;
430  switch (type) {
431  case nArm:
432  expectedParentType = nTop;
433  break;
434  case nRPStation:
435  expectedParentType = nArm;
436  break;
437  case nRPPot:
438  expectedParentType = nRPStation;
439  break;
440  case nRPPlane:
441  expectedParentType = nRPPot;
442  break;
443  case nChip:
444  expectedParentType = nRPPlane;
445  break;
446  case nChannel:
447  expectedParentType = nChip;
448  break;
449  default:
450  expectedParentType = nUnknown;
451  break;
452  }
453 
454  if (expectedParentType != parentType) {
455  throw cms::Exception("TotemDAQMappingESSourceXML")
456  << "Node " << cms::xerces::toString(n->getNodeName()) << " not allowed within "
457  << cms::xerces::toString(parent->getNodeName()) << " block.\n";
458  }
459 
460  // parse tag attributes
461  unsigned int id = 0, hw_id = 0;
462  bool id_set = false, hw_id_set = false;
463  bool fullMask = false;
464  DOMNamedNodeMap *attr = n->getAttributes();
465 
466  for (unsigned int j = 0; j < attr->getLength(); j++) {
467  DOMNode *a = attr->item(j);
468 
469  if (!strcmp(cms::xerces::toString(a->getNodeName()).c_str(), "id")) {
470  sscanf(cms::xerces::toString(a->getNodeValue()).c_str(), "%u", &id);
471  id_set = true;
472  }
473 
474  if (!strcmp(cms::xerces::toString(a->getNodeName()).c_str(), "hw_id")) {
475  sscanf(cms::xerces::toString(a->getNodeValue()).c_str(), "%x", &hw_id);
476  hw_id_set = true;
477  }
478 
479  if (!strcmp(cms::xerces::toString(a->getNodeName()).c_str(), "full_mask"))
480  fullMask = (strcmp(cms::xerces::toString(a->getNodeValue()).c_str(), "no") != 0);
481  }
482 
483  // content control
484  if (!id_set)
485  throw cms::Exception("TotemDAQMappingESSourceXML::ParseTreeRP")
486  << "id not given for element `" << cms::xerces::toString(n->getNodeName()) << "'";
487 
488  if (!hw_id_set && type == nChip && pType == pMapping)
489  throw cms::Exception("TotemDAQMappingESSourceXML::ParseTreeRP")
490  << "hw_id not given for element `" << cms::xerces::toString(n->getNodeName()) << "'";
491 
492  if (type == nRPPlane && id > 9)
493  throw cms::Exception("TotemDAQMappingESSourceXML::ParseTreeRP")
494  << "Plane IDs range from 0 to 9. id = " << id << " is invalid.";
495 
496 #ifdef DEBUG
497  printf("\tID found: 0x%x\n", id);
498 #endif
499 
500  // store mapping data
501  if (pType == pMapping && type == nChip) {
502  const TotemFramePosition &framepos = ChipFramePosition(n);
503  TotemVFATInfo vfatInfo;
504  vfatInfo.hwID = hw_id;
505 
506  const unsigned int armIdx = (parentID / 1000) % 10;
507  const unsigned int stIdx = (parentID / 100) % 10;
508  const unsigned int rpIdx = (parentID / 10) % 10;
509  const unsigned int plIdx = parentID % 10;
510 
511  vfatInfo.symbolicID.symbolicID = TotemRPDetId(armIdx, stIdx, rpIdx, plIdx, id);
512 
513  mapping->insert(framepos, vfatInfo);
514 
515  continue;
516  }
517 
518  // store mask data
519  if (pType == pMask && type == nChip) {
520  const unsigned int armIdx = (parentID / 1000) % 10;
521  const unsigned int stIdx = (parentID / 100) % 10;
522  const unsigned int rpIdx = (parentID / 10) % 10;
523  const unsigned int plIdx = parentID % 10;
524 
525  TotemSymbID symbId;
526  symbId.symbolicID = TotemRPDetId(armIdx, stIdx, rpIdx, plIdx, id);
527 
529  am.fullMask = fullMask;
531 
532  mask->insert(symbId, am);
533 
534  continue;
535  }
536 
537  // recursion (deeper in the tree)
538  ParseTreeRP(pType, n, type, parentID * 10 + id, mapping, mask);
539  }
540 }
Detector ID class for TOTEM Si strip detectors.
Definition: TotemRPDetId.h:30
Contains data on masked channels of a VFAT.
NodeType
enumeration of XML node types
TotemSymbID symbolicID
the symbolic id
NodeType GetNodeType(xercesc::DOMNode *)
determines node type
constexpr uint32_t mask
Definition: gpuClustering.h:24
std::string toString(XMLCh const *toTranscode)
Symbolic ID describing an entity of a TOTEM subdetector.
Definition: TotemSymbId.h:17
TotemFramePosition ChipFramePosition(xercesc::DOMNode *chipnode)
extracts VFAT&#39;s DAQ channel from XML attributes
bool fullMask
whether all channels of the VFAT shall be masked
unsigned int symbolicID
chip ID, raw integer representation of DetId class
Definition: TotemSymbId.h:20
unsigned int hwID
the hardware ID (16 bit)
double a
Definition: hdecay.h:119
std::set< unsigned char > maskedChannels
list of channels to be masked
void ParseTreeRP(ParseType, xercesc::DOMNode *, NodeType, unsigned int parentID, const std::unique_ptr< TotemDAQMapping > &, const std::unique_ptr< TotemAnalysisMask > &)
recursive method to extract RP-related information from the DOM tree
void GetChannels(xercesc::DOMNode *n, std::set< unsigned char > &channels)
Contains mappind data related to a VFAT.

◆ ParseTreeTotemT2()

void TotemDAQMappingESSourceXML::ParseTreeTotemT2 ( ParseType  pType,
xercesc::DOMNode *  parent,
NodeType  parentType,
unsigned int  parentID,
const std::unique_ptr< TotemDAQMapping > &  mapping,
const std::unique_ptr< TotemAnalysisMask > &  mask 
)
private

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

Definition at line 808 of file TotemDAQMappingESSourceXML.cc.

References a, protons_cff::arm, class-composition::children, ChipFramePosition(), Exception, GetNodeType(), mps_fire::i, l1ctLayer2EG_cff::id, dqmiolumiharvest::j, taus_updatedMVAIds_cff::mapping, gpuClustering::pixelStatus::mask, nArm, nTop, nTotemT2Plane, nTotemT2Tile, nUnknown, class-composition::parent, pMapping, TotemSymbID::symbolicID, TotemVFATInfo::symbolicID, cms::xerces::toString(), and TotemT2Node().

Referenced by ParseXML().

813  {
814  DOMNodeList *children = parent->getChildNodes();
815 
816  for (unsigned int i = 0; i < children->getLength(); i++) {
817  DOMNode *child = children->item(i);
818  if (child->getNodeType() != DOMNode::ELEMENT_NODE)
819  continue;
820 
822 
823  // structure control
824  if (!TotemT2Node(type))
825  continue;
826 
827  NodeType expectedParentType;
828  switch (type) {
829  case nArm:
830  expectedParentType = nTop;
831  break;
832  case nTotemT2Plane:
833  expectedParentType = nArm;
834  break;
835  case nTotemT2Tile:
836  expectedParentType = nTotemT2Plane;
837  break;
838  default:
839  expectedParentType = nUnknown;
840  break;
841  }
842 
843  if (expectedParentType != parentType) {
844  throw cms::Exception("TotemDAQMappingESSourceXML")
845  << "Node " << cms::xerces::toString(child->getNodeName()) << " not allowed within "
846  << cms::xerces::toString(parent->getNodeName()) << " block.\n";
847  }
848 
849  unsigned int id = 0;
850  bool id_set = false;
851  DOMNamedNodeMap *attr = child->getAttributes();
852 
853  for (unsigned int j = 0; j < attr->getLength(); j++) {
854  DOMNode *a = attr->item(j);
855  if (!strcmp(cms::xerces::toString(a->getNodeName()).c_str(), "id")) {
856  sscanf(cms::xerces::toString(a->getNodeValue()).c_str(), "%u", &id);
857  id_set = true;
858  }
859  }
860  if (pType == pMapping && type == nTotemT2Tile) {
861  // parse tag attributes
862  unsigned int hw_id = 0;
863  bool hw_id_set = false;
864  DOMNamedNodeMap *attr = child->getAttributes();
865 
866  for (unsigned int j = 0; j < attr->getLength(); j++) {
867  DOMNode *a = attr->item(j);
868  if (!strcmp(cms::xerces::toString(a->getNodeName()).c_str(), "hwId")) {
869  sscanf(cms::xerces::toString(a->getNodeValue()).c_str(), "%u", &hw_id);
870  hw_id_set = true;
871  }
872  }
873 
874  // content control
875  if (!id_set)
876  throw cms::Exception("TotemDAQMappingESSourceXML::ParseTreeTotemT2")
877  << "id not given for element `" << cms::xerces::toString(child->getNodeName()) << "'";
878  if (!hw_id_set)
879  throw cms::Exception("TotemDAQMappingESSourceXML::ParseTreeTotemT2")
880  << "hwId not given for element `" << cms::xerces::toString(child->getNodeName()) << "'";
881 
882  // store mapping data
883  const TotemFramePosition &framepos = ChipFramePosition(child);
884  TotemVFATInfo vfatInfo;
885  unsigned int arm = parentID / 10, plane = parentID % 10;
886  vfatInfo.symbolicID.symbolicID = TotemT2DetId(arm, plane, id);
887 
888  mapping->insert(framepos, vfatInfo);
889 
890  continue;
891  }
892  // follow tree recursively
893  ParseTreeTotemT2(pType, child, type, parentID * 10 + id, mapping, mask);
894  }
895 }
Detector ID class for Totem T2 detectors. Bits [19:31] : Base CTPPSDetId class attributes Bits [16:18...
Definition: TotemT2DetId.h:25
NodeType
enumeration of XML node types
TotemSymbID symbolicID
the symbolic id
NodeType GetNodeType(xercesc::DOMNode *)
determines node type
void ParseTreeTotemT2(ParseType, xercesc::DOMNode *, NodeType, unsigned int parentID, const std::unique_ptr< TotemDAQMapping > &, const std::unique_ptr< TotemAnalysisMask > &)
recursive method to extract nT2-related information from the DOM tree
constexpr uint32_t mask
Definition: gpuClustering.h:24
std::string toString(XMLCh const *toTranscode)
TotemFramePosition ChipFramePosition(xercesc::DOMNode *chipnode)
extracts VFAT&#39;s DAQ channel from XML attributes
unsigned int symbolicID
chip ID, raw integer representation of DetId class
Definition: TotemSymbId.h:20
double a
Definition: hdecay.h:119
Contains mappind data related to a VFAT.

◆ ParseTreeTotemTiming()

void TotemDAQMappingESSourceXML::ParseTreeTotemTiming ( ParseType  pType,
xercesc::DOMNode *  parent,
NodeType  parentType,
unsigned int  parentID,
const std::unique_ptr< TotemDAQMapping > &  mapping,
const std::unique_ptr< TotemAnalysisMask > &  mask 
)
private

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

Definition at line 670 of file TotemDAQMappingESSourceXML.cc.

References a, class-composition::children, ChipFramePosition(), Exception, GetNodeType(), mps_fire::i, l1ctLayer2EG_cff::id, TotemTimingDetId::ID_NOT_SET, dqmiolumiharvest::j, taus_updatedMVAIds_cff::mapping, gpuClustering::pixelStatus::mask, dqmiodumpmetadata::n, nArm, nRPPot, nRPStation, nSampicBoard, nSampicChannel, nTop, nTotemTimingCh, nTotemTimingPlane, nUnknown, class-composition::parent, pMapping, sampicSubDetId, TotemSymbID::symbolicID, TotemVFATInfo::symbolicID, cms::xerces::toString(), and TotemTimingNode().

Referenced by ParseXML().

675  {
676  DOMNodeList *children = parent->getChildNodes();
677 
678  // Fill map hwId -> TotemTimingPlaneChannelPair
679  for (unsigned int i = 0; i < children->getLength(); i++) {
680  DOMNode *child = children->item(i);
681  if ((child->getNodeType() != DOMNode::ELEMENT_NODE) || (GetNodeType(child) != nTotemTimingCh))
682  continue;
683 
684  int plane = -1;
685  DOMNamedNodeMap *attr = parent->getAttributes();
686  for (unsigned int j = 0; j < attr->getLength(); j++) {
687  DOMNode *a = attr->item(j);
688 
689  if (!strcmp(cms::xerces::toString(a->getNodeName()).c_str(), "id"))
690  sscanf(cms::xerces::toString(a->getNodeValue()).c_str(), "%d", &plane);
691  }
692 
693  int channel = -1;
694  unsigned int hwId = 0;
695  attr = child->getAttributes();
696  for (unsigned int j = 0; j < attr->getLength(); j++) {
697  DOMNode *a = attr->item(j);
698 
699  if (!strcmp(cms::xerces::toString(a->getNodeName()).c_str(), "id"))
700  sscanf(cms::xerces::toString(a->getNodeValue()).c_str(), "%d", &channel);
701  if (!strcmp(cms::xerces::toString(a->getNodeName()).c_str(), "hwId"))
702  sscanf(cms::xerces::toString(a->getNodeValue()).c_str(), "%x", &hwId);
703  }
704 
705  mapping->totemTimingChannelMap[(uint8_t)hwId] = TotemDAQMapping::TotemTimingPlaneChannelPair(plane, channel);
706  }
707 
708  for (unsigned int i = 0; i < children->getLength(); i++) {
709  DOMNode *n = children->item(i);
710  if (n->getNodeType() != DOMNode::ELEMENT_NODE)
711  continue;
712 
714 
715  // structure control
716  if (!TotemTimingNode(type))
717  continue;
718 
719  NodeType expectedParentType;
720  switch (type) {
721  case nArm:
722  expectedParentType = nTop;
723  break;
724  case nRPStation:
725  expectedParentType = nArm;
726  break;
727  case nRPPot:
728  expectedParentType = nRPStation;
729  break;
730  case nSampicBoard:
731  expectedParentType = nRPPot;
732  break;
733  case nSampicChannel:
734  expectedParentType = nSampicBoard;
735  break;
736  case nTotemTimingPlane:
737  expectedParentType = nRPPot;
738  break;
739  case nTotemTimingCh:
740  expectedParentType = nTotemTimingPlane;
741  break;
742  default:
743  expectedParentType = nUnknown;
744  break;
745  }
746 
747  if (expectedParentType != parentType) {
748  throw cms::Exception("TotemDAQMappingESSourceXML")
749  << "Node " << cms::xerces::toString(n->getNodeName()) << " not allowed within "
750  << cms::xerces::toString(parent->getNodeName()) << " block.\n";
751  }
752 
753  // parse tag attributes
754  unsigned int id = 0;
755  bool id_set = false;
756  DOMNamedNodeMap *attr = n->getAttributes();
757 
758  for (unsigned int j = 0; j < attr->getLength(); j++) {
759  DOMNode *a = attr->item(j);
760 
761  if (!strcmp(cms::xerces::toString(a->getNodeName()).c_str(), "id")) {
762  sscanf(cms::xerces::toString(a->getNodeValue()).c_str(), "%u", &id);
763  id_set = true;
764  }
765  }
766 
767  // content control
768  if (!id_set)
769  throw cms::Exception("TotemDAQMappingESSourceXML::ParseTreeTotemTiming")
770  << "id not given for element `" << cms::xerces::toString(n->getNodeName()) << "'";
771  if (type == nSampicBoard && id > 5)
772  throw cms::Exception("TotemDAQMappingESSourceXML::ParseTreeTotemTiming")
773  << "SampicBoard IDs range from 0 to 5. id = " << id << " is invalid.";
774 
775  // store mapping data
776  if (pType == pMapping && type == nSampicChannel) {
777  const TotemFramePosition &framepos = ChipFramePosition(n);
778 
779  TotemVFATInfo vfatInfo;
780  unsigned int ArmNum = (parentID / 10000) % 10;
781  unsigned int StationNum = (parentID / 1000) % 10;
782  unsigned int RpNum = (parentID / 100) % 10;
783 
784  vfatInfo.symbolicID.symbolicID = TotemTimingDetId(ArmNum,
785  StationNum,
786  RpNum,
787  0,
789  sampicSubDetId); //Dynamical: it is encoded in the frame
790 
791  mapping->insert(framepos, vfatInfo);
792 
793  continue;
794  }
795 
796  unsigned int childId;
797  if (pType == pMapping && type == nSampicBoard)
798  childId = parentID * 100 + id;
799  else
800  childId = parentID * 10 + id;
801 
802  ParseTreeTotemTiming(pType, n, type, childId, mapping, mask);
803  }
804 }
NodeType
enumeration of XML node types
TotemSymbID symbolicID
the symbolic id
NodeType GetNodeType(xercesc::DOMNode *)
determines node type
constexpr uint32_t mask
Definition: gpuClustering.h:24
std::string toString(XMLCh const *toTranscode)
void ParseTreeTotemTiming(ParseType, xercesc::DOMNode *, NodeType, unsigned int parentID, const std::unique_ptr< TotemDAQMapping > &, const std::unique_ptr< TotemAnalysisMask > &)
recursive method to extract RP-related information from the DOM tree
TotemFramePosition ChipFramePosition(xercesc::DOMNode *chipnode)
extracts VFAT&#39;s DAQ channel from XML attributes
unsigned int symbolicID
chip ID, raw integer representation of DetId class
Definition: TotemSymbId.h:20
Hw Id mapping for Totem Timing (dynamical mapping in Sampic)
double a
Definition: hdecay.h:119
Contains mappind data related to a VFAT.
Detector ID class for CTPPS Totem Timing detectors. Bits [19:31] : Assigend in CTPPSDetId Calss Bits ...

◆ ParseXML()

void TotemDAQMappingESSourceXML::ParseXML ( ParseType  pType,
const string &  file,
const std::unique_ptr< TotemDAQMapping > &  mapping,
const std::unique_ptr< TotemAnalysisMask > &  mask 
)
private

parses XML file

Definition at line 370 of file TotemDAQMappingESSourceXML.cc.

References Exception, geometryDiff::file, taus_updatedMVAIds_cff::mapping, gpuClustering::pixelStatus::mask, nTop, writedatasetfile::parser, ParseTreeDiamond(), ParseTreeRP(), ParseTreeTotemT2(), and ParseTreeTotemTiming().

Referenced by produce().

373  {
374  unique_ptr<XercesDOMParser> parser(new XercesDOMParser());
375  parser->parse(file.c_str());
376 
377  DOMDocument *domDoc = parser->getDocument();
378 
379  if (!domDoc)
380  throw cms::Exception("TotemDAQMappingESSourceXML::ParseXML")
381  << "Cannot parse file `" << file << "' (domDoc = NULL).";
382 
383  DOMElement *elementRoot = domDoc->getDocumentElement();
384 
385  if (!elementRoot)
386  throw cms::Exception("TotemDAQMappingESSourceXML::ParseXML") << "File `" << file << "' is empty.";
387 
388  ParseTreeRP(pType, elementRoot, nTop, 0, mapping, mask);
389 
390  ParseTreeDiamond(pType, elementRoot, nTop, 0, mapping, mask);
391 
392  ParseTreeTotemTiming(pType, elementRoot, nTop, 0, mapping, mask);
393 
394  ParseTreeTotemT2(pType, elementRoot, nTop, 0, mapping, mask);
395 }
void ParseTreeTotemT2(ParseType, xercesc::DOMNode *, NodeType, unsigned int parentID, const std::unique_ptr< TotemDAQMapping > &, const std::unique_ptr< TotemAnalysisMask > &)
recursive method to extract nT2-related information from the DOM tree
constexpr uint32_t mask
Definition: gpuClustering.h:24
void ParseTreeTotemTiming(ParseType, xercesc::DOMNode *, NodeType, unsigned int parentID, const std::unique_ptr< TotemDAQMapping > &, const std::unique_ptr< TotemAnalysisMask > &)
recursive method to extract RP-related information from the DOM tree
void ParseTreeDiamond(ParseType, xercesc::DOMNode *, NodeType, unsigned int parentID, const std::unique_ptr< TotemDAQMapping > &, const std::unique_ptr< TotemAnalysisMask > &)
recursive method to extract RP-related information from the DOM tree
void ParseTreeRP(ParseType, xercesc::DOMNode *, NodeType, unsigned int parentID, const std::unique_ptr< TotemDAQMapping > &, const std::unique_ptr< TotemAnalysisMask > &)
recursive method to extract RP-related information from the DOM tree

◆ produce()

edm::ESProducts< std::unique_ptr< TotemDAQMapping >, std::unique_ptr< TotemAnalysisMask > > TotemDAQMappingESSourceXML::produce ( const TotemReadoutRcd )

Definition at line 344 of file TotemDAQMappingESSourceXML.cc.

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

344  {
346 
347  auto mapping = std::make_unique<TotemDAQMapping>();
348  auto mask = std::make_unique<TotemAnalysisMask>();
349 
350  // initialize Xerces
352 
353  // load mapping files
354  for (const auto &fn : configuration[currentBlock].mappingFileNames)
356 
357  // load mask files
358  for (const auto &fn : configuration[currentBlock].maskFileNames)
360 
361  // release Xerces
363 
364  // commit the products
366 }
ESProducts< std::remove_reference_t< TArgs >... > products(TArgs &&... args)
Definition: ESProducts.h:128
void xercesTerminate()
Definition: Xerces.cc:23
bool currentBlockValid
flag whether the &#39;currentBlock&#39; index is valid
void xercesInitialize()
Definition: Xerces.cc:18
assert(be >=bs)
std::vector< std::string > mappingFileNames
the mapping files
constexpr uint32_t mask
Definition: gpuClustering.h:24
void ParseXML(ParseType, const string &file, const std::unique_ptr< TotemDAQMapping > &, const std::unique_ptr< TotemAnalysisMask > &)
parses XML file
unsigned int currentBlock
index of the current block in &#39;configuration&#39; array
def move(src, dest)
Definition: eostools.py:511
string CompleteFileName(const string &fn)
adds the path prefix, if needed

◆ RPNode()

bool TotemDAQMappingESSourceXML::RPNode ( NodeType  type)
inlineprivate

◆ setIntervalFor()

void TotemDAQMappingESSourceXML::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 289 of file TotemDAQMappingESSourceXML.cc.

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

291  {
292  LogVerbatim("TotemDAQMappingESSourceXML") << ">> TotemDAQMappingESSourceXML::setIntervalFor(" << key.name() << ")";
293 
294  LogVerbatim("TotemDAQMappingESSourceXML")
295  << " run=" << iosv.eventID().run() << ", event=" << iosv.eventID().event();
296 
297  currentBlockValid = false;
298  for (unsigned int idx = 0; idx < configuration.size(); ++idx) {
299  const auto &bl = configuration[idx];
300 
301  edm::EventRange range = bl.validityRange;
302 
303  // If "<run>:min" is specified in python config, it is translated into event <run>:0:1.
304  // However, the truly minimal event id often found in data is <run>:0:0. Therefore the
305  // adjustment below is needed.
306  if (range.startEventID().luminosityBlock() == 0 && range.startEventID().event() == 1)
307  range = edm::EventRange(edm::EventID(range.startEventID().run(), 0, 0), range.endEventID());
308 
309  if (edm::contains(range, iosv.eventID())) {
310  currentBlockValid = true;
311  currentBlock = idx;
312 
313  const IOVSyncValue begin(range.startEventID());
314  const IOVSyncValue end(range.endEventID());
315  oValidity = edm::ValidityInterval(begin, end);
316 
317  LogVerbatim("TotemDAQMappingESSourceXML") << " block found: index=" << currentBlock << ", interval=("
318  << range.startEventID() << " - " << range.endEventID() << ")";
319 
320  return;
321  }
322  }
323 
324  if (!currentBlockValid) {
325  throw cms::Exception("TotemDAQMappingESSourceXML::setIntervalFor")
326  << "No configuration for event " << iosv.eventID();
327  }
328 }
Log< level::Info, true > LogVerbatim
bool contains(EventRange const &lh, EventID const &rh)
Definition: EventRange.cc:37
bool currentBlockValid
flag whether the &#39;currentBlock&#39; index is valid
std::pair< Time_t, Time_t > ValidityInterval
Definition: Time.h:17
RunNumber_t run() const
Definition: EventID.h:38
const EventID & eventID() const
Definition: IOVSyncValue.h:40
unsigned int currentBlock
index of the current block in &#39;configuration&#39; array
EventNumber_t event() const
Definition: EventID.h:40

◆ Test()

bool TotemDAQMappingESSourceXML::Test ( xercesc::DOMNode *  node,
const std::string &  name 
)
inlineprivate

returns true iff the node is of the given name

Definition at line 188 of file TotemDAQMappingESSourceXML.cc.

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

Referenced by GetChannels(), and GetNodeType().

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

◆ TotemT2Node()

bool TotemDAQMappingESSourceXML::TotemT2Node ( NodeType  type)
inlineprivate

◆ TotemTimingNode()

bool TotemDAQMappingESSourceXML::TotemTimingNode ( NodeType  type)
inlineprivate

Member Data Documentation

◆ configuration

vector<ConfigBlock> TotemDAQMappingESSourceXML::configuration
private

◆ currentBlock

unsigned int TotemDAQMappingESSourceXML::currentBlock
private

index of the current block in 'configuration' array

Definition at line 116 of file TotemDAQMappingESSourceXML.cc.

Referenced by produce(), and setIntervalFor().

◆ currentBlockValid

bool TotemDAQMappingESSourceXML::currentBlockValid
private

flag whether the 'currentBlock' index is valid

Definition at line 119 of file TotemDAQMappingESSourceXML.cc.

Referenced by produce(), and setIntervalFor().

◆ mappingFileNames

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

the mapping files

Definition at line 100 of file TotemDAQMappingESSourceXML.cc.

Referenced by produce().

◆ sampicSubDetId

unsigned int TotemDAQMappingESSourceXML::sampicSubDetId
private

Definition at line 97 of file TotemDAQMappingESSourceXML.cc.

Referenced by ParseTreeTotemTiming().

◆ subSystemName

string TotemDAQMappingESSourceXML::subSystemName
private

label of the CTPPS sub-system

Definition at line 94 of file TotemDAQMappingESSourceXML.cc.

Referenced by TotemDAQMappingESSourceXML().

◆ tagAnalysisMask

const string TotemDAQMappingESSourceXML::tagAnalysisMask = "analysisMask"
static

Definition at line 57 of file TotemDAQMappingESSourceXML.cc.

◆ tagArm

const string TotemDAQMappingESSourceXML::tagArm = "arm"
static

Common position tags.

Definition at line 60 of file TotemDAQMappingESSourceXML.cc.

Referenced by GetNodeType().

◆ tagChannel

const string TotemDAQMappingESSourceXML::tagChannel = "channel"
static

Definition at line 56 of file TotemDAQMappingESSourceXML.cc.

◆ tagChip1

const string TotemDAQMappingESSourceXML::tagChip1 = "vfat"
static

COMMON Chip XML tags.

Definition at line 68 of file TotemDAQMappingESSourceXML.cc.

Referenced by GetNodeType().

◆ tagChip2

const string TotemDAQMappingESSourceXML::tagChip2 = "test_vfat"
static

Definition at line 69 of file TotemDAQMappingESSourceXML.cc.

Referenced by GetNodeType().

◆ tagDiamondCh

const string TotemDAQMappingESSourceXML::tagDiamondCh = "diamond_channel"
static

Definition at line 73 of file TotemDAQMappingESSourceXML.cc.

Referenced by GetNodeType().

◆ tagDiamondPlane

const string TotemDAQMappingESSourceXML::tagDiamondPlane = "rp_plane_diamond"
static

diamond specific tags

Definition at line 72 of file TotemDAQMappingESSourceXML.cc.

Referenced by GetNodeType().

◆ tagRPPlane

const string TotemDAQMappingESSourceXML::tagRPPlane = "rp_plane"
static

Definition at line 65 of file TotemDAQMappingESSourceXML.cc.

Referenced by GetNodeType().

◆ tagRPPot

const string TotemDAQMappingESSourceXML::tagRPPot = "rp_detector_set"
static

Definition at line 64 of file TotemDAQMappingESSourceXML.cc.

Referenced by GetNodeType().

◆ tagRPStation

const string TotemDAQMappingESSourceXML::tagRPStation = "station"
static

RP XML tags.

Definition at line 63 of file TotemDAQMappingESSourceXML.cc.

Referenced by GetNodeType().

◆ tagSampicBoard

const string TotemDAQMappingESSourceXML::tagSampicBoard = "rp_sampic_board"
static

totem timing specific tags

Definition at line 76 of file TotemDAQMappingESSourceXML.cc.

Referenced by GetNodeType().

◆ tagSampicCh

const string TotemDAQMappingESSourceXML::tagSampicCh = "rp_sampic_channel"
static

Definition at line 77 of file TotemDAQMappingESSourceXML.cc.

Referenced by GetNodeType().

◆ tagTotemT2Plane

const string TotemDAQMappingESSourceXML::tagTotemT2Plane = "nt2_plane"
static

TOTEM nT2 specific tags.

Definition at line 82 of file TotemDAQMappingESSourceXML.cc.

Referenced by GetNodeType().

◆ tagTotemT2Tile

const string TotemDAQMappingESSourceXML::tagTotemT2Tile = "nt2_tile"
static

Definition at line 83 of file TotemDAQMappingESSourceXML.cc.

Referenced by GetNodeType().

◆ tagTotemTimingCh

const string TotemDAQMappingESSourceXML::tagTotemTimingCh = "timing_channel"
static

Definition at line 78 of file TotemDAQMappingESSourceXML.cc.

Referenced by GetNodeType().

◆ tagTotemTimingPlane

const string TotemDAQMappingESSourceXML::tagTotemTimingPlane = "timing_plane"
static

Definition at line 79 of file TotemDAQMappingESSourceXML.cc.

Referenced by GetNodeType().

◆ tagVFAT

const string TotemDAQMappingESSourceXML::tagVFAT = "vfat"
static

Definition at line 55 of file TotemDAQMappingESSourceXML.cc.

◆ verbosity

unsigned int TotemDAQMappingESSourceXML::verbosity
private

Definition at line 91 of file TotemDAQMappingESSourceXML.cc.