CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

CSCGeometryESModule Class Reference

#include <CSCGeometryESModule.h>

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

List of all members.

Public Member Functions

 CSCGeometryESModule (const edm::ParameterSet &p)
 Constructor.
boost::shared_ptr< CSCGeometryproduce (const MuonGeometryRecord &record)
 Produce CSCGeometry.
virtual ~CSCGeometryESModule ()
 Destructor.

Private Member Functions

void cscRecoDigiParametersChanged_ (const CSCRecoDigiParametersRcd &)
void cscRecoGeometryChanged_ (const CSCRecoGeometryRcd &)
void initCSCGeometry_ (const MuonGeometryRecord &)
void muonNumberingChanged_ (const MuonNumberingRecord &)
 Called when geometry description changes.

Private Attributes

const std::string alignmentsLabel_
bool applyAlignment_
boost::shared_ptr< CSCGeometrycscGeometry
bool debugV
const std::string myLabel_
bool recreateGeometry_
bool useCentreTIOffsets
bool useDDD_
bool useGangedStripsInME1a
bool useOnlyWiresInME1a
bool useRealWireGeometry

Detailed Description

ESProducer for CSCGeometry in MuonGeometryRecord

Author:
Tim Cox

Definition at line 19 of file CSCGeometryESModule.h.


Constructor & Destructor Documentation

CSCGeometryESModule::CSCGeometryESModule ( const edm::ParameterSet p)

Constructor.

Definition at line 35 of file CSCGeometryESModule.cc.

References alignmentsLabel_, applyAlignment_, cscRecoDigiParametersChanged_(), cscRecoGeometryChanged_(), debugV, edm::eventsetup::dependsOn(), edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), muonNumberingChanged_(), myLabel_, edm::ESProducer::setWhatProduced(), useCentreTIOffsets, useDDD_, useGangedStripsInME1a, useOnlyWiresInME1a, and useRealWireGeometry.

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

  // Choose wire geometry modelling
  // We now _require_ some wire geometry specification in the CSCOrcaSpec.xml file
  // in the DDD Geometry.
  // Default as of transition to CMSSW is to use real values.
  // Alternative is to use pseudo-values which match reasonably closely
  // the calculated geometry values used up to and including ORCA_8_8_1.
  // (This was the default in ORCA.)

  useRealWireGeometry =   p.getParameter<bool>("useRealWireGeometry");

  // Suppress strips altogether in ME1a region of ME11?

  useOnlyWiresInME1a =    p.getParameter<bool>("useOnlyWiresInME1a");

  // Allow strips in ME1a region of ME11 but gang them?
  // Default is now to treat ME1a with ganged strips (e.g. in clusterizer)

  useGangedStripsInME1a = p.getParameter<bool>("useGangedStripsInME1a");

  if ( useGangedStripsInME1a ) useOnlyWiresInME1a = false; // override possible inconsistentcy

  // Use the backed-out offsets that correct the CTI
  useCentreTIOffsets = p.getParameter<bool>("useCentreTIOffsets"); 

  // Debug printout etc. in CSCGeometry etc.

  debugV = p.getUntrackedParameter<bool>("debugV", false);

  // Find out if using the DDD or CondDB Geometry source.
  useDDD_ = p.getParameter<bool>("useDDD");

  // Feed these value to where I need them
  applyAlignment_ = p.getParameter<bool>("applyAlignment");


  edm::LogInfo("Geometry") << "@SUB=CSCGeometryESModule" 
                           << "Label '" << myLabel_ << "' "
                           << (applyAlignment_ ? "looking for" : "IGNORING")
                           << " alignment labels '" << alignmentsLabel_ << "'.";
  if(useDDD_) {
    setWhatProduced(this, dependsOn(&CSCGeometryESModule::muonNumberingChanged_) );
  } else {
    setWhatProduced(this, dependsOn(&CSCGeometryESModule::cscRecoGeometryChanged_) & (&CSCGeometryESModule::cscRecoDigiParametersChanged_) );
  }
}
CSCGeometryESModule::~CSCGeometryESModule ( ) [virtual]

Destructor.

Definition at line 88 of file CSCGeometryESModule.cc.

{}

Member Function Documentation

void CSCGeometryESModule::cscRecoDigiParametersChanged_ ( const CSCRecoDigiParametersRcd ) [private]

Definition at line 174 of file CSCGeometryESModule.cc.

References recreateGeometry_.

Referenced by CSCGeometryESModule().

                                                                                         {
  recreateGeometry_=true;
}
void CSCGeometryESModule::cscRecoGeometryChanged_ ( const CSCRecoGeometryRcd ) [private]

Definition at line 171 of file CSCGeometryESModule.cc.

References recreateGeometry_.

Referenced by CSCGeometryESModule().

                                                                             {
  recreateGeometry_=true;
}
void CSCGeometryESModule::initCSCGeometry_ ( const MuonGeometryRecord record) [private]

Definition at line 131 of file CSCGeometryESModule.cc.

References CSCGeometryBuilderFromDDD::build(), CSCGeometryBuilder::build(), cscGeometry, debugV, edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::getRecord(), recreateGeometry_, useCentreTIOffsets, useDDD_, useGangedStripsInME1a, useOnlyWiresInME1a, and useRealWireGeometry.

Referenced by produce().

{
  if(not recreateGeometry_) return;

  // Updates whenever a dependent Record was changed

  cscGeometry = boost::shared_ptr<CSCGeometry>( new CSCGeometry );

  cscGeometry->setUseRealWireGeometry( useRealWireGeometry );
  cscGeometry->setOnlyWiresInME1a( useOnlyWiresInME1a );
  cscGeometry->setGangedStripsInME1a( useGangedStripsInME1a );
  cscGeometry->setUseCentreTIOffsets( useCentreTIOffsets );
  cscGeometry->setDebugV( debugV );
  if ( debugV ) cscGeometry->queryModelling();

  // Called whenever the muon numbering (or ideal geometry) changes
  //
  if ( useDDD_ ) {
    edm::ESTransientHandle<DDCompactView> cpv;
    edm::ESHandle<MuonDDDConstants> mdc;
    record.getRecord<IdealGeometryRecord>().get(cpv);
    record.getRecord<MuonNumberingRecord>().get( mdc );
    CSCGeometryBuilderFromDDD builder;
    //    _cscGeometry = boost::shared_ptr<CSCGeometry>(builder.build(_cscGeometry, &(*cpv), *mdc));
    builder.build(cscGeometry, &(*cpv), *mdc);
  } else {
    edm::ESHandle<RecoIdealGeometry> rig;
    edm::ESHandle<CSCRecoDigiParameters> rdp;
    record.getRecord<CSCRecoGeometryRcd>().get(rig);
    record.getRecord<CSCRecoDigiParametersRcd>().get(rdp);
    CSCGeometryBuilder cscgb;
    //    _cscGeometry = boost::shared_ptr<CSCGeometry>(cscgb.build(_cscGeometry, *rig, *rdp));
    cscgb.build(cscGeometry, *rig, *rdp);
  }
  recreateGeometry_=false;
}
void CSCGeometryESModule::muonNumberingChanged_ ( const MuonNumberingRecord ) [private]

Called when geometry description changes.

Definition at line 168 of file CSCGeometryESModule.cc.

References recreateGeometry_.

Referenced by CSCGeometryESModule().

                                                                            {
  recreateGeometry_=true;
}
boost::shared_ptr< CSCGeometry > CSCGeometryESModule::produce ( const MuonGeometryRecord record)

Produce CSCGeometry.

Definition at line 91 of file CSCGeometryESModule.cc.

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

                                                                                          {

  initCSCGeometry_(record);

  // 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<CSCAlignmentRcd>().get(alignmentsLabel_, alignments);
    edm::ESHandle<AlignmentErrors> alignmentErrors;
// <<<<<<< CSCGeometryESModule.cc
//     record.getRecord<CSCAlignmentErrorRcd>().get( alignmentErrors );
//     GeometryAligner aligner;
//     aligner.applyAlignments<CSCGeometry>( &(*_cscGeometry),
//                                        &(*alignments), &(*alignmentErrors),
//       align::DetectorGlobalPosition(*globalPositionRcd, DetId(DetId::Muon)));
// =======
    record.getRecord<CSCAlignmentErrorRcd>().get(alignmentsLabel_,  alignmentErrors);
    // Only apply alignment if values exist
    if (alignments->empty() && alignmentErrors->empty() && globalPosition->empty()) {
      edm::LogInfo("Config") << "@SUB=CSCGeometryRecord::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<CSCGeometry>( &(*cscGeometry), &(*alignments), &(*alignmentErrors),
                            align::DetectorGlobalPosition(*globalPosition, DetId(DetId::Muon)) );
    }
// >>>>>>> 1.8
  }

  return cscGeometry;
}

Member Data Documentation

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

Definition at line 49 of file CSCGeometryESModule.h.

Referenced by CSCGeometryESModule(), and produce().

Definition at line 47 of file CSCGeometryESModule.h.

Referenced by CSCGeometryESModule(), and produce().

boost::shared_ptr<CSCGeometry> CSCGeometryESModule::cscGeometry [private]

Definition at line 38 of file CSCGeometryESModule.h.

Referenced by initCSCGeometry_(), and produce().

Definition at line 46 of file CSCGeometryESModule.h.

Referenced by CSCGeometryESModule(), and initCSCGeometry_().

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

Definition at line 50 of file CSCGeometryESModule.h.

Referenced by CSCGeometryESModule(), and produce().

Definition at line 45 of file CSCGeometryESModule.h.

Referenced by CSCGeometryESModule(), and initCSCGeometry_().

Definition at line 48 of file CSCGeometryESModule.h.

Referenced by CSCGeometryESModule(), and initCSCGeometry_().

Definition at line 44 of file CSCGeometryESModule.h.

Referenced by CSCGeometryESModule(), and initCSCGeometry_().

Definition at line 43 of file CSCGeometryESModule.h.

Referenced by CSCGeometryESModule(), and initCSCGeometry_().

Definition at line 42 of file CSCGeometryESModule.h.

Referenced by CSCGeometryESModule(), and initCSCGeometry_().