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

New implementation of calibration data service using dbi, for calibrations constants that apply at a detector level. More...

#include <DybPmtCalibSvc.h>

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

List of all members.

Public Member Functions

 DybPmtCalibSvc (const std::string &name, ISvcLocator *svc)
virtual ~DybPmtCalibSvc ()
virtual StatusCode queryInterface (const InterfaceID &riid, void **ppvInterface)
virtual int readCalibPmtTable (const ServiceMode &)
virtual int readCalibHighGainTable (const ServiceMode &)
virtual int readCalibFakeGainTable (const ServiceMode &)
virtual int readCalibFineGainTable (const ServiceMode &)
virtual int readCalibPedBiasTable (const ServiceMode &)
virtual int readCalibTimingTable (const ServiceMode &)
virtual int readCalibGainConvTable (const ServiceMode &)
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::HighGainCalibDatafakeGainCalibData (const DayaBay::DetectorSensor &pmtId, const ServiceMode &svcMode)
const DayaBay::FineGainCalibDatafineGainCalibData (const DayaBay::FeeChannelId &channelId, const ServiceMode &svcMode)
const DayaBay::TimingCalibDatatimingCalibData (const DayaBay::FeeChannelId &channelId, const ServiceMode &svcMode)
const DayaBay::GainConvCalibDatagainConvCalibData (const DayaBay::FeeChannelId &channelId, const ServiceMode &svcMode)

Static Public Member Functions

static const InterfaceID & interfaceID ()

Public Attributes

std::map< ServiceMode,
DbiResultKey
m_pmtCalibDataKeys
std::map< ServiceMode,
std::map
< DayaBay::DetectorSensor,
DayaBay::PmtCalibData > > 
m_pmtCalibDataMap
std::map< ServiceMode,
DbiResultKey
m_highGainCalibDataKeys
std::map< ServiceMode,
std::map
< DayaBay::DetectorSensor,
DayaBay::HighGainCalibData > > 
m_highGainCalibDataMap
std::map< ServiceMode,
DbiResultKey
m_fakeGainCalibDataKeys
std::map< ServiceMode,
std::map
< DayaBay::DetectorSensor,
DayaBay::HighGainCalibData > > 
m_fakeGainCalibDataMap
std::map< ServiceMode,
DbiResultKey
m_fineGainCalibDataKeys
std::map< ServiceMode,
std::map
< DayaBay::FeeChannelId,
DayaBay::FineGainCalibData > > 
m_fineGainCalibDataMap
std::map< ServiceMode,
DbiResultKey
m_timingCalibDataKeys
std::map< ServiceMode,
std::map
< DayaBay::FeeChannelId,
DayaBay::TimingCalibData > > 
m_timingCalibDataMap
std::map< ServiceMode,
DbiResultKey
m_pedBiasCalibDataKeys
std::map< ServiceMode,
std::map
< DayaBay::DetectorSensor,
DayaBay::PedBiasCalibData > > 
m_pedBiasCalibDataMap
std::map< ServiceMode,
DbiResultKey
m_gainConvCalibDataKeys
std::map< ServiceMode,
std::map
< DayaBay::FeeChannelId,
DayaBay::GainConvCalibData > > 
m_gainConvCalibDataMap

Private Member Functions

ServiceMode CopyWithBOT (const ServiceMode &svcMode)

Private Attributes

ServiceMode pmtLastSM
ServiceMode highGainLastSM
ServiceMode fakeGainLastSM
ServiceMode fineGainLastSM
ServiceMode pedBiasLastSM
ServiceMode timingLastSM
ServiceMode gainConvLastSM

Detailed Description

New implementation of calibration data service using dbi, for calibrations constants that apply at a detector level.

New implementation of calibration data service using dbi, for calibrations constants that apply at a PMT level (or channel-level).

jpochoa@lbl.gov Sep 20 2011

Heavily inspired from its predecessor DbiCalibDataSvc (written by Dan and then modified by Xiaosu, Weili and myself, among others). Also inspired from Brett's DybCableSvc.

jpochoa@lbl.gov Aug 29 2011

Definition at line 24 of file DybPmtCalibSvc.h.


Constructor & Destructor Documentation

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

Definition at line 25 of file DybPmtCalibSvc.cc.

    : Service(name,svc)
{

}
DybPmtCalibSvc::~DybPmtCalibSvc ( ) [virtual]

Definition at line 30 of file DybPmtCalibSvc.cc.

{
}

Member Function Documentation

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

Definition at line 34 of file DybPmtCalibSvc.cc.

{
    StatusCode sc = StatusCode::FAILURE;
    if (ppvInterface) {
        *ppvInterface = 0;
    
        if (IPmtCalibSvc::interfaceID().versionMatch(riid)) {
            *ppvInterface = static_cast<IPmtCalibSvc*>(this);
            sc = StatusCode::SUCCESS;
            addRef();
        }
        else sc = Service::queryInterface( riid, ppvInterface );    
    }
    return sc;
}
int DybPmtCalibSvc::readCalibPmtTable ( const ServiceMode serviceMode) [inline, virtual]

Definition at line 179 of file DybPmtCalibSvc.cc.

                                                                          {

  //If service mode is the same as the last query then don't even bother
  //(this happens very often, i.e. whenever looping over PMTs in the same readout)
  if(serviceMode.context() == pmtLastSM.context() && serviceMode.task() == pmtLastSM.task()){  
    return 3;    
  }
  pmtLastSM = serviceMode;       

  //Check if result is already stored in cache; if not, then create it
  ServiceMode mysm = CopyWithBOT(serviceMode);
  DbiResultPtr<GCalibPmtSpec> pr("CalibPmtSpec",serviceMode.context(),serviceMode.context().GetDetId(),serviceMode.task());
  DbiResultKey thisResult = *(pr.GetKey()); 
  if(m_pmtCalibDataKeys.find(mysm)!=m_pmtCalibDataKeys.end() && thisResult.IsEqualTo(&m_pmtCalibDataKeys[mysm])){
    return 2;//<-- nothing to be done; result in cache is the same
  } else {
    
    //Proceed to read the DB table 
    MsgStream log(msgSvc());
    // --> results will be stored in this map
    std::map<DayaBay::DetectorSensor, DayaBay::PmtCalibData > m_calibData;
    // --> Check number of entries in result set
    unsigned int numRows = pr.GetNumRows();
    if(numRows!=0) log << MSG::INFO << "Database rows = " << numRows << endreq;
    if(numRows<=0) {
      //log << MSG::WARNING << "Found no entries in CalibPmtSpec for task " << serviceMode.task() << " and context " << serviceMode.context().AsString() << endreq;
      return 0;
    }
    const GCalibPmtSpec* row ;
    // --> Read table
    for (unsigned int idx=0; idx < numRows; idx++) {
      row = pr.GetRowByIndex(idx);       
      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());  
      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;
      
      m_calibData[pmtId] = pmt;
    }
    // --> saving result
    m_pmtCalibDataKeys[mysm]=thisResult;
    m_pmtCalibDataMap[mysm]=m_calibData;
  }

  return 1;
}
int DybPmtCalibSvc::readCalibHighGainTable ( const ServiceMode serviceMode) [inline, virtual]

Definition at line 236 of file DybPmtCalibSvc.cc.

                                                                               {

  //If service mode is the same as the last query then don't even bother
  //(this happens very often, i.e. whenever looping over PMTs in the same readout)
  if(serviceMode.context() == highGainLastSM.context() && serviceMode.task() == highGainLastSM.task()){      
    return 3;    
  }
  highGainLastSM = serviceMode;     

  //Check if result is already stored in cache; if not, then create it
  ServiceMode mysm = CopyWithBOT(serviceMode);
  DbiResultPtr<GCalibPmtHighGain> pr("CalibPmtHighGain",serviceMode.context(),serviceMode.context().GetDetId(),serviceMode.task());
  DbiResultKey thisResult = *(pr.GetKey()); 
  if(m_highGainCalibDataKeys.find(mysm)!=m_highGainCalibDataKeys.end() && thisResult.IsEqualTo(&m_highGainCalibDataKeys[mysm])){
    return 2;//<-- nothing to be done; result in cache is the same
  } else {
    
    //Proceed to read the DB table 
    MsgStream log(msgSvc());
    // --> results will be stored in this map
    std::map<DayaBay::DetectorSensor, DayaBay::HighGainCalibData > m_calibHighGainData;
    // --> Check number of entries in result set
    unsigned int numRows = pr.GetNumRows();
    if(numRows!=0) log << MSG::INFO << "Database rows = " << numRows << endreq;
    if(numRows<=0) {
      //log << MSG::WARNING << "Found no entries in CalibPmtHighGain for task " << serviceMode.task() << " and context " << serviceMode.context().AsString() << endreq;
      return 0;
    }
    const GCalibPmtHighGain* row ;
    // --> Read table
    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_calibHighGainData[pmtId] = highgain;
    }
    // --> saving result
    m_highGainCalibDataKeys[mysm]=thisResult;
    m_highGainCalibDataMap[mysm]=m_calibHighGainData;

  }

  return 1;
}
int DybPmtCalibSvc::readCalibFakeGainTable ( const ServiceMode serviceMode) [inline, virtual]

Definition at line 290 of file DybPmtCalibSvc.cc.

                                                                               {

  //If service mode is the same as the last query then don't even bother
  //(this happens very often, i.e. whenever looping over PMTs in the same readout)
  if(serviceMode.context() == fakeGainLastSM.context() && serviceMode.task() == fakeGainLastSM.task()){      
    return 3;    
  }
  fakeGainLastSM = serviceMode;     

  //Check if result is already stored in cache; if not, then create it
  ServiceMode mysm = CopyWithBOT(serviceMode);
  DbiResultPtr<GCalibPmtHighGainFake> pr("CalibPmtHighGainFake",serviceMode.context(),serviceMode.context().GetDetId(),serviceMode.task());
  DbiResultKey thisResult = *(pr.GetKey()); 
  if(m_fakeGainCalibDataKeys.find(mysm)!=m_fakeGainCalibDataKeys.end() && thisResult.IsEqualTo(&m_fakeGainCalibDataKeys[mysm])){
    return 2;//<-- nothing to be done; result in cache is the same
  } else {
    
    //Proceed to read the DB table 
    MsgStream log(msgSvc());
    // --> results will be stored in this map
    std::map<DayaBay::DetectorSensor, DayaBay::HighGainCalibData > m_calibFakeGainData;
    // --> Check number of entries in result set
    unsigned int numRows = pr.GetNumRows();
    if(numRows!=0) log << MSG::INFO << "Database rows = " << numRows << endreq;
    if(numRows<=0) {
      //log << MSG::WARNING << "Found no entries in CalibPmtFakeGain for task " << serviceMode.task() << " and context " << serviceMode.context().AsString() << endreq;
      return 0;
    }
    const GCalibPmtHighGainFake* row ;
    // --> Read table
    for (unsigned int idx=0; idx < numRows; idx++) {

      row = pr.GetRowByIndex(idx);  
      DayaBay::HighGainCalibData fakegain;  
      DayaBay::DetectorSensor pmtId(row->GetSensorId());
      //DayaBay::Detector detector( pmtId.site(), pmtId.detectorId() );
      
      fakegain.m_pmtId = pmtId;
      fakegain.m_speHigh = row->GetSpeHigh();
      fakegain.m_speHighError = row->GetSpeHighError();
      fakegain.m_sigmaSpeHigh = row->GetSigmaSpeHigh();
      fakegain.m_speHighFitQual = row->GetSpeHighFitQual();//atof(thisResult.GetSeqNoList().c_str());
      
      m_calibFakeGainData[pmtId] = fakegain;
    }
    // --> saving result
    m_fakeGainCalibDataKeys[mysm]=thisResult;
    m_fakeGainCalibDataMap[mysm]=m_calibFakeGainData;

  }

  return 1;
}
int DybPmtCalibSvc::readCalibFineGainTable ( const ServiceMode serviceMode) [inline, virtual]

Definition at line 344 of file DybPmtCalibSvc.cc.

                                                                               {

  //If service mode is the same as the last query then don't even bother
  //(this happens very often, i.e. whenever looping over PMTs in the same readout)
  if(serviceMode.context() == fineGainLastSM.context() && serviceMode.task() == fineGainLastSM.task()){      
    return 3;    
  }
  fineGainLastSM = serviceMode;     

  //Check if result is already stored in cache; if not, then create it
  ServiceMode mysm = CopyWithBOT(serviceMode);
  DbiResultPtr<GCalibPmtFineGain> pr("CalibPmtFineGain",serviceMode.context(),serviceMode.context().GetDetId(),serviceMode.task());
  DbiResultKey thisResult = *(pr.GetKey()); 
  if(m_fineGainCalibDataKeys.find(mysm)!=m_fineGainCalibDataKeys.end() && thisResult.IsEqualTo(&m_fineGainCalibDataKeys[mysm])){
    return 2;//<-- nothing to be done; result in cache is the same
  } else {
    
    //Proceed to read the DB table 
    MsgStream log(msgSvc());
    // --> results will be stored in this map
    std::map<DayaBay::FeeChannelId, DayaBay::FineGainCalibData > m_calibFineGainData;
    // --> Check number of entries in result set
    unsigned int numRows = pr.GetNumRows();
    if(numRows!=0) log << MSG::INFO << "Database rows = " << numRows << endreq;
    if(numRows<=0) {
      //log << MSG::WARNING << "Found no entries in CalibPmtFineGain for task " << serviceMode.task() << " and context " << serviceMode.context().AsString() << endreq;
      return 0;
    }
    const GCalibPmtFineGain* row ;
    // --> Read table
    for (unsigned int idx=0; idx < numRows; idx++) {

      row = pr.GetRowByIndex(idx);  
      DayaBay::FineGainCalibData finegain;  
      DayaBay::FeeChannelId channelId(row->GetChannelId());
      //DayaBay::Detector detector( pmtId.site(), pmtId.detectorId() );
      
      finegain.m_channelId = channelId;
      finegain.m_speHigh = row->GetSpeHigh();
      finegain.m_speHighError = row->GetSpeHighError();
      finegain.m_sigmaSpeHigh = row->GetSigmaSpeHigh();
      finegain.m_speHighFitQual = row->GetSpeHighFitQual();//atof(thisResult.GetSeqNoList().c_str());
      
      m_calibFineGainData[channelId] = finegain;
    }
    // --> saving result
    m_fineGainCalibDataKeys[mysm]=thisResult;
    m_fineGainCalibDataMap[mysm]=m_calibFineGainData;

  }

  return 1;
}
int DybPmtCalibSvc::readCalibPedBiasTable ( const ServiceMode serviceMode) [inline, virtual]

Definition at line 399 of file DybPmtCalibSvc.cc.

                                                                              {

  //If service mode is the same as the last query then don't even bother
  //(this happens very often, i.e. whenever looping over PMTs in the same readout)
  if(serviceMode.context() == pedBiasLastSM.context() && serviceMode.task() == pedBiasLastSM.task()){      
    return 3;    
  }
  pedBiasLastSM = serviceMode;     

  //Check if result is already stored in cache; if not, then create it
  ServiceMode mysm = CopyWithBOT(serviceMode);
  DbiResultPtr<GCalibPmtPedBias> pr("CalibPmtPedBias",serviceMode.context(),serviceMode.context().GetDetId(),serviceMode.task());
  DbiResultKey thisResult = *(pr.GetKey()); 
  if(m_pedBiasCalibDataKeys.find(mysm)!=m_pedBiasCalibDataKeys.end() && thisResult.IsEqualTo(&m_pedBiasCalibDataKeys[mysm])){
    return 2;//<-- nothing to be done; result in cache is the same
  } else {
    
    //Proceed to read the DB table 
    MsgStream log(msgSvc());
    // --> results will be stored in this map
    std::map<DayaBay::DetectorSensor, DayaBay::PedBiasCalibData > m_calibPedBiasData;
    // --> Check number of entries in result set
    unsigned int numRows = pr.GetNumRows();
    if(numRows!=0) log << MSG::INFO << "Database rows = " << numRows << endreq;
    if(numRows<=0) {
      //log << MSG::WARNING << "Found no entries in CalibPmtPedBias for task " << serviceMode.task() << " and context " << serviceMode.context().AsString() << endreq;
      return 0;
    }
    const GCalibPmtPedBias* row ;
    // --> Read table
    for (unsigned int idx=0; idx < numRows; idx++) {

      row = pr.GetRowByIndex(idx);  
      DayaBay::PedBiasCalibData pedbias;  
      DayaBay::DetectorSensor pmtId(row->GetSensorId());
      
      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_calibPedBiasData[pmtId] = pedbias;
    }
    // --> saving result
    m_pedBiasCalibDataKeys[mysm]=thisResult;
    m_pedBiasCalibDataMap[mysm]=m_calibPedBiasData;

  }

  return 1;
}
int DybPmtCalibSvc::readCalibTimingTable ( const ServiceMode serviceMode) [inline, virtual]

Definition at line 470 of file DybPmtCalibSvc.cc.

                                                                             {

  //If service mode is the same as the last query then don't even bother
  //(this happens very often, i.e. whenever looping over PMTs in the same readout)
  if(serviceMode.context() == timingLastSM.context() && serviceMode.task() == timingLastSM.task()){      
    return 3;    
  }
  timingLastSM = serviceMode;     

  //Check if result is already stored in cache; if not, then create it
  ServiceMode mysm = CopyWithBOT(serviceMode);
  DbiResultPtr<GCalibPmtTiming> pr("CalibPmtTiming",serviceMode.context(),serviceMode.context().GetDetId(),serviceMode.task());
  DbiResultKey thisResult = *(pr.GetKey()); 
  if(m_timingCalibDataKeys.find(mysm)!=m_timingCalibDataKeys.end() && thisResult.IsEqualTo(&m_timingCalibDataKeys[mysm])){
    return 2;//<-- nothing to be done; result in cache is the same
  } else {
    
    //Proceed to read the DB table 
    MsgStream log(msgSvc());
    // --> results will be stored in this map
    std::map<DayaBay::FeeChannelId, DayaBay::TimingCalibData > m_calibTimingData;
    // --> Check number of entries in result set
    unsigned int numRows = pr.GetNumRows();
    if(numRows!=0) log << MSG::INFO << "Database rows = " << numRows << endreq;
    if(numRows<=0) {
      //log << MSG::WARNING << "Found no entries in CalibPmtTiming for task " << serviceMode.task() << " and context " << serviceMode.context().AsString() << endreq;
      return 0;
    }
    const GCalibPmtTiming* row ;
    // --> Read table
    for (unsigned int idx=0; idx < numRows; idx++) {

      row = pr.GetRowByIndex(idx);  
      DayaBay::TimingCalibData timing;  
      DayaBay::FeeChannelId channelId(row->GetChannelId());
      
      timing.m_channelId = channelId;
      timing.m_status = DayaBay::TimingCalibData::Status_t(row->GetStatus());
      timing.m_par0 = row->GetPar0();
      timing.m_par1 = row->GetPar1();
      timing.m_par2 = row->GetPar2();
      timing.m_par3 = row->GetPar3();
      timing.m_par4 = row->GetPar4();
      timing.m_par5 = row->GetPar5();
      timing.m_fitqual = row->GetFitQual();
      
      m_calibTimingData[channelId] = timing;
    }
    // --> saving result
    m_timingCalibDataKeys[mysm]=thisResult;
    m_timingCalibDataMap[mysm]=m_calibTimingData;

  }

  return 1;
}
int DybPmtCalibSvc::readCalibGainConvTable ( const ServiceMode serviceMode) [inline, virtual]

Definition at line 527 of file DybPmtCalibSvc.cc.

                                                                               {

  //If service mode is the same as the last query then don't even bother
  //(this happens very often, i.e. whenever looping over PMTs in the same readout)
  if(serviceMode.context() == gainConvLastSM.context() && serviceMode.task() == gainConvLastSM.task()){      
    return 3;    
  }
  gainConvLastSM = serviceMode;     

  //Check if result is already stored in cache; if not, then create it
  ServiceMode mysm = CopyWithBOT(serviceMode);
  DbiResultPtr<GCalibFeeGainConv> pr("CalibFeeGainConv",serviceMode.context(),serviceMode.context().GetDetId(),serviceMode.task());
  DbiResultKey thisResult = *(pr.GetKey()); 
  if(m_gainConvCalibDataKeys.find(mysm)!=m_gainConvCalibDataKeys.end() && thisResult.IsEqualTo(&m_gainConvCalibDataKeys[mysm])){
    return 2;//<-- nothing to be done; result in cache is the same
  } else {
    
    //Proceed to read the DB table 
    MsgStream log(msgSvc());
    // --> results will be stored in this map
    std::map<DayaBay::FeeChannelId, DayaBay::GainConvCalibData > m_calibGainConvData;
    // --> Check number of entries in result set
    unsigned int numRows = pr.GetNumRows();
    if(numRows!=0) log << MSG::INFO << "Database rows = " << numRows << endreq;
    if(numRows<=0) {
      //log << MSG::WARNING << "Found no entries in CalibFeeGainConv for task " << serviceMode.task() << " and context " << serviceMode.context().AsString() << endreq;
      return 0;
    }
    const GCalibFeeGainConv* row ;
    // --> Read table
    for (unsigned int idx=0; idx < numRows; idx++) {

      row = pr.GetRowByIndex(idx);  

      DayaBay::GainConvCalibData gcpars;  
      DayaBay::FeeChannelId channelId(row->GetChannelId());
   
      gcpars.m_channelId = channelId;
      gcpars.m_fineCoarseRatio = row->GetFineCoarseRatio();
      gcpars.m_fineCoarseRatioErr = row->GetFineCoarseRatioErr();
      gcpars.m_frline.slope = row->GetFRLineSlope();
      gcpars.m_frline.uncert = row->GetFRLineErr();
      gcpars.m_crline.slope = row->GetCRLineSlope();
      gcpars.m_crline.uncert = row->GetCRLineErr();
      
      m_calibGainConvData[channelId] = gcpars;
    }
    // --> saving result
    m_gainConvCalibDataKeys[mysm]=thisResult;
    m_gainConvCalibDataMap[mysm]=m_calibGainConvData;

  }

  return 1;
}
const DayaBay::PmtCalibData * DybPmtCalibSvc::pmtCalibData ( const DayaBay::DetectorSensor pmtId,
const ServiceMode svcMode 
) [virtual]

Implements IPmtCalibSvc.

Definition at line 54 of file DybPmtCalibSvc.cc.

                                                               {

  int outcome=readCalibPmtTable(svcMode);  
  ServiceMode mysm = CopyWithBOT(svcMode);
  std::map<ServiceMode, std::map<DayaBay::DetectorSensor, DayaBay::PmtCalibData> >::iterator result = m_pmtCalibDataMap.find(mysm);
  if(result != m_pmtCalibDataMap.end() && outcome!=0){
    std::map<DayaBay::DetectorSensor, DayaBay::PmtCalibData> ::iterator result2 = (result->second).find(pmtId); 
    if(result2 != (result->second).end()){
      return &(result2->second);
    }
  }
  return 0;
}
const DayaBay::PedBiasCalibData * DybPmtCalibSvc::pedBiasCalibData ( const DayaBay::DetectorSensor pmtId,
const ServiceMode svcMode 
) [virtual]

Implements IPmtCalibSvc.

Definition at line 123 of file DybPmtCalibSvc.cc.

                                                                  {


  int outcome=readCalibPedBiasTable(svcMode);  
  ServiceMode mysm = CopyWithBOT(svcMode);
  std::map<ServiceMode, std::map<DayaBay::DetectorSensor, DayaBay::PedBiasCalibData> >::iterator result = m_pedBiasCalibDataMap.find(mysm);
  if(result != m_pedBiasCalibDataMap.end() && outcome!=0){
    std::map<DayaBay::DetectorSensor, DayaBay::PedBiasCalibData> ::iterator result2 = (result->second).find(pmtId); 
    if(result2 != (result->second).end()){
      return &(result2->second);
    }
  }
  return 0;

}
const DayaBay::HighGainCalibData * DybPmtCalibSvc::highGainCalibData ( const DayaBay::DetectorSensor pmtId,
const ServiceMode svcMode 
) [virtual]

Implements IPmtCalibSvc.

Definition at line 71 of file DybPmtCalibSvc.cc.

                                                               {

  int outcome=readCalibHighGainTable(svcMode);  
  ServiceMode mysm = CopyWithBOT(svcMode);
  std::map<ServiceMode, std::map<DayaBay::DetectorSensor, DayaBay::HighGainCalibData> >::iterator result = m_highGainCalibDataMap.find(mysm);
  if(result != m_highGainCalibDataMap.end() && outcome!=0){
    std::map<DayaBay::DetectorSensor, DayaBay::HighGainCalibData> ::iterator result2 = (result->second).find(pmtId); 
    if(result2 != (result->second).end()){
      return &(result2->second);
    }
  }
  return 0;
}
const DayaBay::HighGainCalibData * DybPmtCalibSvc::fakeGainCalibData ( const DayaBay::DetectorSensor pmtId,
const ServiceMode svcMode 
) [virtual]

Implements IPmtCalibSvc.

Definition at line 88 of file DybPmtCalibSvc.cc.

                                                               {

  int outcome=readCalibFakeGainTable(svcMode);  
  ServiceMode mysm = CopyWithBOT(svcMode);
  std::map<ServiceMode, std::map<DayaBay::DetectorSensor, DayaBay::HighGainCalibData> >::iterator result = m_fakeGainCalibDataMap.find(mysm);
  if(result != m_fakeGainCalibDataMap.end() && outcome!=0){
    std::map<DayaBay::DetectorSensor, DayaBay::HighGainCalibData> ::iterator result2 = (result->second).find(pmtId); 
    if(result2 != (result->second).end()){
      return &(result2->second);
    }
  }
  return 0;
}
const DayaBay::FineGainCalibData * DybPmtCalibSvc::fineGainCalibData ( const DayaBay::FeeChannelId channelId,
const ServiceMode svcMode 
) [virtual]

Implements IPmtCalibSvc.

Definition at line 105 of file DybPmtCalibSvc.cc.

                                                               {

  int outcome=readCalibFineGainTable(svcMode);  
  ServiceMode mysm = CopyWithBOT(svcMode);
  std::map<ServiceMode, std::map<DayaBay::FeeChannelId, DayaBay::FineGainCalibData> >::iterator result = m_fineGainCalibDataMap.find(mysm);
  if(result != m_fineGainCalibDataMap.end() && outcome!=0){
    std::map<DayaBay::FeeChannelId, DayaBay::FineGainCalibData> ::iterator result2 = (result->second).find(channelId); 
    if(result2 != (result->second).end()){
      return &(result2->second);
    }
  }
  return 0;
}
const DayaBay::TimingCalibData * DybPmtCalibSvc::timingCalibData ( const DayaBay::FeeChannelId channelId,
const ServiceMode svcMode 
) [virtual]

Implements IPmtCalibSvc.

Definition at line 142 of file DybPmtCalibSvc.cc.

                                                                           {
 
  int outcome=readCalibTimingTable(svcMode);  
  ServiceMode mysm = CopyWithBOT(svcMode);
  std::map<ServiceMode, std::map<DayaBay::FeeChannelId, DayaBay::TimingCalibData> >::iterator result = m_timingCalibDataMap.find(mysm);
  if(result != m_timingCalibDataMap.end() && outcome!=0){
    std::map<DayaBay::FeeChannelId, DayaBay::TimingCalibData> ::iterator result2 = (result->second).find(channelId); 
    if(result2 != (result->second).end()){
      return &(result2->second);
    }
  }
  return 0;

}
const DayaBay::GainConvCalibData * DybPmtCalibSvc::gainConvCalibData ( const DayaBay::FeeChannelId channelId,
const ServiceMode svcMode 
) [virtual]

Implements IPmtCalibSvc.

Definition at line 160 of file DybPmtCalibSvc.cc.

                                                                  {

  int outcome=readCalibGainConvTable(svcMode);  
  ServiceMode mysm = CopyWithBOT(svcMode);
  std::map<ServiceMode, std::map<DayaBay::FeeChannelId, DayaBay::GainConvCalibData> >::iterator result = m_gainConvCalibDataMap.find(mysm);
  if(result != m_gainConvCalibDataMap.end() && outcome!=0){
    std::map<DayaBay::FeeChannelId, DayaBay::GainConvCalibData> ::iterator result2 = (result->second).find(channelId); 
    if(result2 != (result->second).end()){
      return &(result2->second);
    }
  }
  return 0;
}
ServiceMode DybPmtCalibSvc::CopyWithBOT ( const ServiceMode svcMode) [private]

Definition at line 586 of file DybPmtCalibSvc.cc.

                                                                 {
  
  Context ctx = svcMode.context();
  ctx.SetTimeStamp(TimeStamp::GetBOT());
  ServiceMode mysm(ctx,svcMode.task());
  return mysm;
  
}

Member Data Documentation

Definition at line 47 of file DybPmtCalibSvc.h.

Definition at line 48 of file DybPmtCalibSvc.h.

Definition at line 50 of file DybPmtCalibSvc.h.

Definition at line 51 of file DybPmtCalibSvc.h.

Definition at line 53 of file DybPmtCalibSvc.h.

Definition at line 54 of file DybPmtCalibSvc.h.

Definition at line 56 of file DybPmtCalibSvc.h.

Definition at line 57 of file DybPmtCalibSvc.h.

Definition at line 59 of file DybPmtCalibSvc.h.

Definition at line 60 of file DybPmtCalibSvc.h.

Definition at line 63 of file DybPmtCalibSvc.h.

Definition at line 64 of file DybPmtCalibSvc.h.

Definition at line 66 of file DybPmtCalibSvc.h.

Definition at line 67 of file DybPmtCalibSvc.h.

Definition at line 104 of file DybPmtCalibSvc.h.

Definition at line 105 of file DybPmtCalibSvc.h.

Definition at line 106 of file DybPmtCalibSvc.h.

Definition at line 107 of file DybPmtCalibSvc.h.

Definition at line 108 of file DybPmtCalibSvc.h.

Definition at line 109 of file DybPmtCalibSvc.h.

Definition at line 110 of file DybPmtCalibSvc.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 10:00:00 for DybMetaDataSvc by doxygen 1.7.4