|
|
#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 208 of file CTPPSRPAlignmentCorrectionsMethods.cc.
213 for (
unsigned int i = 0;
i <
children->getLength();
i++) {
215 if (node->getNodeType() != DOMNode::ELEMENT_NODE)
221 unsigned char nodeType = 0;
222 if (node_name ==
"det")
224 else if (node_name ==
"rp")
232 if (node->getChildNodes()->getLength() > 0) {
235 << node->getChildNodes()->getLength() <<
" children nodes - they will be all ignored.";
239 double sh_x = 0., sh_y = 0., sh_z = 0., rot_x = 0., rot_y = 0., rot_z = 0.;
240 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.;
245 DOMNamedNodeMap* attr = node->getAttributes();
246 for (
unsigned int j = 0;
j < attr->getLength();
j++) {
247 DOMNode*
a = attr->item(
j);
250 if (node_name ==
"id") {
253 }
else if (node_name ==
"sh_x")
255 else if (node_name ==
"sh_x_e")
257 else if (node_name ==
"sh_y")
259 else if (node_name ==
"sh_y_e")
261 else if (node_name ==
"sh_z")
263 else if (node_name ==
"sh_z_e")
265 else if (node_name ==
"rot_x")
267 else if (node_name ==
"rot_x_e")
269 else if (node_name ==
"rot_y")
271 else if (node_name ==
"rot_y_e")
273 else if (node_name ==
"rot_z")
275 else if (node_name ==
"rot_z_e")
279 <<
">> CTPPSRPAlignmentCorrectionsMethods::getCorrectionsData > Warning: unknown attribute `"
304 result.addSensorCorrection(
id, align_corr,
true);
306 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 108 of file CTPPSRPAlignmentCorrectionsMethods.cc.
115 XMLPlatformUtils::Initialize();
116 }
catch (
const XMLException& toCatch) {
121 auto parser = std::make_unique<XercesDOMParser>();
122 parser->setValidationScheme(XercesDOMParser::Val_Always);
123 parser->setDoNamespaces(
true);
128 <<
"Cannot parse file `" <<
fileName <<
"' (parser = NULL).";
130 DOMDocument* xmlDoc =
parser->getDocument();
134 <<
"Cannot parse file `" <<
fileName <<
"' (xmlDoc = NULL).";
136 DOMElement* elementRoot = xmlDoc->getDocumentElement();
141 DOMNodeList*
children = elementRoot->getChildNodes();
142 for (
unsigned int i = 0;
i <
children->getLength();
i++) {
144 if (node->getNodeType() != DOMNode::ELEMENT_NODE)
150 unsigned char nodeType = 0;
151 if (node_name ==
"iov")
153 else if (node_name ==
"det")
155 else if (node_name ==
"rp")
159 throw cms::Exception(
"CTPPSRPAlignmentCorrectionsMethods") <<
"Unknown node `" << node_name <<
"'.";
162 if (nodeType == 2 || nodeType == 3) {
170 bool first_set =
false, last_set =
false;
171 DOMNamedNodeMap* attrs = node->getAttributes();
172 for (
unsigned int j = 0;
j < attrs->getLength();
j++) {
173 const DOMNode* attr = attrs->item(
j);
176 if (attr_name ==
"first") {
179 }
else if (attr_name ==
"last") {
184 <<
">> CTPPSRPAlignmentCorrectionsDataSequence::loadFromXML > Warning: unknown attribute `" << attr_name
189 if (!first_set || !last_set)
191 <<
"iov tag must have `first' and `last' attributes set.";
202 XMLPlatformUtils::Terminate();
References edm::IOVSyncValue::beginOfTime(), class-composition::children, edm::IOVSyncValue::endOfTime(), Exception, MillePedeFileConverter_cfg::fileName, first, getCorrectionsData(), mps_fire::i, dqmiolumiharvest::j, dqmdumpme::last, convertSQLitetoXML_cfg::output, writedatasetfile::parser, AlCaHLTBitMon_QueryRunRegistry::string, stringToIOVValue(), and cms::xerces::toString().
Referenced by PPSModifySingularModes::beginRun(), and CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon::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 78 of file CTPPSRPAlignmentCorrectionsMethods.cc.
86 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 314 of file CTPPSRPAlignmentCorrectionsMethods.cc.
326 <<
"Cannot open file `" <<
fileName <<
"' to save alignments.";
328 fprintf(
rf,
"<!-- Shifts in um, rotations in mrad. -->\n");
329 fprintf(
rf,
"<xml DocumentType=\"AlignmentDescription\">\n");
332 for (
const auto&
p :
data) {
334 "\t<iov first=\"%s\" last=\"%s\">\n",
340 fprintf(
rf,
"\t</iov>\n");
343 fprintf(
rf,
"</xml>\n");
References data, Exception, MillePedeFileConverter_cfg::fileName, iovValueToString(), AlCaHLTBitMon_ParallelJobs::p, hltPixelTracks_cff::precise, hcal_runs::rf, and writeXMLBlock().
Referenced by PPSModifySingularModes::beginRun(), StraightTrackAlignment::finish(), and 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 432 of file CTPPSRPAlignmentCorrectionsMethods.cc.
445 WRITE(
data.getShXUnc(),
"sh_x_e", 2, 0.1);
446 WRITE(
data.getShYUnc(),
"sh_y_e", 2, 0.1);
453 WRITE(
data.getShZUnc(),
"sh_z_e", 2, 0.1);
461 WRITE(
data.getRotXUnc(),
"rot_x_e", 3, 0.01);
462 WRITE(
data.getRotYUnc(),
"rot_y_e", 3, 0.01);
469 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 346 of file CTPPSRPAlignmentCorrectionsMethods.cc.
356 unsigned int prevRP = 0;
357 std::set<unsigned int> writtenRPs;
359 const auto& sensors =
data.getSensorMap();
360 const auto& rps =
data.getRPMap();
362 for (
auto it = sensors.begin(); it != sensors.end(); ++it) {
364 unsigned int rpId = sensorId.rpId();
365 unsigned int decRPId = sensorId.arm() * 100 + sensorId.station() * 10 + sensorId.rp();
368 if (firstRP || prevRP !=
rpId) {
373 fprintf(
rf,
"\t<!-- RP %3u -->\n",
decRPId);
375 auto rit = rps.find(
rpId);
376 if (rit != rps.end()) {
377 fprintf(
rf,
"\t<rp id=\"%u\" ", rit->first);
378 writeXML(rit->second,
rf,
precise, wrErrors, wrSh_xy, wrSh_z, wrRot_xy, wrRot_z);
380 writtenRPs.insert(
rpId);
386 unsigned int planeIdx = 1000;
393 fprintf(
rf,
"\t<!-- plane %u --> ", planeIdx);
396 fprintf(
rf,
"<det id=\"%u\"", it->first);
402 for (
auto it = rps.begin(); it != rps.end(); ++it) {
403 std::set<unsigned int>::iterator wit = writtenRPs.find(it->first);
404 if (wit == writtenRPs.end()) {
412 fprintf(
rf,
"\t<!-- RP %3u -->\n",
decRPId);
414 fprintf(
rf,
"\t<rp id=\"%u\" ", it->first);
References CTPPSDetId::arm(), data, protons_cff::decRPId, CTPPSPixelDetId::plane(), CTPPSDiamondDetId::plane(), TotemRPDetId::plane(), hltPixelTracks_cff::precise, hcal_runs::rf, CTPPSDetId::rp(), profile_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)
Log< level::Error, true > LogProblem
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...