Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include "CondTools/L1Trigger/interface/L1ConfigOnlineProdBase.h"
00026
00027 #include "CondFormats/L1TObjects/interface/L1RCTChannelMask.h"
00028 #include "CondFormats/DataRecord/interface/L1RCTChannelMaskRcd.h"
00029
00030
00031
00032
00033
00034
00035
00036
00037 class L1RCTChannelMaskOnlineProd :
00038 public L1ConfigOnlineProdBase< L1RCTChannelMaskRcd, L1RCTChannelMask > {
00039 public:
00040 L1RCTChannelMaskOnlineProd(const edm::ParameterSet& iConfig)
00041 : L1ConfigOnlineProdBase< L1RCTChannelMaskRcd, L1RCTChannelMask > (iConfig) {}
00042 ~L1RCTChannelMaskOnlineProd() {}
00043
00044 virtual boost::shared_ptr< L1RCTChannelMask > newObject(const std::string& objectKey ) ;
00045
00046
00047 private:
00048
00049 };
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063 boost::shared_ptr< L1RCTChannelMask >
00064 L1RCTChannelMaskOnlineProd::newObject( const std::string& objectKey )
00065 {
00066 using namespace edm::es;
00067
00068
00069 std::cout << " Current key is " << objectKey <<std::endl;
00070
00071 std::string rctSchema = "CMS_RCT" ;
00072
00073 std::vector< std::string > dc_maskStrings;
00074 dc_maskStrings.push_back( "HCAL_MASK_CR00_EVEN" );
00075 dc_maskStrings.push_back( "HCAL_MASK_CR00_ODD" );
00076 dc_maskStrings.push_back( "HCAL_MASK_CR01_EVEN" );
00077 dc_maskStrings.push_back( "HCAL_MASK_CR01_ODD" );
00078 dc_maskStrings.push_back( "HCAL_MASK_CR02_EVEN" );
00079 dc_maskStrings.push_back( "HCAL_MASK_CR02_ODD" );
00080 dc_maskStrings.push_back( "HCAL_MASK_CR03_EVEN" );
00081 dc_maskStrings.push_back( "HCAL_MASK_CR03_ODD" );
00082 dc_maskStrings.push_back( "HCAL_MASK_CR04_EVEN" );
00083 dc_maskStrings.push_back( "HCAL_MASK_CR04_ODD" );
00084 dc_maskStrings.push_back( "HCAL_MASK_CR05_EVEN" );
00085 dc_maskStrings.push_back( "HCAL_MASK_CR05_ODD" );
00086 dc_maskStrings.push_back( "HCAL_MASK_CR06_EVEN" );
00087 dc_maskStrings.push_back( "HCAL_MASK_CR06_ODD" );
00088 dc_maskStrings.push_back( "HCAL_MASK_CR07_EVEN" );
00089 dc_maskStrings.push_back( "HCAL_MASK_CR07_ODD" );
00090 dc_maskStrings.push_back( "HCAL_MASK_CR08_EVEN" );
00091 dc_maskStrings.push_back( "HCAL_MASK_CR08_ODD" );
00092 dc_maskStrings.push_back( "HCAL_MASK_CR09_EVEN" );
00093 dc_maskStrings.push_back( "HCAL_MASK_CR09_ODD" );
00094 dc_maskStrings.push_back( "HCAL_MASK_CR10_EVEN" );
00095 dc_maskStrings.push_back( "HCAL_MASK_CR10_ODD" );
00096 dc_maskStrings.push_back( "HCAL_MASK_CR11_EVEN" );
00097 dc_maskStrings.push_back( "HCAL_MASK_CR11_ODD" );
00098 dc_maskStrings.push_back( "HCAL_MASK_CR12_EVEN" );
00099 dc_maskStrings.push_back( "HCAL_MASK_CR12_ODD" );
00100 dc_maskStrings.push_back( "HCAL_MASK_CR13_EVEN" );
00101 dc_maskStrings.push_back( "HCAL_MASK_CR13_ODD" );
00102 dc_maskStrings.push_back( "HCAL_MASK_CR14_EVEN" );
00103 dc_maskStrings.push_back( "HCAL_MASK_CR14_ODD" );
00104 dc_maskStrings.push_back( "HCAL_MASK_CR15_EVEN" );
00105 dc_maskStrings.push_back( "HCAL_MASK_CR15_ODD" );
00106 dc_maskStrings.push_back( "HCAL_MASK_CR16_EVEN" );
00107 dc_maskStrings.push_back( "HCAL_MASK_CR16_ODD" );
00108 dc_maskStrings.push_back( "HCAL_MASK_CR17_EVEN" );
00109 dc_maskStrings.push_back( "HCAL_MASK_CR17_ODD" );
00110 dc_maskStrings.push_back( "ECAL_MASK_CR00_EVEN" );
00111 dc_maskStrings.push_back( "ECAL_MASK_CR00_ODD" );
00112 dc_maskStrings.push_back( "ECAL_MASK_CR01_EVEN" );
00113 dc_maskStrings.push_back( "ECAL_MASK_CR01_ODD" );
00114 dc_maskStrings.push_back( "ECAL_MASK_CR02_EVEN" );
00115 dc_maskStrings.push_back( "ECAL_MASK_CR02_ODD" );
00116 dc_maskStrings.push_back( "ECAL_MASK_CR03_EVEN" );
00117 dc_maskStrings.push_back( "ECAL_MASK_CR03_ODD" );
00118 dc_maskStrings.push_back( "ECAL_MASK_CR04_EVEN" );
00119 dc_maskStrings.push_back( "ECAL_MASK_CR04_ODD" );
00120 dc_maskStrings.push_back( "ECAL_MASK_CR05_EVEN" );
00121 dc_maskStrings.push_back( "ECAL_MASK_CR05_ODD" );
00122 dc_maskStrings.push_back( "ECAL_MASK_CR06_EVEN" );
00123 dc_maskStrings.push_back( "ECAL_MASK_CR06_ODD" );
00124 dc_maskStrings.push_back( "ECAL_MASK_CR07_EVEN" );
00125 dc_maskStrings.push_back( "ECAL_MASK_CR07_ODD" );
00126 dc_maskStrings.push_back( "ECAL_MASK_CR08_EVEN" );
00127 dc_maskStrings.push_back( "ECAL_MASK_CR08_ODD" );
00128 dc_maskStrings.push_back( "ECAL_MASK_CR09_EVEN" );
00129 dc_maskStrings.push_back( "ECAL_MASK_CR09_ODD" );
00130 dc_maskStrings.push_back( "ECAL_MASK_CR10_EVEN" );
00131 dc_maskStrings.push_back( "ECAL_MASK_CR10_ODD" );
00132 dc_maskStrings.push_back( "ECAL_MASK_CR11_EVEN" );
00133 dc_maskStrings.push_back( "ECAL_MASK_CR11_ODD" );
00134 dc_maskStrings.push_back( "ECAL_MASK_CR12_EVEN" );
00135 dc_maskStrings.push_back( "ECAL_MASK_CR12_ODD" );
00136 dc_maskStrings.push_back( "ECAL_MASK_CR13_EVEN" );
00137 dc_maskStrings.push_back( "ECAL_MASK_CR13_ODD" );
00138 dc_maskStrings.push_back( "ECAL_MASK_CR14_EVEN" );
00139 dc_maskStrings.push_back( "ECAL_MASK_CR14_ODD" );
00140 dc_maskStrings.push_back( "ECAL_MASK_CR15_EVEN" );
00141 dc_maskStrings.push_back( "ECAL_MASK_CR15_ODD" );
00142 dc_maskStrings.push_back( "ECAL_MASK_CR16_EVEN" );
00143 dc_maskStrings.push_back( "ECAL_MASK_CR16_ODD" );
00144 dc_maskStrings.push_back( "ECAL_MASK_CR17_EVEN" );
00145 dc_maskStrings.push_back( "ECAL_MASK_CR17_ODD" );
00146
00147 l1t::OMDSReader::QueryResults dcMaskResults =
00148 m_omdsReader.basicQuery(
00149 dc_maskStrings,
00150 rctSchema,
00151 "RCT_DEADCHANNEL_SUMMARY",
00152 "RCT_DEADCHANNEL_SUMMARY.ID",
00153 m_omdsReader.basicQuery( "DC_SUM_ID",
00154 rctSchema,
00155 "RCT_RUN_SETTINGS_KEY",
00156 "RCT_RUN_SETTINGS_KEY.ID",
00157 m_omdsReader.singleAttribute( objectKey))) ;
00158
00159
00160
00161 if( dcMaskResults.queryFailed() ||
00162 dcMaskResults.numberRows() != 1 )
00163 {
00164 edm::LogError( "L1-O2O" ) << "Problem with L1RCTChannelMask key." ;
00165
00166
00167 std::cout << " Returened rows " << dcMaskResults.numberRows() <<std::endl;
00168 return boost::shared_ptr< L1RCTChannelMask >() ;
00169 }
00170
00171 L1RCTChannelMask* m = new L1RCTChannelMask;
00172
00173 long long hcal_temp;
00174 int ecal_temp;
00175 for(int i = 0 ; i < 36 ; i++) {
00176 dcMaskResults.fillVariable(dc_maskStrings.at(i),hcal_temp);
00177 for(int j = 0; j < 32 ; j++)
00178 if(j< 28)
00179 m->hcalMask[i/2][i%2][j] = ((hcal_temp >> j ) & 1) == 1;
00180 else
00181 m->hfMask[i/2][i%2][j-28] = ((hcal_temp >> j ) & 1) == 1;
00182 }
00183 for(int i = 36; i < 72 ; i++) {
00184 dcMaskResults.fillVariable(dc_maskStrings.at(i),ecal_temp);
00185 for(int j = 0; j < 28 ; j++) {
00186 int k = i - 36;
00187 m->ecalMask[k/2][k%2][j] = ((ecal_temp >> j ) & 1) ==1;
00188 }
00189 }
00190
00191
00192
00193
00194
00195 std::vector< std::string > cardMaskStrings;
00196 cardMaskStrings.push_back("RC0");
00197 cardMaskStrings.push_back("RC1");
00198 cardMaskStrings.push_back("RC2");
00199 cardMaskStrings.push_back("RC3");
00200 cardMaskStrings.push_back("RC4");
00201 cardMaskStrings.push_back("RC5");
00202 cardMaskStrings.push_back("RC6");
00203 cardMaskStrings.push_back("JSC");
00204
00205
00206 std::vector< std::string > crateIDStrings;
00207 crateIDStrings.push_back("RCT_CRATE_0");
00208 crateIDStrings.push_back("RCT_CRATE_1");
00209 crateIDStrings.push_back("RCT_CRATE_2");
00210 crateIDStrings.push_back("RCT_CRATE_3");
00211 crateIDStrings.push_back("RCT_CRATE_4");
00212 crateIDStrings.push_back("RCT_CRATE_5");
00213 crateIDStrings.push_back("RCT_CRATE_6");
00214 crateIDStrings.push_back("RCT_CRATE_7");
00215 crateIDStrings.push_back("RCT_CRATE_8");
00216 crateIDStrings.push_back("RCT_CRATE_9");
00217 crateIDStrings.push_back("RCT_CRATE_10");
00218 crateIDStrings.push_back("RCT_CRATE_11");
00219 crateIDStrings.push_back("RCT_CRATE_12");
00220 crateIDStrings.push_back("RCT_CRATE_13");
00221 crateIDStrings.push_back("RCT_CRATE_14");
00222 crateIDStrings.push_back("RCT_CRATE_15");
00223 crateIDStrings.push_back("RCT_CRATE_16");
00224 crateIDStrings.push_back("RCT_CRATE_17");
00225
00226
00227 l1t::OMDSReader::QueryResults crate_conf =
00228 m_omdsReader.basicQuery( "CRATE_CONF",
00229 rctSchema,
00230 "RCT_RUN_SETTINGS_KEY",
00231 "RCT_RUN_SETTINGS_KEY.ID",
00232 m_omdsReader.singleAttribute( objectKey)) ;
00233
00234 int crateNum = 0;
00235 for( std::vector<std::string>::iterator crate = crateIDStrings.begin(); crate !=crateIDStrings.end() ; ++crate) {
00236
00237 l1t::OMDSReader::QueryResults cardConfResults =
00238 m_omdsReader.basicQuery(cardMaskStrings,
00239 rctSchema,
00240 "CRATE_CONF_DUMMY",
00241 "CRATE_CONF_DUMMY.CRATE_CONF",
00242 m_omdsReader.basicQuery( *crate,
00243 rctSchema,
00244 "RCT_CRATE_CONF",
00245 "RCT_CRATE_CONF.RCT_KEY",
00246 crate_conf
00247 ));
00248 bool extantCard[8];
00249 int cardNum =0 ;
00250 for(std::vector<std::string>::iterator card = cardMaskStrings.begin(); card!=cardMaskStrings.end(); ++card){
00251 cardConfResults.fillVariable(*card,extantCard[cardNum]);
00252
00253 if(!extantCard[cardNum]){
00254 switch(cardNum){
00255 case 6 :
00256
00257 for ( int k = 0 ; k <4 ; k++) {
00258
00259 m->ecalMask[crateNum][0][(cardNum/2)*8 + k ] |= !extantCard[cardNum];
00260 m->ecalMask[crateNum][1][(cardNum/2)*8 + k ] |= !extantCard[cardNum];
00261 m->hcalMask[crateNum][0][(cardNum/2)*8 + k ] |= !extantCard[cardNum];
00262 m->hcalMask[crateNum][1][(cardNum/2)*8 + k ] |= !extantCard[cardNum];
00263 }
00264 break;
00265 case 7 :
00266
00267 for ( int k = 0 ; k <4 ; k++) {
00268 m->hfMask[crateNum][0][k] |= !extantCard[cardNum];
00269 m->hfMask[crateNum][1][k] |= !extantCard[cardNum];
00270 }
00271 break;
00272 default:
00273
00274 for(int k = 0; k < 8 ; k++ ){
00275 m->hcalMask[crateNum][cardNum%2][(cardNum/2)*8 + k] |= !extantCard[cardNum];
00276 m->ecalMask[crateNum][cardNum%2][(cardNum/2)*8 + k] |= !extantCard[cardNum];
00277 }
00278 }
00279 }
00280 cardNum++;
00281 }
00282 crateNum++;
00283 }
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303 return boost::shared_ptr< L1RCTChannelMask >(m);
00304 }
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315 DEFINE_FWK_EVENTSETUP_MODULE(L1RCTChannelMaskOnlineProd);