#include <DbiSimDataSvc.h>
Inheritance diagram for DbiSimDataSvc:
Definition at line 17 of file DbiSimDataSvc.h.
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 | ( | ) |
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 }
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.
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.