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
 
 ESProducer (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
 
ESProduceroperator= (const ESProducer &)=delete
 
ESProduceroperator= (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
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::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:165
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 907 of file TotemDAQMappingESSourceXML.cc.

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

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

907  {
909  unsigned char attributeFlag = 0;
910 
911  DOMNamedNodeMap *attr = chipnode->getAttributes();
912  for (unsigned int j = 0; j < attr->getLength(); j++) {
913  DOMNode *a = attr->item(j);
914  if (fp.setXMLAttribute(
915  cms::xerces::toString(a->getNodeName()), cms::xerces::toString(a->getNodeValue()), attributeFlag) > 1) {
916  throw cms::Exception("TotemDAQMappingESSourceXML")
917  << "Unrecognized tag `" << cms::xerces::toString(a->getNodeName()) << "' or incompatible value `"
918  << cms::xerces::toString(a->getNodeValue()) << "'.";
919  }
920  }
921 
922  if (!fp.checkXMLAttributeFlag(attributeFlag)) {
923  throw cms::Exception("TotemDAQMappingESSourceXML")
924  << "Wrong/incomplete DAQ channel specification (attributeFlag = " << attributeFlag << ").";
925  }
926 
927  return fp;
928 }
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 981 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().

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

932  {
933  // common node types
934  if (Test(n, tagArm))
935  return nArm;
936  if (Test(n, tagChip1))
937  return nChip;
938  if (Test(n, tagChip2))
939  return nChip;
940 
941  // RP node types
942  if (Test(n, tagRPStation))
943  return nRPStation;
944  if (Test(n, tagRPPot))
945  return nRPPot;
946  if (Test(n, tagRPPlane))
947  return nRPPlane;
948 
949  //diamond specifics
950  if (Test(n, tagDiamondCh))
951  return nDiamondCh;
952  if (Test(n, tagDiamondPlane))
953  return nDiamondPlane;
954 
955  //totem timing specifics
956  if (Test(n, tagSampicBoard))
957  return nSampicBoard;
958  if (Test(n, tagSampicCh))
959  return nSampicChannel;
960  if (Test(n, tagTotemTimingCh))
961  return nTotemTimingCh;
962  if (Test(n, tagTotemTimingPlane))
963  return nTotemTimingPlane;
964 
965  // TOTEM nT2 specifics
966  if (Test(n, tagTotemT2Plane))
967  return nTotemT2Plane;
968  if (Test(n, tagTotemT2Tile))
969  return nTotemT2Tile;
970 
971  // for backward compatibility
972  if (Test(n, "trigger_vfat"))
973  return nSkip;
974 
975  throw cms::Exception("TotemDAQMappingESSourceXML::GetNodeType")
976  << "Unknown tag `" << cms::xerces::toString(n->getNodeName()) << "'.\n";
977 }
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 552 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().

557  {
558 #ifdef DEBUG
559  printf(">> TotemDAQMappingESSourceXML::ParseTreeDiamond(%s, %u, %u)\n",
560  cms::xerces::toString(parent->getNodeName()),
561  parentType,
562  parentID);
563 #endif
564 
565  DOMNodeList *children = parent->getChildNodes();
566 
567  for (unsigned int i = 0; i < children->getLength(); i++) {
568  DOMNode *n = children->item(i);
569  if (n->getNodeType() != DOMNode::ELEMENT_NODE)
570  continue;
571 
573 #ifdef DEBUG
574  printf("\tname = %s, type = %u\n", cms::xerces::toString(n->getNodeName()), type);
575 #endif
576 
577  // structure control
578  if (!DiamondNode(type))
579  continue;
580 
581  NodeType expectedParentType;
582  switch (type) {
583  case nArm:
584  expectedParentType = nTop;
585  break;
586  case nRPStation:
587  expectedParentType = nArm;
588  break;
589  case nRPPot:
590  expectedParentType = nRPStation;
591  break;
592  case nDiamondPlane:
593  expectedParentType = nRPPot;
594  break;
595  case nDiamondCh:
596  expectedParentType = nDiamondPlane;
597  break;
598  default:
599  expectedParentType = nUnknown;
600  break;
601  }
602 
603  if (expectedParentType != parentType) {
604  throw cms::Exception("TotemDAQMappingESSourceXML")
605  << "Node " << cms::xerces::toString(n->getNodeName()) << " not allowed within "
606  << cms::xerces::toString(parent->getNodeName()) << " block.\n";
607  }
608 
609  // parse tag attributes
610  unsigned int id = 0, hw_id = 0;
611  bool id_set = false, hw_id_set = false;
612  DOMNamedNodeMap *attr = n->getAttributes();
613 
614  for (unsigned int j = 0; j < attr->getLength(); j++) {
615  DOMNode *a = attr->item(j);
616 
617  if (!strcmp(cms::xerces::toString(a->getNodeName()).c_str(), "id")) {
618  sscanf(cms::xerces::toString(a->getNodeValue()).c_str(), "%u", &id);
619  id_set = true;
620  }
621 
622  if (!strcmp(cms::xerces::toString(a->getNodeName()).c_str(), "hw_id")) {
623  sscanf(cms::xerces::toString(a->getNodeValue()).c_str(), "%x", &hw_id);
624  hw_id_set = true;
625  }
626  }
627 
628  // content control
629  if (!id_set)
630  throw cms::Exception("TotemDAQMappingESSourceXML::ParseTreeDiamond")
631  << "id not given for element `" << cms::xerces::toString(n->getNodeName()) << "'";
632 
633  if (!hw_id_set && type == nDiamondCh && pType == pMapping)
634  throw cms::Exception("TotemDAQMappingESSourceXML::ParseTreeDiamond")
635  << "hw_id not given for element `" << cms::xerces::toString(n->getNodeName()) << "'";
636 
637  if (type == nDiamondPlane && id > 3)
638  throw cms::Exception("TotemDAQMappingESSourceXML::ParseTreeDiamond")
639  << "Plane IDs range from 0 to 3. id = " << id << " is invalid.";
640 
641 #ifdef DEBUG
642  printf("\tID found: 0x%x\n", id);
643 #endif
644 
645  // store mapping data
646  if (pType == pMapping && type == nDiamondCh) {
647  const TotemFramePosition &framepos = ChipFramePosition(n);
648 
649  TotemVFATInfo vfatInfo;
650  vfatInfo.hwID = hw_id;
651 
652  if (type == nDiamondCh) {
653  unsigned int ArmNum = (parentID / 10000) % 10;
654  unsigned int StationNum = (parentID / 1000) % 10;
655  unsigned int RpNum = (parentID / 100) % 10;
656  unsigned int PlaneNum = (parentID % 100);
657 
658  vfatInfo.symbolicID.symbolicID = CTPPSDiamondDetId(ArmNum, StationNum, RpNum, PlaneNum, id);
659  }
660 
661  mapping->insert(framepos, vfatInfo);
662 
663  continue;
664  }
665 
666  unsigned int childId;
667  if (pType == pMapping && type == nDiamondPlane)
668  childId = parentID * 100 + id;
669  else
670  childId = parentID * 10 + id;
671 
672  ParseTreeDiamond(pType, n, type, childId, mapping, mask);
673  }
674 }
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:26
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 407 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().

412  {
413 #ifdef DEBUG
414  printf(">> TotemDAQMappingESSourceXML::ParseTreeRP(%s, %u, %u)\n",
415  cms::xerces::toString(parent->getNodeName()),
416  parentType,
417  parentID);
418 #endif
419 
420  DOMNodeList *children = parent->getChildNodes();
421 
422  for (unsigned int i = 0; i < children->getLength(); i++) {
423  DOMNode *n = children->item(i);
424  if (n->getNodeType() != DOMNode::ELEMENT_NODE)
425  continue;
426 
428 
429 #ifdef DEBUG
430  printf("\tname = %s, type = %u\n", cms::xerces::toString(n->getNodeName()), type);
431 #endif
432 
433  // structure control
434  if (!RPNode(type))
435  continue;
436 
437  NodeType expectedParentType;
438  switch (type) {
439  case nArm:
440  expectedParentType = nTop;
441  break;
442  case nRPStation:
443  expectedParentType = nArm;
444  break;
445  case nRPPot:
446  expectedParentType = nRPStation;
447  break;
448  case nRPPlane:
449  expectedParentType = nRPPot;
450  break;
451  case nChip:
452  expectedParentType = nRPPlane;
453  break;
454  case nChannel:
455  expectedParentType = nChip;
456  break;
457  default:
458  expectedParentType = nUnknown;
459  break;
460  }
461 
462  if (expectedParentType != parentType) {
463  throw cms::Exception("TotemDAQMappingESSourceXML")
464  << "Node " << cms::xerces::toString(n->getNodeName()) << " not allowed within "
465  << cms::xerces::toString(parent->getNodeName()) << " block.\n";
466  }
467 
468  // parse tag attributes
469  unsigned int id = 0, hw_id = 0;
470  bool id_set = false, hw_id_set = false;
471  bool fullMask = false;
472  DOMNamedNodeMap *attr = n->getAttributes();
473 
474  for (unsigned int j = 0; j < attr->getLength(); j++) {
475  DOMNode *a = attr->item(j);
476 
477  if (!strcmp(cms::xerces::toString(a->getNodeName()).c_str(), "id")) {
478  sscanf(cms::xerces::toString(a->getNodeValue()).c_str(), "%u", &id);
479  id_set = true;
480  }
481 
482  if (!strcmp(cms::xerces::toString(a->getNodeName()).c_str(), "hw_id")) {
483  sscanf(cms::xerces::toString(a->getNodeValue()).c_str(), "%x", &hw_id);
484  hw_id_set = true;
485  }
486 
487  if (!strcmp(cms::xerces::toString(a->getNodeName()).c_str(), "full_mask"))
488  fullMask = (strcmp(cms::xerces::toString(a->getNodeValue()).c_str(), "no") != 0);
489  }
490 
491  // content control
492  if (!id_set)
493  throw cms::Exception("TotemDAQMappingESSourceXML::ParseTreeRP")
494  << "id not given for element `" << cms::xerces::toString(n->getNodeName()) << "'";
495 
496  if (!hw_id_set && type == nChip && pType == pMapping)
497  throw cms::Exception("TotemDAQMappingESSourceXML::ParseTreeRP")
498  << "hw_id not given for element `" << cms::xerces::toString(n->getNodeName()) << "'";
499 
500  if (type == nRPPlane && id > 9)
501  throw cms::Exception("TotemDAQMappingESSourceXML::ParseTreeRP")
502  << "Plane IDs range from 0 to 9. id = " << id << " is invalid.";
503 
504 #ifdef DEBUG
505  printf("\tID found: 0x%x\n", id);
506 #endif
507 
508  // store mapping data
509  if (pType == pMapping && type == nChip) {
510  const TotemFramePosition &framepos = ChipFramePosition(n);
511  TotemVFATInfo vfatInfo;
512  vfatInfo.hwID = hw_id;
513 
514  const unsigned int armIdx = (parentID / 1000) % 10;
515  const unsigned int stIdx = (parentID / 100) % 10;
516  const unsigned int rpIdx = (parentID / 10) % 10;
517  const unsigned int plIdx = parentID % 10;
518 
519  vfatInfo.symbolicID.symbolicID = TotemRPDetId(armIdx, stIdx, rpIdx, plIdx, id);
520 
521  mapping->insert(framepos, vfatInfo);
522 
523  continue;
524  }
525 
526  // store mask data
527  if (pType == pMask && type == nChip) {
528  const unsigned int armIdx = (parentID / 1000) % 10;
529  const unsigned int stIdx = (parentID / 100) % 10;
530  const unsigned int rpIdx = (parentID / 10) % 10;
531  const unsigned int plIdx = parentID % 10;
532 
533  TotemSymbID symbId;
534  symbId.symbolicID = TotemRPDetId(armIdx, stIdx, rpIdx, plIdx, id);
535 
537  am.fullMask = fullMask;
539 
540  mask->insert(symbId, am);
541 
542  continue;
543  }
544 
545  // recursion (deeper in the tree)
546  ParseTreeRP(pType, n, type, parentID * 10 + id, mapping, mask);
547  }
548 }
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:26
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 816 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().

821  {
822  DOMNodeList *children = parent->getChildNodes();
823 
824  for (unsigned int i = 0; i < children->getLength(); i++) {
825  DOMNode *child = children->item(i);
826  if (child->getNodeType() != DOMNode::ELEMENT_NODE)
827  continue;
828 
830 
831  // structure control
832  if (!TotemT2Node(type))
833  continue;
834 
835  NodeType expectedParentType;
836  switch (type) {
837  case nArm:
838  expectedParentType = nTop;
839  break;
840  case nTotemT2Plane:
841  expectedParentType = nArm;
842  break;
843  case nTotemT2Tile:
844  expectedParentType = nTotemT2Plane;
845  break;
846  default:
847  expectedParentType = nUnknown;
848  break;
849  }
850 
851  if (expectedParentType != parentType) {
852  throw cms::Exception("TotemDAQMappingESSourceXML")
853  << "Node " << cms::xerces::toString(child->getNodeName()) << " not allowed within "
854  << cms::xerces::toString(parent->getNodeName()) << " block.\n";
855  }
856 
857  unsigned int id = 0;
858  bool id_set = false;
859  DOMNamedNodeMap *attr = child->getAttributes();
860 
861  for (unsigned int j = 0; j < attr->getLength(); j++) {
862  DOMNode *a = attr->item(j);
863  if (!strcmp(cms::xerces::toString(a->getNodeName()).c_str(), "id")) {
864  sscanf(cms::xerces::toString(a->getNodeValue()).c_str(), "%u", &id);
865  id_set = true;
866  }
867  }
868  if (pType == pMapping && type == nTotemT2Tile) {
869  // parse tag attributes
870  unsigned int hw_id = 0;
871  bool hw_id_set = false;
872  DOMNamedNodeMap *attr = child->getAttributes();
873 
874  for (unsigned int j = 0; j < attr->getLength(); j++) {
875  DOMNode *a = attr->item(j);
876  if (!strcmp(cms::xerces::toString(a->getNodeName()).c_str(), "hwId")) {
877  sscanf(cms::xerces::toString(a->getNodeValue()).c_str(), "%u", &hw_id);
878  hw_id_set = true;
879  }
880  }
881 
882  // content control
883  if (!id_set)
884  throw cms::Exception("TotemDAQMappingESSourceXML::ParseTreeTotemT2")
885  << "id not given for element `" << cms::xerces::toString(child->getNodeName()) << "'";
886  if (!hw_id_set)
887  throw cms::Exception("TotemDAQMappingESSourceXML::ParseTreeTotemT2")
888  << "hwId not given for element `" << cms::xerces::toString(child->getNodeName()) << "'";
889 
890  // store mapping data
891  const TotemFramePosition &framepos = ChipFramePosition(child);
892  TotemVFATInfo vfatInfo;
893  unsigned int arm = parentID / 10, plane = parentID % 10;
894  vfatInfo.symbolicID.symbolicID = TotemT2DetId(arm, plane, id);
895 
896  mapping->insert(framepos, vfatInfo);
897 
898  continue;
899  }
900  // follow tree recursively
901  ParseTreeTotemT2(pType, child, type, parentID * 10 + id, mapping, mask);
902  }
903 }
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:26
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 678 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().

683  {
684  DOMNodeList *children = parent->getChildNodes();
685 
686  // Fill map hwId -> TotemTimingPlaneChannelPair
687  for (unsigned int i = 0; i < children->getLength(); i++) {
688  DOMNode *child = children->item(i);
689  if ((child->getNodeType() != DOMNode::ELEMENT_NODE) || (GetNodeType(child) != nTotemTimingCh))
690  continue;
691 
692  int plane = -1;
693  DOMNamedNodeMap *attr = parent->getAttributes();
694  for (unsigned int j = 0; j < attr->getLength(); j++) {
695  DOMNode *a = attr->item(j);
696 
697  if (!strcmp(cms::xerces::toString(a->getNodeName()).c_str(), "id"))
698  sscanf(cms::xerces::toString(a->getNodeValue()).c_str(), "%d", &plane);
699  }
700 
701  int channel = -1;
702  unsigned int hwId = 0;
703  attr = child->getAttributes();
704  for (unsigned int j = 0; j < attr->getLength(); j++) {
705  DOMNode *a = attr->item(j);
706 
707  if (!strcmp(cms::xerces::toString(a->getNodeName()).c_str(), "id"))
708  sscanf(cms::xerces::toString(a->getNodeValue()).c_str(), "%d", &channel);
709  if (!strcmp(cms::xerces::toString(a->getNodeName()).c_str(), "hwId"))
710  sscanf(cms::xerces::toString(a->getNodeValue()).c_str(), "%x", &hwId);
711  }
712 
713  mapping->totemTimingChannelMap[(uint8_t)hwId] = TotemDAQMapping::TotemTimingPlaneChannelPair(plane, channel);
714  }
715 
716  for (unsigned int i = 0; i < children->getLength(); i++) {
717  DOMNode *n = children->item(i);
718  if (n->getNodeType() != DOMNode::ELEMENT_NODE)
719  continue;
720 
722 
723  // structure control
724  if (!TotemTimingNode(type))
725  continue;
726 
727  NodeType expectedParentType;
728  switch (type) {
729  case nArm:
730  expectedParentType = nTop;
731  break;
732  case nRPStation:
733  expectedParentType = nArm;
734  break;
735  case nRPPot:
736  expectedParentType = nRPStation;
737  break;
738  case nSampicBoard:
739  expectedParentType = nRPPot;
740  break;
741  case nSampicChannel:
742  expectedParentType = nSampicBoard;
743  break;
744  case nTotemTimingPlane:
745  expectedParentType = nRPPot;
746  break;
747  case nTotemTimingCh:
748  expectedParentType = nTotemTimingPlane;
749  break;
750  default:
751  expectedParentType = nUnknown;
752  break;
753  }
754 
755  if (expectedParentType != parentType) {
756  throw cms::Exception("TotemDAQMappingESSourceXML")
757  << "Node " << cms::xerces::toString(n->getNodeName()) << " not allowed within "
758  << cms::xerces::toString(parent->getNodeName()) << " block.\n";
759  }
760 
761  // parse tag attributes
762  unsigned int id = 0;
763  bool id_set = false;
764  DOMNamedNodeMap *attr = n->getAttributes();
765 
766  for (unsigned int j = 0; j < attr->getLength(); j++) {
767  DOMNode *a = attr->item(j);
768 
769  if (!strcmp(cms::xerces::toString(a->getNodeName()).c_str(), "id")) {
770  sscanf(cms::xerces::toString(a->getNodeValue()).c_str(), "%u", &id);
771  id_set = true;
772  }
773  }
774 
775  // content control
776  if (!id_set)
777  throw cms::Exception("TotemDAQMappingESSourceXML::ParseTreeTotemTiming")
778  << "id not given for element `" << cms::xerces::toString(n->getNodeName()) << "'";
779  if (type == nSampicBoard && id > 5)
780  throw cms::Exception("TotemDAQMappingESSourceXML::ParseTreeTotemTiming")
781  << "SampicBoard IDs range from 0 to 5. id = " << id << " is invalid.";
782 
783  // store mapping data
784  if (pType == pMapping && type == nSampicChannel) {
785  const TotemFramePosition &framepos = ChipFramePosition(n);
786 
787  TotemVFATInfo vfatInfo;
788  unsigned int ArmNum = (parentID / 10000) % 10;
789  unsigned int StationNum = (parentID / 1000) % 10;
790  unsigned int RpNum = (parentID / 100) % 10;
791 
792  vfatInfo.symbolicID.symbolicID = TotemTimingDetId(ArmNum,
793  StationNum,
794  RpNum,
795  0,
797  sampicSubDetId); //Dynamical: it is encoded in the frame
798 
799  mapping->insert(framepos, vfatInfo);
800 
801  continue;
802  }
803 
804  unsigned int childId;
805  if (pType == pMapping && type == nSampicBoard)
806  childId = parentID * 100 + id;
807  else
808  childId = parentID * 10 + id;
809 
810  ParseTreeTotemTiming(pType, n, type, childId, mapping, mask);
811  }
812 }
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:26
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 378 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().

381  {
382  unique_ptr<XercesDOMParser> parser(new XercesDOMParser());
383  parser->parse(file.c_str());
384 
385  DOMDocument *domDoc = parser->getDocument();
386 
387  if (!domDoc)
388  throw cms::Exception("TotemDAQMappingESSourceXML::ParseXML")
389  << "Cannot parse file `" << file << "' (domDoc = NULL).";
390 
391  DOMElement *elementRoot = domDoc->getDocumentElement();
392 
393  if (!elementRoot)
394  throw cms::Exception("TotemDAQMappingESSourceXML::ParseXML") << "File `" << file << "' is empty.";
395 
396  ParseTreeRP(pType, elementRoot, nTop, 0, mapping, mask);
397 
398  ParseTreeDiamond(pType, elementRoot, nTop, 0, mapping, mask);
399 
400  ParseTreeTotemTiming(pType, elementRoot, nTop, 0, mapping, mask);
401 
402  ParseTreeTotemT2(pType, elementRoot, nTop, 0, mapping, mask);
403 }
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:26
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 345 of file TotemDAQMappingESSourceXML.cc.

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

345  {
347 
348  auto mapping = std::make_unique<TotemDAQMapping>();
349  auto mask = std::make_unique<TotemAnalysisMask>();
350 
351  try {
352  // initialize Xerces
354 
355  // load mapping files
356  for (const auto &fn : configuration[currentBlock].mappingFileNames)
358 
359  // load mask files
360  for (const auto &fn : configuration[currentBlock].maskFileNames)
362 
363  // release Xerces
365  } catch (const XMLException &e) {
366  throw cms::Exception("XMLDocument") << "cms::concurrency::xercesInitialize failed because of "
367  << to_string(e.getMessage()) << std::endl;
368  } catch (const SAXException &e) {
369  throw cms::Exception("XMLDocument") << "XML parser reported: " << to_string(e.getMessage()) << "." << std::endl;
370  }
371 
372  // commit the products
374 }
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:26
static std::string to_string(const XMLCh *ch)
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.