CMS 3D CMS Logo

CTPPSGeometryESCommon.cc
Go to the documentation of this file.
3 
4 namespace CTPPSGeometryESCommon {
5 
6  std::unique_ptr<DetGeomDesc> applyAlignments(const DetGeomDesc& idealDetRoot,
7  const CTPPSRPAlignmentCorrectionsData* alignments) {
8  std::deque<const DetGeomDesc*> bufferIdealGeo;
9  bufferIdealGeo.emplace_back(&idealDetRoot);
10 
11  std::deque<DetGeomDesc*> bufferAlignedGeo;
12  DetGeomDesc* alignedDetRoot = new DetGeomDesc(idealDetRoot, DetGeomDesc::cmWithoutChildren);
13  bufferAlignedGeo.emplace_back(alignedDetRoot);
14 
15  while (!bufferIdealGeo.empty()) {
16  const DetGeomDesc* idealDet = bufferIdealGeo.front();
17  DetGeomDesc* alignedDet = bufferAlignedGeo.front();
18  bufferIdealGeo.pop_front();
19  bufferAlignedGeo.pop_front();
20 
21  const std::string name = alignedDet->name();
22 
23  // Is it sensor? If yes, apply full sensor alignments
27  std::regex_match(name, std::regex(DDD_TOTEM_TIMING_SENSOR_TMPL))) {
28  unsigned int plId = alignedDet->geographicalID();
29 
30  if (alignments) {
31  const auto& ac = alignments->getFullSensorCorrection(plId);
32  alignedDet->applyAlignment(ac);
33  }
34  }
35 
36  // Is it RP box? If yes, apply RP alignments
39  unsigned int rpId = alignedDet->geographicalID();
40 
41  if (alignments) {
42  const auto& ac = alignments->getRPCorrection(rpId);
43  alignedDet->applyAlignment(ac);
44  }
45  }
46 
47  // create and add children
48  const auto& idealDetChildren = idealDet->components();
49  for (unsigned int i = 0; i < idealDetChildren.size(); i++) {
50  const DetGeomDesc* idealDetChild = idealDetChildren[i];
51  bufferIdealGeo.emplace_back(idealDetChild);
52 
53  // create new node with the same information as in idealDetChild and add it as a child of alignedDet
54  DetGeomDesc* alignedDetChild = new DetGeomDesc(*idealDetChild, DetGeomDesc::cmWithoutChildren);
55  alignedDet->addComponent(alignedDetChild);
56 
57  bufferAlignedGeo.emplace_back(alignedDetChild);
58  }
59  }
60  return std::unique_ptr<DetGeomDesc>(alignedDetRoot);
61  }
62 
63 } // namespace CTPPSGeometryESCommon
const std::string DDD_CTPPS_PIXELS_RP_NAME
Definition: CTPPSDDDNames.h:24
CTPPSRPAlignmentCorrectionData & getRPCorrection(unsigned int id)
returns the correction value from the RP map
void applyAlignment(const CTPPSRPAlignmentCorrectionData &)
Definition: DetGeomDesc.cc:114
DetId geographicalID() const
Definition: DetGeomDesc.h:102
std::unique_ptr< DetGeomDesc > applyAlignments(const DetGeomDesc &, const CTPPSRPAlignmentCorrectionsData *)
const std::string DDD_TOTEM_TIMING_RP_NAME
Definition: CTPPSDDDNames.h:27
const std::string DDD_CTPPS_PIXELS_SENSOR_NAME_2x2
Definition: CTPPSDDDNames.h:16
const std::string DDD_CTPPS_DIAMONDS_SEGMENT_NAME
Definition: CTPPSDDDNames.h:18
CTPPSRPAlignmentCorrectionData getFullSensorCorrection(unsigned int id, bool useRPErrors=false) const
const Container & components() const
Definition: DetGeomDesc.h:105
const std::string DDD_TOTEM_TIMING_SENSOR_TMPL
Definition: CTPPSDDDNames.h:20
const std::string DDD_TOTEM_RP_RP_NAME
DDD names of RP volumes.
Definition: CTPPSDDDNames.h:23
const std::string DDD_CTPPS_DIAMONDS_RP_NAME
Definition: CTPPSDDDNames.h:26
const std::string & name() const
Definition: DetGeomDesc.h:73
Container for CTPPS RP alignment corrections. The corrections are stored on two levels - RP and senso...
const std::string DDD_TOTEM_RP_SENSOR_NAME
DDD names of sensors.
Definition: CTPPSDDDNames.h:14
const std::string DDD_CTPPS_PIXELS_SENSOR_NAME
Definition: CTPPSDDDNames.h:15
void addComponent(DetGeomDesc *)
Definition: DetGeomDesc.cc:112
const std::string DDD_CTPPS_UFSD_SEGMENT_NAME
Definition: CTPPSDDDNames.h:19