CMS 3D CMS Logo

CTPPSRPAlignmentCorrectionsData.cc
Go to the documentation of this file.
1 /****************************************************************************
2  *
3  * This is a part of CMS-TOTEM PPSoffline software.
4  * Authors:
5  * Jan Kašpar (jan.kaspar@gmail.com)
6  * adapted for CondFormats by H. Malbouisson & C. Mora Herrera
7  ****************************************************************************/
8 
10 
13 
14 #include <set>
15 
16 //----------------------------------------------------------------------------------------------------
17 
20 {
21  return rps_[id];
22 }
23 
24 //----------------------------------------------------------------------------------------------------
25 
28 {
30  auto it = rps_.find( id );
31  if ( it != rps_.end() )
32  align_corr = it->second;
33  return align_corr;
34 }
35 
36 //----------------------------------------------------------------------------------------------------
37 
40 {
41  return sensors_[id];
42 }
43 
44 //----------------------------------------------------------------------------------------------------
45 
48 {
50  auto it = sensors_.find( id );
51  if ( it != sensors_.end() )
52  align_corr = it->second;
53  return align_corr;
54 }
55 
56 //----------------------------------------------------------------------------------------------------
57 
59 CTPPSRPAlignmentCorrectionsData::getFullSensorCorrection( unsigned int id, bool useRPErrors ) const
60 {
62 
63  // try to get alignment correction of the full RP
64  auto rpIt = rps_.find( CTPPSDetId( id ).getRPId() );
65  if ( rpIt != rps_.end() )
66  align_corr = rpIt->second;
67 
68  // try to get sensor alignment correction
69  auto sIt = sensors_.find( id );
70 
71  // merge the corrections
72  if ( sIt != sensors_.end() )
73  align_corr.add( sIt->second, useRPErrors );
74 
75  return align_corr;
76 }
77 
78 //----------------------------------------------------------------------------------------------------
79 
80 void
82 {
83  rps_[id] = ac;
84 }
85 
86 //----------------------------------------------------------------------------------------------------
87 
88 void
90 {
91  sensors_[id] = ac;
92 }
93 
94 //----------------------------------------------------------------------------------------------------
95 
96 void
97 CTPPSRPAlignmentCorrectionsData::addRPCorrection( unsigned int id, const CTPPSRPAlignmentCorrectionData &a, bool sumErrors, bool addSh, bool addRot )
98 {
99  auto it = rps_.find( id );
100  if ( it == rps_.end() )
101  rps_.insert( mapType::value_type( id, a ) );
102  else
103  it->second.add( a, sumErrors, addSh, addRot );
104 }
105 
106 //----------------------------------------------------------------------------------------------------
107 
108 void
109 CTPPSRPAlignmentCorrectionsData::addSensorCorrection( unsigned int id, const CTPPSRPAlignmentCorrectionData &a, bool sumErrors, bool addSh, bool addRot )
110 {
111  auto it = sensors_.find( id );
112  if ( it == sensors_.end() )
113  sensors_.insert( mapType::value_type( id, a ) );
114  else
115  it->second.add( a, sumErrors, addSh, addRot );
116 }
117 
118 //----------------------------------------------------------------------------------------------------
119 
120 void
121 CTPPSRPAlignmentCorrectionsData::addCorrections( const CTPPSRPAlignmentCorrectionsData &nac, bool sumErrors, bool addSh, bool addRot )
122 {
123  for ( const auto& it : nac.rps_ )
124  addRPCorrection( it.first, it.second, sumErrors, addSh, addRot );
125 
126  for ( const auto& it : nac.sensors_ )
127  addSensorCorrection( it.first, it.second, sumErrors, addSh, addRot );
128 }
129 
130 //----------------------------------------------------------------------------------------------------
131 
132 void
134 {
135  rps_.clear();
136  sensors_.clear();
137 }
138 
139 //----------------------------------------------------------------------------------------------------
140 
141 std::ostream& operator<<(std::ostream& s, const CTPPSRPAlignmentCorrectionsData &corr)
142 {
143  for (const auto &p : corr.getRPMap())
144  {
145  s << "RP " << p.first << ": " << p.second << std::endl;
146  }
147 
148  for (const auto &p : corr.getSensorMap())
149  {
150  s << "sensor " << p.first << ": " << p.second << std::endl;
151  }
152 
153  return s;
154 }
155 
156 //----------------------------------------------------------------------------------------------------
void addSensorCorrection(unsigned int, const CTPPSRPAlignmentCorrectionData &, bool sumErrors=true, bool addSh=true, bool addRot=true)
adds (merges) a RP correction on top of the current value
CTPPSRPAlignmentCorrectionData & getRPCorrection(unsigned int id)
returns the correction value from the RP map
void setRPCorrection(unsigned int id, const CTPPSRPAlignmentCorrectionData &ac)
sets the alignment correction for the given RP
const mapType & getRPMap() const
returns the map of RP alignment corrections
CTPPSRPAlignmentCorrectionData & getSensorCorrection(unsigned int id)
returns the correction value from the sensor map
std::ostream & operator<<(std::ostream &s, const CTPPSRPAlignmentCorrectionsData &corr)
void addRPCorrection(unsigned int, const CTPPSRPAlignmentCorrectionData &, bool sumErrors=true, bool addSh=true, bool addRot=true)
CTPPSRPAlignmentCorrectionData getFullSensorCorrection(unsigned int id, bool useRPErrors=false) const
JetCorrectorParameters corr
Definition: classes.h:5
const mapType & getSensorMap() const
returns the map of sensor alignment corrections
void addCorrections(const CTPPSRPAlignmentCorrectionsData &, bool sumErrors=true, bool addSh=true, bool addRot=true)
adds (merges) corrections on top of the current values
mapType rps_
alignment correction maps
Base class for CTPPS detector IDs.
Definition: CTPPSDetId.h:32
Container for CTPPS RP alignment corrections. The corrections are stored on two levels - RP and senso...
double a
Definition: hdecay.h:121
void setSensorCorrection(unsigned int id, const CTPPSRPAlignmentCorrectionData &ac)
sets the alignment correction for the given sensor
void add(const CTPPSRPAlignmentCorrectionData &, bool sumErrors=true, bool addSh=true, bool addRot=true)
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.