CMS 3D CMS Logo

TrackerAlignment.cc
Go to the documentation of this file.
1 // Framework
4 // Conditions database
7 
8 // Geometry
11 
12 // Alignment
15 
17 
18 //__________________________________________________________________
19 //
21  : theAlignRecordName("TrackerAlignmentRcd"), theErrorRecordName("TrackerAlignmentErrorExtendedRcd") {
22  theAlignableTracker = new AlignableTracker(tGeom, tTopo);
23 }
24 
25 //__________________________________________________________________
26 //
28 
29 //__________________________________________________________________
30 //
32  const align::Scalars& local_displacements,
33  const align::Scalars& local_rotations) {
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 }
58 //__________________________________________________________________
59 //
61  const align::Scalars& local_displacements,
62  const align::Scalars& local_rotations) {
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 }
86 //__________________________________________________________________
87 //
89  const align::Scalars& local_displacements,
90  const align::Scalars& local_rotations) {
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 }
115 //__________________________________________________________________
116 //
118  const align::Scalars& local_displacements,
119  const align::Scalars& local_rotations) {
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 }
144 //__________________________________________________________________
145 //
147  const align::Scalars& local_displacements,
148  const align::Scalars& local_rotations) {
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 }
173 //__________________________________________________________________
174 //
176  const align::Scalars& local_displacements,
177  const align::Scalars& local_rotations) {
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 }
200 
201 //__________________________________________________________________
202 //
204  const align::Scalars& globalDisplacements,
205  const align::RotationType& backwardRotation,
206  const align::RotationType& forwardRotation,
207  bool toAndFro) {
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 }
231 
232 //__________________________________________________________________
233 //
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  poolDbService->writeOne<Alignments>(alignments, poolDbService->currentTime(), theAlignRecordName);
251  // if ( poolDbService->isNewTagRequest(theErrorRecordName) )
252  // poolDbService->createNewIOV<AlignmentErrorsExtended>( alignmentErrors,
253  // poolDbService->endOfTime(),
254  // theErrorRecordName );
255  // else
256  // poolDbService->appendSinceTime<AlignmentErrorsExtended>( alignmentErrors,
257  // poolDbService->currentTime(),
258  // theErrorRecordName );
259  poolDbService->writeOne<AlignmentErrorsExtended>(alignmentErrors, poolDbService->currentTime(), theErrorRecordName);
260 }
Vector3DBase
Definition: Vector3DBase.h:8
AlignmentErrorsExtended.h
TkRotation< Scalar >
AlignableTracker::outerBarrelGeomDets
Alignables & outerBarrelGeomDets()
Return outer barrel GeomDets.
Definition: AlignableTracker.h:57
align::Scalars
std::vector< Scalar > Scalars
Definition: Utilities.h:26
ESHandle.h
TrackerAlignment::moveAlignableOuterHalfBarrels
void moveAlignableOuterHalfBarrels(int rawId, const align::Scalars &localDisplacements, const align::Scalars &localRotations)
Definition: TrackerAlignment.cc:117
TrackerTopology
Definition: TrackerTopology.h:16
AlignableTracker::innerBarrelGeomDets
Alignables & innerBarrelGeomDets()
Return inner barrel GeomDets.
Definition: AlignableTracker.h:55
Alignments.h
TrackerAlignment::saveToDB
void saveToDB()
Definition: TrackerAlignment.cc:234
edm::Service::isAvailable
bool isAvailable() const
Definition: Service.h:40
AlignableTracker::pixelHalfBarrelGeomDets
Alignables & pixelHalfBarrelGeomDets()
Return pixel barrel GeomDets.
Definition: AlignableTracker.h:59
AlignableTracker::endcapGeomDets
Alignables & endcapGeomDets()
Return endcap GeomDets.
Definition: AlignableTracker.h:61
PoolDBOutputService.h
TrackerTopologyRcd.h
AlignableTracker::alignmentErrors
AlignmentErrorsExtended * alignmentErrors() const override
Return alignment errors, sorted by DetId.
Definition: AlignableTracker.cc:59
Service.h
AlignableTracker
Definition: AlignableTracker.h:17
TrackerAlignment::theErrorRecordName
std::string theErrorRecordName
Definition: TrackerAlignment.h:51
TrackerAlignment::TrackerAlignment
TrackerAlignment(const TrackerTopology *tTopo, const TrackerGeometry *tGeom)
Definition: TrackerAlignment.cc:20
TrackerDigiGeometryRecord.h
TrackerAlignment::moveAlignablePixelHalfBarrels
void moveAlignablePixelHalfBarrels(int rawId, const align::Scalars &localDisplacements, const align::Scalars &localRotations)
Definition: TrackerAlignment.cc:88
edm::Service< cond::service::PoolDBOutputService >
TrackerAlignment.h
TrackerAlignment::theAlignableTracker
AlignableTracker * theAlignableTracker
Definition: TrackerAlignment.h:50
TrackerAlignment::theAlignRecordName
std::string theAlignRecordName
Definition: TrackerAlignment.h:51
AlignableTracker::TIBTIDGeomDets
Alignables TIBTIDGeomDets()
Return inner barrel and TID GeomDets together.
Definition: AlignableTracker.h:53
TrackerAlignment::moveAlignableTIDs
void moveAlignableTIDs(int rawId, const align::Scalars &localDisplacements, const align::Scalars &localRotations)
Definition: TrackerAlignment.cc:175
AlignmentErrorsExtended
Definition: AlignmentErrorsExtended.h:10
align::Alignables
std::vector< Alignable * > Alignables
Definition: Utilities.h:31
TrackerAlignment::moveAlignableTIBTIDs
void moveAlignableTIBTIDs(int rawId, const align::Scalars &globalDisplacements, const align::RotationType &backwardRotation, const align::RotationType &forwardRotation, bool toAndFro)
Definition: TrackerAlignment.cc:203
TrackerAlignment::~TrackerAlignment
~TrackerAlignment()
Definition: TrackerAlignment.cc:27
AlignableTracker::alignments
Alignments * alignments() const override
Return alignments, sorted by DetId.
Definition: AlignableTracker.cc:42
cond::service::PoolDBOutputService::writeOne
Hash writeOne(const T *payload, Time_t time, const std::string &recordName)
Definition: PoolDBOutputService.h:63
AlignableTracker::TIDGeomDets
Alignables & TIDGeomDets()
Return TID GeomDets.
Definition: AlignableTracker.h:63
TkRotation::transposed
TkRotation transposed() const
Definition: extTkRotation.h:161
ConsumesCollector.h
cms::Exception
Definition: Exception.h:70
TrackerAlignment::moveAlignablePixelEndCaps
void moveAlignablePixelEndCaps(int rawId, const align::Scalars &localDisplacements, const align::Scalars &localRotations)
Definition: TrackerAlignment.cc:31
TrackerAlignment::moveAlignableEndCaps
void moveAlignableEndCaps(int rawId, const align::Scalars &localDisplacements, const align::Scalars &localRotations)
Definition: TrackerAlignment.cc:60
TrackerAlignment::moveAlignableInnerHalfBarrels
void moveAlignableInnerHalfBarrels(int rawId, const align::Scalars &localDisplacements, const align::Scalars &localRotations)
Definition: TrackerAlignment.cc:146
Alignments
Definition: Alignments.h:10
cond::service::PoolDBOutputService::currentTime
cond::Time_t currentTime() const
Definition: PoolDBOutputService.cc:217
AlignableTracker::pixelEndcapGeomDets
Alignables & pixelEndcapGeomDets()
Return pixel endcap GeomDets.
Definition: AlignableTracker.h:65
TrackerGeometry
Definition: TrackerGeometry.h:14