| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

StaticCableSvc Class Reference

#include <StaticCableSvc.h>

Inheritance diagram for StaticCableSvc:

[legend]
Collaboration diagram for StaticCableSvc:
[legend]
List of all members.

Public Types

 SUCCESS
 NO_INTERFACE
 VERSMISMATCH
 LAST_ERROR
enum  Status

Public Member Functions

 StaticCableSvc (const std::string &name, ISvcLocator *svc)
 ~StaticCableSvc ()
virtual StatusCode initialize ()
virtual StatusCode finalize ()
virtual StatusCode queryInterface (const InterfaceID &riid, void **ppvInterface)
const std::vector< DayaBay::HardwareId > & hardwareIds (const ServiceMode &svcMode)
const std::vector< DayaBay::PmtHardwareId > & pmtHardwareIds (const ServiceMode &svcMode)
const std::vector< DayaBay::RpcHardwareId > & rpcHardwareIds (const ServiceMode &svcMode)
const std::vector< DayaBay::FeeHardwareId > & feeHardwareIds (const ServiceMode &svcMode)
const std::vector< DayaBay::FecHardwareId > & fecHardwareIds (const ServiceMode &svcMode)
const std::vector< DayaBay::DetectorSensor > & sensors (const ServiceMode &svcMode)
const std::vector< DayaBay::AdPmtSensor > & adPmtSensors (const ServiceMode &svcMode)
const std::vector< DayaBay::PoolPmtSensor > & poolPmtSensors (const ServiceMode &svcMode)
const std::vector< DayaBay::RpcSensor > & rpcSensors (const ServiceMode &svcMode)
const std::vector< DayaBay::ElecChannelId > & elecChannelIds (const ServiceMode &svcMode)
const std::vector< DayaBay::FeeChannelId > & feeChannelIds (const ServiceMode &svcMode)
const std::vector< DayaBay::FecChannelId > & fecChannelIds (const ServiceMode &svcMode)
DayaBay::ElecChannelId elecChannelId (const DayaBay::DetectorSensor &sensId, const ServiceMode &svcMode)
DayaBay::FeeChannelId feeChannelId (const DayaBay::AdPmtSensor &sensId, const ServiceMode &svcMode)
DayaBay::FeeChannelId feeChannelId (const DayaBay::PoolPmtSensor &sensId, const ServiceMode &svcMode)
DayaBay::FecChannelId fecChannelId (const DayaBay::RpcSensor &sensId, const ServiceMode &svcMode)
DayaBay::DetectorSensor sensor (const DayaBay::ElecChannelId &elecChannel, const ServiceMode &svcMode)
DayaBay::AdPmtSensor adPmtSensor (const DayaBay::FeeChannelId &feeChannel, const ServiceMode &svcMode)
DayaBay::PoolPmtSensor poolPmtSensor (const DayaBay::FeeChannelId &feeChannel, const ServiceMode &svcMode)
DayaBay::RpcSensor rpcSensor (const DayaBay::FecChannelId &fecChannel, const ServiceMode &svcMode)
DayaBay::HardwareId hardwareId (const DayaBay::DetectorSensor &sensId, const ServiceMode &svcMode)
DayaBay::PmtHardwareId pmtHardwareId (const DayaBay::AdPmtSensor &sensId, const ServiceMode &svcMode)
DayaBay::PmtHardwareId pmtHardwareId (const DayaBay::PoolPmtSensor &sensId, const ServiceMode &svcMode)
DayaBay::RpcHardwareId rpcHardwareId (const DayaBay::RpcSensor &sensId, const ServiceMode &svcMode)
DayaBay::DetectorSensor sensor (const DayaBay::HardwareId &hardwareId, const ServiceMode &svcMode)
DayaBay::AdPmtSensor adPmtSensor (const DayaBay::PmtHardwareId &pmtId, const ServiceMode &svcMode)
DayaBay::PoolPmtSensor poolPmtSensor (const DayaBay::PmtHardwareId &pmtId, const ServiceMode &svcMode)
DayaBay::RpcSensor rpcSensor (const DayaBay::RpcHardwareId &rpcId, const ServiceMode &svcMode)
DayaBay::HardwareId hardwareId (const DayaBay::ElecChannelId &elecChannel, const ServiceMode &svcMode)
DayaBay::FeeHardwareId feeHardwareId (const DayaBay::FeeChannelId &feeChannel, const ServiceMode &svcMode)
DayaBay::FecHardwareId fecHardwareId (const DayaBay::FecChannelId &fecChannel, const ServiceMode &svcMode)
DayaBay::ElecChannelId elecChannelId (const DayaBay::HardwareId &hardwareId, const ServiceMode &svcMode)
DayaBay::FeeChannelId feeChannelId (const DayaBay::FeeHardwareId &feeHardwareId, const ServiceMode &svcMode)
DayaBay::FecChannelId fecChannelId (const DayaBay::FecHardwareId &fecHardwareId, const ServiceMode &svcMode)
virtual unsigned long addRef ()
virtual unsigned long release ()
virtual const std::string & name () const
virtual const InterfaceIDtype () const
virtual StatusCode configure ()
virtual StatusCode start ()
virtual StatusCode stop ()
virtual StatusCode terminate ()
virtual Gaudi::StateMachine::State FSMState () const
virtual Gaudi::StateMachine::State targetFSMState () const
virtual StatusCode reinitialize ()
virtual StatusCode restart ()
virtual StatusCode sysInitialize ()
virtual StatusCode sysStart ()
virtual StatusCode sysStop ()
virtual StatusCode sysFinalize ()
virtual StatusCode sysReinitialize ()
virtual StatusCode sysRestart ()
virtual StatusCode setProperty (const Property &p)
virtual StatusCode setProperty (const std::string &s)
virtual StatusCode setProperty (const std::string &n, const std::string &v)
StatusCode setProperty (const std::string &name, const TYPE &value)
virtual StatusCode getProperty (Property *p) const
virtual const PropertygetProperty (const std::string &name) const
virtual StatusCode getProperty (const std::string &n, std::string &v) const
virtual const std::vector<
Property * > & 
getProperties () const
ISvcLocatorserviceLocator () const
IMessageSvcmsgSvc ()
IMessageSvcmsgSvc () const
IMessageSvcmessageService ()
IMessageSvcmessageService () const
StatusCode setProperties ()
StatusCode service (const std::string &name, T *&psvc, bool createIf=true) const
StatusCode service (const std::string &svcType, const std::string &svcName, T *&psvc) const
PropertydeclareProperty (const std::string &name, T &property, const std::string &doc="none") const
PropertydeclareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="") const
IAuditorSvcauditorSvc () const

Static Public Member Functions

static const InterfaceIDinterfaceID ()
static const InterfaceIDinterfaceID ()
static const InterfaceIDinterfaceID ()
static const InterfaceIDinterfaceID ()

Public Attributes

 SUCCESS
 NO_INTERFACE
 VERSMISMATCH
 LAST_ERROR

Protected Member Functions

int outputLevel () const

Protected Attributes

IntegerProperty m_outputLevel
Gaudi::StateMachine::State m_state
Gaudi::StateMachine::State m_targetState
IMessageSvcm_messageSvc

Private Member Functions

StatusCode initMap (const ServiceMode &svcMode)
 Here the real CableMap file will be loaded.

Private Attributes

IMessageSvcmsg
std::string m_feeCableFileName
std::string m_fecCableFileName
bool m_first
 First call of query?
std::vector< DayaBay::HardwareIdm_hardwareIds
std::vector< DayaBay::PmtHardwareIdm_pmtHardwareIds
std::vector< DayaBay::RpcHardwareIdm_rpcHardwareIds
std::vector< DayaBay::FeeHardwareIdm_feeHardwareIds
std::vector< DayaBay::FecHardwareIdm_fecHardwareIds
std::vector< DayaBay::DetectorSensorm_sensors
std::vector< DayaBay::AdPmtSensorm_adPmtSensors
std::vector< DayaBay::PoolPmtSensorm_poolPmtSensors
std::vector< DayaBay::RpcSensorm_rpcSensors
std::vector< DayaBay::ElecChannelIdm_elecChannelIds
std::vector< DayaBay::FeeChannelIdm_feeChannelIds
std::vector< DayaBay::FecChannelIdm_fecChannelIds
std::map< DayaBay::Detector,
std::vector< DayaBay::DetectorSensor > > 
m_sensorsBySiteDet
std::map< DayaBay::Detector,
std::vector< DayaBay::AdPmtSensor > > 
m_adPmtSensorsBySiteDet
std::map< DayaBay::Detector,
std::vector< DayaBay::PoolPmtSensor > > 
m_poolPmtSensorsBySiteDet
std::map< DayaBay::Detector,
std::vector< DayaBay::RpcSensor > > 
m_rpcSensorsBySiteDet
std::map< DayaBay::Detector,
std::vector< DayaBay::ElecChannelId > > 
m_elecChannelIdsBySiteDet
std::map< DayaBay::Detector,
std::vector< DayaBay::FeeChannelId > > 
m_feeChannelIdsBySiteDet
std::map< DayaBay::Detector,
std::vector< DayaBay::FecChannelId > > 
m_fecChannelIdsBySiteDet
std::map< DayaBay::DetectorSensor,
DayaBay::ElecChannelId
m_channelBySensor
std::map< DayaBay::ElecChannelId,
DayaBay::DetectorSensor
m_sensorByChannel
std::map< DayaBay::DetectorSensor,
DayaBay::HardwareId
m_hardwareBySensor
std::map< DayaBay::HardwareId,
DayaBay::DetectorSensor
m_sensorByHardware
std::map< DayaBay::ElecChannelId,
DayaBay::HardwareId
m_hardwareByChannel
std::map< DayaBay::HardwareId,
DayaBay::ElecChannelId
m_channelByHardware

Static Private Attributes

static DayaBay::Detector s_unknownSiteDet
static DayaBay::Detector s_allSiteDet

Friends

friend class ServiceManager

Detailed Description

Definition at line 21 of file StaticCableSvc.h.


Constructor & Destructor Documentation

StaticCableSvc::StaticCableSvc ( const std::string &  name,
ISvcLocator svc 
)

Definition at line 16 of file StaticCableSvc.cc.

00017     : Service(name,svc)
00018     , m_first(true)
00019 {
00020   msg = 0;
00023   declareProperty("FeeCableMap",m_feeCableFileName="",
00024                   "Filename for loading the FEE cabling map.");
00026   declareProperty("FecCableMap",m_fecCableFileName="",
00027                   "Filename for loading the FEC cabling map");
00028 }

StaticCableSvc::~StaticCableSvc (  ) 

Definition at line 30 of file StaticCableSvc.cc.

00031 {
00032 }


Member Function Documentation

StatusCode StaticCableSvc::initialize (  )  [virtual]

Reimplemented from Service.

Definition at line 34 of file StaticCableSvc.cc.

00035 {
00036     this->Service::initialize();
00037 
00038     return StatusCode::SUCCESS;
00039 }

StatusCode StaticCableSvc::finalize (  )  [virtual]

Reimplemented from Service.

Definition at line 222 of file StaticCableSvc.cc.

00223 {
00224     return this->Service::finalize();
00225 }

StatusCode StaticCableSvc::queryInterface ( const InterfaceID riid,
void **  ppvInterface 
) [virtual]

Reimplemented from Service.

Definition at line 227 of file StaticCableSvc.cc.

00229 {
00230     StatusCode sc = StatusCode::FAILURE;
00231     if (ppvInterface) {
00232         *ppvInterface = 0;
00233     
00234         if (ICableSvc::interfaceID().versionMatch(riid)) {
00235             *ppvInterface = static_cast<ICableSvc*>(this);
00236             sc = StatusCode::SUCCESS;
00237             addRef();
00238         }
00239         else sc = Service::queryInterface( riid, ppvInterface );    
00240     }
00241     return sc;
00242 }

const std::vector< DayaBay::HardwareId > & StaticCableSvc::hardwareIds ( const ServiceMode svcMode  )  [virtual]

Implements ICableSvc.

Definition at line 244 of file StaticCableSvc.cc.

00245 {
00246   if( m_first ) initMap(svcMode);
00247   return m_hardwareIds;
00248 }

const std::vector< DayaBay::PmtHardwareId > & StaticCableSvc::pmtHardwareIds ( const ServiceMode svcMode  )  [virtual]

Implements ICableSvc.

Definition at line 250 of file StaticCableSvc.cc.

00251 {
00252   if( m_first ) initMap(svcMode);
00253   return m_pmtHardwareIds;
00254 }

const std::vector< DayaBay::RpcHardwareId > & StaticCableSvc::rpcHardwareIds ( const ServiceMode svcMode  )  [virtual]

Implements ICableSvc.

Definition at line 256 of file StaticCableSvc.cc.

00257 {
00258   if( m_first ) initMap(svcMode);
00259   return m_rpcHardwareIds;
00260 }

const std::vector< DayaBay::FeeHardwareId > & StaticCableSvc::feeHardwareIds ( const ServiceMode svcMode  )  [virtual]

Implements ICableSvc.

Definition at line 262 of file StaticCableSvc.cc.

00263 {
00264   if( m_first ) initMap(svcMode);
00265   return m_feeHardwareIds;
00266 }

const std::vector< DayaBay::FecHardwareId > & StaticCableSvc::fecHardwareIds ( const ServiceMode svcMode  )  [virtual]

Implements ICableSvc.

Definition at line 268 of file StaticCableSvc.cc.

00269 {
00270   if( m_first ) initMap(svcMode);
00271   return m_fecHardwareIds;
00272 }

const std::vector< DayaBay::DetectorSensor > & StaticCableSvc::sensors ( const ServiceMode svcMode  )  [virtual]

Implements ICableSvc.

Definition at line 274 of file StaticCableSvc.cc.

00275 {
00276   MsgStream log(msgSvc(), "StaticCableSvc");
00277 
00278   if( m_first ) initMap(svcMode);
00279   DayaBay::Detector siteDetId(svcMode.context().GetSite(), 
00280                               svcMode.context().GetDetId());
00281   std::map<DayaBay::Detector,std::vector<DayaBay::DetectorSensor> >::iterator iter;
00282   iter = m_sensorsBySiteDet.find(siteDetId);
00283   if( iter != m_sensorsBySiteDet.end() ){
00284     // Found site / det
00285 
00286       const std::vector<DayaBay::DetectorSensor>& detSensors = iter->second;
00287       for (size_t idet = 0; idet < detSensors.size(); ++idet) {
00288           DayaBay::DetectorSensor detSens = detSensors[idet];      
00289           if (detSens.isAD() ) {
00290               DayaBay::AdPmtSensor pmtid(detSens.fullPackedData());
00291               if (pmtid.bogus()) {
00292                   log << MSG::WARNING << "bogus AD PMT id: " << pmtid << endreq;
00293               }
00294           }
00295           else {
00296               DayaBay::PoolPmtSensor pmtid(detSens.fullPackedData());
00297               if (pmtid.bogus()) {
00298                   log << MSG::WARNING << "bogus Pool PMT id: " << pmtid << endreq;
00299               }
00300           }
00301       }
00302 
00303     return iter->second;
00304   }
00305   std::ostringstream msgStr;
00306   msgStr << "sensors(): No sensors for site / detector ID: " << siteDetId;
00307   msg->reportMessage("StaticCableSvc",MSG::WARNING,msgStr.str());
00308   return m_sensorsBySiteDet[s_unknownSiteDet];
00309 }

const std::vector< DayaBay::AdPmtSensor > & StaticCableSvc::adPmtSensors ( const ServiceMode svcMode  )  [virtual]

Implements ICableSvc.

Definition at line 311 of file StaticCableSvc.cc.

00312 {
00314   if( m_first ) initMap(svcMode);
00315   DayaBay::Detector siteDetId(svcMode.context().GetSite(), 
00316                               svcMode.context().GetDetId());
00317   std::map<DayaBay::Detector,std::vector<DayaBay::AdPmtSensor> >::iterator iter;
00318   iter = m_adPmtSensorsBySiteDet.find(siteDetId);
00319   if( iter != m_adPmtSensorsBySiteDet.end() ){
00320     // Found site / det
00321     return iter->second;
00322   }
00323   std::ostringstream msgStr;
00324   msgStr << "adPmtSensors(): No sensors for site / detector ID: " << siteDetId;
00325   msg->reportMessage("StaticCableSvc",MSG::WARNING,msgStr.str());
00326   return m_adPmtSensorsBySiteDet[s_unknownSiteDet];
00327 }

const std::vector< DayaBay::PoolPmtSensor > & StaticCableSvc::poolPmtSensors ( const ServiceMode svcMode  )  [virtual]

Implements ICableSvc.

Definition at line 329 of file StaticCableSvc.cc.

00330 {
00332   if( m_first ) initMap(svcMode);
00333   DayaBay::Detector siteDetId(svcMode.context().GetSite(), 
00334                               svcMode.context().GetDetId());
00335   std::map<DayaBay::Detector,std::vector<DayaBay::PoolPmtSensor> >::iterator iter;
00336   iter = m_poolPmtSensorsBySiteDet.find(siteDetId);
00337   if( iter != m_poolPmtSensorsBySiteDet.end() ){
00338     // Found site / det
00339     return iter->second;
00340   }
00341   std::ostringstream msgStr;
00342   msgStr << "poolPmtSensors(): No sensors for site / detector ID: "<< siteDetId;
00343   msg->reportMessage("StaticCableSvc",MSG::WARNING,msgStr.str());
00344   return m_poolPmtSensorsBySiteDet[s_unknownSiteDet];
00345 }

const std::vector< DayaBay::RpcSensor > & StaticCableSvc::rpcSensors ( const ServiceMode svcMode  )  [virtual]

Implements ICableSvc.

Definition at line 347 of file StaticCableSvc.cc.

00348 {
00349   if( m_first ) initMap(svcMode);
00350   DayaBay::Detector siteDetId(svcMode.context().GetSite(), 
00351                               svcMode.context().GetDetId());
00352   std::map<DayaBay::Detector,std::vector<DayaBay::RpcSensor> >::iterator iter;
00353   iter = m_rpcSensorsBySiteDet.find(siteDetId);
00354   if( iter != m_rpcSensorsBySiteDet.end() ){
00355     // Found site / det
00356     return iter->second;
00357   }
00358   std::ostringstream msgStr;
00359   msgStr << "rpcSensors(): No sensors for site / detector ID: "<< siteDetId;
00360   msg->reportMessage("StaticCableSvc",MSG::WARNING,msgStr.str());
00361   return m_rpcSensorsBySiteDet[s_unknownSiteDet];
00362 }

const std::vector< DayaBay::ElecChannelId > & StaticCableSvc::elecChannelIds ( const ServiceMode svcMode  )  [virtual]

Implements ICableSvc.

Definition at line 364 of file StaticCableSvc.cc.

00365 {
00366   if( m_first ) initMap(svcMode);
00367   DayaBay::Detector siteDetId(svcMode.context().GetSite(), 
00368                               svcMode.context().GetDetId());
00369   std::map<DayaBay::Detector,std::vector<DayaBay::ElecChannelId> >::iterator iter;
00370   iter = m_elecChannelIdsBySiteDet.find(siteDetId);
00371   if( iter != m_elecChannelIdsBySiteDet.end() ){
00372     // Found site / det
00373     return iter->second;
00374   }
00375   std::ostringstream msgStr;
00376   msgStr << "elecChannelIds(): No sensors for site / detector ID: "<< siteDetId;
00377   msg->reportMessage("StaticCableSvc",MSG::WARNING,msgStr.str());
00378   return m_elecChannelIdsBySiteDet[s_unknownSiteDet];
00379 }

const std::vector< DayaBay::FeeChannelId > & StaticCableSvc::feeChannelIds ( const ServiceMode svcMode  )  [virtual]

Implements ICableSvc.

Definition at line 381 of file StaticCableSvc.cc.

00382 {
00383   if( m_first ) initMap(svcMode);
00384   DayaBay::Detector siteDetId(svcMode.context().GetSite(), 
00385                               svcMode.context().GetDetId());
00386   std::map<DayaBay::Detector,std::vector<DayaBay::FeeChannelId> >::iterator iter;
00387   iter = m_feeChannelIdsBySiteDet.find(siteDetId);
00388   if( iter != m_feeChannelIdsBySiteDet.end() ){
00389     // Found site / det
00390     return iter->second;
00391   }
00392   std::ostringstream msgStr;
00393   msgStr << "feeChannelIds(): No sensors for site / detector ID: " << siteDetId;
00394   msg->reportMessage("StaticCableSvc",MSG::WARNING,msgStr.str());
00395   return m_feeChannelIdsBySiteDet[s_unknownSiteDet];
00396 }

const std::vector< DayaBay::FecChannelId > & StaticCableSvc::fecChannelIds ( const ServiceMode svcMode  )  [virtual]

Implements ICableSvc.

Definition at line 398 of file StaticCableSvc.cc.

00399 {
00400   if( m_first ) initMap(svcMode);
00401   DayaBay::Detector siteDetId(svcMode.context().GetSite(), 
00402                               svcMode.context().GetDetId());
00403   std::map<DayaBay::Detector,std::vector<DayaBay::FecChannelId> >::iterator iter;
00404   iter = m_fecChannelIdsBySiteDet.find(siteDetId);
00405   if( iter != m_fecChannelIdsBySiteDet.end() ){
00406     // Found site / det
00407     return iter->second;
00408   }
00409   std::ostringstream msgStr;
00410   msgStr << "fecChannelIds(): No sensors for site / detector ID: " << siteDetId;
00411   msg->reportMessage("StaticCableSvc",MSG::WARNING,msgStr.str());
00412   return m_fecChannelIdsBySiteDet[s_unknownSiteDet];
00413 }

DayaBay::ElecChannelId StaticCableSvc::elecChannelId ( const DayaBay::DetectorSensor sensId,
const ServiceMode svcMode 
) [virtual]

Implements ICableSvc.

Definition at line 415 of file StaticCableSvc.cc.

00418 {
00419   if( m_first ) initMap(svcMode);
00420   std::map<DayaBay::DetectorSensor,DayaBay::ElecChannelId>::iterator iter;
00421   iter = m_channelBySensor.find(sensId);
00422   if( iter != m_channelBySensor.end() ){
00423     // Found channel
00424     return iter->second;
00425   }
00426   std::ostringstream msgStr;
00427   msgStr << "elecChannelId(): No electronics channel for sensor ID: " << sensId;
00428   msg->reportMessage("StaticCableSvc",MSG::WARNING,msgStr.str());
00429   return DayaBay::ElecChannelId(0);
00430 }

DayaBay::FeeChannelId StaticCableSvc::feeChannelId ( const DayaBay::AdPmtSensor sensId,
const ServiceMode svcMode 
) [virtual]

Implements ICableSvc.

Definition at line 432 of file StaticCableSvc.cc.

00435 {
00436   if( m_first ) initMap(svcMode);
00437   return DayaBay::FeeChannelId(elecChannelId(sensId,svcMode).fullPackedData());
00438 }

DayaBay::FeeChannelId StaticCableSvc::feeChannelId ( const DayaBay::PoolPmtSensor sensId,
const ServiceMode svcMode 
) [virtual]

Implements ICableSvc.

Definition at line 440 of file StaticCableSvc.cc.

00443 {
00444   if( m_first ) initMap(svcMode);
00445   return DayaBay::FeeChannelId(elecChannelId(sensId,svcMode).fullPackedData());
00446 }

DayaBay::FecChannelId StaticCableSvc::fecChannelId ( const DayaBay::RpcSensor sensId,
const ServiceMode svcMode 
) [virtual]

Implements ICableSvc.

Definition at line 448 of file StaticCableSvc.cc.

00451 {
00452   if( m_first ) initMap(svcMode);
00453   return DayaBay::FecChannelId(elecChannelId(sensId,svcMode).fullPackedData());
00454 }

DayaBay::DetectorSensor StaticCableSvc::sensor ( const DayaBay::ElecChannelId elecChannel,
const ServiceMode svcMode 
) [virtual]

Implements ICableSvc.

Definition at line 456 of file StaticCableSvc.cc.

00459 {
00460   if( m_first ) initMap(svcMode);
00461   std::map<DayaBay::ElecChannelId,DayaBay::DetectorSensor>::iterator iter;
00462   iter = m_sensorByChannel.find(elecChannel);
00463   if( iter != m_sensorByChannel.end() ){
00464     // Found sensor
00465     return iter->second;
00466   }
00467   std::ostringstream msgStr;
00468   msgStr << "elecChannelId(): No sensor ID for electronics channel: " 
00469          << elecChannel;
00470   msg->reportMessage("StaticCableSvc",MSG::WARNING,msgStr.str());
00471   return DayaBay::DetectorSensor(0);
00472 }

DayaBay::AdPmtSensor StaticCableSvc::adPmtSensor ( const DayaBay::FeeChannelId feeChannel,
const ServiceMode svcMode 
) [virtual]

Implements ICableSvc.

Definition at line 474 of file StaticCableSvc.cc.

00477 {
00478   if( m_first ) initMap(svcMode);
00479   return DayaBay::AdPmtSensor(sensor(feeChannel,svcMode).fullPackedData());
00480 }

DayaBay::PoolPmtSensor StaticCableSvc::poolPmtSensor ( const DayaBay::FeeChannelId feeChannel,
const ServiceMode svcMode 
) [virtual]

Implements ICableSvc.

Definition at line 482 of file StaticCableSvc.cc.

00485 {
00486   if( m_first ) initMap(svcMode);
00487   return DayaBay::PoolPmtSensor(sensor(feeChannel,svcMode).fullPackedData());
00488 }

DayaBay::RpcSensor StaticCableSvc::rpcSensor ( const DayaBay::FecChannelId fecChannel,
const ServiceMode svcMode 
) [virtual]

Implements ICableSvc.

Definition at line 490 of file StaticCableSvc.cc.

00493 {
00494   if( m_first ) initMap(svcMode);
00495   return DayaBay::RpcSensor(sensor(fecChannel,svcMode).fullPackedData());
00496 }

DayaBay::HardwareId StaticCableSvc::hardwareId ( const DayaBay::DetectorSensor sensId,
const ServiceMode svcMode 
) [virtual]

Implements ICableSvc.

Definition at line 498 of file StaticCableSvc.cc.

00501 {
00502   if( m_first ) initMap(svcMode);
00503   std::map<DayaBay::DetectorSensor,DayaBay::HardwareId>::iterator iter;
00504   iter = m_hardwareBySensor.find(sensId);
00505   if( iter != m_hardwareBySensor.end() ){
00506     // Found hardware
00507     return iter->second;
00508   }
00509   std::ostringstream msgStr;
00510   msgStr << "hardwareId(): No hardware ID for sensor ID: " << sensId; 
00511   msg->reportMessage("StaticCableSvc",MSG::WARNING,msgStr.str());
00512   return DayaBay::HardwareId(0);
00513 }

DayaBay::PmtHardwareId StaticCableSvc::pmtHardwareId ( const DayaBay::AdPmtSensor sensId,
const ServiceMode svcMode 
) [virtual]

Implements ICableSvc.

Definition at line 515 of file StaticCableSvc.cc.

00518 {
00519   if( m_first ) initMap(svcMode);
00520   return DayaBay::PmtHardwareId(hardwareId(sensId,svcMode).fullPackedData());
00521 }

DayaBay::PmtHardwareId StaticCableSvc::pmtHardwareId ( const DayaBay::PoolPmtSensor sensId,
const ServiceMode svcMode 
) [virtual]

Implements ICableSvc.

Definition at line 523 of file StaticCableSvc.cc.

00526 {
00527   if( m_first ) initMap(svcMode);
00528   return DayaBay::PmtHardwareId(hardwareId(sensId,svcMode).fullPackedData());
00529 }

DayaBay::RpcHardwareId StaticCableSvc::rpcHardwareId ( const DayaBay::RpcSensor sensId,
const ServiceMode svcMode 
) [virtual]

Implements ICableSvc.

Definition at line 531 of file StaticCableSvc.cc.

00534 {
00535   if( m_first ) initMap(svcMode);
00536   return DayaBay::RpcHardwareId(hardwareId(sensId,svcMode).fullPackedData());
00537 }

DayaBay::DetectorSensor StaticCableSvc::sensor ( const DayaBay::HardwareId hardwareId,
const ServiceMode svcMode 
) [virtual]

Implements ICableSvc.

Definition at line 539 of file StaticCableSvc.cc.

00542 {
00543   if( m_first ) initMap(svcMode);
00544   std::map<DayaBay::HardwareId,DayaBay::DetectorSensor>::iterator iter;
00545   iter = m_sensorByHardware.find(hardwareId);
00546   if( iter != m_sensorByHardware.end() ){
00547     // Found sensor
00548     return iter->second;
00549   }
00550   std::ostringstream msgStr;
00551   msgStr << "sensor(): No sensor for hardware ID: " << hardwareId; 
00552   msg->reportMessage("StaticCableSvc",MSG::WARNING,msgStr.str());
00553   return DayaBay::DetectorSensor(0);
00554 }

DayaBay::AdPmtSensor StaticCableSvc::adPmtSensor ( const DayaBay::PmtHardwareId pmtId,
const ServiceMode svcMode 
) [virtual]

Implements ICableSvc.

Definition at line 556 of file StaticCableSvc.cc.

00559 {
00560   if( m_first ) initMap(svcMode);
00561   return DayaBay::AdPmtSensor(sensor(pmtId,svcMode).fullPackedData());
00562 }

DayaBay::PoolPmtSensor StaticCableSvc::poolPmtSensor ( const DayaBay::PmtHardwareId pmtId,
const ServiceMode svcMode 
) [virtual]

Implements ICableSvc.

Definition at line 564 of file StaticCableSvc.cc.

00567 {
00568   if( m_first ) initMap(svcMode);
00569   return DayaBay::PoolPmtSensor(sensor(pmtId,svcMode).fullPackedData());
00570 }

DayaBay::RpcSensor StaticCableSvc::rpcSensor ( const DayaBay::RpcHardwareId rpcId,
const ServiceMode svcMode 
) [virtual]

Implements ICableSvc.

Definition at line 572 of file StaticCableSvc.cc.

00575 {
00576   if( m_first ) initMap(svcMode);
00577   return DayaBay::RpcSensor(sensor(rpcId, svcMode).fullPackedData());
00578 }

DayaBay::HardwareId StaticCableSvc::hardwareId ( const DayaBay::ElecChannelId elecChannel,
const ServiceMode svcMode 
) [virtual]

Implements ICableSvc.

Definition at line 580 of file StaticCableSvc.cc.

00583 {
00584   if( m_first ) initMap(svcMode);
00585   std::map<DayaBay::ElecChannelId,DayaBay::HardwareId>::iterator iter;
00586   iter = m_hardwareByChannel.find(elecChannel);
00587   if( iter != m_hardwareByChannel.end() ){
00588     // Found hardware
00589     return iter->second;
00590   }
00591   std::ostringstream msgStr;
00592   msgStr << "hardwareId(): No hardware ID for electronics channel: " 
00593          << elecChannel;
00594   msg->reportMessage("StaticCableSvc",MSG::WARNING,msgStr.str());
00595   return DayaBay::HardwareId(0);
00596 }

DayaBay::FeeHardwareId StaticCableSvc::feeHardwareId ( const DayaBay::FeeChannelId feeChannel,
const ServiceMode svcMode 
) [virtual]

Implements ICableSvc.

Definition at line 598 of file StaticCableSvc.cc.

00601 {
00602   if( m_first ) initMap(svcMode);
00603   return DayaBay::FeeHardwareId(hardwareId(feeChannel,svcMode).fullPackedData());
00604 }

DayaBay::FecHardwareId StaticCableSvc::fecHardwareId ( const DayaBay::FecChannelId fecChannel,
const ServiceMode svcMode 
) [virtual]

Implements ICableSvc.

Definition at line 606 of file StaticCableSvc.cc.

00609 {
00610   if( m_first ) initMap(svcMode);
00611   return DayaBay::FecHardwareId(hardwareId(fecChannel,svcMode).fullPackedData());
00612 }

DayaBay::ElecChannelId StaticCableSvc::elecChannelId ( const DayaBay::HardwareId hardwareId,
const ServiceMode svcMode 
) [virtual]

Implements ICableSvc.

Definition at line 614 of file StaticCableSvc.cc.

00617 {
00618   if( m_first ) initMap(svcMode);
00619   std::map<DayaBay::HardwareId,DayaBay::ElecChannelId>::iterator iter;
00620   iter = m_channelByHardware.find(hardwareId);
00621   if( iter != m_channelByHardware.end() ){
00622     // Found channel
00623     return iter->second;
00624   }
00625   std::ostringstream msgStr;
00626   msgStr << "elecChannelId(): No electronics channel for hardware ID: " 
00627          << hardwareId;
00628   msg->reportMessage("StaticCableSvc",MSG::WARNING,msgStr.str());
00629   return DayaBay::ElecChannelId(0);
00630 }

DayaBay::FeeChannelId StaticCableSvc::feeChannelId ( const DayaBay::FeeHardwareId feeHardwareId,
const ServiceMode svcMode 
) [virtual]

Implements ICableSvc.

Definition at line 632 of file StaticCableSvc.cc.

00635 {
00636   if( m_first ) initMap(svcMode);
00637   return DayaBay::FeeChannelId(elecChannelId(feeHardwareId,svcMode).fullPackedData());
00638 }

DayaBay::FecChannelId StaticCableSvc::fecChannelId ( const DayaBay::FecHardwareId fecHardwareId,
const ServiceMode svcMode 
) [virtual]

Implements ICableSvc.

Definition at line 640 of file StaticCableSvc.cc.

00643 {
00644   if( m_first ) initMap(svcMode);
00645   return DayaBay::FecChannelId(elecChannelId(fecHardwareId,svcMode).fullPackedData());
00646 }

StatusCode StaticCableSvc::initMap ( const ServiceMode svcMode  )  [private]

Here the real CableMap file will be loaded.

Master CableMap file. In case no FeeCableMap file specified, it will try to find one from there.

Not implemented yet !!!

Definition at line 42 of file StaticCableSvc.cc.

00043 {
00044     // Prepare the message service for reporting
00045     msg = msgSvc();
00046     if( !msg ){    
00047       return StatusCode::FAILURE;
00048     }
00049     MsgStream log(msgSvc(), "StaticCableSvc");
00050 
00051     if(m_feeCableFileName=="")  {
00052       msg->reportMessage("StaticCableSvc",MSG::INFO,
00053                          "No FeeCableMap file specified. Loading one based on Master.CableMap.txt");
00054       
00057       std::string MasterCableMapFile = "Master.CableMap.txt";
00058       std::string Path = getenv ("DATASVCROOT");
00059       std::ifstream m_masterCableMap( (Path+"/share/"+MasterCableMapFile).c_str() );
00060       
00061       if( !m_masterCableMap.is_open() ){
00062         msg->reportMessage("StaticCableSvc",MSG::ERROR,"Fail to open Master.CableMap.txt");
00063         return StatusCode::FAILURE;
00064       }
00065       
00066       int StartRun,EndRun;
00067       int Sites;
00068       int SimFlag, StartTimeSec, StartTimeNanoSec, EndTimeSec, EndTimeNanoSec;
00069       std::string MapFile;
00070 
00071       std::string line;
00072 
00073       while( std::getline( m_masterCableMap, line ) ){
00074         std::stringstream streamLine(line);
00075         if( streamLine.peek() == '#' ){
00076           continue;
00077         }
00078         streamLine >>StartRun >>EndRun >>Sites
00079           >>SimFlag >>StartTimeSec>> StartTimeNanoSec >>EndTimeSec >>EndTimeNanoSec
00080           >>MapFile;
00081         
00082         ContextRange CRange( Sites, SimFlag, 
00083                              TimeStamp( StartTimeSec, StartTimeNanoSec ),
00084                              TimeStamp( EndTimeSec, EndTimeNanoSec ) );
00085         
00086         const Context &cont = svcMode.context();
00087 
00088         /*
00089         std::cout<< "Searching: "<<cont.GetSite()<<" "<<cont.GetSimFlag()<<std::endl;
00090         std::cout<< cont.GetTimeStamp().AsString()<<std::endl;
00091         std::cout<<"Start: "<<TimeStamp( StartTimeSec, StartTimeNanoSec ).AsString()<<std::endl;
00092         std::cout<<"End:   "<<TimeStamp( EndTimeSec, EndTimeNanoSec ).AsString()<<std::endl;
00093         */
00094 
00095         if( CRange.IsCompatible( cont ) ) {
00096           m_feeCableFileName = Path + "/share/" + MapFile;
00097         }
00098 
00099       }
00100         
00101     }
00102 
00103     if(m_fecCableFileName=="")  {
00105     }
00106 
00107 
00108     if(m_feeCableFileName!=""){
00109 
00110       msg->reportMessage("StaticCableSvc",MSG::INFO,("FeeCableMap: "+m_feeCableFileName).c_str());
00111 
00112       std::ifstream input( m_feeCableFileName.c_str() );
00113       if( !input.is_open() ){
00114         std::ostringstream msgStr;
00115         msgStr << "Failed to open input file: " << m_feeCableFileName;
00116         msg->reportMessage("StaticCableSvc",MSG::ERROR,msgStr.str());
00117         return StatusCode::FAILURE;
00118       }
00119       int site, detectorId, feeBoard, feeBoardSerial, feeConnector; 
00120       int adPmtRing, adPmtColumn, poolPmtWallNumber, poolPmtWallSpot;
00121       int poolPmtInwardFacing, pmtHardwareType, pmtSerialNumber;
00122       std::string line;
00123       while( std::getline(input,line) ){
00124         std::stringstream streamLine(line);
00125         if( streamLine.peek() == '#' ){
00126           continue;
00127         }
00128         streamLine >> site >> detectorId >> feeBoard >> feeBoardSerial 
00129                    >> feeConnector >> adPmtRing >> adPmtColumn 
00130                    >> poolPmtWallNumber >> poolPmtWallSpot 
00131                    >> poolPmtInwardFacing >> pmtHardwareType 
00132                    >> pmtSerialNumber;
00133         DayaBay::FeeChannelId feeChannel(feeBoard, feeConnector,
00134                                          (Site::Site_t)site,
00135                                          (DetectorId::DetectorId_t)detectorId);
00136         DayaBay::FeeHardwareId feeHardware(feeBoardSerial, feeConnector);
00137         DayaBay::PmtHardwareId pmtHardware(pmtSerialNumber, 
00138                                            (DayaBay::Hardware::Hardware_t)pmtHardwareType);
00139         // Make map by site / detector
00140         DayaBay::Detector siteId((Site::Site_t)site, DetectorId::kAll);
00141         DayaBay::Detector detector((Site::Site_t)site, 
00142                                    (DetectorId::DetectorId_t)detectorId);
00143         m_elecChannelIdsBySiteDet[s_allSiteDet].push_back(feeChannel);
00144         m_elecChannelIdsBySiteDet[siteId].push_back(feeChannel);
00145         m_elecChannelIdsBySiteDet[detector].push_back(feeChannel);
00146         m_feeChannelIdsBySiteDet[s_allSiteDet].push_back(feeChannel);
00147         m_feeChannelIdsBySiteDet[siteId].push_back(feeChannel);
00148         m_feeChannelIdsBySiteDet[detector].push_back(feeChannel);
00149         // Make hardware connections
00150         m_channelByHardware[feeHardware] = feeChannel;
00151         m_hardwareByChannel[feeChannel] = feeHardware;
00152 
00153         // Make PMT connections
00154         int sensorId = 0; 
00155         if( adPmtColumn!=0 ){
00156           // AD PMT
00157           DayaBay::AdPmtSensor pmtId(adPmtRing, adPmtColumn, 
00158                                      (Site::Site_t)site,
00159                                      (DetectorId::DetectorId_t)detectorId);
00160           sensorId = pmtId.fullPackedData();
00161         }else if( poolPmtWallNumber!=0 ){
00162           // Pool PMT
00163           DayaBay::PoolPmtSensor pmtId(poolPmtWallNumber, poolPmtWallSpot,
00164                                        poolPmtInwardFacing, 
00165                                        (Site::Site_t)site,
00166                                        (DetectorId::DetectorId_t)detectorId);
00167           sensorId = pmtId.fullPackedData();
00168         }
00169         if( sensorId == 0 ){
00170           // Unconnected FEE channel
00171           continue;
00172         }
00173         DayaBay::DetectorSensor sensor(sensorId);
00174 
00175         m_sensorsBySiteDet[s_allSiteDet].push_back(sensor);
00176         m_sensorsBySiteDet[siteId].push_back(sensor);
00177         m_sensorsBySiteDet[detector].push_back(sensor);
00178         m_channelBySensor[sensor] = feeChannel;
00179         m_sensorByChannel[feeChannel] = sensor;
00180         m_hardwareBySensor[sensor] = pmtHardware;
00181         m_sensorByHardware[pmtHardware] = sensor;
00182         if(sensor.detectorId() == DetectorId::kIWS
00183            || sensor.detectorId() == DetectorId::kOWS){
00184           DayaBay::PoolPmtSensor poolPmt(sensorId);
00185           if (poolPmt.bogus()) {
00186               log << "Warning: got bogus Pool PMT ID: " << poolPmt 
00187                   << " while parsing line:\"" << line << "\""
00188                   << endreq;
00189           }
00190           m_poolPmtSensorsBySiteDet[s_allSiteDet].push_back(poolPmt);
00191           m_poolPmtSensorsBySiteDet[siteId].push_back(poolPmt);
00192           m_poolPmtSensorsBySiteDet[detector].push_back(poolPmt);
00193         }else{
00194           DayaBay::AdPmtSensor adPmt(sensorId);
00195           if (adPmt.bogus()) {
00196               log << "Warning: got bogus AD PMT ID: " << adPmt
00197                   << " while parsing line:\"" << line << "\""
00198                   << endreq;
00199           }
00200           m_adPmtSensorsBySiteDet[s_allSiteDet].push_back(adPmt);
00201           m_adPmtSensorsBySiteDet[siteId].push_back(adPmt);
00202           m_adPmtSensorsBySiteDet[detector].push_back(adPmt);
00203         }
00204       }
00205     }
00206     
00207     if(m_fecCableFileName!=""){
00208       
00209       msg->reportMessage("StaticCableSvc",MSG::INFO,("FecCableMap: "+m_fecCableFileName).c_str());
00210 
00211       std::ostringstream msgStr;
00212       msgStr << "FEC Cable mapping not yet implemented! " << m_fecCableFileName;
00213       msg->reportMessage("StaticCableSvc",MSG::ERROR,msgStr.str());
00214       return StatusCode::FAILURE;
00215     }
00216 
00217     m_first = false;
00218     
00219     return StatusCode::SUCCESS;
00220 }

static const InterfaceID& ICableSvc::interfaceID (  )  [inline, static, inherited]

Reimplemented from IInterface.

Definition at line 28 of file ICableSvc.h.

00028                                          {
00029     return IID_ICableSvc;
00030   }


Member Data Documentation

IMessageSvc* StaticCableSvc::msg [private]

Definition at line 159 of file StaticCableSvc.h.

DayaBay::Detector StaticCableSvc::s_unknownSiteDet [static, private]

Initial value:

Definition at line 162 of file StaticCableSvc.h.

DayaBay::Detector StaticCableSvc::s_allSiteDet [static, private]

Initial value:

Definition at line 163 of file StaticCableSvc.h.

std::string StaticCableSvc::m_feeCableFileName [private]

Definition at line 166 of file StaticCableSvc.h.

std::string StaticCableSvc::m_fecCableFileName [private]

Definition at line 169 of file StaticCableSvc.h.

bool StaticCableSvc::m_first [private]

First call of query?

Definition at line 172 of file StaticCableSvc.h.

std::vector<DayaBay::HardwareId> StaticCableSvc::m_hardwareIds [private]

Definition at line 178 of file StaticCableSvc.h.

std::vector<DayaBay::PmtHardwareId> StaticCableSvc::m_pmtHardwareIds [private]

Definition at line 179 of file StaticCableSvc.h.

std::vector<DayaBay::RpcHardwareId> StaticCableSvc::m_rpcHardwareIds [private]

Definition at line 180 of file StaticCableSvc.h.

std::vector<DayaBay::FeeHardwareId> StaticCableSvc::m_feeHardwareIds [private]

Definition at line 181 of file StaticCableSvc.h.

std::vector<DayaBay::FecHardwareId> StaticCableSvc::m_fecHardwareIds [private]

Definition at line 182 of file StaticCableSvc.h.

std::vector<DayaBay::DetectorSensor> StaticCableSvc::m_sensors [private]

Definition at line 185 of file StaticCableSvc.h.

std::vector<DayaBay::AdPmtSensor> StaticCableSvc::m_adPmtSensors [private]

Definition at line 186 of file StaticCableSvc.h.

std::vector<DayaBay::PoolPmtSensor> StaticCableSvc::m_poolPmtSensors [private]

Definition at line 187 of file StaticCableSvc.h.

std::vector<DayaBay::RpcSensor> StaticCableSvc::m_rpcSensors [private]

Definition at line 188 of file StaticCableSvc.h.

std::vector<DayaBay::ElecChannelId> StaticCableSvc::m_elecChannelIds [private]

Definition at line 191 of file StaticCableSvc.h.

std::vector<DayaBay::FeeChannelId> StaticCableSvc::m_feeChannelIds [private]

Definition at line 192 of file StaticCableSvc.h.

std::vector<DayaBay::FecChannelId> StaticCableSvc::m_fecChannelIds [private]

Definition at line 193 of file StaticCableSvc.h.

std::map<DayaBay::Detector,std::vector<DayaBay::DetectorSensor> > StaticCableSvc::m_sensorsBySiteDet [private]

Definition at line 196 of file StaticCableSvc.h.

std::map<DayaBay::Detector,std::vector<DayaBay::AdPmtSensor> > StaticCableSvc::m_adPmtSensorsBySiteDet [private]

Definition at line 197 of file StaticCableSvc.h.

std::map<DayaBay::Detector,std::vector<DayaBay::PoolPmtSensor> > StaticCableSvc::m_poolPmtSensorsBySiteDet [private]

Definition at line 198 of file StaticCableSvc.h.

std::map<DayaBay::Detector,std::vector<DayaBay::RpcSensor> > StaticCableSvc::m_rpcSensorsBySiteDet [private]

Definition at line 199 of file StaticCableSvc.h.

std::map<DayaBay::Detector,std::vector<DayaBay::ElecChannelId> > StaticCableSvc::m_elecChannelIdsBySiteDet [private]

Definition at line 202 of file StaticCableSvc.h.

std::map<DayaBay::Detector,std::vector<DayaBay::FeeChannelId> > StaticCableSvc::m_feeChannelIdsBySiteDet [private]

Definition at line 203 of file StaticCableSvc.h.

std::map<DayaBay::Detector,std::vector<DayaBay::FecChannelId> > StaticCableSvc::m_fecChannelIdsBySiteDet [private]

Definition at line 204 of file StaticCableSvc.h.

std::map<DayaBay::DetectorSensor,DayaBay::ElecChannelId> StaticCableSvc::m_channelBySensor [private]

Definition at line 207 of file StaticCableSvc.h.

std::map<DayaBay::ElecChannelId,DayaBay::DetectorSensor> StaticCableSvc::m_sensorByChannel [private]

Definition at line 208 of file StaticCableSvc.h.

std::map<DayaBay::DetectorSensor,DayaBay::HardwareId> StaticCableSvc::m_hardwareBySensor [private]

Definition at line 211 of file StaticCableSvc.h.

std::map<DayaBay::HardwareId,DayaBay::DetectorSensor> StaticCableSvc::m_sensorByHardware [private]

Definition at line 212 of file StaticCableSvc.h.

std::map<DayaBay::ElecChannelId,DayaBay::HardwareId> StaticCableSvc::m_hardwareByChannel [private]

Definition at line 215 of file StaticCableSvc.h.

std::map<DayaBay::HardwareId,DayaBay::ElecChannelId> StaticCableSvc::m_channelByHardware [private]

Definition at line 216 of file StaticCableSvc.h.


The documentation for this class was generated from the following files:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 20:21:05 2011 for DataSvc by doxygen 1.4.7