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 HcalGain &fItem)
 
void addData (DOMElement *fData, const HcalGainWidth &fItem)
 
void addData (DOMElement *fData, const HcalPedestal &fItem)
 
void addData (DOMElement *fData, const HcalPedestalWidth &fItem)
 
void addData (DOMElement *fData, const HcalRawGain &fItem)
 
const DOMDocument * document ()
 
DOMElement * makeChId (DOMElement *fDataset, DetId fId)
 
DOMElement * makeData (DOMElement *fDataset)
 
DOMElement * makeData (DOMElement *fDataset, const HcalPedestal &fPed, const HcalPedestalWidth &fWidth)
 
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::XMLDocument ( )

Definition at line 114 of file HcalDbXml.cc.

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 }

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

Member Function Documentation

◆ addAttribute()

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

Definition at line 138 of file HcalDbXml.cc.

138  {
139  fElement->setAttribute(transcode(fName), transcode(fValue));
140 }

References MainPageGenerator::fName.

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

◆ addData() [1/5]

void XMLDocument::addData ( DOMElement *  fData,
const HcalGain fItem 
)

Definition at line 276 of file HcalDbXml.cc.

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 }

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

◆ addData() [2/5]

void XMLDocument::addData ( DOMElement *  fData,
const HcalGainWidth fItem 
)

Definition at line 290 of file HcalDbXml.cc.

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 }

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

◆ addData() [3/5]

void XMLDocument::addData ( DOMElement *  fData,
const HcalPedestal fItem 
)

Definition at line 255 of file HcalDbXml.cc.

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 }

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

◆ addData() [4/5]

void XMLDocument::addData ( DOMElement *  fData,
const HcalPedestalWidth fItem 
)

Definition at line 262 of file HcalDbXml.cc.

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 }

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

◆ addData() [5/5]

void XMLDocument::addData ( DOMElement *  fData,
const HcalRawGain fItem 
)

Definition at line 283 of file HcalDbXml.cc.

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 }

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

◆ document()

const DOMDocument * XMLDocument::document ( )

Definition at line 318 of file HcalDbXml.cc.

318 { return mDoc; }

References mDoc.

◆ makeChId()

DOMElement * XMLDocument::makeChId ( DOMElement *  fDataset,
DetId  fId 
)

Definition at line 171 of file HcalDbXml.cc.

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 }

References funct::abs(), PVValHelper::eta, newElement(), newValue(), writedatasetfile::parser, and DetId::rawId().

Referenced by makeElementDataset().

◆ makeData() [1/2]

DOMElement * XMLDocument::makeData ( DOMElement *  fDataset)

Definition at line 253 of file HcalDbXml.cc.

253 { return newElement(fDataset, "DATA"); }

References newElement().

◆ makeData() [2/2]

DOMElement * XMLDocument::makeData ( DOMElement *  fDataset,
const HcalPedestal fPed,
const HcalPedestalWidth fWidth 
)

Definition at line 297 of file HcalDbXml.cc.

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 }

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

◆ makeDataset()

DOMElement * XMLDocument::makeDataset ( DOMElement *  fRoot,
const std::string &  fVersion 
)

Definition at line 165 of file HcalDbXml.cc.

165  {
166  DOMElement* dataset = newElement(fRoot, "DATA_SET");
167  newValue(dataset, "VERSION", fVersion);
168  return dataset;
169 }

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

◆ makeElement()

DOMElement * XMLDocument::makeElement ( DOMElement *  fRoot)

Definition at line 225 of file HcalDbXml.cc.

225  {
226  DOMElement* element = newElement(fRoot, "ELEMENTS");
227  return element;
228 }

References newElement().

◆ makeElementDataset()

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.

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 }

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

◆ makeElementIOV()

DOMElement * XMLDocument::makeElementIOV ( DOMElement *  fElement,
unsigned long long  fIovBegin,
unsigned long long  fIovEnd = 0 
)

Definition at line 200 of file HcalDbXml.cc.

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 }

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

◆ makeElementTag()

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.

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 }

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

◆ makeHeader()

DOMElement * XMLDocument::makeHeader ( DOMElement *  fRoot,
const std::string &  fExtensionName,
unsigned long  fRun 
)

Definition at line 144 of file HcalDbXml.cc.

144  {
145  DOMElement* header = newElement(fRoot, "HEADER");
146  makeType(header, fExtensionName);
147  makeRun(header, fRun);
148  return header;
149 }

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

◆ makeMapDataset()

DOMElement * XMLDocument::makeMapDataset ( DOMElement *  fIov,
int  fXMLId 
)

Definition at line 247 of file HcalDbXml.cc.

247  {
248  DOMElement* element = newElement(fIov, "DATA_SET");
249  addAttribute(element, "idref", fXMLId);
250  return element;
251 }

References addAttribute(), and newElement().

◆ makeMapIOV()

DOMElement * XMLDocument::makeMapIOV ( DOMElement *  fTag)

Definition at line 241 of file HcalDbXml.cc.

241  {
242  DOMElement* iov = newElement(fTag, "IOV");
243  addAttribute(iov, "idref", IOV_ID);
244  return iov;
245 }

References addAttribute(), and newElement().

◆ makeMaps()

DOMElement * XMLDocument::makeMaps ( DOMElement *  fRoot)

Definition at line 230 of file HcalDbXml.cc.

230  {
231  DOMElement* map = newElement(fRoot, "MAPS");
232  return map;
233 }

References genParticles_cff::map, and newElement().

◆ makeMapTag()

DOMElement * XMLDocument::makeMapTag ( DOMElement *  fMap)

Definition at line 235 of file HcalDbXml.cc.

235  {
236  DOMElement* tag = newElement(fMap, "TAG");
237  addAttribute(tag, "idref", TAG_ID);
238  return tag;
239 }

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

◆ makeRun()

DOMElement * XMLDocument::makeRun ( DOMElement *  fHeader,
unsigned long  fRun 
)

Definition at line 158 of file HcalDbXml.cc.

158  {
159  DOMElement* run = newElement(fHeader, "RUN");
160  newValue(run, "RUN_TYPE", "HcalDbXml");
161  newValue(run, "RUN_NUMBER", fRun);
162  return run;
163 }

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

Referenced by makeElementDataset(), and makeHeader().

◆ makeType()

DOMElement * XMLDocument::makeType ( DOMElement *  fHeader,
const std::string &  fExtensionName 
)

Definition at line 151 of file HcalDbXml.cc.

151  {
152  DOMElement* type = newElement(fHeader, "TYPE");
153  newValue(type, "EXTENSION_TABLE_NAME", extensionTableName(fKind));
154  newValue(type, "NAME", fKind);
155  return type;
156 }

References newElement(), and newValue().

Referenced by makeHeader().

◆ newElement()

template<class T >
DOMElement * XMLDocument::newElement ( DOMElement *  fParent,
const T fName 
)

Definition at line 123 of file HcalDbXml.cc.

123  {
124  DOMElement* element = mDoc->createElement(transcode(fName));
125  fParent->appendChild(element);
126  return element;
127 }

References MainPageGenerator::fName, and mDoc.

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

◆ newValue()

template<class T >
DOMElement * XMLDocument::newValue ( DOMElement *  fParent,
const std::string &  fName,
const T fValue 
)

Definition at line 130 of file HcalDbXml.cc.

130  {
131  DOMElement* element = newElement(fParent, fName);
132  DOMText* text = mDoc->createTextNode(transcode(fValue));
133  element->appendChild(text);
134  return element;
135 }

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

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

◆ root()

DOMElement * XMLDocument::root ( )

Definition at line 142 of file HcalDbXml.cc.

142 { return mDoc->getDocumentElement(); }

References mDoc.

Referenced by streamOut().

◆ streamOut()

void XMLDocument::streamOut ( std::ostream &  fOut)

Definition at line 320 of file HcalDbXml.cc.

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 }

References mDoc, mDom, and root().

Member Data Documentation

◆ mDoc

DOMDocument* XMLDocument::mDoc
private

Definition at line 111 of file HcalDbXml.cc.

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

◆ mDom

DOMImplementation* XMLDocument::mDom
private

Definition at line 110 of file HcalDbXml.cc.

Referenced by streamOut(), and XMLDocument().

HcalRawGain::strStatus
std::string strStatus() const
Definition: HcalRawGain.h:22
HcalGainWidth::getValue
float getValue(int fCapId) const
get value for capId = 0..3
Definition: HcalGainWidth.h:20
HcalGain::getValue
float getValue(int fCapId) const
get value for capId = 0..3
Definition: HcalGain.h:21
writedatasetfile.parser
parser
Definition: writedatasetfile.py:7
MainPageGenerator.fName
fName
Definition: MainPageGenerator.py:301
StreamOutFormatTarget
Definition: StreamOutFormatTarget.h:30
PVValHelper::eta
Definition: PVValidationHelpers.h:70
HcalPedestalWidth::getSigma
float getSigma(int fCapId1, int fCapId2) const
get correlation element for capId1/2 = 0..3
Definition: HcalPedestalWidth.cc:33
HcalRawGain::getVoltage
float getVoltage() const
Definition: HcalRawGain.h:20
XMLDocument::makeRun
DOMElement * makeRun(DOMElement *fHeader, unsigned long fRun)
Definition: HcalDbXml.cc:158
HcalRawGain::getError
float getError() const
Definition: HcalRawGain.h:19
XMLDocument::makeChId
DOMElement * makeChId(DOMElement *fDataset, DetId fId)
Definition: HcalDbXml.cc:171
makeGlobalPositionRcd_cfg.tag
tag
Definition: makeGlobalPositionRcd_cfg.py:6
type
type
Definition: SiPixelVCal_PayloadInspector.cc:39
gainCalibHelper::gainCalibPI::type
type
Definition: SiPixelGainCalibHelper.h:40
XMLDocument::addAttribute
void addAttribute(DOMElement *fElement, const std::string &fName, const T &fValue)
Definition: HcalDbXml.cc:138
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
writedatasetfile.run
run
Definition: writedatasetfile.py:27
writedatasetfile.dataset
dataset
Definition: writedatasetfile.py:19
XMLDocument::newElement
DOMElement * newElement(DOMElement *fParent, const T &fName)
Definition: HcalDbXml.cc:123
XMLDocument::makeType
DOMElement * makeType(DOMElement *fHeader, const std::string &fExtensionName)
Definition: HcalDbXml.cc:151
XMLDocument::newValue
DOMElement * newValue(DOMElement *fParent, const std::string &fName, const T &fValue)
Definition: HcalDbXml.cc:130
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
RecoTauValidation_cfi.header
header
Definition: RecoTauValidation_cfi.py:291
dataset
Definition: dataset.py:1
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
genParticles_cff.map
map
Definition: genParticles_cff.py:11
XMLDocument::mDoc
DOMDocument * mDoc
Definition: HcalDbXml.cc:111
HcalText2DetIdConverter
Definition: HcalText2DetIdConverter.h:21
runonSM.text
text
Definition: runonSM.py:43
cms::concurrency::xercesInitialize
void xercesInitialize()
Definition: Xerces.cc:18
XMLDocument::mDom
DOMImplementation * mDom
Definition: HcalDbXml.cc:110
HcalRawGain::getValue
float getValue() const
Definition: HcalRawGain.h:18
XMLDocument::root
DOMElement * root()
Definition: HcalDbXml.cc:142
HcalPedestal::getValue
float getValue(int fCapId) const
get value for capId = 0..3
Definition: HcalPedestal.h:20