CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Typedefs | Functions
xuti Namespace Reference

Typedefs

typedef std::basic_string< XMLCh > XercesString
 Define an intermediate type. More...
 

Functions

const std::string ADCToGeVConstant_tag ("EcalADCToGeVConstant")
 
const std::string AlignmentConstant_tag ("EcalAlignmentConstant")
 
const std::string Barrel_tag ("BarrelValue")
 
const std::string Cell_tag ("cell")
 
const std::string ChannelStatus_tag ("EcalChannelStatus")
 
const std::string ChannelStatusCode_tag ("ChannelStatusCode")
 
const std::string DAQStatusCode_tag ("DAQStatusCode")
 
const std::string DAQTowerStatus_tag ("EcalDAQTowerStatus")
 
const std::string DCSStatusCode_tag ("DCSStatusCode")
 
const std::string DCSTowerStatus_tag ("EcalDCSTowerStatus")
 
const std::string EcalFloatCondObjectContainer_tag ("EcalFloatCondObjectContainer")
 
const std::string EcalTBWeight_tag ("EcalTBWeight")
 
const std::string EcalTBWeights_tag ("EcalTBWeights")
 
const std::string EcalTDCId_tag ("EcalTDCId")
 
const std::string EcalWeightSet_tag ("EcalWeightSet")
 
const std::string EcalXtalGroupId_tag ("EcalXtalGroupId")
 
const std::string Endcap_tag ("EndcapValue")
 
const std::string ESGain_tag ("ESGain")
 
XercesString fromNative (const char *str)
 
XercesString fromNative (const std::string &str)
 
const std::string Gain12Over6_tag ("Gain12Over6")
 
const std::string Gain6Over1_tag ("Gain6Over1")
 
const std::string GainRatios_tag ("EcalGainRatios")
 
xercesc::DOMNode * getChildNode (xercesc::DOMNode *node, const std::string &nodename)
 get the child of More...
 
template<class T >
void GetNodeData (xercesc::DOMNode *node, T &value)
 get the node data More...
 
void GetNodeStringData (xercesc::DOMNode *node, std::string &value)
 get the node data as string. Needs to be used to avoid splitting More...
 
const std::string Header_datasourcetag ("datasource")
 
const std::string Header_datetag ("date")
 
const std::string Header_methodtag ("method")
 
const std::string Header_sincetag ("since")
 
const std::string Header_tag ("EcalCondHeader")
 
const std::string Header_tagtag ("tag")
 
const std::string Header_versiontag ("version")
 
const std::string id_tag ("id")
 
const std::string iEta_tag ("iEta")
 
const std::string IntercalibConstant_tag ("IntercalibConstant")
 
const std::string IntercalibConstants_tag ("EcalIntercalibConstants")
 
const std::string IntercalibError_tag ("IntercalibError")
 
const std::string iPhi_tag ("iPhi")
 
const std::string ix_tag ("ix")
 
const std::string ixSC_tag ("ixSC")
 
const std::string iy_tag ("iy")
 
const std::string iySC_tag ("iySC")
 
const std::string Laser_p1_tag ("p1")
 
const std::string Laser_p2_tag ("p2")
 
const std::string Laser_p3_tag ("p3")
 
const std::string Laser_t1_tag ("t1")
 
const std::string Laser_t2_tag ("t2")
 
const std::string Laser_t3_tag ("t3")
 
const std::string Laser_tag ("EcalLaserAPDPNRatios")
 
const std::string LinearCorrections_tag ("EcalLinearCorrections")
 
const std::string Linearization_m12_tag ("mult12")
 
const std::string Linearization_m1_tag ("mult1")
 
const std::string Linearization_m6_tag ("mult6")
 
const std::string Linearization_s12_tag ("shift12")
 
const std::string Linearization_s1_tag ("shift1")
 
const std::string Linearization_s6_tag ("shift6")
 
const std::string Linearization_tag ("EcalTPGLinearizationConts")
 
const std::string mean12_tag ("mean_x12")
 
const std::string mean1_tag ("mean_x1")
 
const std::string mean6_tag ("mean_x6")
 
const std::string Pedestals_tag ("EcalPedestals")
 
const std::string Phi_tag ("Phi")
 
const std::string Psi_tag ("Psi")
 
const DetId readCellId (xercesc::DOMElement *node)
 Assuming. More...
 
void readHeader (xercesc::DOMNode *parentNode, EcalCondHeader &header)
 read header from More...
 
int readHeader (const std::string &filename, EcalCondHeader &header)
 read header from any xml file, return -1 in case of error More...
 
const std::string rms12_tag ("rms_x12")
 
const std::string rms1_tag ("rms_x1")
 
const std::string rms6_tag ("rms_x6")
 
const std::string row_tag ("row")
 
const std::string subdet_tag ("SubDet")
 
const std::string Theta_tag ("Theta")
 
const std::string TimeOffsetConstant_tag ("EcalTimeOffsetConstant")
 
std::string toNative (const XMLCh *str)
 
std::string toNative (const XercesString &str)
 
const std::string TPGCrystalStatus_tag ("EcalTPGCrystalStatus")
 
const std::string TPGStripStatus_tag ("EcalTPGStripStatus")
 
const std::string TPGTowerStatus_tag ("EcalTPGTowerStatus")
 
const std::string Value_tag ("Value")
 
const std::string WeightGroup_tag ("EcalWeightGroup")
 
const std::string WeightGroups_tag ("EcalWeightGroups")
 
const std::string wgtAfterSwitch_tag ("WeightAfterSwitch")
 
const std::string wgtBeforeSwitch_tag ("WeightBeforeSwitch")
 
const std::string wgtChi2AfterSwitch_tag ("Chi2WeightAfterSwitch")
 
const std::string wgtChi2BeforeSwitch_tag ("Chi2WeightBeforeSwitch")
 
xercesc::DOMElement * writeCell (xercesc::DOMNode *node, const DetId &detid)
 Append a Cell node with attributes to. More...
 
void writeHeader (xercesc::DOMNode *parentNode, const EcalCondHeader &header)
 write More...
 
template<class T >
void WriteNodeWithValue (xercesc::DOMNode *parentNode, const std::string &tag, const T &value)
 write a node with More...
 
const std::string x_tag ("x")
 
const std::string y_tag ("y")
 
const std::string z_tag ("z")
 
const std::string zside_tag ("zside")
 

Detailed Description

Helper function for converting Ecal DB Objects to XML

Author
S. Argiro, F. Rubbo
Id:
DOMHelperFunctions.h,v 1.1 2008/11/14 15:46:05 argiro Exp

Utility functions to convert from unhandy XMLCh * to std::string and back

To convert a XMLCh* into a std::string:

std::string aString= toNative(const XMLCh* str);

to convert a std::string into XMLCh* and not worry about memory:

XMLCh * aCh = fromNative(std::string str).c_str();

Author
Stefano Argiro' (seen somehwere on the internet)
Id:
XercesString.h,v 1.4 2008/11/05 15:17:40 argiro Exp

Typedef Documentation

typedef std::basic_string<XMLCh> xuti::XercesString

Define an intermediate type.

Definition at line 28 of file XercesString.h.

Function Documentation

const std::string xuti::ADCToGeVConstant_tag ( "EcalADCToGeVConstant"  )
const std::string xuti::AlignmentConstant_tag ( "EcalAlignmentConstant"  )
const std::string xuti::Barrel_tag ( "BarrelValue"  )
const std::string xuti::Cell_tag ( "cell"  )
const std::string xuti::ChannelStatus_tag ( "EcalChannelStatus"  )
const std::string xuti::ChannelStatusCode_tag ( "ChannelStatusCode"  )
const std::string xuti::DAQStatusCode_tag ( "DAQStatusCode"  )
const std::string xuti::DAQTowerStatus_tag ( "EcalDAQTowerStatus"  )
const std::string xuti::DCSStatusCode_tag ( "DCSStatusCode"  )
const std::string xuti::DCSTowerStatus_tag ( "EcalDCSTowerStatus"  )
const std::string xuti::EcalFloatCondObjectContainer_tag ( "EcalFloatCondObjectContainer"  )
const std::string xuti::EcalTBWeight_tag ( "EcalTBWeight"  )
const std::string xuti::EcalTBWeights_tag ( "EcalTBWeights"  )
const std::string xuti::EcalTDCId_tag ( "EcalTDCId"  )
const std::string xuti::EcalWeightSet_tag ( "EcalWeightSet"  )
const std::string xuti::EcalXtalGroupId_tag ( "EcalXtalGroupId"  )
const std::string xuti::Endcap_tag ( "EndcapValue"  )
const std::string xuti::ESGain_tag ( "ESGain"  )
XercesString xuti::fromNative ( const char *  str)
inline

Definition at line 31 of file XercesString.h.

Referenced by EcalAlignmentXMLTranslator::dumpXML(), ESGainXMLTranslator::dumpXML(), EcalTPGCrystalStatusXMLTranslator::dumpXML(), EcalTimeBiasCorrectionsXMLTranslator::dumpXML(), EcalClusterCrackCorrXMLTranslator::dumpXML(), EcalClusterEnergyCorrectionObjectSpecificXMLTranslator::dumpXML(), EcalClusterEnergyCorrectionXMLTranslator::dumpXML(), EcalClusterLocalContCorrXMLTranslator::dumpXML(), EcalTBWeightsXMLTranslator::dumpXML(), EcalTPGStripStatusXMLTranslator::dumpXML(), EcalTPGTowerStatusXMLTranslator::dumpXML(), EcalPedestalsXMLTranslator::dumpXML(), EcalDAQTowerStatusXMLTranslator::dumpXML(), EcalDCSTowerStatusXMLTranslator::dumpXML(), EcalChannelStatusXMLTranslator::dumpXML(), EcalADCToGeVXMLTranslator::dumpXML(), EcalTimeOffsetXMLTranslator::dumpXML(), EcalTPGLinearizationConstXMLTranslator::dumpXML(), EcalGainRatiosXMLTranslator::dumpXML(), EcalWeightGroupXMLTranslator::dumpXML(), EcalFloatCondObjectContainerXMLTranslator::dumpXML(), EcalLinearCorrectionsXMLTranslator::dumpXML(), EcalWeightSetXMLTranslator::dumpXML(), EcalLaserAPDPNRatiosXMLTranslator::dumpXML(), fromNative(), readCellId(), EcalTBWeightsXMLTranslator::readWeightSet(), EcalWeightSetXMLTranslator::readXML(), EcalWeightSetXMLTranslator::write10x10(), EcalWeightSetXMLTranslator::write3x10(), writeCell(), EcalTBWeightsXMLTranslator::writeChi2WeightMatrix(), writeHeader(), WriteNodeWithValue(), EcalTBWeightsXMLTranslator::writeWeightMatrix(), and EcalTBWeightsXMLTranslator::writeWeightSet().

31  {
32  boost::scoped_array<XMLCh> ptr(xercesc::XMLString::transcode(str));
33  return XercesString(ptr.get( ));
34  }
std::basic_string< XMLCh > XercesString
Define an intermediate type.
Definition: XercesString.h:28
XercesString xuti::fromNative ( const std::string &  str)
inline

Definition at line 37 of file XercesString.h.

References fromNative().

37  {
38  return fromNative(str.c_str( ));
39  }
XercesString fromNative(const char *str)
Definition: XercesString.h:31
const std::string xuti::Gain12Over6_tag ( "Gain12Over6"  )
const std::string xuti::Gain6Over1_tag ( "Gain6Over1"  )
const std::string xuti::GainRatios_tag ( "EcalGainRatios"  )
xercesc::DOMNode* xuti::getChildNode ( xercesc::DOMNode *  node,
const std::string &  nodename 
)
template<class T >
void xuti::GetNodeData ( xercesc::DOMNode *  node,
T value 
)
void xuti::GetNodeStringData ( xercesc::DOMNode *  node,
std::string &  value 
)

get the node data as string. Needs to be used to avoid splitting

Definition at line 244 of file DOMHelperFunctions.cc.

References toNative().

Referenced by readHeader().

244  {
245  value= toNative(node->getTextContent());
246 }
tuple node
Definition: Node.py:50
std::string toNative(const XMLCh *str)
Definition: XercesString.h:42
const std::string xuti::Header_datasourcetag ( "datasource"  )

Referenced by readHeader(), and writeHeader().

const std::string xuti::Header_datetag ( "date"  )

Referenced by readHeader(), and writeHeader().

const std::string xuti::Header_methodtag ( "method"  )

Referenced by readHeader(), and writeHeader().

const std::string xuti::Header_sincetag ( "since"  )

Referenced by readHeader(), and writeHeader().

const std::string xuti::Header_tag ( "EcalCondHeader"  )

Referenced by readHeader(), and writeHeader().

const std::string xuti::Header_tagtag ( "tag"  )

Referenced by readHeader(), and writeHeader().

const std::string xuti::Header_versiontag ( "version"  )

Referenced by readHeader(), and writeHeader().

const std::string xuti::id_tag ( "id"  )
const std::string xuti::iEta_tag ( "iEta"  )

Referenced by readCellId(), and writeCell().

const std::string xuti::IntercalibConstant_tag ( "IntercalibConstant"  )
const std::string xuti::IntercalibConstants_tag ( "EcalIntercalibConstants"  )
const std::string xuti::IntercalibError_tag ( "IntercalibError"  )
const std::string xuti::iPhi_tag ( "iPhi"  )

Referenced by readCellId(), and writeCell().

const std::string xuti::ix_tag ( "ix"  )

Referenced by readCellId(), and writeCell().

const std::string xuti::ixSC_tag ( "ixSC"  )

Referenced by readCellId(), and writeCell().

const std::string xuti::iy_tag ( "iy"  )

Referenced by readCellId(), and writeCell().

const std::string xuti::iySC_tag ( "iySC"  )

Referenced by readCellId(), and writeCell().

const std::string xuti::Laser_p1_tag ( "p1"  )
const std::string xuti::Laser_p2_tag ( "p2"  )
const std::string xuti::Laser_p3_tag ( "p3"  )
const std::string xuti::Laser_t1_tag ( "t1"  )
const std::string xuti::Laser_t2_tag ( "t2"  )
const std::string xuti::Laser_t3_tag ( "t3"  )
const std::string xuti::Laser_tag ( "EcalLaserAPDPNRatios"  )
const std::string xuti::LinearCorrections_tag ( "EcalLinearCorrections"  )
const std::string xuti::Linearization_m12_tag ( "mult12"  )
const std::string xuti::Linearization_m1_tag ( "mult1"  )
const std::string xuti::Linearization_m6_tag ( "mult6"  )
const std::string xuti::Linearization_s12_tag ( "shift12"  )
const std::string xuti::Linearization_s1_tag ( "shift1"  )
const std::string xuti::Linearization_s6_tag ( "shift6"  )
const std::string xuti::Linearization_tag ( "EcalTPGLinearizationConts"  )
const std::string xuti::mean12_tag ( "mean_x12"  )
const std::string xuti::mean1_tag ( "mean_x1"  )
const std::string xuti::mean6_tag ( "mean_x6"  )
const std::string xuti::Pedestals_tag ( "EcalPedestals"  )
const std::string xuti::Phi_tag ( "Phi"  )
const std::string xuti::Psi_tag ( "Psi"  )
const DetId xuti::readCellId ( xercesc::DOMElement *  node)

Assuming.

Parameters
nodeis a <cell> node, read the id

Definition at line 25 of file DOMHelperFunctions.cc.

References dtNoiseDBValidation_cfg::cerr, fromNative(), iEta_tag(), iPhi_tag(), ix_tag(), ixSC_tag(), iy_tag(), iySC_tag(), toNative(), and zside_tag().

Referenced by EcalFloatCondObjectContainerXMLTranslator::readXML(), EcalDAQTowerStatusXMLTranslator::readXML(), EcalPedestalsXMLTranslator::readXML(), EcalDCSTowerStatusXMLTranslator::readXML(), EcalChannelStatusXMLTranslator::readXML(), EcalGainRatiosXMLTranslator::readXML(), EcalWeightGroupXMLTranslator::readXML(), EcalLinearCorrectionsXMLTranslator::readXML(), and EcalLaserAPDPNRatiosXMLTranslator::readXML().

25  {
26 
27 
28  int ieta =0;
29  int iphi =0;
30  int ix =0;
31  int iy =0;
32  int ixSC =0;
33  int iySC =0;
34  int zside=0;
35 
36  stringstream ieta_str ;
37  stringstream iphi_str;
38  stringstream ix_str;
39  stringstream iy_str ;
40  stringstream ixSC_str;
41  stringstream iySC_str ;
42  stringstream zside_str ;
43 
44 
45  ieta_str << toNative(node->getAttribute(fromNative(iEta_tag).c_str()));
46  iphi_str << toNative(node->getAttribute(fromNative(iPhi_tag).c_str()));
47  ix_str << toNative(node->getAttribute(fromNative(ix_tag).c_str()));
48  iy_str << toNative(node->getAttribute(fromNative(iy_tag).c_str()));
49  ixSC_str << toNative(node->getAttribute(fromNative(ixSC_tag).c_str()));
50  iySC_str << toNative(node->getAttribute(fromNative(iySC_tag).c_str()));
51  zside_str<< toNative(node->getAttribute(fromNative(zside_tag).c_str()));
52 
53  ieta_str>> ieta;
54  iphi_str>> iphi;
55  ix_str >> ix;
56  iy_str >> iy;
57  ixSC_str >> ixSC;
58  iySC_str >> iySC;
59  zside_str >> zside;
60 
61  if (ieta && iphi) {return EBDetId(ieta,iphi);}
62  if (ix && iy && zside){return EEDetId(ix,iy,zside);}
63  if (ixSC && iySC && zside){return EcalScDetId(ixSC, iySC, zside);}
64 
65  cerr<<"XMLCell: error reading cell, missing field ?"<<std::endl;
66  return 0;
67 
68 }
const std::string iySC_tag("iySC")
const std::string iEta_tag("iEta")
tuple node
Definition: Node.py:50
const std::string ix_tag("ix")
const std::string iy_tag("iy")
const std::string zside_tag("zside")
XercesString fromNative(const char *str)
Definition: XercesString.h:31
const std::string ixSC_tag("ixSC")
const std::string iPhi_tag("iPhi")
std::string toNative(const XMLCh *str)
Definition: XercesString.h:42
void xuti::readHeader ( xercesc::DOMNode *  parentNode,
EcalCondHeader header 
)

read header from

Parameters
parentNode

Definition at line 189 of file DOMHelperFunctions.cc.

References EcalCondHeader::datasource_, EcalCondHeader::date_, getChildNode(), GetNodeData(), GetNodeStringData(), Header_datasourcetag(), Header_datetag(), Header_methodtag(), Header_sincetag(), Header_tag(), Header_tagtag(), Header_versiontag(), EcalCondHeader::method_, EcalCondHeader::since_, EcalCondHeader::tag_, and EcalCondHeader::version_.

Referenced by EcalFloatCondObjectContainerHandler::id(), readHeader(), EcalTimeBiasCorrectionsXMLTranslator::readXML(), EcalClusterCrackCorrXMLTranslator::readXML(), EcalClusterLocalContCorrXMLTranslator::readXML(), EcalClusterEnergyCorrectionObjectSpecificXMLTranslator::readXML(), EcalClusterEnergyCorrectionXMLTranslator::readXML(), EcalFloatCondObjectContainerXMLTranslator::readXML(), EcalTBWeightsXMLTranslator::readXML(), EcalTPGStripStatusXMLTranslator::readXML(), EcalTPGTowerStatusXMLTranslator::readXML(), EcalDCSTowerStatusXMLTranslator::readXML(), EcalDAQTowerStatusXMLTranslator::readXML(), EcalPedestalsXMLTranslator::readXML(), EcalChannelStatusXMLTranslator::readXML(), EcalADCToGeVXMLTranslator::readXML(), EcalTimeOffsetXMLTranslator::readXML(), EcalGainRatiosXMLTranslator::readXML(), EcalWeightGroupXMLTranslator::readXML(), EcalLinearCorrectionsXMLTranslator::readXML(), EcalWeightSetXMLTranslator::readXML(), and EcalLaserAPDPNRatiosXMLTranslator::readXML().

190  {
191 
192  DOMNode * hnode = getChildNode(parentNode,Header_tag);
193 
194  DOMNode * node = getChildNode(hnode,Header_methodtag);
195  GetNodeStringData(node,header.method_);
196 
197  node = getChildNode(hnode,Header_versiontag);
198  GetNodeStringData(node,header.version_);
199 
200  node = getChildNode(hnode,Header_datasourcetag);
201  GetNodeStringData(node,header.datasource_);
202 
203  node = getChildNode(hnode,Header_sincetag);
204  GetNodeData(node,header.since_);
205 
206  node = getChildNode(hnode,Header_tagtag);
207  GetNodeStringData(node,header.tag_);
208 
209 
210  node = getChildNode(hnode,Header_datetag);
211  GetNodeStringData(node,header.date_);
212 
213 }
void GetNodeStringData(xercesc::DOMNode *node, std::string &value)
get the node data as string. Needs to be used to avoid splitting
std::string datasource_
cond::Time_t since_
std::string date_
const std::string Header_sincetag("since")
std::string version_
tuple node
Definition: Node.py:50
const std::string Header_methodtag("method")
const std::string Header_datetag("date")
std::string tag_
const std::string Header_tagtag("tag")
const std::string Header_versiontag("version")
const std::string Header_tag("EcalCondHeader")
std::string method_
void GetNodeData(xercesc::DOMNode *node, T &value)
get the node data
xercesc::DOMNode * getChildNode(xercesc::DOMNode *node, const std::string &nodename)
get the child of
const std::string Header_datasourcetag("datasource")
int xuti::readHeader ( const std::string &  filename,
EcalCondHeader header 
)

read header from any xml file, return -1 in case of error

Definition at line 215 of file DOMHelperFunctions.cc.

References gather_cfg::cout, geometryXMLtoCSV::parser, readHeader(), cms::concurrency::xercesInitialize(), and cms::concurrency::xercesTerminate().

215  {
216 
218 
219  XercesDOMParser* parser = new XercesDOMParser;
220  parser->setValidationScheme( XercesDOMParser::Val_Never );
221  parser->setDoNamespaces( false );
222  parser->setDoSchema( false );
223 
224  parser->parse(filename.c_str());
225 
226  DOMDocument* xmlDoc = parser->getDocument();
227 
228 
229  if (!xmlDoc) {
230  std::cout << "Error parsing document" << std::endl;
231  return -1;
232  }
233 
234  DOMElement* elementRoot = xmlDoc->getDocumentElement();
235 
236  xuti::readHeader(elementRoot, header);
237 
238  delete parser;
240 
241  return 0;
242 }
void xercesTerminate()
Definition: Xerces.cc:22
void xercesInitialize()
Definition: Xerces.cc:17
void readHeader(xercesc::DOMNode *parentNode, EcalCondHeader &header)
read header from
tuple filename
Definition: lut2db_cfg.py:20
tuple cout
Definition: gather_cfg.py:121
const std::string xuti::rms12_tag ( "rms_x12"  )
const std::string xuti::rms1_tag ( "rms_x1"  )
const std::string xuti::rms6_tag ( "rms_x6"  )
const std::string xuti::row_tag ( "row"  )
const std::string xuti::subdet_tag ( "SubDet"  )
const std::string xuti::Theta_tag ( "Theta"  )
const std::string xuti::TimeOffsetConstant_tag ( "EcalTimeOffsetConstant"  )
std::string xuti::toNative ( const XMLCh *  str)
inline

Definition at line 42 of file XercesString.h.

References AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by EcalAlignmentXMLTranslator::dumpXML(), ESGainXMLTranslator::dumpXML(), EcalTPGCrystalStatusXMLTranslator::dumpXML(), EcalTimeBiasCorrectionsXMLTranslator::dumpXML(), EcalClusterCrackCorrXMLTranslator::dumpXML(), EcalClusterEnergyCorrectionObjectSpecificXMLTranslator::dumpXML(), EcalClusterEnergyCorrectionXMLTranslator::dumpXML(), EcalClusterLocalContCorrXMLTranslator::dumpXML(), EcalTBWeightsXMLTranslator::dumpXML(), EcalTPGStripStatusXMLTranslator::dumpXML(), EcalTPGTowerStatusXMLTranslator::dumpXML(), EcalPedestalsXMLTranslator::dumpXML(), EcalDCSTowerStatusXMLTranslator::dumpXML(), EcalDAQTowerStatusXMLTranslator::dumpXML(), EcalADCToGeVXMLTranslator::dumpXML(), EcalTimeOffsetXMLTranslator::dumpXML(), EcalTPGLinearizationConstXMLTranslator::dumpXML(), EcalChannelStatusXMLTranslator::dumpXML(), EcalGainRatiosXMLTranslator::dumpXML(), EcalWeightGroupXMLTranslator::dumpXML(), EcalFloatCondObjectContainerXMLTranslator::dumpXML(), EcalLinearCorrectionsXMLTranslator::dumpXML(), EcalWeightSetXMLTranslator::dumpXML(), EcalLaserAPDPNRatiosXMLTranslator::dumpXML(), GetNodeData(), GetNodeStringData(), popcon::EcalSRPHandler::importDccConfigFile(), readCellId(), EcalTBWeightsXMLTranslator::readWeightSet(), EcalWeightSetXMLTranslator::readXML(), toNative(), EcalWeightSetXMLTranslator::write10x10(), and EcalWeightSetXMLTranslator::write3x10().

42  {
43  boost::scoped_array<char> ptr(xercesc::XMLString::transcode(str));
44  return std::string(ptr.get( ));
45  }
std::string xuti::toNative ( const XercesString &  str)
inline

Definition at line 48 of file XercesString.h.

References toNative().

48  {
49  return toNative(str.c_str( ));
50  }
std::string toNative(const XMLCh *str)
Definition: XercesString.h:42
const std::string xuti::TPGCrystalStatus_tag ( "EcalTPGCrystalStatus"  )
const std::string xuti::TPGStripStatus_tag ( "EcalTPGStripStatus"  )
const std::string xuti::TPGTowerStatus_tag ( "EcalTPGTowerStatus"  )
const std::string xuti::Value_tag ( "Value"  )
const std::string xuti::WeightGroup_tag ( "EcalWeightGroup"  )
const std::string xuti::WeightGroups_tag ( "EcalWeightGroups"  )
const std::string xuti::wgtAfterSwitch_tag ( "WeightAfterSwitch"  )
const std::string xuti::wgtBeforeSwitch_tag ( "WeightBeforeSwitch"  )
const std::string xuti::wgtChi2AfterSwitch_tag ( "Chi2WeightAfterSwitch"  )
const std::string xuti::wgtChi2BeforeSwitch_tag ( "Chi2WeightBeforeSwitch"  )
DOMElement * xuti::writeCell ( xercesc::DOMNode *  node,
const DetId detid 
)

Append a Cell node with attributes to.

Parameters
node

Definition at line 72 of file DOMHelperFunctions.cc.

References Cell_tag(), EcalBarrel, EcalEndcap, EcalTriggerTower, fromNative(), EcalTrigTowerDetId::ieta(), EBDetId::ieta(), iEta_tag(), EBDetId::iphi(), EcalTrigTowerDetId::iphi(), iPhi_tag(), EcalScDetId::ix(), EEDetId::ix(), ix_tag(), ixSC_tag(), EcalScDetId::iy(), EEDetId::iy(), iy_tag(), iySC_tag(), DetId::rawId(), DetId::subdetId(), EcalScDetId::zside(), EEDetId::zside(), and zside_tag().

Referenced by EcalTPGCrystalStatusXMLTranslator::dumpXML(), EcalTPGTowerStatusXMLTranslator::dumpXML(), EcalPedestalsXMLTranslator::dumpXML(), EcalDAQTowerStatusXMLTranslator::dumpXML(), EcalDCSTowerStatusXMLTranslator::dumpXML(), EcalChannelStatusXMLTranslator::dumpXML(), EcalTPGLinearizationConstXMLTranslator::dumpXML(), EcalGainRatiosXMLTranslator::dumpXML(), EcalFloatCondObjectContainerXMLTranslator::dumpXML(), EcalWeightGroupXMLTranslator::dumpXML(), EcalLinearCorrectionsXMLTranslator::dumpXML(), and EcalLaserAPDPNRatiosXMLTranslator::dumpXML().

73  {
74 
75  DOMElement* cell_node =
76  node->getOwnerDocument()->createElement( fromNative(Cell_tag).c_str());
77 
78  node->appendChild(cell_node);
79 
80  if (detid.subdetId() == EcalBarrel ){
81 
82  stringstream value_s;
83  value_s <<EBDetId(detid).ieta() ;
84 
85  cell_node->setAttribute(fromNative(iEta_tag).c_str(),
86  fromNative(value_s.str()).c_str());
87  value_s.str("");
88  value_s <<EBDetId(detid).iphi() ;
89 
90  cell_node->setAttribute(fromNative(iPhi_tag).c_str(),
91  fromNative(value_s.str()).c_str());
92 
93  } else if (detid.subdetId() == EcalEndcap){
94 
95  // is it a EcalScDetId ?
96  unsigned int ScIdCheck = detid.rawId() & 0x00008000;
97  if (ScIdCheck == 0) {
98  stringstream value_s;
99  value_s <<EEDetId(detid).ix() ;
100 
101  cell_node->setAttribute(fromNative(ix_tag).c_str(),
102  fromNative(value_s.str()).c_str());
103  value_s.str("");
104  value_s <<EEDetId(detid).iy() ;
105 
106  cell_node->setAttribute(fromNative(iy_tag).c_str(),
107  fromNative(value_s.str()).c_str());
108  value_s.str("");
109  value_s <<EEDetId(detid).zside() ;
110 
111  cell_node->setAttribute(fromNative(zside_tag).c_str(),
112  fromNative(value_s.str()).c_str());
113  }
114  else {
115  stringstream value_s;
116  value_s << EcalScDetId(detid).ix() ;
117 
118  cell_node->setAttribute(fromNative(ixSC_tag).c_str(),
119  fromNative(value_s.str()).c_str());
120  value_s.str("");
121  value_s << EcalScDetId(detid).iy() ;
122 
123  cell_node->setAttribute(fromNative(iySC_tag).c_str(),
124  fromNative(value_s.str()).c_str());
125  value_s.str("");
126  value_s << EcalScDetId(detid).zside() ;
127 
128  cell_node->setAttribute(fromNative(zside_tag).c_str(),
129  fromNative(value_s.str()).c_str());
130  }
131 
132  } else if (detid.subdetId() == EcalTriggerTower ){
133  stringstream value_s;
134  value_s <<EcalTrigTowerDetId(detid).ieta() ;
135 
136  cell_node->setAttribute(fromNative(iEta_tag).c_str(),
137  fromNative(value_s.str()).c_str());
138  value_s.str("");
139  value_s <<EcalTrigTowerDetId(detid).iphi() ;
140 
141  cell_node->setAttribute(fromNative(iPhi_tag).c_str(),
142  fromNative(value_s.str()).c_str());
143  }
144  return cell_node;
145 }
int ix() const
Definition: EEDetId.h:76
const std::string iySC_tag("iySC")
const std::string iEta_tag("iEta")
tuple node
Definition: Node.py:50
int ieta() const
get the tower ieta
int iphi() const
get the crystal iphi
Definition: EBDetId.h:53
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
int ix() const
Definition: EcalScDetId.h:71
const std::string Cell_tag("cell")
const std::string ix_tag("ix")
int zside() const
Definition: EEDetId.h:70
int iy() const
Definition: EEDetId.h:82
int ieta() const
get the crystal ieta
Definition: EBDetId.h:51
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
int iy() const
Definition: EcalScDetId.h:77
const std::string iy_tag("iy")
int iphi() const
get the tower iphi
const std::string zside_tag("zside")
int zside() const
Definition: EcalScDetId.h:65
XercesString fromNative(const char *str)
Definition: XercesString.h:31
const std::string ixSC_tag("ixSC")
const std::string iPhi_tag("iPhi")
void xuti::writeHeader ( xercesc::DOMNode *  parentNode,
const EcalCondHeader header 
)

write

Parameters
headerunder
parentNode

Definition at line 169 of file DOMHelperFunctions.cc.

References EcalCondHeader::datasource_, EcalCondHeader::date_, fromNative(), Header_datasourcetag(), Header_datetag(), Header_methodtag(), Header_sincetag(), Header_tag(), Header_tagtag(), Header_versiontag(), EcalCondHeader::method_, EcalCondHeader::since_, EcalCondHeader::tag_, EcalCondHeader::version_, and WriteNodeWithValue().

Referenced by EcalAlignmentXMLTranslator::dumpXML(), EcalTPGCrystalStatusXMLTranslator::dumpXML(), ESGainXMLTranslator::dumpXML(), EcalTimeBiasCorrectionsXMLTranslator::dumpXML(), EcalClusterCrackCorrXMLTranslator::dumpXML(), EcalClusterEnergyCorrectionObjectSpecificXMLTranslator::dumpXML(), EcalClusterEnergyCorrectionXMLTranslator::dumpXML(), EcalClusterLocalContCorrXMLTranslator::dumpXML(), EcalTPGTowerStatusXMLTranslator::dumpXML(), EcalTPGStripStatusXMLTranslator::dumpXML(), EcalTBWeightsXMLTranslator::dumpXML(), EcalDAQTowerStatusXMLTranslator::dumpXML(), EcalDCSTowerStatusXMLTranslator::dumpXML(), EcalPedestalsXMLTranslator::dumpXML(), EcalADCToGeVXMLTranslator::dumpXML(), EcalTimeOffsetXMLTranslator::dumpXML(), EcalChannelStatusXMLTranslator::dumpXML(), EcalTPGLinearizationConstXMLTranslator::dumpXML(), EcalGainRatiosXMLTranslator::dumpXML(), EcalWeightGroupXMLTranslator::dumpXML(), EcalFloatCondObjectContainerXMLTranslator::dumpXML(), EcalLinearCorrectionsXMLTranslator::dumpXML(), EcalWeightSetXMLTranslator::dumpXML(), and EcalLaserAPDPNRatiosXMLTranslator::dumpXML().

170  {
171 
172 
173 
174  DOMElement* headernode =
175  parentNode->getOwnerDocument()->createElement( fromNative(Header_tag).c_str());
176  parentNode->appendChild(headernode);
177 
178  // write the actual header
179  WriteNodeWithValue(headernode, Header_methodtag, header.method_);
180  WriteNodeWithValue(headernode, Header_versiontag, header.version_);
182  WriteNodeWithValue(headernode, Header_sincetag, header.since_);
183  WriteNodeWithValue(headernode, Header_tagtag, header.tag_);
184  WriteNodeWithValue(headernode, Header_datetag, header.date_);
185 
186 }
std::string datasource_
cond::Time_t since_
std::string date_
const std::string Header_sincetag("since")
std::string version_
void WriteNodeWithValue(xercesc::DOMNode *parentNode, const std::string &tag, const T &value)
write a node with
const std::string Header_methodtag("method")
const std::string Header_datetag("date")
std::string tag_
const std::string Header_tagtag("tag")
const std::string Header_versiontag("version")
const std::string Header_tag("EcalCondHeader")
std::string method_
const std::string Header_datasourcetag("datasource")
XercesString fromNative(const char *str)
Definition: XercesString.h:31
template<class T >
void xuti::WriteNodeWithValue ( xercesc::DOMNode *  parentNode,
const std::string &  tag,
const T value 
)

write a node with

Parameters
tagand
valueunder
parentNode

Definition at line 52 of file DOMHelperFunctions.h.

References asciidump::doc, fromNative(), and relativeConstraints::value.

Referenced by EcalAlignmentXMLTranslator::dumpXML(), EcalTPGCrystalStatusXMLTranslator::dumpXML(), ESGainXMLTranslator::dumpXML(), EcalTimeBiasCorrectionsXMLTranslator::dumpXML(), EcalClusterCrackCorrXMLTranslator::dumpXML(), EcalClusterLocalContCorrXMLTranslator::dumpXML(), EcalClusterEnergyCorrectionObjectSpecificXMLTranslator::dumpXML(), EcalClusterEnergyCorrectionXMLTranslator::dumpXML(), EcalTBWeightsXMLTranslator::dumpXML(), EcalTPGStripStatusXMLTranslator::dumpXML(), EcalTPGTowerStatusXMLTranslator::dumpXML(), EcalDAQTowerStatusXMLTranslator::dumpXML(), EcalDCSTowerStatusXMLTranslator::dumpXML(), EcalPedestalsXMLTranslator::dumpXML(), EcalChannelStatusXMLTranslator::dumpXML(), EcalTPGLinearizationConstXMLTranslator::dumpXML(), EcalADCToGeVXMLTranslator::dumpXML(), EcalTimeOffsetXMLTranslator::dumpXML(), EcalGainRatiosXMLTranslator::dumpXML(), EcalFloatCondObjectContainerXMLTranslator::dumpXML(), EcalWeightGroupXMLTranslator::dumpXML(), EcalLinearCorrectionsXMLTranslator::dumpXML(), EcalLaserAPDPNRatiosXMLTranslator::dumpXML(), and writeHeader().

55  {
56 
57  xercesc::DOMDocument * doc = parentNode->getOwnerDocument();
58  xercesc::DOMElement* new_node = doc->createElement(fromNative(tag).c_str());
59  parentNode->appendChild(new_node);
60 
61  std::stringstream value_ss;
62  value_ss <<value;
63 
64  xercesc::DOMText* tvalue =
65  doc->createTextNode(fromNative(value_ss.str()).c_str());
66  new_node->appendChild(tvalue);
67 
68  }
tuple doc
Definition: asciidump.py:381
XercesString fromNative(const char *str)
Definition: XercesString.h:31
const std::string xuti::x_tag ( "x"  )
const std::string xuti::y_tag ( "y"  )
const std::string xuti::z_tag ( "z"  )
const std::string xuti::zside_tag ( "zside"  )

Referenced by readCellId(), and writeCell().