/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 Member Functions | Private Attributes
DbiCalibDataSvc Class Reference

#include <DbiCalibDataSvc.h>

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

List of all members.

Public Member Functions

 DbiCalibDataSvc (const std::string &name, ISvcLocator *svc)
 ~DbiCalibDataSvc ()
virtual StatusCode initialize ()
virtual StatusCode finalize ()
virtual StatusCode queryInterface (const InterfaceID &riid, void **ppvInterface)
const DayaBay::PmtCalibDatapmtCalibData (const DayaBay::DetectorSensor &pmtId, const ServiceMode &svcMode)
const DayaBay::PedBiasCalibDatapedBiasCalibData (const DayaBay::DetectorSensor &pmtId, const ServiceMode &svcMode)
const DayaBay::HighGainCalibDatahighGainCalibData (const DayaBay::DetectorSensor &pmtId, const ServiceMode &svcMode)
const DayaBay::RpcCalibDatarpcCalibData (const DayaBay::RpcSensor &rpcId, const ServiceMode &svcMode)
const DayaBay::FeeCalibDatafeeCalibData (const DayaBay::FeeChannelId &channelId, const ServiceMode &svcMode)
const DayaBay::FecCalibDatafecCalibData (const DayaBay::FecChannelId &channelId, const ServiceMode &svcMode)
const DayaBay::SrcEnergyDatasrcEnergyData (int type, const ServiceMode &svcMode)
const std::vector
< DayaBay::PmtCalibData > & 
pmtCalibList (const DayaBay::Detector &detectorId, const ServiceMode &svcMode)
const std::vector
< DayaBay::PedBiasCalibData > & 
pedBiasCalibList (const DayaBay::Detector &detectorId, const ServiceMode &svcMode)
const std::vector
< DayaBay::HighGainCalibData > & 
highGainCalibList (const DayaBay::Detector &detectorId, const ServiceMode &svcMode)
const std::vector
< DayaBay::RpcCalibData > & 
rpcCalibList (const DayaBay::Detector &detectorId, const ServiceMode &svcMode)
const std::vector
< DayaBay::FeeCalibData > & 
feeCalibList (const DayaBay::Detector &detectorId, const ServiceMode &svcMode)
const std::vector
< DayaBay::FecCalibData > & 
fecCalibList (const DayaBay::Detector &detectorId, const ServiceMode &svcMode)
const std::vector
< DayaBay::SrcEnergyData > & 
srcEnergyList (const ServiceMode &svcMode)

Static Public Member Functions

static const InterfaceID & interfaceID ()

Private Member Functions

virtual int readCalibPmtTable (const ServiceMode &)
virtual int readCalibPmtPedBiasTable (const ServiceMode &)
virtual int readCalibPmtHighGainTable (const ServiceMode &)
virtual int readCalibFeeTable (const ServiceMode &)
virtual int readCalibSrcEnergyTable (const ServiceMode &)

Private Attributes

std::map< DayaBay::Detector,
std::vector
< DayaBay::PmtCalibData > > 
m_pmtData
std::map< DayaBay::Detector,
std::vector
< DayaBay::PedBiasCalibData > > 
m_pedBiasData
std::map< DayaBay::Detector,
std::vector
< DayaBay::HighGainCalibData > > 
m_highGainData
std::map< DayaBay::Detector,
std::vector
< DayaBay::RpcCalibData > > 
m_rpcData
std::map< DayaBay::Detector,
std::vector
< DayaBay::FeeCalibData > > 
m_feeData
std::map< DayaBay::Detector,
std::vector
< DayaBay::FecCalibData > > 
m_fecData
std::map< DayaBay::Detector,
std::vector
< DayaBay::SrcEnergyData > > 
m_srcEnergyData
std::map
< DayaBay::DetectorSensor,
DayaBay::PmtCalibData
m_pmtDataBySensor
std::map
< DayaBay::DetectorSensor,
DayaBay::PedBiasCalibData
m_pedBiasDataBySensor
std::map
< DayaBay::DetectorSensor,
DayaBay::HighGainCalibData
m_highGainDataBySensor
std::map< DayaBay::RpcSensor,
DayaBay::RpcCalibData
m_rpcDataBySensor
std::map
< DayaBay::FeeChannelId,
DayaBay::FeeCalibData
m_feeDataByChannel
std::map
< DayaBay::FecChannelId,
DayaBay::FecCalibData
m_fecDataByChannel
std::string m_cableSvcName
Context feeLastContext
Context fecLastContext
Context pmtLastContext
Context pmtPedBiasLastContext
Context pmtHighGainLastContext
Context srcEnergyLastContext
const DbiResultKeyfeeLastResult
const DbiResultKeyfecLastResult
const DbiResultKeypmtLastResult
const DbiResultKeypmtPedBiasLastResult
const DbiResultKeypmtHighGainLastResult
const DbiResultKeysrcEnergyLastResult

Detailed Description

Definition at line 23 of file DbiCalibDataSvc.h.


Constructor & Destructor Documentation

DbiCalibDataSvc::DbiCalibDataSvc ( const std::string &  name,
ISvcLocator *  svc 
)

Definition at line 42 of file DbiCalibDataSvc.cc.

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

Definition at line 49 of file DbiCalibDataSvc.cc.

{
}

Member Function Documentation

StatusCode DbiCalibDataSvc::initialize ( ) [virtual]

Definition at line 53 of file DbiCalibDataSvc.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;
    //msg->reportMessage("DbiCalibDataSvc",MSG::ERROR,msgStr.str());
    return sc;    
  }
  feeLastResult = 0;   //cxs 2010-10-28
  fecLastResult = 0;   //cxs 2010-10-28
  pmtLastResult = 0;   //cxs 2010-10-28
  pmtPedBiasLastResult = 0; //jpochoa 2011-06-15
  pmtHighGainLastResult = 0; //jpochoa 2011-06-15
  //pmtTimingLastResult = 0; //jpochoa 2011-06-24
  //feeGainConvLastResult = 0;//jpochoa 2011-07-08
  
  return StatusCode::SUCCESS;
}
StatusCode DbiCalibDataSvc::finalize ( ) [virtual]

Definition at line 82 of file DbiCalibDataSvc.cc.

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

Definition at line 87 of file DbiCalibDataSvc.cc.

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

Implements ICalibDataSvc.

Definition at line 103 of file DbiCalibDataSvc.cc.

{
/*
  if(serviceMode.context() != lastContext){  //XiaoSu Chen 2010/7/10
    readCalibPmtTable(serviceMode.context());//XiaoSu Chen 2010/6/30
    lastContext = serviceMode.context();
  }
*/

  readCalibPmtTable(serviceMode);
  std::map<DayaBay::DetectorSensor, DayaBay::PmtCalibData>::iterator result = 
    m_pmtDataBySensor.find(pmtId); 
  if(result != m_pmtDataBySensor.end()){
    return &(result->second);
  }
  return 0;
}
const DayaBay::PedBiasCalibData * DbiCalibDataSvc::pedBiasCalibData ( const DayaBay::DetectorSensor pmtId,
const ServiceMode svcMode 
) [virtual]

Implements ICalibDataSvc.

Definition at line 123 of file DbiCalibDataSvc.cc.

{  
  readCalibPmtPedBiasTable(serviceMode);
  std::map<DayaBay::DetectorSensor, DayaBay::PedBiasCalibData>::iterator result = 
    m_pedBiasDataBySensor.find(pmtId);  
  if(result != m_pedBiasDataBySensor.end()){
    return &(result->second);
  }
  return 0;
}
const DayaBay::HighGainCalibData * DbiCalibDataSvc::highGainCalibData ( const DayaBay::DetectorSensor pmtId,
const ServiceMode svcMode 
) [virtual]

Implements ICalibDataSvc.

Definition at line 136 of file DbiCalibDataSvc.cc.

{  
  readCalibPmtHighGainTable(serviceMode);
  std::map<DayaBay::DetectorSensor, DayaBay::HighGainCalibData>::iterator result = 
    m_highGainDataBySensor.find(pmtId);  
  if(result != m_highGainDataBySensor.end()){
    return &(result->second);
  }
  return 0;
}
const DayaBay::RpcCalibData * DbiCalibDataSvc::rpcCalibData ( const DayaBay::RpcSensor rpcId,
const ServiceMode svcMode 
) [virtual]

Implements ICalibDataSvc.

Definition at line 175 of file DbiCalibDataSvc.cc.

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

Implements ICalibDataSvc.

Definition at line 187 of file DbiCalibDataSvc.cc.

{
/*
  if(serviceMode.context() != lastContext){  //XiaoSu Chen 2010/7/10
    readCalibFeeTable(serviceMode.context());//XiaoSu Chen 2010/6/30
    lastContext = serviceMode.context();
  }
*/
  readCalibFeeTable(serviceMode);
  std::map<DayaBay::FeeChannelId, DayaBay::FeeCalibData>::iterator result = 
    m_feeDataByChannel.find(channelId); 
  if(result != m_feeDataByChannel.end()){
    return &(result->second);
  }
  return 0;
}
const DayaBay::FecCalibData * DbiCalibDataSvc::fecCalibData ( const DayaBay::FecChannelId channelId,
const ServiceMode svcMode 
) [virtual]

Implements ICalibDataSvc.

Definition at line 206 of file DbiCalibDataSvc.cc.

{
  std::map<DayaBay::FecChannelId, DayaBay::FecCalibData>::iterator result = 
    m_fecDataByChannel.find(channelId); 
  if(result != m_fecDataByChannel.end()){
    return &(result->second);
  }
  return 0;
}
const DayaBay::SrcEnergyData * DbiCalibDataSvc::srcEnergyData ( int  type,
const ServiceMode svcMode 
) [virtual]

Implements ICalibDataSvc.

Definition at line 218 of file DbiCalibDataSvc.cc.

{
  //error
  readCalibSrcEnergyTable(svcMode);
  DayaBay::Detector detector(svcMode.context().GetSite(),svcMode.context().GetDetId());
  std::vector<DayaBay::SrcEnergyData> energyList = m_srcEnergyData[detector];
  std::vector<DayaBay::SrcEnergyData>::iterator be = energyList.begin(), en = energyList.end();
  for(;be!=en;be++){
        if((*be).m_sourcePeakType==type)
                return &(*be);
  }
  //Not implemented for StaticCalibDataSvc (jpochoa)
  return 0;

}
const std::vector< DayaBay::PmtCalibData > & DbiCalibDataSvc::pmtCalibList ( const DayaBay::Detector detectorId,
const ServiceMode svcMode 
) [virtual]

Implements ICalibDataSvc.

Definition at line 235 of file DbiCalibDataSvc.cc.

{
  readCalibPmtTable(serviceMode);
  return m_pmtData[detectorId];
}
const std::vector< DayaBay::PedBiasCalibData > & DbiCalibDataSvc::pedBiasCalibList ( const DayaBay::Detector detectorId,
const ServiceMode svcMode 
) [virtual]

Implements ICalibDataSvc.

Definition at line 243 of file DbiCalibDataSvc.cc.

{
  readCalibPmtPedBiasTable(serviceMode);
  return m_pedBiasData[detectorId];
}
const std::vector< DayaBay::HighGainCalibData > & DbiCalibDataSvc::highGainCalibList ( const DayaBay::Detector detectorId,
const ServiceMode svcMode 
) [virtual]

Implements ICalibDataSvc.

Definition at line 251 of file DbiCalibDataSvc.cc.

{
  readCalibPmtHighGainTable(serviceMode);
  return m_highGainData[detectorId];
}
const std::vector< DayaBay::RpcCalibData > & DbiCalibDataSvc::rpcCalibList ( const DayaBay::Detector detectorId,
const ServiceMode svcMode 
) [virtual]

Implements ICalibDataSvc.

Definition at line 275 of file DbiCalibDataSvc.cc.

{
  return m_rpcData[detectorId];
}
const std::vector< DayaBay::FeeCalibData > & DbiCalibDataSvc::feeCalibList ( const DayaBay::Detector detectorId,
const ServiceMode svcMode 
) [virtual]

Implements ICalibDataSvc.

Definition at line 282 of file DbiCalibDataSvc.cc.

{
  readCalibFeeTable(serviceMode);
  return m_feeData[detectorId];
}
const std::vector< DayaBay::FecCalibData > & DbiCalibDataSvc::fecCalibList ( const DayaBay::Detector detectorId,
const ServiceMode svcMode 
) [virtual]

Implements ICalibDataSvc.

Definition at line 290 of file DbiCalibDataSvc.cc.

{
  return m_fecData[detectorId];
}
const std::vector< DayaBay::SrcEnergyData > & DbiCalibDataSvc::srcEnergyList ( const ServiceMode svcMode) [virtual]

Implements ICalibDataSvc.

Definition at line 297 of file DbiCalibDataSvc.cc.

{
 // readCalibSrcEnergyTable(serviceMode);
  //return m_srcEnergyData;
}
int DbiCalibDataSvc::readCalibPmtTable ( const ServiceMode serviceMode) [inline, private, virtual]

Definition at line 305 of file DbiCalibDataSvc.cc.

                                                                           {
  if(serviceMode.context() == pmtLastContext){  //XiaoSu Chen 2010/10/28
    return 2;    
  }
  pmtLastContext = serviceMode.context();       //XiaoSu Chen 2010/10/28

  DbiResultPtr<GCalibPmtSpec> pr("CalibPmtSpec",pmtLastContext,pmtLastContext.GetDetId());
  // Check whether the result is the same as the last one
  const DbiResultKey* thisResult= pr.GetKey(); 
  if(pmtLastResult == 0){                       //XiaoSu Chen 2010/7/8
    pmtLastResult = thisResult;
  }else if(thisResult->IsEqualTo(pmtLastResult))
  {
    return 2;
  }else{
    pmtLastResult = thisResult;
  }

  //DbiTableProxyRegistry::Instance().ShowStatistics();
  // Check number of entires in result set
  unsigned int numRows = pr.GetNumRows();

  std::cout << "Database rows = " << numRows << std::endl;
  const GCalibPmtSpec* row ;
//  int site, detectorID, ring, column;
  //DayaBay::Detector lastDetector;
  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::PmtCalibData pmt;
    DayaBay::DetectorSensor pmtId(row->GetPmtId());
    DayaBay::Detector detector( pmtId.site(), pmtId.detectorId() );
    pmt.m_pmtId = pmtId;
    pmt.m_status = DayaBay::PmtCalibData::Status_t(row->GetStatus());               // rewrited by ChenXiaosu
    pmt.m_speHigh = row->GetSpeHigh();
    pmt.m_sigmaSpeHigh = row->GetSigmaSpeHigh();
    pmt.m_speLow = row->GetSpeLow();
    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::cout << "Adding PMT = " << pmtId.fullPackedData() << std::endl;
    //std::vector<DayaBay::PmtCalibData>& pmtList = m_pmtData[detector];
    //Add lookup by sensor ID
    m_pmtDataBySensor[pmtId] = pmt;
  }
  for(std::map<DayaBay::Detector, std::vector<DayaBay::PmtCalibData> >::iterator pmtData = m_pmtData.begin(); pmtData != m_pmtData.end(); pmtData++)//Xiaosu Chen 2010/7/8
  {
    std::vector<DayaBay::PmtCalibData>& pmtList = pmtData->second;
    pmtList.clear();
  }

  for(std::map<DayaBay::DetectorSensor, DayaBay::PmtCalibData>::iterator pmtDataBySensor = m_pmtDataBySensor.begin(); pmtDataBySensor != m_pmtDataBySensor.end(); pmtDataBySensor++)//Xiaosu Chen 2010/7/8
  {
    DayaBay::DetectorSensor pmtId = pmtDataBySensor->first;
    DayaBay::Detector detector( pmtId.site(), pmtId.detectorId() );
    std::vector<DayaBay::PmtCalibData>& pmtList = m_pmtData[detector];
    pmtList.push_back(pmtDataBySensor->second);
  }
  return 1;
}
int DbiCalibDataSvc::readCalibPmtPedBiasTable ( const ServiceMode serviceMode) [inline, private, virtual]

Definition at line 378 of file DbiCalibDataSvc.cc.

                                                                                  {
 
  if(serviceMode.context() == pmtPedBiasLastContext){  
    return 2;    
  }
  pmtPedBiasLastContext = serviceMode.context();       

  DbiResultPtr<GCalibPmtPedBias> pr("CalibPmtPedBias",pmtPedBiasLastContext,pmtPedBiasLastContext.GetDetId());
  // Check whether the result is the same as the last one
  const DbiResultKey* thisResult= pr.GetKey(); 
  if(pmtPedBiasLastResult == 0){                       
    pmtPedBiasLastResult = thisResult;
  }else if(thisResult->IsEqualTo(pmtPedBiasLastResult))
  {
    return 2;
  }else{
    pmtPedBiasLastResult = thisResult;
  }

  // Check number of entries in result set
  unsigned int numRows = pr.GetNumRows();

  std::cout << "Database rows = " << numRows << std::endl;
  const GCalibPmtPedBias* row ;

  for (unsigned int idx=0; idx < numRows; idx++) {
    row = pr.GetRowByIndex(idx);  
    DayaBay::PedBiasCalibData pedbias;  
    DayaBay::DetectorSensor pmtId(row->GetSensorId());
    DayaBay::Detector detector( pmtId.site(), pmtId.detectorId() );

    pedbias.m_pmtId = pmtId;
    pedbias.m_amp.b=row->GetAmp_b();
    pedbias.m_amp.m=row->GetAmp_m();
    pedbias.m_mean.amp = row->GetMean_amp();
    pedbias.m_mean.mean = row->GetMean_mean();
    pedbias.m_mean.sigma = row->GetMean_sigma();
    pedbias.m_mean.offset = row->GetMean_offset();
    pedbias.m_mean.b = row->GetMean_b();
    pedbias.m_mean.m = row->GetMean_m();
    pedbias.m_sigma.amp = row->GetSigma_amp();
    pedbias.m_sigma.mean = row->GetSigma_mean();
    pedbias.m_sigma.sigma = row->GetSigma_sigma();
    pedbias.m_sigma.offset = row->GetSigma_offset();
    pedbias.m_sigma.b = row->GetSigma_b();
    pedbias.m_sigma.m = row->GetSigma_m();
    pedbias.m_a0.b = row->GetA0_b();
    pedbias.m_a0.m = row->GetA0_m();
    pedbias.m_a1.b = row->GetA1_b();
    pedbias.m_a1.m = row->GetA1_m();
    pedbias.m_a2.b = row->GetA2_b();
    pedbias.m_a2.m = row->GetA2_m();
    pedbias.m_a3.b = row->GetA3_b();
    pedbias.m_a3.m = row->GetA3_m();
   
    m_pedBiasDataBySensor[pmtId] = pedbias;
  }
  for(std::map<DayaBay::Detector, std::vector<DayaBay::PedBiasCalibData> >::iterator pedBiasData = m_pedBiasData.begin(); pedBiasData != m_pedBiasData.end(); pedBiasData++)
  {
    std::vector<DayaBay::PedBiasCalibData>& pmtList = pedBiasData->second;
    pmtList.clear();
  }

  for(std::map<DayaBay::DetectorSensor, DayaBay::PedBiasCalibData>::iterator pedBiasDataBySensor = m_pedBiasDataBySensor.begin(); pedBiasDataBySensor != m_pedBiasDataBySensor.end(); pedBiasDataBySensor++)
  {
    DayaBay::DetectorSensor pmtId = pedBiasDataBySensor->first;
    DayaBay::Detector detector( pmtId.site(), pmtId.detectorId() );
    std::vector<DayaBay::PedBiasCalibData>& pmtList = m_pedBiasData[detector];
    pmtList.push_back(pedBiasDataBySensor->second);
  }
  return 1;
}
int DbiCalibDataSvc::readCalibPmtHighGainTable ( const ServiceMode serviceMode) [inline, private, virtual]

Definition at line 453 of file DbiCalibDataSvc.cc.

                                                                                   {
 
  if(serviceMode.context() == pmtHighGainLastContext){  
    return 2;    
  }
  pmtHighGainLastContext = serviceMode.context();       

  DbiResultPtr<GCalibPmtHighGain> pr("CalibPmtHighGain",pmtHighGainLastContext,pmtHighGainLastContext.GetDetId());
  // Check whether the result is the same as the last one
  const DbiResultKey* thisResult= pr.GetKey(); 
  if(pmtHighGainLastResult == 0){                       
    pmtHighGainLastResult = thisResult;
  }else if(thisResult->IsEqualTo(pmtHighGainLastResult))
  {
    return 2;
  }else{
    pmtHighGainLastResult = thisResult;
  }

  // Check number of entries in result set
  unsigned int numRows = pr.GetNumRows();

  std::cout << "Database rows = " << numRows << std::endl;
  const GCalibPmtHighGain* row ;

  for (unsigned int idx=0; idx < numRows; idx++) {
    row = pr.GetRowByIndex(idx);  
    DayaBay::HighGainCalibData highgain;  
    DayaBay::DetectorSensor pmtId(row->GetSensorId());
    DayaBay::Detector detector( pmtId.site(), pmtId.detectorId() );

    highgain.m_pmtId = pmtId;
    highgain.m_speHigh = row->GetSpeHigh();
    highgain.m_speHighError = row->GetSpeHighError();
    highgain.m_sigmaSpeHigh = row->GetSigmaSpeHigh();
    highgain.m_speHighFitQual = row->GetSpeHighFitQual();
   
    m_highGainDataBySensor[pmtId] = highgain;
  }
  for(std::map<DayaBay::Detector, std::vector<DayaBay::HighGainCalibData> >::iterator highGainData = m_highGainData.begin(); highGainData != m_highGainData.end(); highGainData++)
  {
    std::vector<DayaBay::HighGainCalibData>& pmtList = highGainData->second;
    pmtList.clear();
  }

  for(std::map<DayaBay::DetectorSensor, DayaBay::HighGainCalibData>::iterator highGainDataBySensor = m_highGainDataBySensor.begin(); highGainDataBySensor != m_highGainDataBySensor.end(); highGainDataBySensor++)
  {
    DayaBay::DetectorSensor pmtId = highGainDataBySensor->first;
    DayaBay::Detector detector( pmtId.site(), pmtId.detectorId() );
    std::vector<DayaBay::HighGainCalibData>& pmtList = m_highGainData[detector];
    pmtList.push_back(highGainDataBySensor->second);
  }
  return 1;
}
int DbiCalibDataSvc::readCalibFeeTable ( const ServiceMode serviceMode) [inline, private, virtual]

Definition at line 628 of file DbiCalibDataSvc.cc.

                                                                           {
  if(serviceMode.context() == feeLastContext){  //XiaoSu Chen 2010/10/28
    return 2;    
  }
  feeLastContext = serviceMode.context();       //XiaoSu Chen 2010/10/28

  DbiResultPtr<GCalibFeeSpec> pr("CalibFeeSpec",feeLastContext,feeLastContext.GetDetId());
  const DbiResultKey* thisResult= pr.GetKey(); 
  if(feeLastResult == 0){                       //XiaoSu Chen 2010/7/8
    feeLastResult = thisResult;
  }else if(thisResult->IsEqualTo(feeLastResult))
  {
    return 2;
  }else{
    feeLastResult = thisResult;
  }

  //DbiTableProxyRegistry::Instance().ShowStatistics();
  // Check number of entires in result set
  unsigned int numRows = pr.GetNumRows();
  std::cout << "Database rows = " << numRows << std::endl;
  const GCalibFeeSpec* row;
  for (unsigned int idx=0; idx < numRows; idx++) {
    row = pr.GetRowByIndex(idx); 
    DayaBay::FeeChannelId feeId(row->GetChannelId());
    DayaBay::FeeCalibData fee;
    fee.m_channelId = row->GetChannelId();  
    fee.m_status = DayaBay::FeeCalibData::Status_t(row->GetStatus());         
    fee.m_adcThresholdHigh = row->GetAdcThresholdHigh(); 
    fee.m_adcThresholdLow = row->GetAdcThresholdLow(); 
    fee.m_adcBaselineHigh = row->GetAdcPedestalHigh();  
    fee.m_adcBaselineLow = row->GetAdcPedestalLow(); 
    m_feeDataByChannel[feeId] = fee;  
  }
  for(std::map<DayaBay::Detector, std::vector<DayaBay::FeeCalibData> >::iterator feeData = m_feeData.begin(); feeData != m_feeData.end(); feeData++)//Xiaosu Chen 2010/7/8
  {
    std::vector<DayaBay::FeeCalibData>& feeList = feeData->second;
    feeList.clear();
  }
  for(std::map<DayaBay::FeeChannelId, DayaBay::FeeCalibData>::iterator feeDataByChannel = m_feeDataByChannel.begin(); feeDataByChannel != m_feeDataByChannel.end(); feeDataByChannel++)//Xiaosu Chen 2010/7/8
  {
    DayaBay::FeeChannelId feeId = feeDataByChannel->first;
    DayaBay::Detector detector( feeId.site(), feeId.detectorId() );
    std::vector<DayaBay::FeeCalibData>& feeList = m_feeData[detector];
    feeList.push_back(feeDataByChannel->second);
  }

  return 1;
}
int DbiCalibDataSvc::readCalibSrcEnergyTable ( const ServiceMode serviceMode) [inline, private, virtual]

Definition at line 681 of file DbiCalibDataSvc.cc.

                                                                                 {

  if(serviceMode.context() == srcEnergyLastContext){
    return 2;
  }
  srcEnergyLastContext = serviceMode.context();

  DbiResultPtr<GCalibSrcEnergy> pr("CalibSrcEnergy",srcEnergyLastContext,srcEnergyLastContext.GetDetId());
  // Check whether the result is the same as the last one
  const DbiResultKey* thisResult= pr.GetKey();
  if(srcEnergyLastResult == 0){
    srcEnergyLastResult = thisResult;
  }else if(thisResult->IsEqualTo(srcEnergyLastResult))
    {
      return 2;
    }else{
      srcEnergyLastResult = thisResult;
    }

  // Check number of entries in result set
  unsigned int numRows = pr.GetNumRows();

  std::cout << "Database rows = " << numRows << std::endl;
  const GCalibSrcEnergy* row ;
  for(std::map<DayaBay::Detector, std::vector<DayaBay::SrcEnergyData> >::iterator energyData = m_srcEnergyData.begin(); energyData != m_srcEnergyData.end(); energyData++)//Xiaosu Chen 2010/7/8
  {
    std::vector<DayaBay::SrcEnergyData>& energyList = energyData->second;
    energyList.clear();
  }

  for (unsigned int idx=0; idx < numRows; idx++) {
    row = pr.GetRowByIndex(idx);
    DayaBay::SrcEnergyData srcenergy;

    srcenergy.m_sourcePeakType = row->GetSourcePeakType();
    srcenergy.m_xSrcPosition = row->GetXSrcPosition();
    srcenergy.m_ySrcPosition = row->GetYSrcPosition();
    srcenergy.m_zSrcPosition = row->GetZSrcPosition();
    srcenergy.m_pePeak = row->GetPEPeak();
    srcenergy.m_pePeakUnc = row->GetPEPeakUnc();
    srcenergy.m_pePeakFitQuality = row->GetPEPeakFitQuality();
    DayaBay::Detector detector(serviceMode.context().GetSite(),serviceMode.context().GetDetId());
    std::vector<DayaBay::SrcEnergyData>& energyList = m_srcEnergyData[detector];
    energyList.push_back(srcenergy);
   // m_srcEnergyData.push_back(srcenergy);
  }
  
  return 1;
}

Member Data Documentation

Definition at line 125 of file DbiCalibDataSvc.h.

Definition at line 126 of file DbiCalibDataSvc.h.

Definition at line 127 of file DbiCalibDataSvc.h.

Definition at line 130 of file DbiCalibDataSvc.h.

Definition at line 131 of file DbiCalibDataSvc.h.

Definition at line 132 of file DbiCalibDataSvc.h.

Definition at line 133 of file DbiCalibDataSvc.h.

Definition at line 136 of file DbiCalibDataSvc.h.

Definition at line 137 of file DbiCalibDataSvc.h.

Definition at line 138 of file DbiCalibDataSvc.h.

Definition at line 140 of file DbiCalibDataSvc.h.

Definition at line 143 of file DbiCalibDataSvc.h.

Definition at line 144 of file DbiCalibDataSvc.h.

std::string DbiCalibDataSvc::m_cableSvcName [private]

Definition at line 147 of file DbiCalibDataSvc.h.

Definition at line 149 of file DbiCalibDataSvc.h.

Definition at line 150 of file DbiCalibDataSvc.h.

Definition at line 151 of file DbiCalibDataSvc.h.

Definition at line 152 of file DbiCalibDataSvc.h.

Definition at line 153 of file DbiCalibDataSvc.h.

Definition at line 156 of file DbiCalibDataSvc.h.

Definition at line 158 of file DbiCalibDataSvc.h.

Definition at line 159 of file DbiCalibDataSvc.h.

Definition at line 160 of file DbiCalibDataSvc.h.

Definition at line 161 of file DbiCalibDataSvc.h.

Definition at line 162 of file DbiCalibDataSvc.h.

Definition at line 165 of file DbiCalibDataSvc.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