103 std::unique_ptr<ProcessInputSignal> signal;
112 signal = std::make_unique<RBCProcessRPCDigis>(rpcGeometry, pIn);
115 iEvent.getByLabel(
"simMuonRPCDigis",
"RPCDigiSimLink", simIn);
122 signal = std::make_unique<RBCProcessRPCSimDigis>(rpcGeometry, simIn);
125 LogDebug(
"RPCTechnicalTrigger") <<
"signal object created" <<
'\n';
128 edm::LogError(
"RPCTechnicalTrigger") <<
"cannot read hardware configuration \n";
140 auto*
input = signal->retrievedata();
142 std::vector<L1GtTechnicalTrigger> ttVec(
m_ttBits.size());
145 std::bitset<5> triggerbits;
147 std::vector<std::unique_ptr<TTUResults>> serializedInfoLine1;
148 std::vector<std::unique_ptr<TTUResults>> serializedInfoLine2;
154 for (
auto firstSector : s_quadrants)
158 for (
auto const&
out :
m_ttu[
k].m_triggerBxVec)
159 serializedInfoLine1.emplace_back(std::make_unique<TTUResults>(
k,
out.m_bx,
out.m_trigger[0],
out.m_trigger[1]));
160 m_ttu[
k].clearTriggerResponse();
164 serializedInfoLine2.push_back(
165 std::make_unique<TTUResults>(
k,
out.m_bx,
out.m_trigger[0],
out.m_trigger[1],
out.m_wedge));
174 infoSize = serializedInfoLine1.size();
176 auto sortByBx = [](
auto& iLHS,
auto& iRHS) {
return iLHS->m_bx < iRHS->m_bx; };
177 std::sort(serializedInfoLine1.begin(), serializedInfoLine1.end(), sortByBx);
180 for (
auto& ttu : serializedInfoLine1) {
181 if (
abs(ttu->m_bx) <= 1)
182 std::cout <<
"RPCTechnicalTrigger> " << ttu->m_ttuidx <<
'\t' << ttu->m_bx <<
'\t' << ttu->m_trigWheel1 <<
'\t' 183 << ttu->m_trigWheel2 <<
'\n';
187 bool has_bx0 =
false;
190 bx = serializedInfoLine1[
k]->m_bx;
193 triggerbits.set(0, serializedInfoLine1[
k]->m_trigWheel2);
194 triggerbits.set(1, serializedInfoLine1[
k]->m_trigWheel1);
195 triggerbits.set(2, serializedInfoLine1[
k + 1]->m_trigWheel1);
196 triggerbits.set(3, serializedInfoLine1[
k + 2]->m_trigWheel1);
197 triggerbits.set(4, serializedInfoLine1[
k + 2]->m_trigWheel2);
199 bool five_wheels_OR = triggerbits.any();
219 infoSize = serializedInfoLine2.size();
221 std::sort(serializedInfoLine2.begin(), serializedInfoLine2.end(), sortByBx);
224 for (
auto& ttu : serializedInfoLine2) {
225 if (
abs(ttu->m_bx) <= 1)
226 std::cout <<
"RPCTechnicalTrigger> " << ttu->m_ttuidx <<
'\t' << ttu->m_bx <<
'\t' << ttu->m_trigWheel1 <<
'\t' 227 << ttu->m_trigWheel2 <<
'\t' << ttu->m_wedge <<
'\n';
231 auto ttuResultsByQuadrant =
convertToMap(serializedInfoLine2);
233 std::bitset<8> triggerCoincidence;
234 triggerCoincidence.reset();
238 triggerCoincidence.set(0,
result);
242 triggerCoincidence.set(1,
result);
246 triggerCoincidence.set(2,
result);
250 triggerCoincidence.set(3,
result);
254 triggerCoincidence.set(4,
result);
258 triggerCoincidence.set(5,
result);
262 triggerCoincidence.set(6,
result);
266 triggerCoincidence.set(7,
result);
268 bool five_wheels_OR = triggerCoincidence.any();
271 std::cout <<
"RPCTechnicalTrigger> pointing trigger: " << five_wheels_OR <<
'\n';
276 triggerCoincidence.reset();
282 LogDebug(
"RPCTechnicalTrigger") <<
"RPCTechnicalTrigger> end of event loop" << std::endl;
286 output->setGtTechnicalTrigger(ttVec);
291 LogDebug(
"RPCTechnicalTrigger") <<
"RPCTechnicalTrigger> end of event loop" << std::endl;
const edm::InputTag m_rpcDigiLabel
const int m_useRPCSimLink
std::map< int, TTUResults * > convertToMap(const std::vector< std::unique_ptr< TTUResults >> &) const
Log< level::Error, false > LogError
static std::string const input
static constexpr int kMaxTtuBoards
edm::ESGetToken< RPCGeometry, MuonGeometryRecord > m_rpcGeometryToken
Abs< T >::type abs(const T &t)
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
bool searchCoincidence(int, int, std::map< int, TTUResults *> const &ttuResultsByQuandrant) const
std::array< TTUEmulator, kMaxTtuBoards > m_ttu
const edm::EDGetTokenT< RPCDigiCollection > m_rpcDigiToken
const std::vector< unsigned > m_ttBits
const std::vector< std::string > m_ttNames
std::array< TTUEmulator, kMaxTtuBoards > m_ttuRbcLine