CMS 3D CMS Logo

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::TrackerAlignment ( const edm::EventSetup setup)

Definition at line 20 of file TrackerAlignment.cc.

21  : theAlignRecordName("TrackerAlignmentRcd"), theErrorRecordName("TrackerAlignmentErrorExtendedRcd") {
22  //Retrieve tracker topology from geometry
24  setup.get<TrackerTopologyRcd>().get(tTopoHandle);
25  const TrackerTopology* const tTopo = tTopoHandle.product();
26 
30 }

References get, edm::ESHandle< T >::product(), singleTopDQM_cfi::setup, theAlignableTracker, and trackerGeometry_cfi::trackerGeometry.

◆ ~TrackerAlignment()

TrackerAlignment::~TrackerAlignment ( void  )

Definition at line 34 of file TrackerAlignment.cc.

34 { delete theAlignableTracker; }

References theAlignableTracker.

Member Function Documentation

◆ getAlignableTracker()

AlignableTracker* TrackerAlignment::getAlignableTracker ( )
inline

◆ moveAlignableEndCaps()

void TrackerAlignment::moveAlignableEndCaps ( int  rawId,
const align::Scalars localDisplacements,
const align::Scalars localRotations 
)

Definition at line 67 of file TrackerAlignment.cc.

69  {
70  // Displace and rotate EndCaps
71  const align::Alignables& theEndCapsAlignables = theAlignableTracker->endcapGeomDets();
72  for (align::Alignables::const_iterator iter = theEndCapsAlignables.begin(); iter != theEndCapsAlignables.end();
73  ++iter) {
74  // Get the raw ID of the associated GeomDet
75  int id = (*iter)->geomDetId().rawId();
76 
77  // Select the given module
78  if (id == rawid) {
79  // Convert local to global diplacements
80  align::LocalVector lvector(local_displacements.at(0), local_displacements.at(1), local_displacements.at(2));
81  align::GlobalVector gvector = ((*iter)->surface()).toGlobal(lvector);
82 
83  // global displacement
84  (*iter)->move(gvector);
85 
86  // local rotation
87  (*iter)->rotateAroundLocalX(local_rotations.at(0)); // Local X axis rotation
88  (*iter)->rotateAroundLocalY(local_rotations.at(1)); // Local Y axis rotation
89  (*iter)->rotateAroundLocalZ(local_rotations.at(2)); // Local Z axis rotation
90  }
91  }
92 }

References AlignableTracker::endcapGeomDets(), and theAlignableTracker.

◆ moveAlignableInnerHalfBarrels()

void TrackerAlignment::moveAlignableInnerHalfBarrels ( int  rawId,
const align::Scalars localDisplacements,
const align::Scalars localRotations 
)

Definition at line 153 of file TrackerAlignment.cc.

155  {
156  // Displace and rotate InnerHalfBarrels
157  const align::Alignables& theInnerHalfBarrelsAlignables = theAlignableTracker->innerBarrelGeomDets();
158  for (align::Alignables::const_iterator iter = theInnerHalfBarrelsAlignables.begin();
159  iter != theInnerHalfBarrelsAlignables.end();
160  ++iter) {
161  // Get the raw ID of the associated GeomDet
162  int id = (*iter)->geomDetId().rawId();
163 
164  // Select the given module
165  if (id == rawid) {
166  // Convert local to global diplacements
167  align::LocalVector lvector(local_displacements.at(0), local_displacements.at(1), local_displacements.at(2));
168  align::GlobalVector gvector = ((*iter)->surface()).toGlobal(lvector);
169 
170  // global displacement
171  (*iter)->move(gvector);
172 
173  // local rotation
174  (*iter)->rotateAroundLocalX(local_rotations.at(0)); // Local X axis rotation
175  (*iter)->rotateAroundLocalY(local_rotations.at(1)); // Local Y axis rotation
176  (*iter)->rotateAroundLocalZ(local_rotations.at(2)); // Local Z axis rotation
177  }
178  }
179 }

References AlignableTracker::innerBarrelGeomDets(), and theAlignableTracker.

◆ moveAlignableOuterHalfBarrels()

void TrackerAlignment::moveAlignableOuterHalfBarrels ( int  rawId,
const align::Scalars localDisplacements,
const align::Scalars localRotations 
)

Definition at line 124 of file TrackerAlignment.cc.

126  {
127  // Displace and rotate OuterHalfBarrels
128  const align::Alignables& theOuterHalfBarrelsAlignables = theAlignableTracker->outerBarrelGeomDets();
129  for (align::Alignables::const_iterator iter = theOuterHalfBarrelsAlignables.begin();
130  iter != theOuterHalfBarrelsAlignables.end();
131  ++iter) {
132  // Get the raw ID of the associated GeomDet
133  int id = (*iter)->geomDetId().rawId();
134 
135  // Select the given module
136  if (id == rawid) {
137  // Convert local to global diplacements
138  align::LocalVector lvector(local_displacements.at(0), local_displacements.at(1), local_displacements.at(2));
139  align::GlobalVector gvector = ((*iter)->surface()).toGlobal(lvector);
140 
141  // global displacement
142  (*iter)->move(gvector);
143 
144  // local rotation
145  (*iter)->rotateAroundLocalX(local_rotations.at(0)); // Local X axis rotation
146  (*iter)->rotateAroundLocalY(local_rotations.at(1)); // Local Y axis rotation
147  (*iter)->rotateAroundLocalZ(local_rotations.at(2)); // Local Z axis rotation
148  }
149  }
150 }

References AlignableTracker::outerBarrelGeomDets(), and theAlignableTracker.

◆ moveAlignablePixelEndCaps()

void TrackerAlignment::moveAlignablePixelEndCaps ( int  rawId,
const align::Scalars localDisplacements,
const align::Scalars localRotations 
)

Definition at line 38 of file TrackerAlignment.cc.

40  {
41  // Displace and rotate pixelEndCaps
42  const align::Alignables& thePixelEndCapsAlignables = theAlignableTracker->pixelEndcapGeomDets();
43  for (align::Alignables::const_iterator iter = thePixelEndCapsAlignables.begin();
44  iter != thePixelEndCapsAlignables.end();
45  ++iter) {
46  // Get the raw ID of the associated GeomDet
47  int id = (*iter)->geomDetId().rawId();
48 
49  // Select the given module
50  if (id == rawid) {
51  // Convert local to global diplacements
52  align::LocalVector lvector(local_displacements.at(0), local_displacements.at(1), local_displacements.at(2));
53  align::GlobalVector gvector = ((*iter)->surface()).toGlobal(lvector);
54 
55  // global displacement
56  (*iter)->move(gvector);
57 
58  // local rotation
59  (*iter)->rotateAroundLocalX(local_rotations.at(0)); // Local X axis rotation
60  (*iter)->rotateAroundLocalY(local_rotations.at(1)); // Local Y axis rotation
61  (*iter)->rotateAroundLocalZ(local_rotations.at(2)); // Local Z axis rotation
62  }
63  }
64 }

References AlignableTracker::pixelEndcapGeomDets(), and theAlignableTracker.

◆ moveAlignablePixelHalfBarrels()

void TrackerAlignment::moveAlignablePixelHalfBarrels ( int  rawId,
const align::Scalars localDisplacements,
const align::Scalars localRotations 
)

Definition at line 95 of file TrackerAlignment.cc.

97  {
98  // Displace and rotate PixelHalfBarrels
99  const align::Alignables& thePixelHalfBarrelsAlignables = theAlignableTracker->pixelHalfBarrelGeomDets();
100  for (align::Alignables::const_iterator iter = thePixelHalfBarrelsAlignables.begin();
101  iter != thePixelHalfBarrelsAlignables.end();
102  ++iter) {
103  // Get the raw ID of the associated GeomDet
104  int id = (*iter)->geomDetId().rawId();
105 
106  // Select the given module
107  if (id == rawid) {
108  // Convert local to global diplacements
109  align::LocalVector lvector(local_displacements.at(0), local_displacements.at(1), local_displacements.at(2));
110  align::GlobalVector gvector = ((*iter)->surface()).toGlobal(lvector);
111 
112  // global displacement
113  (*iter)->move(gvector);
114 
115  // local rotation
116  (*iter)->rotateAroundLocalX(local_rotations.at(0)); // Local X axis rotation
117  (*iter)->rotateAroundLocalY(local_rotations.at(1)); // Local Y axis rotation
118  (*iter)->rotateAroundLocalZ(local_rotations.at(2)); // Local Z axis rotation
119  }
120  }
121 }

References AlignableTracker::pixelHalfBarrelGeomDets(), and theAlignableTracker.

◆ moveAlignableTIBTIDs()

void TrackerAlignment::moveAlignableTIBTIDs ( int  rawId,
const align::Scalars globalDisplacements,
const align::RotationType backwardRotation,
const align::RotationType forwardRotation,
bool  toAndFro 
)

Definition at line 210 of file TrackerAlignment.cc.

214  {
215  // Displace and rotate TIB and TID
216  const align::Alignables& theTIBTIDAlignables = theAlignableTracker->TIBTIDGeomDets();
217  for (align::Alignables::const_iterator iter = theTIBTIDAlignables.begin(); iter != theTIBTIDAlignables.end();
218  ++iter) {
219  // Get the raw ID of the associated GeomDet
220  int id = (*iter)->geomDetId().rawId();
221 
222  // Select the given module
223  if (id == rawId) {
224  // global displacement
225  align::GlobalVector gvector(globalDisplacements.at(0), globalDisplacements.at(1), globalDisplacements.at(2));
226  (*iter)->move(gvector);
227 
228  // global rotation
229  if (toAndFro) {
230  align::RotationType theResultRotation = backwardRotation * forwardRotation.transposed();
231  (*iter)->rotateInGlobalFrame(theResultRotation);
232  } else {
233  (*iter)->rotateInGlobalFrame(backwardRotation);
234  }
235  }
236  }
237 }

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

Referenced by SurveyDataConverter::applyFineSurveyInfo().

◆ moveAlignableTIDs()

void TrackerAlignment::moveAlignableTIDs ( int  rawId,
const align::Scalars localDisplacements,
const align::Scalars localRotations 
)

Definition at line 182 of file TrackerAlignment.cc.

184  {
185  // Displace and rotate TIDs
186  const align::Alignables& theTIDsAlignables = theAlignableTracker->TIDGeomDets();
187  for (align::Alignables::const_iterator iter = theTIDsAlignables.begin(); iter != theTIDsAlignables.end(); ++iter) {
188  // Get the raw ID of the associated GeomDet
189  int id = (*iter)->geomDetId().rawId();
190 
191  // Select the given module
192  if (id == rawid) {
193  // Convert local to global diplacements
194  align::LocalVector lvector(local_displacements.at(0), local_displacements.at(1), local_displacements.at(2));
195  align::GlobalVector gvector = ((*iter)->surface()).toGlobal(lvector);
196 
197  // global displacement
198  (*iter)->move(gvector);
199 
200  // local rotation
201  (*iter)->rotateAroundLocalX(local_rotations.at(0)); // Local X axis rotation
202  (*iter)->rotateAroundLocalY(local_rotations.at(1)); // Local Y axis rotation
203  (*iter)->rotateAroundLocalZ(local_rotations.at(2)); // Local Z axis rotation
204  }
205  }
206 }

References theAlignableTracker, and AlignableTracker::TIDGeomDets().

◆ saveToDB()

void TrackerAlignment::saveToDB ( void  )

Definition at line 241 of file TrackerAlignment.cc.

241  {
242  // Output POOL-ORA objects
244  if (!poolDbService.isAvailable()) // Die if not available
245  throw cms::Exception("NotAvailable") << "PoolDBOutputService not available";
246 
247  // Retrieve and store
248  Alignments* alignments = theAlignableTracker->alignments();
250 
251  // if ( poolDbService->isNewTagRequest(theAlignRecordName) )
252  // poolDbService->createNewIOV<Alignments>( alignments, poolDbService->endOfTime(),
253  // theAlignRecordName );
254  // else
255  // poolDbService->appendSinceTime<Alignments>( alignments, poolDbService->currentTime(),
256  // theAlignRecordName );
257  poolDbService->writeOne<Alignments>(alignments, poolDbService->currentTime(), theAlignRecordName);
258  // if ( poolDbService->isNewTagRequest(theErrorRecordName) )
259  // poolDbService->createNewIOV<AlignmentErrorsExtended>( alignmentErrors,
260  // poolDbService->endOfTime(),
261  // theErrorRecordName );
262  // else
263  // poolDbService->appendSinceTime<AlignmentErrorsExtended>( alignmentErrors,
264  // poolDbService->currentTime(),
265  // theErrorRecordName );
266  poolDbService->writeOne<AlignmentErrorsExtended>(alignmentErrors, poolDbService->currentTime(), theErrorRecordName);
267 }

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().

Member Data Documentation

◆ theAlignableTracker

AlignableTracker* TrackerAlignment::theAlignableTracker
private

◆ theAlignRecordName

std::string TrackerAlignment::theAlignRecordName
private

Definition at line 48 of file TrackerAlignment.h.

Referenced by saveToDB().

◆ theErrorRecordName

std::string TrackerAlignment::theErrorRecordName
private

Definition at line 48 of file TrackerAlignment.h.

Referenced by saveToDB().

Vector3DBase
Definition: Vector3DBase.h:8
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
TkRotation< Scalar >
AlignableTracker::outerBarrelGeomDets
Alignables & outerBarrelGeomDets()
Return outer barrel GeomDets.
Definition: AlignableTracker.h:57
TrackerTopology
Definition: TrackerTopology.h:16
AlignableTracker::innerBarrelGeomDets
Alignables & innerBarrelGeomDets()
Return inner barrel GeomDets.
Definition: AlignableTracker.h:55
trackerGeometry_cfi.trackerGeometry
trackerGeometry
Definition: trackerGeometry_cfi.py:3
edm::Service::isAvailable
bool isAvailable() const
Definition: Service.h:40
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
AlignableTracker::pixelHalfBarrelGeomDets
Alignables & pixelHalfBarrelGeomDets()
Return pixel barrel GeomDets.
Definition: AlignableTracker.h:59
AlignableTracker::endcapGeomDets
Alignables & endcapGeomDets()
Return endcap GeomDets.
Definition: AlignableTracker.h:61
AlignableTracker::alignmentErrors
AlignmentErrorsExtended * alignmentErrors() const override
Return alignment errors, sorted by DetId.
Definition: AlignableTracker.cc:59
TrackerDigiGeometryRecord
Definition: TrackerDigiGeometryRecord.h:15
edm::ESHandle< TrackerTopology >
AlignableTracker
Definition: AlignableTracker.h:17
TrackerAlignment::theErrorRecordName
std::string theErrorRecordName
Definition: TrackerAlignment.h:48
edm::Service< cond::service::PoolDBOutputService >
TrackerAlignment::theAlignableTracker
AlignableTracker * theAlignableTracker
Definition: TrackerAlignment.h:46
TrackerAlignment::theAlignRecordName
std::string theAlignRecordName
Definition: TrackerAlignment.h:48
AlignableTracker::TIBTIDGeomDets
Alignables TIBTIDGeomDets()
Return inner barrel and TID GeomDets together.
Definition: AlignableTracker.h:53
get
#define get
AlignmentErrorsExtended
Definition: AlignmentErrorsExtended.h:10
align::Alignables
std::vector< Alignable * > Alignables
Definition: Utilities.h:31
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:57
AlignableTracker::TIDGeomDets
Alignables & TIDGeomDets()
Return TID GeomDets.
Definition: AlignableTracker.h:63
TkRotation::transposed
TkRotation transposed() const
Definition: extTkRotation.h:161
cms::Exception
Definition: Exception.h:70
TrackerTopologyRcd
Definition: TrackerTopologyRcd.h:10
Alignments
Definition: Alignments.h:10
cond::service::PoolDBOutputService::currentTime
cond::Time_t currentTime() const
Definition: PoolDBOutputService.cc:189
AlignableTracker::pixelEndcapGeomDets
Alignables & pixelEndcapGeomDets()
Return pixel endcap GeomDets.
Definition: AlignableTracker.h:65