101 std::unique_ptr<ProcessInputSignal> signal;
110 signal = std::make_unique<RBCProcessRPCDigis>(rpcGeometry, pIn);
113 iEvent.
getByLabel(
"simMuonRPCDigis",
"RPCDigiSimLink", simIn);
120 signal = std::make_unique<RBCProcessRPCSimDigis>(rpcGeometry, simIn);
123 LogDebug(
"RPCTechnicalTrigger") <<
"signal object created" <<
'\n';
126 edm::LogError(
"RPCTechnicalTrigger") <<
"cannot read hardware configuration \n";
138 auto*
input = signal->retrievedata();
140 std::vector<L1GtTechnicalTrigger> ttVec(
m_ttBits.size());
143 std::bitset<5> triggerbits;
145 std::vector<std::unique_ptr<TTUResults>> serializedInfoLine1;
146 std::vector<std::unique_ptr<TTUResults>> serializedInfoLine2;
152 for (
auto firstSector : s_quadrants)
156 for (
auto const&
out :
m_ttu[
k].m_triggerBxVec)
157 serializedInfoLine1.emplace_back(std::make_unique<TTUResults>(
k,
out.m_bx,
out.m_trigger[0],
out.m_trigger[1]));
158 m_ttu[
k].clearTriggerResponse();
162 serializedInfoLine2.push_back(
163 std::make_unique<TTUResults>(
k,
out.m_bx,
out.m_trigger[0],
out.m_trigger[1],
out.m_wedge));
172 infoSize = serializedInfoLine1.size();
174 auto sortByBx = [](
auto& iLHS,
auto& iRHS) {
return iLHS->m_bx < iRHS->m_bx; };
175 std::sort(serializedInfoLine1.begin(), serializedInfoLine1.end(), sortByBx);
178 for (
auto& ttu : serializedInfoLine1) {
179 if (
abs(ttu->m_bx) <= 1)
180 std::cout <<
"RPCTechnicalTrigger> " << ttu->m_ttuidx <<
'\t' << ttu->m_bx <<
'\t' << ttu->m_trigWheel1 <<
'\t' 181 << ttu->m_trigWheel2 <<
'\n';
185 bool has_bx0 =
false;
188 bx = serializedInfoLine1[
k]->m_bx;
191 triggerbits.set(0, serializedInfoLine1[
k]->m_trigWheel2);
192 triggerbits.set(1, serializedInfoLine1[
k]->m_trigWheel1);
193 triggerbits.set(2, serializedInfoLine1[
k + 1]->m_trigWheel1);
194 triggerbits.set(3, serializedInfoLine1[
k + 2]->m_trigWheel1);
195 triggerbits.set(4, serializedInfoLine1[
k + 2]->m_trigWheel2);
197 bool five_wheels_OR = triggerbits.any();
217 infoSize = serializedInfoLine2.size();
219 std::sort(serializedInfoLine2.begin(), serializedInfoLine2.end(), sortByBx);
222 for (
auto& ttu : serializedInfoLine2) {
223 if (
abs(ttu->m_bx) <= 1)
224 std::cout <<
"RPCTechnicalTrigger> " << ttu->m_ttuidx <<
'\t' << ttu->m_bx <<
'\t' << ttu->m_trigWheel1 <<
'\t' 225 << ttu->m_trigWheel2 <<
'\t' << ttu->m_wedge <<
'\n';
229 auto ttuResultsByQuadrant =
convertToMap(serializedInfoLine2);
231 std::bitset<8> triggerCoincidence;
232 triggerCoincidence.reset();
236 triggerCoincidence.set(0, result);
240 triggerCoincidence.set(1, result);
244 triggerCoincidence.set(2, result);
248 triggerCoincidence.set(3, result);
252 triggerCoincidence.set(4, result);
256 triggerCoincidence.set(5, result);
260 triggerCoincidence.set(6, result);
264 triggerCoincidence.set(7, result);
266 bool five_wheels_OR = triggerCoincidence.any();
269 std::cout <<
"RPCTechnicalTrigger> pointing trigger: " << five_wheels_OR <<
'\n';
274 triggerCoincidence.reset();
280 LogDebug(
"RPCTechnicalTrigger") <<
"RPCTechnicalTrigger> end of event loop" << std::endl;
284 output->setGtTechnicalTrigger(ttVec);
289 LogDebug(
"RPCTechnicalTrigger") <<
"RPCTechnicalTrigger> end of event loop" << std::endl;
bool searchCoincidence(int, int, std::map< int, TTUResults * > const &ttuResultsByQuandrant) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
const edm::InputTag m_rpcDigiLabel
const int m_useRPCSimLink
bool getByToken(EDGetToken token, Handle< PROD > &result) const
static std::string const input
Abs< T >::type abs(const T &t)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) 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::map< int, TTUResults * > convertToMap(const std::vector< std::unique_ptr< TTUResults >> &) const
std::array< TTUEmulator, kMaxTtuBoards > m_ttuRbcLine