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

In This Package:

DbiSimDataSvc Class Reference

#include <DbiSimDataSvc.h>

Inheritance diagram for DbiSimDataSvc:

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

Public Types

 SUCCESS
 NO_INTERFACE
 VERSMISMATCH
 LAST_ERROR
enum  Status
 SUCCESS
 NO_INTERFACE
 VERSMISMATCH
 LAST_ERROR

Public Member Functions

 DbiSimDataSvc (const std::string &name, ISvcLocator *svc)
 ~DbiSimDataSvc ()
virtual StatusCode initialize ()
virtual StatusCode finalize ()
virtual StatusCode queryInterface (const InterfaceID &riid, void **ppvInterface)
const DayaBay::PmtSimDatapmtSimData (const DayaBay::DetectorSensor &pmtId, const ServiceMode &svcMode)
const DayaBay::RpcSimDatarpcSimData (const DayaBay::RpcSensor &rpcId, const ServiceMode &svcMode)
virtual const DayaBay::FeeSimDatafeeSimData (const DayaBay::FeeChannelId &channelId, const ServiceMode &svcMode)
virtual const DayaBay::FecSimDatafecSimData (const DayaBay::FecChannelId &channelId, const ServiceMode &svcMode)
const std::vector< DayaBay::PmtSimData > & pmtSimList (const DayaBay::Detector &detectorId, const ServiceMode &svcMode)
const std::vector< DayaBay::RpcSimData > & rpcSimList (const DayaBay::Detector &detectorId, const ServiceMode &svcMode)
virtual const std::vector<
DayaBay::FeeSimData > & 
feeSimList (const DayaBay::Detector &detectorId, const ServiceMode &svcMode)
virtual const std::vector<
DayaBay::FecSimData > & 
fecSimList (const DayaBay::Detector &detectorId, 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
virtual unsigned long addRef ()=0
virtual unsigned long release ()=0

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 Attributes

std::map< DayaBay::Detector,
std::vector< DayaBay::PmtSimData > > 
m_pmtData
std::map< DayaBay::Detector,
std::vector< DayaBay::RpcSimData > > 
m_rpcData
std::map< DayaBay::Detector,
std::vector< DayaBay::FeeSimData > > 
m_feeData
std::map< DayaBay::Detector,
std::vector< DayaBay::FecSimData > > 
m_fecData
std::map< DayaBay::DetectorSensor,
DayaBay::PmtSimData
m_pmtDataBySensor
std::map< DayaBay::RpcSensor,
DayaBay::RpcSimData
m_rpcDataBySensor
std::map< DayaBay::FeeChannelId,
DayaBay::FeeSimData
m_feeDataByChannel
std::map< DayaBay::FecChannelId,
DayaBay::FecSimData
m_fecDataByChannel
std::string m_cableSvcName

Friends

friend class ServiceManager

Detailed Description

Definition at line 17 of file DbiSimDataSvc.h.


Constructor & Destructor Documentation

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

Definition at line 34 of file DbiSimDataSvc.cc.

00035     : Service(name,svc)
00036 {
00037   declareProperty("CableSvcName",m_cableSvcName="DbiCableSvc",
00038                   "Name of service which provides the list of sensors to simulate");
00039 }

DbiSimDataSvc::~DbiSimDataSvc (  ) 

Definition at line 41 of file DbiSimDataSvc.cc.

00042 {
00043 }


Member Function Documentation

StatusCode DbiSimDataSvc::initialize (  )  [virtual]

Reimplemented from Service.

Definition at line 45 of file DbiSimDataSvc.cc.

00046 {
00047   this->Service::initialize();
00048   
00049 /*  IMessageSvc* msg = msgSvc();//cxs 2010-12-7
00050   if( !msg ){    
00051     return StatusCode::FAILURE;
00052   }
00053 */
00054    MsgStream msg(msgSvc(),name());
00055   // Initialize the data with a static table of numbers
00056   ICableSvc* cableSvc = 0;
00057   StatusCode sc = service("StaticCableSvc",cableSvc,true);
00058 
00059   if( sc != StatusCode::SUCCESS ){
00060     std::ostringstream msgStr;
00061     msgStr << "Failed to access cable service: " << m_cableSvcName;
00062     //msg->reportMessage("DbiSimDataSvc",MSG::ERROR,msgStr.str());
00063     return sc;    
00064   }
00065 
00066   // Use a dummy service mode for initialization
00067 /*  Context context;
00068   context.SetSite(Site::kAll);
00069   context.SetDetId(DetectorId::kAll);
00070   ServiceMode svcMode(context,0);
00071   const std::vector<DayaBay::DetectorSensor> sensors = 
00072     cableSvc->sensors(svcMode);
00073 */
00074   // =======================================================
00075   // FIXME: since there's only one context range, hard coding context for now
00076   // =======================================================
00077   //TimeStamp tstamp(2007, 1, 15, 0, 0, 1);
00078   //Context vc(Site::kDayaBay, SimFlag::kMC, tstamp);
00079   Context vc(Site::kAll, SimFlag::kMC);
00080   DbiResultPtr<GSimPmtSpec> pr("SimPmtSpec",vc);
00081   //pr.NewQuery(vc);
00082 
00083   // Delete any residual objects and check for leaks.
00084 
00085   DbiTableProxyRegistry::Instance().ShowStatistics();
00086   
00087 
00088   // Check number of entires in result set
00089   unsigned int numRows = pr.GetNumRows();
00090   std::cout << "CJSLIN: Database rows = " << numRows << std::endl;
00091   const GSimPmtSpec* row ;
00092 //  int site, detectorID, ring, column;
00093   
00094   for (unsigned int idx=0; idx < numRows; idx++) {
00095 
00096     row = pr.GetRowByIndex(idx);  
00097 //    site = row->GetSite();
00098 //    detectorID = row->GetAD();
00099 //    ring = row->GetRing();
00100 //    column = row->GetColumn();
00101 
00102 //    DayaBay::Detector detector((Site::Site_t)site, 
00103 //                         (DetectorId::DetectorId_t)detectorID);
00104 //    DayaBay::AdPmtSensor pmtId(ring, column, (Site::Site_t)site, 
00105 //                             (DetectorId::DetectorId_t)detectorID);
00106     DayaBay::PmtSimData pmt;
00107     DayaBay::DetectorSensor pmtId(row->GetPmtId());
00108     DayaBay::Detector detector( pmtId.site(), pmtId.detectorId() );
00109 //    pmt.m_pmtId = pmtId.fullPackedData();
00110     pmt.m_pmtId = pmtId;
00111     pmt.m_gain = row->GetGain();
00112     pmt.m_sigmaGain = row->GetSigmaGain();
00113     pmt.m_timeOffset = row->GetTimeOffset() * Units::ns;
00114     pmt.m_timeSpread = row->GetTimeSpread() * Units::ns;
00115     pmt.m_efficiency = row->GetEfficiency();
00116     pmt.m_prePulseProb = row->GetPrePulseProb();
00117     pmt.m_afterPulseProb = row->GetAfterPulseProb();
00118     pmt.m_darkRate = row->GetDarkRate() * Units::hertz;
00119     std::vector<DayaBay::PmtSimData>& pmtList = m_pmtData[detector];
00120     pmtList.push_back(pmt);
00121     // Add lookup by sensor ID
00122     m_pmtDataBySensor[pmtId] = pmtList[pmtList.size()-1];
00123 
00124   }
00125 
00126   //FIXME: leaving out RPC stuff for now
00127 
00128 
00129   return StatusCode::SUCCESS;
00130 }

StatusCode DbiSimDataSvc::finalize (  )  [virtual]

Reimplemented from Service.

Definition at line 132 of file DbiSimDataSvc.cc.

00133 {
00134   return this->Service::finalize();
00135 }

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

Reimplemented from Service.

Definition at line 137 of file DbiSimDataSvc.cc.

00139 {
00140   StatusCode sc = StatusCode::FAILURE;
00141   if (ppvInterface) {
00142     *ppvInterface = 0;
00143     
00144     if (ISimDataSvc::interfaceID().versionMatch(riid)) {
00145       *ppvInterface = static_cast<ISimDataSvc*>(this);
00146       sc = StatusCode::SUCCESS;
00147       addRef();
00148     }
00149     else sc = Service::queryInterface( riid, ppvInterface );    
00150   }
00151   return sc;
00152 }

const DayaBay::PmtSimData * DbiSimDataSvc::pmtSimData ( const DayaBay::DetectorSensor pmtId,
const ServiceMode svcMode 
) [virtual]

Implements ISimDataSvc.

Definition at line 154 of file DbiSimDataSvc.cc.

00157 {
00158   std::map<DayaBay::DetectorSensor, DayaBay::PmtSimData>::iterator result = 
00159     m_pmtDataBySensor.find(pmtId); 
00160   if(result != m_pmtDataBySensor.end()){
00161     return &(result->second);
00162   }
00163   return 0;
00164 }

const DayaBay::RpcSimData * DbiSimDataSvc::rpcSimData ( const DayaBay::RpcSensor rpcId,
const ServiceMode svcMode 
) [virtual]

Implements ISimDataSvc.

Definition at line 166 of file DbiSimDataSvc.cc.

00169 {
00170   std::map<DayaBay::RpcSensor, DayaBay::RpcSimData>::iterator result = 
00171     m_rpcDataBySensor.find(rpcId); 
00172   if(result != m_rpcDataBySensor.end()){
00173     return &(result->second);
00174   }
00175   return 0;
00176 }

const DayaBay::FeeSimData * DbiSimDataSvc::feeSimData ( const DayaBay::FeeChannelId channelId,
const ServiceMode svcMode 
) [virtual]

Implements ISimDataSvc.

Definition at line 179 of file DbiSimDataSvc.cc.

00182 {
00183   std::map<DayaBay::FeeChannelId, DayaBay::FeeSimData>::iterator result = 
00184     m_feeDataByChannel.find(channelId); 
00185   if(result != m_feeDataByChannel.end()){
00186     return &(result->second);
00187   }
00188   return 0;
00189 }

const DayaBay::FecSimData * DbiSimDataSvc::fecSimData ( const DayaBay::FecChannelId channelId,
const ServiceMode svcMode 
) [virtual]

Implements ISimDataSvc.

Definition at line 191 of file DbiSimDataSvc.cc.

00194 {
00195   std::map<DayaBay::FecChannelId, DayaBay::FecSimData>::iterator result = 
00196     m_fecDataByChannel.find(channelId); 
00197   if(result != m_fecDataByChannel.end()){
00198     return &(result->second);
00199   }
00200   return 0;
00201 }

const std::vector< DayaBay::PmtSimData > & DbiSimDataSvc::pmtSimList ( const DayaBay::Detector detectorId,
const ServiceMode svcMode 
) [virtual]

Implements ISimDataSvc.

Definition at line 204 of file DbiSimDataSvc.cc.

00207 {
00208   return m_pmtData[detectorId];
00209 }

const std::vector< DayaBay::RpcSimData > & DbiSimDataSvc::rpcSimList ( const DayaBay::Detector detectorId,
const ServiceMode svcMode 
) [virtual]

Implements ISimDataSvc.

Definition at line 211 of file DbiSimDataSvc.cc.

00214 {
00215   return m_rpcData[detectorId];
00216 }

const std::vector< DayaBay::FeeSimData > & DbiSimDataSvc::feeSimList ( const DayaBay::Detector detectorId,
const ServiceMode svcMode 
) [virtual]

Implements ISimDataSvc.

Definition at line 219 of file DbiSimDataSvc.cc.

00222 {
00223   return m_feeData[detectorId];
00224 }

const std::vector< DayaBay::FecSimData > & DbiSimDataSvc::fecSimList ( const DayaBay::Detector detectorId,
const ServiceMode svcMode 
) [virtual]

Implements ISimDataSvc.

Definition at line 226 of file DbiSimDataSvc.cc.

00229 {
00230   return m_fecData[detectorId];
00231 }


Member Data Documentation

std::map<DayaBay::Detector, std::vector<DayaBay::PmtSimData> > DbiSimDataSvc::m_pmtData [private]

Definition at line 71 of file DbiSimDataSvc.h.

std::map<DayaBay::Detector, std::vector<DayaBay::RpcSimData> > DbiSimDataSvc::m_rpcData [private]

Definition at line 72 of file DbiSimDataSvc.h.

std::map<DayaBay::Detector, std::vector<DayaBay::FeeSimData> > DbiSimDataSvc::m_feeData [private]

Definition at line 73 of file DbiSimDataSvc.h.

std::map<DayaBay::Detector, std::vector<DayaBay::FecSimData> > DbiSimDataSvc::m_fecData [private]

Definition at line 74 of file DbiSimDataSvc.h.

std::map<DayaBay::DetectorSensor, DayaBay::PmtSimData> DbiSimDataSvc::m_pmtDataBySensor [private]

Definition at line 77 of file DbiSimDataSvc.h.

std::map<DayaBay::RpcSensor, DayaBay::RpcSimData> DbiSimDataSvc::m_rpcDataBySensor [private]

Definition at line 78 of file DbiSimDataSvc.h.

std::map<DayaBay::FeeChannelId, DayaBay::FeeSimData> DbiSimDataSvc::m_feeDataByChannel [private]

Definition at line 80 of file DbiSimDataSvc.h.

std::map<DayaBay::FecChannelId, DayaBay::FecSimData> DbiSimDataSvc::m_fecDataByChannel [private]

Definition at line 81 of file DbiSimDataSvc.h.

std::string DbiSimDataSvc::m_cableSvcName [private]

Definition at line 85 of file DbiSimDataSvc.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:49 2011 for DbiDataSvc by doxygen 1.4.7