39 virtual boost::shared_ptr< L1MuDTTFMasks >
newObject(
69 boost::shared_ptr< L1MuDTTFMasks >
72 using namespace edm::es;
74 boost::shared_ptr< L1MuDTTFMasks > pDTTFMasks(
82 std::vector< std::string > crateMaskColumns ;
83 crateMaskColumns.push_back(
"WEDGE_CRATE_1" ) ;
84 crateMaskColumns.push_back(
"WEDGE_CRATE_2" ) ;
85 crateMaskColumns.push_back(
"WEDGE_CRATE_3" ) ;
86 crateMaskColumns.push_back(
"WEDGE_CRATE_4" ) ;
87 crateMaskColumns.push_back(
"WEDGE_CRATE_5" ) ;
88 crateMaskColumns.push_back(
"WEDGE_CRATE_6" ) ;
89 crateMaskColumns.push_back(
"WEDGE_CRATE_1_E" ) ;
90 crateMaskColumns.push_back(
"WEDGE_CRATE_2_E" ) ;
91 crateMaskColumns.push_back(
"WEDGE_CRATE_3_E" ) ;
92 crateMaskColumns.push_back(
"WEDGE_CRATE_4_E" ) ;
93 crateMaskColumns.push_back(
"WEDGE_CRATE_5_E" ) ;
94 crateMaskColumns.push_back(
"WEDGE_CRATE_6_E" ) ;
100 "DTTF_RUN_SETTINGS.ID",
103 if( crateMaskResults.queryFailed() ||
104 crateMaskResults.numberRows() != 1 )
107 <<
"Problem with L1MuDTTFMasks key " << objectKey ;
108 return boost::shared_ptr< L1MuDTTFMasks >() ;
112 unsigned long crateMaskL[ 6 ] ;
113 unsigned long crateMaskR[ 6 ] ;
114 unsigned long krateMaskL[ 6 ] ;
115 unsigned long krateMaskR[ 6 ] ;
116 for(
int icrate = 0 ; icrate < 6 ; ++icrate )
119 crateMaskResults.fillVariable( crateMaskColumns[ icrate ],
122 crateMaskL[ icrate ] = std::strtol( crateMask.c_str(), &pEnd, 16 ) ;
123 crateMaskR[ icrate ] = std::strtol( pEnd, (
char **)
NULL, 16 ) ;
125 crateMaskResults.fillVariable( crateMaskColumns[ icrate+6 ],
127 krateMaskL[ icrate ] = std::strtol( crateMask.c_str(), &pEnd, 16 ) ;
128 krateMaskR[ icrate ] = std::strtol( pEnd, (
char **)
NULL, 16 ) ;
130 std::cout <<
"Crate " << icrate <<
" masks"
131 <<
" L: " << std::hex << crateMaskL[ icrate ]
132 <<
" " << std::hex << krateMaskL[ icrate ]
133 <<
" R: " << std::hex << crateMaskR[ icrate ]
134 <<
" " << std::hex << krateMaskR[ icrate ] << std::endl ;
139 "R",
"L",
"R",
"L",
"L",
"R",
"L",
"R",
"R",
"L",
"R",
"L" } ;
142 int crateNumbers[ 12 ] = { 3, 3, 4, 4, 5, 5, 2, 2, 1, 1, 0, 0 } ;
145 int wheelNumbers[ 6 ] = { -3, -2, -1, 1, 2, 3 } ;
148 std::string wheelNames[ 6 ] = {
"N2",
"N1",
"N0",
"P0",
"P1",
"P2" } ;
151 std::map< std::string, unsigned int > crateMaskBitmap ;
152 crateMaskBitmap.insert( std::make_pair(
"N2", 24 ) ) ;
153 crateMaskBitmap.insert( std::make_pair(
"N1", 20 ) ) ;
154 crateMaskBitmap.insert( std::make_pair(
"N0", 16 ) ) ;
155 crateMaskBitmap.insert( std::make_pair(
"P0", 8 ) ) ;
156 crateMaskBitmap.insert( std::make_pair(
"P1", 4 ) ) ;
157 crateMaskBitmap.insert( std::make_pair(
"P2", 0 ) ) ;
159 std::map< std::string, unsigned int > krateMaskBitmap ;
160 krateMaskBitmap.insert( std::make_pair(
"N2", 16 ) ) ;
161 krateMaskBitmap.insert( std::make_pair(
"N1", 12 ) ) ;
162 krateMaskBitmap.insert( std::make_pair(
"P0", 8 ) ) ;
163 krateMaskBitmap.insert( std::make_pair(
"P1", 4 ) ) ;
164 krateMaskBitmap.insert( std::make_pair(
"P2", 0 ) ) ;
167 for(
int isc = 0 ; isc < 12 ; ++isc )
169 int crateNumber = crateNumbers[ isc ] ;
170 unsigned long crateMask = crateMaskL[ crateNumber ] ;
171 if ( sectorNames[ isc ] ==
"R" ) crateMask = crateMaskR[ crateNumber ] ;
172 unsigned long krateMask = krateMaskL[ crateNumber ] ;
173 if ( sectorNames[ isc ] ==
"R" ) krateMask = krateMaskR[ crateNumber ] ;
174 std::cout <<
"isc " << isc <<
" icr " << crateNumber << std::endl ;
177 for(
int iwh = 0 ; iwh < 6 ; ++iwh )
180 sectorNames[ isc ] + wheelNames[ iwh ] ;
182 unsigned int maskBit = 30 ;
183 std::map< std::string, unsigned int >::const_iterator itr =
184 crateMaskBitmap.find( wheelNames[ iwh ] ) ;
185 if( itr != crateMaskBitmap.end() ) maskBit = itr->second ;
187 unsigned long phtfEnabled = ( crateMask >> maskBit ) & 0xF ;
189 if ( wheelNames[ iwh ] ==
"P2" ) phtfEnabled += ( crateMask >> 24 ) & 0x10 ;
190 if ( wheelNames[ iwh ] ==
"N2" ) phtfEnabled += ( crateMask >> 25 ) & 0x10 ;
192 std::cout <<
"Bits " << std::dec << maskBit <<
" (" << sectorWheelName
193 <<
") of mask " << std::hex << crateMask <<
" is "
194 << std::hex << phtfEnabled << std::endl ;
196 int nwh = wheelNumbers[ iwh ] ;
198 unsigned long chmask = phtfEnabled & 0x1;
199 std::cout <<
" INREC_CHDIS_ST1 " << 1-chmask ;
200 pDTTFMasks->set_inrec_chdis_st1( nwh, isc, 1-chmask ) ;
201 chmask = ( phtfEnabled >> 1 ) & 0x1;
202 std::cout <<
" INREC_CHDIS_ST2 " << 1-chmask ;
203 pDTTFMasks->set_inrec_chdis_st2( nwh, isc, 1-chmask ) ;
204 chmask = ( phtfEnabled >> 2 ) & 0x1;
205 std::cout <<
" INREC_CHDIS_ST3 " << 1-chmask ;
206 pDTTFMasks->set_inrec_chdis_st3( nwh, isc, 1-chmask ) ;
207 chmask = ( phtfEnabled >> 3 ) & 0x1;
208 std::cout <<
" INREC_CHDIS_ST4 " << 1-chmask ;
209 pDTTFMasks->set_inrec_chdis_st4( nwh, isc, 1-chmask ) ;
210 chmask = ( phtfEnabled >> 4 ) & 0x1;
211 std::cout <<
" INREC_CHDIS_CSC " << 1-chmask << std::endl ;
212 pDTTFMasks->set_inrec_chdis_csc( nwh, isc, 1-chmask ) ;
214 if ( wheelNames[ iwh ] ==
"N0" ) continue ;
217 itr = krateMaskBitmap.find( wheelNames[ iwh ] ) ;
218 if( itr != krateMaskBitmap.end() ) maskBit = itr->second ;
220 unsigned long ettfEnabled = ( krateMask >> maskBit ) & 0x7 ;
222 std::cout <<
"Bits " << std::dec << maskBit <<
" (" << sectorWheelName
223 <<
") of mask " << std::hex << krateMask <<
" is "
224 << std::hex << ettfEnabled << std::endl ;
226 chmask = ettfEnabled & 0x1;
227 std::cout <<
" ETSOC_CHDIS_ST1 " << 1-chmask ;
228 pDTTFMasks->set_etsoc_chdis_st1( nwh, isc, 1-chmask ) ;
229 chmask = ( ettfEnabled >> 1 ) & 0x1;
230 std::cout <<
" ETSOC_CHDIS_ST2 " << 1-chmask ;
231 pDTTFMasks->set_etsoc_chdis_st2( nwh, isc, 1-chmask ) ;
232 chmask = ( ettfEnabled >> 2 ) & 0x1;
233 std::cout <<
" ETSOC_CHDIS_ST3 " << 1-chmask << std::endl ;
234 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) override
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)