| 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 RPC Calibration data
00048   const DayaBay::RpcCalibData* rpcCalibData(const DayaBay::RpcSensor& rpcId,
00049                                             const ServiceMode& svcMode);
00050 
00051   // Return the FEE Calibration data
00052   const DayaBay::FeeCalibData* feeCalibData(
00053                                          const DayaBay::FeeChannelId& channelId,
00054                                          const ServiceMode& svcMode);
00055 
00056   // Return the FEC Calibration data
00057   const DayaBay::FecCalibData* fecCalibData(
00058                                          const DayaBay::FecChannelId& channelId,
00059                                          const ServiceMode& svcMode);
00060 
00061   // Return the array of Calibration data by detector
00062   const std::vector<DayaBay::PmtCalibData>& pmtCalibList(
00063                                            const DayaBay::Detector& detectorId,
00064                                            const ServiceMode& svcMode);
00065 
00066   // Return the array of Calibration data by detector
00067   const std::vector<DayaBay::RpcCalibData>& rpcCalibList(
00068                                            const DayaBay::Detector& detectorId,
00069                                            const ServiceMode& svcMode);
00070 
00071   // Return the array of Calibration data by detector
00072   const std::vector<DayaBay::FeeCalibData>& feeCalibList(
00073                                            const DayaBay::Detector& detectorId,
00074                                            const ServiceMode& svcMode);
00075 
00076   // Return the array of Calibration data by detector
00077   const std::vector<DayaBay::FecCalibData>& fecCalibList(
00078                                            const DayaBay::Detector& detectorId,
00079                                            const ServiceMode& svcMode);
00080  private:
00081   //  ---------------  Here is a separator  -------------------------------
00082   // Lists of PMT/RPC/channel data by detector
00083   typedef std::map<DayaBay::Detector, std::vector<DayaBay::PmtCalibData> > PmtData;
00084   typedef std::map<DayaBay::Detector, std::vector<DayaBay::RpcCalibData> > RpcData;
00085   typedef std::map<DayaBay::Detector, std::vector<DayaBay::FeeCalibData> > FeeData;
00086   typedef std::map<DayaBay::Detector, std::vector<DayaBay::FecCalibData> > FecData;
00087 
00088   // Lookup map by Sensor ID
00089   typedef std::map<DayaBay::DetectorSensor, DayaBay::PmtCalibData> PmtDataBySensor;
00090   typedef std::map<DayaBay::RpcSensor,      DayaBay::RpcCalibData> RpcDataBySensor;
00091 
00092   // Lookup map by Channel ID
00093   typedef std::map<DayaBay::FeeChannelId, DayaBay::FeeCalibData> FeeDataByChannel;
00094   typedef std::map<DayaBay::FecChannelId, DayaBay::FecCalibData> FecDataByChannel;
00095 
00096   //  ---------------  Here is a separator  -------------------------------
00097   // All above data types have to be context sensitive
00098   typedef std::map< ContextRange, PmtData > PmtDataMap;
00099   typedef std::map< ContextRange, RpcData > RpcDataMap;
00100   typedef std::map< ContextRange, FeeData > FeeDataMap;
00101   typedef std::map< ContextRange, FecData > FecDataMap;
00102 
00103   typedef std::map< ContextRange, PmtDataBySensor > PmtDataBySensorMap;
00104   typedef std::map< ContextRange, RpcDataBySensor > RpcDataBySensorMap;
00105 
00106   typedef std::map< ContextRange, FeeDataByChannel > FeeDataByChannelMap;
00107   typedef std::map< ContextRange, FecDataByChannel > FecDataByChannelMap;
00108 
00109   //  ---------------  Here is a separator  -------------------------------
00110   // Hold all available maps according to context range
00111   PmtDataMap m_pmtDataMap;
00112   RpcDataMap m_rpcDataMap;
00113   FeeDataMap m_feeDataMap;
00114   FecDataMap m_fecDataMap;
00115 
00116   PmtDataBySensorMap m_pmtDataBySensorMap;
00117   RpcDataBySensorMap m_rpcDataBySensorMap;
00118 
00119   FeeDataByChannelMap m_feeDataByChannelMap;
00120   FecDataByChannelMap m_fecDataByChannelMap;
00121 
00122   //  ---------------  Here is a separator  -------------------------------
00123   // current context range
00124   ContextRange m_currentPmtContextRange;
00125   ContextRange m_currentRpcContextRange;
00126   ContextRange m_currentFeeContextRange;
00127   ContextRange m_currentFecContextRange;
00128   
00129 
00130   // Lists of PMT/RPC/channel data by detector pointed by Current Context Range
00131   PmtData * m_currentPmtData;
00132   RpcData * m_currentRpcData;
00133   FeeData * m_currentFeeData;
00134   FecData * m_currentFecData;
00135 
00136   // Lookup map by Sensor ID pointed by Current Context Range
00137   PmtDataBySensor * m_currentPmtDataBySensor;
00138   RpcDataBySensor * m_currentRpcDataBySensor;
00139 
00140   // Lookup map by Channel ID pointed by Current Context Range
00141   FeeDataByChannel * m_currentFeeDataByChannel;
00142   FecDataByChannel * m_currentFecDataByChannel;
00143 
00144   //  ---------------  Here is a separator  -------------------------------
00146 
00147   // Property: Text file of pmt data
00148   std::string m_masterPmtDataFileName;
00149   // Property: Text file of rpc data
00150   // to do: std::string m_rpcDataFileName;
00151   // Property: Text file of FEE data
00152   std::string m_masterFeeDataFileName;
00153   // Property: Text file of FEC data
00154   // to do: std::string m_fecDataFileName;
00155 
00156   //              < ContextRange, FileName >
00157   typedef std::map< ContextRange, std::string > FileNameList;
00158 
00159 
00160   //  ---------------  Here is a separator  -------------------------------
00162 
00163   // Property: Text file of pmt data
00164   std::string m_pmtDataFileName;
00165   // Property: Text file of rpc data
00166   std::string m_rpcDataFileName;
00167   // Property: Text file of FEE data
00168   std::string m_feeDataFileName;
00169   // Property: Text file of FEC data
00170   std::string m_fecDataFileName;
00171 
00172   //  ---------------  Here is a separator  -------------------------------
00173   // Lists of PMT/RPC/channel data by detector specified by user
00174   PmtData m_pmtDataUser;
00175   RpcData m_rpcDataUser;
00176   FeeData m_feeDataUser;
00177   FecData m_fecDataUser;
00178 
00179   // Lookup map by Sensor ID specified by user
00180   PmtDataBySensor m_pmtDataBySensorUser;
00181   RpcDataBySensor m_rpcDataBySensorUser;
00182 
00183   // Lookup map by Channel ID specified by user
00184   FeeDataByChannel m_feeDataByChannelUser;
00185   FecDataByChannel m_fecDataByChannelUser;
00186 
00187   //  ---------------  Here is a separator  -------------------------------
00188 
00189   // read master files
00190   StatusCode readMasterFile( std::string masterFileName, FileNameList &subFileNameList );
00191 
00192   // Functions to read data file
00193   StatusCode readPmtDataFile( std::string pmtDataFileName, PmtData &pmtData, PmtDataBySensor &pmtDataBySensor );
00194   // to do: StatusCode readRpcDataFile( ... );
00195   StatusCode readFeeDataFile( std::string feeDataFileName, FeeData &feeData, FeeDataByChannel &feeDataByChannel );
00196   // to do: StatusCode readFecDataFile( ... );
00197 };
00198 
00199 #endif  // DATASVC_STATICCALIBDATASVC_H
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 20:21:03 2011 for DataSvc by doxygen 1.4.7