CMS 3D CMS Logo

List of all members | Static Public Member Functions | Static Private Member Functions
EcalAlignmentXMLTranslator Class Reference

#include <EcalAlignmentXMLTranslator.h>

Static Public Member Functions

static int writeXML (const std::string &filename, const EcalCondHeader &header, const Alignments &record)
 

Static Private Member Functions

static std::string dumpXML (const EcalCondHeader &header, const Alignments &record)
 

Detailed Description

Definition at line 18 of file EcalAlignmentXMLTranslator.h.

Member Function Documentation

◆ dumpXML()

string EcalAlignmentXMLTranslator::dumpXML ( const EcalCondHeader header,
const Alignments record 
)
staticprivate

Definition at line 33 of file EcalAlignmentXMLTranslator.cc.

33  {
34  unique_ptr<DOMImplementation> impl(DOMImplementationRegistry::getDOMImplementation(cms::xerces::uStr("LS").ptr()));
35 
36  DOMLSSerializer* writer = impl->createLSSerializer();
37  if (writer->getDomConfig()->canSetParameter(XMLUni::fgDOMWRTFormatPrettyPrint, true))
38  writer->getDomConfig()->setParameter(XMLUni::fgDOMWRTFormatPrettyPrint, true);
39 
40  DOMDocumentType* doctype = impl->createDocumentType(cms::xerces::uStr("XML").ptr(), nullptr, nullptr);
41  DOMDocument* doc = impl->createDocument(nullptr, cms::xerces::uStr(AlignmentConstant_tag.c_str()).ptr(), doctype);
42  DOMElement* root = doc->getDocumentElement();
43 
45 
46  for (vector<AlignTransform>::const_iterator it = record.m_align.begin(); it != record.m_align.end(); it++) {
47  int Id = (*it).rawId();
48  int sub = (Id >> 24) & 0xF;
49  stringstream subdet;
50  if (sub == 2) {
51  subdet << "EB";
52  int SM;
53  int phi = Id & 0x1FF;
54  // int eta = (Id>>9)&0x3F;
55  int side = (Id >> 16) & 1;
56  if (side == 0) {
57  subdet << "-";
58  SM = (phi + 19) / 20;
59  } else {
60  subdet << "+";
61  SM = phi / 20;
62  }
63  if (SM < 10)
64  subdet << "0" << SM;
65  else
66  subdet << SM;
67  } else if (sub == 4) {
68  subdet << "EE";
69  // int y = Id&0x7F;
70  int x = (Id >> 7) & 0x7F;
71  // int Dee = x/70 + 1;
72  int side = (Id >> 14) & 1;
73  if (side == 0) {
74  subdet << "-";
75  } else {
76  subdet << "+";
77  }
78  // subdet << "0" << Dee;
79  if (x == 20)
80  subdet << "F";
81  else if (x == 70)
82  subdet << "N";
83  else
84  cout << " strange value for x " << x << endl; // should never occur
85  } else if (sub == 6) {
86  subdet << "ES";
87  // int strip = Id&0x3F;
88  int x = (Id >> 6) & 0x3F;
89  // int y = (Id>>12)&0x3F;
90  int plane = (Id >> 18) & 1;
91  int side = (Id >> 19) & 1;
92  if (side == 0)
93  subdet << "-";
94  else
95  subdet << "+";
96  if (plane)
97  subdet << "F";
98  else
99  subdet << "R";
100  if (x / 30)
101  subdet << "F";
102  else
103  subdet << "N";
104  } else
105  cout << " problem sub = " << sub << endl;
106  cout << (*it).rawId() << " " << (*it).rotation().getPhi() << " " << (*it).rotation().getTheta() << " "
107  << (*it).rotation().getPsi() << " " << (*it).translation().x() << " " << (*it).translation().y() << " "
108  << (*it).translation().z() << endl;
109  uint32_t rawid = (*it).rawId();
110  DOMElement* cellnode = root->getOwnerDocument()->createElement(cms::xerces::uStr(Cell_tag.c_str()).ptr());
111  root->appendChild(cellnode);
112  cellnode->setAttribute(cms::xerces::uStr(subdet_tag.c_str()).ptr(), cms::xerces::uStr(subdet.str().c_str()).ptr());
113  xuti::WriteNodeWithValue(cellnode, id_tag, rawid);
114  xuti::WriteNodeWithValue(cellnode, x_tag, (*it).translation().x());
115  xuti::WriteNodeWithValue(cellnode, y_tag, (*it).translation().y());
116  xuti::WriteNodeWithValue(cellnode, z_tag, (*it).translation().z());
117  xuti::WriteNodeWithValue(cellnode, Phi_tag, (*it).rotation().getPhi());
118  xuti::WriteNodeWithValue(cellnode, Theta_tag, (*it).rotation().getTheta());
119  xuti::WriteNodeWithValue(cellnode, Psi_tag, (*it).rotation().getPsi());
120  }
121 
122  std::string dump = cms::xerces::toString(writer->writeToString(root));
123  doc->release();
124  doctype->release();
125  writer->release();
126 
127  return dump;
128 }

References xuti::AlignmentConstant_tag(), xuti::Cell_tag(), gather_cfg::cout, boostedTaus_cff::doc, submitPVValidationJobs::dump, RecoTauValidation_cfi::header, xuti::id_tag(), xuti::Phi_tag(), xuti::Psi_tag(), AlCaHarvesting_cff::record, AlCaHLTBitMon_QueryRunRegistry::string, xuti::subdet_tag(), xuti::Theta_tag(), cms::xerces::toString(), cms::xerces::uStr(), xuti::writeHeader(), xuti::WriteNodeWithValue(), cscNeutronWriter_cfi::writer, xuti::x_tag(), xuti::y_tag(), and xuti::z_tag().

◆ writeXML()

int EcalAlignmentXMLTranslator::writeXML ( const std::string &  filename,
const EcalCondHeader header,
const Alignments record 
)
static
submitPVValidationJobs.dump
dump
Definition: submitPVValidationJobs.py:55
xuti::writeHeader
void writeHeader(xercesc::DOMNode *parentNode, const EcalCondHeader &header)
write
Definition: DOMHelperFunctions.cc:151
boostedTaus_cff.doc
doc
Definition: boostedTaus_cff.py:20
gather_cfg.cout
cout
Definition: gather_cfg.py:144
cscNeutronWriter_cfi.writer
writer
Definition: cscNeutronWriter_cfi.py:6
DDAxes::x
cms::xerces::toString
std::string toString(XMLCh const *toTranscode)
Definition: XercesStrUtils.h:35
xuti::id_tag
const std::string id_tag("id")
xuti::WriteNodeWithValue
void WriteNodeWithValue(xercesc::DOMNode *parentNode, const std::string &tag, const T &value)
write a node with
Definition: DOMHelperFunctions.h:46
corrVsCorr.filename
filename
Definition: corrVsCorr.py:123
xuti::Theta_tag
const std::string Theta_tag("Theta")
xuti::x_tag
const std::string x_tag("x")
xuti::Psi_tag
const std::string Psi_tag("Psi")
xuti::Phi_tag
const std::string Phi_tag("Phi")
EcalAlignmentXMLTranslator::dumpXML
static std::string dumpXML(const EcalCondHeader &header, const Alignments &record)
Definition: EcalAlignmentXMLTranslator.cc:33
cms::concurrency::xercesTerminate
void xercesTerminate()
Definition: Xerces.cc:23
root
Definition: RooFitFunction.h:10
cms::xerces::uStr
ZStr< XMLCh > uStr(char const *str)
Definition: XercesStrUtils.h:31
AlCaHarvesting_cff.record
record
Definition: AlCaHarvesting_cff.py:42
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
DDAxes::phi
impl
Definition: trackAlgoPriorityOrder.h:18
xuti::AlignmentConstant_tag
const std::string AlignmentConstant_tag("EcalAlignmentConstant")
RecoTauValidation_cfi.header
header
Definition: RecoTauValidation_cfi.py:291
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
xuti::subdet_tag
const std::string subdet_tag("SubDet")
cms::concurrency::xercesInitialize
void xercesInitialize()
Definition: Xerces.cc:18
xuti::Cell_tag
const std::string Cell_tag("cell")
xuti::z_tag
const std::string z_tag("z")
xuti::y_tag
const std::string y_tag("y")