CMS 3D CMS Logo

Public Member Functions | Private Types | Private Member Functions | Private Attributes

SurveyDBUploader Class Reference

#include <SurveyDBUploader.h>

Inheritance diagram for SurveyDBUploader:
edm::EDAnalyzer

List of all members.

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
virtual void endJob ()
 Upload to DB.
 SurveyDBUploader (const edm::ParameterSet &)
 Set value & error tag names for survey records.

Private Types

typedef AlignTransform SurveyValue
typedef Alignments SurveyValues

Private Member Functions

void getSurveyInfo (const Alignable *)
 Get survey info of an alignable in the detector.

Private Attributes

std::string theErrorRcd
SurveyErrorstheErrors
std::string theValueRcd
SurveyValuestheValues

Detailed Description

Module for uploading survey info to the DB.

Usage: module uploader = SurveyDBUploader { string valueTag = "TrackerSurveyRcd" string errorTag = "TrackerSurveyErrorRcd" }

Date:
2007/04/18 17:23:51
Revision:
1.1
Author:
Chung Khim Lae

Definition at line 27 of file SurveyDBUploader.h.


Member Typedef Documentation

Definition at line 30 of file SurveyDBUploader.h.

Definition at line 31 of file SurveyDBUploader.h.


Constructor & Destructor Documentation

SurveyDBUploader::SurveyDBUploader ( const edm::ParameterSet cfg)

Set value & error tag names for survey records.

Definition at line 12 of file SurveyDBUploader.cc.

                                                            :
  theValueRcd( cfg.getParameter<std::string>("valueRcd") ),
  theErrorRcd( cfg.getParameter<std::string>("errorRcd") ),
  theValues(0),
  theErrors(0)
{
}

Member Function Documentation

virtual void SurveyDBUploader::analyze ( const edm::Event ,
const edm::EventSetup  
) [inline, virtual]

Implements edm::EDAnalyzer.

Definition at line 40 of file SurveyDBUploader.h.

                         {}
void SurveyDBUploader::endJob ( void  ) [virtual]

Upload to DB.

Reimplemented from edm::EDAnalyzer.

Definition at line 20 of file SurveyDBUploader.cc.

References SurveyInputBase::detector(), Exception, getSurveyInfo(), edm::Service< T >::isAvailable(), Alignments::m_align, SurveyErrors::m_surveyErrors, theErrorRcd, theErrors, theValueRcd, and theValues.

{
  theValues = new SurveyValues;
  theErrors = new SurveyErrors;

  theValues->m_align.reserve(65536);
  theErrors->m_surveyErrors.reserve(65536);

  getSurveyInfo( SurveyInputBase::detector() );

  edm::Service<cond::service::PoolDBOutputService> poolDbService;

  if( poolDbService.isAvailable() )
  {
    poolDbService->writeOne<SurveyValues>
      (theValues, poolDbService->currentTime(), theValueRcd);
    poolDbService->writeOne<SurveyErrors>
      (theErrors, poolDbService->currentTime(), theErrorRcd);
  }
  else
    throw cms::Exception("ConfigError")
      << "PoolDBOutputService is not available";
}
void SurveyDBUploader::getSurveyInfo ( const Alignable ali) [private]

Get survey info of an alignable in the detector.

Definition at line 44 of file SurveyDBUploader.cc.

References Alignable::alignableObjectId(), Alignable::components(), error, SurveyDet::errors(), i, Alignable::id(), Alignments::m_align, SurveyErrors::m_surveyErrors, pos, SurveyDet::position(), makeMuonMisalignmentScenario::rot, SurveyDet::rotation(), Alignable::survey(), theErrors, theValues, relativeConstraints::value, PV3DBase< T, PVType, FrameType >::x(), TkRotation< T >::xx(), TkRotation< T >::xy(), TkRotation< T >::xz(), PV3DBase< T, PVType, FrameType >::y(), TkRotation< T >::yx(), TkRotation< T >::yy(), TkRotation< T >::yz(), PV3DBase< T, PVType, FrameType >::z(), TkRotation< T >::zx(), TkRotation< T >::zy(), and TkRotation< T >::zz().

Referenced by endJob().

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

  unsigned int nComp = comp.size();

  for (unsigned int i = 0; i < nComp; ++i) getSurveyInfo(comp[i]);

  const SurveyDet* survey = ali->survey();

  const align::PositionType& pos = survey->position();
  const align::RotationType& rot = survey->rotation();

  SurveyValue value( CLHEP::Hep3Vector( pos.x(), pos.y(), pos.z() ),
                     CLHEP::HepRotation
                     ( CLHEP::HepRep3x3( rot.xx(), rot.xy(), rot.xz(),
                                         rot.yx(), rot.yy(), rot.yz(),
                                         rot.zx(), rot.zy(), rot.zz() ) ),
                     ali->id() );

  SurveyError error( ali->alignableObjectId(),
                     ali->id(),
                     survey->errors() );

  theValues->m_align.push_back(value);
  theErrors->m_surveyErrors.push_back(error);
}

Member Data Documentation

std::string SurveyDBUploader::theErrorRcd [private]

Definition at line 56 of file SurveyDBUploader.h.

Referenced by endJob().

Definition at line 59 of file SurveyDBUploader.h.

Referenced by endJob(), and getSurveyInfo().

std::string SurveyDBUploader::theValueRcd [private]

Definition at line 55 of file SurveyDBUploader.h.

Referenced by endJob().

Definition at line 58 of file SurveyDBUploader.h.

Referenced by endJob(), and getSurveyInfo().