test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | 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

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)
 
xercesc::DOMDocument * GetDOMDocument (string file)
 returns the top element from an XML file More...
 
string GetNodeContent (xercesc::DOMNode *parent)
 returns the content of the node More...
 
NodeType GetNodeType (xercesc::DOMNode *)
 determines node type More...
 
string GetNodeValue (xercesc::DOMNode *node)
 returns the value of the node More...
 
void 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

std::vector< std::string > mappingFileNames
 the mapping files More...
 
std::vector< std::string > maskFileNames
 the mask files 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 92 of file TotemDAQMappingESSourceXML.cc.

whether to parse a mapping of a mask XML

Enumerator
pMapping 
pMask 

Definition at line 96 of file TotemDAQMappingESSourceXML.cc.

Constructor & Destructor Documentation

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

Definition at line 209 of file TotemDAQMappingESSourceXML.cc.

References edm::ESProducer::setWhatProduced().

209  :
210  verbosity(conf.getUntrackedParameter<unsigned int>("verbosity", 0)),
211  mappingFileNames(conf.getUntrackedParameter< vector<string> >("mappingFileNames")),
212  maskFileNames(conf.getUntrackedParameter< vector<string> >("maskFileNames"))
213 {
214  setWhatProduced(this);
215  findingRecord<TotemReadoutRcd>();
216 }
T getUntrackedParameter(std::string const &, T const &) const
std::vector< std::string > mappingFileNames
the mapping files
std::vector< std::string > maskFileNames
the mask files
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
Definition: ESProducer.h:115
TotemDAQMappingESSourceXML::~TotemDAQMappingESSourceXML ( )

Definition at line 253 of file TotemDAQMappingESSourceXML.cc.

254 {
255 }

Member Function Documentation

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

extracts VFAT's DAQ channel from XML attributes

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

955 {
957  unsigned char attributeFlag = 0;
958 
959  DOMNamedNodeMap* attr = chipnode->getAttributes();
960  for (unsigned int j = 0; j < attr->getLength(); j++)
961  {
962  DOMNode *a = attr->item(j);
963  if (fp.setXMLAttribute(XMLString::transcode(a->getNodeName()), XMLString::transcode(a->getNodeValue()), attributeFlag) > 1)
964  {
965  throw cms::Exception("TotemDAQMappingESSourceXML") <<
966  "Unrecognized tag `" << XMLString::transcode(a->getNodeName()) <<
967  "' or incompatible value `" << XMLString::transcode(a->getNodeValue()) <<
968  "'." << endl;
969  }
970  }
971 
972  if (!fp.checkXMLAttributeFlag(attributeFlag))
973  {
974  throw cms::Exception("TotemDAQMappingESSourceXML") <<
975  "Wrong/incomplete DAQ channel specification (attributeFlag = " << attributeFlag << ")." << endl;
976  }
977 
978  return fp;
979 }
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 220 of file TotemDAQMappingESSourceXML.cc.

References edm::FileInPath::fullPath().

Referenced by produce().

221 {
222  FileInPath fip(fn);
223  return fip.fullPath();
224 }
void TotemDAQMappingESSourceXML::GetChannels ( xercesc::DOMNode *  n,
std::set< unsigned char > &  channels 
)
private

Definition at line 1016 of file TotemDAQMappingESSourceXML.cc.

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

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

1017 {
1018  DOMNodeList *children = n->getChildNodes();
1019  for (unsigned int i = 0; i < children->getLength(); i++)
1020  {
1021  DOMNode *n = children->item(i);
1022  if (n->getNodeType() != DOMNode::ELEMENT_NODE || !Test(n, "channel"))
1023  continue;
1024 
1025  DOMNamedNodeMap* attr = n->getAttributes();
1026  bool idSet = false;
1027  for (unsigned int j = 0; j < attr->getLength(); j++)
1028  {
1029  DOMNode *a = attr->item(j);
1030 
1031  if (!strcmp(XMLString::transcode(a->getNodeName()), "id"))
1032  {
1033  unsigned int id = 0;
1034  sscanf(XMLString::transcode(a->getNodeValue()), "%u", &id);
1035  channels.insert(id);
1036  idSet = true;
1037  break;
1038  }
1039  }
1040 
1041  if (!idSet)
1042  {
1043  throw cms::Exception("TotemDAQMappingESSourceXML::GetChannels") <<
1044  "Channel tags must have an `id' attribute.";
1045  }
1046  }
1047 }
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
DOMDocument * TotemDAQMappingESSourceXML::GetDOMDocument ( string  file)
private

returns the top element from an XML file

Definition at line 237 of file TotemDAQMappingESSourceXML.cc.

References Exception, and mps_alisetup::parser.

Referenced by ParseXML().

238 {
239  XercesDOMParser* parser = new XercesDOMParser();
240  parser->parse(file.c_str());
241 
242  DOMDocument* xmlDoc = parser->getDocument();
243 
244  if (!xmlDoc)
245  throw cms::Exception("TotemDAQMappingESSourceXML::GetDOMDocument") << "Cannot parse file `" << file
246  << "' (xmlDoc = NULL)." << endl;
247 
248  return xmlDoc;
249 }
string TotemDAQMappingESSourceXML::GetNodeContent ( xercesc::DOMNode *  parent)
inlineprivate

returns the content of the node

Definition at line 131 of file TotemDAQMappingESSourceXML.cc.

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

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

determines node type

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

984 {
985  // common node types
986  if (Test(n, tagArm)) return nArm;
987  if (Test(n, tagChip1)) return nChip;
988  if (Test(n, tagChip2)) return nChip;
989  if (Test(n, tagTriggerVFAT1)) return nTriggerVFAT;
990 
991  // RP node types
992  if (Test(n, tagRPStation)) return nRPStation;
993  if (Test(n, tagRPPot)) return nRPPot;
994  if (Test(n, tagRPPlane)) return nRPPlane;
995 
996  // T2 node types
997  if (Test(n, tagT2)) return nT2;
998  if (Test(n, tagT2detector)) return nT2Det;
999  if (Test(n, tagT2Half)) return nT2Half;
1000 
1001  // T1 node types
1002  if (Test(n, tagT1)) return nT1;
1003  if (Test(n, tagT1Arm)) return nT1Arm;
1004  if (Test(n, tagT1Plane)) return nT1Plane;
1005  if (Test(n, tagT1CSC)) return nT1CSC;
1006  if (Test(n, tagT1ChannelType)) return nT1ChannelType;
1007  if (Test(n, tagChannel)) return nChannel;
1008 
1009 
1010  throw cms::Exception("TotemDAQMappingESSourceXML::GetNodeType") << "Unknown tag `"
1011  << XMLString::transcode(n->getNodeName()) << "'.\n";
1012 }
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 137 of file TotemDAQMappingESSourceXML.cc.

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

Referenced by ParseTreeT2().

138  {
139  return string(xercesc::XMLString::transcode(node->getNodeValue()));
140  }
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 311 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().

314 {
315 #ifdef DEBUG
316  printf(">> TotemDAQMappingESSourceXML::ParseTreeRP(%s, %u, %u)\n", XMLString::transcode(parent->getNodeName()),
317  parentType, parentID);
318 #endif
319 
320  DOMNodeList *children = parent->getChildNodes();
321 
322  for (unsigned int i = 0; i < children->getLength(); i++)
323  {
324  DOMNode *n = children->item(i);
325  if (n->getNodeType() != DOMNode::ELEMENT_NODE)
326  continue;
327 
329 
330 #ifdef DEBUG
331  printf("\tname = %s, type = %u\n", XMLString::transcode(n->getNodeName()), type);
332 #endif
333 
334  // structure control
335  if (!RPNode(type))
336  continue;
337 
338  if ((type != parentType + 1)&&(parentType != nRPPot || type != nTriggerVFAT))
339  {
340  if (parentType == nTop && type == nRPPot)
341  {
342  LogPrint("TotemDAQMappingESSourceXML") << ">> TotemDAQMappingESSourceXML::ParseTreeRP > Warning: tag `" << tagRPPot
343  << "' found in global scope, assuming station ID = 12.";
344  parentID = 12;
345  } else {
346  throw cms::Exception("TotemDAQMappingESSourceXML") << "Node " << XMLString::transcode(n->getNodeName())
347  << " not allowed within " << XMLString::transcode(parent->getNodeName()) << " block.\n";
348  }
349  }
350 
351  // parse tag attributes
352  unsigned int id = 0, hw_id = 0;
353  bool id_set = false, hw_id_set = false;
354  bool fullMask = false;
355  DOMNamedNodeMap* attr = n->getAttributes();
356 
357  for (unsigned int j = 0; j < attr->getLength(); j++)
358  {
359  DOMNode *a = attr->item(j);
360 
361  if (!strcmp(XMLString::transcode(a->getNodeName()), "id"))
362  {
363  sscanf(XMLString::transcode(a->getNodeValue()), "%u", &id);
364  id_set = true;
365  }
366 
367  if (!strcmp(XMLString::transcode(a->getNodeName()), "hw_id"))
368  {
369  sscanf(XMLString::transcode(a->getNodeValue()), "%x", &hw_id);
370  hw_id_set = true;
371  }
372 
373  if (!strcmp(XMLString::transcode(a->getNodeName()), "full_mask"))
374  fullMask = (strcmp(XMLString::transcode(a->getNodeValue()), "no") != 0);
375  }
376 
377  // content control
378  if (!id_set && type != nTriggerVFAT)
379  throw cms::Exception("TotemDAQMappingESSourceXML::ParseTreeRP") << "id not given for element `"
380  << XMLString::transcode(n->getNodeName()) << "'" << endl;
381 
382  if (!hw_id_set && type == nChip && pType == pMapping)
383  throw cms::Exception("TotemDAQMappingESSourceXML::ParseTreeRP") << "hw_id not given for element `"
384  << XMLString::transcode(n->getNodeName()) << "'" << endl;
385 
386  if (type == nRPPlane && id > 9)
387  throw cms::Exception("TotemDAQMappingESSourceXML::ParseTreeRP") <<
388  "Plane IDs range from 0 to 9. id = " << id << " is invalid." << endl;
389 
390 #ifdef DEBUG
391  printf("\tID found: 0x%x\n", id);
392 #endif
393 
394  // store mapping data
395  if (pType == pMapping && (type == nChip || type == nTriggerVFAT))
396  {
397  const TotemFramePosition &framepos = ChipFramePosition(n);
398  TotemVFATInfo vfatInfo;
399  vfatInfo.hwID = hw_id;
401 
402  if (type == nChip)
403  {
404  vfatInfo.symbolicID.symbolicID = parentID * 10 + id;
405  vfatInfo.type = TotemVFATInfo::data;
406  }
407 
408  if (type == nTriggerVFAT)
409  {
410  vfatInfo.symbolicID.symbolicID = parentID;
411  vfatInfo.type = TotemVFATInfo::CC;
412  }
413 
414  mapping->insert(framepos, vfatInfo);
415 
416  continue;
417  }
418 
419  // store mask data
420  if (pType == pMask && type == nChip)
421  {
422  TotemSymbID symbId;
423  symbId.subSystem = TotemSymbID::RP;
424  symbId.symbolicID = parentID * 10 + id;
425 
427  am.fullMask = fullMask;
429 
430  mask->insert(symbId, am);
431 
432  continue;
433  }
434 
435  // recursion (deeper in the tree)
436  ParseTreeRP(pType, n, type, parentID * 10 + id, mapping, mask);
437  }
438 }
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 728 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().

731 {
732  const int ArmMask = 0x0200;
733  const int PlaneMask = 0x01c0;
734  const int CSCMask = 0x0038;
735  const int GenderMask = 0x0004;
736  const int VFnMask = 0x0003;
737 
738  int ArmMask_ = 0;
739  int PlaneMask_ = 0;
740  int CSCMask_ = 0;
741  int GenderMask_ = 0;
742  int VFnMask_ = 0;
743 
744  unsigned int T1ChannelType = 0;
745 
746  DOMNodeList *children = parent->getChildNodes();
747 
748 #ifdef DEBUG
749  printf(">> ParseTreeT1(parent,parentType,parentID)=(%p, %i, %u)\n", parent, parentType, parentID);
750  printf("\tchildren: Numero children: %li\n", children->getLength());
751 #endif
752 
753  for (unsigned int i = 0; i < children->getLength(); i++) {
754  DOMNode *n = children->item(i);
755 
756  if (n->getNodeType() != DOMNode::ELEMENT_NODE)
757  continue;
758 
759  // get node type for RP or T2 or T1
761 
762 #ifdef DEBUG
763  printf("\t\tchildren #%i: is a %s, (of type %i) \n", i, XMLString::transcode(n->getNodeName()), type);
764 #endif
765 
766  if ((type == nUnknown)) {
767 #ifdef DEBUG
768  printf("Found Unknown tag during T1 reading.. EXIT ");
769 #endif
770  continue;
771  }
772 
773  if ((T1Node(type)==false)&&(CommonNode(type)==false)) {
774 #ifdef DEBUG
775  printf("Found Non-T1 tag during T1 reading.. EXIT ");
776  printf("\t The tag is: %s \n", XMLString::transcode(n->getNodeName()));
777 #endif
778  continue;
779  }
780 
781  // id for T2 plane goes from 0..9; for chip is the 16 bit ID
782  // for VFATs: (0 or 1 for anodes A0 and A1; 0, 1 or 2 for Cathodes C0,C1,C2)
783  unsigned int ID_t1 = 0;
784 #ifdef DEBUG
785  unsigned int VFPOS = 0;
786 #endif
787  unsigned int Gender =0;
788 
789  // hardware of an id
790  unsigned int hw_id = 0;
791  bool hw_id_set = false;
792 
793  bool idSet_t1 = false;//bool position_t2Set = false;
794 
795  DOMNamedNodeMap* attr = n->getAttributes();
796 
797  bool fullMask = false;
798 
799  // Begin loop for save T1 element attriute ------------------------------------------------------------------
800  for (unsigned int j = 0; j < attr->getLength(); j++) {
801 
802  DOMNode *a = attr->item(j);
803  if (!strcmp(XMLString::transcode(a->getNodeName()), "id")) {
804  sscanf(XMLString::transcode(a->getNodeValue()), "%u", &ID_t1);
805  idSet_t1 = true;
806  }
807 
808  if (type == nT1Arm) {
809  if (!strcmp(XMLString::transcode(a->getNodeName()), "id")) {
810  // arm is the top node and parent ID should be reset to 0.
811  parentID=0;
812  unsigned int id_arm = atoi(XMLString::transcode(a->getNodeValue()));
813  T1Arm = id_arm;
814  if (id_arm != 0 && id_arm != 1) {
815  throw cms::Exception("TotemDAQMappingESSourceXML::ParseTree") << "T1 id_arm neither 0 nor 1. Problem parsing XML file." << XMLString::transcode(n->getNodeName()) << endl;
816  edm::LogProblem ("TotemDAQMappingESSourceXML") <<"T1 id_arm neither 0 nor 1. Problem parsing XML file."<<XMLString::transcode(n->getNodeName()) ;
817  }
818 
819  id_arm = id_arm << 9;
820  ArmMask_ = ~ArmMask;
821  parentID &= ArmMask_;
822  parentID |= id_arm;
823  }
824  }
825 
826  if (type == nT1Plane) {
827  if (!strcmp(XMLString::transcode(a->getNodeName()), "id")) {
828  unsigned int id_plane = atoi(XMLString::transcode(a->getNodeValue()));
829  T1Plane = id_plane;
830  id_plane = id_plane << 6;
831  PlaneMask_ = ~PlaneMask;
832  parentID &= PlaneMask_;
833  parentID |= id_plane;
834  }
835  }
836 
837  if (type == nT1CSC) {
838  if (!strcmp(XMLString::transcode(a->getNodeName()), "id")) {
839  unsigned int id_csc = atoi(XMLString::transcode(a->getNodeValue()));
840  T1CSC = id_csc;
841  id_csc = id_csc << 3;
842  CSCMask_ = ~CSCMask;
843  parentID &= CSCMask_;
844  parentID |= id_csc;
845  }
846  }
847 
848  if (type == nT1ChannelType) {
849  if (!strcmp(XMLString::transcode(a->getNodeName()), "id")) {
850  T1ChannelType = atoi(XMLString::transcode(a->getNodeValue()));
851  }
852  if (!strcmp(XMLString::transcode(a->getNodeName()), "full_mask")) {
853  fullMask = (strcmp(XMLString::transcode(a->getNodeValue()), "no") != 0);
854  }
855  }
856 
857  if(type == nChip) {
858 #ifdef DEBUG
859  if (!strcmp(XMLString::transcode(a->getNodeName()), "position")){
860  VFPOS = atoi(XMLString::transcode(a->getNodeValue()));
861  }
862 #endif
863  if (!strcmp(XMLString::transcode(a->getNodeName()), "polarity")) {
864  if (!strcmp(XMLString::transcode(a->getNodeValue()),"a")) {
865  Gender = 0;
866  } else
867  if (!strcmp(XMLString::transcode(a->getNodeValue()),"c")) {
868  Gender = 1;
869  } else {
870  throw cms::Exception("TotemDAQMappingESSourceXML::ParseTree") << "T1: Neither anode nor cathode vfat : " << XMLString::transcode(n->getNodeName()) << endl;
871  edm::LogProblem ("TotemDAQMappingESSourceXML") <<"T1: Neither anode nor cathode vfat : "<<XMLString::transcode(n->getNodeName());
872  }
873  }
874 
875  if (!strcmp(XMLString::transcode(a->getNodeName()), "hw_id"))
876  sscanf(XMLString::transcode(a->getNodeValue()), "%x", &hw_id);
877  hw_id_set = true;
878  }
879  }
880 
881  // content control
882  // Note: each element has an id!! However if the element is a plane, it could be enough to use position 0..9
883 
884  if (idSet_t1==false){
885  throw cms::Exception("TotemDAQMappingESSourceXML::ParseTree") << "ID_t1 not given for element `" << XMLString::transcode(n->getNodeName()) << "'" << endl;
886  edm::LogProblem ("TotemDAQMappingESSourceXML") <<"ID_t1 not given for element `"<<XMLString::transcode(n->getNodeName()) << "'";
887  }
888 
889  if (type == nChip && !hw_id_set)
890  throw cms::Exception("TotemDAQMappingESSourceXML::ParseTreeT1") <<
891  "hw_id not set for T1 VFAT id " << ID_t1 << "." << endl;
892 
893 
894 
895  // save mask data
896  if (type == nT1ChannelType && pType == pMask) {
897  TotemSymbID symbId;
898  symbId.subSystem = TotemSymbID::T1;
899  symbId.symbolicID = T1ChannelType + 10 * T1CSC + 100 * T1Plane + 1000 * T1Arm;
900  //cout << "mask: " << T1Arm << " " << T1Plane << " " << T1CSC << " " <<T1ChannelType << endl;
902  am.fullMask = fullMask;
904  mask->insert(symbId, am);
905  //cout << "saved mask, ID = " << symbId.symbolicID << ", full mask: " << am.fullMask << endl;
906  }
907 
908  // save data
909  if (type == nChip) {
910 #ifdef DEBUG
911  printf("T1 Vfat in detector (parentID): %x || Position %i \n", parentID, VFPOS);
912  printf("\t\t\tID_t1 = 0x%x\n", ID_t1);
913 #endif
914 
915  unsigned int symId=0;
916 
917  // Check if it is a special chip
918  if (!tagT1CSC.compare(XMLString::transcode((n->getParentNode()->getNodeName())))) {
919  symId = parentID;
920  Gender = Gender << 2;
921  GenderMask_ = ~GenderMask;
922 
923  symId &= GenderMask_;
924  symId |= Gender;
925 
926  VFnMask_ = ~VFnMask;
927  symId &= VFnMask_;
928  symId |= ID_t1;
929  } else {
930  // It is a special VFAT ...
931  throw cms::Exception("TotemDAQMappingESSourceXML::ParseTree") << "T1 has no special vfat `" << XMLString::transcode(n->getNodeName()) << "'" << endl;
932  edm::LogProblem ("TotemDAQMappingESSourceXML") <<"T1 has no special vfat `"<<XMLString::transcode(n->getNodeName()) << "'";
933  }
934 
935  // Assign a contanaier for the register of that VFAT with ChipId (Hex)
937  TotemVFATInfo vfatInfo;
938  vfatInfo.symbolicID.symbolicID = symId;
939  vfatInfo.hwID = hw_id;
941  vfatInfo.type = TotemVFATInfo::data;
942  mapping->insert(framepos, vfatInfo);
943  } else {
944  // Look for the children of n (recursion)
945  // 3° argument=parentId is needed for calculate VFAT-id startintg from the parent plane
946  ParseTreeT1(pType, n, type, parentID, mapping, mask, T1Arm, T1Plane, T1CSC);
947  }
948  } // Go to the next children
949 }
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 442 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().

445 {
446  DOMNodeList *children = parent->getChildNodes();
447 
448 #ifdef DEBUG
449  printf(">> ParseTreeT2(parent,parentType,parentID)=(%p, %i, %u)\n", parent, parentType, parentID);
450  printf("\tchildren: Numero children: %li\n", children->getLength());
451 #endif
452 
453  for (unsigned int i = 0; i < children->getLength(); i++)
454  {
455  DOMNode *n = children->item(i);
456 
457  if (n->getNodeType() != DOMNode::ELEMENT_NODE)
458  continue;
459 
460  // get node type for RP or T2
462 
463 #ifdef DEBUG
464  printf("\t\tchildren #%i: is a %s, (of type %i) \n", i, XMLString::transcode(n->getNodeName()), type);
465 #endif
466 
467  if ((type == nUnknown)) {
468 #ifdef DEBUG
469  printf("Found Unknown tag during T2 reading.. EXIT ");
470 #endif
471  continue;
472  }
473 
474  if ((T2Node(type)==false)&&(CommonNode(type)==false)) {
475 #ifdef DEBUG
476  printf("Found Non-T2 tag during T2 reading.. EXIT ");
477  printf("\t The tag is: %s \n", XMLString::transcode(n->getNodeName()));
478 #endif
479  continue;
480  }
481 
482  // get ID_t2 and position
483 
484  // id for T2 plane goes from 0..9; for chip is the 16 bit ID
485  // 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
486  int ID_t2 = 0;
487 
488  unsigned int position_t2 = 0;
489 
490  unsigned int arm=0,ht=0,pl=0,pls=0;
491 
492  bool idSet_t2 = false;
493  //position_t2Set = false;
494  int attribcounter_t2planedescript=0;
495  unsigned int toaddForParentID=0;
496 
497  unsigned hw_id = 0;
498  bool hw_id_set = false;
499 
500  DOMNamedNodeMap* attr = n->getAttributes();
501 
502  // Begin loop for save T2 element attriute
503  for (unsigned int j = 0; j < attr->getLength(); j++) {
504  DOMNode *a = attr->item(j);
505  if (!strcmp(XMLString::transcode(a->getNodeName()), "id")) {
506  sscanf(XMLString::transcode(a->getNodeValue()), "%i", &ID_t2);
507  idSet_t2 = true;
508  }
509 
510  if (!strcmp(XMLString::transcode(a->getNodeName()), "hw_id")) {
511  sscanf(XMLString::transcode(a->getNodeValue()), "%x", &hw_id);
512  hw_id_set = true;
513  }
514 
515  if (!strcmp(XMLString::transcode(a->getNodeName()), "position")) {
516  position_t2 = atoi(XMLString::transcode(a->getNodeValue()));
517  if (pType == pMask)
518  toaddForParentID = position_t2;
519 // position_t2Set = true;
520  }
521 
522  if (type == nArm) {
523  // arm is the top node and should be reset to 0.
524  if (!strcmp(XMLString::transcode(a->getNodeName()), "id")) {
525  parentID=0;
526  unsigned int id_arm = atoi(XMLString::transcode(a->getNodeValue()));
527  toaddForParentID=20*id_arm;
528  }
529  }
530 
531  if (type == nT2Half) {
532  if (!strcmp(XMLString::transcode(a->getNodeName()), "id")) {
533  unsigned int id_half = atoi(XMLString::transcode(a->getNodeValue()));
534  toaddForParentID=10*id_half;
535  }
536  }
537 
538  // This is needed in principle only for the old formats
539  if(type == nT2Det) {
540  if (!strcmp(XMLString::transcode(a->getNodeName()), "arm")) {
541  sscanf(XMLString::transcode(a->getNodeValue()), "%u", &arm);
542  attribcounter_t2planedescript++;
543  }
544 
545  if (!strcmp(XMLString::transcode(a->getNodeName()), "ht")) {
546  sscanf(XMLString::transcode(a->getNodeValue()), "%u", &ht);
547  attribcounter_t2planedescript++;
548  }
549 
550  if (!strcmp(XMLString::transcode(a->getNodeName()), "pl")) {
551  sscanf(XMLString::transcode(a->getNodeValue()), "%u", &pl);
552  attribcounter_t2planedescript++;
553  }
554 
555  if (!strcmp(XMLString::transcode(a->getNodeName()), "pls")) {
556  sscanf(XMLString::transcode(a->getNodeValue()), "%u", &pls);
557  attribcounter_t2planedescript++;
558  }
559 
560  // remember id in monitor goes from 0 -- 39
561  if (!strcmp(XMLString::transcode(a->getNodeName()), "id")) {
562  // Id saved another time ... just to increment attribcounter
563  sscanf(XMLString::transcode(a->getNodeValue()), "%i", &ID_t2);
564  attribcounter_t2planedescript++;
565  }
566 
567  if (!strcmp(XMLString::transcode(a->getNodeName()), "position")) {
568  sscanf(XMLString::transcode(a->getNodeValue()), "%u", &position_t2);
569  attribcounter_t2planedescript++;
570  // Just another indication for further checking. This attribute was not compulsory in monitor.
571  attribcounter_t2planedescript=attribcounter_t2planedescript+20;
572  // 20 is just a "big number"
573  }
574  }
575  }
576 
577  // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
578  // When a plane tag is found, calculate Parent-Id and allows different xml formats:
579  // Provide compatibility with old monitor formats.
580 
581  // Note:
582  // plane position and id foreseen in final ip5 mapping.
583  // plane position NOT foreseen in Monitor.
584 
585  if (pType == pMapping) {
586  if (type == nT2Det) {
587  // Calculate the parent-id from attributes or xml STRUCTURE
588 // position_t2Set = true;
589  if (attribcounter_t2planedescript>=(21)) {
590  // there is already in xml plane the "position" attribute + other attributes. It is assumed to utilize the parent info
591 
592 #ifdef DEBUG
593  printf("TotemDAQMappingESSourceXML: attribcounter_t2planedescript: %i \n",attribcounter_t2planedescript);
594 #endif
595 
596  if (attribcounter_t2planedescript>=25) {
597  edm::LogVerbatim("TotemDAQMappingESSourceXML") << "T2-Plane attribute utilezed for parentID: position+info from parent ";
598  //Plane Seems fully specified
599  //all T2 plane attribute read correctly. Check if it is consitent
600  unsigned int test_position_t2=arm*20+ht*10+pl*2+pls;
601  unsigned int testHS=pl*2+pls;
602  if(testHS!=position_t2) {
603  edm::LogPrint("TotemDAQMappingESSourceXML") <<"T2 Xml inconsistence in pl-pls attributes and position. Only 'position attribute' taken ";
604  }
605 
606  // For plane, ID_t2 should go from 0..39 position_t2 from 0..9
607  ID_t2=parentID+position_t2;
608  cout << "attribcounter_t2planedescript>=(25), ID_t2: " << ID_t2 << endl;
609  toaddForParentID=position_t2;
610  if (ID_t2!=(int)test_position_t2)
611  edm::LogPrint("TotemDAQMappingESSourceXML") <<"T2 Xml inconsistence in plane attributes and xml parents structure. Plane attributes ignored";
612 
613  } else {
614  // Case where arm-ht-pl-pls are NOT specified
615  edm::LogVerbatim("TotemDAQMappingESSourceXML")<<"T2 Plane have parentID: "<<parentID<<" for its VFATs. Plane Position read: "<<position_t2;
616 
617  if (attribcounter_t2planedescript==21) {
618  // You have put in XML only position and not Plane id (the last is obligatory)
619  ID_t2=parentID+position_t2;
620  // cout << "attribcounter_t2planedescript>=(21), ID_t2: " << ID_t2 << endl;
621  toaddForParentID=position_t2;
622  idSet_t2=true;
623  }
624  }
625  } else {
626  // Construct plane position from other attributes cause "position" is not inserted;
627  // Ex- monitor: <t2_detector id="0" z="13871.3" arm="0" ht="0" pl="0" pls="0" >
628 
629  if (attribcounter_t2planedescript>=1) {
630  // Remember, Z attribute is not counted
631 
632  if(attribcounter_t2planedescript>=5) {
633  int test_position_t2=arm*20+ht*10+pl*2+pls;
634 
635  // case for xml from monitor
636  ID_t2=test_position_t2;
637  cout << "ID_t2=test_position_t2: " << ID_t2 << endl;
638  toaddForParentID=test_position_t2;
639 
640  if ((int)parentID!=ID_t2) {
641  edm::LogPrint("TotemDAQMappingESSourceXML") <<"T2 Inconsistence between plane 'id' and position from attributes. Id ignored";
642  edm::LogPrint("TotemDAQMappingESSourceXML") <<" T2-Parent = "<<parentID;
643  }
644  } else {
645  toaddForParentID=ID_t2;
646  edm::LogVerbatim("TotemDAQMappingESSourceXML")<<" Number of T2 plane attributes: "<< attribcounter_t2planedescript<<" T2-Plane attribute utilezed for parentID: plane 'id' only";
647  }
648  } else {
649 // position_t2Set = false;
650  edm::LogProblem ("TotemDAQMappingESSourceXML") << "T2 plane not enough specified from its attribute!";
651  }
652  }
653  }
654 
655  // content control
656  if (idSet_t2 == false) {
657  throw cms::Exception("TotemDAQMappingESSourceXML::ParseTree") << "ID_t2 not given for element `" << XMLString::transcode(n->getNodeName()) << "'" << endl;
658  edm::LogProblem ("TotemDAQMappingESSourceXML") <<"ID_t2 not given for element `"<<XMLString::transcode(n->getNodeName()) << "'";
659  }
660 
661  if (type == nChip && !hw_id_set)
662  throw cms::Exception("TotemDAQMappingESSourceXML::ParseTree") << "hw_id not given for VFAT id `" <<
663  ID_t2 << "'" << endl;
664 
665  if (type == nT2Det && position_t2 > 39) {
666  throw cms::Exception("TotemDAQMappingESSourceXML::ParseTree") << "Plane position_t2 range from 0 to 39. position_t2 = " << position_t2 << " is invalid." << endl;
667  edm::LogProblem ("TotemDAQMappingESSourceXML") <<"Plane position_t2 range from 0 to 39. position_t2 = "<<position_t2<< " is invalid.";
668  }
669  }
670 
671 
672  if (type == nChip) {
673  // save mapping data
674  if (pType == pMapping) {
675 #ifdef DEBUG
676  printf("T2 Vfat in plane (parentID): %i || GeomPosition %i \n", parentID, ID_t2);
677  printf("\t\t\tID_t2 = 0x%x\n", hw_id);
678  printf("\t\t\tpos = %i\n", position_t2);
679 #endif
680  unsigned int symId=0;
681  // Check if it is a special chip
682  if (!tagT2detector.compare(XMLString::transcode((n->getParentNode()->getNodeName()))))
683  symId = parentID * 100 + ID_t2; // same conv = symbplaneNumber*100 +iid used in DQM
684  else {
685  // It is a special VFAT and the special number is set directly in the XML file
686  symId = ID_t2; //17,18,19,20
687 #ifdef DEBUG
688  printf("TotemDAQMappingESSourceXML Found T2 special Vfat ChId-SLink-Symb 0x%x - %i - %i \n",
689  ID_t2,position_t2,symId );
690 #endif
691  }
692 
694  TotemVFATInfo vfatInfo;
695  vfatInfo.symbolicID.symbolicID = symId;
696  vfatInfo.hwID = hw_id;
698  vfatInfo.type = TotemVFATInfo::data;
699  data->insert(framepos, vfatInfo);
700  }
701 
702  // save mask data
703  if (pType == pMask) {
704  TotemVFATAnalysisMask vfatMask;
705  TotemSymbID symbId;
706  symbId.subSystem = TotemSymbID::T2;
707  symbId.symbolicID = 100*parentID+ID_t2;
708 
709  DOMNode *fullMaskNode = attr->getNamedItem(XMLString::transcode("full_mask"));
710  if (fullMaskNode && !GetNodeValue(fullMaskNode).compare("yes"))
711  vfatMask.fullMask = true;
712  else
713  GetChannels(n, vfatMask.maskedChannels);
714 
715  mask->insert(symbId, vfatMask);
716  //cout << "saved mask, ID = " << symbId.symbolicID << ", full mask: " << vfatMask.fullMask << endl;
717  }
718  } else {
719  // Look for the children of n (recursion)
720  // 3° argument=parentId is needed for calculate VFAT-id startintg from the parent plane
721  ParseTreeT2(pType, n, type, parentID+toaddForParentID, data, mask);
722  }
723  } // Go to the next children
724 }
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
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 294 of file TotemDAQMappingESSourceXML.cc.

References Exception, GetDOMDocument(), nTop, ParseTreeRP(), ParseTreeT1(), and ParseTreeT2().

Referenced by produce().

296 {
297  DOMDocument* domDoc = GetDOMDocument(file);
298  DOMElement* elementRoot = domDoc->getDocumentElement();
299 
300  if (!elementRoot)
301  throw cms::Exception("TotemDAQMappingESSourceXML::ParseMappingXML") << "File `" <<
302  file << "' is empty." << endl;
303 
304  ParseTreeRP(pType, elementRoot, nTop, 0, mapping, mask);
305  ParseTreeT2(pType, elementRoot, nTop, 0, mapping, mask);
306  ParseTreeT1(pType, elementRoot, nTop, 0, mapping, mask, 0,0,0);
307 }
xercesc::DOMDocument * GetDOMDocument(string file)
returns the top element from an XML file
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 260 of file TotemDAQMappingESSourceXML.cc.

References CompleteFileName(), Exception, i, mappingFileNames, 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().

261 {
262  boost::shared_ptr<TotemDAQMapping> mapping(new TotemDAQMapping());
263  boost::shared_ptr<TotemAnalysisMask> mask(new TotemAnalysisMask());
264 
265  // initialize Xerces
266  try
267  {
268  XMLPlatformUtils::Initialize();
269  }
270  catch (const XMLException& toCatch)
271  {
272  char* message = XMLString::transcode(toCatch.getMessage());
273  throw cms::Exception("TotemDAQMappingESSourceXML") << "An XMLException caught with message: " << message << ".\n";
274  XMLString::release(&message);
275  }
276 
277  // load mapping files
278  for (unsigned int i = 0; i < mappingFileNames.size(); ++i)
280 
281  // load mask files
282  for (unsigned int i = 0; i < maskFileNames.size(); ++i)
283  ParseXML(pMask, CompleteFileName(maskFileNames[i]), mapping, mask);
284 
285  // release Xerces
286  XMLPlatformUtils::Terminate();
287 
288  // commit the products
289  return edm::es::products(mapping, mask);
290 }
int i
Definition: DBlmapReader.cc:9
Channel-mask mapping.
void ParseXML(ParseType, const string &file, const boost::shared_ptr< TotemDAQMapping > &, const boost::shared_ptr< TotemAnalysisMask > &)
parses XML file
std::vector< std::string > mappingFileNames
the mapping files
std::vector< std::string > maskFileNames
the mask files
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)
string CompleteFileName(const string &fn)
adds the path prefix, if needed
bool TotemDAQMappingESSourceXML::RPNode ( NodeType  type)
inlineprivate
void TotemDAQMappingESSourceXML::setIntervalFor ( const edm::eventsetup::EventSetupRecordKey ,
const edm::IOVSyncValue iosv,
edm::ValidityInterval oValidity 
)
protectedvirtual

sets infinite validity of this data

Implements edm::EventSetupRecordIntervalFinder.

Definition at line 228 of file TotemDAQMappingESSourceXML.cc.

References edm::IOVSyncValue::beginOfTime(), edm::IOVSyncValue::endOfTime(), and infinity.

230 {
232  oValidity = infinity;
233 }
static const IOVSyncValue & endOfTime()
Definition: IOVSyncValue.cc:97
static const IOVSyncValue & beginOfTime()
const double infinity
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 122 of file TotemDAQMappingESSourceXML.cc.

References XERCES_CPP_NAMESPACE_USE::transcode().

Referenced by GetChannels(), and GetNodeType().

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

Member Data Documentation

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

the mapping files

Definition at line 86 of file TotemDAQMappingESSourceXML.cc.

Referenced by produce().

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

the mask files

Definition at line 89 of file TotemDAQMappingESSourceXML.cc.

Referenced by produce().

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.