CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

MuonAlignmentInputSurveyDB Class Reference

#include <Alignment/MuonAlignment/interface/MuonAlignmentInputSurveyDB.h>

Inheritance diagram for MuonAlignmentInputSurveyDB:
MuonAlignmentInputMethod

List of all members.

Public Member Functions

 MuonAlignmentInputSurveyDB ()
 MuonAlignmentInputSurveyDB (std::string dtLabel, std::string cscLabel)
virtual AlignableMuonnewAlignableMuon (const edm::EventSetup &iSetup) const
virtual ~MuonAlignmentInputSurveyDB ()

Private Member Functions

void addSurveyInfo_ (Alignable *ali, unsigned int *theSurveyIndex, const Alignments *theSurveyValues, const SurveyErrors *theSurveyErrors) const
 MuonAlignmentInputSurveyDB (const MuonAlignmentInputSurveyDB &)
const MuonAlignmentInputSurveyDBoperator= (const MuonAlignmentInputSurveyDB &)

Private Attributes

std::string m_cscLabel
std::string m_dtLabel

Detailed Description

Description: <one line="" class="" summary>="">

Usage: <usage>

Definition at line 31 of file MuonAlignmentInputSurveyDB.h.


Constructor & Destructor Documentation

MuonAlignmentInputSurveyDB::MuonAlignmentInputSurveyDB ( )

Definition at line 36 of file MuonAlignmentInputSurveyDB.cc.

   : m_dtLabel(""), m_cscLabel("") {}
MuonAlignmentInputSurveyDB::MuonAlignmentInputSurveyDB ( std::string  dtLabel,
std::string  cscLabel 
)
MuonAlignmentInputSurveyDB::~MuonAlignmentInputSurveyDB ( ) [virtual]

Definition at line 47 of file MuonAlignmentInputSurveyDB.cc.

{}
MuonAlignmentInputSurveyDB::MuonAlignmentInputSurveyDB ( const MuonAlignmentInputSurveyDB ) [private]

Member Function Documentation

void MuonAlignmentInputSurveyDB::addSurveyInfo_ ( Alignable ali,
unsigned int *  theSurveyIndex,
const Alignments theSurveyValues,
const SurveyErrors theSurveyErrors 
) const [private]

Definition at line 103 of file MuonAlignmentInputSurveyDB.cc.

References Alignable::alignableObjectId(), Alignable::components(), error, Exception, Alignable::geomDetId(), i, AlignableSurface::length(), Alignments::m_align, SurveyErrors::m_surveyErrors, SurveyError::matrix(), pos, DetId::rawId(), SurveyError::rawId(), AlignableSurface::setLength(), Alignable::setSurvey(), AlignableSurface::setWidth(), SurveyError::structureType(), Alignable::surface(), and AlignableSurface::width().

Referenced by newAlignableMuon().

                                                                                           {
  const std::vector<Alignable*>& comp = ali->components();

  unsigned int nComp = comp.size();

  for (unsigned int i = 0; i < nComp; ++i) addSurveyInfo_(comp[i], theSurveyIndex, theSurveyValues, theSurveyErrors);

  const SurveyError& error = theSurveyErrors->m_surveyErrors[*theSurveyIndex];

  if ( ali->geomDetId().rawId() != error.rawId() ||
       ali->alignableObjectId() != error.structureType() )
  {
    throw cms::Exception("DatabaseError")
      << "Error reading survey info from DB. Mismatched id!";
  }

  const CLHEP::Hep3Vector&  pos = theSurveyValues->m_align[*theSurveyIndex].translation();
  const CLHEP::HepRotation& rot = theSurveyValues->m_align[*theSurveyIndex].rotation();

  AlignableSurface surf( align::PositionType( pos.x(), pos.y(), pos.z() ),
                         align::RotationType( rot.xx(), rot.xy(), rot.xz(),
                                              rot.yx(), rot.yy(), rot.yz(),
                                              rot.zx(), rot.zy(), rot.zz() ) );

  surf.setWidth( ali->surface().width() );
  surf.setLength( ali->surface().length() );

  ali->setSurvey( new SurveyDet( surf, error.matrix() ) );

  (*theSurveyIndex)++;
}
AlignableMuon * MuonAlignmentInputSurveyDB::newAlignableMuon ( const edm::EventSetup iSetup) const [virtual]

Reimplemented from MuonAlignmentInputMethod.

Definition at line 65 of file MuonAlignmentInputSurveyDB.cc.

References addSurveyInfo_(), align::AlignableMuon, AlignableMuon::CSCEndcaps(), AlignableMuon::DTBarrel(), edm::EventSetup::get(), MuonAlignmentInputMethod::idealCSCGeometry(), MuonAlignmentInputMethod::idealDTGeometry(), m_cscLabel, m_dtLabel, and convertSQLitetoXML_cfg::output.

                                                                                             {
   boost::shared_ptr<DTGeometry> dtGeometry = idealDTGeometry(iSetup);
   boost::shared_ptr<CSCGeometry> cscGeometry = idealCSCGeometry(iSetup);

   edm::ESHandle<Alignments> dtSurvey;
   edm::ESHandle<SurveyErrors> dtSurveyError;
   edm::ESHandle<Alignments> cscSurvey;
   edm::ESHandle<SurveyErrors> cscSurveyError;
   iSetup.get<DTSurveyRcd>().get(m_dtLabel, dtSurvey);
   iSetup.get<DTSurveyErrorRcd>().get(m_dtLabel, dtSurveyError);
   iSetup.get<CSCSurveyRcd>().get(m_cscLabel, cscSurvey);
   iSetup.get<CSCSurveyErrorRcd>().get(m_cscLabel, cscSurveyError);

   AlignableMuon *output = new AlignableMuon(&(*dtGeometry), &(*cscGeometry));

   unsigned int theSurveyIndex  = 0;
   const Alignments *theSurveyValues = &*dtSurvey;
   const SurveyErrors *theSurveyErrors = &*dtSurveyError;
   std::vector<Alignable*> barrels = output->DTBarrel();
   for (std::vector<Alignable*>::const_iterator iter = barrels.begin();  iter != barrels.end();  ++iter) {
      addSurveyInfo_(*iter, &theSurveyIndex, theSurveyValues, theSurveyErrors);
   }

   theSurveyIndex  = 0;
   theSurveyValues = &*cscSurvey;
   theSurveyErrors = &*cscSurveyError;
   std::vector<Alignable*> endcaps = output->CSCEndcaps();
   for (std::vector<Alignable*>::const_iterator iter = endcaps.begin();  iter != endcaps.end();  ++iter) {
      addSurveyInfo_(*iter, &theSurveyIndex, theSurveyValues, theSurveyErrors);
   }

   return output;
}
const MuonAlignmentInputSurveyDB& MuonAlignmentInputSurveyDB::operator= ( const MuonAlignmentInputSurveyDB ) [private]

Member Data Documentation

Definition at line 57 of file MuonAlignmentInputSurveyDB.h.

Referenced by newAlignableMuon().

Definition at line 57 of file MuonAlignmentInputSurveyDB.h.

Referenced by newAlignableMuon().