00001
00002 #include "Alignment/LaserAlignment/src/LASGeometryUpdater.h"
00003
00004
00008 LASGeometryUpdater::LASGeometryUpdater() {
00009 }
00010
00011
00012
00013
00014
00021 void LASGeometryUpdater::Update( LASEndcapAlignmentParameterSet& endcapParameters,
00022 LASBarrelAlignmentParameterSet& barrelParameters,
00023 AlignableTracker& theAlignableTracker ) {
00024
00025
00026
00027 const align::Alignables& theOuterHalfBarrels = theAlignableTracker.outerHalfBarrels();
00028 const align::Alignables& theInnerHalfBarrels = theAlignableTracker.innerHalfBarrels();
00029
00030
00031 const align::Alignables& theEndcaps = theAlignableTracker.endCaps();
00032
00033
00034
00035 std::vector<Alignable*> theHalfBarrels( 6 );
00036 theHalfBarrels.at( 0 ) = theEndcaps.at( 0 );
00037 theHalfBarrels.at( 1 ) = theEndcaps.at( 1 );
00038 theHalfBarrels.at( 2 ) = theInnerHalfBarrels.at( 1 );
00039 theHalfBarrels.at( 3 ) = theInnerHalfBarrels.at( 0 );
00040 theHalfBarrels.at( 4 ) = theOuterHalfBarrels.at( 1 );
00041 theHalfBarrels.at( 5 ) = theOuterHalfBarrels.at( 0 );
00042
00043
00044
00045 std::vector<double> theBarrelLength( 6, 0. );
00046 theBarrelLength.at( 0 ) = 1348.65;
00047 theBarrelLength.at( 1 ) = 1348.65;
00048 theBarrelLength.at( 2 ) = 400.;
00049 theBarrelLength.at( 3 ) = 400.;
00050 theBarrelLength.at( 4 ) = 790.;
00051 theBarrelLength.at( 5 ) = 790.;
00052
00053
00054
00055 for( int halfBarrel = 2; halfBarrel < 6; ++halfBarrel ) {
00056
00057
00058 const align::GlobalVector dxLocal( ( barrelParameters.GetParameter( halfBarrel, 0, 0 ).first + barrelParameters.GetParameter( halfBarrel, 1, 0 ).first ) / 2., 0., 0. );
00059 theHalfBarrels.at( halfBarrel )->move( dxLocal );
00060
00061
00062 const align::GlobalVector dyLocal( 0., ( barrelParameters.GetParameter( halfBarrel, 0, 1 ).first + barrelParameters.GetParameter( halfBarrel, 1, 1 ).first ) / 2., 0. );
00063 theHalfBarrels.at( halfBarrel )->move( dyLocal );
00064
00065
00066 const align::Scalar rxLocal = ( barrelParameters.GetParameter( halfBarrel, 1, 2 ).first - barrelParameters.GetParameter( halfBarrel, 0, 2 ).first ) / theBarrelLength.at( halfBarrel );
00067 theHalfBarrels.at( halfBarrel )->rotateAroundLocalX( rxLocal );
00068
00069
00070 const align::Scalar ryLocal = ( barrelParameters.GetParameter( halfBarrel, 0, 1 ).first - barrelParameters.GetParameter( halfBarrel, 1, 1 ).first ) / theBarrelLength.at( halfBarrel );
00071 theHalfBarrels.at( halfBarrel )->rotateAroundLocalY( ryLocal );
00072
00073
00074 const align::Scalar rzLocal = ( barrelParameters.GetParameter( halfBarrel, 0, 0 ).first + barrelParameters.GetParameter( halfBarrel, 1, 0 ).first ) / 2.;
00075 theHalfBarrels.at( halfBarrel )->rotateAroundLocalZ( rzLocal );
00076
00077 }
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091 std::vector<std::vector<double> > wheelZPositions( 2, std::vector<double>( 9, 0. ) );
00092 for( int wheel = 0; wheel < 9; ++wheel ) {
00093 wheelZPositions.at( 0 ).at( wheel ) = 10. * theEndcaps.at( 0 )->components().at( wheel )->globalPosition().z();
00094 wheelZPositions.at( 1 ).at( wheel ) = 10. * theEndcaps.at( 1 )->components().at( wheel )->globalPosition().z();
00095 }
00096
00097
00098
00099
00100 for( int det = 0; det < 2; ++ det ) {
00101
00102 const int& side = det;
00103
00104
00105 for( int wheel = 0; wheel < 9; ++ wheel ) {
00106 theEndcaps.at( det )->components().at( wheel )->rotateAroundLocalZ( endcapParameters.GetParameter( det, wheel, 0 ).first );
00107 const align::GlobalVector dXY( endcapParameters.GetParameter( det, wheel, 1 ).first, endcapParameters.GetParameter( det, wheel, 2 ).first, 0. );
00108 theEndcaps.at( det )->components().at( wheel )->move( dXY );
00109 }
00110
00111
00112
00113
00114 const align::Scalar dphi1 = barrelParameters.GetParameter( det, side, 0 ).first - endcapParameters.GetParameter( det, 0, 0 ).first;
00115 theEndcaps.at( det )->rotateAroundLocalZ( dphi1 );
00116
00117
00118 const align::GlobalVector dxy1( barrelParameters.GetParameter( det, side, 1 ).first - endcapParameters.GetParameter( det, 0, 1 ).first,
00119 barrelParameters.GetParameter( det, side, 2 ).first - endcapParameters.GetParameter( det, 0, 2 ).first,
00120 0. );
00121 theEndcaps.at( det )->move( dxy1 );
00122
00123
00124 const align::Scalar resultingPhi9 = endcapParameters.GetParameter( det, 8, 0 ).first + dphi1;
00125 const align::GlobalVector resultingXY9( theEndcaps.at( det )->components().at( 8 )->globalPosition().x(),
00126 theEndcaps.at( det )->components().at( 8 )->globalPosition().y(),
00127 0. );
00128
00129
00130
00131
00132
00133 for( int wheel = 0; wheel < 9; ++wheel ) {
00134 const double reducedZ = fabs( wheelZPositions.at( det ).at( wheel ) - wheelZPositions.at( det ).at( 0 ) ) / theBarrelLength.at( det );
00135 theEndcaps.at( det )->components().at( wheel )->rotateAroundLocalZ( -1. * reducedZ * resultingPhi9 );
00136 theEndcaps.at( det )->components().at( wheel )->move( -1. * reducedZ * resultingXY9 );
00137 }
00138
00139 }
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154 }