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 dbGeometryCallback_ (const DTRecoGeometryRcd &record)
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:
2011/12/10 03:13:18
Revision:
1.6
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_, dbGeometryCallback_(), edm::eventsetup::dependsOn(), fromDDD_, 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");

  if(fromDDD_) {
    setWhatProduced(this, dependsOn(&DTGeometryESModule::geometryCallback_) );
  } else {
    setWhatProduced(this, dependsOn(&DTGeometryESModule::dbGeometryCallback_) );
  }

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

Destructor.

Definition at line 55 of file DTGeometryESModule.cc.

{}

Member Function Documentation

void DTGeometryESModule::dbGeometryCallback_ ( const DTRecoGeometryRcd record) [private]

Definition at line 107 of file DTGeometryESModule.cc.

References _dtGeometry, DTGeometryBuilderFromCondDB::build(), and edm::eventsetup::EventSetupRecord::get().

Referenced by DTGeometryESModule().

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

  _dtGeometry = boost::shared_ptr<DTGeometry>(new DTGeometry );
  edm::ESHandle<RecoIdealGeometry> rig;
  record.get(rig);
  
  DTGeometryBuilderFromCondDB builder;
  builder.build(_dtGeometry, *rig);

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

Definition at line 90 of file DTGeometryESModule.cc.

References _dtGeometry, DTGeometryBuilderFromDDD::build(), 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 );
  edm::ESHandle<MuonDDDConstants> mdc;
  record.get( mdc );

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

  DTGeometryBuilderFromDDD builder;
  builder.build(_dtGeometry, &(*cpv), *mdc);
    
}
boost::shared_ptr< DTGeometry > DTGeometryESModule::produce ( const MuonGeometryRecord record)

Produce DTGeometry.

Definition at line 58 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 35 of file DTGeometryESModule.h.

Referenced by dbGeometryCallback_(), geometryCallback_(), and produce().

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

Definition at line 38 of file DTGeometryESModule.h.

Referenced by DTGeometryESModule(), and produce().

Definition at line 37 of file DTGeometryESModule.h.

Referenced by DTGeometryESModule(), and produce().

Definition at line 40 of file DTGeometryESModule.h.

Referenced by DTGeometryESModule().

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

Definition at line 39 of file DTGeometryESModule.h.

Referenced by DTGeometryESModule(), and produce().