CMS 3D CMS Logo

SurveyMisalignmentInput Class Reference

Class to misaligned tracker from DB. More...

#include <Alignment/SurveyAnalysis/plugins/SurveyMisalignmentInput.h>

Inheritance diagram for SurveyMisalignmentInput:

SurveyInputBase edm::EDAnalyzer

List of all members.

Public Member Functions

virtual void beginJob (const edm::EventSetup &)
 Read ideal tracker geometry from DB.
 SurveyMisalignmentInput (const edm::ParameterSet &)

Private Member Functions

void addSurveyInfo (Alignable *)
 Add survey info to an alignable.
AlignableSurface getAlignableSurface (align::ID)
 Get alignable surface from misalignments.db.

Private Attributes

edm::ESHandle< Alignmentsalignments
std::string textFileName
SurveyInputTextReader::MapType uIdMap


Detailed Description

Class to misaligned tracker from DB.

Date
2007/10/08 16:38:04
Revision
1.3
Author:
Chung Khim Lae

Definition at line 21 of file SurveyMisalignmentInput.h.


Constructor & Destructor Documentation

SurveyMisalignmentInput::SurveyMisalignmentInput ( const edm::ParameterSet cfg  ) 

Definition at line 16 of file SurveyMisalignmentInput.cc.

00016                                                                           :
00017   textFileName( cfg.getParameter<std::string>("textFileName") )
00018 {
00019 }


Member Function Documentation

void SurveyMisalignmentInput::addSurveyInfo ( Alignable ali  )  [private]

Add survey info to an alignable.

Definition at line 42 of file SurveyMisalignmentInput.cc.

References align::AlignableDetUnit, Alignable::alignableObjectId(), Alignable::components(), e, error, getAlignableSurface(), i, Alignable::id(), it, python::trackProbabilityAnalysis_cff::parameters, edm::second(), Alignable::setSurvey(), Alignable::surface(), and uIdMap.

Referenced by beginJob().

00043 {
00044 
00045   const align::Alignables& comp = ali->components();
00046   unsigned int nComp = comp.size();
00047   for (unsigned int i = 0; i < nComp; ++i) addSurveyInfo(comp[i]);
00048         
00049   SurveyInputTextReader::MapType::const_iterator it
00050     = uIdMap.find(std::make_pair(ali->id(), ali->alignableObjectId()));
00051 
00052   align::ErrorMatrix error;
00053 
00054   if (it != uIdMap.end()){
00055     //survey error values
00056     const align::Scalars& parameters = (it)->second;
00057     //sets the errors for the hierarchy level
00058     double* errorData = error.Array();
00059     for (unsigned int i = 0; i < 21; ++i){errorData[i] = parameters[i+6];}
00060                 
00061     //because record only needs global value of modules
00062     if (ali->alignableObjectId() == align::AlignableDetUnit){
00063       // fill survey values
00064       ali->setSurvey( new SurveyDet(getAlignableSurface(ali->id()), error) );
00065     }
00066     else{
00067       ali->setSurvey( new SurveyDet(ali->surface(), error) );
00068     }
00069   }
00070   else{
00071     //fill
00072     error = ROOT::Math::SMatrixIdentity();
00073     ali->setSurvey( new SurveyDet(ali->surface(), error*(1e-6)) );
00074   }
00075   //std::cout << "UniqueId: " << id.first << ", " << id.second << std::endl;
00076   //std::cout << error << std::endl;
00077         
00078 }

void SurveyMisalignmentInput::beginJob ( const edm::EventSetup setup  )  [virtual]

Read ideal tracker geometry from DB.

Implements SurveyInputBase.

Definition at line 21 of file SurveyMisalignmentInput.cc.

References SurveyInputBase::addComponent(), addSurveyInfo(), alignments, SurveyInputBase::detector(), edm::EventSetup::get(), SurveyInputTextReader::readFile(), textFileName, uIdMap, and SurveyInputTextReader::UniqueIdMap().

00022 {
00023 
00024   edm::ESHandle<GeometricDet>  geom;
00025   setup.get<IdealGeometryRecord>().get(geom);    
00026   TrackerGeometry* tracker = TrackerGeomBuilderFromGeometricDet().build(&*geom);
00027   addComponent(new AlignableTracker( tracker ) );
00028 
00029   edm::LogInfo("SurveyMisalignmentInput") << "Starting!";
00030   // Retrieve alignment[Error]s from DBase
00031   setup.get<TrackerAlignmentRcd>().get( alignments );
00032 
00033   //Get map from textreader
00034   SurveyInputTextReader dataReader;
00035   dataReader.readFile( textFileName );
00036   uIdMap = dataReader.UniqueIdMap();
00037 
00038   addSurveyInfo( detector() );
00039 }

AlignableSurface SurveyMisalignmentInput::getAlignableSurface ( align::ID  id  )  [private]

Get alignable surface from misalignments.db.

Definition at line 80 of file SurveyMisalignmentInput.cc.

References alignments, it, and rot.

Referenced by addSurveyInfo().

00081 {
00082   std::vector<AlignTransform>::const_iterator it;
00083 
00084   for (it = alignments->m_align.begin(); it != alignments->m_align.end(); ++it)
00085   {
00086     if (id == (*it).rawId())
00087     {
00088       align::PositionType position( (*it).translation().x(), (*it).translation().y(), (*it).translation().z() );
00089       CLHEP::HepRotation rot( (*it).rotation() );
00090       align::RotationType rotation( rot.xx(), rot.xy(), rot.xz(),
00091                                     rot.yx(), rot.yy(), rot.yz(),
00092                                     rot.zx(), rot.zy(), rot.zz() );
00093       return AlignableSurface(position,rotation);
00094     }
00095   }
00096         
00097   return AlignableSurface();
00098 }


Member Data Documentation

edm::ESHandle<Alignments> SurveyMisalignmentInput::alignments [private]

Definition at line 41 of file SurveyMisalignmentInput.h.

Referenced by beginJob(), and getAlignableSurface().

std::string SurveyMisalignmentInput::textFileName [private]

Definition at line 39 of file SurveyMisalignmentInput.h.

Referenced by beginJob().

SurveyInputTextReader::MapType SurveyMisalignmentInput::uIdMap [private]

Definition at line 37 of file SurveyMisalignmentInput.h.

Referenced by addSurveyInfo(), and beginJob().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:33:01 2009 for CMSSW by  doxygen 1.5.4