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
DetGeomDesc::applyAlignment
void applyAlignment(const CTPPSRPAlignmentCorrectionData &)
Definition: DetGeomDesc.cc:81
mps_fire.i
i
Definition: mps_fire.py:428
DDD_CTPPS_UFSD_SEGMENT_NAME
const std::string DDD_CTPPS_UFSD_SEGMENT_NAME
Definition: CTPPSDDDNames.h:18
DDD_CTPPS_PIXELS_SENSOR_NAME
const std::string DDD_CTPPS_PIXELS_SENSOR_NAME
Definition: CTPPSDDDNames.h:14
DetGeomDesc::addComponent
void addComponent(DetGeomDesc *)
Definition: DetGeomDesc.cc:79
DDD_CTPPS_PIXELS_RP_NAME
const std::string DDD_CTPPS_PIXELS_RP_NAME
Definition: CTPPSDDDNames.h:23
DDD_TOTEM_TIMING_RP_NAME
const std::string DDD_TOTEM_TIMING_RP_NAME
Definition: CTPPSDDDNames.h:26
CTPPSGeometryESCommon.h
DDD_CTPPS_DIAMONDS_SEGMENT_NAME
const std::string DDD_CTPPS_DIAMONDS_SEGMENT_NAME
Definition: CTPPSDDDNames.h:17
CTPPSRPAlignmentCorrectionsData::getRPCorrection
CTPPSRPAlignmentCorrectionData & getRPCorrection(unsigned int id)
returns the correction value from the RP map
Definition: CTPPSRPAlignmentCorrectionsData.cc:17
DetGeomDesc::geographicalID
DetId geographicalID() const
Definition: DetGeomDesc.h:97
DDD_CTPPS_PIXELS_SENSOR_NAME_2x2
const std::string DDD_CTPPS_PIXELS_SENSOR_NAME_2x2
Definition: CTPPSDDDNames.h:15
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
DetGeomDesc::cmWithoutChildren
Definition: DetGeomDesc.h:64
DetGeomDesc::components
const Container & components() const
Definition: DetGeomDesc.h:100
DDD_CTPPS_DIAMONDS_RP_NAME
const std::string DDD_CTPPS_DIAMONDS_RP_NAME
Definition: CTPPSDDDNames.h:25
DetGeomDesc::name
const std::string & name() const
Definition: DetGeomDesc.h:68
DDD_TOTEM_TIMING_SENSOR_TMPL
const std::string DDD_TOTEM_TIMING_SENSOR_TMPL
Definition: CTPPSDDDNames.h:19
DetGeomDesc
Definition: DetGeomDesc.h:49
DDD_TOTEM_RP_RP_NAME
const std::string DDD_TOTEM_RP_RP_NAME
DDD names of RP volumes.
Definition: CTPPSDDDNames.h:22
CTPPSGeometryESCommon::applyAlignments
std::unique_ptr< DetGeomDesc > applyAlignments(const DetGeomDesc &, const CTPPSRPAlignmentCorrectionsData *)
Definition: CTPPSGeometryESCommon.cc:6
CTPPSDDDNames.h
CTPPSGeometryESCommon
Definition: CTPPSGeometryESCommon.h:4
profile_2016_postTS2_cff.rpId
rpId
Definition: profile_2016_postTS2_cff.py:21
DDD_TOTEM_RP_SENSOR_NAME
const std::string DDD_TOTEM_RP_SENSOR_NAME
DDD names of sensors.
Definition: CTPPSDDDNames.h:13
CTPPSRPAlignmentCorrectionsData
Container for CTPPS RP alignment corrections. The corrections are stored on two levels - RP and senso...
Definition: CTPPSRPAlignmentCorrectionsData.h:24
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
CTPPSRPAlignmentCorrectionsData::getFullSensorCorrection
CTPPSRPAlignmentCorrectionData getFullSensorCorrection(unsigned int id, bool useRPErrors=false) const
Definition: CTPPSRPAlignmentCorrectionsData.cc:47