CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
LASGeometryUpdater Class Reference

#include <LASGeometryUpdater.h>

Public Member Functions

void ApplyBeamKinkCorrections (LASGlobalData< LASCoordinateSet > &) const
 
void EndcapUpdate (LASEndcapAlignmentParameterSet &, LASGlobalData< LASCoordinateSet > &)
 
 LASGeometryUpdater (LASGlobalData< LASCoordinateSet > &, LASConstants &)
 
void SetMisalignmentFromRefGeometry (bool)
 
void SetReverseDirection (bool)
 
void TrackerUpdate (LASEndcapAlignmentParameterSet &, LASBarrelAlignmentParameterSet &, AlignableTracker &)
 

Private Attributes

bool isMisalignmentFromRefGeometry
 
bool isReverseDirection
 
LASConstants lasConstants
 
LASGlobalData< LASCoordinateSetnominalCoordinates
 

Detailed Description

Definition at line 17 of file LASGeometryUpdater.h.

Constructor & Destructor Documentation

LASGeometryUpdater::LASGeometryUpdater ( LASGlobalData< LASCoordinateSet > &  aNominalCoordinates,
LASConstants aLasConstants 
)

constructor providing access to the nominal coordinates and the constants - for the moment, both objects are passed here, later it should be sufficient to pass only the constants and to fill the nominalCoordinates locally from that

Definition at line 11 of file LASGeometryUpdater.cc.

References aNominalCoordinates, isMisalignmentFromRefGeometry, isReverseDirection, lasConstants, and nominalCoordinates.

11  {
12 
14  isReverseDirection = false;
16  lasConstants = aLasConstants;
17 
18 }
LASGlobalData< LASCoordinateSet > * aNominalCoordinates
LASConstants lasConstants
LASGlobalData< LASCoordinateSet > nominalCoordinates

Member Function Documentation

void LASGeometryUpdater::ApplyBeamKinkCorrections ( LASGlobalData< LASCoordinateSet > &  measuredCoordinates) const

this function reads the beam kinks from the lasConstants and applies them to the set of measured global phi positions

first we apply the endcap beamsplitter kink corrections for TEC+/- in one go

alignment tube beamsplitter & mirror kink corrections TBD.

Definition at line 28 of file LASGeometryUpdater.cc.

References EcalCondDBWriter_cfi::beam, LASConstants::GetEndcapBsKink(), LASCoordinateSet::GetPhi(), LASConstants::GetTecBsZPosition(), LASGlobalData< T >::GetTECEntry(), LASConstants::GetTecRadius(), LASConstants::GetTecZPosition(), lasConstants, relativeConstraints::ring, LASCoordinateSet::SetPhi(), and funct::tan().

Referenced by LaserAlignment::endRunProduce().

28  {
29 
32  for( unsigned int det = 0; det < 2; ++det ) {
33  for( unsigned int ring = 0; ring < 2; ++ring ) {
34  for( unsigned int beam = 0; beam < 8; ++beam ) {
35 
36  // corrections have different sign for TEC+/-
37  const double endcapSign = det==0 ? 1.: -1.;
38 
39  // the correction is applied to the last 4 disks
40  for( unsigned int disk = 5; disk < 9; ++disk ) {
41 
42  measuredCoordinates.GetTECEntry( det, ring, beam, disk ).SetPhi(
43  measuredCoordinates.GetTECEntry( det, ring, beam, disk ).GetPhi() -
45  ( lasConstants.GetTecZPosition( det, disk ) - endcapSign * lasConstants.GetTecBsZPosition( det ) )
46  );
47 
48  }
49  }
50  }
51  }
52 
53 
56 
57 }
void SetPhi(double aPhi)
double GetTecRadius(unsigned int ring) const
Definition: LASConstants.cc:92
double GetPhi(void) const
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
LASConstants lasConstants
double GetEndcapBsKink(unsigned int det, unsigned int ring, unsigned int beam) const
Definition: LASConstants.cc:58
T & GetTECEntry(int subdetector, int tecRing, int beam, int tecDisk)
Definition: LASGlobalData.h:91
double GetTecZPosition(unsigned int det, unsigned int disk) const
double GetTecBsZPosition(unsigned int det) const
void LASGeometryUpdater::EndcapUpdate ( LASEndcapAlignmentParameterSet endcapParameters,
LASGlobalData< LASCoordinateSet > &  measuredCoordinates 
)

apply the endcap alignment parameters in the LASEndcapAlignmentParameterSet to the Measurements (TEC2TEC only) and the AlignableTracker object

Definition at line 68 of file LASGeometryUpdater.cc.

References EcalCondDBWriter_cfi::beam, funct::cos(), LASEndcapAlignmentParameterSet::GetDiskParameter(), LASCoordinateSet::GetPhi(), LASGlobalData< T >::GetTEC2TECEntry(), nominalCoordinates, CosmicsPD_Skims::radius, LASCoordinateSet::SetPhi(), funct::sin(), and LASGlobalLoop::TEC2TECLoop().

Referenced by LaserAlignment::endRunProduce().

68  {
69 
70  // radius of TEC ring4 laser in mm
71  const double radius = 564.;
72 
73  // loop objects and its variables
74  LASGlobalLoop moduleLoop;
75  int det = 0, beam = 0, disk = 0;
76 
77 
78 
79  // update the TEC2TEC measurements
80  do {
81 
82  // the measured phi value for this module
83  const double currentPhi = measuredCoordinates.GetTEC2TECEntry( det, beam, disk ).GetPhi();
84 
85  // the correction to phi from the endcap algorithm;
86  // it is defined such that the correction is to be subtracted
87  double phiCorrection = 0.;
88 
89  // plain phi component
90  phiCorrection -= endcapParameters.GetDiskParameter( det, disk, 0 ).first;
91 
92  // phi component from x deviation
93  phiCorrection += sin( nominalCoordinates.GetTEC2TECEntry( det, beam, disk ).GetPhi() ) / radius * endcapParameters.GetDiskParameter( det, disk, 1 ).first;
94 
95  // phi component from y deviation
96  phiCorrection -= cos( nominalCoordinates.GetTEC2TECEntry( det, beam, disk ).GetPhi() ) / radius * endcapParameters.GetDiskParameter( det, disk, 2 ).first;
97 
98  measuredCoordinates.GetTEC2TECEntry( det, beam, disk ).SetPhi( currentPhi - phiCorrection );
99 
100  } while( moduleLoop.TEC2TECLoop( det, beam, disk ) );
101 
102 }
void SetPhi(double aPhi)
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
double GetPhi(void) const
bool TEC2TECLoop(int &, int &, int &) const
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
std::pair< double, double > & GetDiskParameter(int aSubdetector, int aDisk, int aParameter)
T & GetTEC2TECEntry(int subdetector, int beam, int tecDisk)
LASGlobalData< LASCoordinateSet > nominalCoordinates
void LASGeometryUpdater::SetMisalignmentFromRefGeometry ( bool  isSet)

Definition at line 333 of file LASGeometryUpdater.cc.

References isMisalignmentFromRefGeometry.

Referenced by LaserAlignment::endRunProduce().

333  {
334 
336 
337 }
void LASGeometryUpdater::SetReverseDirection ( bool  isSet)

Definition at line 320 of file LASGeometryUpdater.cc.

References isReverseDirection.

Referenced by LaserAlignment::endRunProduce().

320  {
321 
322  isReverseDirection = isSet;
323 
324 }
void LASGeometryUpdater::TrackerUpdate ( LASEndcapAlignmentParameterSet endcapParameters,
LASBarrelAlignmentParameterSet barrelParameters,
AlignableTracker theAlignableTracker 
)

merge the output from endcap and barrel algorithms and update the AlignableTracker object

the AlignableTracker input object is expected to be perfectly aligned!!

Definition at line 114 of file LASGeometryUpdater.cc.

References AlignableTracker::endCaps(), LASEndcapAlignmentParameterSet::GetDiskParameter(), LASBarrelAlignmentParameterSet::GetParameter(), AlignableTracker::innerHalfBarrels(), isMisalignmentFromRefGeometry, isReverseDirection, and AlignableTracker::outerHalfBarrels().

Referenced by LaserAlignment::endRunProduce().

116  {
117 
118 
119  // this constant defines the sense of *ALL* translations/rotations
120  // of the alignables in the AlignableTracker object
121  const int direction = ( isReverseDirection || isMisalignmentFromRefGeometry ) ? -1 : 1;
122 
123  // first, we access the half barrels of TIB and TOB
124  const align::Alignables& theOuterHalfBarrels = theAlignableTracker.outerHalfBarrels();
125  const align::Alignables& theInnerHalfBarrels = theAlignableTracker.innerHalfBarrels();
126 
127  // then the TECs and treat them also as half barrels
128  const align::Alignables& theEndcaps = theAlignableTracker.endCaps();
129 
130  // re-arrange to match the structure in LASBarrelAlignmentParameterSet and simplify the loop
131  // 2 (TIB+), 3 (TIB-), 4 (TOB+), 5 (TOB-)
132  std::vector<Alignable*> theHalfBarrels( 6 );
133  theHalfBarrels.at( 0 ) = theEndcaps.at( 0 ); // TEC+
134  theHalfBarrels.at( 1 ) = theEndcaps.at( 1 ); // TEC-
135  theHalfBarrels.at( 2 ) = theInnerHalfBarrels.at( 1 ); // TIB+
136  theHalfBarrels.at( 3 ) = theInnerHalfBarrels.at( 0 ); // TIB-
137  theHalfBarrels.at( 4 ) = theOuterHalfBarrels.at( 1 ); // TOB+
138  theHalfBarrels.at( 5 ) = theOuterHalfBarrels.at( 0 ); // TOB-
139 
140  // the z positions of the lower/upper-z halfbarrel_end_faces / outer_TEC_disks (in mm)
141  // indices are: halfbarrel (0-5), endface(0=lowerZ,1=upperZ)
142  std::vector<std::vector<double> > halfbarrelEndfaceZPositions( 6, std::vector<double>( 2, 0. ) );
143  halfbarrelEndfaceZPositions.at( 0 ).at( 0 ) = 1322.5;
144  halfbarrelEndfaceZPositions.at( 0 ).at( 1 ) = 2667.5;
145  halfbarrelEndfaceZPositions.at( 1 ).at( 0 ) = -2667.5;
146  halfbarrelEndfaceZPositions.at( 1 ).at( 1 ) = -1322.5;
147  halfbarrelEndfaceZPositions.at( 2 ).at( 0 ) = 300.;
148  halfbarrelEndfaceZPositions.at( 2 ).at( 1 ) = 700.;
149  halfbarrelEndfaceZPositions.at( 3 ).at( 0 ) = -700.;
150  halfbarrelEndfaceZPositions.at( 3 ).at( 1 ) = -300.;
151  halfbarrelEndfaceZPositions.at( 4 ).at( 0 ) = 300.;
152  halfbarrelEndfaceZPositions.at( 4 ).at( 1 ) = 1090.;
153  halfbarrelEndfaceZPositions.at( 5 ).at( 0 ) = -1090.;
154  halfbarrelEndfaceZPositions.at( 5 ).at( 1 ) = -300.;
155 
156  // z difference of half barrel end faces (= hb-length) in mm
157  // do all this geometry stuff more intelligent later..
158  std::vector<double> theBarrelLength( 6, 0. );
159  theBarrelLength.at( 0 ) = 1345.; // TEC
160  theBarrelLength.at( 1 ) = 1345.;
161  theBarrelLength.at( 2 ) = 400.; // TIB
162  theBarrelLength.at( 3 ) = 400.;
163  theBarrelLength.at( 4 ) = 790.; // TOB
164  theBarrelLength.at( 5 ) = 790.;
165 
166 
167  // the halfbarrel centers as defined in the AlignableTracker object,
168  // needed for offset corrections; code to be improved later
169  std::vector<double> theHalfbarrelCenters( 6, 0. );
170  for( int halfbarrel = 0; halfbarrel < 6; ++halfbarrel ) {
171  theHalfbarrelCenters.at( halfbarrel ) = theHalfBarrels.at( halfbarrel )->globalPosition().z() * 10.; // in mm
172  }
173 
174 
175 
176  // mm to cm conversion factor (use by division)
177  const double fromMmToCm = 10.;
178 
179  // half barrel loop (no TECs -> det>1)
180  for( int halfBarrel = 2; halfBarrel < 6; ++halfBarrel ) {
181 
182  // A word on the factors of -1 in the below move/rotate statements:
183  //
184  // Since it is not possible to misalign simulated low-level objects like SiStripDigis in CMSSW,
185  // LAS monte carlo digis are always ideally aligned, and misalignment is introduced
186  // by displacing the reference geometry (AlignableTracker) instead which is used for stripNumber->phi conversion.
187  // Hence, in case MC are used in that way, factors of -1 must be introduced
188  // for rotations around x,y and translations in x,y. The variable "xyDirection" takes care of this.
189  //
190  // However, for rotations around z (phi) there is a complication:
191  // in the analytical AlignmentTubeAlgorithm, the alignment parameter phi (z-rotation)
192  // is defined such that a positive value results in a positive contribution to the residual. In the real detector,
193  // the opposite is true. The resulting additional factor of -1 thus compensates for the abovementioned reference geometry effect.
194  //
195  // this behavior can be reversed using the "direction" factor.
196 
197 
198  // rotation around x axis = (dy1-dy2)/L
199  const align::Scalar rxLocal = ( barrelParameters.GetParameter( halfBarrel, 0, 2 ).first - barrelParameters.GetParameter( halfBarrel, 1, 2 ).first ) / theBarrelLength.at( halfBarrel );
200  theHalfBarrels.at( halfBarrel )->rotateAroundLocalX( direction * rxLocal );
201 
202  // rotation around y axis = (dx2-dx1)/L
203  const align::Scalar ryLocal = ( barrelParameters.GetParameter( halfBarrel, 1, 1 ).first - barrelParameters.GetParameter( halfBarrel, 0, 1 ).first ) / theBarrelLength.at( halfBarrel );
204  theHalfBarrels.at( halfBarrel )->rotateAroundLocalY( direction * ryLocal );
205 
206  // average rotation around z axis = (dphi1+dphi2)/2
207  const align::Scalar rzLocal = ( barrelParameters.GetParameter( halfBarrel, 0, 0 ).first + barrelParameters.GetParameter( halfBarrel, 1, 0 ).first ) / 2.;
208  theHalfBarrels.at( halfBarrel )->rotateAroundLocalZ( -1. * direction * rzLocal ); // this is phi, additional -1 here, see comment above
209 
210  // now that the rotational displacements are removed, the remaining translational offsets can be corrected for.
211  // for this, the effect of the rotations is subtracted from the measured endface offsets
212 
213  // @@@ the +/-/-/+ signs for the correction parameters are not yet fully understood -
214  // @@@ do they flip when switching from reference-geometry-misalignment to true misalignment???
215  std::vector<double> correctedEndfaceOffsetsX( 2, 0. ); // lowerZ/upperZ endface
216  correctedEndfaceOffsetsX.at( 0 ) = barrelParameters.GetParameter( halfBarrel, 0, 1 ).first
217  + ( theHalfbarrelCenters.at( halfBarrel ) - halfbarrelEndfaceZPositions.at( halfBarrel ).at( 0 ) ) * ryLocal;
218  correctedEndfaceOffsetsX.at( 1 ) = barrelParameters.GetParameter( halfBarrel, 1, 1 ).first
219  - ( halfbarrelEndfaceZPositions.at( halfBarrel ).at( 1 ) - theHalfbarrelCenters.at( halfBarrel ) ) * ryLocal;
220 
221  std::vector<double> correctedEndfaceOffsetsY( 2, 0. ); // lowerZ/upperZ endface
222  correctedEndfaceOffsetsY.at( 0 ) = barrelParameters.GetParameter( halfBarrel, 0, 2 ).first
223  - ( theHalfbarrelCenters.at( halfBarrel ) - halfbarrelEndfaceZPositions.at( halfBarrel ).at( 0 ) ) * rxLocal;
224  correctedEndfaceOffsetsY.at( 1 ) = barrelParameters.GetParameter( halfBarrel, 1, 2 ).first
225  + ( halfbarrelEndfaceZPositions.at( halfBarrel ).at( 1 ) - theHalfbarrelCenters.at( halfBarrel ) ) * rxLocal;
226 
227  // average x displacement = (cd1+cd2)/2
228  const align::GlobalVector dxLocal( ( correctedEndfaceOffsetsX.at( 0 ) + correctedEndfaceOffsetsX.at( 1 ) ) / 2. / fromMmToCm, 0., 0. );
229  theHalfBarrels.at( halfBarrel )->move( direction * ( dxLocal ) );
230 
231  // average y displacement = (cd1+cd2)/s
232  const align::GlobalVector dyLocal( 0., ( correctedEndfaceOffsetsY.at( 0 ) + correctedEndfaceOffsetsY.at( 1 ) ) / 2. / fromMmToCm, 0. );
233  theHalfBarrels.at( halfBarrel )->move( direction * ( dyLocal ) );
234 
235  }
236 
237 
238  // now fit the endcaps into that alignment tube frame. the strategy is the following:
239  //
240  // 1. apply the parameters from the endcap algorithm to the individual disks
241  // 2. the tec as a whole is rotated and moved such that the innermost disk (1) (= halfbarrel inner endface)
242  // reaches the position determined by the barrel algorithm.
243  // 3. then, the TEC is twisted and sheared until the outermost disk (9) reaches nominal position
244  // (since it has been fixed there in the alignment tube frame). this resolves any common
245  // shear and torsion within the TEC coordinate frame.
246 
247 
248  // shortcut to the z positions of the disks' mechanical structures (TEC+/-, 9*disk)
249  std::vector<std::vector<double> > wheelZPositions( 2, std::vector<double>( 9, 0. ) );
250  for( int wheel = 0; wheel < 9; ++wheel ) {
251  wheelZPositions.at( 0 ).at( wheel ) = theEndcaps.at( 0 )->components().at( wheel )->globalPosition().z();
252  wheelZPositions.at( 1 ).at( wheel ) = theEndcaps.at( 1 )->components().at( wheel )->globalPosition().z();
253  }
254 
255 
256  // we can do this for both TECs in one go;
257  // only real difference is the index change in the second argument to barrelParameters::GetParameter:
258  // here the disk index changes from 0(+) to 1(-), since the end faces are sorted according to z (-->side=det)
259 
260  for( int det = 0; det < 2; ++det ) {
261 
262  const int& side = det;
263 
264  // step 1: apply the endcap algorithm parameters
265 
266  // factors of -1. within the move/rotate statements: see comment above.
267  // difference here: in the the endcap algorithm, the alignment parameter phi (z-rotation) is defined
268  // in the opposite sense compared with the AT algorithm, thus the factor of -1 applies also to phi rotations.
269 
270  for( int wheel = 0; wheel < 9; ++wheel ) {
271  theEndcaps.at( det )->components().at( wheel )->rotateAroundLocalZ( direction * endcapParameters.GetDiskParameter( det, wheel, 0 ).first );
272  const align::GlobalVector dXY( endcapParameters.GetDiskParameter( det, wheel, 1 ).first / fromMmToCm, endcapParameters.GetDiskParameter( det, wheel, 2 ).first / fromMmToCm, 0. );
273  theEndcaps.at( det )->components().at( wheel )->move( direction * dXY );
274  }
275 
276 
277 
278  // step 2: attach the innermost disk (disk 1) by rotating/moving the complete endcap
279 
280  // rotation around z of disk 1
281  const align::Scalar dphi1 = barrelParameters.GetParameter( det, side, 0 ).first;
282  theEndcaps.at( det )->rotateAroundLocalZ( -1. * direction * dphi1 ); // dphi1 is from the AT algorithm, so additional sign (s.above)
283 
284  // displacement in x,y of disk 1
285  const align::GlobalVector dxy1( barrelParameters.GetParameter( det, side, 1 ).first / fromMmToCm,
286  barrelParameters.GetParameter( det, side, 2 ).first / fromMmToCm,
287  0. );
288  theEndcaps.at( det )->move( direction * dxy1 );
289 
290 
291 
292 
293  // determine the resulting phi, x, y of disk 9 after step 2
294  // the wrong sign for TEC- is soaked up by the reducedZ in step 3
295  const align::Scalar resultingPhi9 = barrelParameters.GetParameter( det, 1, 0 ).first - barrelParameters.GetParameter( det, 0, 0 ).first;
296  const align::GlobalVector resultingXY9( ( barrelParameters.GetParameter( det, 1, 1 ).first - barrelParameters.GetParameter( det, 0, 1 ).first ) / fromMmToCm,
297  ( barrelParameters.GetParameter( det, 1, 2 ).first - barrelParameters.GetParameter( det, 0, 2 ).first ) / fromMmToCm,
298  0. );
299 
300  // step 3: twist and shear back
301 
302  // the individual rotation/movement of the wheels is a function of their z-position
303  for( int wheel = 0; wheel < 9; ++wheel ) {
304  const double reducedZ = ( wheelZPositions.at( det ).at( wheel ) - wheelZPositions.at( det ).at( 0 ) ) / theBarrelLength.at( det ) * fromMmToCm;
305  theEndcaps.at( det )->components().at( wheel )->rotateAroundLocalZ( -1. * direction * reducedZ * resultingPhi9 ); // twist
306  theEndcaps.at( det )->components().at( wheel )->move( direction * reducedZ * resultingXY9 ); // shear
307  }
308 
309  }
310 
311 }
std::pair< double, double > & GetParameter(int aSubdetector, int aDisk, int aParameter)
double Scalar
Definition: Definitions.h:27
Alignables & endCaps()
Return TECs.
std::pair< double, double > & GetDiskParameter(int aSubdetector, int aDisk, int aParameter)
std::vector< Alignable * > Alignables
Definition: Utilities.h:28
Alignables & innerHalfBarrels()
Return TIB half barrels.
Alignables & outerHalfBarrels()
Return TOB half barrels.

Member Data Documentation

bool LASGeometryUpdater::isMisalignmentFromRefGeometry
private
bool LASGeometryUpdater::isReverseDirection
private

Definition at line 30 of file LASGeometryUpdater.h.

Referenced by LASGeometryUpdater(), SetReverseDirection(), and TrackerUpdate().

LASConstants LASGeometryUpdater::lasConstants
private

Definition at line 29 of file LASGeometryUpdater.h.

Referenced by ApplyBeamKinkCorrections(), and LASGeometryUpdater().

LASGlobalData<LASCoordinateSet> LASGeometryUpdater::nominalCoordinates
private

Definition at line 28 of file LASGeometryUpdater.h.

Referenced by EndcapUpdate(), and LASGeometryUpdater().