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

257 {
258 }

Member Function Documentation

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

extracts VFAT's DAQ channel from XML attributes

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

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

Referenced by produce().

221 {
222  char *cmsswPath = getenv("CMSSW_BASE");
223  if (cmsswPath && fn[0] != '/' && fn[0] != '.')
224  return string(cmsswPath) + string("/src/") + fn;
225  else
226  return fn;
227 }
void TotemDAQMappingESSourceXML::GetChannels ( xercesc::DOMNode *  n,
std::set< unsigned char > &  channels 
)
private

Definition at line 1019 of file TotemDAQMappingESSourceXML.cc.

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

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

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

References Exception, and mps_alisetup::parser.

Referenced by ParseXML().

241 {
242  XercesDOMParser* parser = new XercesDOMParser();
243  parser->parse(file.c_str());
244 
245  DOMDocument* xmlDoc = parser->getDocument();
246 
247  if (!xmlDoc)
248  throw cms::Exception("TotemDAQMappingESSourceXML::GetDOMDocument") << "Cannot parse file `" << file
249  << "' (xmlDoc = NULL)." << endl;
250 
251  return xmlDoc;
252 }
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 986 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().

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

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

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

References a, ChipFramePosition(), CommonNode(), 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().

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

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

Referenced by produce().

299 {
300  DOMDocument* domDoc = GetDOMDocument(file);
301  DOMElement* elementRoot = domDoc->getDocumentElement();
302 
303  if (!elementRoot)
304  throw cms::Exception("TotemDAQMappingESSourceXML::ParseMappingXML") << "File `" <<
305  file << "' is empty." << endl;
306 
307  ParseTreeRP(pType, elementRoot, nTop, 0, mapping, mask);
308  ParseTreeT2(pType, elementRoot, nTop, 0, mapping, mask);
309  ParseTreeT1(pType, elementRoot, nTop, 0, mapping, mask, 0,0,0);
310 }
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 263 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().

264 {
265  boost::shared_ptr<TotemDAQMapping> mapping(new TotemDAQMapping());
266  boost::shared_ptr<TotemAnalysisMask> mask(new TotemAnalysisMask());
267 
268  // initialize Xerces
269  try
270  {
271  XMLPlatformUtils::Initialize();
272  }
273  catch (const XMLException& toCatch)
274  {
275  char* message = XMLString::transcode(toCatch.getMessage());
276  throw cms::Exception("TotemDAQMappingESSourceXML") << "An XMLException caught with message: " << message << ".\n";
277  XMLString::release(&message);
278  }
279 
280  // load mapping files
281  for (unsigned int i = 0; i < mappingFileNames.size(); ++i)
283 
284  // load mask files
285  for (unsigned int i = 0; i < maskFileNames.size(); ++i)
286  ParseXML(pMask, CompleteFileName(maskFileNames[i]), mapping, mask);
287 
288  // release Xerces
289  XMLPlatformUtils::Terminate();
290 
291  // commit the products
292  return edm::es::products(mapping, mask);
293 }
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 231 of file TotemDAQMappingESSourceXML.cc.

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

233 {
235  oValidity = infinity;
236 }
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.