#include <Alignment/MuonAlignment/plugins/MisalignedMuonESProducer.h>
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 | |
AlignmentErrors * | csc_AlignmentErrors |
Alignments * | csc_Alignments |
AlignmentErrors * | dt_AlignmentErrors |
Alignments * | dt_Alignments |
std::string | theCSCAlignRecordName |
std::string | theCSCErrorRecordName |
boost::shared_ptr< CSCGeometry > | theCSCGeometry |
std::string | theDTAlignRecordName |
std::string | theDTErrorRecordName |
boost::shared_ptr< DTGeometry > | theDTGeometry |
edm::ParameterSet | theParameterSet |
The misaligned muon ES producer.
This should replace the standard DTGeometry and CSCGeometry producers when producing Misalignment scenarios.
Definition at line 29 of file MisalignedMuonESProducer.h.
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] |
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 }
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 }
std::string MisalignedMuonESProducer::theCSCAlignRecordName [private] |
std::string MisalignedMuonESProducer::theCSCErrorRecordName [private] |
boost::shared_ptr<CSCGeometry> MisalignedMuonESProducer::theCSCGeometry [private] |
std::string MisalignedMuonESProducer::theDTAlignRecordName [private] |
std::string MisalignedMuonESProducer::theDTErrorRecordName [private] |
boost::shared_ptr<DTGeometry> MisalignedMuonESProducer::theDTGeometry [private] |