4 template <
class T> XMLCh* transcode (
const T& fInput) {
5 std::ostringstream ost;
7 return XMLString::transcode(ost.str().c_str());
12 DOMElement*
elem = doc->createElement(
XML(name));
13 parent->appendChild(elem);
19 elem->appendChild(doc->createTextNode(
XML(value)));
25 elem->appendChild(doc->createTextNode(
XML(value)));
30 DOMImplementation* impl = DOMImplementationRegistry::getDOMImplementation(
XML(
"Core"));
31 return impl->createDocument(0,
XML(
"ROOT"),0);
35 DOMImplementation* impl = DOMImplementationRegistry::getDOMImplementation(
XML(
"Core"));
36 DOMWriter *theSerializer = ((DOMImplementationLS*)impl)->createDOMWriter();
37 if (theSerializer->canSetFeature(XMLUni::fgDOMWRTFormatPrettyPrint,
true))
38 theSerializer->setFeature(XMLUni::fgDOMWRTFormatPrettyPrint,
true);
39 if (theSerializer->canSetFeature(XMLUni::fgDOMWRTBOM,
true))
40 theSerializer->setFeature(XMLUni::fgDOMWRTBOM,
true);
41 XMLFormatTarget *myFormTarget =
new LocalFileFormatTarget(xmlFile);
42 theSerializer->writeNode(myFormTarget, *doc);
48 unsigned long long fIovBegin,
unsigned long long fIovEnd,
49 const char* fTagName,
const char* fDetectorName,
const char* fComment){
51 DOMElement*
parent = doc->getDocumentElement();
52 DOMElement* elems =
createElement(doc,parent,(
char*)
"ELEMENTS");
54 dataset->setAttribute(transcode(
"id"), transcode(
"-1"));
56 createTag(doc,elems,fTagName,fDetectorName,fComment);
68 tag->setAttribute(transcode(
"idref"), transcode(
"TAG_ID"));
74 iov->setAttribute(transcode(
"idref"), transcode(
"IOV_ID"));
79 DOMElement* element =
createElement(doc,fIov, (
char*)
"DATA_SET");
80 element->setAttribute(transcode(
"idref"), transcode(
"-1"));
85 unsigned long long fIovBegin,
unsigned long long fIovEnd) {
87 iov->setAttribute(transcode(
"id"), transcode(
"IOV_ID"));
97 const char* fTagName,
const char* fDetectorName,
const char* fComment) {
99 tag->setAttribute(transcode(
"id"), transcode (
"TAG_ID"));
100 tag->setAttribute(transcode(
"mode"), transcode (
"auto"));
103 createElement(doc,tag,(
char*)
"DETECTOR_NAME", fDetectorName);
104 createElement(doc,tag,(
char*)
"COMMENT_DESCRIPTION", fComment);
111 DOMElement*
parent = doc->getDocumentElement();
112 DOMElement* headerElem =
createElement(doc,parent,(
char*)
"HEADER");
113 DOMElement* typeElem =
createElement(doc,headerElem,(
char*)
"TYPE");
114 createElement(doc,typeElem,(
char*)
"EXTENSION_TABLE_NAME",(
char*)
"HCAL_CHANNEL_ON_OFF_STATES");
115 createElement(doc,typeElem,(
char*)
"NAME",(
char*)
"HCAL channel on off states");
116 DOMElement* runElem =
createElement(doc,headerElem,(
char*)
"RUN");
117 createElement(doc,runElem,(
char*)
"RUN_TYPE",(
char*)
"hcal-dqm-onoff-test");
119 createElement(doc,runElem,(
char*)
"RUN_BEGIN_TIMESTAMP",startTime);
120 createElement(doc,runElem,(
char*)
"COMMENT_DESCRIPTION",(
char*)
"dqm data");
125 DOMElement* chanElem =
createElement(doc,parent,(
char*)
"CHANNEL");
126 createElement(doc,chanElem,(
char*)
"EXTENSION_TABLE_NAME",(
char*)
"HCAL_CHANNELS");
137 DOMElement* dataElem =
createElement(doc,parent,(
char*)
"DATA");
150 DOMElement*
parent = doc->getDocumentElement();
151 DOMElement* dataSetElem =
createElement(doc,parent,(
char*)
"DATA_SET");
153 createElement(doc,dataSetElem,(
char*)
"CREATION_TIMESTAMP",gmtime);
154 createElement(doc,dataSetElem,(
char*)
"CREATED_BY",(
char*)
"wfisher");
162 DOMElement*
parent = doc->getDocumentElement();
163 DOMElement* headerElem =
createElement(doc,parent,(
char*)
"HEADER");
164 DOMElement* typeElem =
createElement(doc,headerElem,(
char*)
"TYPE");
165 createElement(doc,typeElem,(
char*)
"EXTENSION_TABLE_NAME",(
char*)
"HCAL_HLX_MASKS_TYPE01");
166 createElement(doc,typeElem,(
char*)
"NAME",(
char*)
"HCAL HLX masks [type 1]");
167 DOMElement* element=
createElement(doc,headerElem,(
char*)
"RUN");
168 element->setAttribute(transcode(
"mode"), transcode(
"no-run"));
172 DOMElement* dataElem =
createElement(doc,parent,(
char*)
"DATA");
174 char tmp[5] =
"fooo";
175 sprintf(tmp,
"%i",masks.
occMask);
177 sprintf(tmp,
"%i",masks.
lhcMask);
186 const char*
version,
const char* subversion){
188 DOMElement*
parent = doc->getDocumentElement();
189 DOMElement* dataSetElem =
createElement(doc,parent,(
char*)
"DATA_SET");
191 createElement(doc,dataSetElem,(
char*)
"SUBVERSION",subversion);
192 createElement(doc,dataSetElem,(
char*)
"CREATION_TIMESTAMP",gmtime);
193 createElement(doc,dataSetElem,(
char*)
"CREATED_BY",(
char*)
"jwerner");
195 DOMElement* partAssElem =
createElement(doc,dataSetElem,(
char*)
"PART_ASSEMBLY");
196 DOMElement* parentPartAssElem =
createElement(doc,partAssElem,(
char*)
"PARENT_PART");
197 createElement(doc, parentPartAssElem, (
char*)
"KIND_OF_PART", (
char*)
"HCAL HTR Crate");
200 else{ sprintf(tmp,
"CRATE%i",masks.
crateId);}
201 createElement(doc, parentPartAssElem, (
char*)
"NAME_LABEL",tmp);
203 DOMElement* childUniqueIdByElem =
createElement(doc,partAssElem,(
char*)
"CHILD_UNIQUELY_IDENTIFIED_BY");
204 createElement(doc, childUniqueIdByElem, (
char*)
"KIND_OF_PART", (
char*)
"HCAL HTR Crate Slot");
205 DOMElement* attributeElem =
createElement(doc,childUniqueIdByElem,(
char*)
"ATTRIBUTE");
206 createElement(doc, attributeElem, (
char*)
"NAME", (
char*)
"HCAL HTR Slot Number");
void createHeader(DOMDocument *doc, unsigned int runno, const char *startTime)
DOMElement * createFooter(DOMDocument *doc, unsigned long long fIovBegin, unsigned long long fIovEnd, const char *fTagName, const char *fDetectorName, const char *fComment)
void createDataset(DOMDocument *doc, HcalDQMChannelQuality::Item item, const char *gmtime, const char *version)
DOMDocument * createDocument()
DOMElement * createChannel(DOMDocument *doc, DOMElement *parent, HcalDetId id)
DOMElement * createTag(DOMDocument *doc, DOMElement *parent, const char *fTagName, const char *fDetectorName, const char *fComment)
DOMElement * createDataset(DOMDocument *doc, const HcalHLXMask mask, const char *gmtime, const char *version, const char *subversion)
DOMElement * makeMapIOV(DOMDocument *doc, DOMElement *fTag)
void writeDocument(DOMDocument *doc, const char *xmlFile)
bool xmlFile(const std::string fParam)
std::vector< std::vector< double > > tmp
void createHeader(DOMDocument *doc)
void createData(DOMDocument *doc, DOMElement *parent, HcalHLXMask mask)
DOMElement * makeMapTag(DOMDocument *doc, DOMElement *fMap)
DOMElement * createData(DOMDocument *doc, DOMElement *parent, HcalDQMChannelQuality::Item item)
const std::string & getFlavor() const
DOMElement * makeMapDataset(DOMDocument *doc, DOMElement *fIov)
DOMElement * createElement(DOMDocument *doc, DOMElement *parent, char *name)
DOMElement * createIOV(DOMDocument *doc, DOMElement *parent, unsigned long long fIovBegin, unsigned long long fIovEnd)
static const uint32_t masks[]