// // $Id: absRcpGeometer.cpp,v 1.7 2001/06/14 20:57:22 hobbs Exp $ // // File: absRcpGeometer.cpp // Purpose: // Created: 9-NOV-2000 John Hobbs // // $Revision: 1.7 $ // // // Include files #include "geometry_system/management/RcpGeometerRegistry.hpp" #include "geometry_system/management/absRcpGeometer.hpp" // Global definitions using std::set; using std::vector; using std::string; using edm::RCPID; using edm::RCP; using namespace dgs; absRcpGeometer::absRcpGeometer(): _check_every_event(false) { RcpGeometerRegistry* rgr = RcpGeometerRegistry::get_instance(); rgr->add(this); } absRcpGeometer::~absRcpGeometer() { RcpGeometerRegistry* rgr = RcpGeometerRegistry::get_instance(); rgr->remove(this); } RCPID absRcpGeometer::id() const { return d_currentRCP; } bool absRcpGeometer::absRefresh(const bool isMC, const int runNumber, const std::vector& versions, const edm::Event *anEvt/*=0*/) { RCP* newRCP = check_version(isMC,runNumber,versions,anEvt); bool doneOK = false; if( newRCP && (newRCP->getRCPID()!=d_currentRCP)) doneOK=absRefresh(newRCP); return doneOK; } bool absRcpGeometer::absRefresh(const RCP* newRCP) { // NOP, if the pointer if NULL. Why not use a reference? Because we want // backward compatibility with existing silicon geometry code. if( !newRCP ) return false; // Do the update bool doneOK = refresh(newRCP); if( doneOK ) { d_currentRCP = newRCP->getRCPID(); RcpGeometerRegistry::get_instance()->update_environment(this,d_currentRCP); notify_observers(); } return doneOK; } // Default version. Never switch RCP parameters by default RCP* absRcpGeometer::check_version(const bool isMC, const int runNumber, const vector& versions, const edm::Event *anEvt/*=0*/) { return 0; }