CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Static 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::ESProductResolverFactoryProducer edm::eventsetup::ESProductResolverProvider

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
 
ESResolverIndex const * getTokenIndices (unsigned int iIndex) const
 
ESRecordIndex const * getTokenRecordIndices (unsigned int iIndex) const
 
bool hasMayConsumes () const noexcept
 
size_t numberOfTokenIndices (unsigned int iIndex) const
 
ESProduceroperator= (const ESProducer &)=delete
 
ESProduceroperator= (ESProducer &&)=delete
 
SerialTaskQueueChainqueue ()
 
template<typename Record >
std::optional< std::vector< ESResolverIndex > > updateFromMayConsumes (unsigned int iIndex, const Record &iRecord) const
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &) final
 
 ~ESProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::ESProductResolverFactoryProducer
 ESProductResolverFactoryProducer ()
 
 ESProductResolverFactoryProducer (const ESProductResolverFactoryProducer &)=delete
 
const ESProductResolverFactoryProduceroperator= (const ESProductResolverFactoryProducer &)=delete
 
 ~ESProductResolverFactoryProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::eventsetup::ESProductResolverProvider
void createKeyedResolvers (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
const ComponentDescriptiondescription () const
 
 ESProductResolverProvider ()
 
 ESProductResolverProvider (const ESProductResolverProvider &)=delete
 
void fillRecordsNotAllowingConcurrentIOVs (std::set< EventSetupRecordKey > &recordsNotAllowingConcurrentIOVs) const
 
virtual void initConcurrentIOVs (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
bool isUsingRecord (const EventSetupRecordKey &key) const
 
KeyedResolverskeyedResolvers (const EventSetupRecordKey &iRecordKey, unsigned int iovIndex=0)
 
const ESProductResolverProvideroperator= (const ESProductResolverProvider &)=delete
 
void setAppendToDataLabel (const edm::ParameterSet &)
 
void setDescription (const ComponentDescription &iDescription)
 
std::set< EventSetupRecordKeyusingRecords () const
 
virtual ~ESProductResolverProvider () noexcept(false)
 
- Public Member Functions inherited from edm::EventSetupRecordIntervalFinder
bool concurrentFinder () const
 
const eventsetup::ComponentDescriptiondescriptionForFinder () const
 
 EventSetupRecordIntervalFinder ()
 
 EventSetupRecordIntervalFinder (const EventSetupRecordIntervalFinder &)=delete
 
std::set< eventsetup::EventSetupRecordKeyfindingForRecords () const
 
const ValidityIntervalfindIntervalFor (const eventsetup::EventSetupRecordKey &, const IOVSyncValue &)
 
bool nonconcurrentAndIOVNeedsUpdate (const eventsetup::EventSetupRecordKey &key, const IOVSyncValue &syncValue) const
 
const EventSetupRecordIntervalFinderoperator= (const EventSetupRecordIntervalFinder &)=delete
 
void resetInterval (const eventsetup::EventSetupRecordKey &)
 
void setDescriptionForFinder (const eventsetup::ComponentDescription &iDescription)
 
virtual ~EventSetupRecordIntervalFinder () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &)
 
- Static Public Member Functions inherited from edm::eventsetup::ESProductResolverProvider
static void prevalidate (ConfigurationDescriptions &)
 

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::ESProductResolverFactoryProducer
template<class TFactory >
void registerFactory (std::unique_ptr< TFactory > iFactory, const std::string &iLabel=std::string())
 
virtual void registerFactoryWithKey (const EventSetupRecordKey &iRecord, std::unique_ptr< eventsetup::ESProductResolverFactoryBase > iFactory, const std::string &iLabel=std::string())
 
KeyedResolversVector registerResolvers (const EventSetupRecordKey &, unsigned int iovIndex) override
 
- Protected Member Functions inherited from edm::eventsetup::ESProductResolverProvider
template<class T >
void usingRecord ()
 
void usingRecordWithKey (const EventSetupRecordKey &key)
 
- Protected Member Functions inherited from edm::EventSetupRecordIntervalFinder
template<class T >
void findingRecord ()
 
void findingRecordWithKey (const eventsetup::EventSetupRecordKey &)
 

Private Types

enum  NodeType {
  nUnknown, nSkip, nTop, nArm,
  nRPStation, nRPPot, 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...
 
TotemT2FramePosition ChipT2FramePosition (xercesc::DOMNode *chipnode)
 extracts VFAT's DAQ channel from XML attributes for packed T2 payload 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...
 
bool packedPayload
 
unsigned int sampicSubDetId
 
string subSystemName
 label of the CTPPS sub-system More...
 
unsigned int verbosity
 

Additional Inherited Members

- Protected Types inherited from edm::ESProductResolverFactoryProducer
using EventSetupRecordKey = eventsetup::EventSetupRecordKey
 
- Protected Types inherited from edm::eventsetup::ESProductResolverProvider
using KeyedResolversVector = std::vector< std::pair< DataKey, std::shared_ptr< ESProductResolver > >>
 

Detailed Description

Loads TotemDAQMapping and TotemAnalysisMask from two XML files.

Definition at line 55 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 129 of file TotemDAQMappingESSourceXML.cc.

129  {
130  nUnknown,
131  nSkip,
132  nTop,
133  nArm,
134  nRPStation,
135  nRPPot,
136  nRPPlane,
138  nChip,
139  nDiamondCh,
140  nChannel,
141  nSampicBoard,
147  };

◆ ParseType

whether to parse a mapping of a mask XML

Enumerator
pMapping 
pMask 

Definition at line 150 of file TotemDAQMappingESSourceXML.cc.

Constructor & Destructor Documentation

◆ TotemDAQMappingESSourceXML()

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

Definition at line 279 of file TotemDAQMappingESSourceXML.cc.

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

280  : verbosity(conf.getUntrackedParameter<unsigned int>("verbosity", 0)),
281  subSystemName(conf.getUntrackedParameter<string>("subSystem")),
282  sampicSubDetId(conf.getParameter<unsigned int>("sampicSubDetId")),
283  packedPayload(conf.getParameter<bool>("multipleChannelsPerPayload")),
284  currentBlock(0),
285  currentBlockValid(false) {
286  for (const auto &it : conf.getParameter<vector<ParameterSet>>("configuration")) {
287  ConfigBlock b;
288  b.validityRange = it.getParameter<EventRange>("validityRange");
289  b.mappingFileNames = it.getParameter<vector<string>>("mappingFileNames");
290  b.maskFileNames = it.getParameter<vector<string>>("maskFileNames");
291  configuration.push_back(b);
292  }
293 
295  findingRecord<TotemReadoutRcd>();
296 }
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:166
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
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:120
unsigned int currentBlock
index of the current block in &#39;configuration&#39; array

◆ ~TotemDAQMappingESSourceXML()

TotemDAQMappingESSourceXML::~TotemDAQMappingESSourceXML ( )
override

Definition at line 343 of file TotemDAQMappingESSourceXML.cc.

343 {}

Member Function Documentation

◆ ChipFramePosition()

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

extracts VFAT's DAQ channel from XML attributes

Definition at line 940 of file TotemDAQMappingESSourceXML.cc.

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

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

940  {
942  unsigned char attributeFlag = 0;
943 
944  DOMNamedNodeMap *attr = chipnode->getAttributes();
945  for (unsigned int j = 0; j < attr->getLength(); j++) {
946  DOMNode *a = attr->item(j);
947  if (fp.setXMLAttribute(
948  cms::xerces::toString(a->getNodeName()), cms::xerces::toString(a->getNodeValue()), attributeFlag) > 1) {
949  throw cms::Exception("TotemDAQMappingESSourceXML")
950  << "Unrecognized tag `" << cms::xerces::toString(a->getNodeName()) << "' or incompatible value `"
951  << cms::xerces::toString(a->getNodeValue()) << "'.";
952  }
953  }
954 
955  if (!fp.checkXMLAttributeFlag(attributeFlag)) {
956  throw cms::Exception("TotemDAQMappingESSourceXML")
957  << "Wrong/incomplete DAQ channel specification (attributeFlag = " << attributeFlag << ").";
958  }
959 
960  return fp;
961 }
std::string toString(XMLCh const *toTranscode)
double a
Definition: hdecay.h:121

◆ ChipT2FramePosition()

TotemT2FramePosition TotemDAQMappingESSourceXML::ChipT2FramePosition ( xercesc::DOMNode *  chipnode)
private

extracts VFAT's DAQ channel from XML attributes for packed T2 payload

Definition at line 965 of file TotemDAQMappingESSourceXML.cc.

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

Referenced by ParseTreeTotemT2().

965  {
967  unsigned char attributeFlag = 0;
968 
969  DOMNamedNodeMap *attr = chipnode->getAttributes();
970  for (unsigned int j = 0; j < attr->getLength(); j++) {
971  DOMNode *a = attr->item(j);
972  if (fp.setXMLAttribute(
973  cms::xerces::toString(a->getNodeName()), cms::xerces::toString(a->getNodeValue()), attributeFlag) > 1) {
974  throw cms::Exception("TotemDAQMappingESSourceXML")
975  << "Unrecognized T2 tag `" << cms::xerces::toString(a->getNodeName()) << "' or incompatible value `"
976  << cms::xerces::toString(a->getNodeValue()) << "'.";
977  }
978  }
979 
980  if (!fp.checkXMLAttributeFlag(attributeFlag)) {
981  throw cms::Exception("TotemDAQMappingESSourceXML")
982  << "Wrong/incomplete T2 DAQ channel specification (attributeFlag = " << attributeFlag << ").";
983  }
984 
985  return fp;
986 }
std::string toString(XMLCh const *toTranscode)
double a
Definition: hdecay.h:121

◆ CommonNode()

bool TotemDAQMappingESSourceXML::CommonNode ( NodeType  type)
inlineprivate

◆ CompleteFileName()

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

adds the path prefix, if needed

Definition at line 347 of file TotemDAQMappingESSourceXML.cc.

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

Referenced by produce().

347  {
348  FileInPath fip(fn);
349  return fip.fullPath();
350 }

◆ DiamondNode()

bool TotemDAQMappingESSourceXML::DiamondNode ( NodeType  type)
inlineprivate

◆ fillDescriptions()

void TotemDAQMappingESSourceXML::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 1067 of file TotemDAQMappingESSourceXML.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), edm::ParameterSet::addParameter(), submitPVResolutionJobs::desc, and AlCaHLTBitMon_QueryRunRegistry::string.

1067  {
1068  // totemDAQMappingESSourceXML
1070  desc.addUntracked<unsigned int>("verbosity", 0);
1071  desc.addUntracked<std::string>("subSystem", "")->setComment("set it to: TrackingStrip, ...");
1072  desc.add<unsigned int>("sampicSubDetId");
1073  desc.add<bool>("multipleChannelsPerPayload", false);
1074  {
1076  vpsd1.add<edm::EventRange>("validityRange", edm::EventRange(1, 0, 1, 1, 0, 0));
1077  vpsd1.add<std::vector<std::string>>("mappingFileNames", {});
1078  vpsd1.add<std::vector<std::string>>("maskFileNames", {});
1079  std::vector<edm::ParameterSet> temp1;
1080  temp1.reserve(1);
1081  {
1082  edm::ParameterSet temp2;
1083  temp2.addParameter<edm::EventRange>("validityRange", edm::EventRange(1, 0, 1, 1, 0, 0));
1084  temp2.addParameter<std::vector<std::string>>("mappingFileNames", {});
1085  temp2.addParameter<std::vector<std::string>>("maskFileNames", {});
1086  temp1.push_back(temp2);
1087  }
1088  desc.addVPSet("configuration", vpsd1, temp1)->setComment("validityRange, mappingFileNames and maskFileNames");
1089  }
1090  descriptions.add("totemDAQMappingESSourceXML", desc);
1091  // or use the following to generate the label from the module's C++ type
1092  //descriptions.addWithDefaultLabel(desc);
1093 }
void addParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:136
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ GetChannels()

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

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

1038  {
1039  DOMNodeList *children = n->getChildNodes();
1040  for (unsigned int i = 0; i < children->getLength(); i++) {
1041  DOMNode *n = children->item(i);
1042  if (n->getNodeType() != DOMNode::ELEMENT_NODE || !Test(n, "channel"))
1043  continue;
1044 
1045  DOMNamedNodeMap *attr = n->getAttributes();
1046  bool idSet = false;
1047  for (unsigned int j = 0; j < attr->getLength(); j++) {
1048  DOMNode *a = attr->item(j);
1049 
1050  if (!strcmp(cms::xerces::toString(a->getNodeName()).c_str(), "id")) {
1051  unsigned int id = 0;
1052  sscanf(cms::xerces::toString(a->getNodeValue()).c_str(), "%u", &id);
1053  channels.insert(id);
1054  idSet = true;
1055  break;
1056  }
1057  }
1058 
1059  if (!idSet) {
1060  throw cms::Exception("TotemDAQMappingESSourceXML::GetChannels") << "Channel tags must have an `id' attribute.";
1061  }
1062  }
1063 }
std::string toString(XMLCh const *toTranscode)
bool Test(xercesc::DOMNode *node, const std::string &name)
returns true iff the node is of the given name
double a
Definition: hdecay.h:121

◆ GetNodeContent()

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

returns the content of the node

Definition at line 203 of file TotemDAQMappingESSourceXML.cc.

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

203 { 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 989 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().

989  {
990  // common node types
991  if (Test(n, tagArm))
992  return nArm;
993  if (Test(n, tagChip1))
994  return nChip;
995  if (Test(n, tagChip2))
996  return nChip;
997 
998  // RP node types
999  if (Test(n, tagRPStation))
1000  return nRPStation;
1001  if (Test(n, tagRPPot))
1002  return nRPPot;
1003  if (Test(n, tagRPPlane))
1004  return nRPPlane;
1005 
1006  //diamond specifics
1007  if (Test(n, tagDiamondCh))
1008  return nDiamondCh;
1009  if (Test(n, tagDiamondPlane))
1010  return nDiamondPlane;
1011 
1012  //totem timing specifics
1013  if (Test(n, tagSampicBoard))
1014  return nSampicBoard;
1015  if (Test(n, tagSampicCh))
1016  return nSampicChannel;
1017  if (Test(n, tagTotemTimingCh))
1018  return nTotemTimingCh;
1019  if (Test(n, tagTotemTimingPlane))
1020  return nTotemTimingPlane;
1021 
1022  // TOTEM nT2 specifics
1023  if (Test(n, tagTotemT2Plane))
1024  return nTotemT2Plane;
1025  if (Test(n, tagTotemT2Tile))
1026  return nTotemT2Tile;
1027 
1028  // for backward compatibility
1029  if (Test(n, "trigger_vfat"))
1030  return nSkip;
1031 
1032  throw cms::Exception("TotemDAQMappingESSourceXML::GetNodeType")
1033  << "Unknown tag `" << cms::xerces::toString(n->getNodeName()) << "'.\n";
1034 }
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 206 of file TotemDAQMappingESSourceXML.cc.

References cms::xerces::toString().

206 { 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 565 of file TotemDAQMappingESSourceXML.cc.

References a, class-composition::children, ChipFramePosition(), DiamondNode(), Exception, GetNodeType(), TotemVFATInfo::hwID, mps_fire::i, l1ctLayer2EG_cff::id, dqmiolumiharvest::j, HPSPFTaus_cff::mapping, ALPAKA_ACCELERATOR_NAMESPACE::pixelClustering::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().

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

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

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

Referenced by ParseXML().

834  {
835  DOMNodeList *children = parent->getChildNodes();
836 
837  for (unsigned int i = 0; i < children->getLength(); i++) {
838  DOMNode *child = children->item(i);
839  if (child->getNodeType() != DOMNode::ELEMENT_NODE)
840  continue;
841 
843 
844  // structure control
845  if (!TotemT2Node(type))
846  continue;
847 
848  NodeType expectedParentType;
849  switch (type) {
850  case nArm:
851  expectedParentType = nTop;
852  break;
853  case nTotemT2Plane:
854  expectedParentType = nArm;
855  break;
856  case nTotemT2Tile:
857  expectedParentType = nTotemT2Plane;
858  break;
859  default:
860  expectedParentType = nUnknown;
861  break;
862  }
863 
864  if (expectedParentType != parentType) {
865  throw cms::Exception("TotemDAQMappingESSourceXML")
866  << "Node " << cms::xerces::toString(child->getNodeName()) << " not allowed within "
867  << cms::xerces::toString(parent->getNodeName()) << " block.\n";
868  }
869 
870  unsigned int id = 0;
871  bool 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(), "id")) {
877  sscanf(cms::xerces::toString(a->getNodeValue()).c_str(), "%u", &id);
878  id_set = true;
879  }
880  }
881  if (pType == pMapping && type == nTotemT2Tile) {
882  // parse tag attributes
883  unsigned int hw_id = 0;
884  bool hw_id_set = false;
885  unsigned int channel_in_payload = 0;
886  bool payload_set = false;
887  DOMNamedNodeMap *attr = child->getAttributes();
888 
889  for (unsigned int j = 0; j < attr->getLength(); j++) {
890  DOMNode *a = attr->item(j);
891  if (!strcmp(cms::xerces::toString(a->getNodeName()).c_str(), "hwId")) {
892  sscanf(cms::xerces::toString(a->getNodeValue()).c_str(), "%x", &hw_id);
893  hw_id_set = true;
894  }
895  if (packedPayload && (!strcmp(cms::xerces::toString(a->getNodeName()).c_str(), "pay"))) {
896  sscanf(cms::xerces::toString(a->getNodeValue()).c_str(), "%u", &channel_in_payload);
897  payload_set = true;
898  }
899  }
900 
901  // content control
902  if (!id_set)
903  throw cms::Exception("TotemDAQMappingESSourceXML::ParseTreeTotemT2")
904  << "id not given for element `" << cms::xerces::toString(child->getNodeName()) << "'";
905  if (!hw_id_set)
906  throw cms::Exception("TotemDAQMappingESSourceXML::ParseTreeTotemT2")
907  << "hwId not given for element `" << cms::xerces::toString(child->getNodeName()) << "'";
908  if (packedPayload && (!payload_set))
909  throw cms::Exception("TotemDAQMappingESSourceXML::ParseTreeTotemT2")
910  << "Payload position in fibre not given for element `" << cms::xerces::toString(child->getNodeName())
911  << "'";
912 
913  // store mapping data
916  TotemVFATInfo vfatInfo;
917  vfatInfo.hwID = hw_id;
918  unsigned int arm = parentID / 10, plane = parentID % 10;
919  vfatInfo.symbolicID.symbolicID = TotemT2DetId(arm, plane, id);
920  if (verbosity > 2) {
921  edm::LogWarning("Totem") << "Print T2 frame pos (payload):" << framepos << " ("
922  << (packedPayload ? "true" : "false") << ") hw_id / T2 DetID" << hw_id << "/"
923  << TotemT2DetId(arm, plane, id) << endl;
924  }
925 
926  if (packedPayload)
927  mapping->insert(framepos, vfatInfo);
928  else
929  mapping->insert(frameposSingle, vfatInfo);
930 
931  continue;
932  }
933  // follow tree recursively
934  ParseTreeTotemT2(pType, child, type, parentID * 10 + id, mapping, mask);
935  }
936 }
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
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:21
unsigned int hwID
the hardware ID (16 bit)
double a
Definition: hdecay.h:121
Log< level::Warning, false > LogWarning
Contains mappind data related to a VFAT.
TotemT2FramePosition ChipT2FramePosition(xercesc::DOMNode *chipnode)
extracts VFAT&#39;s DAQ channel from XML attributes for packed T2 payload

◆ 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 691 of file TotemDAQMappingESSourceXML.cc.

References a, class-composition::children, ChipFramePosition(), Exception, GetNodeType(), mps_fire::i, l1ctLayer2EG_cff::id, TotemTimingDetId::ID_NOT_SET, dqmiolumiharvest::j, HPSPFTaus_cff::mapping, ALPAKA_ACCELERATOR_NAMESPACE::pixelClustering::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().

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

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

Referenced by produce().

394  {
395  unique_ptr<XercesDOMParser> parser(new XercesDOMParser());
396  parser->parse(file.c_str());
397 
398  DOMDocument *domDoc = parser->getDocument();
399 
400  if (!domDoc)
401  throw cms::Exception("TotemDAQMappingESSourceXML::ParseXML")
402  << "Cannot parse file `" << file << "' (domDoc = NULL).";
403 
404  DOMElement *elementRoot = domDoc->getDocumentElement();
405 
406  if (!elementRoot)
407  throw cms::Exception("TotemDAQMappingESSourceXML::ParseXML") << "File `" << file << "' is empty.";
408 
409  ParseTreeRP(pType, elementRoot, nTop, 0, mapping, mask);
410 
411  ParseTreeDiamond(pType, elementRoot, nTop, 0, mapping, mask);
412 
413  ParseTreeTotemTiming(pType, elementRoot, nTop, 0, mapping, mask);
414 
415  ParseTreeTotemT2(pType, elementRoot, nTop, 0, mapping, mask);
416 }
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
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 356 of file TotemDAQMappingESSourceXML.cc.

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

356  {
358 
359  auto mapping = std::make_unique<TotemDAQMapping>();
360  auto mask = std::make_unique<TotemAnalysisMask>();
361 
362  try {
363  // initialize Xerces
365 
366  // load mapping files
367  for (const auto &fn : configuration[currentBlock].mappingFileNames)
369 
370  // load mask files
371  for (const auto &fn : configuration[currentBlock].maskFileNames)
373 
374  // release Xerces
376  } catch (const XMLException &e) {
377  throw cms::Exception("XMLDocument") << "cms::concurrency::xercesInitialize failed because of "
378  << to_string(e.getMessage());
379  } catch (const SAXException &e) {
380  throw cms::Exception("XMLDocument") << "XML parser (SAX) reported: " << to_string(e.getMessage()) << ".";
381  } catch (const DOMException &e) {
382  throw cms::Exception("XMLDocument") << "XML parser (DOM) reported: " << to_string(e.getMessage()) << ".";
383  }
384 
385  // commit the products
387 }
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
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 300 of file TotemDAQMappingESSourceXML.cc.

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

302  {
303  LogVerbatim("TotemDAQMappingESSourceXML") << ">> TotemDAQMappingESSourceXML::setIntervalFor(" << key.name() << ")";
304 
305  LogVerbatim("TotemDAQMappingESSourceXML")
306  << " run=" << iosv.eventID().run() << ", event=" << iosv.eventID().event();
307 
308  currentBlockValid = false;
309  for (unsigned int idx = 0; idx < configuration.size(); ++idx) {
310  const auto &bl = configuration[idx];
311 
312  edm::EventRange range = bl.validityRange;
313 
314  // If "<run>:min" is specified in python config, it is translated into event <run>:0:1.
315  // However, the truly minimal event id often found in data is <run>:0:0. Therefore the
316  // adjustment below is needed.
317  if (range.startEventID().luminosityBlock() == 0 && range.startEventID().event() == 1)
318  range = edm::EventRange(edm::EventID(range.startEventID().run(), 0, 0), range.endEventID());
319 
320  if (edm::contains(range, iosv.eventID())) {
321  currentBlockValid = true;
322  currentBlock = idx;
323 
324  const IOVSyncValue begin(range.startEventID());
325  const IOVSyncValue end(range.endEventID());
326  oValidity = edm::ValidityInterval(begin, end);
327 
328  LogVerbatim("TotemDAQMappingESSourceXML") << " block found: index=" << currentBlock << ", interval=("
329  << range.startEventID() << " - " << range.endEventID() << ")";
330 
331  return;
332  }
333  }
334 
335  if (!currentBlockValid) {
336  throw cms::Exception("TotemDAQMappingESSourceXML::setIntervalFor")
337  << "No configuration for event " << iosv.eventID();
338  }
339 }
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
key
prepare the HTCondor submission files and eventually submit them
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 195 of file TotemDAQMappingESSourceXML.cc.

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

Referenced by GetChannels(), and GetNodeType().

195  {
196  return !(name.compare(cms::xerces::toString(node->getNodeName())));
197  }
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 123 of file TotemDAQMappingESSourceXML.cc.

Referenced by produce(), and setIntervalFor().

◆ currentBlockValid

bool TotemDAQMappingESSourceXML::currentBlockValid
private

flag whether the 'currentBlock' index is valid

Definition at line 126 of file TotemDAQMappingESSourceXML.cc.

Referenced by produce(), and setIntervalFor().

◆ mappingFileNames

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

the mapping files

Definition at line 107 of file TotemDAQMappingESSourceXML.cc.

Referenced by produce().

◆ packedPayload

bool TotemDAQMappingESSourceXML::packedPayload
private

Definition at line 104 of file TotemDAQMappingESSourceXML.cc.

Referenced by ParseTreeTotemT2().

◆ sampicSubDetId

unsigned int TotemDAQMappingESSourceXML::sampicSubDetId
private

Definition at line 101 of file TotemDAQMappingESSourceXML.cc.

Referenced by ParseTreeTotemTiming().

◆ subSystemName

string TotemDAQMappingESSourceXML::subSystemName
private

label of the CTPPS sub-system

Definition at line 98 of file TotemDAQMappingESSourceXML.cc.

Referenced by TotemDAQMappingESSourceXML().

◆ tagAnalysisMask

const string TotemDAQMappingESSourceXML::tagAnalysisMask = "analysisMask"
static

Definition at line 59 of file TotemDAQMappingESSourceXML.cc.

◆ tagArm

const string TotemDAQMappingESSourceXML::tagArm = "arm"
static

Common position tags.

Definition at line 62 of file TotemDAQMappingESSourceXML.cc.

Referenced by GetNodeType().

◆ tagChannel

const string TotemDAQMappingESSourceXML::tagChannel = "channel"
static

Definition at line 58 of file TotemDAQMappingESSourceXML.cc.

◆ tagChip1

const string TotemDAQMappingESSourceXML::tagChip1 = "vfat"
static

COMMON Chip XML tags.

Definition at line 70 of file TotemDAQMappingESSourceXML.cc.

Referenced by GetNodeType().

◆ tagChip2

const string TotemDAQMappingESSourceXML::tagChip2 = "test_vfat"
static

Definition at line 71 of file TotemDAQMappingESSourceXML.cc.

Referenced by GetNodeType().

◆ tagDiamondCh

const string TotemDAQMappingESSourceXML::tagDiamondCh = "diamond_channel"
static

Definition at line 75 of file TotemDAQMappingESSourceXML.cc.

Referenced by GetNodeType().

◆ tagDiamondPlane

const string TotemDAQMappingESSourceXML::tagDiamondPlane = "rp_plane_diamond"
static

diamond specific tags

Definition at line 74 of file TotemDAQMappingESSourceXML.cc.

Referenced by GetNodeType().

◆ tagRPPlane

const string TotemDAQMappingESSourceXML::tagRPPlane = "rp_plane"
static

Definition at line 67 of file TotemDAQMappingESSourceXML.cc.

Referenced by GetNodeType().

◆ tagRPPot

const string TotemDAQMappingESSourceXML::tagRPPot = "rp_detector_set"
static

Definition at line 66 of file TotemDAQMappingESSourceXML.cc.

Referenced by GetNodeType().

◆ tagRPStation

const string TotemDAQMappingESSourceXML::tagRPStation = "station"
static

RP XML tags.

Definition at line 65 of file TotemDAQMappingESSourceXML.cc.

Referenced by GetNodeType().

◆ tagSampicBoard

const string TotemDAQMappingESSourceXML::tagSampicBoard = "rp_sampic_board"
static

totem timing specific tags

Definition at line 78 of file TotemDAQMappingESSourceXML.cc.

Referenced by GetNodeType().

◆ tagSampicCh

const string TotemDAQMappingESSourceXML::tagSampicCh = "rp_sampic_channel"
static

Definition at line 79 of file TotemDAQMappingESSourceXML.cc.

Referenced by GetNodeType().

◆ tagTotemT2Plane

const string TotemDAQMappingESSourceXML::tagTotemT2Plane = "nt2_plane"
static

TOTEM nT2 specific tags.

Definition at line 84 of file TotemDAQMappingESSourceXML.cc.

Referenced by GetNodeType().

◆ tagTotemT2Tile

const string TotemDAQMappingESSourceXML::tagTotemT2Tile = "nt2_tile"
static

Definition at line 85 of file TotemDAQMappingESSourceXML.cc.

Referenced by GetNodeType().

◆ tagTotemTimingCh

const string TotemDAQMappingESSourceXML::tagTotemTimingCh = "timing_channel"
static

Definition at line 80 of file TotemDAQMappingESSourceXML.cc.

Referenced by GetNodeType().

◆ tagTotemTimingPlane

const string TotemDAQMappingESSourceXML::tagTotemTimingPlane = "timing_plane"
static

Definition at line 81 of file TotemDAQMappingESSourceXML.cc.

Referenced by GetNodeType().

◆ tagVFAT

const string TotemDAQMappingESSourceXML::tagVFAT = "vfat"
static

Definition at line 57 of file TotemDAQMappingESSourceXML.cc.

◆ verbosity

unsigned int TotemDAQMappingESSourceXML::verbosity
private

Definition at line 95 of file TotemDAQMappingESSourceXML.cc.

Referenced by ParseTreeTotemT2().