|
|
#include <CTPPSRPAlignmentCorrectionsMethods.h>
|
static std::string | iovValueToString (const edm::IOVSyncValue &) |
|
static CTPPSRPAlignmentCorrectionsDataSequence | loadFromXML (const std::string &fileName) |
| loads sequence of alignment corrections from XML file More...
|
|
static edm::IOVSyncValue | stringToIOVValue (const std::string &) |
|
static void | writeToXML (const CTPPSRPAlignmentCorrectionsData &ad, const std::string &fileName, bool precise=false, bool wrErrors=true, bool wrSh_xy=true, bool wrSh_z=false, bool wrRot_xy=false, bool wrRot_z=true) |
| writes alignment corrections into a single XML file, assigning infinite interval of validity More...
|
|
static void | writeToXML (const CTPPSRPAlignmentCorrectionsDataSequence &seq, const std::string &fileName, bool precise=false, bool wrErrors=true, bool wrSh_xy=true, bool wrSh_z=false, bool wrRot_xy=false, bool wrRot_z=true) |
| writes sequence of alignment corrections into a single XML file More...
|
|
|
static CTPPSRPAlignmentCorrectionsData | getCorrectionsData (xercesc::DOMNode *) |
| load corrections data corresponding to one IOV More...
|
|
static void | writeXML (const CTPPSRPAlignmentCorrectionData &data, FILE *f, bool precise, bool wrErrors, bool wrSh_xy, bool wrSh_z, bool wrRot_xy, bool wrRot_z) |
| writes data of a correction in XML format More...
|
|
static void | writeXMLBlock (const CTPPSRPAlignmentCorrectionsData &, FILE *, bool precise=false, bool wrErrors=true, bool wrSh_xy=true, bool wrSh_z=false, bool wrRot_xy=false, bool wrRot_z=true) |
| writes a block of corrections into a file More...
|
|
◆ CTPPSRPAlignmentCorrectionsMethods()
CTPPSRPAlignmentCorrectionsMethods::CTPPSRPAlignmentCorrectionsMethods |
( |
| ) |
|
|
inline |
◆ getCorrectionsData()
load corrections data corresponding to one IOV
Definition at line 204 of file CTPPSRPAlignmentCorrectionsMethods.cc.
209 for (
unsigned int i = 0;
i <
children->getLength();
i++) {
211 if (node->getNodeType() != DOMNode::ELEMENT_NODE)
217 unsigned char nodeType = 0;
218 if (node_name ==
"det")
220 else if (node_name ==
"rp")
228 if (node->getChildNodes()->getLength() > 0) {
231 << node->getChildNodes()->getLength() <<
" children nodes - they will be all ignored.";
235 double sh_x = 0., sh_y = 0., sh_z = 0., rot_x = 0., rot_y = 0., rot_z = 0.;
236 double sh_x_e = 0., sh_y_e = 0., sh_z_e = 0., rot_x_e = 0., rot_y_e = 0., rot_z_e = 0.;
241 DOMNamedNodeMap* attr = node->getAttributes();
242 for (
unsigned int j = 0;
j < attr->getLength();
j++) {
243 DOMNode*
a = attr->item(
j);
246 if (node_name ==
"id") {
249 }
else if (node_name ==
"sh_x")
251 else if (node_name ==
"sh_x_e")
253 else if (node_name ==
"sh_y")
255 else if (node_name ==
"sh_y_e")
257 else if (node_name ==
"sh_z")
259 else if (node_name ==
"sh_z_e")
261 else if (node_name ==
"rot_x")
263 else if (node_name ==
"rot_x_e")
265 else if (node_name ==
"rot_y")
267 else if (node_name ==
"rot_y_e")
269 else if (node_name ==
"rot_z")
271 else if (node_name ==
"rot_z_e")
275 <<
">> CTPPSRPAlignmentCorrectionsMethods::getCorrectionsData > Warning: unknown attribute `"
300 result.addSensorCorrection(
id, align_corr,
true);
302 result.addRPCorrection(
id, align_corr,
true);
References a, class-composition::children, MillePedeFileConverter_cfg::e, Exception, mps_fire::i, dqmiolumiharvest::j, mps_fire::result, AlCaHLTBitMon_QueryRunRegistry::string, cms::xerces::toDouble(), cms::xerces::toString(), and cms::xerces::toUInt().
Referenced by loadFromXML().
◆ iovValueToString()
std::string CTPPSRPAlignmentCorrectionsMethods::iovValueToString |
( |
const edm::IOVSyncValue & |
val | ) |
|
|
static |
◆ loadFromXML()
loads sequence of alignment corrections from XML file
Definition at line 104 of file CTPPSRPAlignmentCorrectionsMethods.cc.
111 XMLPlatformUtils::Initialize();
112 }
catch (
const XMLException& toCatch) {
117 auto parser = std::make_unique<XercesDOMParser>();
118 parser->setValidationScheme(XercesDOMParser::Val_Always);
119 parser->setDoNamespaces(
true);
124 <<
"Cannot parse file `" <<
fileName <<
"' (parser = NULL).";
126 DOMDocument* xmlDoc =
parser->getDocument();
130 <<
"Cannot parse file `" <<
fileName <<
"' (xmlDoc = NULL).";
132 DOMElement* elementRoot = xmlDoc->getDocumentElement();
137 DOMNodeList*
children = elementRoot->getChildNodes();
138 for (
unsigned int i = 0;
i <
children->getLength();
i++) {
140 if (node->getNodeType() != DOMNode::ELEMENT_NODE)
146 unsigned char nodeType = 0;
147 if (node_name ==
"iov")
149 else if (node_name ==
"det")
151 else if (node_name ==
"rp")
155 throw cms::Exception(
"CTPPSRPAlignmentCorrectionsMethods") <<
"Unknown node `" << node_name <<
"'.";
158 if (nodeType == 2 || nodeType == 3) {
166 bool first_set =
false, last_set =
false;
167 DOMNamedNodeMap* attrs = node->getAttributes();
168 for (
unsigned int j = 0;
j < attrs->getLength();
j++) {
169 const DOMNode* attr = attrs->item(
j);
172 if (attr_name ==
"first") {
175 }
else if (attr_name ==
"last") {
180 <<
">> CTPPSRPAlignmentCorrectionsDataSequence::loadFromXML > Warning: unknown attribute `" << attr_name
185 if (!first_set || !last_set)
187 <<
"iov tag must have `first' and `last' attributes set.";
198 XMLPlatformUtils::Terminate();
References edm::IOVSyncValue::beginOfTime(), class-composition::children, edm::IOVSyncValue::endOfTime(), Exception, MillePedeFileConverter_cfg::fileName, dqmdumpme::first, getCorrectionsData(), mps_fire::i, dqmiolumiharvest::j, dqmdumpme::last, convertSQLitetoXML_cfg::output, writedatasetfile::parser, AlCaHLTBitMon_QueryRunRegistry::string, stringToIOVValue(), and cms::xerces::toString().
Referenced by CTPPSRPAlignmentCorrectionsDataESSourceXML::PrepareSequence().
◆ stringToIOVValue()
edm::IOVSyncValue CTPPSRPAlignmentCorrectionsMethods::stringToIOVValue |
( |
const std::string & |
str | ) |
|
|
static |
STRUCTURE OF CTPPS ALINGMENT XML FILE The file has the following structure <xml> <iov first="run:ls" last="run:ls"> <tag> <tag> ... </iov> <iov first="run:ls" last="run:ls"> ... </iov></xml>
The time intervals are specified by the ‘first’ and ‘last’ run-lumisection pairs. If the <iov> tag is not present, an infinite validty is assumed for all the tags. The tag can be either "det" - the alignment correction is applied to one detector or "rp" - the alignment correction id applied to one RP Each tag must have an "id" attribute set. In addition the following attributes are recognized: sh_x - shift in x sh_x_e - the uncertainty of sh_x determination sh_y - shift in y sh_y_e - the uncertainty of sh_y determination sh_z - shift in z sh_z_e - the uncertainty of sh_z determination rot_x - rotation around x rot_x_e - the uncertainty of rot_x determination rot_y - rotation around y rot_y_e - the uncertainty of rot_y determination rot_z - rotation around z rot_z_e - the uncertainty of rot_z determination UNITS: shifts are in um, rotations are in mrad.
Definition at line 74 of file CTPPSRPAlignmentCorrectionsMethods.cc.
82 size_t sep_pos =
str.find(
":");
References edm::IOVSyncValue::beginOfTime(), edm::IOVSyncValue::endOfTime(), str, and AlCaHLTBitMon_QueryRunRegistry::string.
Referenced by loadFromXML().
◆ writeToXML() [1/2]
static void CTPPSRPAlignmentCorrectionsMethods::writeToXML |
( |
const CTPPSRPAlignmentCorrectionsData & |
ad, |
|
|
const std::string & |
fileName, |
|
|
bool |
precise = false , |
|
|
bool |
wrErrors = true , |
|
|
bool |
wrSh_xy = true , |
|
|
bool |
wrSh_z = false , |
|
|
bool |
wrRot_xy = false , |
|
|
bool |
wrRot_z = true |
|
) |
| |
|
inlinestatic |
◆ writeToXML() [2/2]
void CTPPSRPAlignmentCorrectionsMethods::writeToXML |
( |
const CTPPSRPAlignmentCorrectionsDataSequence & |
seq, |
|
|
const std::string & |
fileName, |
|
|
bool |
precise = false , |
|
|
bool |
wrErrors = true , |
|
|
bool |
wrSh_xy = true , |
|
|
bool |
wrSh_z = false , |
|
|
bool |
wrRot_xy = false , |
|
|
bool |
wrRot_z = true |
|
) |
| |
|
static |
writes sequence of alignment corrections into a single XML file
Definition at line 310 of file CTPPSRPAlignmentCorrectionsMethods.cc.
322 <<
"Cannot open file `" <<
fileName <<
"' to save alignments.";
324 fprintf(
rf,
"<!-- Shifts in um, rotations in mrad. -->\n");
325 fprintf(
rf,
"<xml DocumentType=\"AlignmentDescription\">\n");
328 for (
const auto&
p :
data) {
330 "\t<iov first=\"%s\" last=\"%s\">\n",
336 fprintf(
rf,
"\t</iov>\n");
339 fprintf(
rf,
"</xml>\n");
References data, Exception, MillePedeFileConverter_cfg::fileName, iovValueToString(), AlCaHLTBitMon_ParallelJobs::p, hltPixelTracks_cff::precise, hcal_runs::rf, and writeXMLBlock().
Referenced by writeToXML().
◆ writeXML()
void CTPPSRPAlignmentCorrectionsMethods::writeXML |
( |
const CTPPSRPAlignmentCorrectionData & |
data, |
|
|
FILE * |
f, |
|
|
bool |
precise, |
|
|
bool |
wrErrors, |
|
|
bool |
wrSh_xy, |
|
|
bool |
wrSh_z, |
|
|
bool |
wrRot_xy, |
|
|
bool |
wrRot_z |
|
) |
| |
|
staticprotected |
writes data of a correction in XML format
Definition at line 428 of file CTPPSRPAlignmentCorrectionsMethods.cc.
441 WRITE(
data.getShXUnc(),
"sh_x_e", 2, 0.1);
442 WRITE(
data.getShYUnc(),
"sh_y_e", 2, 0.1);
449 WRITE(
data.getShZUnc(),
"sh_z_e", 2, 0.1);
457 WRITE(
data.getRotXUnc(),
"rot_x_e", 3, 0.01);
458 WRITE(
data.getRotYUnc(),
"rot_y_e", 3, 0.01);
465 WRITE(
data.getRotZUnc(),
"rot_z_e", 3, 0.01);
References data, and WRITE.
Referenced by writeXMLBlock().
◆ writeXMLBlock()
void CTPPSRPAlignmentCorrectionsMethods::writeXMLBlock |
( |
const CTPPSRPAlignmentCorrectionsData & |
data, |
|
|
FILE * |
rf, |
|
|
bool |
precise = false , |
|
|
bool |
wrErrors = true , |
|
|
bool |
wrSh_xy = true , |
|
|
bool |
wrSh_z = false , |
|
|
bool |
wrRot_xy = false , |
|
|
bool |
wrRot_z = true |
|
) |
| |
|
staticprotected |
writes a block of corrections into a file
Definition at line 342 of file CTPPSRPAlignmentCorrectionsMethods.cc.
352 unsigned int prevRP = 0;
353 std::set<unsigned int> writtenRPs;
355 const auto& sensors =
data.getSensorMap();
356 const auto& rps =
data.getRPMap();
358 for (
auto it = sensors.begin(); it != sensors.end(); ++it) {
360 unsigned int rpId = sensorId.rpId();
361 unsigned int decRPId = sensorId.arm() * 100 + sensorId.station() * 10 + sensorId.rp();
364 if (firstRP || prevRP !=
rpId) {
369 fprintf(
rf,
"\t<!-- RP %3u -->\n", decRPId);
371 auto rit = rps.find(
rpId);
372 if (rit != rps.end()) {
373 fprintf(
rf,
"\t<rp id=\"%u\" ", rit->first);
374 writeXML(rit->second,
rf,
precise, wrErrors, wrSh_xy, wrSh_z, wrRot_xy, wrRot_z);
376 writtenRPs.insert(
rpId);
382 unsigned int planeIdx = 1000;
389 fprintf(
rf,
"\t<!-- plane %u --> ", planeIdx);
392 fprintf(
rf,
"<det id=\"%u\"", it->first);
398 for (
auto it = rps.begin(); it != rps.end(); ++it) {
399 std::set<unsigned int>::iterator wit = writtenRPs.find(it->first);
400 if (wit == writtenRPs.end()) {
402 unsigned int decRPId =
rpId.arm() * 100 +
rpId.station() * 10 +
rpId.rp();
408 fprintf(
rf,
"\t<!-- RP %3u -->\n", decRPId);
410 fprintf(
rf,
"\t<rp id=\"%u\" ", it->first);
References CTPPSDetId::arm(), data, CTPPSPixelDetId::plane(), CTPPSDiamondDetId::plane(), TotemRPDetId::plane(), hltPixelTracks_cff::precise, hcal_runs::rf, CTPPSDetId::rp(), year_2016_postTS2_cff::rpId, CTPPSDetId::rpId(), CTPPSDetId::sdTimingDiamond, CTPPSDetId::sdTrackingPixel, CTPPSDetId::sdTrackingStrip, CTPPSDetId::station(), DetId::subdetId(), and writeXML().
Referenced by writeToXML().
static std::string iovValueToString(const edm::IOVSyncValue &)
std::string toString(XMLCh const *toTranscode)
double toDouble(XMLCh const *toTranscode)
static void writeXMLBlock(const CTPPSRPAlignmentCorrectionsData &, FILE *, bool precise=false, bool wrErrors=true, bool wrSh_xy=true, bool wrSh_z=false, bool wrRot_xy=false, bool wrRot_z=true)
writes a block of corrections into a file
static void writeToXML(const CTPPSRPAlignmentCorrectionsDataSequence &seq, const std::string &fileName, bool precise=false, bool wrErrors=true, bool wrSh_xy=true, bool wrSh_z=false, bool wrRot_xy=false, bool wrRot_z=true)
writes sequence of alignment corrections into a single XML file
static CTPPSRPAlignmentCorrectionsData getCorrectionsData(xercesc::DOMNode *)
load corrections data corresponding to one IOV
#define WRITE(q, tag, dig, lim)
Detector ID class for CTPPS Timing Diamond detectors. Bits [19:31] : Assigend in CTPPSDetId Calss Bit...
static edm::IOVSyncValue stringToIOVValue(const std::string &)
static const IOVSyncValue & endOfTime()
static void writeXML(const CTPPSRPAlignmentCorrectionData &data, FILE *f, bool precise, bool wrErrors, bool wrSh_xy, bool wrSh_z, bool wrRot_xy, bool wrRot_z)
writes data of a correction in XML format
Base class for CTPPS detector IDs.
unsigned int toUInt(XMLCh const *toTranscode)
Container for CTPPS RP alignment corrections. The corrections are stored on two levels - RP and senso...
static const IOVSyncValue & beginOfTime()
char data[epos_bytes_allocation]
Alignment correction for an element of the CT-PPS detector. Within the geometry description,...
Detector ID class for TOTEM Si strip detectors.
Time sequence of alignment corrections. I/O methods have been factored out to: CondFormats/PPSObjects...