39 virtual std::shared_ptr< L1MuDTTFMasks >
newObject(
69 std::shared_ptr< L1MuDTTFMasks >
74 auto pDTTFMasks = std::make_shared< L1MuDTTFMasks >() ;
81 std::vector< std::string > crateMaskColumns ;
82 crateMaskColumns.push_back(
"WEDGE_CRATE_1" ) ;
83 crateMaskColumns.push_back(
"WEDGE_CRATE_2" ) ;
84 crateMaskColumns.push_back(
"WEDGE_CRATE_3" ) ;
85 crateMaskColumns.push_back(
"WEDGE_CRATE_4" ) ;
86 crateMaskColumns.push_back(
"WEDGE_CRATE_5" ) ;
87 crateMaskColumns.push_back(
"WEDGE_CRATE_6" ) ;
88 crateMaskColumns.push_back(
"WEDGE_CRATE_1_E" ) ;
89 crateMaskColumns.push_back(
"WEDGE_CRATE_2_E" ) ;
90 crateMaskColumns.push_back(
"WEDGE_CRATE_3_E" ) ;
91 crateMaskColumns.push_back(
"WEDGE_CRATE_4_E" ) ;
92 crateMaskColumns.push_back(
"WEDGE_CRATE_5_E" ) ;
93 crateMaskColumns.push_back(
"WEDGE_CRATE_6_E" ) ;
99 "DTTF_RUN_SETTINGS.ID",
106 <<
"Problem with L1MuDTTFMasks key " << objectKey ;
107 return std::shared_ptr< L1MuDTTFMasks >() ;
111 unsigned long crateMaskL[ 6 ] ;
112 unsigned long crateMaskR[ 6 ] ;
113 unsigned long krateMaskL[ 6 ] ;
114 unsigned long krateMaskR[ 6 ] ;
115 for(
int icrate = 0 ; icrate < 6 ; ++icrate )
118 crateMaskResults.
fillVariable( crateMaskColumns[ icrate ],
121 crateMaskL[ icrate ] = std::strtol( crateMask.c_str(), &pEnd, 16 ) ;
122 crateMaskR[ icrate ] = std::strtol( pEnd, (
char **)
NULL, 16 ) ;
124 crateMaskResults.
fillVariable( crateMaskColumns[ icrate+6 ],
126 krateMaskL[ icrate ] = std::strtol( crateMask.c_str(), &pEnd, 16 ) ;
127 krateMaskR[ icrate ] = std::strtol( pEnd, (
char **)
NULL, 16 ) ;
129 std::cout <<
"Crate " << icrate <<
" masks" 130 <<
" L: " << std::hex << crateMaskL[ icrate ]
131 <<
" " << std::hex << krateMaskL[ icrate ]
132 <<
" R: " << std::hex << crateMaskR[ icrate ]
133 <<
" " << std::hex << krateMaskR[ icrate ] << std::endl ;
138 "R",
"L",
"R",
"L",
"L",
"R",
"L",
"R",
"R",
"L",
"R",
"L" } ;
141 int crateNumbers[ 12 ] = { 3, 3, 4, 4, 5, 5, 2, 2, 1, 1, 0, 0 } ;
144 int wheelNumbers[ 6 ] = { -3, -2, -1, 1, 2, 3 } ;
147 std::string wheelNames[ 6 ] = {
"N2",
"N1",
"N0",
"P0",
"P1",
"P2" } ;
150 std::map< std::string, unsigned int > crateMaskBitmap ;
151 crateMaskBitmap.insert( std::make_pair(
"N2", 24 ) ) ;
152 crateMaskBitmap.insert( std::make_pair(
"N1", 20 ) ) ;
153 crateMaskBitmap.insert( std::make_pair(
"N0", 16 ) ) ;
154 crateMaskBitmap.insert( std::make_pair(
"P0", 8 ) ) ;
155 crateMaskBitmap.insert( std::make_pair(
"P1", 4 ) ) ;
156 crateMaskBitmap.insert( std::make_pair(
"P2", 0 ) ) ;
158 std::map< std::string, unsigned int > krateMaskBitmap ;
159 krateMaskBitmap.insert( std::make_pair(
"N2", 16 ) ) ;
160 krateMaskBitmap.insert( std::make_pair(
"N1", 12 ) ) ;
161 krateMaskBitmap.insert( std::make_pair(
"P0", 8 ) ) ;
162 krateMaskBitmap.insert( std::make_pair(
"P1", 4 ) ) ;
163 krateMaskBitmap.insert( std::make_pair(
"P2", 0 ) ) ;
166 for(
int isc = 0 ; isc < 12 ; ++isc )
168 int crateNumber = crateNumbers[ isc ] ;
169 unsigned long crateMask = crateMaskL[ crateNumber ] ;
170 if ( sectorNames[ isc ] ==
"R" ) crateMask = crateMaskR[ crateNumber ] ;
171 unsigned long krateMask = krateMaskL[ crateNumber ] ;
172 if ( sectorNames[ isc ] ==
"R" ) krateMask = krateMaskR[ crateNumber ] ;
173 std::cout <<
"isc " << isc <<
" icr " << crateNumber << std::endl ;
176 for(
int iwh = 0 ; iwh < 6 ; ++iwh )
179 sectorNames[ isc ] + wheelNames[ iwh ] ;
181 unsigned int maskBit = 30 ;
182 std::map< std::string, unsigned int >::const_iterator itr =
183 crateMaskBitmap.find( wheelNames[ iwh ] ) ;
184 if( itr != crateMaskBitmap.end() ) maskBit = itr->second ;
186 unsigned long phtfEnabled = ( crateMask >> maskBit ) & 0xF ;
188 if ( wheelNames[ iwh ] ==
"P2" ) phtfEnabled += ( crateMask >> 24 ) & 0x10 ;
189 if ( wheelNames[ iwh ] ==
"N2" ) phtfEnabled += ( crateMask >> 25 ) & 0x10 ;
192 <<
") of mask " << std::hex << crateMask <<
" is " 193 << std::hex << phtfEnabled << std::endl ;
195 int nwh = wheelNumbers[ iwh ] ;
197 unsigned long chmask = phtfEnabled & 0x1;
198 std::cout <<
" INREC_CHDIS_ST1 " << 1-chmask ;
199 pDTTFMasks->set_inrec_chdis_st1( nwh, isc, 1-chmask ) ;
200 chmask = ( phtfEnabled >> 1 ) & 0x1;
201 std::cout <<
" INREC_CHDIS_ST2 " << 1-chmask ;
202 pDTTFMasks->set_inrec_chdis_st2( nwh, isc, 1-chmask ) ;
203 chmask = ( phtfEnabled >> 2 ) & 0x1;
204 std::cout <<
" INREC_CHDIS_ST3 " << 1-chmask ;
205 pDTTFMasks->set_inrec_chdis_st3( nwh, isc, 1-chmask ) ;
206 chmask = ( phtfEnabled >> 3 ) & 0x1;
207 std::cout <<
" INREC_CHDIS_ST4 " << 1-chmask ;
208 pDTTFMasks->set_inrec_chdis_st4( nwh, isc, 1-chmask ) ;
209 chmask = ( phtfEnabled >> 4 ) & 0x1;
210 std::cout <<
" INREC_CHDIS_CSC " << 1-chmask << std::endl ;
211 pDTTFMasks->set_inrec_chdis_csc( nwh, isc, 1-chmask ) ;
213 if ( wheelNames[ iwh ] ==
"N0" ) continue ;
216 itr = krateMaskBitmap.find( wheelNames[ iwh ] ) ;
217 if( itr != krateMaskBitmap.end() ) maskBit = itr->second ;
219 unsigned long ettfEnabled = ( krateMask >> maskBit ) & 0x7 ;
222 <<
") of mask " << std::hex << krateMask <<
" is " 223 << std::hex << ettfEnabled << std::endl ;
225 chmask = ettfEnabled & 0x1;
226 std::cout <<
" ETSOC_CHDIS_ST1 " << 1-chmask ;
227 pDTTFMasks->set_etsoc_chdis_st1( nwh, isc, 1-chmask ) ;
228 chmask = ( ettfEnabled >> 1 ) & 0x1;
229 std::cout <<
" ETSOC_CHDIS_ST2 " << 1-chmask ;
230 pDTTFMasks->set_etsoc_chdis_st2( nwh, isc, 1-chmask ) ;
231 chmask = ( ettfEnabled >> 2 ) & 0x1;
232 std::cout <<
" ETSOC_CHDIS_ST3 " << 1-chmask << std::endl ;
233 pDTTFMasks->set_etsoc_chdis_st3( nwh, isc, 1-chmask ) ;
bool fillVariable(const std::string &columnName, T &outputVariable) const
const QueryResults singleAttribute(const T &data) const
virtual std::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="")
l1t::OMDSReader m_omdsReader
DTTFMasksOnlineProd(const edm::ParameterSet &)
#define DEFINE_FWK_EVENTSETUP_MODULE(type)