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

#include <StaticCalibDataSvc.h>

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

List of all members.

Public Member Functions

 StaticCalibDataSvc (const std::string &name, ISvcLocator *svc)
 ~StaticCalibDataSvc ()
virtual StatusCode initialize ()
virtual StatusCode finalize ()
virtual StatusCode queryInterface (const InterfaceID &riid, void **ppvInterface)
const DayaBay::PmtCalibDatapmtCalibData (const DayaBay::DetectorSensor &pmtId, const ServiceMode &svcMode)
 For every query request, firstly check whether user supplied any file.
const DayaBay::PedBiasCalibDatapedBiasCalibData (const DayaBay::DetectorSensor &pmtId, const ServiceMode &svcMode)
const DayaBay::HighGainCalibDatahighGainCalibData (const DayaBay::DetectorSensor &pmtId, const ServiceMode &svcMode)
const DayaBay::TimingCalibDatatimingCalibData (const DayaBay::DetectorSensor &pmtId, const ServiceMode &svcMode)
const DayaBay::GainConvCalibDatagainConvCalibData (const DayaBay::FeeChannelId &channelId, 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::TimingCalibData > & 
timingCalibList (const DayaBay::Detector &detectorId, const ServiceMode &svcMode)
const std::vector
< DayaBay::GainConvCalibData > & 
gainConvCalibList (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 Types

typedef std::map
< DayaBay::Detector,
std::vector
< DayaBay::PmtCalibData > > 
PmtData
typedef std::map
< DayaBay::Detector,
std::vector
< DayaBay::RpcCalibData > > 
RpcData
typedef std::map
< DayaBay::Detector,
std::vector
< DayaBay::FeeCalibData > > 
FeeData
typedef std::map
< DayaBay::Detector,
std::vector
< DayaBay::FecCalibData > > 
FecData
typedef std::map
< DayaBay::DetectorSensor,
DayaBay::PmtCalibData
PmtDataBySensor
typedef std::map
< DayaBay::RpcSensor,
DayaBay::RpcCalibData
RpcDataBySensor
typedef std::map
< DayaBay::FeeChannelId,
DayaBay::FeeCalibData
FeeDataByChannel
typedef std::map
< DayaBay::FecChannelId,
DayaBay::FecCalibData
FecDataByChannel
typedef std::map< ContextRange,
PmtData
PmtDataMap
typedef std::map< ContextRange,
RpcData
RpcDataMap
typedef std::map< ContextRange,
FeeData
FeeDataMap
typedef std::map< ContextRange,
FecData
FecDataMap
typedef std::map< ContextRange,
PmtDataBySensor
PmtDataBySensorMap
typedef std::map< ContextRange,
RpcDataBySensor
RpcDataBySensorMap
typedef std::map< ContextRange,
FeeDataByChannel
FeeDataByChannelMap
typedef std::map< ContextRange,
FecDataByChannel
FecDataByChannelMap
typedef std::map< ContextRange,
std::string > 
FileNameList

Private Member Functions

StatusCode readMasterFile (std::string masterFileName, FileNameList &subFileNameList)
StatusCode readPmtDataFile (std::string pmtDataFileName, PmtData &pmtData, PmtDataBySensor &pmtDataBySensor)
StatusCode readFeeDataFile (std::string feeDataFileName, FeeData &feeData, FeeDataByChannel &feeDataByChannel)

Private Attributes

PmtDataMap m_pmtDataMap
RpcDataMap m_rpcDataMap
FeeDataMap m_feeDataMap
FecDataMap m_fecDataMap
PmtDataBySensorMap m_pmtDataBySensorMap
RpcDataBySensorMap m_rpcDataBySensorMap
FeeDataByChannelMap m_feeDataByChannelMap
FecDataByChannelMap m_fecDataByChannelMap
ContextRange m_currentPmtContextRange
ContextRange m_currentRpcContextRange
ContextRange m_currentFeeContextRange
ContextRange m_currentFecContextRange
PmtDatam_currentPmtData
RpcDatam_currentRpcData
FeeDatam_currentFeeData
FecDatam_currentFecData
PmtDataBySensorm_currentPmtDataBySensor
RpcDataBySensorm_currentRpcDataBySensor
FeeDataByChannelm_currentFeeDataByChannel
FecDataByChannelm_currentFecDataByChannel
std::string m_masterPmtDataFileName
 User specified file. If not present, load the default ones from Master.CalibMap.txt.
std::string m_masterFeeDataFileName
std::string m_pmtDataFileName
 User specified file. If not present, load the default ones from Master.CalibMap.txt.
std::string m_rpcDataFileName
std::string m_feeDataFileName
std::string m_fecDataFileName
PmtData m_pmtDataUser
RpcData m_rpcDataUser
FeeData m_feeDataUser
FecData m_fecDataUser
PmtDataBySensor m_pmtDataBySensorUser
RpcDataBySensor m_rpcDataBySensorUser
FeeDataByChannel m_feeDataByChannelUser
FecDataByChannel m_fecDataByChannelUser

Detailed Description

Definition at line 29 of file StaticCalibDataSvc.h.


Member Typedef Documentation

typedef std::map<DayaBay::Detector, std::vector<DayaBay::PmtCalibData> > StaticCalibDataSvc::PmtData [private]

Definition at line 132 of file StaticCalibDataSvc.h.

typedef std::map<DayaBay::Detector, std::vector<DayaBay::RpcCalibData> > StaticCalibDataSvc::RpcData [private]

Definition at line 133 of file StaticCalibDataSvc.h.

typedef std::map<DayaBay::Detector, std::vector<DayaBay::FeeCalibData> > StaticCalibDataSvc::FeeData [private]

Definition at line 134 of file StaticCalibDataSvc.h.

typedef std::map<DayaBay::Detector, std::vector<DayaBay::FecCalibData> > StaticCalibDataSvc::FecData [private]

Definition at line 135 of file StaticCalibDataSvc.h.

Definition at line 138 of file StaticCalibDataSvc.h.

Definition at line 139 of file StaticCalibDataSvc.h.

Definition at line 142 of file StaticCalibDataSvc.h.

Definition at line 143 of file StaticCalibDataSvc.h.

typedef std::map< ContextRange, PmtData > StaticCalibDataSvc::PmtDataMap [private]

Definition at line 147 of file StaticCalibDataSvc.h.

typedef std::map< ContextRange, RpcData > StaticCalibDataSvc::RpcDataMap [private]

Definition at line 148 of file StaticCalibDataSvc.h.

typedef std::map< ContextRange, FeeData > StaticCalibDataSvc::FeeDataMap [private]

Definition at line 149 of file StaticCalibDataSvc.h.

typedef std::map< ContextRange, FecData > StaticCalibDataSvc::FecDataMap [private]

Definition at line 150 of file StaticCalibDataSvc.h.

Definition at line 152 of file StaticCalibDataSvc.h.

Definition at line 153 of file StaticCalibDataSvc.h.

Definition at line 155 of file StaticCalibDataSvc.h.

Definition at line 156 of file StaticCalibDataSvc.h.

typedef std::map< ContextRange, std::string > StaticCalibDataSvc::FileNameList [private]

Definition at line 206 of file StaticCalibDataSvc.h.


Constructor & Destructor Documentation

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

Definition at line 12 of file StaticCalibDataSvc.cc.

    : Service(name,svc)
{
  // User specified file. If not present, load the default ones from Master.CalibMap.txt
  declareProperty("PmtDataFile",m_pmtDataFileName="",
                  "Filename for loading pmt simulation input data");
  declareProperty("RpcDataFile",m_rpcDataFileName="",
                  "Filename for loading rpc simulation input data");
  declareProperty("FeeDataFile",m_feeDataFileName="",
                  "Filename for loading FEE simulation input data");
  declareProperty("FecDataFile",m_fecDataFileName="",
                  "Filename for loading FEC simulation input data");

  m_masterPmtDataFileName = "Master.pmtCalibMap.txt";
  m_masterFeeDataFileName = "Master.feeCalibMap.txt";

  m_pmtDataMap.clear();
  m_rpcDataMap.clear();
  m_feeDataMap.clear();
  m_fecDataMap.clear();

  m_pmtDataBySensorMap.clear();
  m_rpcDataBySensorMap.clear();

  m_feeDataByChannelMap.clear();
  m_fecDataByChannelMap.clear();
}
StaticCalibDataSvc::~StaticCalibDataSvc ( )

Definition at line 40 of file StaticCalibDataSvc.cc.

{
}

Member Function Documentation

StatusCode StaticCalibDataSvc::initialize ( ) [virtual]

Read user specified files

read Master.pmtCalibMap.txt

read Master.pmtCalibMap.txt

to do: read rpc

read fec

Definition at line 44 of file StaticCalibDataSvc.cc.

{
  this->Service::initialize();
  
  IMessageSvc* msg = msgSvc();
  if( !msg ){    
    return StatusCode::FAILURE;
  }
  MsgStream log(msg,"StaticCalibDataSvc");

  log << MSG::INFO << "User specified PmtDataFile is [" << m_pmtDataFileName <<"]"<< endreq;
  //  ---------------  Here is a separator  -------------------------------
  if(m_pmtDataFileName!="")  {
    log << MSG::INFO << "Loading PmtDataFile: " <<  m_pmtDataFileName << endreq;
    readPmtDataFile( m_pmtDataFileName,
                     m_pmtDataUser,
                     m_pmtDataBySensorUser );
  }

  if(m_feeDataFileName!=""){
    msg->reportMessage( "StaticCalibDataSvc", MSG::INFO, ("Loading " + m_feeDataFileName).c_str() );
    readFeeDataFile( m_feeDataFileName,
                     m_feeDataUser,
                     m_feeDataByChannelUser );
  }

  if(m_rpcDataFileName!=""){
    // FIXME: Add RPC data file
    std::ostringstream msgStr;
    msgStr << "RPC calibration data file not yet implemented!";
    msg->reportMessage("StaticCalibDataSvc",MSG::ERROR,msgStr.str());
    return StatusCode::FAILURE;
  }

  if(m_fecDataFileName!=""){
    // FIXME: Add FEC data file
    std::ostringstream msgStr;
    msgStr << "FEC calibration data file not yet implemented!";
    msg->reportMessage("StaticCalibDataSvc",MSG::ERROR,msgStr.str());
    return StatusCode::FAILURE;
  }

  //  ---------------  Here is a separator  -------------------------------
  FileNameList::iterator it, itend;

  msg->reportMessage( "StaticCalibDataSvc", MSG::INFO, ("Loading " + m_masterPmtDataFileName).c_str() );
  FileNameList PmtDataFileList;
  readMasterFile( m_masterPmtDataFileName, PmtDataFileList );

  itend = PmtDataFileList.end();
  for( it=PmtDataFileList.begin(); it!=itend; it++ ) {
    PmtData aPmtData;
    PmtDataBySensor aPmtDataBySensor;
    readPmtDataFile( it->second,                    // file name
                     aPmtData,
                     aPmtDataBySensor );
    
    m_pmtDataMap[ it->first ] = aPmtData;
    m_pmtDataBySensorMap[ it->first ] = aPmtDataBySensor;
  }
  
  // use the first one to start
  m_currentPmtContextRange  = PmtDataFileList.begin()->first;
  m_currentPmtData          = &(m_pmtDataMap.begin()->second);
  m_currentPmtDataBySensor  = &(m_pmtDataBySensorMap.begin()->second);

  msg->reportMessage( "StaticCalibDataSvc", MSG::INFO, ("Loading " + m_masterFeeDataFileName).c_str() );
  FileNameList FeeDataFileList;
  readMasterFile( m_masterFeeDataFileName, FeeDataFileList );

  itend = FeeDataFileList.end();
  for( it=FeeDataFileList.begin(); it!=itend; it++ ) {
    FeeData aFeeData;
    FeeDataByChannel aFeeDataByChannel;
    readFeeDataFile( it->second,                    // file name
                     aFeeData,
                     aFeeDataByChannel );

    m_feeDataMap[ it->first ] = aFeeData;
    m_feeDataByChannelMap[ it->first ] = aFeeDataByChannel;
  }
  
  // use the first one to start
  m_currentFeeContextRange  = FeeDataFileList.begin()->first;
  m_currentFeeData          = &(m_feeDataMap.begin()->second);
  m_currentFeeDataByChannel = &(m_feeDataByChannelMap.begin()->second);


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

Definition at line 142 of file StaticCalibDataSvc.cc.

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

Definition at line 147 of file StaticCalibDataSvc.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 * StaticCalibDataSvc::pmtCalibData ( const DayaBay::DetectorSensor pmtId,
const ServiceMode svcMode 
) [virtual]

For every query request, firstly check whether user supplied any file.

If they do, then use the user specified one. If not, check whether it can be found in Master map list. Secondly, compare the requested data's context with current context range, If compatible, then return. If not, find the right one with ContextRange indexed map until the end.

Search though whole map. The slowest process only happen a few times;

update m_currentPmtData simultaneously

error

error

Implements ICalibDataSvc.

Definition at line 174 of file StaticCalibDataSvc.cc.

{
  /*
  cout<<svcMode.context()<<endl;
  cout<<m_currentPmtContextRange.GetTimeStart().AsString()<<endl;
  cout<<m_currentPmtContextRange.GetTimeEnd().AsString()<<endl;
  */
  PmtDataBySensor* pPmtDataBySensor = 0;

  if (m_pmtDataFileName.size() != 0)  {
    pPmtDataBySensor = &m_pmtDataBySensorUser;
  } else {
    const Context &cont = svcMode.context();
    if ( m_currentPmtContextRange.IsCompatible( cont ) )  {
      pPmtDataBySensor = m_currentPmtDataBySensor;
    } else {
      PmtDataBySensorMap::iterator it, itend=m_pmtDataBySensorMap.end();
      for( it = m_pmtDataBySensorMap.begin(); it!=itend; it++ )  {
        if( it->first.IsCompatible( cont ) )  {
          m_currentPmtContextRange = it->first;
          m_currentPmtDataBySensor = &(it->second);
          pPmtDataBySensor = m_currentPmtDataBySensor;
          m_currentPmtData = &(m_pmtDataMap[m_currentPmtContextRange]);
          break;
        }
      }
    }
  }
  
  if( pPmtDataBySensor!=0 )  {
    std::map<DayaBay::DetectorSensor, DayaBay::PmtCalibData>::iterator result =
      pPmtDataBySensor->find(pmtId);
    if(result != pPmtDataBySensor->end()){
      return &(result->second);
    }
    return 0;
  }

  return 0;
}
const DayaBay::PedBiasCalibData * StaticCalibDataSvc::pedBiasCalibData ( const DayaBay::DetectorSensor pmtId,
const ServiceMode svcMode 
) [virtual]

Implements ICalibDataSvc.

Definition at line 222 of file StaticCalibDataSvc.cc.

{

  //error
  //Not implemented for StaticCalibDataSvc (jpochoa)
  return 0;

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

Implements ICalibDataSvc.

Definition at line 233 of file StaticCalibDataSvc.cc.

{

  //error
  //Not implemented for StaticCalibDataSvc (jpochoa)
  return 0;

}
const DayaBay::TimingCalibData * StaticCalibDataSvc::timingCalibData ( const DayaBay::DetectorSensor pmtId,
const ServiceMode svcMode 
)

Definition at line 244 of file StaticCalibDataSvc.cc.

{

  //error
  //Not implemented for StaticCalibDataSvc (jpochoa)
  return 0;

}
const DayaBay::GainConvCalibData * StaticCalibDataSvc::gainConvCalibData ( const DayaBay::FeeChannelId channelId,
const ServiceMode svcMode 
)

Definition at line 255 of file StaticCalibDataSvc.cc.

{

  //error
  //Not implemented for StaticCalibDataSvc (jpochoa)
  return 0;

}
const DayaBay::RpcCalibData * StaticCalibDataSvc::rpcCalibData ( const DayaBay::RpcSensor rpcId,
const ServiceMode svcMode 
) [virtual]

Implements ICalibDataSvc.

Definition at line 267 of file StaticCalibDataSvc.cc.

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

Search though whole map. The slowest process only happen a few times;

update m_currentFeeData simultaneously

error

error

Implements ICalibDataSvc.

Definition at line 279 of file StaticCalibDataSvc.cc.

{
  FeeDataByChannel * pFeeDataByChannel = 0;
  
  if (m_feeDataFileName.size() != 0)  {
    pFeeDataByChannel = &m_feeDataByChannelUser;
  } else {
    const Context &cont = svcMode.context();
    if ( m_currentFeeContextRange.IsCompatible( cont ) )  {
      pFeeDataByChannel = m_currentFeeDataByChannel;
    } else {
      FeeDataByChannelMap::iterator it, itend=m_feeDataByChannelMap.end();
      for( it = m_feeDataByChannelMap.begin(); it!=itend; it++ )  {
        if( it->first.IsCompatible( cont ) )  {
          m_currentFeeContextRange = it->first;
          m_currentFeeDataByChannel = &(it->second);
          pFeeDataByChannel = m_currentFeeDataByChannel;
          m_currentFeeData = &(m_feeDataMap[m_currentFeeContextRange]);
          break;
        }
      }
    }
  }

  if( pFeeDataByChannel!=0 )  {
    std::map<DayaBay::FeeChannelId, DayaBay::FeeCalibData>::iterator result = 
      pFeeDataByChannel->find(channelId); 
    if(result != pFeeDataByChannel->end()){
      return &(result->second);
    }
    return 0;
  }
  
  return 0;
}
const DayaBay::FecCalibData * StaticCalibDataSvc::fecCalibData ( const DayaBay::FecChannelId channelId,
const ServiceMode svcMode 
) [virtual]

Implements ICalibDataSvc.

Definition at line 322 of file StaticCalibDataSvc.cc.

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

Implements ICalibDataSvc.

Definition at line 334 of file StaticCalibDataSvc.cc.

{
  //error
  //Not implemented for StaticCalibDataSvc (jpochoa)
  return 0;
  
}
const std::vector< DayaBay::PmtCalibData > & StaticCalibDataSvc::pmtCalibList ( const DayaBay::Detector detectorId,
const ServiceMode svcMode 
) [virtual]

Search though whole map. The slowest process only happen a few times;

update m_currentPmtDataBySensor simultaneously

error

Implements ICalibDataSvc.

Definition at line 343 of file StaticCalibDataSvc.cc.

{
  PmtData* pPmtData = 0;

  if (m_pmtDataFileName.size() != 0)  {
    pPmtData = &m_pmtDataUser;
  } else {
    const Context &cont = svcMode.context();
    if ( m_currentPmtContextRange.IsCompatible( cont ) )  {
      pPmtData = m_currentPmtData;
    } else {
      PmtDataMap::iterator it, itend=m_pmtDataMap.end();
      for( it = m_pmtDataMap.begin(); it!=itend; it++ )  {
        if( it->first.IsCompatible( cont ) )  {
          m_currentPmtContextRange = it->first;
          m_currentPmtData = &(it->second);
          pPmtData = m_currentPmtData;
          m_currentPmtDataBySensor = &(m_pmtDataBySensorMap[m_currentPmtContextRange]);
          break;
        }
      }
    }
  }

  if( pPmtData!=0 )  {
    return (*pPmtData)[detectorId];
  }
  
  cout<<"No available PmtCalibData found"<<endl;
  cout<<"No CalibData file specified, or wrong time range in Master.pmtCalibMap.txt, or no such data file at all"<<endl;
  abort();
}
const std::vector< DayaBay::PedBiasCalibData > & StaticCalibDataSvc::pedBiasCalibList ( const DayaBay::Detector detectorId,
const ServiceMode svcMode 
) [virtual]

Implements ICalibDataSvc.

Definition at line 382 of file StaticCalibDataSvc.cc.

{
  cout << "StaticCalibDataSvc::pedBiasCalibList not implemented" << endl;
  cout << "Use DbiCalibDataSvc instead" << endl;
  abort();

}
const std::vector< DayaBay::HighGainCalibData > & StaticCalibDataSvc::highGainCalibList ( const DayaBay::Detector detectorId,
const ServiceMode svcMode 
) [virtual]

Implements ICalibDataSvc.

Definition at line 392 of file StaticCalibDataSvc.cc.

{
  cout << "StaticCalibDataSvc::highGainCalibList not implemented" << endl;
  cout << "Use DbiCalibDataSvc instead" << endl;
  abort();

}
const std::vector< DayaBay::TimingCalibData > & StaticCalibDataSvc::timingCalibList ( const DayaBay::Detector detectorId,
const ServiceMode svcMode 
)

Definition at line 402 of file StaticCalibDataSvc.cc.

{
  cout << "StaticCalibDataSvc::timingCalibList not implemented" << endl;
  cout << "Use DbiCalibDataSvc instead" << endl;
  abort();

}
const std::vector< DayaBay::GainConvCalibData > & StaticCalibDataSvc::gainConvCalibList ( const DayaBay::Detector detectorId,
const ServiceMode svcMode 
)

Definition at line 421 of file StaticCalibDataSvc.cc.

{
  cout << "StaticCalibDataSvc::gainConvCalibList not implemented" << endl;
  cout << "Use DbiCalibDataSvc instead" << endl;
  abort();

}
const std::vector< DayaBay::RpcCalibData > & StaticCalibDataSvc::rpcCalibList ( const DayaBay::Detector detectorId,
const ServiceMode svcMode 
) [virtual]

Implements ICalibDataSvc.

Definition at line 431 of file StaticCalibDataSvc.cc.

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

Search though whole map. The slowest process only happen a few times;

update m_currentFeeDataByChannel simultaneously

error

Implements ICalibDataSvc.

Definition at line 438 of file StaticCalibDataSvc.cc.

{
  FeeData * pFeeData = 0;

  if (m_feeDataFileName.size() != 0)  {
    pFeeData = &m_feeDataUser;
  } else {
    const Context &cont = svcMode.context();
    if ( m_currentFeeContextRange.IsCompatible( cont ) )  {
      pFeeData = m_currentFeeData;
    } else {
      FeeDataMap::iterator it, itend=m_feeDataMap.end();
      for( it = m_feeDataMap.begin(); it!=itend; it++ )  {
        if( it->first.IsCompatible( cont ) )  {
          m_currentFeeContextRange = it->first;
          m_currentFeeData = &(it->second);
          pFeeData = m_currentFeeData;
          m_currentFeeDataByChannel = &(m_feeDataByChannelMap[m_currentFeeContextRange]);
          break;
        }
      }
    }
  }

  if( pFeeData!=0 )  {
    return (*pFeeData)[detectorId];
  }

  cout<<"No available FeeCalibData found"<<endl;
  cout<<"No CalibData file specified, or wrong time range in Master.feeCalibMap.txt, or no such data file at all"<<endl;
  abort();
}
const std::vector< DayaBay::FecCalibData > & StaticCalibDataSvc::fecCalibList ( const DayaBay::Detector detectorId,
const ServiceMode svcMode 
) [virtual]

Implements ICalibDataSvc.

Definition at line 477 of file StaticCalibDataSvc.cc.

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

Implements ICalibDataSvc.

Definition at line 412 of file StaticCalibDataSvc.cc.

{
  cout << "StaticCalibDataSvc::srcEnergyList not implemented" << endl;
  cout << "Use DbiCalibDataSvc instead" << endl;
  abort();

}
StatusCode StaticCalibDataSvc::readMasterFile ( std::string  masterFileName,
FileNameList subFileNameList 
) [private]

Definition at line 606 of file StaticCalibDataSvc.cc.

{
  IMessageSvc* msg = msgSvc();
  if( !msg ){
    return StatusCode::FAILURE;
  }
  MsgStream log(msg,"StaticCalibDataSvc");

  std::string Path = getenv ("DATASVCROOT");
  std::ifstream masterFileStream( (Path+"/share/"+masterFileName).c_str() );

  if( !masterFileStream.is_open() ){
    msg->reportMessage( "StaticCalibDataSvc", MSG::ERROR, ("Fail to open" + masterFileName).c_str() );
    return StatusCode::FAILURE;
  }

  int StartRun,EndRun;
  int Sites;
  int SimFlag, StartTimeSec, StartTimeNanoSec, EndTimeSec, EndTimeNanoSec;
  std::string MapFileName;

  std::string line;

  while( std::getline( masterFileStream, line ) ){
    std::stringstream streamLine(line);
    if( streamLine.peek() == '#' ){
      continue;
    }
    streamLine >>StartRun >>EndRun >>Sites
               >>SimFlag >>StartTimeSec>> StartTimeNanoSec >>EndTimeSec >>EndTimeNanoSec
               >>MapFileName;

    ContextRange CRange( Sites, SimFlag,
                         TimeStamp( StartTimeSec, StartTimeNanoSec ),
                         TimeStamp( EndTimeSec, EndTimeNanoSec ) );
    /*
    std::cout<<TimeStamp( StartTimeSec, StartTimeNanoSec ).AsString()<<std::endl;
    std::cout<<TimeStamp( EndTimeSec, EndTimeNanoSec ).AsString()<<std::endl;
    */
    MapFileName = Path + "/share/" + MapFileName;
    subFileNameList[ CRange ] = MapFileName ;
  }

  return StatusCode::SUCCESS;
}
StatusCode StaticCalibDataSvc::readPmtDataFile ( std::string  pmtDataFileName,
PmtData pmtData,
PmtDataBySensor pmtDataBySensor 
) [private]

Definition at line 486 of file StaticCalibDataSvc.cc.

{
  IMessageSvc* msg = msgSvc();
  if( !msg ){
    return StatusCode::FAILURE;
  }
  MsgStream log(msg,"StaticCalibDataSvc");

  std::ifstream input( pmtDataFileName.c_str() );
  std::ostringstream prtStr;
  prtStr<<"PmtCalibMap "<<pmtDataFileName;
  msg->reportMessage("StaticCalibDataSvc",MSG::DEBUG,prtStr.str());
  if( !input.is_open() ){
    std::ostringstream msgStr;
    msgStr << "Failed to open input file: " << pmtDataFileName;
    msg->reportMessage("StaticCalibDataSvc",MSG::ERROR,msgStr.str());
    return StatusCode::FAILURE;
  }
  int sensorId;
  std::string description;
  int status;
  double speHigh, sigmaSpeHigh, speLow, timeOffset, timeSpread, efficiency;
  double prePulseProb, afterPulseProb, darkRate;
  std::string line;
  while( std::getline(input,line) ){
    std::ostringstream msgStr;
    msgStr << "Got line: " << line;
    msg->reportMessage("StaticCalibDataSvc",MSG::VERBOSE,msgStr.str());
    msgStr.str("");
    std::stringstream streamLine(line);
    if( streamLine.peek() == '#' ){
      continue;
    }
    streamLine >> sensorId >> description
               >> status >> speHigh >> sigmaSpeHigh >> speLow
               >> timeOffset >> timeSpread >> efficiency >> prePulseProb
               >> afterPulseProb >> darkRate;
    msgStr << "Adding PMT: " << description;
    msg->reportMessage("StaticCalibDataSvc",MSG::VERBOSE,msgStr.str());

    DayaBay::DetectorSensor pmtId(sensorId);
    DayaBay::Detector detector( pmtId.site(), pmtId.detectorId() );
    DayaBay::PmtCalibData pmt;
    pmt.m_pmtId = pmtId;
    pmt.m_status = (DayaBay::PmtCalibData::Status_t)status;
    pmt.m_speHigh = speHigh;
    pmt.m_sigmaSpeHigh = sigmaSpeHigh;
    pmt.m_speLow = speLow;
    pmt.m_timeOffset = timeOffset * Units::ns;
    pmt.m_timeSpread = timeSpread * Units::ns;
    pmt.m_efficiency = efficiency;
    pmt.m_prePulseProb = prePulseProb;
    pmt.m_afterPulseProb = afterPulseProb;
    pmt.m_darkRate = darkRate * Units::hertz;
    std::vector<DayaBay::PmtCalibData>& pmtList = pmtData[detector];
    pmtList.push_back(pmt);
    // Add lookup by sensor ID                                                                                                           
    pmtDataBySensor[pmtId] = pmtList[pmtList.size()-1];
  }

  return StatusCode::SUCCESS;

}
StatusCode StaticCalibDataSvc::readFeeDataFile ( std::string  feeDataFileName,
FeeData feeData,
FeeDataByChannel feeDataByChannel 
) [private]

Definition at line 551 of file StaticCalibDataSvc.cc.

{
  IMessageSvc* msg = msgSvc();
  if( !msg ){
    return StatusCode::FAILURE;
  }
  MsgStream log(msg,"StaticCalibDataSvc");

  std::ifstream input( feeDataFileName.c_str() );
  if( !input.is_open() ){
    std::ostringstream msgStr;
    msgStr << "Failed to open input file: " << feeDataFileName;
    msg->reportMessage("StaticCalibDataSvc",MSG::ERROR,msgStr.str());
    return StatusCode::FAILURE;
  }
  int channelId;
  std::string description;
  int status;
  double adcThresholdHigh, adcThresholdLow, adcBaselineHigh, adcBaselineLow;
  std::string line;
  while( std::getline(input,line) ){
    std::ostringstream msgStr;
    msgStr << "Got line: " << line;
    msg->reportMessage("StaticCalibDataSvc",MSG::VERBOSE,msgStr.str());
    msgStr.str("");
    std::stringstream streamLine(line);
    if( streamLine.peek() == '#' ){
      continue;
    }
    streamLine >> channelId >> description
               >> status >> adcThresholdHigh >> adcThresholdLow
               >> adcBaselineHigh >> adcBaselineLow;
    msgStr << "Adding PMT: " << description;
    msg->reportMessage("StaticCalibDataSvc",MSG::VERBOSE,msgStr.str());

    DayaBay::FeeChannelId feeChannelId(channelId);
    DayaBay::Detector detector(feeChannelId.site(),feeChannelId.detectorId());
    DayaBay::FeeCalibData fee;
    fee.m_channelId = feeChannelId;
    fee.m_status = (DayaBay::FeeCalibData::Status_t)status;
    fee.m_adcThresholdHigh = adcThresholdHigh;
    fee.m_adcThresholdLow = adcThresholdLow;
    fee.m_adcBaselineHigh = adcBaselineHigh;
    fee.m_adcBaselineLow = adcBaselineLow;
    std::vector<DayaBay::FeeCalibData>& feeList = feeData[detector];
    feeList.push_back(fee);
    // Add lookup by channel ID                                                                                                          
    feeDataByChannel[feeChannelId] = feeList[feeList.size()-1];
  }

  return StatusCode::SUCCESS;

}
static const InterfaceID& ICalibDataSvc::interfaceID ( ) [inline, static, inherited]

Definition at line 242 of file ICalibDataSvc.h.

                                         {
    return IID_ICalibDataSvc;
  }

Member Data Documentation

Definition at line 160 of file StaticCalibDataSvc.h.

Definition at line 161 of file StaticCalibDataSvc.h.

Definition at line 162 of file StaticCalibDataSvc.h.

Definition at line 163 of file StaticCalibDataSvc.h.

Definition at line 165 of file StaticCalibDataSvc.h.

Definition at line 166 of file StaticCalibDataSvc.h.

Definition at line 168 of file StaticCalibDataSvc.h.

Definition at line 169 of file StaticCalibDataSvc.h.

Definition at line 173 of file StaticCalibDataSvc.h.

Definition at line 174 of file StaticCalibDataSvc.h.

Definition at line 175 of file StaticCalibDataSvc.h.

Definition at line 176 of file StaticCalibDataSvc.h.

Definition at line 180 of file StaticCalibDataSvc.h.

Definition at line 181 of file StaticCalibDataSvc.h.

Definition at line 182 of file StaticCalibDataSvc.h.

Definition at line 183 of file StaticCalibDataSvc.h.

Definition at line 186 of file StaticCalibDataSvc.h.

Definition at line 187 of file StaticCalibDataSvc.h.

Definition at line 190 of file StaticCalibDataSvc.h.

Definition at line 191 of file StaticCalibDataSvc.h.

User specified file. If not present, load the default ones from Master.CalibMap.txt.

Definition at line 197 of file StaticCalibDataSvc.h.

Definition at line 201 of file StaticCalibDataSvc.h.

User specified file. If not present, load the default ones from Master.CalibMap.txt.

Definition at line 213 of file StaticCalibDataSvc.h.

Definition at line 215 of file StaticCalibDataSvc.h.

Definition at line 217 of file StaticCalibDataSvc.h.

Definition at line 219 of file StaticCalibDataSvc.h.

Definition at line 223 of file StaticCalibDataSvc.h.

Definition at line 224 of file StaticCalibDataSvc.h.

Definition at line 225 of file StaticCalibDataSvc.h.

Definition at line 226 of file StaticCalibDataSvc.h.

Definition at line 229 of file StaticCalibDataSvc.h.

Definition at line 230 of file StaticCalibDataSvc.h.

Definition at line 233 of file StaticCalibDataSvc.h.

Definition at line 234 of file StaticCalibDataSvc.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:23 for DataSvc by doxygen 1.7.4