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(), edm::ESHandle< class >::product(), and theAlignableTracker.

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

Definition at line 38 of file TrackerAlignment.cc.

References theAlignableTracker.

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

References AlignableTracker::endcapGeomDets(), getDQMSummary::iter, and theAlignableTracker.

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

References AlignableTracker::innerBarrelGeomDets(), getDQMSummary::iter, and theAlignableTracker.

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

References getDQMSummary::iter, AlignableTracker::outerBarrelGeomDets(), and theAlignableTracker.

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

References getDQMSummary::iter, AlignableTracker::pixelEndcapGeomDets(), and theAlignableTracker.

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

References getDQMSummary::iter, AlignableTracker::pixelHalfBarrelGeomDets(), and theAlignableTracker.

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

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

Referenced by SurveyDataConverter::applyFineSurveyInfo().

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

References getDQMSummary::iter, theAlignableTracker, and AlignableTracker::TIDGeomDets().

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

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

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