CMS 3D CMS Logo

DTGeometryESModule Class Reference

ESProducer for DTGeometry in MuonGeometryRecord. More...

#include <Geometry/DTGeometryBuilder/plugins/DTGeometryESModule.h>

Inheritance diagram for DTGeometryESModule:

edm::ESProducer edm::ESProxyFactoryProducer edm::eventsetup::DataProxyProvider

List of all members.

Public Member Functions

 DTGeometryESModule (const edm::ParameterSet &p)
 Constructor.
boost::shared_ptr< DTGeometryproduce (const MuonGeometryRecord &record)
 Produce DTGeometry.
virtual ~DTGeometryESModule ()
 Destructor.

Private Member Functions

void geometryCallback_ (const MuonNumberingRecord &)
 Called when geometry description changes.

Private Attributes

boost::shared_ptr< DTGeometry_dtGeometry
const std::string alignmentsLabel_
bool applyAlignment_
const std::string myLabel_


Detailed Description

ESProducer for DTGeometry in MuonGeometryRecord.

Date
2008/06/26 12:20:40
Revision
1.3
Author:
N. Amapane - CERN

Definition at line 21 of file DTGeometryESModule.h.


Constructor & Destructor Documentation

DTGeometryESModule::DTGeometryESModule ( const edm::ParameterSet p  ) 

Constructor.

Definition at line 29 of file DTGeometryESModule.cc.

References alignmentsLabel_, applyAlignment_, edm::eventsetup::dependsOn(), geometryCallback_(), edm::ParameterSet::getParameter(), myLabel_, and edm::ESProducer::setWhatProduced().

00030   : alignmentsLabel_(p.getParameter<std::string>("alignmentsLabel")),
00031     myLabel_(p.getParameter<std::string>("appendToDataLabel"))
00032 {
00033 
00034   applyAlignment_ = p.getParameter<bool>("applyAlignment");
00035 
00036   setWhatProduced(this, dependsOn(&DTGeometryESModule::geometryCallback_) );
00037 
00038   edm::LogInfo("Geometry") << "@SUB=DTGeometryESModule"
00039                            << "Label '" << myLabel_ << "' "
00040                            << (applyAlignment_ ? "looking for" : "IGNORING")
00041                            << " alignment labels '" << alignmentsLabel_ << "'.";
00042 }

DTGeometryESModule::~DTGeometryESModule (  )  [virtual]

Destructor.

Definition at line 45 of file DTGeometryESModule.cc.

00045 {}


Member Function Documentation

void DTGeometryESModule::geometryCallback_ ( const MuonNumberingRecord record  )  [private]

Called when geometry description changes.

Definition at line 83 of file DTGeometryESModule.cc.

References _dtGeometry, DTGeometryBuilderFromDDD::build(), edm::eventsetup::EventSetupRecordImplementation< T >::get(), and edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::getRecord().

Referenced by DTGeometryESModule().

00084 {
00085   
00086   //
00087   // Called whenever the muon numbering (or ideal geometry) changes
00088   //
00089   edm::ESHandle<DDCompactView> cpv;
00090   edm::ESHandle<MuonDDDConstants> mdc;
00091   record.getRecord<IdealGeometryRecord>().get(cpv);
00092   record.get( mdc );
00093   DTGeometryBuilderFromDDD builder;
00094   _dtGeometry = boost::shared_ptr<DTGeometry>(builder.build(&(*cpv), *mdc));
00095 
00096 }

boost::shared_ptr< DTGeometry > DTGeometryESModule::produce ( const MuonGeometryRecord record  ) 

Produce DTGeometry.

Definition at line 49 of file DTGeometryESModule.cc.

References _dtGeometry, alignmentsLabel_, applyAlignment_, GeometryAligner::applyAlignments(), align::DetectorGlobalPosition(), edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::getRecord(), DetId::Muon, and myLabel_.

00049                                                              {
00050 
00051   //
00052   // Called whenever the alignments or alignment errors change
00053   //  
00054   if ( applyAlignment_ ) {
00055     // applyAlignment_ is scheduled for removal. 
00056     // Ideal geometry obtained by using 'fake alignment' (with applyAlignment_ = true)
00057     edm::ESHandle<Alignments> globalPosition;
00058     record.getRecord<GlobalPositionRcd>().get(alignmentsLabel_, globalPosition);
00059     edm::ESHandle<Alignments> alignments;
00060     record.getRecord<DTAlignmentRcd>().get(alignmentsLabel_, alignments);
00061     edm::ESHandle<AlignmentErrors> alignmentErrors;
00062     record.getRecord<DTAlignmentErrorRcd>().get(alignmentsLabel_, alignmentErrors);
00063     // Only apply alignment if values exist
00064     if (alignments->empty() && alignmentErrors->empty() && globalPosition->empty()) {
00065       edm::LogInfo("Config") << "@SUB=DTGeometryRecord::produce"
00066                              << "Alignment(Error)s and global position (label '"
00067                              << alignmentsLabel_ << "') empty: Geometry producer (label "
00068                              << "'" << myLabel_ << "') assumes fake and does not apply.";
00069     } else {
00070       GeometryAligner aligner;
00071       aligner.applyAlignments<DTGeometry>( &(*_dtGeometry),
00072                                            &(*alignments), &(*alignmentErrors),
00073                                            align::DetectorGlobalPosition(*globalPosition, DetId(DetId::Muon)));
00074     }
00075   }
00076 
00077   return _dtGeometry;
00078 
00079 }


Member Data Documentation

boost::shared_ptr<DTGeometry> DTGeometryESModule::_dtGeometry [private]

Definition at line 35 of file DTGeometryESModule.h.

Referenced by geometryCallback_(), and produce().

const std::string DTGeometryESModule::alignmentsLabel_ [private]

Definition at line 38 of file DTGeometryESModule.h.

Referenced by DTGeometryESModule(), and produce().

bool DTGeometryESModule::applyAlignment_ [private]

Definition at line 36 of file DTGeometryESModule.h.

Referenced by DTGeometryESModule(), and produce().

const std::string DTGeometryESModule::myLabel_ [private]

Definition at line 39 of file DTGeometryESModule.h.

Referenced by DTGeometryESModule(), and produce().


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