CMS 3D CMS Logo

Public Member Functions | Private Attributes

MisalignedMuonESProducer Class Reference

Inheritance diagram for MisalignedMuonESProducer:
edm::ESProducer edm::ESProxyFactoryProducer edm::eventsetup::DataProxyProvider

List of all members.

Public Member Functions

 MisalignedMuonESProducer (const edm::ParameterSet &p)
 Constructor.
edm::ESProducts
< boost::shared_ptr
< DTGeometry >
, boost::shared_ptr
< CSCGeometry > > 
produce (const MuonGeometryRecord &)
 Produce the misaligned Muon geometry and store it.
void saveToDB ()
 Save alignemnts and error to database.
virtual ~MisalignedMuonESProducer ()
 Destructor.

Private Attributes

AlignmentErrorscsc_AlignmentErrors
Alignmentscsc_Alignments
AlignmentErrorsdt_AlignmentErrors
Alignmentsdt_Alignments
std::string theCSCAlignRecordName
std::string theCSCErrorRecordName
boost::shared_ptr< CSCGeometrytheCSCGeometry
std::string theDTAlignRecordName
 misalignment scenario
std::string theDTErrorRecordName
boost::shared_ptr< DTGeometrytheDTGeometry
const bool theSaveToDB
const edm::ParameterSet theScenario
 whether or not writing to DB

Detailed Description

Definition at line 42 of file MisalignedMuonESProducer.cc.


Constructor & Destructor Documentation

MisalignedMuonESProducer::MisalignedMuonESProducer ( const edm::ParameterSet p)

Constructor.

Definition at line 82 of file MisalignedMuonESProducer.cc.

References edm::ESProducer::setWhatProduced().

                                                                           :
  theSaveToDB(p.getUntrackedParameter<bool>("saveToDbase")),
  theScenario(p.getParameter<edm::ParameterSet>("scenario")),
  theDTAlignRecordName( "DTAlignmentRcd" ),
  theDTErrorRecordName( "DTAlignmentErrorRcd" ),
  theCSCAlignRecordName( "CSCAlignmentRcd" ),
  theCSCErrorRecordName( "CSCAlignmentErrorRcd" )
{
  
  setWhatProduced(this);

}
MisalignedMuonESProducer::~MisalignedMuonESProducer ( ) [virtual]

Destructor.

Definition at line 97 of file MisalignedMuonESProducer.cc.

{}

Member Function Documentation

edm::ESProducts< boost::shared_ptr< DTGeometry >, boost::shared_ptr< CSCGeometry > > MisalignedMuonESProducer::produce ( const MuonGeometryRecord iRecord)

Produce the misaligned Muon geometry and store it.

Definition at line 102 of file MisalignedMuonESProducer.cc.

References align::AlignableMuon, GeometryAligner::applyAlignments(), MuonScenarioBuilder::applyScenario(), DTGeometryBuilderFromDDD::build(), CSCGeometryBuilderFromDDD::build(), csc_AlignmentErrors, csc_Alignments, AlignableMuon::cscAlignmentErrors(), AlignableMuon::cscAlignments(), dt_AlignmentErrors, dt_Alignments, AlignableMuon::dtAlignmentErrors(), AlignableMuon::dtAlignments(), edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::getRecord(), edm::es::products(), saveToDB(), theCSCGeometry, theDTGeometry, theSaveToDB, and theScenario.

{ 

  edm::LogInfo("MisalignedMuon") << "Producer called";
  

  // Create the Muon geometry from ideal geometry
  edm::ESTransientHandle<DDCompactView> cpv;
  iRecord.getRecord<IdealGeometryRecord>().get( cpv );

  edm::ESHandle<MuonDDDConstants> mdc;
  iRecord.getRecord<MuonNumberingRecord>().get(mdc);

  DTGeometryBuilderFromDDD  DTGeometryBuilder;
  CSCGeometryBuilderFromDDD CSCGeometryBuilder;

  theDTGeometry = boost::shared_ptr<DTGeometry>(new DTGeometry );
  DTGeometryBuilder.build(theDTGeometry,  &(*cpv), *mdc );
  theCSCGeometry  = boost::shared_ptr<CSCGeometry>( new CSCGeometry );
  CSCGeometryBuilder.build( theCSCGeometry,  &(*cpv), *mdc );


  // Create the alignable hierarchy
  AlignableMuon* theAlignableMuon = new AlignableMuon( &(*theDTGeometry) , &(*theCSCGeometry) );

  // Create misalignment scenario
  MuonScenarioBuilder scenarioBuilder( theAlignableMuon );
  scenarioBuilder.applyScenario( theScenario );
  
  // Get alignments and errors
  dt_Alignments = theAlignableMuon->dtAlignments() ;
  dt_AlignmentErrors = theAlignableMuon->dtAlignmentErrors();
  csc_Alignments = theAlignableMuon->cscAlignments();
  csc_AlignmentErrors = theAlignableMuon->cscAlignmentErrors();

 
  // Misalign the EventSetup geometry
  GeometryAligner aligner;

  aligner.applyAlignments<DTGeometry>( &(*theDTGeometry),
                                       dt_Alignments, 
                                       dt_AlignmentErrors,
                                       AlignTransform() );
  aligner.applyAlignments<CSCGeometry>( &(*theCSCGeometry ),
                                        csc_Alignments,
                                        csc_AlignmentErrors,
                                        AlignTransform() );  

  // Write alignments to DB
  if (theSaveToDB) this->saveToDB();

  edm::LogInfo("MisalignedMuon") << "Producer done";

  return edm::es::products( theDTGeometry, theCSCGeometry ); 
  
}
void MisalignedMuonESProducer::saveToDB ( void  )

Save alignemnts and error to database.

Definition at line 161 of file MisalignedMuonESProducer.cc.

References edm::Service< T >::isAvailable(), theCSCAlignRecordName, theCSCErrorRecordName, theDTAlignRecordName, and theDTErrorRecordName.

Referenced by produce().

{

  // Call service
  edm::Service<cond::service::PoolDBOutputService> poolDbService;
  if( !poolDbService.isAvailable() ) // Die if not available
        throw cms::Exception("NotAvailable") << "PoolDBOutputService not available";

  // Store DT alignments and errors
  poolDbService->writeOne<Alignments>( &(*dt_Alignments), poolDbService->beginOfTime(), theDTAlignRecordName);
  poolDbService->writeOne<AlignmentErrors>( &(*dt_AlignmentErrors), poolDbService->beginOfTime(), theDTErrorRecordName);

  // Store CSC alignments and errors
  poolDbService->writeOne<Alignments>( &(*csc_Alignments), poolDbService->beginOfTime(), theCSCAlignRecordName);
  poolDbService->writeOne<AlignmentErrors>( &(*csc_AlignmentErrors), poolDbService->beginOfTime(), theCSCErrorRecordName);

}

Member Data Documentation

Definition at line 72 of file MisalignedMuonESProducer.cc.

Referenced by produce().

Definition at line 71 of file MisalignedMuonESProducer.cc.

Referenced by produce().

Definition at line 70 of file MisalignedMuonESProducer.cc.

Referenced by produce().

Definition at line 69 of file MisalignedMuonESProducer.cc.

Referenced by produce().

Definition at line 64 of file MisalignedMuonESProducer.cc.

Referenced by saveToDB().

Definition at line 64 of file MisalignedMuonESProducer.cc.

Referenced by saveToDB().

Definition at line 67 of file MisalignedMuonESProducer.cc.

Referenced by produce().

misalignment scenario

Definition at line 63 of file MisalignedMuonESProducer.cc.

Referenced by saveToDB().

Definition at line 63 of file MisalignedMuonESProducer.cc.

Referenced by saveToDB().

Definition at line 66 of file MisalignedMuonESProducer.cc.

Referenced by produce().

Definition at line 60 of file MisalignedMuonESProducer.cc.

Referenced by produce().

whether or not writing to DB

Definition at line 61 of file MisalignedMuonESProducer.cc.

Referenced by produce().