test
CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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
< boost::shared_ptr
< TotemDAQMapping >
, boost::shared_ptr
< TotemAnalysisMask > > 
produce (const TotemReadoutRcd &)
 
 TotemDAQMappingESSourceXML (const edm::ParameterSet &)
 
 ~TotemDAQMappingESSourceXML ()
 
- Public Member Functions inherited from edm::ESProducer
 ESProducer ()
 
virtual ~ESProducer ()
 
- Public Member Functions inherited from edm::ESProxyFactoryProducer
 ESProxyFactoryProducer ()
 
virtual void newInterval (const eventsetup::EventSetupRecordKey &iRecordType, const ValidityInterval &iInterval)
 overrides DataProxyProvider method More...
 
virtual ~ESProxyFactoryProducer ()
 
- Public Member Functions inherited from edm::eventsetup::DataProxyProvider
 DataProxyProvider ()
 
const ComponentDescriptiondescription () const
 
bool isUsingRecord (const EventSetupRecordKey &) const
 
const KeyedProxieskeyedProxies (const EventSetupRecordKey &iRecordKey) const
 
void resetProxies (const EventSetupRecordKey &iRecordType)
 
void resetProxiesIfTransient (const EventSetupRecordKey &iRecordType)
 
void setAppendToDataLabel (const edm::ParameterSet &)
 
void setDescription (const ComponentDescription &iDescription)
 
std::set< EventSetupRecordKeyusingRecords () const
 
virtual ~DataProxyProvider ()
 
- Public Member Functions inherited from edm::EventSetupRecordIntervalFinder
const
eventsetup::ComponentDescription
descriptionForFinder () const
 
 EventSetupRecordIntervalFinder ()
 
std::set
< eventsetup::EventSetupRecordKey
findingForRecords () const
 
const ValidityIntervalfindIntervalFor (const eventsetup::EventSetupRecordKey &, const IOVSyncValue &)
 
void setDescriptionForFinder (const eventsetup::ComponentDescription &iDescription)
 
virtual ~EventSetupRecordIntervalFinder ()
 

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 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 tagT1 ="t1_detector_set"
 T1 XML tags. More...
 
static const std::string tagT1Arm ="t1_arm"
 
static const std::string tagT1ChannelType ="t1_channel_type"
 
static const std::string tagT1CSC ="t1_csc"
 
static const std::string tagT1Plane ="t1_plane"
 
static const std::string tagT2 ="t2_detector_set"
 T2 XML tags. More...
 
static const std::string tagT2detector ="t2_detector"
 
static const std::string tagT2Half ="t2_half"
 
static const std::string tagTriggerVFAT1 = "trigger_vfat"
 
static const std::string tagVFAT ="vfat"
 

Protected Member Functions

virtual void setIntervalFor (const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &)
 sets infinite validity of this data More...
 
- Protected Member Functions inherited from edm::ESProducer
template<typename T >
void setWhatProduced (T *iThis, const es::Label &iLabel=es::Label())
 
template<typename T >
void setWhatProduced (T *iThis, const char *iLabel)
 
template<typename T >
void setWhatProduced (T *iThis, const std::string &iLabel)
 
template<typename T , typename TDecorator >
void setWhatProduced (T *iThis, const TDecorator &iDec, const es::Label &iLabel=es::Label())
 
template<typename T , typename TReturn , typename TRecord >
void setWhatProduced (T *iThis, TReturn(T::*iMethod)(const TRecord &), const es::Label &iLabel=es::Label())
 
template<typename T , typename TReturn , typename TRecord , typename TArg >
void setWhatProduced (T *iThis, TReturn(T::*iMethod)(const TRecord &), const TArg &iDec, const es::Label &iLabel=es::Label())
 
- Protected Member Functions inherited from edm::ESProxyFactoryProducer
template<class TFactory >
void registerFactory (std::auto_ptr< TFactory > iFactory, const std::string &iLabel=std::string())
 
virtual void registerFactoryWithKey (const eventsetup::EventSetupRecordKey &iRecord, std::auto_ptr< eventsetup::ProxyFactoryBase > &iFactory, const std::string &iLabel=std::string())
 
virtual void registerProxies (const eventsetup::EventSetupRecordKey &iRecord, KeyedProxies &aProxyList)
 override DataProxyProvider method More...
 
- Protected Member Functions inherited from edm::eventsetup::DataProxyProvider
void eraseAll (const EventSetupRecordKey &iRecordKey)
 deletes all the Proxies in aStream More...
 
void invalidateProxies (const EventSetupRecordKey &iRecordKey)
 
template<class T >
void usingRecord ()
 
void usingRecordWithKey (const EventSetupRecordKey &)
 
- Protected Member Functions inherited from edm::EventSetupRecordIntervalFinder
template<class T >
void findingRecord ()
 
void findingRecordWithKey (const eventsetup::EventSetupRecordKey &)
 

Private Types

enum  NodeType {
  nUnknown, nTop, nArm, nRPStation,
  nRPPot, nRPPlane, nChip, nTriggerVFAT,
  nT2, nT2Half, nT2Det, nT1,
  nT1Arm, nT1Plane, nT1CSC, nT1ChannelType,
  nChannel
}
 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...
 
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 ParseTreeRP (ParseType, xercesc::DOMNode *, NodeType, unsigned int parentID, const boost::shared_ptr< TotemDAQMapping > &, const boost::shared_ptr< TotemAnalysisMask > &)
 recursive method to extract RP-related information from the DOM tree More...
 
void ParseTreeT1 (ParseType, xercesc::DOMNode *, NodeType, unsigned int parentID, const boost::shared_ptr< TotemDAQMapping > &, const boost::shared_ptr< TotemAnalysisMask > &, unsigned int T1Arm, unsigned int T1Plane, unsigned int T1CSC)
 recursive method to extract RP-related information from the DOM tree More...
 
void ParseTreeT2 (ParseType, xercesc::DOMNode *, NodeType, unsigned int parentID, const boost::shared_ptr< TotemDAQMapping > &, const boost::shared_ptr< TotemAnalysisMask > &)
 recursive method to extract RP-related information from the DOM tree More...
 
void ParseXML (ParseType, const string &file, const boost::shared_ptr< TotemDAQMapping > &, const boost::shared_ptr< TotemAnalysisMask > &)
 parses XML file More...
 
bool RPNode (NodeType type)
 
bool T1Node (NodeType type)
 
bool T2Node (NodeType type)
 
bool Test (xercesc::DOMNode *node, const std::string &name)
 returns true iff the node is of the given name More...
 

Private Attributes

vector< ConfigBlockconfiguration
 
unsigned int currentBlock
 index of the current block in 'configuration' array More...
 
bool currentBlockValid
 flag whether the 'currentBlock' index is valid More...
 
unsigned int verbosity
 

Additional Inherited Members

- Public Types inherited from edm::eventsetup::DataProxyProvider
typedef std::vector< std::pair
< DataKey,
edm::propagate_const
< std::shared_ptr< DataProxy > > > > 
KeyedProxies
 
typedef std::vector
< EventSetupRecordKey
Keys
 
typedef std::map
< EventSetupRecordKey,
KeyedProxies
RecordProxies
 
- Static Public Member Functions inherited from edm::eventsetup::DataProxyProvider
static void prevalidate (ConfigurationDescriptions &)
 

Detailed Description

Loads TotemDAQMapping and TotemAnalysisMask from two XML files.

Definition at line 45 of file TotemDAQMappingESSourceXML.cc.

Member Enumeration Documentation

enumeration of XML node types

Enumerator
nUnknown 
nTop 
nArm 
nRPStation 
nRPPot 
nRPPlane 
nChip 
nTriggerVFAT 
nT2 
nT2Half 
nT2Det 
nT1 
nT1Arm 
nT1Plane 
nT1CSC 
nT1ChannelType 
nChannel 

Definition at line 106 of file TotemDAQMappingESSourceXML.cc.

whether to parse a mapping of a mask XML

Enumerator
pMapping 
pMask 

Definition at line 110 of file TotemDAQMappingESSourceXML.cc.

Constructor & Destructor Documentation

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

Definition at line 220 of file TotemDAQMappingESSourceXML.cc.

References b, configuration, edm::ParameterSet::getParameter(), TotemDAQMappingESSourceXML::ConfigBlock::mappingFileNames, TotemDAQMappingESSourceXML::ConfigBlock::maskFileNames, edm::ESProducer::setWhatProduced(), and TotemDAQMappingESSourceXML::ConfigBlock::validityRange.

220  :
221  verbosity(conf.getUntrackedParameter<unsigned int>("verbosity", 0)),
222  currentBlock(0),
223  currentBlockValid(false)
224 {
225  for (const auto it : conf.getParameter<vector<ParameterSet>>("configuration"))
226  {
227  ConfigBlock b;
228  b.validityRange = it.getParameter<EventRange>("validityRange");
229  b.mappingFileNames = it.getParameter< vector<string> >("mappingFileNames");
230  b.maskFileNames = it.getParameter< vector<string> >("maskFileNames");
231  configuration.push_back(b);
232  }
233 
234  setWhatProduced(this);
235  findingRecord<TotemReadoutRcd>();
236 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
bool currentBlockValid
flag whether the &#39;currentBlock&#39; index is valid
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
Definition: ESProducer.h:115
double b
Definition: hdecay.h:120
unsigned int currentBlock
index of the current block in &#39;configuration&#39; array
TotemDAQMappingESSourceXML::~TotemDAQMappingESSourceXML ( )

Definition at line 285 of file TotemDAQMappingESSourceXML.cc.

286 {
287 }

Member Function Documentation

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

extracts VFAT's DAQ channel from XML attributes

Definition at line 1004 of file TotemDAQMappingESSourceXML.cc.

References a, TotemFramePosition::checkXMLAttributeFlag(), Exception, personalPlayback::fp, j, TotemFramePosition::setXMLAttribute(), and XERCES_CPP_NAMESPACE_USE::transcode().

Referenced by ParseTreeRP(), ParseTreeT1(), and ParseTreeT2().

1005 {
1007  unsigned char attributeFlag = 0;
1008 
1009  DOMNamedNodeMap* attr = chipnode->getAttributes();
1010  for (unsigned int j = 0; j < attr->getLength(); j++)
1011  {
1012  DOMNode *a = attr->item(j);
1013  if (fp.setXMLAttribute(XMLString::transcode(a->getNodeName()), XMLString::transcode(a->getNodeValue()), attributeFlag) > 1)
1014  {
1015  throw cms::Exception("TotemDAQMappingESSourceXML") <<
1016  "Unrecognized tag `" << XMLString::transcode(a->getNodeName()) <<
1017  "' or incompatible value `" << XMLString::transcode(a->getNodeValue()) <<
1018  "'." << endl;
1019  }
1020  }
1021 
1022  if (!fp.checkXMLAttributeFlag(attributeFlag))
1023  {
1024  throw cms::Exception("TotemDAQMappingESSourceXML") <<
1025  "Wrong/incomplete DAQ channel specification (attributeFlag = " << attributeFlag << ")." << endl;
1026  }
1027 
1028  return fp;
1029 }
XMLCh * transcode(const T &fInput)
int j
Definition: DBlmapReader.cc:9
double a
Definition: hdecay.h:121
static bool checkXMLAttributeFlag(unsigned char flag)
returns true if all attributes have been set
unsigned char setXMLAttribute(const std::string &attribute, const std::string &value, unsigned char &flag)
bool TotemDAQMappingESSourceXML::CommonNode ( NodeType  type)
inlineprivate
string TotemDAQMappingESSourceXML::CompleteFileName ( const string &  fn)
private

adds the path prefix, if needed

Definition at line 291 of file TotemDAQMappingESSourceXML.cc.

References edm::FileInPath::fullPath().

Referenced by produce().

292 {
293  FileInPath fip(fn);
294  return fip.fullPath();
295 }
void TotemDAQMappingESSourceXML::GetChannels ( xercesc::DOMNode *  n,
std::set< unsigned char > &  channels 
)
private

Definition at line 1066 of file TotemDAQMappingESSourceXML.cc.

References a, Exception, i, j, Test(), and XERCES_CPP_NAMESPACE_USE::transcode().

Referenced by ParseTreeRP(), ParseTreeT1(), and ParseTreeT2().

1067 {
1068  DOMNodeList *children = n->getChildNodes();
1069  for (unsigned int i = 0; i < children->getLength(); i++)
1070  {
1071  DOMNode *n = children->item(i);
1072  if (n->getNodeType() != DOMNode::ELEMENT_NODE || !Test(n, "channel"))
1073  continue;
1074 
1075  DOMNamedNodeMap* attr = n->getAttributes();
1076  bool idSet = false;
1077  for (unsigned int j = 0; j < attr->getLength(); j++)
1078  {
1079  DOMNode *a = attr->item(j);
1080 
1081  if (!strcmp(XMLString::transcode(a->getNodeName()), "id"))
1082  {
1083  unsigned int id = 0;
1084  sscanf(XMLString::transcode(a->getNodeValue()), "%u", &id);
1085  channels.insert(id);
1086  idSet = true;
1087  break;
1088  }
1089  }
1090 
1091  if (!idSet)
1092  {
1093  throw cms::Exception("TotemDAQMappingESSourceXML::GetChannels") <<
1094  "Channel tags must have an `id' attribute.";
1095  }
1096  }
1097 }
int i
Definition: DBlmapReader.cc:9
XMLCh * transcode(const T &fInput)
int j
Definition: DBlmapReader.cc:9
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
string TotemDAQMappingESSourceXML::GetNodeContent ( xercesc::DOMNode *  parent)
inlineprivate

returns the content of the node

Definition at line 142 of file TotemDAQMappingESSourceXML.cc.

References AlCaHLTBitMon_QueryRunRegistry::string, and XERCES_CPP_NAMESPACE_USE::transcode().

143  {
144  return string(xercesc::XMLString::transcode(parent->getTextContent()));
145  }
XMLCh * transcode(const T &fInput)
TotemDAQMappingESSourceXML::NodeType TotemDAQMappingESSourceXML::GetNodeType ( xercesc::DOMNode *  n)
private

determines node type

Definition at line 1033 of file TotemDAQMappingESSourceXML.cc.

References Exception, nArm, nChannel, nChip, nRPPlane, nRPPot, nRPStation, nT1, nT1Arm, nT1ChannelType, nT1CSC, nT1Plane, nT2, nT2Det, nT2Half, nTriggerVFAT, tagArm, tagChannel, tagChip1, tagChip2, tagRPPlane, tagRPPot, tagRPStation, tagT1, tagT1Arm, tagT1ChannelType, tagT1CSC, tagT1Plane, tagT2, tagT2detector, tagT2Half, tagTriggerVFAT1, Test(), and XERCES_CPP_NAMESPACE_USE::transcode().

Referenced by ParseTreeRP(), ParseTreeT1(), and ParseTreeT2().

1034 {
1035  // common node types
1036  if (Test(n, tagArm)) return nArm;
1037  if (Test(n, tagChip1)) return nChip;
1038  if (Test(n, tagChip2)) return nChip;
1039  if (Test(n, tagTriggerVFAT1)) return nTriggerVFAT;
1040 
1041  // RP node types
1042  if (Test(n, tagRPStation)) return nRPStation;
1043  if (Test(n, tagRPPot)) return nRPPot;
1044  if (Test(n, tagRPPlane)) return nRPPlane;
1045 
1046  // T2 node types
1047  if (Test(n, tagT2)) return nT2;
1048  if (Test(n, tagT2detector)) return nT2Det;
1049  if (Test(n, tagT2Half)) return nT2Half;
1050 
1051  // T1 node types
1052  if (Test(n, tagT1)) return nT1;
1053  if (Test(n, tagT1Arm)) return nT1Arm;
1054  if (Test(n, tagT1Plane)) return nT1Plane;
1055  if (Test(n, tagT1CSC)) return nT1CSC;
1056  if (Test(n, tagT1ChannelType)) return nT1ChannelType;
1057  if (Test(n, tagChannel)) return nChannel;
1058 
1059 
1060  throw cms::Exception("TotemDAQMappingESSourceXML::GetNodeType") << "Unknown tag `"
1061  << XMLString::transcode(n->getNodeName()) << "'.\n";
1062 }
static const std::string tagChannel
static const std::string tagT2Half
static const std::string tagChip1
COMMON Chip XML tags.
static const std::string tagT2
T2 XML tags.
static const std::string tagTriggerVFAT1
static const std::string tagT1ChannelType
static const std::string tagT2detector
static const std::string tagRPStation
RP XML tags.
XMLCh * transcode(const T &fInput)
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 tagRPPlane
static const std::string tagT1
T1 XML tags.
static const std::string tagT1Plane
string TotemDAQMappingESSourceXML::GetNodeValue ( xercesc::DOMNode *  node)
inlineprivate

returns the value of the node

Definition at line 148 of file TotemDAQMappingESSourceXML.cc.

References AlCaHLTBitMon_QueryRunRegistry::string, and XERCES_CPP_NAMESPACE_USE::transcode().

Referenced by ParseTreeT2().

149  {
150  return string(xercesc::XMLString::transcode(node->getNodeValue()));
151  }
XMLCh * transcode(const T &fInput)
void TotemDAQMappingESSourceXML::ParseTreeRP ( ParseType  pType,
xercesc::DOMNode *  parent,
NodeType  parentType,
unsigned int  parentID,
const boost::shared_ptr< TotemDAQMapping > &  mapping,
const boost::shared_ptr< TotemAnalysisMask > &  mask 
)
private

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

Definition at line 361 of file TotemDAQMappingESSourceXML.cc.

References a, TotemVFATInfo::CC, ChipFramePosition(), TotemVFATInfo::data, Exception, TotemVFATAnalysisMask::fullMask, GetChannels(), GetNodeType(), TotemVFATInfo::hwID, i, j, TotemVFATAnalysisMask::maskedChannels, gen::n, nChip, nRPPlane, nRPPot, nTop, nTriggerVFAT, pMapping, pMask, TotemSymbID::RP, RPNode(), TotemSymbID::subSystem, TotemSymbID::symbolicID, TotemVFATInfo::symbolicID, tagRPPot, XERCES_CPP_NAMESPACE_USE::transcode(), and TotemVFATInfo::type.

Referenced by ParseXML().

364 {
365 #ifdef DEBUG
366  printf(">> TotemDAQMappingESSourceXML::ParseTreeRP(%s, %u, %u)\n", XMLString::transcode(parent->getNodeName()),
367  parentType, parentID);
368 #endif
369 
370  DOMNodeList *children = parent->getChildNodes();
371 
372  for (unsigned int i = 0; i < children->getLength(); i++)
373  {
374  DOMNode *n = children->item(i);
375  if (n->getNodeType() != DOMNode::ELEMENT_NODE)
376  continue;
377 
379 
380 #ifdef DEBUG
381  printf("\tname = %s, type = %u\n", XMLString::transcode(n->getNodeName()), type);
382 #endif
383 
384  // structure control
385  if (!RPNode(type))
386  continue;
387 
388  if ((type != parentType + 1)&&(parentType != nRPPot || type != nTriggerVFAT))
389  {
390  if (parentType == nTop && type == nRPPot)
391  {
392  LogPrint("TotemDAQMappingESSourceXML") << ">> TotemDAQMappingESSourceXML::ParseTreeRP > Warning: tag `" << tagRPPot
393  << "' found in global scope, assuming station ID = 12.";
394  parentID = 12;
395  } else {
396  throw cms::Exception("TotemDAQMappingESSourceXML") << "Node " << XMLString::transcode(n->getNodeName())
397  << " not allowed within " << XMLString::transcode(parent->getNodeName()) << " block.\n";
398  }
399  }
400 
401  // parse tag attributes
402  unsigned int id = 0, hw_id = 0;
403  bool id_set = false, hw_id_set = false;
404  bool fullMask = false;
405  DOMNamedNodeMap* attr = n->getAttributes();
406 
407  for (unsigned int j = 0; j < attr->getLength(); j++)
408  {
409  DOMNode *a = attr->item(j);
410 
411  if (!strcmp(XMLString::transcode(a->getNodeName()), "id"))
412  {
413  sscanf(XMLString::transcode(a->getNodeValue()), "%u", &id);
414  id_set = true;
415  }
416 
417  if (!strcmp(XMLString::transcode(a->getNodeName()), "hw_id"))
418  {
419  sscanf(XMLString::transcode(a->getNodeValue()), "%x", &hw_id);
420  hw_id_set = true;
421  }
422 
423  if (!strcmp(XMLString::transcode(a->getNodeName()), "full_mask"))
424  fullMask = (strcmp(XMLString::transcode(a->getNodeValue()), "no") != 0);
425  }
426 
427  // content control
428  if (!id_set && type != nTriggerVFAT)
429  throw cms::Exception("TotemDAQMappingESSourceXML::ParseTreeRP") << "id not given for element `"
430  << XMLString::transcode(n->getNodeName()) << "'" << endl;
431 
432  if (!hw_id_set && type == nChip && pType == pMapping)
433  throw cms::Exception("TotemDAQMappingESSourceXML::ParseTreeRP") << "hw_id not given for element `"
434  << XMLString::transcode(n->getNodeName()) << "'" << endl;
435 
436  if (type == nRPPlane && id > 9)
437  throw cms::Exception("TotemDAQMappingESSourceXML::ParseTreeRP") <<
438  "Plane IDs range from 0 to 9. id = " << id << " is invalid." << endl;
439 
440 #ifdef DEBUG
441  printf("\tID found: 0x%x\n", id);
442 #endif
443 
444  // store mapping data
445  if (pType == pMapping && (type == nChip || type == nTriggerVFAT))
446  {
447  const TotemFramePosition &framepos = ChipFramePosition(n);
448  TotemVFATInfo vfatInfo;
449  vfatInfo.hwID = hw_id;
451 
452  if (type == nChip)
453  {
454  vfatInfo.symbolicID.symbolicID = parentID * 10 + id;
455  vfatInfo.type = TotemVFATInfo::data;
456  }
457 
458  if (type == nTriggerVFAT)
459  {
460  vfatInfo.symbolicID.symbolicID = parentID;
461  vfatInfo.type = TotemVFATInfo::CC;
462  }
463 
464  mapping->insert(framepos, vfatInfo);
465 
466  continue;
467  }
468 
469  // store mask data
470  if (pType == pMask && type == nChip)
471  {
472  TotemSymbID symbId;
473  symbId.subSystem = TotemSymbID::RP;
474  symbId.symbolicID = parentID * 10 + id;
475 
477  am.fullMask = fullMask;
479 
480  mask->insert(symbId, am);
481 
482  continue;
483  }
484 
485  // recursion (deeper in the tree)
486  ParseTreeRP(pType, n, type, parentID * 10 + id, mapping, mask);
487  }
488 }
type
Definition: HCALResponse.h:21
Contains data on masked channels of a VFAT.
int i
Definition: DBlmapReader.cc:9
NodeType
enumeration of XML node types
TotemSymbID symbolicID
the symbolic id
NodeType GetNodeType(xercesc::DOMNode *)
determines node type
enum TotemVFATInfo::@83 type
is data of coincidence-chip VFAT
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
XMLCh * transcode(const T &fInput)
void ParseTreeRP(ParseType, xercesc::DOMNode *, NodeType, unsigned int parentID, const boost::shared_ptr< TotemDAQMapping > &, const boost::shared_ptr< TotemAnalysisMask > &)
recursive method to extract RP-related information from the DOM tree
int j
Definition: DBlmapReader.cc:9
bool fullMask
whether all channels of the VFAT shall be masked
unsigned int symbolicID
integer-encoded symbolic ID
Definition: TotemSymbId.h:24
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
enum TotemSymbID::@84 subSystem
identifies the TOTEM subsystem
void GetChannels(xercesc::DOMNode *n, std::set< unsigned char > &channels)
Contains mappind data related to a VFAT.
void TotemDAQMappingESSourceXML::ParseTreeT1 ( ParseType  pType,
xercesc::DOMNode *  parent,
NodeType  parentType,
unsigned int  parentID,
const boost::shared_ptr< TotemDAQMapping > &  mapping,
const boost::shared_ptr< TotemAnalysisMask > &  mask,
unsigned int  T1Arm,
unsigned int  T1Plane,
unsigned int  T1CSC 
)
private

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

Definition at line 778 of file TotemDAQMappingESSourceXML.cc.

References a, ChipFramePosition(), CommonNode(), TotemVFATInfo::data, Exception, TotemVFATAnalysisMask::fullMask, GetChannels(), GetNodeType(), TotemVFATInfo::hwID, i, j, TotemVFATAnalysisMask::maskedChannels, gen::n, nChip, nT1Arm, nT1ChannelType, nT1CSC, nT1Plane, nUnknown, pMask, TotemSymbID::subSystem, TotemSymbID::symbolicID, TotemVFATInfo::symbolicID, TotemSymbID::T1, T1Node(), tagT1CSC, XERCES_CPP_NAMESPACE_USE::transcode(), and TotemVFATInfo::type.

Referenced by ParseXML().

781 {
782  const int ArmMask = 0x0200;
783  const int PlaneMask = 0x01c0;
784  const int CSCMask = 0x0038;
785  const int GenderMask = 0x0004;
786  const int VFnMask = 0x0003;
787 
788  int ArmMask_ = 0;
789  int PlaneMask_ = 0;
790  int CSCMask_ = 0;
791  int GenderMask_ = 0;
792  int VFnMask_ = 0;
793 
794  unsigned int T1ChannelType = 0;
795 
796  DOMNodeList *children = parent->getChildNodes();
797 
798 #ifdef DEBUG
799  printf(">> ParseTreeT1(parent,parentType,parentID)=(%p, %i, %u)\n", parent, parentType, parentID);
800  printf("\tchildren: Numero children: %li\n", children->getLength());
801 #endif
802 
803  for (unsigned int i = 0; i < children->getLength(); i++) {
804  DOMNode *n = children->item(i);
805 
806  if (n->getNodeType() != DOMNode::ELEMENT_NODE)
807  continue;
808 
809  // get node type for RP or T2 or T1
811 
812 #ifdef DEBUG
813  printf("\t\tchildren #%i: is a %s, (of type %i) \n", i, XMLString::transcode(n->getNodeName()), type);
814 #endif
815 
816  if ((type == nUnknown)) {
817 #ifdef DEBUG
818  printf("Found Unknown tag during T1 reading.. EXIT ");
819 #endif
820  continue;
821  }
822 
823  if ((T1Node(type)==false)&&(CommonNode(type)==false)) {
824 #ifdef DEBUG
825  printf("Found Non-T1 tag during T1 reading.. EXIT ");
826  printf("\t The tag is: %s \n", XMLString::transcode(n->getNodeName()));
827 #endif
828  continue;
829  }
830 
831  // id for T2 plane goes from 0..9; for chip is the 16 bit ID
832  // for VFATs: (0 or 1 for anodes A0 and A1; 0, 1 or 2 for Cathodes C0,C1,C2)
833  unsigned int ID_t1 = 0;
834 #ifdef DEBUG
835  unsigned int VFPOS = 0;
836 #endif
837  unsigned int Gender =0;
838 
839  // hardware of an id
840  unsigned int hw_id = 0;
841  bool hw_id_set = false;
842 
843  bool idSet_t1 = false;//bool position_t2Set = false;
844 
845  DOMNamedNodeMap* attr = n->getAttributes();
846 
847  bool fullMask = false;
848 
849  // Begin loop for save T1 element attriute ------------------------------------------------------------------
850  for (unsigned int j = 0; j < attr->getLength(); j++) {
851 
852  DOMNode *a = attr->item(j);
853  if (!strcmp(XMLString::transcode(a->getNodeName()), "id")) {
854  sscanf(XMLString::transcode(a->getNodeValue()), "%u", &ID_t1);
855  idSet_t1 = true;
856  }
857 
858  if (type == nT1Arm) {
859  if (!strcmp(XMLString::transcode(a->getNodeName()), "id")) {
860  // arm is the top node and parent ID should be reset to 0.
861  parentID=0;
862  unsigned int id_arm = atoi(XMLString::transcode(a->getNodeValue()));
863  T1Arm = id_arm;
864  if (id_arm != 0 && id_arm != 1) {
865  throw cms::Exception("TotemDAQMappingESSourceXML::ParseTree") << "T1 id_arm neither 0 nor 1. Problem parsing XML file." << XMLString::transcode(n->getNodeName()) << endl;
866  edm::LogProblem ("TotemDAQMappingESSourceXML") <<"T1 id_arm neither 0 nor 1. Problem parsing XML file."<<XMLString::transcode(n->getNodeName()) ;
867  }
868 
869  id_arm = id_arm << 9;
870  ArmMask_ = ~ArmMask;
871  parentID &= ArmMask_;
872  parentID |= id_arm;
873  }
874  }
875 
876  if (type == nT1Plane) {
877  if (!strcmp(XMLString::transcode(a->getNodeName()), "id")) {
878  unsigned int id_plane = atoi(XMLString::transcode(a->getNodeValue()));
879  T1Plane = id_plane;
880  id_plane = id_plane << 6;
881  PlaneMask_ = ~PlaneMask;
882  parentID &= PlaneMask_;
883  parentID |= id_plane;
884  }
885  }
886 
887  if (type == nT1CSC) {
888  if (!strcmp(XMLString::transcode(a->getNodeName()), "id")) {
889  unsigned int id_csc = atoi(XMLString::transcode(a->getNodeValue()));
890  T1CSC = id_csc;
891  id_csc = id_csc << 3;
892  CSCMask_ = ~CSCMask;
893  parentID &= CSCMask_;
894  parentID |= id_csc;
895  }
896  }
897 
898  if (type == nT1ChannelType) {
899  if (!strcmp(XMLString::transcode(a->getNodeName()), "id")) {
900  T1ChannelType = atoi(XMLString::transcode(a->getNodeValue()));
901  }
902  if (!strcmp(XMLString::transcode(a->getNodeName()), "full_mask")) {
903  fullMask = (strcmp(XMLString::transcode(a->getNodeValue()), "no") != 0);
904  }
905  }
906 
907  if(type == nChip) {
908 #ifdef DEBUG
909  if (!strcmp(XMLString::transcode(a->getNodeName()), "position")){
910  VFPOS = atoi(XMLString::transcode(a->getNodeValue()));
911  }
912 #endif
913  if (!strcmp(XMLString::transcode(a->getNodeName()), "polarity")) {
914  if (!strcmp(XMLString::transcode(a->getNodeValue()),"a")) {
915  Gender = 0;
916  } else
917  if (!strcmp(XMLString::transcode(a->getNodeValue()),"c")) {
918  Gender = 1;
919  } else {
920  throw cms::Exception("TotemDAQMappingESSourceXML::ParseTree") << "T1: Neither anode nor cathode vfat : " << XMLString::transcode(n->getNodeName()) << endl;
921  edm::LogProblem ("TotemDAQMappingESSourceXML") <<"T1: Neither anode nor cathode vfat : "<<XMLString::transcode(n->getNodeName());
922  }
923  }
924 
925  if (!strcmp(XMLString::transcode(a->getNodeName()), "hw_id")) {
926  sscanf(XMLString::transcode(a->getNodeValue()), "%x", &hw_id);
927  hw_id_set = true; }
928  }
929  }
930 
931  // content control
932  // Note: each element has an id!! However if the element is a plane, it could be enough to use position 0..9
933 
934  if (idSet_t1==false){
935  throw cms::Exception("TotemDAQMappingESSourceXML::ParseTree") << "ID_t1 not given for element `" << XMLString::transcode(n->getNodeName()) << "'" << endl;
936  edm::LogProblem ("TotemDAQMappingESSourceXML") <<"ID_t1 not given for element `"<<XMLString::transcode(n->getNodeName()) << "'";
937  }
938 
939  if (type == nChip && !hw_id_set)
940  throw cms::Exception("TotemDAQMappingESSourceXML::ParseTreeT1") <<
941  "hw_id not set for T1 VFAT id " << ID_t1 << "." << endl;
942 
943 
944 
945  // save mask data
946  if (type == nT1ChannelType && pType == pMask) {
947  TotemSymbID symbId;
948  symbId.subSystem = TotemSymbID::T1;
949  symbId.symbolicID = T1ChannelType + 10 * T1CSC + 100 * T1Plane + 1000 * T1Arm;
950  //cout << "mask: " << T1Arm << " " << T1Plane << " " << T1CSC << " " <<T1ChannelType << endl;
952  am.fullMask = fullMask;
954  mask->insert(symbId, am);
955  //cout << "saved mask, ID = " << symbId.symbolicID << ", full mask: " << am.fullMask << endl;
956  }
957 
958  // save data
959  if (type == nChip) {
960 #ifdef DEBUG
961  printf("T1 Vfat in detector (parentID): %x || Position %i \n", parentID, VFPOS);
962  printf("\t\t\tID_t1 = 0x%x\n", ID_t1);
963 #endif
964 
965  unsigned int symId=0;
966 
967  // Check if it is a special chip
968  if (!tagT1CSC.compare(XMLString::transcode((n->getParentNode()->getNodeName())))) {
969  symId = parentID;
970  Gender = Gender << 2;
971  GenderMask_ = ~GenderMask;
972 
973  symId &= GenderMask_;
974  symId |= Gender;
975 
976  VFnMask_ = ~VFnMask;
977  symId &= VFnMask_;
978  symId |= ID_t1;
979  } else {
980  // It is a special VFAT ...
981  throw cms::Exception("TotemDAQMappingESSourceXML::ParseTree") << "T1 has no special vfat `" << XMLString::transcode(n->getNodeName()) << "'" << endl;
982  edm::LogProblem ("TotemDAQMappingESSourceXML") <<"T1 has no special vfat `"<<XMLString::transcode(n->getNodeName()) << "'";
983  }
984 
985  // Assign a contanaier for the register of that VFAT with ChipId (Hex)
987  TotemVFATInfo vfatInfo;
988  vfatInfo.symbolicID.symbolicID = symId;
989  vfatInfo.hwID = hw_id;
991  vfatInfo.type = TotemVFATInfo::data;
992  mapping->insert(framepos, vfatInfo);
993  } else {
994  // Look for the children of n (recursion)
995  // 3° argument=parentId is needed for calculate VFAT-id startintg from the parent plane
996  ParseTreeT1(pType, n, type, parentID, mapping, mask, T1Arm, T1Plane, T1CSC);
997  }
998  } // Go to the next children
999 }
type
Definition: HCALResponse.h:21
Contains data on masked channels of a VFAT.
int i
Definition: DBlmapReader.cc:9
NodeType
enumeration of XML node types
TotemSymbID symbolicID
the symbolic id
NodeType GetNodeType(xercesc::DOMNode *)
determines node type
enum TotemVFATInfo::@83 type
is data of coincidence-chip VFAT
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
XMLCh * transcode(const T &fInput)
int j
Definition: DBlmapReader.cc:9
bool fullMask
whether all channels of the VFAT shall be masked
unsigned int symbolicID
integer-encoded symbolic ID
Definition: TotemSymbId.h:24
unsigned int hwID
the hardware ID (16 bit)
void ParseTreeT1(ParseType, xercesc::DOMNode *, NodeType, unsigned int parentID, const boost::shared_ptr< TotemDAQMapping > &, const boost::shared_ptr< TotemAnalysisMask > &, unsigned int T1Arm, unsigned int T1Plane, unsigned int T1CSC)
recursive method to extract RP-related information from the DOM tree
double a
Definition: hdecay.h:121
std::set< unsigned char > maskedChannels
list of channels to be masked
enum TotemSymbID::@84 subSystem
identifies the TOTEM subsystem
void GetChannels(xercesc::DOMNode *n, std::set< unsigned char > &channels)
Contains mappind data related to a VFAT.
void TotemDAQMappingESSourceXML::ParseTreeT2 ( ParseType  pType,
xercesc::DOMNode *  parent,
NodeType  parentType,
unsigned int  parentID,
const boost::shared_ptr< TotemDAQMapping > &  data,
const boost::shared_ptr< TotemAnalysisMask > &  mask 
)
private

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

Definition at line 492 of file TotemDAQMappingESSourceXML.cc.

References a, ChipFramePosition(), CommonNode(), compare_using_db::compare, gather_cfg::cout, TotemVFATInfo::data, Exception, TotemVFATAnalysisMask::fullMask, GetChannels(), GetNodeType(), GetNodeValue(), TotemVFATInfo::hwID, i, j, TotemVFATAnalysisMask::maskedChannels, gen::n, nArm, nChip, nT2Det, nT2Half, nUnknown, pMapping, pMask, TotemSymbID::subSystem, TotemSymbID::symbolicID, TotemVFATInfo::symbolicID, TotemSymbID::T2, T2Node(), tagT2detector, XERCES_CPP_NAMESPACE_USE::transcode(), and TotemVFATInfo::type.

Referenced by ParseXML().

495 {
496  DOMNodeList *children = parent->getChildNodes();
497 
498 #ifdef DEBUG
499  printf(">> ParseTreeT2(parent,parentType,parentID)=(%p, %i, %u)\n", parent, parentType, parentID);
500  printf("\tchildren: Numero children: %li\n", children->getLength());
501 #endif
502 
503  for (unsigned int i = 0; i < children->getLength(); i++)
504  {
505  DOMNode *n = children->item(i);
506 
507  if (n->getNodeType() != DOMNode::ELEMENT_NODE)
508  continue;
509 
510  // get node type for RP or T2
512 
513 #ifdef DEBUG
514  printf("\t\tchildren #%i: is a %s, (of type %i) \n", i, XMLString::transcode(n->getNodeName()), type);
515 #endif
516 
517  if ((type == nUnknown)) {
518 #ifdef DEBUG
519  printf("Found Unknown tag during T2 reading.. EXIT ");
520 #endif
521  continue;
522  }
523 
524  if ((T2Node(type)==false)&&(CommonNode(type)==false)) {
525 #ifdef DEBUG
526  printf("Found Non-T2 tag during T2 reading.. EXIT ");
527  printf("\t The tag is: %s \n", XMLString::transcode(n->getNodeName()));
528 #endif
529  continue;
530  }
531 
532  // get ID_t2 and position
533 
534  // id for T2 plane goes from 0..9; for chip is the 16 bit ID
535  // position_t2 was the S-link for chip and for the plane should be a number compatible with arm,ht,pl,pls or HS position
536  int ID_t2 = 0;
537 
538  unsigned int position_t2 = 0;
539 
540  unsigned int arm=0,ht=0,pl=0,pls=0;
541 
542  bool idSet_t2 = false;
543  //position_t2Set = false;
544  int attribcounter_t2planedescript=0;
545  unsigned int toaddForParentID=0;
546 
547  unsigned hw_id = 0;
548  bool hw_id_set = false;
549 
550  DOMNamedNodeMap* attr = n->getAttributes();
551 
552  // Begin loop for save T2 element attriute
553  for (unsigned int j = 0; j < attr->getLength(); j++) {
554  DOMNode *a = attr->item(j);
555  if (!strcmp(XMLString::transcode(a->getNodeName()), "id")) {
556  sscanf(XMLString::transcode(a->getNodeValue()), "%i", &ID_t2);
557  idSet_t2 = true;
558  }
559 
560  if (!strcmp(XMLString::transcode(a->getNodeName()), "hw_id")) {
561  sscanf(XMLString::transcode(a->getNodeValue()), "%x", &hw_id);
562  hw_id_set = true;
563  }
564 
565  if (!strcmp(XMLString::transcode(a->getNodeName()), "position")) {
566  position_t2 = atoi(XMLString::transcode(a->getNodeValue()));
567  if (pType == pMask)
568  toaddForParentID = position_t2;
569 // position_t2Set = true;
570  }
571 
572  if (type == nArm) {
573  // arm is the top node and should be reset to 0.
574  if (!strcmp(XMLString::transcode(a->getNodeName()), "id")) {
575  parentID=0;
576  unsigned int id_arm = atoi(XMLString::transcode(a->getNodeValue()));
577  toaddForParentID=20*id_arm;
578  }
579  }
580 
581  if (type == nT2Half) {
582  if (!strcmp(XMLString::transcode(a->getNodeName()), "id")) {
583  unsigned int id_half = atoi(XMLString::transcode(a->getNodeValue()));
584  toaddForParentID=10*id_half;
585  }
586  }
587 
588  // This is needed in principle only for the old formats
589  if(type == nT2Det) {
590  if (!strcmp(XMLString::transcode(a->getNodeName()), "arm")) {
591  sscanf(XMLString::transcode(a->getNodeValue()), "%u", &arm);
592  attribcounter_t2planedescript++;
593  }
594 
595  if (!strcmp(XMLString::transcode(a->getNodeName()), "ht")) {
596  sscanf(XMLString::transcode(a->getNodeValue()), "%u", &ht);
597  attribcounter_t2planedescript++;
598  }
599 
600  if (!strcmp(XMLString::transcode(a->getNodeName()), "pl")) {
601  sscanf(XMLString::transcode(a->getNodeValue()), "%u", &pl);
602  attribcounter_t2planedescript++;
603  }
604 
605  if (!strcmp(XMLString::transcode(a->getNodeName()), "pls")) {
606  sscanf(XMLString::transcode(a->getNodeValue()), "%u", &pls);
607  attribcounter_t2planedescript++;
608  }
609 
610  // remember id in monitor goes from 0 -- 39
611  if (!strcmp(XMLString::transcode(a->getNodeName()), "id")) {
612  // Id saved another time ... just to increment attribcounter
613  sscanf(XMLString::transcode(a->getNodeValue()), "%i", &ID_t2);
614  attribcounter_t2planedescript++;
615  }
616 
617  if (!strcmp(XMLString::transcode(a->getNodeName()), "position")) {
618  sscanf(XMLString::transcode(a->getNodeValue()), "%u", &position_t2);
619  attribcounter_t2planedescript++;
620  // Just another indication for further checking. This attribute was not compulsory in monitor.
621  attribcounter_t2planedescript=attribcounter_t2planedescript+20;
622  // 20 is just a "big number"
623  }
624  }
625  }
626 
627  // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
628  // When a plane tag is found, calculate Parent-Id and allows different xml formats:
629  // Provide compatibility with old monitor formats.
630 
631  // Note:
632  // plane position and id foreseen in final ip5 mapping.
633  // plane position NOT foreseen in Monitor.
634 
635  if (pType == pMapping) {
636  if (type == nT2Det) {
637  // Calculate the parent-id from attributes or xml STRUCTURE
638 // position_t2Set = true;
639  if (attribcounter_t2planedescript>=(21)) {
640  // there is already in xml plane the "position" attribute + other attributes. It is assumed to utilize the parent info
641 
642 #ifdef DEBUG
643  printf("TotemDAQMappingESSourceXML: attribcounter_t2planedescript: %i \n",attribcounter_t2planedescript);
644 #endif
645 
646  if (attribcounter_t2planedescript>=25) {
647  edm::LogVerbatim("TotemDAQMappingESSourceXML") << "T2-Plane attribute utilezed for parentID: position+info from parent ";
648  //Plane Seems fully specified
649  //all T2 plane attribute read correctly. Check if it is consitent
650  unsigned int test_position_t2=arm*20+ht*10+pl*2+pls;
651  unsigned int testHS=pl*2+pls;
652  if(testHS!=position_t2) {
653  edm::LogPrint("TotemDAQMappingESSourceXML") <<"T2 Xml inconsistence in pl-pls attributes and position. Only 'position attribute' taken ";
654  }
655 
656  // For plane, ID_t2 should go from 0..39 position_t2 from 0..9
657  ID_t2=parentID+position_t2;
658  cout << "attribcounter_t2planedescript>=(25), ID_t2: " << ID_t2 << endl;
659  toaddForParentID=position_t2;
660  if (ID_t2!=(int)test_position_t2)
661  edm::LogPrint("TotemDAQMappingESSourceXML") <<"T2 Xml inconsistence in plane attributes and xml parents structure. Plane attributes ignored";
662 
663  } else {
664  // Case where arm-ht-pl-pls are NOT specified
665  edm::LogVerbatim("TotemDAQMappingESSourceXML")<<"T2 Plane have parentID: "<<parentID<<" for its VFATs. Plane Position read: "<<position_t2;
666 
667  if (attribcounter_t2planedescript==21) {
668  // You have put in XML only position and not Plane id (the last is obligatory)
669  ID_t2=parentID+position_t2;
670  // cout << "attribcounter_t2planedescript>=(21), ID_t2: " << ID_t2 << endl;
671  toaddForParentID=position_t2;
672  idSet_t2=true;
673  }
674  }
675  } else {
676  // Construct plane position from other attributes cause "position" is not inserted;
677  // Ex- monitor: <t2_detector id="0" z="13871.3" arm="0" ht="0" pl="0" pls="0" >
678 
679  if (attribcounter_t2planedescript>=1) {
680  // Remember, Z attribute is not counted
681 
682  if(attribcounter_t2planedescript>=5) {
683  int test_position_t2=arm*20+ht*10+pl*2+pls;
684 
685  // case for xml from monitor
686  ID_t2=test_position_t2;
687  cout << "ID_t2=test_position_t2: " << ID_t2 << endl;
688  toaddForParentID=test_position_t2;
689 
690  if ((int)parentID!=ID_t2) {
691  edm::LogPrint("TotemDAQMappingESSourceXML") <<"T2 Inconsistence between plane 'id' and position from attributes. Id ignored";
692  edm::LogPrint("TotemDAQMappingESSourceXML") <<" T2-Parent = "<<parentID;
693  }
694  } else {
695  toaddForParentID=ID_t2;
696  edm::LogVerbatim("TotemDAQMappingESSourceXML")<<" Number of T2 plane attributes: "<< attribcounter_t2planedescript<<" T2-Plane attribute utilezed for parentID: plane 'id' only";
697  }
698  } else {
699 // position_t2Set = false;
700  edm::LogProblem ("TotemDAQMappingESSourceXML") << "T2 plane not enough specified from its attribute!";
701  }
702  }
703  }
704 
705  // content control
706  if (idSet_t2 == false) {
707  throw cms::Exception("TotemDAQMappingESSourceXML::ParseTree") << "ID_t2 not given for element `" << XMLString::transcode(n->getNodeName()) << "'" << endl;
708  edm::LogProblem ("TotemDAQMappingESSourceXML") <<"ID_t2 not given for element `"<<XMLString::transcode(n->getNodeName()) << "'";
709  }
710 
711  if (type == nChip && !hw_id_set)
712  throw cms::Exception("TotemDAQMappingESSourceXML::ParseTree") << "hw_id not given for VFAT id `" <<
713  ID_t2 << "'" << endl;
714 
715  if (type == nT2Det && position_t2 > 39) {
716  throw cms::Exception("TotemDAQMappingESSourceXML::ParseTree") << "Plane position_t2 range from 0 to 39. position_t2 = " << position_t2 << " is invalid." << endl;
717  edm::LogProblem ("TotemDAQMappingESSourceXML") <<"Plane position_t2 range from 0 to 39. position_t2 = "<<position_t2<< " is invalid.";
718  }
719  }
720 
721 
722  if (type == nChip) {
723  // save mapping data
724  if (pType == pMapping) {
725 #ifdef DEBUG
726  printf("T2 Vfat in plane (parentID): %i || GeomPosition %i \n", parentID, ID_t2);
727  printf("\t\t\tID_t2 = 0x%x\n", hw_id);
728  printf("\t\t\tpos = %i\n", position_t2);
729 #endif
730  unsigned int symId=0;
731  // Check if it is a special chip
732  if (!tagT2detector.compare(XMLString::transcode((n->getParentNode()->getNodeName()))))
733  symId = parentID * 100 + ID_t2; // same conv = symbplaneNumber*100 +iid used in DQM
734  else {
735  // It is a special VFAT and the special number is set directly in the XML file
736  symId = ID_t2; //17,18,19,20
737 #ifdef DEBUG
738  printf("TotemDAQMappingESSourceXML Found T2 special Vfat ChId-SLink-Symb 0x%x - %i - %i \n",
739  ID_t2,position_t2,symId );
740 #endif
741  }
742 
744  TotemVFATInfo vfatInfo;
745  vfatInfo.symbolicID.symbolicID = symId;
746  vfatInfo.hwID = hw_id;
748  vfatInfo.type = TotemVFATInfo::data;
749  data->insert(framepos, vfatInfo);
750  }
751 
752  // save mask data
753  if (pType == pMask) {
754  TotemVFATAnalysisMask vfatMask;
755  TotemSymbID symbId;
756  symbId.subSystem = TotemSymbID::T2;
757  symbId.symbolicID = 100*parentID+ID_t2;
758 
759  DOMNode *fullMaskNode = attr->getNamedItem(XMLString::transcode("full_mask"));
760  if (fullMaskNode && !GetNodeValue(fullMaskNode).compare("yes"))
761  vfatMask.fullMask = true;
762  else
763  GetChannels(n, vfatMask.maskedChannels);
764 
765  mask->insert(symbId, vfatMask);
766  //cout << "saved mask, ID = " << symbId.symbolicID << ", full mask: " << vfatMask.fullMask << endl;
767  }
768  } else {
769  // Look for the children of n (recursion)
770  // 3° argument=parentId is needed for calculate VFAT-id startintg from the parent plane
771  ParseTreeT2(pType, n, type, parentID+toaddForParentID, data, mask);
772  }
773  } // Go to the next children
774 }
type
Definition: HCALResponse.h:21
Contains data on masked channels of a VFAT.
int i
Definition: DBlmapReader.cc:9
NodeType
enumeration of XML node types
TotemSymbID symbolicID
the symbolic id
NodeType GetNodeType(xercesc::DOMNode *)
determines node type
enum TotemVFATInfo::@83 type
is data of coincidence-chip VFAT
Symbolic ID describing an entity of a TOTEM subdetector.
Definition: TotemSymbId.h:17
static const std::string tagT2detector
TotemFramePosition ChipFramePosition(xercesc::DOMNode *chipnode)
extracts VFAT&#39;s DAQ channel from XML attributes
XMLCh * transcode(const T &fInput)
int j
Definition: DBlmapReader.cc:9
bool fullMask
whether all channels of the VFAT shall be masked
unsigned int symbolicID
integer-encoded symbolic ID
Definition: TotemSymbId.h:24
unsigned int hwID
the hardware ID (16 bit)
void ParseTreeT2(ParseType, xercesc::DOMNode *, NodeType, unsigned int parentID, const boost::shared_ptr< TotemDAQMapping > &, const boost::shared_ptr< TotemAnalysisMask > &)
recursive method to extract RP-related information from the DOM tree
string GetNodeValue(xercesc::DOMNode *node)
returns the value of the node
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
double a
Definition: hdecay.h:121
std::set< unsigned char > maskedChannels
list of channels to be masked
tuple cout
Definition: gather_cfg.py:145
enum TotemSymbID::@84 subSystem
identifies the TOTEM subsystem
void GetChannels(xercesc::DOMNode *n, std::set< unsigned char > &channels)
Contains mappind data related to a VFAT.
void TotemDAQMappingESSourceXML::ParseXML ( ParseType  pType,
const string &  file,
const boost::shared_ptr< TotemDAQMapping > &  mapping,
const boost::shared_ptr< TotemAnalysisMask > &  mask 
)
private

parses XML file

Definition at line 336 of file TotemDAQMappingESSourceXML.cc.

References Exception, nTop, createfilelist::parser, ParseTreeRP(), ParseTreeT1(), and ParseTreeT2().

Referenced by produce().

338 {
339  unique_ptr<XercesDOMParser> parser(new XercesDOMParser());
340  parser->parse(file.c_str());
341 
342  DOMDocument* domDoc = parser->getDocument();
343 
344  if (!domDoc)
345  throw cms::Exception("TotemDAQMappingESSourceXML::ParseXML") << "Cannot parse file `" << file
346  << "' (domDoc = NULL)." << endl;
347 
348  DOMElement* elementRoot = domDoc->getDocumentElement();
349 
350  if (!elementRoot)
351  throw cms::Exception("TotemDAQMappingESSourceXML::ParseXML") << "File `" <<
352  file << "' is empty." << endl;
353 
354  ParseTreeRP(pType, elementRoot, nTop, 0, mapping, mask);
355  ParseTreeT2(pType, elementRoot, nTop, 0, mapping, mask);
356  ParseTreeT1(pType, elementRoot, nTop, 0, mapping, mask, 0,0,0);
357 }
void ParseTreeRP(ParseType, xercesc::DOMNode *, NodeType, unsigned int parentID, const boost::shared_ptr< TotemDAQMapping > &, const boost::shared_ptr< TotemAnalysisMask > &)
recursive method to extract RP-related information from the DOM tree
void ParseTreeT1(ParseType, xercesc::DOMNode *, NodeType, unsigned int parentID, const boost::shared_ptr< TotemDAQMapping > &, const boost::shared_ptr< TotemAnalysisMask > &, unsigned int T1Arm, unsigned int T1Plane, unsigned int T1CSC)
recursive method to extract RP-related information from the DOM tree
void ParseTreeT2(ParseType, xercesc::DOMNode *, NodeType, unsigned int parentID, const boost::shared_ptr< TotemDAQMapping > &, const boost::shared_ptr< TotemAnalysisMask > &)
recursive method to extract RP-related information from the DOM tree
edm::ESProducts< boost::shared_ptr< TotemDAQMapping >, boost::shared_ptr< TotemAnalysisMask > > TotemDAQMappingESSourceXML::produce ( const TotemReadoutRcd )

Definition at line 300 of file TotemDAQMappingESSourceXML.cc.

References assert(), CompleteFileName(), configuration, currentBlock, currentBlockValid, Exception, personalPlayback::fn, totemRawToDigi_cff::mappingFileNames, totemRawToDigi_cff::maskFileNames, python.rootplot.argparse::message, ParseXML(), pMapping, pMask, edm::es::products(), fetchall_from_DQM_v2::release, and XERCES_CPP_NAMESPACE_USE::transcode().

Referenced by JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), and HTMLExport.HTMLExportStatic::export().

301 {
303 
304  boost::shared_ptr<TotemDAQMapping> mapping(new TotemDAQMapping());
305  boost::shared_ptr<TotemAnalysisMask> mask(new TotemAnalysisMask());
306 
307  // initialize Xerces
308  try
309  {
310  XMLPlatformUtils::Initialize();
311  }
312  catch (const XMLException& toCatch)
313  {
314  char* message = XMLString::transcode(toCatch.getMessage());
315  throw cms::Exception("TotemDAQMappingESSourceXML") << "An XMLException caught with message: " << message << ".\n";
316  XMLString::release(&message);
317  }
318 
319  // load mapping files
320  for (const auto &fn : configuration[currentBlock].mappingFileNames)
321  ParseXML(pMapping, CompleteFileName(fn), mapping, mask);
322 
323  // load mask files
324  for (const auto &fn : configuration[currentBlock].maskFileNames)
325  ParseXML(pMask, CompleteFileName(fn), mapping, mask);
326 
327  // release Xerces
328  XMLPlatformUtils::Terminate();
329 
330  // commit the products
331  return edm::es::products(mapping, mask);
332 }
Channel-mask mapping.
assert(m_qm.get())
bool currentBlockValid
flag whether the &#39;currentBlock&#39; index is valid
void ParseXML(ParseType, const string &file, const boost::shared_ptr< TotemDAQMapping > &, const boost::shared_ptr< TotemAnalysisMask > &)
parses XML file
ESProducts< T, S > products(const T &i1, const S &i2)
Definition: ESProducts.h:189
The mapping between FramePosition and VFATInfo.
XMLCh * transcode(const T &fInput)
unsigned int currentBlock
index of the current block in &#39;configuration&#39; array
string CompleteFileName(const string &fn)
adds the path prefix, if needed
bool TotemDAQMappingESSourceXML::RPNode ( NodeType  type)
inlineprivate
void TotemDAQMappingESSourceXML::setIntervalFor ( const edm::eventsetup::EventSetupRecordKey key,
const edm::IOVSyncValue iosv,
edm::ValidityInterval oValidity 
)
protectedvirtual

sets infinite validity of this data

Implements edm::EventSetupRecordIntervalFinder.

Definition at line 240 of file TotemDAQMappingESSourceXML.cc.

References begin, configuration, currentBlock, currentBlockValid, end, edm::EventID::event(), edm::IOVSyncValue::eventID(), Exception, customizeTrackingMonitorSeedNumber::idx, edm::eventsetup::EventSetupRecordKey::name(), and edm::EventID::run().

242 {
243  LogVerbatim("TotemDAQMappingESSourceXML")
244  << ">> TotemDAQMappingESSourceXML::setIntervalFor(" << key.name() << ")";
245 
246  LogVerbatim("TotemDAQMappingESSourceXML")
247  << " run=" << iosv.eventID().run() << ", event=" << iosv.eventID().event();
248 
249  currentBlockValid = false;
250  for (unsigned int idx = 0; idx < configuration.size(); ++idx)
251  {
252  const auto &bl = configuration[idx];
253 
254  // event id "1:min" has a special meaning and is translated to a truly minimal event id (1:0:0)
255  EventID startEventID = bl.validityRange.startEventID();
256  if (startEventID == EventID(1, 0, 1))
257  startEventID = EventID(1, 0, 0);
258 
259  if (startEventID <= iosv.eventID() && iosv.eventID() <= bl.validityRange.endEventID())
260  {
261  currentBlockValid = true;
262  currentBlock = idx;
263 
264  const IOVSyncValue begin(startEventID);
265  const IOVSyncValue end(bl.validityRange.endEventID());
266  oValidity = ValidityInterval(begin, end);
267 
268  LogVerbatim("TotemDAQMappingESSourceXML")
269  << " block found: index=" << currentBlock
270  << ", interval=(" << startEventID << " - " << bl.validityRange.endEventID() << ")";
271 
272  return;
273  }
274  }
275 
276  if (!currentBlockValid)
277  {
278  throw cms::Exception("TotemDAQMappingESSourceXML::setIntervalFor") <<
279  "No configuration for event " << iosv.eventID();
280  }
281 }
RunNumber_t run() const
Definition: EventID.h:39
EventNumber_t event() const
Definition: EventID.h:41
const EventID & eventID() const
Definition: IOVSyncValue.h:42
bool currentBlockValid
flag whether the &#39;currentBlock&#39; index is valid
std::pair< Time_t, Time_t > ValidityInterval
Definition: Time.h:19
#define end
Definition: vmac.h:37
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
#define begin
Definition: vmac.h:30
unsigned int currentBlock
index of the current block in &#39;configuration&#39; array
bool TotemDAQMappingESSourceXML::T1Node ( NodeType  type)
inlineprivate
bool TotemDAQMappingESSourceXML::T2Node ( NodeType  type)
inlineprivate
bool TotemDAQMappingESSourceXML::Test ( xercesc::DOMNode *  node,
const std::string &  name 
)
inlineprivate

returns true iff the node is of the given name

Definition at line 133 of file TotemDAQMappingESSourceXML.cc.

References XERCES_CPP_NAMESPACE_USE::transcode().

Referenced by GetChannels(), and GetNodeType().

134  {
135  return !(name.compare(xercesc::XMLString::transcode(node->getNodeName())));
136  }
XMLCh * transcode(const T &fInput)

Member Data Documentation

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

index of the current block in 'configuration' array

Definition at line 100 of file TotemDAQMappingESSourceXML.cc.

Referenced by produce(), and setIntervalFor().

bool TotemDAQMappingESSourceXML::currentBlockValid
private

flag whether the 'currentBlock' index is valid

Definition at line 103 of file TotemDAQMappingESSourceXML.cc.

Referenced by produce(), and setIntervalFor().

const string TotemDAQMappingESSourceXML::tagAnalysisMask ="analysisMask"
static

Definition at line 50 of file TotemDAQMappingESSourceXML.cc.

const string TotemDAQMappingESSourceXML::tagArm = "arm"
static

Common position tags.

Definition at line 53 of file TotemDAQMappingESSourceXML.cc.

Referenced by GetNodeType().

const string TotemDAQMappingESSourceXML::tagChannel ="channel"
static

Definition at line 49 of file TotemDAQMappingESSourceXML.cc.

Referenced by GetNodeType().

const string TotemDAQMappingESSourceXML::tagChip1 = "vfat"
static

COMMON Chip XML tags.

Definition at line 73 of file TotemDAQMappingESSourceXML.cc.

Referenced by GetNodeType().

const string TotemDAQMappingESSourceXML::tagChip2 = "test_vfat"
static

Definition at line 74 of file TotemDAQMappingESSourceXML.cc.

Referenced by GetNodeType().

const string TotemDAQMappingESSourceXML::tagRPPlane = "rp_plane"
static

Definition at line 58 of file TotemDAQMappingESSourceXML.cc.

Referenced by GetNodeType().

const string TotemDAQMappingESSourceXML::tagRPPot = "rp_detector_set"
static

Definition at line 57 of file TotemDAQMappingESSourceXML.cc.

Referenced by GetNodeType(), and ParseTreeRP().

const string TotemDAQMappingESSourceXML::tagRPStation = "station"
static

RP XML tags.

Definition at line 56 of file TotemDAQMappingESSourceXML.cc.

Referenced by GetNodeType().

const string TotemDAQMappingESSourceXML::tagT1 ="t1_detector_set"
static

T1 XML tags.

Definition at line 66 of file TotemDAQMappingESSourceXML.cc.

Referenced by GetNodeType().

const string TotemDAQMappingESSourceXML::tagT1Arm ="t1_arm"
static

Definition at line 67 of file TotemDAQMappingESSourceXML.cc.

Referenced by GetNodeType().

const string TotemDAQMappingESSourceXML::tagT1ChannelType ="t1_channel_type"
static

Definition at line 70 of file TotemDAQMappingESSourceXML.cc.

Referenced by GetNodeType().

const string TotemDAQMappingESSourceXML::tagT1CSC ="t1_csc"
static

Definition at line 69 of file TotemDAQMappingESSourceXML.cc.

Referenced by GetNodeType(), and ParseTreeT1().

const string TotemDAQMappingESSourceXML::tagT1Plane ="t1_plane"
static

Definition at line 68 of file TotemDAQMappingESSourceXML.cc.

Referenced by GetNodeType().

const string TotemDAQMappingESSourceXML::tagT2 ="t2_detector_set"
static

T2 XML tags.

Definition at line 61 of file TotemDAQMappingESSourceXML.cc.

Referenced by GetNodeType().

const string TotemDAQMappingESSourceXML::tagT2detector ="t2_detector"
static

Definition at line 63 of file TotemDAQMappingESSourceXML.cc.

Referenced by GetNodeType(), and ParseTreeT2().

const string TotemDAQMappingESSourceXML::tagT2Half ="t2_half"
static

Definition at line 62 of file TotemDAQMappingESSourceXML.cc.

Referenced by GetNodeType().

const string TotemDAQMappingESSourceXML::tagTriggerVFAT1 = "trigger_vfat"
static

Definition at line 75 of file TotemDAQMappingESSourceXML.cc.

Referenced by GetNodeType().

const string TotemDAQMappingESSourceXML::tagVFAT ="vfat"
static

Definition at line 48 of file TotemDAQMappingESSourceXML.cc.

unsigned int TotemDAQMappingESSourceXML::verbosity
private

Definition at line 83 of file TotemDAQMappingESSourceXML.cc.