CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

DTGeometryESModule Class Reference

#include <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 &record)

Private Attributes

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

Detailed Description

ESProducer for DTGeometry in MuonGeometryRecord

Date:
2009/03/10 17:39:31
Revision:
1.5
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 35 of file DTGeometryESModule.cc.

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

  : alignmentsLabel_(p.getParameter<std::string>("alignmentsLabel")),
    myLabel_(p.getParameter<std::string>("appendToDataLabel")),
    fromDDD_(p.getParameter<bool>("fromDDD"))
{

  applyAlignment_ = p.getParameter<bool>("applyAlignment");

  setWhatProduced(this, dependsOn(&DTGeometryESModule::geometryCallback_) );

  edm::LogInfo("Geometry") << "@SUB=DTGeometryESModule"
    << "Label '" << myLabel_ << "' "
    << (applyAlignment_ ? "looking for" : "IGNORING")
    << " alignment labels '" << alignmentsLabel_ << "'.";
}
DTGeometryESModule::~DTGeometryESModule ( ) [virtual]

Destructor.

Definition at line 51 of file DTGeometryESModule.cc.

{}

Member Function Documentation

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

Definition at line 86 of file DTGeometryESModule.cc.

References _dtGeometry, DTGeometryBuilderFromDDD::build(), DTGeometryBuilderFromCondDB::build(), fromDDD_, edm::eventsetup::EventSetupRecord::get(), and edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::getRecord().

Referenced by DTGeometryESModule().

                                                                              {
  //
  // Called whenever the muon numbering (or ideal geometry) changes
  //

  _dtGeometry = boost::shared_ptr<DTGeometry>(new DTGeometry );
  if ( fromDDD_ ) {
    edm::ESHandle<MuonDDDConstants> mdc;
    record.get( mdc );

    edm::ESTransientHandle<DDCompactView> cpv;
    record.getRecord<IdealGeometryRecord>().get(cpv);

    DTGeometryBuilderFromDDD builder;
    builder.build(_dtGeometry, &(*cpv), *mdc);
  } else {
    edm::ESHandle<RecoIdealGeometry> rig;
    record.getRecord<DTRecoGeometryRcd>().get(rig);

    DTGeometryBuilderFromCondDB builder;
    builder.build(_dtGeometry, *rig);
  }

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

Produce DTGeometry.

Definition at line 54 of file DTGeometryESModule.cc.

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

                                                             {

  //
  // Called whenever the alignments or alignment errors change
  //  
  if ( applyAlignment_ ) {
    // applyAlignment_ is scheduled for removal. 
    // Ideal geometry obtained by using 'fake alignment' (with applyAlignment_ = true)
    edm::ESHandle<Alignments> globalPosition;
    record.getRecord<GlobalPositionRcd>().get(alignmentsLabel_, globalPosition);
    edm::ESHandle<Alignments> alignments;
    record.getRecord<DTAlignmentRcd>().get(alignmentsLabel_, alignments);
    edm::ESHandle<AlignmentErrors> alignmentErrors;
    record.getRecord<DTAlignmentErrorRcd>().get(alignmentsLabel_, alignmentErrors);
    // Only apply alignment if values exist
    if (alignments->empty() && alignmentErrors->empty() && globalPosition->empty()) {
      edm::LogInfo("Config") << "@SUB=DTGeometryRecord::produce"
        << "Alignment(Error)s and global position (label '"
        << alignmentsLabel_ << "') empty: Geometry producer (label "
        << "'" << myLabel_ << "') assumes fake and does not apply.";
    } else {
      GeometryAligner aligner;
      aligner.applyAlignments<DTGeometry>( &(*_dtGeometry),
                                           &(*alignments), &(*alignmentErrors),
                                           align::DetectorGlobalPosition(*globalPosition, DetId(DetId::Muon)));
    }
  }

  return _dtGeometry;

}

Member Data Documentation

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

Definition at line 34 of file DTGeometryESModule.h.

Referenced by geometryCallback_(), and produce().

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

Definition at line 37 of file DTGeometryESModule.h.

Referenced by DTGeometryESModule(), and produce().

Definition at line 36 of file DTGeometryESModule.h.

Referenced by DTGeometryESModule(), and produce().

Definition at line 39 of file DTGeometryESModule.h.

Referenced by geometryCallback_().

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

Definition at line 38 of file DTGeometryESModule.h.

Referenced by DTGeometryESModule(), and produce().