/search.css" rel="stylesheet" type="text/css"/> /search.js">
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

Public Member Functions | Static Public Member Functions | Private Attributes
DbiSimDataSvc Class Reference

#include <DbiSimDataSvc.h>

Inheritance diagram for DbiSimDataSvc:
Inheritance graph
[legend]
Collaboration diagram for DbiSimDataSvc:
Collaboration graph
[legend]

List of all members.

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)

Static Public Member Functions

static const InterfaceID & interfaceID ()

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

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.

    : Service(name,svc)
{
  declareProperty("CableSvcName",m_cableSvcName="DbiCableSvc",
                  "Name of service which provides the list of sensors to simulate");
}
DbiSimDataSvc::~DbiSimDataSvc ( )

Definition at line 41 of file DbiSimDataSvc.cc.

{
}

Member Function Documentation

StatusCode DbiSimDataSvc::initialize ( ) [virtual]

Definition at line 45 of file DbiSimDataSvc.cc.

{
  this->Service::initialize();
  
/*  IMessageSvc* msg = msgSvc();//cxs 2010-12-7
  if( !msg ){    
    return StatusCode::FAILURE;
  }
*/
   MsgStream msg(msgSvc(),name());
  // Initialize the data with a static table of numbers
  ICableSvc* cableSvc = 0;
  StatusCode sc = service("CableSvc",cableSvc,true);

  if( sc != StatusCode::SUCCESS ){
    std::ostringstream msgStr;
    msgStr << "Failed to access cable service: " << m_cableSvcName;
    return sc;    
  }

  Context vc(Site::kAll, SimFlag::kMC);
  DbiResultPtr<GSimPmtSpec> pr("SimPmtSpec",vc);
  //pr.NewQuery(vc);

  // Delete any residual objects and check for leaks.

  DbiTableProxyRegistry::Instance().ShowStatistics();
  

  // Check number of entires in result set
  unsigned int numRows = pr.GetNumRows();
  std::cout << "CJSLIN: Database rows = " << numRows << std::endl;
  const GSimPmtSpec* row ;
//  int site, detectorID, ring, column;
  
  for (unsigned int idx=0; idx < numRows; idx++) {

    row = pr.GetRowByIndex(idx);  
//    site = row->GetSite();
//    detectorID = row->GetAD();
//    ring = row->GetRing();
//    column = row->GetColumn();

//    DayaBay::Detector detector((Site::Site_t)site, 
//                         (DetectorId::DetectorId_t)detectorID);
//    DayaBay::AdPmtSensor pmtId(ring, column, (Site::Site_t)site, 
//                             (DetectorId::DetectorId_t)detectorID);
    DayaBay::PmtSimData pmt;
    DayaBay::DetectorSensor pmtId(row->GetPmtId());
    DayaBay::Detector detector( pmtId.site(), pmtId.detectorId() );
//    pmt.m_pmtId = pmtId.fullPackedData();
    pmt.m_pmtId = pmtId;
    pmt.m_gain = row->GetGain();
    pmt.m_sigmaGain = row->GetSigmaGain();
    pmt.m_timeOffset = row->GetTimeOffset() * Units::ns;
    pmt.m_timeSpread = row->GetTimeSpread() * Units::ns;
    pmt.m_efficiency = row->GetEfficiency();
    pmt.m_prePulseProb = row->GetPrePulseProb();
    pmt.m_afterPulseProb = row->GetAfterPulseProb();
    pmt.m_darkRate = row->GetDarkRate() * Units::hertz;
    std::vector<DayaBay::PmtSimData>& pmtList = m_pmtData[detector];
    pmtList.push_back(pmt);
    // Add lookup by sensor ID
    m_pmtDataBySensor[pmtId] = pmtList[pmtList.size()-1];

  }

  //FIXME: leaving out RPC stuff for now


  return StatusCode::SUCCESS;
}
StatusCode DbiSimDataSvc::finalize ( ) [virtual]

Definition at line 118 of file DbiSimDataSvc.cc.

{
  return this->Service::finalize();
}
StatusCode DbiSimDataSvc::queryInterface ( const InterfaceID &  riid,
void **  ppvInterface 
) [virtual]

Definition at line 123 of file DbiSimDataSvc.cc.

{
  StatusCode sc = StatusCode::FAILURE;
  if (ppvInterface) {
    *ppvInterface = 0;
    
    if (ISimDataSvc::interfaceID().versionMatch(riid)) {
      *ppvInterface = static_cast<ISimDataSvc*>(this);
      sc = StatusCode::SUCCESS;
      addRef();
    }
    else sc = Service::queryInterface( riid, ppvInterface );    
  }
  return sc;
}
const DayaBay::PmtSimData * DbiSimDataSvc::pmtSimData ( const DayaBay::DetectorSensor pmtId,
const ServiceMode svcMode 
) [virtual]

Implements ISimDataSvc.

Definition at line 140 of file DbiSimDataSvc.cc.

{
  std::map<DayaBay::DetectorSensor, DayaBay::PmtSimData>::iterator result = 
    m_pmtDataBySensor.find(pmtId); 
  if(result != m_pmtDataBySensor.end()){
    return &(result->second);
  }
  return 0;
}
const DayaBay::RpcSimData * DbiSimDataSvc::rpcSimData ( const DayaBay::RpcSensor rpcId,
const ServiceMode svcMode 
) [virtual]

Implements ISimDataSvc.

Definition at line 152 of file DbiSimDataSvc.cc.

{
  std::map<DayaBay::RpcSensor, DayaBay::RpcSimData>::iterator result = 
    m_rpcDataBySensor.find(rpcId); 
  if(result != m_rpcDataBySensor.end()){
    return &(result->second);
  }
  return 0;
}
const DayaBay::FeeSimData * DbiSimDataSvc::feeSimData ( const DayaBay::FeeChannelId channelId,
const ServiceMode svcMode 
) [virtual]

Implements ISimDataSvc.

Definition at line 165 of file DbiSimDataSvc.cc.

{
  std::map<DayaBay::FeeChannelId, DayaBay::FeeSimData>::iterator result = 
    m_feeDataByChannel.find(channelId); 
  if(result != m_feeDataByChannel.end()){
    return &(result->second);
  }
  return 0;
}
const DayaBay::FecSimData * DbiSimDataSvc::fecSimData ( const DayaBay::FecChannelId channelId,
const ServiceMode svcMode 
) [virtual]

Implements ISimDataSvc.

Definition at line 177 of file DbiSimDataSvc.cc.

{
  std::map<DayaBay::FecChannelId, DayaBay::FecSimData>::iterator result = 
    m_fecDataByChannel.find(channelId); 
  if(result != m_fecDataByChannel.end()){
    return &(result->second);
  }
  return 0;
}
const std::vector< DayaBay::PmtSimData > & DbiSimDataSvc::pmtSimList ( const DayaBay::Detector detectorId,
const ServiceMode svcMode 
) [virtual]

Implements ISimDataSvc.

Definition at line 190 of file DbiSimDataSvc.cc.

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

Implements ISimDataSvc.

Definition at line 197 of file DbiSimDataSvc.cc.

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

Implements ISimDataSvc.

Definition at line 205 of file DbiSimDataSvc.cc.

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

Implements ISimDataSvc.

Definition at line 212 of file DbiSimDataSvc.cc.

{
  return m_fecData[detectorId];
}

Member Data Documentation

Definition at line 71 of file DbiSimDataSvc.h.

Definition at line 72 of file DbiSimDataSvc.h.

Definition at line 73 of file DbiSimDataSvc.h.

Definition at line 74 of file DbiSimDataSvc.h.

Definition at line 77 of file DbiSimDataSvc.h.

Definition at line 78 of file DbiSimDataSvc.h.

Definition at line 80 of file DbiSimDataSvc.h.

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 Fri May 16 2014 09:59:43 for DbiDataSvc by doxygen 1.7.4