39 std::unique_ptr< L1MuDTTFMasks >
newObject(
69 std::unique_ptr< L1MuDTTFMasks >
72 auto pDTTFMasks = std::make_unique< L1MuDTTFMasks >() ;
79 std::vector< std::string > crateMaskColumns ;
80 crateMaskColumns.push_back(
"WEDGE_CRATE_1" ) ;
81 crateMaskColumns.push_back(
"WEDGE_CRATE_2" ) ;
82 crateMaskColumns.push_back(
"WEDGE_CRATE_3" ) ;
83 crateMaskColumns.push_back(
"WEDGE_CRATE_4" ) ;
84 crateMaskColumns.push_back(
"WEDGE_CRATE_5" ) ;
85 crateMaskColumns.push_back(
"WEDGE_CRATE_6" ) ;
86 crateMaskColumns.push_back(
"WEDGE_CRATE_1_E" ) ;
87 crateMaskColumns.push_back(
"WEDGE_CRATE_2_E" ) ;
88 crateMaskColumns.push_back(
"WEDGE_CRATE_3_E" ) ;
89 crateMaskColumns.push_back(
"WEDGE_CRATE_4_E" ) ;
90 crateMaskColumns.push_back(
"WEDGE_CRATE_5_E" ) ;
91 crateMaskColumns.push_back(
"WEDGE_CRATE_6_E" ) ;
97 "DTTF_RUN_SETTINGS.ID",
104 <<
"Problem with L1MuDTTFMasks key " << objectKey ;
105 return std::unique_ptr< L1MuDTTFMasks >() ;
109 unsigned long crateMaskL[ 6 ] ;
110 unsigned long crateMaskR[ 6 ] ;
111 unsigned long krateMaskL[ 6 ] ;
112 unsigned long krateMaskR[ 6 ] ;
113 for(
int icrate = 0 ; icrate < 6 ; ++icrate )
116 crateMaskResults.
fillVariable( crateMaskColumns[ icrate ],
119 crateMaskL[ icrate ] = std::strtol( crateMask.c_str(), &pEnd, 16 ) ;
120 crateMaskR[ icrate ] = std::strtol( pEnd, (
char **)
nullptr, 16 ) ;
122 crateMaskResults.
fillVariable( crateMaskColumns[ icrate+6 ],
124 krateMaskL[ icrate ] = std::strtol( crateMask.c_str(), &pEnd, 16 ) ;
125 krateMaskR[ icrate ] = std::strtol( pEnd, (
char **)
nullptr, 16 ) ;
127 std::cout <<
"Crate " << icrate <<
" masks" 128 <<
" L: " << std::hex << crateMaskL[ icrate ]
129 <<
" " << std::hex << krateMaskL[ icrate ]
130 <<
" R: " << std::hex << crateMaskR[ icrate ]
131 <<
" " << std::hex << krateMaskR[ icrate ] << std::endl ;
136 "R",
"L",
"R",
"L",
"L",
"R",
"L",
"R",
"R",
"L",
"R",
"L" } ;
139 int crateNumbers[ 12 ] = { 3, 3, 4, 4, 5, 5, 2, 2, 1, 1, 0, 0 } ;
142 int wheelNumbers[ 6 ] = { -3, -2, -1, 1, 2, 3 } ;
145 std::string wheelNames[ 6 ] = {
"N2",
"N1",
"N0",
"P0",
"P1",
"P2" } ;
148 std::map< std::string, unsigned int > crateMaskBitmap ;
149 crateMaskBitmap.insert( std::make_pair(
"N2", 24 ) ) ;
150 crateMaskBitmap.insert( std::make_pair(
"N1", 20 ) ) ;
151 crateMaskBitmap.insert( std::make_pair(
"N0", 16 ) ) ;
152 crateMaskBitmap.insert( std::make_pair(
"P0", 8 ) ) ;
153 crateMaskBitmap.insert( std::make_pair(
"P1", 4 ) ) ;
154 crateMaskBitmap.insert( std::make_pair(
"P2", 0 ) ) ;
156 std::map< std::string, unsigned int > krateMaskBitmap ;
157 krateMaskBitmap.insert( std::make_pair(
"N2", 16 ) ) ;
158 krateMaskBitmap.insert( std::make_pair(
"N1", 12 ) ) ;
159 krateMaskBitmap.insert( std::make_pair(
"P0", 8 ) ) ;
160 krateMaskBitmap.insert( std::make_pair(
"P1", 4 ) ) ;
161 krateMaskBitmap.insert( std::make_pair(
"P2", 0 ) ) ;
164 for(
int isc = 0 ; isc < 12 ; ++isc )
166 int crateNumber = crateNumbers[ isc ] ;
167 unsigned long crateMask = crateMaskL[ crateNumber ] ;
168 if ( sectorNames[ isc ] ==
"R" ) crateMask = crateMaskR[ crateNumber ] ;
169 unsigned long krateMask = krateMaskL[ crateNumber ] ;
170 if ( sectorNames[ isc ] ==
"R" ) krateMask = krateMaskR[ crateNumber ] ;
171 std::cout <<
"isc " << isc <<
" icr " << crateNumber << std::endl ;
174 for(
int iwh = 0 ; iwh < 6 ; ++iwh )
177 sectorNames[ isc ] + wheelNames[ iwh ] ;
179 unsigned int maskBit = 30 ;
180 std::map< std::string, unsigned int >::const_iterator itr =
181 crateMaskBitmap.find( wheelNames[ iwh ] ) ;
182 if( itr != crateMaskBitmap.end() ) maskBit = itr->second ;
184 unsigned long phtfEnabled = ( crateMask >> maskBit ) & 0xF ;
186 if ( wheelNames[ iwh ] ==
"P2" ) phtfEnabled += ( crateMask >> 24 ) & 0x10 ;
187 if ( wheelNames[ iwh ] ==
"N2" ) phtfEnabled += ( crateMask >> 25 ) & 0x10 ;
190 <<
") of mask " << std::hex << crateMask <<
" is " 191 << std::hex << phtfEnabled << std::endl ;
193 int nwh = wheelNumbers[ iwh ] ;
195 unsigned long chmask = phtfEnabled & 0x1;
196 std::cout <<
" INREC_CHDIS_ST1 " << 1-chmask ;
197 pDTTFMasks->set_inrec_chdis_st1( nwh, isc, 1-chmask ) ;
198 chmask = ( phtfEnabled >> 1 ) & 0
x1;
199 std::cout <<
" INREC_CHDIS_ST2 " << 1-chmask ;
200 pDTTFMasks->set_inrec_chdis_st2( nwh, isc, 1-chmask ) ;
201 chmask = ( phtfEnabled >> 2 ) & 0
x1;
202 std::cout <<
" INREC_CHDIS_ST3 " << 1-chmask ;
203 pDTTFMasks->set_inrec_chdis_st3( nwh, isc, 1-chmask ) ;
204 chmask = ( phtfEnabled >> 3 ) & 0
x1;
205 std::cout <<
" INREC_CHDIS_ST4 " << 1-chmask ;
206 pDTTFMasks->set_inrec_chdis_st4( nwh, isc, 1-chmask ) ;
207 chmask = ( phtfEnabled >> 4 ) & 0
x1;
208 std::cout <<
" INREC_CHDIS_CSC " << 1-chmask << std::endl ;
209 pDTTFMasks->set_inrec_chdis_csc( nwh, isc, 1-chmask ) ;
211 if ( wheelNames[ iwh ] ==
"N0" ) continue ;
214 itr = krateMaskBitmap.find( wheelNames[ iwh ] ) ;
215 if( itr != krateMaskBitmap.end() ) maskBit = itr->second ;
217 unsigned long ettfEnabled = ( krateMask >> maskBit ) & 0x7 ;
220 <<
") of mask " << std::hex << krateMask <<
" is " 221 << std::hex << ettfEnabled << std::endl ;
223 chmask = ettfEnabled & 0x1;
224 std::cout <<
" ETSOC_CHDIS_ST1 " << 1-chmask ;
225 pDTTFMasks->set_etsoc_chdis_st1( nwh, isc, 1-chmask ) ;
226 chmask = ( ettfEnabled >> 1 ) & 0
x1;
227 std::cout <<
" ETSOC_CHDIS_ST2 " << 1-chmask ;
228 pDTTFMasks->set_etsoc_chdis_st2( nwh, isc, 1-chmask ) ;
229 chmask = ( ettfEnabled >> 2 ) & 0
x1;
230 std::cout <<
" ETSOC_CHDIS_ST3 " << 1-chmask << std::endl ;
231 pDTTFMasks->set_etsoc_chdis_st3( nwh, isc, 1-chmask ) ;
std::unique_ptr< L1MuDTTFMasks > newObject(const std::string &objectKey) override
bool fillVariable(const std::string &columnName, T &outputVariable) const
const QueryResults singleAttribute(const T &data) const
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
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
DTTFMasksOnlineProd(const edm::ParameterSet &)
~DTTFMasksOnlineProd() override