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

In This Package:

StaticCalibDataSvc.h
Go to the documentation of this file.
00001 /*
00002  *  StaticCalibDataSvc.h
00003  *
00004  *  Temporary Calibration Data service
00005  *
00006  *  Created by Dan Dwyer on 2009/02/04
00007  *
00008  *  Updated to be smarter to be able to pick the right calib file by itself.
00009  *  (PMT, FEE)
00010  *  For every query request, firstly check whether user supplied any file.
00011  *  If they do, then use the user specified one.
00012  *  If not, check whether it can be found in Master map list.
00013  *  Secondly, compare the requested data's context with current context range,
00014  *  If compatible, then return.
00015  *  If not, find the right one with ContextRange indexed map until the end.
00016  *
00017  *  2010/03/01  Zhe Wang
00018  *
00019  */
00020 
00021 #ifndef DATASVC_STATICCALIBDATASVC_H
00022 #define DATASVC_STATICCALIBDATASVC_H
00023 
00024 #include "DataSvc/ICalibDataSvc.h"
00025 #include "GaudiKernel/Service.h"
00026 #include "Context/ContextRange.h"
00027 #include <map>
00028 
00029 class StaticCalibDataSvc : public Service,
00030                            virtual public ICalibDataSvc
00031 {
00032  public:
00033   // Service interface implementation
00034   StaticCalibDataSvc(const std::string& name, ISvcLocator *svc);
00035   ~StaticCalibDataSvc();
00036   virtual StatusCode initialize();
00037   virtual StatusCode finalize();
00038   virtual StatusCode queryInterface(const InterfaceID& riid, 
00039                                     void** ppvInterface);
00040 
00041   // ICalibDataSvc interface implementation
00042   // Return the PMT Calibration data
00043   const DayaBay::PmtCalibData* pmtCalibData(
00044                                           const DayaBay::DetectorSensor& pmtId,
00045                                           const ServiceMode& svcMode);
00046 
00047   // Return the PMT Calibration data
00048   const DayaBay::PedBiasCalibData* pedBiasCalibData(
00049                                   const DayaBay::DetectorSensor& pmtId,
00050                                           const ServiceMode& svcMode);
00051 
00052   // Return the PMT (high-gain) Calibration data
00053   const DayaBay::HighGainCalibData* highGainCalibData(
00054                                   const DayaBay::DetectorSensor& pmtId,
00055                                           const ServiceMode& svcMode);
00056 
00057   // Return the PMT (timing) Calibration data
00058   const DayaBay::TimingCalibData* timingCalibData(
00059                                   const DayaBay::DetectorSensor& pmtId,
00060                                           const ServiceMode& svcMode);
00061 
00062   // Return the FEE gain conversion calibration data
00063   const DayaBay::GainConvCalibData* gainConvCalibData(
00064                                   const DayaBay::FeeChannelId& channelId,
00065                                           const ServiceMode& svcMode);
00066 
00067   // Return the RPC Calibration data
00068   const DayaBay::RpcCalibData* rpcCalibData(const DayaBay::RpcSensor& rpcId,
00069                                             const ServiceMode& svcMode);
00070 
00071   // Return the FEE Calibration data
00072   const DayaBay::FeeCalibData* feeCalibData(
00073                                          const DayaBay::FeeChannelId& channelId,
00074                                          const ServiceMode& svcMode);
00075 
00076   // Return the FEC Calibration data
00077   const DayaBay::FecCalibData* fecCalibData(
00078                                          const DayaBay::FecChannelId& channelId,
00079                                          const ServiceMode& svcMode);
00080 
00081   // Return calibration source peak data
00082   const DayaBay::SrcEnergyData* srcEnergyData(int type, const ServiceMode& svcMode);
00083 
00084 
00085   // Return the array of Calibration data by detector
00086   const std::vector<DayaBay::PmtCalibData>& pmtCalibList(
00087                                            const DayaBay::Detector& detectorId,
00088                                            const ServiceMode& svcMode);
00089 
00090   // Return the array of PedBias data by detector
00091   const std::vector<DayaBay::PedBiasCalibData>& pedBiasCalibList(
00092                                            const DayaBay::Detector& detectorId,
00093                                            const ServiceMode& svcMode);
00094 
00095   // Return the array of HighGain data by detector
00096   const std::vector<DayaBay::HighGainCalibData>& highGainCalibList(
00097                                            const DayaBay::Detector& detectorId,
00098                                            const ServiceMode& svcMode);
00099 
00100   // Return the array of Timing data by detector
00101   const std::vector<DayaBay::TimingCalibData>& timingCalibList(
00102                                            const DayaBay::Detector& detectorId,
00103                                            const ServiceMode& svcMode);
00104 
00105   // Return the array of GainConv data by detector
00106   const std::vector<DayaBay::GainConvCalibData>& gainConvCalibList(
00107                                            const DayaBay::Detector& detectorId,
00108                                            const ServiceMode& svcMode);
00109 
00110   // Return the array of Calibration data by detector
00111   const std::vector<DayaBay::RpcCalibData>& rpcCalibList(
00112                                            const DayaBay::Detector& detectorId,
00113                                            const ServiceMode& svcMode);
00114 
00115   // Return the array of Calibration data by detector
00116   const std::vector<DayaBay::FeeCalibData>& feeCalibList(
00117                                            const DayaBay::Detector& detectorId,
00118                                            const ServiceMode& svcMode);
00119 
00120   // Return the array of Calibration data by detector
00121   const std::vector<DayaBay::FecCalibData>& fecCalibList(
00122                                            const DayaBay::Detector& detectorId,
00123                                            const ServiceMode& svcMode);
00124 
00125   // Return the array of SrcEnergy data by detector
00126   const std::vector<DayaBay::SrcEnergyData>& srcEnergyList(
00127                                                            const ServiceMode& svcMode);
00128 
00129  private:
00130   //  ---------------  Here is a separator  -------------------------------
00131   // Lists of PMT/RPC/channel data by detector
00132   typedef std::map<DayaBay::Detector, std::vector<DayaBay::PmtCalibData> > PmtData;
00133   typedef std::map<DayaBay::Detector, std::vector<DayaBay::RpcCalibData> > RpcData;
00134   typedef std::map<DayaBay::Detector, std::vector<DayaBay::FeeCalibData> > FeeData;
00135   typedef std::map<DayaBay::Detector, std::vector<DayaBay::FecCalibData> > FecData;
00136 
00137   // Lookup map by Sensor ID
00138   typedef std::map<DayaBay::DetectorSensor, DayaBay::PmtCalibData> PmtDataBySensor;
00139   typedef std::map<DayaBay::RpcSensor,      DayaBay::RpcCalibData> RpcDataBySensor;
00140 
00141   // Lookup map by Channel ID
00142   typedef std::map<DayaBay::FeeChannelId, DayaBay::FeeCalibData> FeeDataByChannel;
00143   typedef std::map<DayaBay::FecChannelId, DayaBay::FecCalibData> FecDataByChannel;
00144 
00145   //  ---------------  Here is a separator  -------------------------------
00146   // All above data types have to be context sensitive
00147   typedef std::map< ContextRange, PmtData > PmtDataMap;
00148   typedef std::map< ContextRange, RpcData > RpcDataMap;
00149   typedef std::map< ContextRange, FeeData > FeeDataMap;
00150   typedef std::map< ContextRange, FecData > FecDataMap;
00151 
00152   typedef std::map< ContextRange, PmtDataBySensor > PmtDataBySensorMap;
00153   typedef std::map< ContextRange, RpcDataBySensor > RpcDataBySensorMap;
00154 
00155   typedef std::map< ContextRange, FeeDataByChannel > FeeDataByChannelMap;
00156   typedef std::map< ContextRange, FecDataByChannel > FecDataByChannelMap;
00157 
00158   //  ---------------  Here is a separator  -------------------------------
00159   // Hold all available maps according to context range
00160   PmtDataMap m_pmtDataMap;
00161   RpcDataMap m_rpcDataMap;
00162   FeeDataMap m_feeDataMap;
00163   FecDataMap m_fecDataMap;
00164 
00165   PmtDataBySensorMap m_pmtDataBySensorMap;
00166   RpcDataBySensorMap m_rpcDataBySensorMap;
00167 
00168   FeeDataByChannelMap m_feeDataByChannelMap;
00169   FecDataByChannelMap m_fecDataByChannelMap;
00170 
00171   //  ---------------  Here is a separator  -------------------------------
00172   // current context range
00173   ContextRange m_currentPmtContextRange;
00174   ContextRange m_currentRpcContextRange;
00175   ContextRange m_currentFeeContextRange;
00176   ContextRange m_currentFecContextRange;
00177   
00178 
00179   // Lists of PMT/RPC/channel data by detector pointed by Current Context Range
00180   PmtData * m_currentPmtData;
00181   RpcData * m_currentRpcData;
00182   FeeData * m_currentFeeData;
00183   FecData * m_currentFecData;
00184 
00185   // Lookup map by Sensor ID pointed by Current Context Range
00186   PmtDataBySensor * m_currentPmtDataBySensor;
00187   RpcDataBySensor * m_currentRpcDataBySensor;
00188 
00189   // Lookup map by Channel ID pointed by Current Context Range
00190   FeeDataByChannel * m_currentFeeDataByChannel;
00191   FecDataByChannel * m_currentFecDataByChannel;
00192 
00193   //  ---------------  Here is a separator  -------------------------------
00195 
00196   // Property: Text file of pmt data
00197   std::string m_masterPmtDataFileName;
00198   // Property: Text file of rpc data
00199   // to do: std::string m_rpcDataFileName;
00200   // Property: Text file of FEE data
00201   std::string m_masterFeeDataFileName;
00202   // Property: Text file of FEC data
00203   // to do: std::string m_fecDataFileName;
00204 
00205   //              < ContextRange, FileName >
00206   typedef std::map< ContextRange, std::string > FileNameList;
00207 
00208 
00209   //  ---------------  Here is a separator  -------------------------------
00211 
00212   // Property: Text file of pmt data
00213   std::string m_pmtDataFileName;
00214   // Property: Text file of rpc data
00215   std::string m_rpcDataFileName;
00216   // Property: Text file of FEE data
00217   std::string m_feeDataFileName;
00218   // Property: Text file of FEC data
00219   std::string m_fecDataFileName;
00220 
00221   //  ---------------  Here is a separator  -------------------------------
00222   // Lists of PMT/RPC/channel data by detector specified by user
00223   PmtData m_pmtDataUser;
00224   RpcData m_rpcDataUser;
00225   FeeData m_feeDataUser;
00226   FecData m_fecDataUser;
00227 
00228   // Lookup map by Sensor ID specified by user
00229   PmtDataBySensor m_pmtDataBySensorUser;
00230   RpcDataBySensor m_rpcDataBySensorUser;
00231 
00232   // Lookup map by Channel ID specified by user
00233   FeeDataByChannel m_feeDataByChannelUser;
00234   FecDataByChannel m_fecDataByChannelUser;
00235 
00236   //  ---------------  Here is a separator  -------------------------------
00237 
00238   // read master files
00239   StatusCode readMasterFile( std::string masterFileName, FileNameList &subFileNameList );
00240 
00241   // Functions to read data file
00242   StatusCode readPmtDataFile( std::string pmtDataFileName, PmtData &pmtData, PmtDataBySensor &pmtDataBySensor );
00243   // to do: StatusCode readRpcDataFile( ... );
00244   StatusCode readFeeDataFile( std::string feeDataFileName, FeeData &feeData, FeeDataByChannel &feeDataByChannel );
00245   // to do: StatusCode readFecDataFile( ... );
00246 };
00247 
00248 #endif  // DATASVC_STATICCALIBDATASVC_H
| 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