CMS 3D CMS Logo

Public Member Functions | Private Attributes

TrackerDigiGeometryESModule Class Reference

#include <TrackerDigiGeometryESModule.h>

Inheritance diagram for TrackerDigiGeometryESModule:
edm::ESProducer edm::ESProxyFactoryProducer edm::eventsetup::DataProxyProvider

List of all members.

Public Member Functions

boost::shared_ptr
< TrackerGeometry
produce (const TrackerDigiGeometryRecord &)
 TrackerDigiGeometryESModule (const edm::ParameterSet &p)
virtual ~TrackerDigiGeometryESModule ()

Private Attributes

boost::shared_ptr
< TrackerGeometry
_tracker
 Called when geometry description changes.
const std::string alignmentsLabel_
bool applyAlignment_
bool fromDDD_
const std::string myLabel_

Detailed Description

Definition at line 12 of file TrackerDigiGeometryESModule.h.


Constructor & Destructor Documentation

TrackerDigiGeometryESModule::TrackerDigiGeometryESModule ( const edm::ParameterSet p)

Definition at line 28 of file TrackerDigiGeometryESModule.cc.

References alignmentsLabel_, applyAlignment_, fromDDD_, edm::ParameterSet::getParameter(), myLabel_, and edm::ESProducer::setWhatProduced().

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

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

    setWhatProduced(this);

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

Definition at line 45 of file TrackerDigiGeometryESModule.cc.

{}

Member Function Documentation

boost::shared_ptr< TrackerGeometry > TrackerDigiGeometryESModule::produce ( const TrackerDigiGeometryRecord iRecord)

Definition at line 49 of file TrackerDigiGeometryESModule.cc.

References _tracker, alignmentsLabel_, applyAlignment_, GeometryAligner::applyAlignments(), GeometryAligner::attachSurfaceDeformations(), TrackerGeomBuilderFromGeometricDet::build(), align::DetectorGlobalPosition(), edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::getRecord(), myLabel_, and DetId::Tracker.

{ 
  //
  // Called whenever the alignments, alignment errors or global positions change
  //
  edm::ESHandle<GeometricDet> gD;
  iRecord.getRecord<IdealGeometryRecord>().get( gD );
  
  TrackerGeomBuilderFromGeometricDet builder;
  _tracker  = boost::shared_ptr<TrackerGeometry>(builder.build(&(*gD)));

  if (applyAlignment_) {
    // Since fake is fully working when checking for 'empty', we should get rid of applyAlignment_!
    edm::ESHandle<Alignments> globalPosition;
    iRecord.getRecord<GlobalPositionRcd>().get(alignmentsLabel_, globalPosition);
    edm::ESHandle<Alignments> alignments;
    iRecord.getRecord<TrackerAlignmentRcd>().get(alignmentsLabel_, alignments);
    edm::ESHandle<AlignmentErrors> alignmentErrors;
    iRecord.getRecord<TrackerAlignmentErrorRcd>().get(alignmentsLabel_, alignmentErrors);
    // apply if not empty:
    if (alignments->empty() && alignmentErrors->empty() && globalPosition->empty()) {
      edm::LogInfo("Config") << "@SUB=TrackerDigiGeometryRecord::produce"
                             << "Alignment(Error)s and global position (label '"
                             << alignmentsLabel_ << "') empty: Geometry producer (label "
                             << "'" << myLabel_ << "') assumes fake and does not apply.";
    } else {
      GeometryAligner ali;
      ali.applyAlignments<TrackerGeometry>(&(*_tracker), &(*alignments), &(*alignmentErrors),
                                           align::DetectorGlobalPosition(*globalPosition,
                                                                         DetId(DetId::Tracker)));
    }

    edm::ESHandle<AlignmentSurfaceDeformations> surfaceDeformations;
    iRecord.getRecord<TrackerSurfaceDeformationRcd>().get(alignmentsLabel_, surfaceDeformations);
    // apply if not empty:
    if (surfaceDeformations->empty()) {
      edm::LogInfo("Config") << "@SUB=TrackerDigiGeometryRecord::produce"
                             << "AlignmentSurfaceDeformations (label '"
                             << alignmentsLabel_ << "') empty: Geometry producer (label "
                             << "'" << myLabel_ << "') assumes fake and does not apply.";
    } else {
      GeometryAligner ali;
      ali.attachSurfaceDeformations<TrackerGeometry>(&(*_tracker), &(*surfaceDeformations));
    }
  }
  
  return _tracker;
} 

Member Data Documentation

Called when geometry description changes.

Definition at line 19 of file TrackerDigiGeometryESModule.h.

Referenced by produce().

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

Definition at line 22 of file TrackerDigiGeometryESModule.h.

Referenced by produce(), and TrackerDigiGeometryESModule().

Definition at line 20 of file TrackerDigiGeometryESModule.h.

Referenced by produce(), and TrackerDigiGeometryESModule().

Definition at line 21 of file TrackerDigiGeometryESModule.h.

Referenced by TrackerDigiGeometryESModule().

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

Definition at line 23 of file TrackerDigiGeometryESModule.h.

Referenced by produce(), and TrackerDigiGeometryESModule().