40 virtual boost::shared_ptr< L1MuDTTFMasks >
newObject(
41 const std::string& objectKey ) ;
70 boost::shared_ptr< L1MuDTTFMasks >
73 using namespace edm::es;
75 boost::shared_ptr< L1MuDTTFMasks > pDTTFMasks(
80 std::string dttfSchema =
"CMS_DT_TF" ;
83 std::vector< std::string > crateMaskColumns ;
84 crateMaskColumns.push_back(
"WEDGE_CRATE_1" ) ;
85 crateMaskColumns.push_back(
"WEDGE_CRATE_2" ) ;
86 crateMaskColumns.push_back(
"WEDGE_CRATE_3" ) ;
87 crateMaskColumns.push_back(
"WEDGE_CRATE_4" ) ;
88 crateMaskColumns.push_back(
"WEDGE_CRATE_5" ) ;
89 crateMaskColumns.push_back(
"WEDGE_CRATE_6" ) ;
90 crateMaskColumns.push_back(
"WEDGE_CRATE_1_E" ) ;
91 crateMaskColumns.push_back(
"WEDGE_CRATE_2_E" ) ;
92 crateMaskColumns.push_back(
"WEDGE_CRATE_3_E" ) ;
93 crateMaskColumns.push_back(
"WEDGE_CRATE_4_E" ) ;
94 crateMaskColumns.push_back(
"WEDGE_CRATE_5_E" ) ;
95 crateMaskColumns.push_back(
"WEDGE_CRATE_6_E" ) ;
101 "DTTF_RUN_SETTINGS.ID",
104 if( crateMaskResults.queryFailed() ||
105 crateMaskResults.numberRows() != 1 )
108 <<
"Problem with L1MuDTTFMasks key " << objectKey ;
109 return boost::shared_ptr< L1MuDTTFMasks >() ;
113 unsigned long crateMaskL[ 6 ] ;
114 unsigned long crateMaskR[ 6 ] ;
115 unsigned long krateMaskL[ 6 ] ;
116 unsigned long krateMaskR[ 6 ] ;
117 for(
int icrate = 0 ; icrate < 6 ; ++icrate )
119 std::string crateMask ;
120 crateMaskResults.fillVariable( crateMaskColumns[ icrate ],
123 crateMaskL[ icrate ] = std::strtol( crateMask.c_str(), &pEnd, 16 ) ;
124 crateMaskR[ icrate ] = std::strtol( pEnd, (
char **)
NULL, 16 ) ;
126 crateMaskResults.fillVariable( crateMaskColumns[ icrate+6 ],
128 krateMaskL[ icrate ] = std::strtol( crateMask.c_str(), &pEnd, 16 ) ;
129 krateMaskR[ icrate ] = std::strtol( pEnd, (
char **)
NULL, 16 ) ;
131 std::cout <<
"Crate " << icrate <<
" masks"
132 <<
" L: " << std::hex << crateMaskL[ icrate ]
133 <<
" " << std::hex << krateMaskL[ icrate ]
134 <<
" R: " << std::hex << crateMaskR[ icrate ]
135 <<
" " << std::hex << krateMaskR[ icrate ] << std::endl ;
139 std::string sectorNames[ 12 ] = {
140 "R",
"L",
"R",
"L",
"L",
"R",
"L",
"R",
"R",
"L",
"R",
"L" } ;
143 int crateNumbers[ 12 ] = { 3, 3, 4, 4, 5, 5, 2, 2, 1, 1, 0, 0 } ;
146 int wheelNumbers[ 6 ] = { -3, -2, -1, 1, 2, 3 } ;
149 std::string wheelNames[ 6 ] = {
"N2",
"N1",
"N0",
"P0",
"P1",
"P2" } ;
152 std::map< std::string, unsigned int > crateMaskBitmap ;
153 crateMaskBitmap.insert( std::make_pair(
"N2", 24 ) ) ;
154 crateMaskBitmap.insert( std::make_pair(
"N1", 20 ) ) ;
155 crateMaskBitmap.insert( std::make_pair(
"N0", 16 ) ) ;
156 crateMaskBitmap.insert( std::make_pair(
"P0", 8 ) ) ;
157 crateMaskBitmap.insert( std::make_pair(
"P1", 4 ) ) ;
158 crateMaskBitmap.insert( std::make_pair(
"P2", 0 ) ) ;
160 std::map< std::string, unsigned int > krateMaskBitmap ;
161 krateMaskBitmap.insert( std::make_pair(
"N2", 16 ) ) ;
162 krateMaskBitmap.insert( std::make_pair(
"N1", 12 ) ) ;
163 krateMaskBitmap.insert( std::make_pair(
"P0", 8 ) ) ;
164 krateMaskBitmap.insert( std::make_pair(
"P1", 4 ) ) ;
165 krateMaskBitmap.insert( std::make_pair(
"P2", 0 ) ) ;
168 for(
int isc = 0 ; isc < 12 ; ++isc )
170 int crateNumber = crateNumbers[ isc ] ;
171 unsigned long crateMask = crateMaskL[ crateNumber ] ;
172 if ( sectorNames[ isc ] ==
"R" ) crateMask = crateMaskR[ crateNumber ] ;
173 unsigned long krateMask = krateMaskL[ crateNumber ] ;
174 if ( sectorNames[ isc ] ==
"R" ) krateMask = krateMaskR[ crateNumber ] ;
175 std::cout <<
"isc " << isc <<
" icr " << crateNumber << std::endl ;
178 for(
int iwh = 0 ; iwh < 6 ; ++iwh )
180 std::string sectorWheelName =
181 sectorNames[ isc ] + wheelNames[ iwh ] ;
183 unsigned int maskBit = 30 ;
184 std::map< std::string, unsigned int >::const_iterator itr =
185 crateMaskBitmap.find( wheelNames[ iwh ] ) ;
186 if( itr != crateMaskBitmap.end() ) maskBit = itr->second ;
188 unsigned long phtfEnabled = ( crateMask >> maskBit ) & 0xF ;
190 if ( wheelNames[ iwh ] ==
"P2" ) phtfEnabled += ( crateMask >> 24 ) & 0x10 ;
191 if ( wheelNames[ iwh ] ==
"N2" ) phtfEnabled += ( crateMask >> 25 ) & 0x10 ;
193 std::cout <<
"Bits " << std::dec << maskBit <<
" (" << sectorWheelName
194 <<
") of mask " << std::hex << crateMask <<
" is "
195 << std::hex << phtfEnabled << std::endl ;
197 int nwh = wheelNumbers[ iwh ] ;
199 unsigned long chmask = phtfEnabled & 0x1;
200 std::cout <<
" INREC_CHDIS_ST1 " << 1-chmask ;
201 pDTTFMasks->set_inrec_chdis_st1( nwh, isc, 1-chmask ) ;
202 chmask = ( phtfEnabled >> 1 ) & 0x1;
203 std::cout <<
" INREC_CHDIS_ST2 " << 1-chmask ;
204 pDTTFMasks->set_inrec_chdis_st2( nwh, isc, 1-chmask ) ;
205 chmask = ( phtfEnabled >> 2 ) & 0x1;
206 std::cout <<
" INREC_CHDIS_ST3 " << 1-chmask ;
207 pDTTFMasks->set_inrec_chdis_st3( nwh, isc, 1-chmask ) ;
208 chmask = ( phtfEnabled >> 3 ) & 0x1;
209 std::cout <<
" INREC_CHDIS_ST4 " << 1-chmask ;
210 pDTTFMasks->set_inrec_chdis_st4( nwh, isc, 1-chmask ) ;
211 chmask = ( phtfEnabled >> 4 ) & 0x1;
212 std::cout <<
" INREC_CHDIS_CSC " << 1-chmask << std::endl ;
213 pDTTFMasks->set_inrec_chdis_csc( nwh, isc, 1-chmask ) ;
215 if ( wheelNames[ iwh ] ==
"N0" ) continue ;
218 itr = krateMaskBitmap.find( wheelNames[ iwh ] ) ;
219 if( itr != krateMaskBitmap.end() ) maskBit = itr->second ;
221 unsigned long ettfEnabled = ( krateMask >> maskBit ) & 0x7 ;
223 std::cout <<
"Bits " << std::dec << maskBit <<
" (" << sectorWheelName
224 <<
") of mask " << std::hex << krateMask <<
" is "
225 << std::hex << ettfEnabled << std::endl ;
227 chmask = ettfEnabled & 0x1;
228 std::cout <<
" ETSOC_CHDIS_ST1 " << 1-chmask ;
229 pDTTFMasks->set_etsoc_chdis_st1( nwh, isc, 1-chmask ) ;
230 chmask = ( ettfEnabled >> 1 ) & 0x1;
231 std::cout <<
" ETSOC_CHDIS_ST2 " << 1-chmask ;
232 pDTTFMasks->set_etsoc_chdis_st2( nwh, isc, 1-chmask ) ;
233 chmask = ( ettfEnabled >> 2 ) & 0x1;
234 std::cout <<
" ETSOC_CHDIS_ST3 " << 1-chmask << std::endl ;
235 pDTTFMasks->set_etsoc_chdis_st3( nwh, isc, 1-chmask ) ;
const QueryResults singleAttribute(const T &data) const
virtual boost::shared_ptr< L1MuDTTFMasks > newObject(const std::string &objectKey)
const QueryResults basicQuery(const std::vector< std::string > &columnNames, const std::string &schemaName, const std::string &tableName, const std::string &conditionLHS="", const QueryResults conditionRHS=QueryResults(), const std::string &conditionRHSName="") const
l1t::OMDSReader m_omdsReader
DTTFMasksOnlineProd(const edm::ParameterSet &)
#define DEFINE_FWK_EVENTSETUP_MODULE(type)