CMS 3D CMS Logo

Public Member Functions | Private Attributes

TrackerAlignment Class Reference

#include <TrackerAlignment.h>

List of all members.

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(), and theAlignableTracker.

                                                              :
  theAlignRecordName( "TrackerAlignmentRcd" ),
  theErrorRecordName( "TrackerAlignmentErrorRcd" )
{

  edm::ESHandle<TrackerGeometry> trackerGeometry;
  setup.get<TrackerDigiGeometryRecord>().get( trackerGeometry );
  theAlignableTracker = new AlignableTracker( &(*trackerGeometry) );

}
TrackerAlignment::~TrackerAlignment ( void  )

Definition at line 33 of file TrackerAlignment.cc.

References theAlignableTracker.

{

  delete theAlignableTracker;

}

Member Function Documentation

AlignableTracker* TrackerAlignment::getAlignableTracker ( ) [inline]
void TrackerAlignment::moveAlignableEndCaps ( int  rawId,
const align::Scalars localDisplacements,
const align::Scalars localRotations 
)

Definition at line 77 of file TrackerAlignment.cc.

References AlignableTracker::endcapGeomDets(), and theAlignableTracker.

                                                                                                                                       {
        
  // Displace and rotate EndCaps
  const align::Alignables& theEndCapsAlignables = theAlignableTracker->endcapGeomDets();
  for ( align::Alignables::const_iterator iter = theEndCapsAlignables.begin(); 
        iter != theEndCapsAlignables.end(); ++iter ){ 
                
    // Get the raw ID of the associated GeomDet
    int id = (*iter)->geomDetId().rawId();
                
    // Select the given module
    if ( id == rawid ){
                        
      // Convert local to global diplacements
      align::LocalVector lvector( local_displacements.at(0), local_displacements.at(1), local_displacements.at(2)); 
      align::GlobalVector gvector = ((*iter)->surface()).toGlobal( lvector );
                        
      // global displacement 
      (*iter)->move( gvector );
                        
      // local rotation 
      (*iter)->rotateAroundLocalX( local_rotations.at(0) ); // Local X axis rotation
      (*iter)->rotateAroundLocalY( local_rotations.at(1) ); // Local Y axis rotation
      (*iter)->rotateAroundLocalZ( local_rotations.at(2) ); // Local Z axis rotation
                        
    }
  }
}
void TrackerAlignment::moveAlignableInnerHalfBarrels ( int  rawId,
const align::Scalars localDisplacements,
const align::Scalars localRotations 
)

Definition at line 167 of file TrackerAlignment.cc.

References AlignableTracker::innerBarrelGeomDets(), and theAlignableTracker.

                                                                                                                                                {
        
  // Displace and rotate InnerHalfBarrels
  const align::Alignables& theInnerHalfBarrelsAlignables = theAlignableTracker->innerBarrelGeomDets();
  for ( align::Alignables::const_iterator iter = theInnerHalfBarrelsAlignables.begin(); 
        iter != theInnerHalfBarrelsAlignables.end(); ++iter ){ 
                
    // Get the raw ID of the associated GeomDet
    int id = (*iter)->geomDetId().rawId();
                
    // Select the given module
    if ( id == rawid ){
                        
      // Convert local to global diplacements
      align::LocalVector lvector( local_displacements.at(0), local_displacements.at(1), local_displacements.at(2)); 
      align::GlobalVector gvector = ((*iter)->surface()).toGlobal( lvector );
                        
      // global displacement 
      (*iter)->move( gvector );
                        
      // local rotation 
      (*iter)->rotateAroundLocalX( local_rotations.at(0) ); // Local X axis rotation
      (*iter)->rotateAroundLocalY( local_rotations.at(1) ); // Local Y axis rotation
      (*iter)->rotateAroundLocalZ( local_rotations.at(2) ); // Local Z axis rotation
                        
    }
  }
}
void TrackerAlignment::moveAlignableOuterHalfBarrels ( int  rawId,
const align::Scalars localDisplacements,
const align::Scalars localRotations 
)

Definition at line 137 of file TrackerAlignment.cc.

References AlignableTracker::outerBarrelGeomDets(), and theAlignableTracker.

                                                                                                                                                {
        
  // Displace and rotate OuterHalfBarrels
  const align::Alignables& theOuterHalfBarrelsAlignables = theAlignableTracker->outerBarrelGeomDets();
  for ( align::Alignables::const_iterator iter = theOuterHalfBarrelsAlignables.begin(); 
        iter != theOuterHalfBarrelsAlignables.end(); ++iter ){ 
                
    // Get the raw ID of the associated GeomDet
    int id = (*iter)->geomDetId().rawId();
                
    // Select the given module
    if ( id == rawid ){
                        
      // Convert local to global diplacements
      align::LocalVector lvector( local_displacements.at(0), local_displacements.at(1), local_displacements.at(2)); 
      align::GlobalVector gvector = ((*iter)->surface()).toGlobal( lvector );
                        
      // global displacement 
      (*iter)->move( gvector );
                        
      // local rotation 
      (*iter)->rotateAroundLocalX( local_rotations.at(0) ); // Local X axis rotation
      (*iter)->rotateAroundLocalY( local_rotations.at(1) ); // Local Y axis rotation
      (*iter)->rotateAroundLocalZ( local_rotations.at(2) ); // Local Z axis rotation
                        
    }
  }
}
void TrackerAlignment::moveAlignablePixelEndCaps ( int  rawId,
const align::Scalars localDisplacements,
const align::Scalars localRotations 
)

Definition at line 43 of file TrackerAlignment.cc.

References AlignableTracker::pixelEndcapGeomDets(), and theAlignableTracker.

{
        
  // Displace and rotate pixelEndCaps
  const align::Alignables& thePixelEndCapsAlignables = theAlignableTracker->pixelEndcapGeomDets();
  for ( align::Alignables::const_iterator iter = thePixelEndCapsAlignables.begin(); 
        iter != thePixelEndCapsAlignables.end(); ++iter )
    { 
        
      // Get the raw ID of the associated GeomDet
      int id = (*iter)->geomDetId().rawId();
                
      // Select the given module
      if ( id == rawid ){
          
        // Convert local to global diplacements
        align::LocalVector lvector( local_displacements.at(0), local_displacements.at(1), local_displacements.at(2)); 
        align::GlobalVector gvector = ((*iter)->surface()).toGlobal( lvector );
          
        // global displacement 
        (*iter)->move( gvector );
          
        // local rotation 
        (*iter)->rotateAroundLocalX( local_rotations.at(0) ); // Local X axis rotation
        (*iter)->rotateAroundLocalY( local_rotations.at(1) ); // Local Y axis rotation
        (*iter)->rotateAroundLocalZ( local_rotations.at(2) ); // Local Z axis rotation
          
      }
    }
}
void TrackerAlignment::moveAlignablePixelHalfBarrels ( int  rawId,
const align::Scalars localDisplacements,
const align::Scalars localRotations 
)

Definition at line 107 of file TrackerAlignment.cc.

References AlignableTracker::pixelHalfBarrelGeomDets(), and theAlignableTracker.

                                                                                                                                                {
        
  // Displace and rotate PixelHalfBarrels
  const align::Alignables& thePixelHalfBarrelsAlignables = theAlignableTracker->pixelHalfBarrelGeomDets();
  for ( align::Alignables::const_iterator iter = thePixelHalfBarrelsAlignables.begin(); 
        iter != thePixelHalfBarrelsAlignables.end(); ++iter ){ 
                
    // Get the raw ID of the associated GeomDet
    int id = (*iter)->geomDetId().rawId();
                
    // Select the given module
    if ( id == rawid ){
                        
      // Convert local to global diplacements
      align::LocalVector lvector( local_displacements.at(0), local_displacements.at(1), local_displacements.at(2)); 
      align::GlobalVector gvector = ((*iter)->surface()).toGlobal( lvector );
                        
      // global displacement 
      (*iter)->move( gvector );
                        
      // local rotation 
      (*iter)->rotateAroundLocalX( local_rotations.at(0) ); // Local X axis rotation
      (*iter)->rotateAroundLocalY( local_rotations.at(1) ); // Local Y axis rotation
      (*iter)->rotateAroundLocalZ( local_rotations.at(2) ); // Local Z axis rotation
                        
    }
  }
}
void TrackerAlignment::moveAlignableTIBTIDs ( int  rawId,
const align::Scalars globalDisplacements,
const align::RotationType backwardRotation,
const align::RotationType forwardRotation,
bool  toAndFro 
)

Definition at line 228 of file TrackerAlignment.cc.

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

Referenced by SurveyDataConverter::applyFineSurveyInfo().

                                                                                                                                                                                                   {

  // Displace and rotate TIB and TID
  const align::Alignables& theTIBTIDAlignables = theAlignableTracker->TIBTIDGeomDets();
  for ( align::Alignables::const_iterator iter = theTIBTIDAlignables.begin(); 
        iter != theTIBTIDAlignables.end(); ++iter )
    { 
            
      // Get the raw ID of the associated GeomDet
      int id = (*iter)->geomDetId().rawId();
            
      // Select the given module
      if ( id == rawId ){
              
        // global displacement 
        align::GlobalVector gvector (globalDisplacements.at(0), globalDisplacements.at(1), globalDisplacements.at(2));
        (*iter)->move( gvector );
              
        // global rotation
        if (toAndFro) { 
          align::RotationType theResultRotation = backwardRotation*forwardRotation.transposed();
          (*iter)->rotateInGlobalFrame( theResultRotation ); 
        } else {
          (*iter)->rotateInGlobalFrame( backwardRotation );
        }
      }
    }
}
void TrackerAlignment::moveAlignableTIDs ( int  rawId,
const align::Scalars localDisplacements,
const align::Scalars localRotations 
)

Definition at line 197 of file TrackerAlignment.cc.

References theAlignableTracker, and AlignableTracker::TIDGeomDets().

                                                                                                                                    {
        
  // Displace and rotate TIDs
  const align::Alignables& theTIDsAlignables = theAlignableTracker->TIDGeomDets();
  for ( align::Alignables::const_iterator iter = theTIDsAlignables.begin(); 
        iter != theTIDsAlignables.end(); ++iter ){ 
                
    // Get the raw ID of the associated GeomDet
    int id = (*iter)->geomDetId().rawId();
                
    // Select the given module
    if ( id == rawid ){
                        
      // Convert local to global diplacements
      align::LocalVector lvector( local_displacements.at(0), local_displacements.at(1), local_displacements.at(2)); 
      align::GlobalVector gvector = ((*iter)->surface()).toGlobal( lvector );
                        
      // global displacement 
      (*iter)->move( gvector );
                        
      // local rotation 
      (*iter)->rotateAroundLocalX( local_rotations.at(0) ); // Local X axis rotation
      (*iter)->rotateAroundLocalY( local_rotations.at(1) ); // Local Y axis rotation
      (*iter)->rotateAroundLocalZ( local_rotations.at(2) ); // Local Z axis rotation
                        
    }
  }
}
void TrackerAlignment::saveToDB ( void  )

Definition at line 260 of file TrackerAlignment.cc.

References AlignableTracker::alignmentErrors(), AlignableTracker::alignments(), edm::Service< T >::isAvailable(), theAlignableTracker, theAlignRecordName, and theErrorRecordName.

Referenced by SurveyDataConverter::analyze().

                                   {
        
  // Output POOL-ORA objects
  edm::Service<cond::service::PoolDBOutputService> poolDbService;
  if( !poolDbService.isAvailable() ) // Die if not available
        throw cms::Exception("NotAvailable") << "PoolDBOutputService not available";

  // Retrieve and store
  Alignments* alignments = theAlignableTracker->alignments();
  AlignmentErrors* alignmentErrors = theAlignableTracker->alignmentErrors();

//   if ( poolDbService->isNewTagRequest(theAlignRecordName) )
//     poolDbService->createNewIOV<Alignments>( alignments, poolDbService->endOfTime(), 
//                                              theAlignRecordName );
//   else
//     poolDbService->appendSinceTime<Alignments>( alignments, poolDbService->currentTime(), 
//                                                 theAlignRecordName );
  poolDbService->writeOne<Alignments>(alignments, poolDbService->currentTime(),
                                      theAlignRecordName);
//   if ( poolDbService->isNewTagRequest(theErrorRecordName) )
//     poolDbService->createNewIOV<AlignmentErrors>( alignmentErrors,
//                                                   poolDbService->endOfTime(), 
//                                                   theErrorRecordName );
//   else
//     poolDbService->appendSinceTime<AlignmentErrors>( alignmentErrors,
//                                                      poolDbService->currentTime(), 
//                                                      theErrorRecordName );
  poolDbService->writeOne<AlignmentErrors>(alignmentErrors, poolDbService->currentTime(),
                                           theErrorRecordName);
}

Member Data Documentation

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