CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Static Protected Member Functions
RPAlignmentCorrectionsMethods Class Reference

#include <RPAlignmentCorrectionsMethods.h>

Public Member Functions

 RPAlignmentCorrectionsMethods ()
 

Static Public Member Functions

static std::string iovValueToString (const edm::IOVSyncValue &)
 
static RPAlignmentCorrectionsDataSequence 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 RPAlignmentCorrectionsDataSequence &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 void writeToXML (const RPAlignmentCorrectionsData &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 Protected Member Functions

static RPAlignmentCorrectionsData getCorrectionsData (xercesc::DOMNode *)
 load corrections data corresponding to one IOV More...
 
static void writeXML (const RPAlignmentCorrectionData &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 RPAlignmentCorrectionsData &, 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...
 

Detailed Description

Definition at line 20 of file RPAlignmentCorrectionsMethods.h.

Constructor & Destructor Documentation

RPAlignmentCorrectionsMethods::RPAlignmentCorrectionsMethods ( )
inline

Member Function Documentation

RPAlignmentCorrectionsData RPAlignmentCorrectionsMethods::getCorrectionsData ( xercesc::DOMNode *  )
staticprotected

load corrections data corresponding to one IOV

Definition at line 212 of file RPAlignmentCorrectionsMethods.cc.

References a, RPAlignmentCorrectionsData::addRPCorrection(), RPAlignmentCorrectionsData::addSensorCorrection(), class-composition::children, MillePedeFileConverter_cfg::e, Exception, mps_fire::i, mps_fire::result, AlCaHLTBitMon_QueryRunRegistry::string, cms::xerces::toDouble(), cms::xerces::toString(), and cms::xerces::toUInt().

Referenced by loadFromXML(), and writeToXML().

213 {
215 
216  DOMNodeList *children = root->getChildNodes();
217  for ( unsigned int i = 0; i < children->getLength(); i++ )
218  {
219  DOMNode *node = children->item( i );
220  if ( node->getNodeType() != DOMNode::ELEMENT_NODE )
221  continue;
222 
223  const std::string node_name = cms::xerces::toString( node->getNodeName() );
224 
225  // check node type
226  unsigned char nodeType = 0;
227  if ( node_name == "det" ) nodeType = 1;
228  else if ( node_name == "rp" ) nodeType = 2;
229 
230  if ( nodeType == 0 )
231  throw cms::Exception("RPAlignmentCorrectionsMethods") << "Unknown node `" << cms::xerces::toString( node->getNodeName() ) << "'.";
232 
233  // check children
234  if ( node->getChildNodes()->getLength() > 0 )
235  {
236  edm::LogProblem("RPAlignmentCorrectionsMethods") << "LoadXMLFile > Warning: tag `" <<
237  cms::xerces::toString( node->getNodeName() ) << "' has " << node->getChildNodes()->getLength() << " children nodes - they will be all ignored.";
238  }
239 
240  // default values
241  double sh_x = 0., sh_y = 0., sh_z = 0., rot_x = 0., rot_y = 0., rot_z = 0.;
242  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.;
243  unsigned int id = 0;
244  bool idSet = false;
245 
246  // get attributes
247  DOMNamedNodeMap* attr = node->getAttributes();
248  for ( unsigned int j = 0; j < attr->getLength(); j++ )
249  {
250  DOMNode *a = attr->item( j );
251  const std::string node_name = cms::xerces::toString( a->getNodeName() );
252 
253  if ( node_name == "id" )
254  {
255  id = cms::xerces::toUInt( a->getNodeValue() );
256  idSet = true;
257  }
258  else if ( node_name == "sh_x" ) sh_x = cms::xerces::toDouble( a->getNodeValue() );
259  else if ( node_name == "sh_x_e" ) sh_x_e = cms::xerces::toDouble( a->getNodeValue() );
260  else if ( node_name == "sh_y" ) sh_y = cms::xerces::toDouble( a->getNodeValue() );
261  else if ( node_name == "sh_y_e" ) sh_y_e = cms::xerces::toDouble( a->getNodeValue() );
262  else if ( node_name == "sh_z" ) sh_z = cms::xerces::toDouble( a->getNodeValue() );
263  else if ( node_name == "sh_z_e" ) sh_z_e = cms::xerces::toDouble( a->getNodeValue() );
264  else if ( node_name == "rot_x" ) rot_x = cms::xerces::toDouble( a->getNodeValue() );
265  else if ( node_name == "rot_x_e" ) rot_x_e = cms::xerces::toDouble( a->getNodeValue() );
266  else if ( node_name == "rot_y" ) rot_y = cms::xerces::toDouble( a->getNodeValue() );
267  else if ( node_name == "rot_y_e" ) rot_y_e = cms::xerces::toDouble( a->getNodeValue() );
268  else if ( node_name == "rot_z" ) rot_z = cms::xerces::toDouble( a->getNodeValue() );
269  else if ( node_name == "rot_z_e" ) rot_z_e = cms::xerces::toDouble( a->getNodeValue() );
270  else
271  edm::LogProblem("RPAlignmentCorrectionsMethods") << ">> RPAlignmentCorrectionsMethods::getCorrectionsData > Warning: unknown attribute `"
272  << cms::xerces::toString( a->getNodeName() ) << "'.";
273  }
274 
275  // id must be set
276  if ( !idSet )
277  throw cms::Exception("RPAlignmentCorrectionsMethods") << "Id not set for tag `" << cms::xerces::toString( node->getNodeName() ) << "'.";
278 
279  // build alignment
280  const RPAlignmentCorrectionData align_corr(
281  sh_x*1e-3, sh_x_e*1e-3,
282  sh_y*1e-3, sh_y_e*1e-3,
283  sh_z*1e-3, sh_z_e*1e-3,
284  rot_x*1e-3, rot_x_e*1e-3,
285  rot_y*1e-3, rot_y_e*1e-3,
286  rot_z*1e-3, rot_z_e*1e-3
287  );
288 
289  // add the alignment to the right list
290  if ( nodeType == 1 ) result.addSensorCorrection( id, align_corr, true );
291  if ( nodeType == 2 ) result.addRPCorrection( id, align_corr, true );
292  }
293 
294  return result;
295 }
double toDouble(XMLCh const *toTranscode)
std::string toString(XMLCh const *toTranscode)
void addRPCorrection(unsigned int, const RPAlignmentCorrectionData &, bool sumErrors=true, bool addSh=true, bool addRot=true)
unsigned int toUInt(XMLCh const *toTranscode)
void addSensorCorrection(unsigned int, const RPAlignmentCorrectionData &, bool sumErrors=true, bool addSh=true, bool addRot=true)
adds (merges) a RP correction on top of the current value
Alignment correction for an element of the CT-PPS detector. Within the geometry description, every sensor (more generally every element) is given its translation and rotation. These two quantities shall be understood in local-to-global coordinate transform. That is, if r_l is a point in local coordinate system and x_g in global, then it holds.
Container for CTPPS RP alignment corrections. The corrections are stored on two levels - RP and senso...
double a
Definition: hdecay.h:121
std::string RPAlignmentCorrectionsMethods::iovValueToString ( const edm::IOVSyncValue val)
static

Definition at line 96 of file RPAlignmentCorrectionsMethods.cc.

References edm::IOVSyncValue::beginOfTime(), edm::IOVSyncValue::endOfTime(), edm::IOVSyncValue::eventID(), edm::EventID::luminosityBlock(), and edm::EventID::run().

Referenced by CTPPSIncludeAlignmentsFromXML::Merge(), CTPPSIncludeAlignmentsFromXML::setIntervalFor(), and writeToXML().

97 {
98  if (val == edm::IOVSyncValue::beginOfTime())
99  return "-inf";
100 
101  if (val == edm::IOVSyncValue::endOfTime())
102  return "+inf";
103 
104  char buf[50];
105  sprintf(buf, "%u:%u", val.eventID().run(), val.eventID().luminosityBlock());
106  return buf;
107 }
RunNumber_t run() const
Definition: EventID.h:39
const EventID & eventID() const
Definition: IOVSyncValue.h:42
static const IOVSyncValue & endOfTime()
Definition: IOVSyncValue.cc:97
LuminosityBlockNumber_t luminosityBlock() const
Definition: EventID.h:40
static const IOVSyncValue & beginOfTime()
RPAlignmentCorrectionsDataSequence RPAlignmentCorrectionsMethods::loadFromXML ( const std::string &  fileName)
static

loads sequence of alignment corrections from XML file

Definition at line 112 of file RPAlignmentCorrectionsMethods.cc.

References edm::IOVSyncValue::beginOfTime(), class-composition::children, edm::IOVSyncValue::endOfTime(), Exception, plotBeamSpotDB::first, getCorrectionsData(), mps_fire::i, RPAlignmentCorrectionsDataSequence::insert(), plotBeamSpotDB::last, convertSQLitetoXML_cfg::output, createfilelist::parser, AlCaHLTBitMon_QueryRunRegistry::string, stringToIOVValue(), and cms::xerces::toString().

Referenced by CTPPSIncludeAlignmentsFromXML::PrepareSequence(), and RPAlignmentCorrectionsMethods().

113 {
114  // prepare output
116 
117  // load DOM tree
118  try {
119  XMLPlatformUtils::Initialize();
120  } catch ( const XMLException& toCatch ) {
121  throw cms::Exception("RPAlignmentCorrectionsMethods") << "An XMLException caught with message: " << cms::xerces::toString( toCatch.getMessage() ) << ".";
122  }
123 
124  auto parser = std::make_unique<XercesDOMParser>();
125  parser->setValidationScheme( XercesDOMParser::Val_Always );
126  parser->setDoNamespaces( true );
127  parser->parse( fileName.c_str() );
128 
129  if ( !parser )
130  throw cms::Exception("RPAlignmentCorrectionsMethods") << "Cannot parse file `" << fileName << "' (parser = NULL).";
131 
132  DOMDocument* xmlDoc = parser->getDocument();
133 
134  if ( !xmlDoc )
135  throw cms::Exception("RPAlignmentCorrectionsMethods") << "Cannot parse file `" << fileName << "' (xmlDoc = NULL).";
136 
137  DOMElement* elementRoot = xmlDoc->getDocumentElement();
138  if ( !elementRoot )
139  throw cms::Exception("RPAlignmentCorrectionsMethods") << "File `" << fileName << "' is empty.";
140 
141  // extract useful information form the DOM tree
142  DOMNodeList* children = elementRoot->getChildNodes();
143  for ( unsigned int i = 0; i < children->getLength(); i++ )
144  {
145  DOMNode* node = children->item( i );
146  if ( node->getNodeType() != DOMNode::ELEMENT_NODE )
147  continue;
148 
149  const std::string node_name = cms::xerces::toString( node->getNodeName() );
150 
151  // check node type
152  unsigned char nodeType = 0;
153  if ( node_name == "iov" ) nodeType = 1;
154  else if ( node_name == "det" ) nodeType = 2;
155  else if ( node_name == "rp" ) nodeType = 3;
156 
157  if ( nodeType == 0 )
158  throw cms::Exception("RPAlignmentCorrectionsMethods") << "Unknown node `" << node_name << "'.";
159 
160  // for backward compatibility: support files with no iov block
161  if ( nodeType == 2 || nodeType == 3 )
162  {
164  output.insert(iov, getCorrectionsData(elementRoot));
165  break;
166  }
167 
168  // get attributes
170  bool first_set = false, last_set = false;
171  DOMNamedNodeMap* attrs = node->getAttributes();
172  for ( unsigned int j = 0; j < attrs->getLength(); j++ )
173  {
174  const DOMNode* attr = attrs->item( j );
175  const std::string attr_name = cms::xerces::toString( attr->getNodeName() );
176 
177  if ( attr_name == "first" )
178  {
179  first_set = true;
180  first = stringToIOVValue( cms::xerces::toString( attr->getNodeValue() ) );
181  }
182  else if ( attr_name == "last" ) {
183  last_set = true;
184  last = stringToIOVValue( cms::xerces::toString( attr->getNodeValue() ) );
185  }
186  else
187  edm::LogProblem("RPAlignmentCorrectionsMethods") << ">> RPAlignmentCorrectionsDataSequence::loadFromXML > Warning: unknown attribute `"
188  << attr_name << "'.";
189  }
190 
191  // interval of validity must be set
192  if ( !first_set || !last_set )
193  throw cms::Exception("RPAlignmentCorrectionsMethods") << "iov tag must have `first' and `last' attributes set.";
194 
195  // process data
197 
198  // save result
199  output.insert(edm::ValidityInterval(first, last), corrections);
200  }
201 
202  // clean up
203  parser.reset();
204  XMLPlatformUtils::Terminate();
205 
206  return output;
207 }
Time sequence of alignment corrections. I/O methods have been factored out to: Geometry/VeryForwardGe...
static const IOVSyncValue & endOfTime()
Definition: IOVSyncValue.cc:97
static edm::IOVSyncValue stringToIOVValue(const std::string &)
void insert(const edm::ValidityInterval &iov, const RPAlignmentCorrectionsData &data)
static RPAlignmentCorrectionsData getCorrectionsData(xercesc::DOMNode *)
load corrections data corresponding to one IOV
std::string toString(XMLCh const *toTranscode)
static const IOVSyncValue & beginOfTime()
Container for CTPPS RP alignment corrections. The corrections are stored on two levels - RP and senso...
edm::IOVSyncValue RPAlignmentCorrectionsMethods::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 79 of file RPAlignmentCorrectionsMethods.cc.

References edm::IOVSyncValue::beginOfTime(), edm::IOVSyncValue::endOfTime(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by loadFromXML(), and writeToXML().

80 {
81  if (str == "-inf")
83 
84  if (str == "+inf")
86 
87  size_t sep_pos = str.find(":");
88  const std::string &runStr = str.substr(0, sep_pos);
89  const std::string &lsStr = str.substr(sep_pos+1);
90 
91  return edm::IOVSyncValue(edm::EventID(atoi(runStr.c_str()), atoi(lsStr.c_str()), 1));
92 }
static const IOVSyncValue & endOfTime()
Definition: IOVSyncValue.cc:97
static const IOVSyncValue & beginOfTime()
#define str(s)
void RPAlignmentCorrectionsMethods::writeToXML ( const RPAlignmentCorrectionsDataSequence 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 301 of file RPAlignmentCorrectionsMethods.cc.

References Exception, iovValueToString(), AlCaHLTBitMon_ParallelJobs::p, and writeXMLBlock().

Referenced by RPAlignmentCorrectionsMethods(), and writeToXML().

303 {
304  FILE* rf = fopen( fileName.c_str(), "w" );
305  if ( !rf )
306  throw cms::Exception("RPAlignmentCorrectionsMethods") << "Cannot open file `" << fileName << "' to save alignments.";
307 
308  fprintf( rf, "<!-- Shifts in um, rotations in mrad. -->\n" );
309  fprintf( rf, "<xml DocumentType=\"AlignmentDescription\">\n" );
310 
311  // write all IOVs
312  for ( const auto &p : data )
313  {
314  fprintf( rf, "\t<iov first=\"%s\" last=\"%s\">\n",
315  iovValueToString(p.first.first()).c_str(),
316  iovValueToString(p.first.last()).c_str()
317  );
318 
319  writeXMLBlock( p.second, rf, precise, wrErrors, wrSh_xy, wrSh_z, wrRot_xy, wrRot_z );
320 
321  fprintf( rf, "\t</iov>\n" );
322  }
323 
324  fprintf( rf, "</xml>\n" );
325  fclose( rf );
326 }
static void writeXMLBlock(const RPAlignmentCorrectionsData &, 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
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
static std::string iovValueToString(const edm::IOVSyncValue &)
static void RPAlignmentCorrectionsMethods::writeToXML ( const RPAlignmentCorrectionsData 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

writes alignment corrections into a single XML file, assigning infinite interval of validity

Definition at line 34 of file RPAlignmentCorrectionsMethods.h.

References edm::IOVSyncValue::beginOfTime(), data, edm::IOVSyncValue::endOfTime(), f, getCorrectionsData(), RPAlignmentCorrectionsDataSequence::insert(), iovValueToString(), hiDetachedQuadStep_cff::precise, alignCSCRings::s, AlCaHLTBitMon_QueryRunRegistry::string, stringToIOVValue(), writeToXML(), writeXML(), and writeXMLBlock().

37  {
40  s.insert(iov, ad);
41  writeToXML(s, fileName, precise, wrErrors, wrSh_xy, wrSh_z, wrRot_xy, wrRot_z);
42  }
static void writeToXML(const RPAlignmentCorrectionsDataSequence &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
Time sequence of alignment corrections. I/O methods have been factored out to: Geometry/VeryForwardGe...
static const IOVSyncValue & endOfTime()
Definition: IOVSyncValue.cc:97
void insert(const edm::ValidityInterval &iov, const RPAlignmentCorrectionsData &data)
static const IOVSyncValue & beginOfTime()
void RPAlignmentCorrectionsMethods::writeXML ( const RPAlignmentCorrectionData 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 416 of file RPAlignmentCorrectionsMethods.cc.

References RPAlignmentCorrectionData::getRotX(), RPAlignmentCorrectionData::getRotXUnc(), RPAlignmentCorrectionData::getRotY(), RPAlignmentCorrectionData::getRotYUnc(), RPAlignmentCorrectionData::getRotZ(), RPAlignmentCorrectionData::getRotZUnc(), RPAlignmentCorrectionData::getShX(), RPAlignmentCorrectionData::getShXUnc(), RPAlignmentCorrectionData::getShY(), RPAlignmentCorrectionData::getShYUnc(), RPAlignmentCorrectionData::getShZ(), RPAlignmentCorrectionData::getShZUnc(), and WRITE.

Referenced by writeToXML(), and writeXMLBlock().

418 {
419  if ( wrSh_xy )
420  {
421  WRITE( data.getShX(), "sh_x", 2, 0.1 );
422  WRITE( data.getShY(), "sh_y", 2, 0.1 );
423  if ( wrErrors )
424  {
425  WRITE( data.getShXUnc(), "sh_x_e", 2, 0.1 );
426  WRITE( data.getShYUnc(), "sh_y_e", 2, 0.1 );
427  }
428  }
429 
430  if ( wrSh_z )
431  {
432  WRITE( data.getShZ(), "sh_z", 2, 0.1 );
433  if ( wrErrors )
434  {
435  WRITE( data.getShZUnc(), "sh_z_e", 2, 0.1 );
436  }
437  }
438 
439  if ( wrRot_xy )
440  {
441  WRITE( data.getRotX(), "rot_x", 3, 0.01 );
442  WRITE( data.getRotY(), "rot_y", 3, 0.01 );
443  if ( wrErrors )
444  {
445  WRITE( data.getRotXUnc(), "rot_x_e", 3, 0.01 );
446  WRITE( data.getRotYUnc(), "rot_y_e", 3, 0.01 );
447  }
448  }
449 
450  if ( wrRot_z )
451  {
452  WRITE( data.getRotZ(), "rot_z", 3, 0.01 );
453  if ( wrErrors )
454  {
455  WRITE( data.getRotZUnc(), "rot_z_e", 3, 0.01 );
456  }
457  }
458 }
#define WRITE(q, tag, dig, lim)
void RPAlignmentCorrectionsMethods::writeXMLBlock ( const RPAlignmentCorrectionsData 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 331 of file RPAlignmentCorrectionsMethods.cc.

References CTPPSDetId::arm(), CTPPSDetId::getRPId(), RPAlignmentCorrectionsData::getRPMap(), RPAlignmentCorrectionsData::getSensorMap(), CTPPSPixelDetId::plane(), TotemRPDetId::plane(), CTPPSDiamondDetId::plane(), CTPPSDetId::rp(), CTPPSDetId::sdTimingDiamond, CTPPSDetId::sdTrackingPixel, CTPPSDetId::sdTrackingStrip, CTPPSDetId::station(), DetId::subdetId(), and writeXML().

Referenced by writeToXML().

333 {
334  bool firstRP = true;
335  unsigned int prevRP = 0;
336  std::set<unsigned int> writtenRPs;
337 
338  const auto &sensors = data.getSensorMap();
339  const auto &rps = data.getRPMap();
340 
341  for (auto it = sensors.begin(); it != sensors.end(); ++it)
342  {
343  CTPPSDetId sensorId(it->first);
344  unsigned int rpId = sensorId.getRPId();
345  unsigned int decRPId = sensorId.arm()*100 + sensorId.station()*10 + sensorId.rp();
346 
347  // start a RP block
348  if (firstRP || prevRP != rpId)
349  {
350  if (!firstRP)
351  fprintf(rf, "\n");
352  firstRP = false;
353 
354  fprintf(rf, "\t<!-- RP %3u -->\n", decRPId);
355 
356  auto rit = rps.find(rpId);
357  if (rit != rps.end())
358  {
359  fprintf(rf, "\t<rp id=\"%u\" ", rit->first);
360  writeXML( rit->second , rf, precise, wrErrors, wrSh_xy, wrSh_z, wrRot_xy, wrRot_z );
361  fprintf(rf, "/>\n");
362  writtenRPs.insert(rpId);
363  }
364  }
365  prevRP = rpId;
366 
367  // write plane id
368  unsigned int planeIdx = 1000;
369  if (sensorId.subdetId() == CTPPSDetId::sdTrackingStrip) planeIdx = TotemRPDetId(it->first).plane();
370  if (sensorId.subdetId() == CTPPSDetId::sdTrackingPixel) planeIdx = CTPPSPixelDetId(it->first).plane();
371  if (sensorId.subdetId() == CTPPSDetId::sdTimingDiamond) planeIdx = CTPPSDiamondDetId(it->first).plane();
372  fprintf(rf, "\t<!-- plane %u --> ", planeIdx);
373 
374  // write the correction
375  fprintf(rf, "<det id=\"%u\"", it->first);
376  writeXML(it->second, rf, precise, wrErrors, wrSh_xy, wrSh_z, wrRot_xy, wrRot_z);
377  fprintf(rf, "/>\n");
378  }
379 
380  // write remaining RPs
381  for (auto it = rps.begin(); it != rps.end(); ++it)
382  {
383  std::set<unsigned int>::iterator wit = writtenRPs.find(it->first);
384  if (wit == writtenRPs.end())
385  {
386  CTPPSDetId rpId(it->first);
387  unsigned int decRPId = rpId.arm()*100 + rpId.station()*10 + rpId.rp();
388 
389  if (!firstRP)
390  fprintf(rf, "\n");
391  firstRP = false;
392 
393  fprintf(rf, "\t<!-- RP %3u -->\n", decRPId);
394 
395  fprintf(rf, "\t<rp id=\"%u\" ", it->first);
396  writeXML(it->second, rf, precise, wrErrors, wrSh_xy, wrSh_z, wrRot_xy, wrRot_z);
397  fprintf(rf, "/>\n");
398  }
399  }
400 }
Detector ID class for TOTEM Si strip detectors.
Definition: TotemRPDetId.h:30
uint32_t plane() const
uint32_t plane() const
Definition: TotemRPDetId.h:49
const mapType & getRPMap() const
returns the map of RP alignment corrections
static void writeXML(const RPAlignmentCorrectionData &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
uint32_t plane() const
const mapType & getSensorMap() const
returns the map of sensor alignment corrections
Base class for CTPPS detector IDs.
Definition: CTPPSDetId.h:32
Detector ID class for CTPPS Timing Diamond detectors. Bits [19:31] : Assigend in CTPPSDetId Calss Bit...