CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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 TrackerTopology *tTopo, const TrackerGeometry *tGeom)
 
 ~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 19 of file TrackerAlignment.h.

Constructor & Destructor Documentation

TrackerAlignment::TrackerAlignment ( const TrackerTopology tTopo,
const TrackerGeometry tGeom 
)

Definition at line 20 of file TrackerAlignment.cc.

References theAlignableTracker.

21  : theAlignRecordName("TrackerAlignmentRcd"), theErrorRecordName("TrackerAlignmentErrorExtendedRcd") {
22  theAlignableTracker = new AlignableTracker(tGeom, tTopo);
23 }
std::string theAlignRecordName
std::string theErrorRecordName
AlignableTracker * theAlignableTracker
TrackerAlignment::~TrackerAlignment ( void  )

Definition at line 27 of file TrackerAlignment.cc.

References theAlignableTracker.

27 { delete theAlignableTracker; }
AlignableTracker * theAlignableTracker

Member Function Documentation

AlignableTracker* TrackerAlignment::getAlignableTracker ( )
inline

Definition at line 25 of file TrackerAlignment.h.

References theAlignableTracker.

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

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

Definition at line 60 of file TrackerAlignment.cc.

References AlignableTracker::endcapGeomDets(), and theAlignableTracker.

62  {
63  // Displace and rotate EndCaps
64  const align::Alignables& theEndCapsAlignables = theAlignableTracker->endcapGeomDets();
65  for (align::Alignables::const_iterator iter = theEndCapsAlignables.begin(); iter != theEndCapsAlignables.end();
66  ++iter) {
67  // Get the raw ID of the associated GeomDet
68  int id = (*iter)->geomDetId().rawId();
69 
70  // Select the given module
71  if (id == rawid) {
72  // Convert local to global diplacements
73  align::LocalVector lvector(local_displacements.at(0), local_displacements.at(1), local_displacements.at(2));
74  align::GlobalVector gvector = ((*iter)->surface()).toGlobal(lvector);
75 
76  // global displacement
77  (*iter)->move(gvector);
78 
79  // local rotation
80  (*iter)->rotateAroundLocalX(local_rotations.at(0)); // Local X axis rotation
81  (*iter)->rotateAroundLocalY(local_rotations.at(1)); // Local Y axis rotation
82  (*iter)->rotateAroundLocalZ(local_rotations.at(2)); // Local Z axis rotation
83  }
84  }
85 }
Alignables & endcapGeomDets()
Return endcap GeomDets.
std::vector< Alignable * > Alignables
Definition: Utilities.h:31
AlignableTracker * theAlignableTracker
void TrackerAlignment::moveAlignableInnerHalfBarrels ( int  rawId,
const align::Scalars localDisplacements,
const align::Scalars localRotations 
)

Definition at line 146 of file TrackerAlignment.cc.

References AlignableTracker::innerBarrelGeomDets(), and theAlignableTracker.

148  {
149  // Displace and rotate InnerHalfBarrels
150  const align::Alignables& theInnerHalfBarrelsAlignables = theAlignableTracker->innerBarrelGeomDets();
151  for (align::Alignables::const_iterator iter = theInnerHalfBarrelsAlignables.begin();
152  iter != theInnerHalfBarrelsAlignables.end();
153  ++iter) {
154  // Get the raw ID of the associated GeomDet
155  int id = (*iter)->geomDetId().rawId();
156 
157  // Select the given module
158  if (id == rawid) {
159  // Convert local to global diplacements
160  align::LocalVector lvector(local_displacements.at(0), local_displacements.at(1), local_displacements.at(2));
161  align::GlobalVector gvector = ((*iter)->surface()).toGlobal(lvector);
162 
163  // global displacement
164  (*iter)->move(gvector);
165 
166  // local rotation
167  (*iter)->rotateAroundLocalX(local_rotations.at(0)); // Local X axis rotation
168  (*iter)->rotateAroundLocalY(local_rotations.at(1)); // Local Y axis rotation
169  (*iter)->rotateAroundLocalZ(local_rotations.at(2)); // Local Z axis rotation
170  }
171  }
172 }
Alignables & innerBarrelGeomDets()
Return inner barrel GeomDets.
std::vector< Alignable * > Alignables
Definition: Utilities.h:31
AlignableTracker * theAlignableTracker
void TrackerAlignment::moveAlignableOuterHalfBarrels ( int  rawId,
const align::Scalars localDisplacements,
const align::Scalars localRotations 
)

Definition at line 117 of file TrackerAlignment.cc.

References AlignableTracker::outerBarrelGeomDets(), and theAlignableTracker.

119  {
120  // Displace and rotate OuterHalfBarrels
121  const align::Alignables& theOuterHalfBarrelsAlignables = theAlignableTracker->outerBarrelGeomDets();
122  for (align::Alignables::const_iterator iter = theOuterHalfBarrelsAlignables.begin();
123  iter != theOuterHalfBarrelsAlignables.end();
124  ++iter) {
125  // Get the raw ID of the associated GeomDet
126  int id = (*iter)->geomDetId().rawId();
127 
128  // Select the given module
129  if (id == rawid) {
130  // Convert local to global diplacements
131  align::LocalVector lvector(local_displacements.at(0), local_displacements.at(1), local_displacements.at(2));
132  align::GlobalVector gvector = ((*iter)->surface()).toGlobal(lvector);
133 
134  // global displacement
135  (*iter)->move(gvector);
136 
137  // local rotation
138  (*iter)->rotateAroundLocalX(local_rotations.at(0)); // Local X axis rotation
139  (*iter)->rotateAroundLocalY(local_rotations.at(1)); // Local Y axis rotation
140  (*iter)->rotateAroundLocalZ(local_rotations.at(2)); // Local Z axis rotation
141  }
142  }
143 }
Alignables & outerBarrelGeomDets()
Return outer barrel GeomDets.
std::vector< Alignable * > Alignables
Definition: Utilities.h:31
AlignableTracker * theAlignableTracker
void TrackerAlignment::moveAlignablePixelEndCaps ( int  rawId,
const align::Scalars localDisplacements,
const align::Scalars localRotations 
)

Definition at line 31 of file TrackerAlignment.cc.

References AlignableTracker::pixelEndcapGeomDets(), and theAlignableTracker.

33  {
34  // Displace and rotate pixelEndCaps
35  const align::Alignables& thePixelEndCapsAlignables = theAlignableTracker->pixelEndcapGeomDets();
36  for (align::Alignables::const_iterator iter = thePixelEndCapsAlignables.begin();
37  iter != thePixelEndCapsAlignables.end();
38  ++iter) {
39  // Get the raw ID of the associated GeomDet
40  int id = (*iter)->geomDetId().rawId();
41 
42  // Select the given module
43  if (id == rawid) {
44  // Convert local to global diplacements
45  align::LocalVector lvector(local_displacements.at(0), local_displacements.at(1), local_displacements.at(2));
46  align::GlobalVector gvector = ((*iter)->surface()).toGlobal(lvector);
47 
48  // global displacement
49  (*iter)->move(gvector);
50 
51  // local rotation
52  (*iter)->rotateAroundLocalX(local_rotations.at(0)); // Local X axis rotation
53  (*iter)->rotateAroundLocalY(local_rotations.at(1)); // Local Y axis rotation
54  (*iter)->rotateAroundLocalZ(local_rotations.at(2)); // Local Z axis rotation
55  }
56  }
57 }
Alignables & pixelEndcapGeomDets()
Return pixel endcap GeomDets.
std::vector< Alignable * > Alignables
Definition: Utilities.h:31
AlignableTracker * theAlignableTracker
void TrackerAlignment::moveAlignablePixelHalfBarrels ( int  rawId,
const align::Scalars localDisplacements,
const align::Scalars localRotations 
)

Definition at line 88 of file TrackerAlignment.cc.

References AlignableTracker::pixelHalfBarrelGeomDets(), and theAlignableTracker.

90  {
91  // Displace and rotate PixelHalfBarrels
92  const align::Alignables& thePixelHalfBarrelsAlignables = theAlignableTracker->pixelHalfBarrelGeomDets();
93  for (align::Alignables::const_iterator iter = thePixelHalfBarrelsAlignables.begin();
94  iter != thePixelHalfBarrelsAlignables.end();
95  ++iter) {
96  // Get the raw ID of the associated GeomDet
97  int id = (*iter)->geomDetId().rawId();
98 
99  // Select the given module
100  if (id == rawid) {
101  // Convert local to global diplacements
102  align::LocalVector lvector(local_displacements.at(0), local_displacements.at(1), local_displacements.at(2));
103  align::GlobalVector gvector = ((*iter)->surface()).toGlobal(lvector);
104 
105  // global displacement
106  (*iter)->move(gvector);
107 
108  // local rotation
109  (*iter)->rotateAroundLocalX(local_rotations.at(0)); // Local X axis rotation
110  (*iter)->rotateAroundLocalY(local_rotations.at(1)); // Local Y axis rotation
111  (*iter)->rotateAroundLocalZ(local_rotations.at(2)); // Local Z axis rotation
112  }
113  }
114 }
Alignables & pixelHalfBarrelGeomDets()
Return pixel barrel GeomDets.
std::vector< Alignable * > Alignables
Definition: Utilities.h:31
AlignableTracker * theAlignableTracker
void TrackerAlignment::moveAlignableTIBTIDs ( int  rawId,
const align::Scalars globalDisplacements,
const align::RotationType backwardRotation,
const align::RotationType forwardRotation,
bool  toAndFro 
)

Definition at line 203 of file TrackerAlignment.cc.

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

Referenced by SurveyDataConverter::applyFineSurveyInfo().

207  {
208  // Displace and rotate TIB and TID
209  const align::Alignables& theTIBTIDAlignables = theAlignableTracker->TIBTIDGeomDets();
210  for (align::Alignables::const_iterator iter = theTIBTIDAlignables.begin(); iter != theTIBTIDAlignables.end();
211  ++iter) {
212  // Get the raw ID of the associated GeomDet
213  int id = (*iter)->geomDetId().rawId();
214 
215  // Select the given module
216  if (id == rawId) {
217  // global displacement
218  align::GlobalVector gvector(globalDisplacements.at(0), globalDisplacements.at(1), globalDisplacements.at(2));
219  (*iter)->move(gvector);
220 
221  // global rotation
222  if (toAndFro) {
223  align::RotationType theResultRotation = backwardRotation * forwardRotation.transposed();
224  (*iter)->rotateInGlobalFrame(theResultRotation);
225  } else {
226  (*iter)->rotateInGlobalFrame(backwardRotation);
227  }
228  }
229  }
230 }
Alignables TIBTIDGeomDets()
Return inner barrel and TID GeomDets together.
std::vector< Alignable * > Alignables
Definition: Utilities.h:31
TkRotation transposed() const
AlignableTracker * theAlignableTracker
void TrackerAlignment::moveAlignableTIDs ( int  rawId,
const align::Scalars localDisplacements,
const align::Scalars localRotations 
)

Definition at line 175 of file TrackerAlignment.cc.

References theAlignableTracker, and AlignableTracker::TIDGeomDets().

177  {
178  // Displace and rotate TIDs
179  const align::Alignables& theTIDsAlignables = theAlignableTracker->TIDGeomDets();
180  for (align::Alignables::const_iterator iter = theTIDsAlignables.begin(); iter != theTIDsAlignables.end(); ++iter) {
181  // Get the raw ID of the associated GeomDet
182  int id = (*iter)->geomDetId().rawId();
183 
184  // Select the given module
185  if (id == rawid) {
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 }
Alignables & TIDGeomDets()
Return TID GeomDets.
std::vector< Alignable * > Alignables
Definition: Utilities.h:31
AlignableTracker * theAlignableTracker
void TrackerAlignment::saveToDB ( void  )

Definition at line 234 of file TrackerAlignment.cc.

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

Referenced by SurveyDataConverter::analyze().

234  {
235  // Output POOL-ORA objects
237  if (!poolDbService.isAvailable()) // Die if not available
238  throw cms::Exception("NotAvailable") << "PoolDBOutputService not available";
239 
240  // Retrieve and store
241  Alignments alignments = *(theAlignableTracker->alignments());
243 
244  // if ( poolDbService->isNewTagRequest(theAlignRecordName) )
245  // poolDbService->createNewIOV<Alignments>( alignments, poolDbService->endOfTime(),
246  // theAlignRecordName );
247  // else
248  // poolDbService->appendSinceTime<Alignments>( alignments, poolDbService->currentTime(),
249  // theAlignRecordName );
250  // In the two calls below it is assumed that the delete of "theAlignableTracker" is also deleting the two concerned payloads...
251  poolDbService->writeOneIOV<Alignments>(alignments, poolDbService->currentTime(), theAlignRecordName);
252  // if ( poolDbService->isNewTagRequest(theErrorRecordName) )
253  // poolDbService->createNewIOV<AlignmentErrorsExtended>( alignmentErrors,
254  // poolDbService->endOfTime(),
255  // theErrorRecordName );
256  // else
257  // poolDbService->appendSinceTime<AlignmentErrorsExtended>( alignmentErrors,
258  // poolDbService->currentTime(),
259  // theErrorRecordName );
260  poolDbService->writeOneIOV<AlignmentErrorsExtended>(
261  alignmentErrors, poolDbService->currentTime(), theErrorRecordName);
262 }
Alignments * alignments() const override
Return alignments, sorted by DetId.
std::string theAlignRecordName
bool isAvailable() const
Definition: Service.h:40
Hash writeOneIOV(const T &payload, Time_t time, const std::string &recordName)
std::string theErrorRecordName
AlignmentErrorsExtended * alignmentErrors() const override
Return alignment errors, sorted by DetId.
AlignableTracker * theAlignableTracker

Member Data Documentation

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

Definition at line 51 of file TrackerAlignment.h.

Referenced by saveToDB().

std::string TrackerAlignment::theErrorRecordName
private

Definition at line 51 of file TrackerAlignment.h.

Referenced by saveToDB().