CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

SurveyMisalignmentInput Class Reference

#include <SurveyMisalignmentInput.h>

Inheritance diagram for SurveyMisalignmentInput:
SurveyInputBase edm::EDAnalyzer

List of all members.

Public Member Functions

virtual void analyze (const edm::Event &, 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:
2010/01/07 14:36:23
Revision:
1.4
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.

                                                                          :
  textFileName( cfg.getParameter<std::string>("textFileName") )
{
}

Member Function Documentation

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

Add survey info to an alignable.

Definition at line 45 of file SurveyMisalignmentInput.cc.

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

Referenced by analyze().

{

  const align::Alignables& comp = ali->components();
  unsigned int nComp = comp.size();
  for (unsigned int i = 0; i < nComp; ++i) addSurveyInfo(comp[i]);
        
  SurveyInputTextReader::MapType::const_iterator it
    = uIdMap.find(std::make_pair(ali->id(), ali->alignableObjectId()));

  align::ErrorMatrix error;

  if (it != uIdMap.end()){
    //survey error values
    const align::Scalars& parameters = (it)->second;
    //sets the errors for the hierarchy level
    double* errorData = error.Array();
    for (unsigned int i = 0; i < 21; ++i){errorData[i] = parameters[i+6];}
                
    //because record only needs global value of modules
    if (ali->alignableObjectId() == align::AlignableDetUnit){
      // fill survey values
      ali->setSurvey( new SurveyDet(getAlignableSurface(ali->id()), error) );
    }
    else{
      ali->setSurvey( new SurveyDet(ali->surface(), error) );
    }
  }
  else{
    //fill
    error = ROOT::Math::SMatrixIdentity();
    ali->setSurvey( new SurveyDet(ali->surface(), error*(1e-6)) );
  }
  //std::cout << "UniqueId: " << id.first << ", " << id.second << std::endl;
  //std::cout << error << std::endl;
        
}
void SurveyMisalignmentInput::analyze ( const edm::Event ,
const edm::EventSetup setup 
) [virtual]
AlignableSurface SurveyMisalignmentInput::getAlignableSurface ( align::ID  id) [private]

Get alignable surface from misalignments.db.

Definition at line 83 of file SurveyMisalignmentInput.cc.

References alignments, and position.

Referenced by addSurveyInfo().

{
  std::vector<AlignTransform>::const_iterator it;

  for (it = alignments->m_align.begin(); it != alignments->m_align.end(); ++it)
  {
    if (id == (*it).rawId())
    {
      align::PositionType position( (*it).translation().x(), (*it).translation().y(), (*it).translation().z() );
      CLHEP::HepRotation rot( (*it).rotation() );
      align::RotationType rotation( rot.xx(), rot.xy(), rot.xz(),
                                    rot.yx(), rot.yy(), rot.yz(),
                                    rot.zx(), rot.zy(), rot.zz() );
      return AlignableSurface(position,rotation);
    }
  }
        
  return AlignableSurface();
}

Member Data Documentation

Definition at line 42 of file SurveyMisalignmentInput.h.

Referenced by analyze(), and getAlignableSurface().

Definition at line 40 of file SurveyMisalignmentInput.h.

Referenced by analyze().

Definition at line 38 of file SurveyMisalignmentInput.h.

Referenced by addSurveyInfo(), and analyze().