CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
XMLDocument Class Reference

Public Member Functions

template<class T >
void addAttribute (DOMElement *fElement, const std::string &fName, const T &fValue)
 
void addData (DOMElement *fData, const HcalPedestal &fItem)
 
void addData (DOMElement *fData, const HcalPedestalWidth &fItem)
 
void addData (DOMElement *fData, const HcalGain &fItem)
 
void addData (DOMElement *fData, const HcalRawGain &fItem)
 
void addData (DOMElement *fData, const HcalGainWidth &fItem)
 
const DOMDocument * document ()
 
DOMElement * makeChId (DOMElement *fDataset, DetId fId)
 
DOMElement * makeData (DOMElement *fDataset, const HcalPedestal &fPed, const HcalPedestalWidth &fWidth)
 
DOMElement * makeData (DOMElement *fDataset)
 
DOMElement * makeDataset (DOMElement *fRoot, const std::string &fVersion)
 
DOMElement * makeElement (DOMElement *fRoot)
 
DOMElement * makeElementDataset (DOMElement *fElement, int fXMLId, DetId fDetId, const std::string &fVersion, const std::string &fKind, unsigned long fRun)
 
DOMElement * makeElementIOV (DOMElement *fElement, unsigned long long fIovBegin, unsigned long long fIovEnd=0)
 
DOMElement * makeElementTag (DOMElement *fElement, const std::string &fTagName, const std::string &fDetectorName, const std::string &fComment="Automatically created by HcalDbXml")
 
DOMElement * makeHeader (DOMElement *fRoot, const std::string &fExtensionName, unsigned long fRun)
 
DOMElement * makeMapDataset (DOMElement *fIov, int fXMLId)
 
DOMElement * makeMapIOV (DOMElement *fTag)
 
DOMElement * makeMaps (DOMElement *fRoot)
 
DOMElement * makeMapTag (DOMElement *fMap)
 
DOMElement * makeRun (DOMElement *fHeader, unsigned long fRun)
 
DOMElement * makeType (DOMElement *fHeader, const std::string &fExtensionName)
 
template<class T >
DOMElement * newElement (DOMElement *fParent, const T &fName)
 
template<class T >
DOMElement * newValue (DOMElement *fParent, const std::string &fName, const T &fValue)
 
DOMElement * root ()
 
void streamOut (std::ostream &fOut)
 
 XMLDocument ()
 

Private Attributes

DOMDocument * mDoc
 
DOMImplementation * mDom
 

Detailed Description

Definition at line 60 of file HcalDbXml.cc.

Constructor & Destructor Documentation

XMLDocument::XMLDocument ( )

Definition at line 114 of file HcalDbXml.cc.

References mDoc, mDom, and cms::concurrency::xercesInitialize().

114  : mDoc(nullptr) {
116  mDom = DOMImplementationRegistry::getDOMImplementation(transcode("Core"));
117  mDoc = mDom->createDocument(nullptr, // root element namespace URI.
118  transcode("ROOT"), // root element name
119  nullptr); // document type object (DTD).
120 }
void xercesInitialize()
Definition: Xerces.cc:18
DOMImplementation * mDom
Definition: HcalDbXml.cc:110
DOMDocument * mDoc
Definition: HcalDbXml.cc:111

Member Function Documentation

template<class T >
void XMLDocument::addAttribute ( DOMElement *  fElement,
const std::string &  fName,
const T fValue 
)

Definition at line 138 of file HcalDbXml.cc.

Referenced by makeElementDataset(), makeElementIOV(), makeElementTag(), makeMapDataset(), makeMapIOV(), and makeMapTag().

138  {
139  fElement->setAttribute(transcode(fName), transcode(fValue));
140 }
void XMLDocument::addData ( DOMElement *  fData,
const HcalPedestal fItem 
)

Definition at line 255 of file HcalDbXml.cc.

References HcalPedestal::getValue(), and newValue().

Referenced by dumpObject_().

255  {
256  newValue(fData, "CAPACITOR_0_VALUE", fItem.getValue(0));
257  newValue(fData, "CAPACITOR_1_VALUE", fItem.getValue(1));
258  newValue(fData, "CAPACITOR_2_VALUE", fItem.getValue(2));
259  newValue(fData, "CAPACITOR_3_VALUE", fItem.getValue(3));
260 }
float getValue(int fCapId) const
get value for capId = 0..3
Definition: HcalPedestal.h:20
DOMElement * newValue(DOMElement *fParent, const std::string &fName, const T &fValue)
Definition: HcalDbXml.cc:130
void XMLDocument::addData ( DOMElement *  fData,
const HcalPedestalWidth fItem 
)

Definition at line 262 of file HcalDbXml.cc.

References HcalPedestalWidth::getSigma(), and newValue().

262  {
263  // widths
264  newValue(fData, "SIGMA_0_0", fItem.getSigma(0, 0));
265  newValue(fData, "SIGMA_1_1", fItem.getSigma(1, 1));
266  newValue(fData, "SIGMA_2_2", fItem.getSigma(2, 2));
267  newValue(fData, "SIGMA_3_3", fItem.getSigma(3, 3));
268  newValue(fData, "SIGMA_0_1", fItem.getSigma(0, 1));
269  newValue(fData, "SIGMA_0_2", fItem.getSigma(0, 2));
270  newValue(fData, "SIGMA_0_3", fItem.getSigma(0, 3));
271  newValue(fData, "SIGMA_1_2", fItem.getSigma(1, 2));
272  newValue(fData, "SIGMA_1_3", fItem.getSigma(1, 3));
273  newValue(fData, "SIGMA_2_3", fItem.getSigma(2, 3));
274 }
float getSigma(int fCapId1, int fCapId2) const
get correlation element for capId1/2 = 0..3
DOMElement * newValue(DOMElement *fParent, const std::string &fName, const T &fValue)
Definition: HcalDbXml.cc:130
void XMLDocument::addData ( DOMElement *  fData,
const HcalGain fItem 
)

Definition at line 276 of file HcalDbXml.cc.

References HcalGain::getValue(), and newValue().

276  {
277  newValue(fData, "CAPACITOR_0_VALUE", fItem.getValue(0));
278  newValue(fData, "CAPACITOR_1_VALUE", fItem.getValue(1));
279  newValue(fData, "CAPACITOR_2_VALUE", fItem.getValue(2));
280  newValue(fData, "CAPACITOR_3_VALUE", fItem.getValue(3));
281 }
float getValue(int fCapId) const
get value for capId = 0..3
Definition: HcalGain.h:21
DOMElement * newValue(DOMElement *fParent, const std::string &fName, const T &fValue)
Definition: HcalDbXml.cc:130
void XMLDocument::addData ( DOMElement *  fData,
const HcalRawGain fItem 
)

Definition at line 283 of file HcalDbXml.cc.

References HcalRawGain::getError(), HcalRawGain::getValue(), HcalRawGain::getVoltage(), newValue(), and HcalRawGain::strStatus().

283  {
284  newValue(fData, "VALUE", fItem.getValue());
285  newValue(fData, "ERROR", fItem.getError());
286  newValue(fData, "VOLTAGE", fItem.getVoltage());
287  newValue(fData, "STATUS", fItem.strStatus());
288 }
std::string strStatus() const
Definition: HcalRawGain.h:22
float getValue() const
Definition: HcalRawGain.h:18
float getError() const
Definition: HcalRawGain.h:19
float getVoltage() const
Definition: HcalRawGain.h:20
DOMElement * newValue(DOMElement *fParent, const std::string &fName, const T &fValue)
Definition: HcalDbXml.cc:130
void XMLDocument::addData ( DOMElement *  fData,
const HcalGainWidth fItem 
)

Definition at line 290 of file HcalDbXml.cc.

References HcalGainWidth::getValue(), and newValue().

290  {
291  newValue(fData, "CAPACITOR_0_ERROR", fItem.getValue(0));
292  newValue(fData, "CAPACITOR_1_ERROR", fItem.getValue(1));
293  newValue(fData, "CAPACITOR_2_ERROR", fItem.getValue(2));
294  newValue(fData, "CAPACITOR_3_ERROR", fItem.getValue(3));
295 }
float getValue(int fCapId) const
get value for capId = 0..3
Definition: HcalGainWidth.h:20
DOMElement * newValue(DOMElement *fParent, const std::string &fName, const T &fValue)
Definition: HcalDbXml.cc:130
const DOMDocument * XMLDocument::document ( )

Definition at line 318 of file HcalDbXml.cc.

References mDoc.

318 { return mDoc; }
DOMDocument * mDoc
Definition: HcalDbXml.cc:111
DOMElement * XMLDocument::makeChId ( DOMElement *  fDataset,
DetId  fId 
)

Definition at line 171 of file HcalDbXml.cc.

References funct::abs(), PVValHelper::eta, HcalText2DetIdConverter::getField(), HcalText2DetIdConverter::getField2(), HcalText2DetIdConverter::getField3(), HcalText2DetIdConverter::getFlavor(), newElement(), newValue(), writedatasetfile::parser, and DetId::rawId().

Referenced by dumpObject_(), and makeElementDataset().

171  {
172  DOMElement* channel = newElement(fDataset, "CHANNEL");
173  newValue(channel, "EXTENSION_TABLE_NAME", "HCAL_CHANNELS");
175  newValue(channel, "DETECTOR_NAME", parser.getFlavor());
176  int eta = parser.getField(1);
177  newValue(channel, "ETA", abs(eta));
178  newValue(channel, "Z", eta > 0 ? 1 : -1);
179  newValue(channel, "PHI", parser.getField2());
180  newValue(channel, "DEPTH", parser.getField3());
181  newValue(channel, "HCAL_CHANNEL_ID", fId.rawId());
182  return channel;
183 }
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
DOMElement * newElement(DOMElement *fParent, const T &fName)
Definition: HcalDbXml.cc:123
DOMElement * newValue(DOMElement *fParent, const std::string &fName, const T &fValue)
Definition: HcalDbXml.cc:130
DOMElement * XMLDocument::makeData ( DOMElement *  fDataset,
const HcalPedestal fPed,
const HcalPedestalWidth fWidth 
)

Definition at line 297 of file HcalDbXml.cc.

References data, HcalPedestalWidth::getSigma(), HcalPedestal::getValue(), newElement(), and newValue().

Referenced by dumpObject_().

297  {
298  DOMElement* data = newElement(fDataset, "DATA");
299  // pedestals
300  newValue(data, "CAPACITOR_0_VALUE", fPed.getValue(0));
301  newValue(data, "CAPACITOR_1_VALUE", fPed.getValue(1));
302  newValue(data, "CAPACITOR_2_VALUE", fPed.getValue(2));
303  newValue(data, "CAPACITOR_3_VALUE", fPed.getValue(3));
304  // widths
305  newValue(data, "SIGMA_0_0", fWidth.getSigma(0, 0));
306  newValue(data, "SIGMA_1_1", fWidth.getSigma(1, 1));
307  newValue(data, "SIGMA_2_2", fWidth.getSigma(2, 2));
308  newValue(data, "SIGMA_3_3", fWidth.getSigma(3, 3));
309  newValue(data, "SIGMA_0_1", fWidth.getSigma(0, 1));
310  newValue(data, "SIGMA_0_2", fWidth.getSigma(0, 2));
311  newValue(data, "SIGMA_0_3", fWidth.getSigma(0, 3));
312  newValue(data, "SIGMA_1_2", fWidth.getSigma(1, 2));
313  newValue(data, "SIGMA_1_3", fWidth.getSigma(1, 3));
314  newValue(data, "SIGMA_2_3", fWidth.getSigma(2, 3));
315  return data;
316 }
float getSigma(int fCapId1, int fCapId2) const
get correlation element for capId1/2 = 0..3
float getValue(int fCapId) const
get value for capId = 0..3
Definition: HcalPedestal.h:20
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
DOMElement * newElement(DOMElement *fParent, const T &fName)
Definition: HcalDbXml.cc:123
DOMElement * newValue(DOMElement *fParent, const std::string &fName, const T &fValue)
Definition: HcalDbXml.cc:130
DOMElement * XMLDocument::makeData ( DOMElement *  fDataset)

Definition at line 253 of file HcalDbXml.cc.

References newElement().

253 { return newElement(fDataset, "DATA"); }
DOMElement * newElement(DOMElement *fParent, const T &fName)
Definition: HcalDbXml.cc:123
DOMElement * XMLDocument::makeDataset ( DOMElement *  fRoot,
const std::string &  fVersion 
)

Definition at line 165 of file HcalDbXml.cc.

References writedatasetfile::dataset, newElement(), and newValue().

Referenced by dumpObject_().

165  {
166  DOMElement* dataset = newElement(fRoot, "DATA_SET");
167  newValue(dataset, "VERSION", fVersion);
168  return dataset;
169 }
DOMElement * newElement(DOMElement *fParent, const T &fName)
Definition: HcalDbXml.cc:123
DOMElement * newValue(DOMElement *fParent, const std::string &fName, const T &fValue)
Definition: HcalDbXml.cc:130
DOMElement * XMLDocument::makeElement ( DOMElement *  fRoot)

Definition at line 225 of file HcalDbXml.cc.

References newElement().

Referenced by dumpObject_().

225  {
226  DOMElement* element = newElement(fRoot, "ELEMENTS");
227  return element;
228 }
DOMElement * newElement(DOMElement *fParent, const T &fName)
Definition: HcalDbXml.cc:123
DOMElement * XMLDocument::makeElementDataset ( DOMElement *  fElement,
int  fXMLId,
DetId  fDetId,
const std::string &  fVersion,
const std::string &  fKind,
unsigned long  fRun 
)

Definition at line 185 of file HcalDbXml.cc.

References addAttribute(), writedatasetfile::dataset, makeChId(), makeRun(), newElement(), and newValue().

Referenced by dumpObject_().

190  {
191  DOMElement* dataset = newElement(fElement, "DATA_SET");
192  addAttribute(dataset, "id", fXMLId);
193  newValue(newElement(dataset, "KIND_OF_CONDITION"), "NAME", fKind);
194  newValue(dataset, "VERSION", fVersion);
195  makeRun(dataset, fRun);
196  makeChId(dataset, fDetId);
197  return dataset;
198 }
void addAttribute(DOMElement *fElement, const std::string &fName, const T &fValue)
Definition: HcalDbXml.cc:138
DOMElement * makeRun(DOMElement *fHeader, unsigned long fRun)
Definition: HcalDbXml.cc:158
DOMElement * makeChId(DOMElement *fDataset, DetId fId)
Definition: HcalDbXml.cc:171
DOMElement * newElement(DOMElement *fParent, const T &fName)
Definition: HcalDbXml.cc:123
DOMElement * newValue(DOMElement *fParent, const std::string &fName, const T &fValue)
Definition: HcalDbXml.cc:130
DOMElement * XMLDocument::makeElementIOV ( DOMElement *  fElement,
unsigned long long  fIovBegin,
unsigned long long  fIovEnd = 0 
)

Definition at line 200 of file HcalDbXml.cc.

References addAttribute(), newElement(), and newValue().

Referenced by dumpObject_().

202  {
203  DOMElement* iov = newElement(fElement, "IOV");
204  addAttribute(iov, "id", IOV_ID);
205  newValue(iov, "INTERVAL_OF_VALIDITY_BEGIN", fIovBegin);
206  if (fIovEnd) {
207  newValue(iov, "INTERVAL_OF_VALIDITY_END", fIovEnd);
208  }
209  return iov;
210 }
void addAttribute(DOMElement *fElement, const std::string &fName, const T &fValue)
Definition: HcalDbXml.cc:138
DOMElement * newElement(DOMElement *fParent, const T &fName)
Definition: HcalDbXml.cc:123
DOMElement * newValue(DOMElement *fParent, const std::string &fName, const T &fValue)
Definition: HcalDbXml.cc:130
DOMElement * XMLDocument::makeElementTag ( DOMElement *  fElement,
const std::string &  fTagName,
const std::string &  fDetectorName,
const std::string &  fComment = "Automatically created by HcalDbXml" 
)

Definition at line 212 of file HcalDbXml.cc.

References addAttribute(), newElement(), newValue(), and GlobalPosition_Frontier_DevDB_cff::tag.

Referenced by dumpObject_().

215  {
216  DOMElement* tag = newElement(fElement, "TAG");
217  addAttribute(tag, "id", TAG_ID);
218  addAttribute(tag, "mode", "create");
219  newValue(tag, "TAG_NAME", fTagName);
220  newValue(tag, "DETECTOR_NAME", fDetectorName);
221  newValue(tag, "COMMENT_DESCRIPTION", fComment);
222  return tag;
223 }
void addAttribute(DOMElement *fElement, const std::string &fName, const T &fValue)
Definition: HcalDbXml.cc:138
DOMElement * newElement(DOMElement *fParent, const T &fName)
Definition: HcalDbXml.cc:123
DOMElement * newValue(DOMElement *fParent, const std::string &fName, const T &fValue)
Definition: HcalDbXml.cc:130
DOMElement * XMLDocument::makeHeader ( DOMElement *  fRoot,
const std::string &  fExtensionName,
unsigned long  fRun 
)

Definition at line 144 of file HcalDbXml.cc.

References RecoTauValidation_cfi::header, makeRun(), makeType(), and newElement().

Referenced by dumpObject_().

144  {
145  DOMElement* header = newElement(fRoot, "HEADER");
146  makeType(header, fExtensionName);
147  makeRun(header, fRun);
148  return header;
149 }
DOMElement * makeRun(DOMElement *fHeader, unsigned long fRun)
Definition: HcalDbXml.cc:158
DOMElement * makeType(DOMElement *fHeader, const std::string &fExtensionName)
Definition: HcalDbXml.cc:151
DOMElement * newElement(DOMElement *fParent, const T &fName)
Definition: HcalDbXml.cc:123
DOMElement * XMLDocument::makeMapDataset ( DOMElement *  fIov,
int  fXMLId 
)

Definition at line 247 of file HcalDbXml.cc.

References addAttribute(), and newElement().

Referenced by dumpObject_().

247  {
248  DOMElement* element = newElement(fIov, "DATA_SET");
249  addAttribute(element, "idref", fXMLId);
250  return element;
251 }
void addAttribute(DOMElement *fElement, const std::string &fName, const T &fValue)
Definition: HcalDbXml.cc:138
DOMElement * newElement(DOMElement *fParent, const T &fName)
Definition: HcalDbXml.cc:123
DOMElement * XMLDocument::makeMapIOV ( DOMElement *  fTag)

Definition at line 241 of file HcalDbXml.cc.

References addAttribute(), and newElement().

Referenced by dumpObject_().

241  {
242  DOMElement* iov = newElement(fTag, "IOV");
243  addAttribute(iov, "idref", IOV_ID);
244  return iov;
245 }
void addAttribute(DOMElement *fElement, const std::string &fName, const T &fValue)
Definition: HcalDbXml.cc:138
DOMElement * newElement(DOMElement *fParent, const T &fName)
Definition: HcalDbXml.cc:123
DOMElement * XMLDocument::makeMaps ( DOMElement *  fRoot)

Definition at line 230 of file HcalDbXml.cc.

References genParticles_cff::map, and newElement().

Referenced by dumpObject_().

230  {
231  DOMElement* map = newElement(fRoot, "MAPS");
232  return map;
233 }
DOMElement * newElement(DOMElement *fParent, const T &fName)
Definition: HcalDbXml.cc:123
DOMElement * XMLDocument::makeMapTag ( DOMElement *  fMap)

Definition at line 235 of file HcalDbXml.cc.

References addAttribute(), newElement(), and GlobalPosition_Frontier_DevDB_cff::tag.

Referenced by dumpObject_().

235  {
236  DOMElement* tag = newElement(fMap, "TAG");
237  addAttribute(tag, "idref", TAG_ID);
238  return tag;
239 }
void addAttribute(DOMElement *fElement, const std::string &fName, const T &fValue)
Definition: HcalDbXml.cc:138
DOMElement * newElement(DOMElement *fParent, const T &fName)
Definition: HcalDbXml.cc:123
DOMElement * XMLDocument::makeRun ( DOMElement *  fHeader,
unsigned long  fRun 
)

Definition at line 158 of file HcalDbXml.cc.

References newElement(), newValue(), and writedatasetfile::run.

Referenced by makeElementDataset(), and makeHeader().

158  {
159  DOMElement* run = newElement(fHeader, "RUN");
160  newValue(run, "RUN_TYPE", "HcalDbXml");
161  newValue(run, "RUN_NUMBER", fRun);
162  return run;
163 }
DOMElement * newElement(DOMElement *fParent, const T &fName)
Definition: HcalDbXml.cc:123
DOMElement * newValue(DOMElement *fParent, const std::string &fName, const T &fValue)
Definition: HcalDbXml.cc:130
DOMElement * XMLDocument::makeType ( DOMElement *  fHeader,
const std::string &  fExtensionName 
)

Definition at line 151 of file HcalDbXml.cc.

References newElement(), and newValue().

Referenced by makeHeader().

151  {
152  DOMElement* type = newElement(fHeader, "TYPE");
153  newValue(type, "EXTENSION_TABLE_NAME", extensionTableName(fKind));
154  newValue(type, "NAME", fKind);
155  return type;
156 }
type
Definition: HCALResponse.h:21
DOMElement * newElement(DOMElement *fParent, const T &fName)
Definition: HcalDbXml.cc:123
DOMElement * newValue(DOMElement *fParent, const std::string &fName, const T &fValue)
Definition: HcalDbXml.cc:130
template<class T >
DOMElement * XMLDocument::newElement ( DOMElement *  fParent,
const T fName 
)

Definition at line 123 of file HcalDbXml.cc.

References mDoc.

Referenced by makeChId(), makeData(), makeDataset(), makeElement(), makeElementDataset(), makeElementIOV(), makeElementTag(), makeHeader(), makeMapDataset(), makeMapIOV(), makeMaps(), makeMapTag(), makeRun(), makeType(), and newValue().

123  {
124  DOMElement* element = mDoc->createElement(transcode(fName));
125  fParent->appendChild(element);
126  return element;
127 }
DOMDocument * mDoc
Definition: HcalDbXml.cc:111
template<class T >
DOMElement * XMLDocument::newValue ( DOMElement *  fParent,
const std::string &  fName,
const T fValue 
)

Definition at line 130 of file HcalDbXml.cc.

References mDoc, newElement(), and runonSM::text.

Referenced by addData(), makeChId(), makeData(), makeDataset(), makeElementDataset(), makeElementIOV(), makeElementTag(), makeRun(), and makeType().

130  {
131  DOMElement* element = newElement(fParent, fName);
132  DOMText* text = mDoc->createTextNode(transcode(fValue));
133  element->appendChild(text);
134  return element;
135 }
DOMDocument * mDoc
Definition: HcalDbXml.cc:111
DOMElement * newElement(DOMElement *fParent, const T &fName)
Definition: HcalDbXml.cc:123
DOMElement * XMLDocument::root ( )

Definition at line 142 of file HcalDbXml.cc.

References mDoc.

Referenced by dumpObject_(), and streamOut().

142 { return mDoc->getDocumentElement(); }
DOMDocument * mDoc
Definition: HcalDbXml.cc:111
void XMLDocument::streamOut ( std::ostream &  fOut)

Definition at line 320 of file HcalDbXml.cc.

References mDoc, mDom, and root().

Referenced by dumpObject_().

320  {
321  StreamOutFormatTarget formTarget(fOut);
322  DOMLSSerializer* domWriter = mDom->createLSSerializer();
323  DOMConfiguration* dc = domWriter->getDomConfig();
324  dc->setParameter(XMLUni::fgDOMWRTFormatPrettyPrint, true);
325 
326  DOMLSOutput* outputDesc = ((DOMImplementationLS*)mDom)->createLSOutput();
327  outputDesc->setByteStream(&formTarget);
328 
329  domWriter->write(root(), outputDesc);
330  mDoc->release();
331 }
DOMImplementation * mDom
Definition: HcalDbXml.cc:110
DOMDocument * mDoc
Definition: HcalDbXml.cc:111
DOMElement * root()
Definition: HcalDbXml.cc:142

Member Data Documentation

DOMDocument* XMLDocument::mDoc
private

Definition at line 111 of file HcalDbXml.cc.

Referenced by document(), newElement(), newValue(), root(), streamOut(), and XMLDocument().

DOMImplementation* XMLDocument::mDom
private

Definition at line 110 of file HcalDbXml.cc.

Referenced by streamOut(), and XMLDocument().