CMS 3D CMS Logo

MisalignedMuonESProducer Class Reference

An ESProducer that fills the MuonDigiGeometryRcd with a misaligned Muon. More...

#include <Alignment/MuonAlignment/plugins/MisalignedMuonESProducer.h>

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
std::string theDTErrorRecordName
boost::shared_ptr< DTGeometrytheDTGeometry
edm::ParameterSet theParameterSet


Detailed Description

An ESProducer that fills the MuonDigiGeometryRcd with a misaligned Muon.

The misaligned muon ES producer.

This should replace the standard DTGeometry and CSCGeometry producers when producing Misalignment scenarios.

Date
2007/04/17 12:10:20
Revision
1.1
Author:
Andre Sznajder - UERJ(Brazil)

Definition at line 29 of file MisalignedMuonESProducer.h.


Constructor & Destructor Documentation

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

Constructor.

An ESProducer that fills the MuonDigiGeometryRcd with a misaligned Muon.

Definition at line 35 of file MisalignedMuonESProducer.cc.

References edm::ESProducer::setWhatProduced().

00035                                                                            :
00036   theParameterSet( p ),
00037   theDTAlignRecordName( "DTAlignmentRcd" ),
00038   theDTErrorRecordName( "DTAlignmentErrorRcd" ),
00039   theCSCAlignRecordName( "CSCAlignmentRcd" ),
00040   theCSCErrorRecordName( "CSCAlignmentErrorRcd" )
00041 {
00042   
00043   setWhatProduced(this);
00044 
00045 }

MisalignedMuonESProducer::~MisalignedMuonESProducer (  )  [virtual]

Destructor.

Definition at line 49 of file MisalignedMuonESProducer.cc.

00049 {}


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 54 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::ParameterSet::getUntrackedParameter(), edm::es::products(), saveToDB(), theCSCGeometry, theDTGeometry, and theParameterSet.

00055 { 
00056 
00057   edm::LogInfo("MisalignedMuon") << "Producer called";
00058   
00059 
00060   // Create the Muon geometry from ideal geometry
00061   edm::ESHandle<DDCompactView> cpv;
00062   iRecord.getRecord<IdealGeometryRecord>().get( cpv );
00063 
00064   edm::ESHandle<MuonDDDConstants> mdc;
00065   iRecord.getRecord<MuonNumberingRecord>().get(mdc);
00066 
00067   DTGeometryBuilderFromDDD  DTGeometryBuilder;
00068   CSCGeometryBuilderFromDDD CSCGeometryBuilder;
00069 
00070   theDTGeometry   = boost::shared_ptr<DTGeometry>(  DTGeometryBuilder.build( &(*cpv), *mdc ) );
00071   //theCSCGeometry  = boost::shared_ptr<CSCGeometry>( CSCGeometryBuilder.build( &(*cpv), *mdc ) );
00072   theCSCGeometry  = boost::shared_ptr<CSCGeometry>( new CSCGeometry );
00073   CSCGeometryBuilder.build( theCSCGeometry,  &(*cpv), *mdc );
00074 
00075 
00076   // Create the alignable hierarchy
00077   AlignableMuon* theAlignableMuon = new AlignableMuon( &(*theDTGeometry) , &(*theCSCGeometry) );
00078 
00079   // Create misalignment scenario
00080   MuonScenarioBuilder scenarioBuilder( theAlignableMuon );
00081   scenarioBuilder.applyScenario( theParameterSet );
00082   
00083   // Get alignments and errors
00084   dt_Alignments = theAlignableMuon->dtAlignments() ;
00085   dt_AlignmentErrors = theAlignableMuon->dtAlignmentErrors();
00086   csc_Alignments = theAlignableMuon->cscAlignments();
00087   csc_AlignmentErrors = theAlignableMuon->cscAlignmentErrors();
00088 
00089  
00090   // Misalign the EventSetup geometry
00091   GeometryAligner aligner;
00092 
00093   aligner.applyAlignments<DTGeometry>( &(*theDTGeometry),
00094                                        dt_Alignments, 
00095                                        dt_AlignmentErrors,
00096                                        AlignTransform() );
00097   aligner.applyAlignments<CSCGeometry>( &(*theCSCGeometry ),
00098                                         csc_Alignments,
00099                                         csc_AlignmentErrors,
00100                                         AlignTransform() );  
00101 
00102   // Write alignments to DB
00103   if ( theParameterSet.getUntrackedParameter<bool>("saveToDbase", false) ) saveToDB();
00104 
00105   edm::LogInfo("MisalignedMuon") << "Producer done";
00106 
00107   return edm::es::products( theDTGeometry, theCSCGeometry ); 
00108   
00109 }

void MisalignedMuonESProducer::saveToDB ( void   ) 

Save alignemnts and error to database.

Definition at line 113 of file MisalignedMuonESProducer.cc.

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

Referenced by produce().

00114 {
00115 
00116   // Call service
00117   edm::Service<cond::service::PoolDBOutputService> poolDbService;
00118   if( !poolDbService.isAvailable() ) // Die if not available
00119         throw cms::Exception("NotAvailable") << "PoolDBOutputService not available";
00120 
00121   // Store DT alignments and errors
00122   poolDbService->writeOne<Alignments>( &(*dt_Alignments), poolDbService->beginOfTime(), theDTAlignRecordName);
00123   poolDbService->writeOne<AlignmentErrors>( &(*dt_AlignmentErrors), poolDbService->beginOfTime(), theDTErrorRecordName);
00124 
00125   // Store CSC alignments and errors
00126   poolDbService->writeOne<Alignments>( &(*csc_Alignments), poolDbService->beginOfTime(), theCSCAlignRecordName);
00127   poolDbService->writeOne<AlignmentErrors>( &(*csc_AlignmentErrors), poolDbService->beginOfTime(), theCSCErrorRecordName);
00128 
00129 }


Member Data Documentation

AlignmentErrors* MisalignedMuonESProducer::csc_AlignmentErrors [private]

Definition at line 59 of file MisalignedMuonESProducer.h.

Referenced by produce().

Alignments* MisalignedMuonESProducer::csc_Alignments [private]

Definition at line 58 of file MisalignedMuonESProducer.h.

Referenced by produce().

AlignmentErrors* MisalignedMuonESProducer::dt_AlignmentErrors [private]

Definition at line 57 of file MisalignedMuonESProducer.h.

Referenced by produce().

Alignments* MisalignedMuonESProducer::dt_Alignments [private]

Definition at line 56 of file MisalignedMuonESProducer.h.

Referenced by produce().

std::string MisalignedMuonESProducer::theCSCAlignRecordName [private]

Definition at line 51 of file MisalignedMuonESProducer.h.

Referenced by saveToDB().

std::string MisalignedMuonESProducer::theCSCErrorRecordName [private]

Definition at line 51 of file MisalignedMuonESProducer.h.

Referenced by saveToDB().

boost::shared_ptr<CSCGeometry> MisalignedMuonESProducer::theCSCGeometry [private]

Definition at line 54 of file MisalignedMuonESProducer.h.

Referenced by produce().

std::string MisalignedMuonESProducer::theDTAlignRecordName [private]

Definition at line 50 of file MisalignedMuonESProducer.h.

Referenced by saveToDB().

std::string MisalignedMuonESProducer::theDTErrorRecordName [private]

Definition at line 50 of file MisalignedMuonESProducer.h.

Referenced by saveToDB().

boost::shared_ptr<DTGeometry> MisalignedMuonESProducer::theDTGeometry [private]

Definition at line 53 of file MisalignedMuonESProducer.h.

Referenced by produce().

edm::ParameterSet MisalignedMuonESProducer::theParameterSet [private]

Definition at line 48 of file MisalignedMuonESProducer.h.

Referenced by produce().


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