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 20 of file TrackerAlignment.cc.

References edm::EventSetup::get(), edm::ESHandle< class >::product(), and theAlignableTracker.

20  :
21  theAlignRecordName( "TrackerAlignmentRcd" ),
22  theErrorRecordName( "TrackerAlignmentErrorExtendedRcd" )
23 {
24 
25  //Retrieve tracker topology from geometry
27  setup.get<TrackerTopologyRcd>().get(tTopoHandle);
28  const TrackerTopology* const tTopo = tTopoHandle.product();
29 
30  edm::ESHandle<TrackerGeometry> trackerGeometry;
31  setup.get<TrackerDigiGeometryRecord>().get( trackerGeometry );
32  theAlignableTracker = new AlignableTracker( &(*trackerGeometry), tTopo );
33 
34 }
std::string theAlignRecordName
std::string theErrorRecordName
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:86
AlignableTracker * theAlignableTracker
TrackerAlignment::~TrackerAlignment ( void  )

Definition at line 39 of file TrackerAlignment.cc.

References theAlignableTracker.

40 {
41 
42  delete theAlignableTracker;
43 
44 }
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 83 of file TrackerAlignment.cc.

References AlignableTracker::endcapGeomDets(), and theAlignableTracker.

83  {
84 
85  // Displace and rotate EndCaps
86  const align::Alignables& theEndCapsAlignables = theAlignableTracker->endcapGeomDets();
87  for ( align::Alignables::const_iterator iter = theEndCapsAlignables.begin();
88  iter != theEndCapsAlignables.end(); ++iter ){
89 
90  // Get the raw ID of the associated GeomDet
91  int id = (*iter)->geomDetId().rawId();
92 
93  // Select the given module
94  if ( id == rawid ){
95 
96  // Convert local to global diplacements
97  align::LocalVector lvector( local_displacements.at(0), local_displacements.at(1), local_displacements.at(2));
98  align::GlobalVector gvector = ((*iter)->surface()).toGlobal( lvector );
99 
100  // global displacement
101  (*iter)->move( gvector );
102 
103  // local rotation
104  (*iter)->rotateAroundLocalX( local_rotations.at(0) ); // Local X axis rotation
105  (*iter)->rotateAroundLocalY( local_rotations.at(1) ); // Local Y axis rotation
106  (*iter)->rotateAroundLocalZ( local_rotations.at(2) ); // Local Z axis rotation
107 
108  }
109  }
110 }
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 173 of file TrackerAlignment.cc.

References AlignableTracker::innerBarrelGeomDets(), and theAlignableTracker.

173  {
174 
175  // Displace and rotate InnerHalfBarrels
176  const align::Alignables& theInnerHalfBarrelsAlignables = theAlignableTracker->innerBarrelGeomDets();
177  for ( align::Alignables::const_iterator iter = theInnerHalfBarrelsAlignables.begin();
178  iter != theInnerHalfBarrelsAlignables.end(); ++iter ){
179 
180  // Get the raw ID of the associated GeomDet
181  int id = (*iter)->geomDetId().rawId();
182 
183  // Select the given module
184  if ( id == rawid ){
185 
186  // Convert local to global diplacements
187  align::LocalVector lvector( local_displacements.at(0), local_displacements.at(1), local_displacements.at(2));
188  align::GlobalVector gvector = ((*iter)->surface()).toGlobal( lvector );
189 
190  // global displacement
191  (*iter)->move( gvector );
192 
193  // local rotation
194  (*iter)->rotateAroundLocalX( local_rotations.at(0) ); // Local X axis rotation
195  (*iter)->rotateAroundLocalY( local_rotations.at(1) ); // Local Y axis rotation
196  (*iter)->rotateAroundLocalZ( local_rotations.at(2) ); // Local Z axis rotation
197 
198  }
199  }
200 }
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 143 of file TrackerAlignment.cc.

References AlignableTracker::outerBarrelGeomDets(), and theAlignableTracker.

143  {
144 
145  // Displace and rotate OuterHalfBarrels
146  const align::Alignables& theOuterHalfBarrelsAlignables = theAlignableTracker->outerBarrelGeomDets();
147  for ( align::Alignables::const_iterator iter = theOuterHalfBarrelsAlignables.begin();
148  iter != theOuterHalfBarrelsAlignables.end(); ++iter ){
149 
150  // Get the raw ID of the associated GeomDet
151  int id = (*iter)->geomDetId().rawId();
152 
153  // Select the given module
154  if ( id == rawid ){
155 
156  // Convert local to global diplacements
157  align::LocalVector lvector( local_displacements.at(0), local_displacements.at(1), local_displacements.at(2));
158  align::GlobalVector gvector = ((*iter)->surface()).toGlobal( lvector );
159 
160  // global displacement
161  (*iter)->move( gvector );
162 
163  // local rotation
164  (*iter)->rotateAroundLocalX( local_rotations.at(0) ); // Local X axis rotation
165  (*iter)->rotateAroundLocalY( local_rotations.at(1) ); // Local Y axis rotation
166  (*iter)->rotateAroundLocalZ( local_rotations.at(2) ); // Local Z axis rotation
167 
168  }
169  }
170 }
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 49 of file TrackerAlignment.cc.

References AlignableTracker::pixelEndcapGeomDets(), and theAlignableTracker.

52 {
53 
54  // Displace and rotate pixelEndCaps
55  const align::Alignables& thePixelEndCapsAlignables = theAlignableTracker->pixelEndcapGeomDets();
56  for ( align::Alignables::const_iterator iter = thePixelEndCapsAlignables.begin();
57  iter != thePixelEndCapsAlignables.end(); ++iter )
58  {
59 
60  // Get the raw ID of the associated GeomDet
61  int id = (*iter)->geomDetId().rawId();
62 
63  // Select the given module
64  if ( id == rawid ){
65 
66  // Convert local to global diplacements
67  align::LocalVector lvector( local_displacements.at(0), local_displacements.at(1), local_displacements.at(2));
68  align::GlobalVector gvector = ((*iter)->surface()).toGlobal( lvector );
69 
70  // global displacement
71  (*iter)->move( gvector );
72 
73  // local rotation
74  (*iter)->rotateAroundLocalX( local_rotations.at(0) ); // Local X axis rotation
75  (*iter)->rotateAroundLocalY( local_rotations.at(1) ); // Local Y axis rotation
76  (*iter)->rotateAroundLocalZ( local_rotations.at(2) ); // Local Z axis rotation
77 
78  }
79  }
80 }
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 113 of file TrackerAlignment.cc.

References AlignableTracker::pixelHalfBarrelGeomDets(), and theAlignableTracker.

113  {
114 
115  // Displace and rotate PixelHalfBarrels
116  const align::Alignables& thePixelHalfBarrelsAlignables = theAlignableTracker->pixelHalfBarrelGeomDets();
117  for ( align::Alignables::const_iterator iter = thePixelHalfBarrelsAlignables.begin();
118  iter != thePixelHalfBarrelsAlignables.end(); ++iter ){
119 
120  // Get the raw ID of the associated GeomDet
121  int id = (*iter)->geomDetId().rawId();
122 
123  // Select the given module
124  if ( id == rawid ){
125 
126  // Convert local to global diplacements
127  align::LocalVector lvector( local_displacements.at(0), local_displacements.at(1), local_displacements.at(2));
128  align::GlobalVector gvector = ((*iter)->surface()).toGlobal( lvector );
129 
130  // global displacement
131  (*iter)->move( gvector );
132 
133  // local rotation
134  (*iter)->rotateAroundLocalX( local_rotations.at(0) ); // Local X axis rotation
135  (*iter)->rotateAroundLocalY( local_rotations.at(1) ); // Local Y axis rotation
136  (*iter)->rotateAroundLocalZ( local_rotations.at(2) ); // Local Z axis rotation
137 
138  }
139  }
140 }
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 234 of file TrackerAlignment.cc.

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

Referenced by SurveyDataConverter::applyFineSurveyInfo().

234  {
235 
236  // Displace and rotate TIB and TID
237  const align::Alignables& theTIBTIDAlignables = theAlignableTracker->TIBTIDGeomDets();
238  for ( align::Alignables::const_iterator iter = theTIBTIDAlignables.begin();
239  iter != theTIBTIDAlignables.end(); ++iter )
240  {
241 
242  // Get the raw ID of the associated GeomDet
243  int id = (*iter)->geomDetId().rawId();
244 
245  // Select the given module
246  if ( id == rawId ){
247 
248  // global displacement
249  align::GlobalVector gvector (globalDisplacements.at(0), globalDisplacements.at(1), globalDisplacements.at(2));
250  (*iter)->move( gvector );
251 
252  // global rotation
253  if (toAndFro) {
254  align::RotationType theResultRotation = backwardRotation*forwardRotation.transposed();
255  (*iter)->rotateInGlobalFrame( theResultRotation );
256  } else {
257  (*iter)->rotateInGlobalFrame( backwardRotation );
258  }
259  }
260  }
261 }
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 203 of file TrackerAlignment.cc.

References theAlignableTracker, and AlignableTracker::TIDGeomDets().

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

Definition at line 266 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().

266  {
267 
268  // Output POOL-ORA objects
270  if( !poolDbService.isAvailable() ) // Die if not available
271  throw cms::Exception("NotAvailable") << "PoolDBOutputService not available";
272 
273  // Retrieve and store
274  Alignments* alignments = theAlignableTracker->alignments();
276 
277 // if ( poolDbService->isNewTagRequest(theAlignRecordName) )
278 // poolDbService->createNewIOV<Alignments>( alignments, poolDbService->endOfTime(),
279 // theAlignRecordName );
280 // else
281 // poolDbService->appendSinceTime<Alignments>( alignments, poolDbService->currentTime(),
282 // theAlignRecordName );
283  poolDbService->writeOne<Alignments>(alignments, poolDbService->currentTime(),
285 // if ( poolDbService->isNewTagRequest(theErrorRecordName) )
286 // poolDbService->createNewIOV<AlignmentErrorsExtended>( alignmentErrors,
287 // poolDbService->endOfTime(),
288 // theErrorRecordName );
289 // else
290 // poolDbService->appendSinceTime<AlignmentErrorsExtended>( alignmentErrors,
291 // poolDbService->currentTime(),
292 // theErrorRecordName );
293  poolDbService->writeOne<AlignmentErrorsExtended>(alignmentErrors, poolDbService->currentTime(),
295 }
AlignmentErrorsExtended * alignmentErrors() const
Return alignment errors, sorted by DetId.
std::string theAlignRecordName
bool isAvailable() const
Definition: Service.h:46
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().