00001 #ifndef ODLASERCONFIG_H 00002 #define ODLASERCONFIG_H 00003 00004 #include <map> 00005 #include <stdexcept> 00006 #include "OnlineDB/Oracle/interface/Oracle.h" 00007 #include "OnlineDB/EcalCondDB/interface/IODConfig.h" 00008 #define USE_NORM 1 00009 #define USE_CHUN 2 00010 #define USE_BUFF 3 00011 00012 /* Buffer Size */ 00013 #define BUFSIZE 200; 00014 00015 class ODLaserConfig : public IODConfig { 00016 public: 00017 friend class EcalCondDBInterface; 00018 ODLaserConfig(); 00019 ~ODLaserConfig(); 00020 00021 // User data methods 00022 inline std::string getTable() { return "ECAL_Laser_CONFIGURATION"; } 00023 00024 inline void setId(int id) { m_ID = id; } 00025 inline int getId() const { return m_ID; } 00026 inline void setSize(unsigned int id) { m_size = id; } 00027 inline unsigned int getSize() const { return m_size; } 00028 00029 00030 inline void setDebug(int x) { m_debug = x; } 00031 inline int getDebug() const { return m_debug; } 00032 inline void setDummy(int x) { m_dummy = x; } 00033 inline int getDummy() const { return m_dummy; } 00034 00035 inline void setMatacqBaseAddress(int x) { m_mq_base = x; } 00036 inline int getMatacqBaseAddress() const { return m_mq_base; } 00037 inline void setMatacqNone(int x) { m_mq_none = x; } 00038 inline int getMatacqNone() const { return m_mq_none; } 00039 inline void setMatacqMode(std::string x) { m_mode = x; } 00040 inline std::string getMatacqMode() const { return m_mode; } 00041 inline void setChannelMask(int x) { m_chan_mask = x; } 00042 inline int getChannelMask() const { return m_chan_mask; } 00043 inline void setMaxSamplesForDaq(std::string x) { m_samples = x; } 00044 inline std::string getMaxSamplesForDaq() const { return m_samples; } 00045 inline void setMatacqFedId(int x) { m_mq_fed = x; } 00046 inline int getMatacqFedId() const { return m_mq_fed; } 00047 inline void setPedestalFile(std::string x) { m_ped_file = x; } 00048 inline std::string getPedestalFile() const { return m_ped_file; } 00049 inline void setUseBuffer(int x) { m_use_buffer = x; } 00050 inline int getUseBuffer() const { return m_use_buffer; } 00051 inline void setPostTrig(int x) { m_post_trig = x; } 00052 inline int getPostTrig() const { return m_post_trig; } 00053 inline void setFPMode(int x) { m_fp_mode = x; } 00054 inline int getFPMode() const { return m_fp_mode; } 00055 inline void setHalModuleFile(std::string x) { m_hal_mod_file = x; } 00056 inline std::string getHalModuleFile() const { return m_hal_mod_file; } 00057 inline void setMatacqVernierMax(int x) { m_matacq_vernier_max = x; } 00058 inline int getMatacqVernierMax() { return m_matacq_vernier_max; } 00059 inline void setMatacqVernierMin(int x) { m_matacq_vernier_min = x; } 00060 inline int getMatacqVernierMin() { return m_matacq_vernier_min; } 00061 00062 inline void setHalAddressTableFile(std::string x) { m_hal_add_file = x; } 00063 inline std::string getHalAddressTableFile() const { return m_hal_add_file; } 00064 00065 inline void setHalStaticTableFile(std::string x) { m_hal_tab_file = x; } 00066 inline std::string getHalStaticTableFile() const { return m_hal_tab_file; } 00067 00068 inline void setMatacqSerialNumber(std::string x) { m_serial = x; } 00069 inline std::string getMatacqSerialNumber() const { return m_serial; } 00070 00071 inline void setPedestalRunEventCount(int x) { m_ped_count = x; } 00072 inline int getPedestalRunEventCount() const { return m_ped_count; } 00073 00074 inline void setRawDataMode(int x) { m_raw_mode = x; } 00075 inline int getRawDataMode() const { return m_raw_mode; } 00076 00077 inline void setMatacqAcquisitionMode(std::string x) { m_aqmode = x; } 00078 inline std::string getMatacqAcquisitionMode() const { return m_aqmode; } 00079 00080 inline void setLocalOutputFile(std::string x) { m_mq_file = x; } 00081 inline std::string getLocalOutputFile() const { return m_mq_file; } 00082 00083 // emtc 00084 inline void setEMTCNone(int x) { m_emtc_1 = x; } 00085 inline int getEMTCNone() const { return m_emtc_1; } 00086 inline void setWTE2LaserDelay(int x) { m_emtc_2 = x; } 00087 inline int getWTE2LaserDelay() const { return m_emtc_2; } 00088 inline void setLaserPhase(int x) { m_emtc_3 = x; } 00089 inline int getLaserPhase() const { return m_emtc_3; } 00090 inline void setEMTCTTCIn(int x) { m_emtc_4 = x; } 00091 inline int getEMTCTTCIn() const { return m_emtc_4; } 00092 inline void setEMTCSlotId(int x) { m_emtc_5 = x; } 00093 inline int getEMTCSlotId() const { return m_emtc_5; } 00094 00095 // void setParameters(std::map<std::string,std::string> my_keys_map); 00096 00097 // laser 00098 00099 inline void setWaveLength(int x) { m_wave = x; } 00100 inline int getWaveLength() const { return m_wave; } 00101 00102 inline void setPower(int x) { m_power = x; } 00103 inline int getPower() const { return m_power; } 00104 00105 inline void setOpticalSwitch(int x) { m_switch = x; } 00106 inline int getOpticalSwitch() const { return m_switch; } 00107 00108 inline void setFilter(int x) { m_filter = x; } 00109 inline int getFilter() const { return m_filter; } 00110 00111 inline void setLaserControlOn(int x) { m_on = x; } 00112 inline int getLaserControlOn() const { return m_on; } 00113 00114 inline void setLaserControlHost(std::string x) { m_laserhost = x; } 00115 inline std::string getLaserControlHost() const { return m_laserhost; } 00116 00117 inline void setLaserControlPort(int x) { m_laserport = x; } 00118 inline int getLaserControlPort() const { return m_laserport; } 00119 00120 00121 00122 inline void setLaserTag(std::string x) { m_laser_tag = x; } 00123 inline std::string getLaserTag() const { return m_laser_tag ; } 00124 00125 00126 00127 // new parameters 00128 00129 inline void setWTE2LedDelay(int x) { m_wte_2_led_delay = x; } 00130 inline int getWTE2LedDelay() const { return m_wte_2_led_delay; } 00131 00132 inline void setLed1ON(int x) { m_led1_on = x; } 00133 inline int getLed1ON() const { return m_led1_on; } 00134 00135 inline void setLed2ON(int x) { m_led2_on = x; } 00136 inline int getLed2ON() const { return m_led2_on; } 00137 00138 inline void setLed3ON(int x) { m_led3_on = x; } 00139 inline int getLed3ON() const { return m_led3_on; } 00140 00141 inline void setLed4ON(int x) { m_led4_on = x; } 00142 inline int getLed4ON() const { return m_led4_on; } 00143 00144 inline void setVinj(int x) { m_vinj = x; } 00145 inline int getVinj() const { return m_vinj; } 00146 00147 inline void setOrangeLedMonAmpl(int x) { m_orange_led_mon_ampl = x; } 00148 inline int getOrangeLedMonAmpl() const { return m_orange_led_mon_ampl; } 00149 00150 inline void setBlueLedMonAmpl(int x) { m_blue_led_mon_ampl = x; } 00151 inline int getBlueLedMonAmpl() const { return m_blue_led_mon_ampl; } 00152 00153 inline void setTrigLogFile(std::string x) { m_trig_log_file = x; } 00154 inline std::string getTrigLogFile() const { return m_trig_log_file; } 00155 00156 inline void setLedControlON(int x) { m_led_control_on = x; } 00157 inline int getLedControlON() const { return m_led_control_on; } 00158 00159 inline void setLedControlHost(std::string x) { m_led_control_host = x; } 00160 inline std::string getLedControlHost() const { return m_led_control_host; } 00161 00162 inline void setLedControlPort(int x) { m_led_control_port = x; } 00163 inline int getLedControlPort() const { return m_led_control_port; } 00164 00165 inline void setIRLaserPower(int x) { m_ir_laser_power = x; } 00166 inline int getIRLaserPower() const { return m_ir_laser_power; } 00167 00168 inline void setGreenLaserPower(int x) { m_green_laser_power = x; } 00169 inline int getGreenLaserPower() const { return m_green_laser_power; } 00170 00171 inline void setRedLaserPower(int x) { m_red_laser_power = x; } 00172 inline int getRedLaserPower() const { return m_red_laser_power; } 00173 00174 inline void setBlueLaserLogAttenuator(int x) { m_blue_laser_log_attenuator = x; } 00175 inline int getBlueLaserLogAttenuator() const { return m_blue_laser_log_attenuator; } 00176 00177 inline void setIRLaserLogAttenuator(int x) { m_ir_laser_log_attenuator = x; } 00178 inline int getIRLaserLogAttenuator() const { return m_ir_laser_log_attenuator; } 00179 00180 inline void setGreenLaserLogAttenuator(int x) { m_green_laser_log_attenuator = x; } 00181 inline int getGreenLaserLogAttenuator() const { return m_green_laser_log_attenuator; } 00182 00183 inline void setRedLaserLogAttenuator(int x) { m_red_laser_log_attenuator = x; } 00184 inline int getRedLaserLogAttenuator() const { return m_red_laser_log_attenuator; } 00185 00186 inline void setLaserConfigFile(std::string x) { m_laser_config_file = x; } 00187 inline std::string getLaserConfigFile() const { return m_laser_config_file ; } 00188 00189 inline void setLaserClob(unsigned char* x) { m_laser_clob = x; } 00190 inline unsigned char* getLaserClob() const { return m_laser_clob; } 00191 00192 void setParameters(std::map<std::string,std::string> my_keys_map); 00193 00194 int fetchNextId() throw(std::runtime_error); 00195 00196 private: 00197 void prepareWrite() throw(std::runtime_error); 00198 void writeDB() throw(std::runtime_error); 00199 void clear(); 00200 void fetchData(ODLaserConfig * result) throw(std::runtime_error); 00201 int fetchID() throw(std::runtime_error); 00202 00203 00204 // User data 00205 int m_ID; 00206 00207 // mataq 00208 int m_dummy; 00209 int m_debug; 00210 int m_mq_base; 00211 int m_mq_none; 00212 std::string m_mode ; 00213 int m_chan_mask; 00214 std::string m_samples; 00215 int m_mq_fed; 00216 std::string m_ped_file; 00217 int m_use_buffer; 00218 int m_post_trig; 00219 int m_fp_mode; 00220 std::string m_hal_mod_file; 00221 std::string m_hal_add_file; 00222 std::string m_hal_tab_file; 00223 std::string m_serial; 00224 int m_ped_count; 00225 int m_raw_mode; 00226 std::string m_aqmode; 00227 std::string m_mq_file; 00228 int m_matacq_vernier_min; 00229 int m_matacq_vernier_max; 00230 00231 // emtc 00232 int m_emtc_1; 00233 int m_emtc_2; 00234 int m_emtc_3; 00235 int m_emtc_4; 00236 int m_emtc_5; 00237 00238 // laser 00239 int m_wave; 00240 int m_power; 00241 int m_switch; 00242 int m_filter; 00243 int m_on; 00244 std::string m_laserhost; 00245 int m_laserport; 00246 00247 std::string m_laser_tag; 00248 00249 00250 // led 00251 int m_wte_2_led_delay; 00252 int m_led1_on; 00253 int m_led2_on ; 00254 int m_led3_on ; 00255 int m_led4_on ; 00256 int m_vinj; 00257 int m_orange_led_mon_ampl ; 00258 int m_blue_led_mon_ampl ; 00259 std::string m_trig_log_file; 00260 int m_led_control_on ; 00261 std::string m_led_control_host; 00262 int m_led_control_port ; 00263 int m_ir_laser_power ; 00264 int m_green_laser_power; 00265 int m_red_laser_power ; 00266 int m_blue_laser_log_attenuator; 00267 int m_ir_laser_log_attenuator; 00268 int m_green_laser_log_attenuator; 00269 int m_red_laser_log_attenuator; 00270 std::string m_laser_config_file; 00271 unsigned char* m_laser_clob ; 00272 unsigned int m_size; 00273 00274 00275 }; 00276 00277 #endif