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
TrackerAlignment Class Reference

#include <TrackerAlignment.h>

Public Member Functions

AlignableTrackergetAlignableTracker ()
 
void moveAlignableEndCaps (int rawId, const align::Scalars &localDisplacements, const align::Scalars &localRotations)
 
void moveAlignableInnerHalfBarrels (int rawId, const align::Scalars &localDisplacements, const align::Scalars &localRotations)
 
void moveAlignableOuterHalfBarrels (int rawId, const align::Scalars &localDisplacements, const align::Scalars &localRotations)
 
void moveAlignablePixelEndCaps (int rawId, const align::Scalars &localDisplacements, const align::Scalars &localRotations)
 
void moveAlignablePixelHalfBarrels (int rawId, const align::Scalars &localDisplacements, const align::Scalars &localRotations)
 
void moveAlignableTIBTIDs (int rawId, const align::Scalars &globalDisplacements, const align::RotationType &backwardRotation, const align::RotationType &forwardRotation, bool toAndFro)
 
void moveAlignableTIDs (int rawId, const align::Scalars &localDisplacements, const align::Scalars &localRotations)
 
void saveToDB ()
 
 TrackerAlignment (const edm::EventSetup &setup)
 
 ~TrackerAlignment ()
 

Private Attributes

AlignableTrackertheAlignableTracker
 
std::string theAlignRecordName
 
std::string theErrorRecordName
 

Detailed Description

The TrackerAlignment helper class for alignment jobs

Author
Nhan Tran

Definition at line 15 of file TrackerAlignment.h.

Constructor & Destructor Documentation

TrackerAlignment::TrackerAlignment ( const edm::EventSetup setup)

Definition at line 19 of file TrackerAlignment.cc.

References edm::EventSetup::get(), and theAlignableTracker.

19  :
20  theAlignRecordName( "TrackerAlignmentRcd" ),
21  theErrorRecordName( "TrackerAlignmentErrorRcd" )
22 {
23 
24  edm::ESHandle<TrackerGeometry> trackerGeometry;
25  setup.get<TrackerDigiGeometryRecord>().get( trackerGeometry );
26  theAlignableTracker = new AlignableTracker( &(*trackerGeometry) );
27 
28 }
std::string theAlignRecordName
std::string theErrorRecordName
const T & get() const
Definition: EventSetup.h:55
AlignableTracker * theAlignableTracker
TrackerAlignment::~TrackerAlignment ( void  )

Definition at line 33 of file TrackerAlignment.cc.

References theAlignableTracker.

34 {
35 
36  delete theAlignableTracker;
37 
38 }
AlignableTracker * theAlignableTracker

Member Function Documentation

AlignableTracker* TrackerAlignment::getAlignableTracker ( )
inline

Definition at line 23 of file TrackerAlignment.h.

References theAlignableTracker.

Referenced by SurveyDataConverter::applyAPEs(), and SurveyDataConverter::applyCoarseSurveyInfo().

23 { return theAlignableTracker; }
AlignableTracker * theAlignableTracker
void TrackerAlignment::moveAlignableEndCaps ( int  rawId,
const align::Scalars localDisplacements,
const align::Scalars localRotations 
)

Definition at line 77 of file TrackerAlignment.cc.

References AlignableTracker::endcapGeomDets(), and theAlignableTracker.

77  {
78 
79  // Displace and rotate EndCaps
80  const align::Alignables& theEndCapsAlignables = theAlignableTracker->endcapGeomDets();
81  for ( align::Alignables::const_iterator iter = theEndCapsAlignables.begin();
82  iter != theEndCapsAlignables.end(); ++iter ){
83 
84  // Get the raw ID of the associated GeomDet
85  int id = (*iter)->geomDetId().rawId();
86 
87  // Select the given module
88  if ( id == rawid ){
89 
90  // Convert local to global diplacements
91  align::LocalVector lvector( local_displacements.at(0), local_displacements.at(1), local_displacements.at(2));
92  align::GlobalVector gvector = ((*iter)->surface()).toGlobal( lvector );
93 
94  // global displacement
95  (*iter)->move( gvector );
96 
97  // local rotation
98  (*iter)->rotateAroundLocalX( local_rotations.at(0) ); // Local X axis rotation
99  (*iter)->rotateAroundLocalY( local_rotations.at(1) ); // Local Y axis rotation
100  (*iter)->rotateAroundLocalZ( local_rotations.at(2) ); // Local Z axis rotation
101 
102  }
103  }
104 }
Alignables & endcapGeomDets()
Return endcap GeomDets.
std::vector< Alignable * > Alignables
Definition: Utilities.h:28
AlignableTracker * theAlignableTracker
void TrackerAlignment::moveAlignableInnerHalfBarrels ( int  rawId,
const align::Scalars localDisplacements,
const align::Scalars localRotations 
)

Definition at line 167 of file TrackerAlignment.cc.

References AlignableTracker::innerBarrelGeomDets(), and theAlignableTracker.

167  {
168 
169  // Displace and rotate InnerHalfBarrels
170  const align::Alignables& theInnerHalfBarrelsAlignables = theAlignableTracker->innerBarrelGeomDets();
171  for ( align::Alignables::const_iterator iter = theInnerHalfBarrelsAlignables.begin();
172  iter != theInnerHalfBarrelsAlignables.end(); ++iter ){
173 
174  // Get the raw ID of the associated GeomDet
175  int id = (*iter)->geomDetId().rawId();
176 
177  // Select the given module
178  if ( id == rawid ){
179 
180  // Convert local to global diplacements
181  align::LocalVector lvector( local_displacements.at(0), local_displacements.at(1), local_displacements.at(2));
182  align::GlobalVector gvector = ((*iter)->surface()).toGlobal( lvector );
183 
184  // global displacement
185  (*iter)->move( gvector );
186 
187  // local rotation
188  (*iter)->rotateAroundLocalX( local_rotations.at(0) ); // Local X axis rotation
189  (*iter)->rotateAroundLocalY( local_rotations.at(1) ); // Local Y axis rotation
190  (*iter)->rotateAroundLocalZ( local_rotations.at(2) ); // Local Z axis rotation
191 
192  }
193  }
194 }
Alignables & innerBarrelGeomDets()
Return inner barrel GeomDets.
std::vector< Alignable * > Alignables
Definition: Utilities.h:28
AlignableTracker * theAlignableTracker
void TrackerAlignment::moveAlignableOuterHalfBarrels ( int  rawId,
const align::Scalars localDisplacements,
const align::Scalars localRotations 
)

Definition at line 137 of file TrackerAlignment.cc.

References AlignableTracker::outerBarrelGeomDets(), and theAlignableTracker.

137  {
138 
139  // Displace and rotate OuterHalfBarrels
140  const align::Alignables& theOuterHalfBarrelsAlignables = theAlignableTracker->outerBarrelGeomDets();
141  for ( align::Alignables::const_iterator iter = theOuterHalfBarrelsAlignables.begin();
142  iter != theOuterHalfBarrelsAlignables.end(); ++iter ){
143 
144  // Get the raw ID of the associated GeomDet
145  int id = (*iter)->geomDetId().rawId();
146 
147  // Select the given module
148  if ( id == rawid ){
149 
150  // Convert local to global diplacements
151  align::LocalVector lvector( local_displacements.at(0), local_displacements.at(1), local_displacements.at(2));
152  align::GlobalVector gvector = ((*iter)->surface()).toGlobal( lvector );
153 
154  // global displacement
155  (*iter)->move( gvector );
156 
157  // local rotation
158  (*iter)->rotateAroundLocalX( local_rotations.at(0) ); // Local X axis rotation
159  (*iter)->rotateAroundLocalY( local_rotations.at(1) ); // Local Y axis rotation
160  (*iter)->rotateAroundLocalZ( local_rotations.at(2) ); // Local Z axis rotation
161 
162  }
163  }
164 }
Alignables & outerBarrelGeomDets()
Return outer barrel GeomDets.
std::vector< Alignable * > Alignables
Definition: Utilities.h:28
AlignableTracker * theAlignableTracker
void TrackerAlignment::moveAlignablePixelEndCaps ( int  rawId,
const align::Scalars localDisplacements,
const align::Scalars localRotations 
)

Definition at line 43 of file TrackerAlignment.cc.

References AlignableTracker::pixelEndcapGeomDets(), and theAlignableTracker.

46 {
47 
48  // Displace and rotate pixelEndCaps
49  const align::Alignables& thePixelEndCapsAlignables = theAlignableTracker->pixelEndcapGeomDets();
50  for ( align::Alignables::const_iterator iter = thePixelEndCapsAlignables.begin();
51  iter != thePixelEndCapsAlignables.end(); ++iter )
52  {
53 
54  // Get the raw ID of the associated GeomDet
55  int id = (*iter)->geomDetId().rawId();
56 
57  // Select the given module
58  if ( id == rawid ){
59 
60  // Convert local to global diplacements
61  align::LocalVector lvector( local_displacements.at(0), local_displacements.at(1), local_displacements.at(2));
62  align::GlobalVector gvector = ((*iter)->surface()).toGlobal( lvector );
63 
64  // global displacement
65  (*iter)->move( gvector );
66 
67  // local rotation
68  (*iter)->rotateAroundLocalX( local_rotations.at(0) ); // Local X axis rotation
69  (*iter)->rotateAroundLocalY( local_rotations.at(1) ); // Local Y axis rotation
70  (*iter)->rotateAroundLocalZ( local_rotations.at(2) ); // Local Z axis rotation
71 
72  }
73  }
74 }
Alignables & pixelEndcapGeomDets()
Return pixel endcap GeomDets.
std::vector< Alignable * > Alignables
Definition: Utilities.h:28
AlignableTracker * theAlignableTracker
void TrackerAlignment::moveAlignablePixelHalfBarrels ( int  rawId,
const align::Scalars localDisplacements,
const align::Scalars localRotations 
)

Definition at line 107 of file TrackerAlignment.cc.

References AlignableTracker::pixelHalfBarrelGeomDets(), and theAlignableTracker.

107  {
108 
109  // Displace and rotate PixelHalfBarrels
110  const align::Alignables& thePixelHalfBarrelsAlignables = theAlignableTracker->pixelHalfBarrelGeomDets();
111  for ( align::Alignables::const_iterator iter = thePixelHalfBarrelsAlignables.begin();
112  iter != thePixelHalfBarrelsAlignables.end(); ++iter ){
113 
114  // Get the raw ID of the associated GeomDet
115  int id = (*iter)->geomDetId().rawId();
116 
117  // Select the given module
118  if ( id == rawid ){
119 
120  // Convert local to global diplacements
121  align::LocalVector lvector( local_displacements.at(0), local_displacements.at(1), local_displacements.at(2));
122  align::GlobalVector gvector = ((*iter)->surface()).toGlobal( lvector );
123 
124  // global displacement
125  (*iter)->move( gvector );
126 
127  // local rotation
128  (*iter)->rotateAroundLocalX( local_rotations.at(0) ); // Local X axis rotation
129  (*iter)->rotateAroundLocalY( local_rotations.at(1) ); // Local Y axis rotation
130  (*iter)->rotateAroundLocalZ( local_rotations.at(2) ); // Local Z axis rotation
131 
132  }
133  }
134 }
Alignables & pixelHalfBarrelGeomDets()
Return pixel barrel GeomDets.
std::vector< Alignable * > Alignables
Definition: Utilities.h:28
AlignableTracker * theAlignableTracker
void TrackerAlignment::moveAlignableTIBTIDs ( int  rawId,
const align::Scalars globalDisplacements,
const align::RotationType backwardRotation,
const align::RotationType forwardRotation,
bool  toAndFro 
)

Definition at line 228 of file TrackerAlignment.cc.

References theAlignableTracker, AlignableTracker::TIBTIDGeomDets(), and TkRotation< T >::transposed().

Referenced by SurveyDataConverter::applyFineSurveyInfo().

228  {
229 
230  // Displace and rotate TIB and TID
231  const align::Alignables& theTIBTIDAlignables = theAlignableTracker->TIBTIDGeomDets();
232  for ( align::Alignables::const_iterator iter = theTIBTIDAlignables.begin();
233  iter != theTIBTIDAlignables.end(); ++iter )
234  {
235 
236  // Get the raw ID of the associated GeomDet
237  int id = (*iter)->geomDetId().rawId();
238 
239  // Select the given module
240  if ( id == rawId ){
241 
242  // global displacement
243  align::GlobalVector gvector (globalDisplacements.at(0), globalDisplacements.at(1), globalDisplacements.at(2));
244  (*iter)->move( gvector );
245 
246  // global rotation
247  if (toAndFro) {
248  align::RotationType theResultRotation = backwardRotation*forwardRotation.transposed();
249  (*iter)->rotateInGlobalFrame( theResultRotation );
250  } else {
251  (*iter)->rotateInGlobalFrame( backwardRotation );
252  }
253  }
254  }
255 }
Alignables TIBTIDGeomDets()
Return inner barrel and TID GeomDets together.
std::vector< Alignable * > Alignables
Definition: Utilities.h:28
TkRotation transposed() const
AlignableTracker * theAlignableTracker
void TrackerAlignment::moveAlignableTIDs ( int  rawId,
const align::Scalars localDisplacements,
const align::Scalars localRotations 
)

Definition at line 197 of file TrackerAlignment.cc.

References theAlignableTracker, and AlignableTracker::TIDGeomDets().

197  {
198 
199  // Displace and rotate TIDs
200  const align::Alignables& theTIDsAlignables = theAlignableTracker->TIDGeomDets();
201  for ( align::Alignables::const_iterator iter = theTIDsAlignables.begin();
202  iter != theTIDsAlignables.end(); ++iter ){
203 
204  // Get the raw ID of the associated GeomDet
205  int id = (*iter)->geomDetId().rawId();
206 
207  // Select the given module
208  if ( id == rawid ){
209 
210  // Convert local to global diplacements
211  align::LocalVector lvector( local_displacements.at(0), local_displacements.at(1), local_displacements.at(2));
212  align::GlobalVector gvector = ((*iter)->surface()).toGlobal( lvector );
213 
214  // global displacement
215  (*iter)->move( gvector );
216 
217  // local rotation
218  (*iter)->rotateAroundLocalX( local_rotations.at(0) ); // Local X axis rotation
219  (*iter)->rotateAroundLocalY( local_rotations.at(1) ); // Local Y axis rotation
220  (*iter)->rotateAroundLocalZ( local_rotations.at(2) ); // Local Z axis rotation
221 
222  }
223  }
224 }
Alignables & TIDGeomDets()
Return TID GeomDets.
std::vector< Alignable * > Alignables
Definition: Utilities.h:28
AlignableTracker * theAlignableTracker
void TrackerAlignment::saveToDB ( void  )

Definition at line 260 of file TrackerAlignment.cc.

References AlignableTracker::alignmentErrors(), AlignableTracker::alignments(), cond::service::PoolDBOutputService::currentTime(), edm::Service< T >::isAvailable(), theAlignableTracker, theAlignRecordName, theErrorRecordName, and cond::service::PoolDBOutputService::writeOne().

Referenced by SurveyDataConverter::analyze().

260  {
261 
262  // Output POOL-ORA objects
264  if( !poolDbService.isAvailable() ) // Die if not available
265  throw cms::Exception("NotAvailable") << "PoolDBOutputService not available";
266 
267  // Retrieve and store
268  Alignments* alignments = theAlignableTracker->alignments();
270 
271 // if ( poolDbService->isNewTagRequest(theAlignRecordName) )
272 // poolDbService->createNewIOV<Alignments>( alignments, poolDbService->endOfTime(),
273 // theAlignRecordName );
274 // else
275 // poolDbService->appendSinceTime<Alignments>( alignments, poolDbService->currentTime(),
276 // theAlignRecordName );
277  poolDbService->writeOne<Alignments>(alignments, poolDbService->currentTime(),
279 // if ( poolDbService->isNewTagRequest(theErrorRecordName) )
280 // poolDbService->createNewIOV<AlignmentErrors>( alignmentErrors,
281 // poolDbService->endOfTime(),
282 // theErrorRecordName );
283 // else
284 // poolDbService->appendSinceTime<AlignmentErrors>( alignmentErrors,
285 // poolDbService->currentTime(),
286 // theErrorRecordName );
287  poolDbService->writeOne<AlignmentErrors>(alignmentErrors, poolDbService->currentTime(),
289 }
std::string theAlignRecordName
bool isAvailable() const
Definition: Service.h:47
AlignmentErrors * alignmentErrors() const
Return alignment errors, sorted by DetId.
void writeOne(T *payload, Time_t time, const std::string &recordName, bool withlogging=false)
std::string theErrorRecordName
AlignableTracker * theAlignableTracker
Alignments * alignments() const
Return alignments, sorted by DetId.

Member Data Documentation

AlignableTracker* TrackerAlignment::theAlignableTracker
private
std::string TrackerAlignment::theAlignRecordName
private

Definition at line 39 of file TrackerAlignment.h.

Referenced by saveToDB().

std::string TrackerAlignment::theErrorRecordName
private

Definition at line 39 of file TrackerAlignment.h.

Referenced by saveToDB().