10 ATH_MSG_DEBUG(
"Initializing JfexSimMonitorAlgorithm algorithm with name: "<<
name());
59 return StatusCode::SUCCESS;
68 if(larBadChan.isValid()) {
69 timeSince = ctx.eventID().time_stamp() - larBadChan.getRange().start().time_stamp();
70 timeUntil = larBadChan.getRange().stop().time_stamp() - ctx.eventID().time_stamp();
79 static constexpr
int jJmaxTobs = 7;
80 static constexpr
int jTAUmaxTobs = 6;
81 static constexpr
int jEMmaxTobs = 5;
91 return StatusCode::SUCCESS;
101 const EventContext& ctx,
bool simReadyFlag,
size_t maxTobs)
const {
103 if(!tobsDataCont.isValid()) {
107 if(!tobsSimCont.isValid()) {
111 bool mismatches =
false;
123 auto mask = (
label==
"jTE") ? 0x7FFFFFFE : 0xFFFFFFFE;
127 std::map<std::pair<uint8_t,uint8_t>,std::multiset<uint16_t>> tobEts_byFpga;
129 unsigned zeroTobs1 = 0;
130 unsigned zeroTobs2 = 0;
131 for(
const auto tob1 : *tobsDataCont) {
133 auto word1 = tob1->tobWord();
134 auto jfex1 = tob1->jFexNumber();
135 auto fpga1 = tob1->fpgaNumber();
137 for (
const auto tob2 : *tobsSimCont) {
138 if(
word1==0 || ((
word1&
mask) == (tob2->tobWord()&
mask) && jfex1 == tob2->jFexNumber() && fpga1 == tob2->fpgaNumber())) {
149 if(tobEts_byFpga.empty()) {
150 for (
const auto tob: *tobsSimCont) {
153 tobEts_byFpga[std::pair(tob->jFexNumber(), tob->fpgaNumber())].insert(
tobEt(tob));
158 if(
auto itr = tobEts_byFpga.find(std::pair(jfex1,fpga1)); itr != tobEts_byFpga.end()
159 && itr->second.size() == maxTobs
160 && (*itr->second.begin())==
tobEt(tob1)
175 for (
const auto tob2: *tobsSimCont) {
176 if (tob2->tobWord() == 0) {
182 if(tobsSimCont.isValid() && (tobsDataCont->size() - zeroTobs1) < (tobsSimCont->size() - zeroTobs2) ) {
193 auto itr = m_firstEvents.find(lbn);
194 if(itr==m_firstEvents.end()) {
196 itr = m_firstEvents.find(lbn);
198 lbnString = itr->second;
200 std::vector<float> detas{};std::vector<float> setas{};
201 std::vector<float> dphis{};std::vector<float> sphis{};
202 std::vector<unsigned int> dword0s{};std::vector<unsigned int> sword0s{};
212 std::cout <<
"LBN: " << std::string(lbnString) <<
" EventNumber: " << ULong64_t(evtNumber) <<
" signature: " <<
label << std::endl;
213 std::cout <<
" data : " << std::hex;
214 for (
const auto w: dword0s) std::cout <<
w <<
" ";
215 std::cout << std::endl <<
" sim : ";
216 for (
const auto w: sword0s) std::cout <<
w <<
" ";
217 std::cout << std::endl << std::dec;
220 fill(
"mismatches",tobMismatched,lbn,lbnString,evtNumber,dtobEtas,dtobPhis,dtobWord0s,stobEtas,stobPhis,stobWord0s,Signature,eventType,IsDataTowers,IsEmulatedTowers,simReady,eventType);
221 fill(
"mismatches_count",lbn,Signature,simReady,eventType);
224 fill(
"mismatches",lbn,Signature,tobMismatched,simReady,eventType);
232 etas.clear();phis.clear();word0s.clear();
235 etas.reserve(tobs->size());
236 phis.reserve(tobs->size());
237 word0s.reserve(tobs->size());
238 std::vector<SortableTob> sortedTobs;
239 sortedTobs.reserve(tobs->size());
241 sortedTobs.emplace_back(
SortableTob{tob->tobWord(),0.,0.});
243 std::sort(sortedTobs.begin(),sortedTobs.end(),[](
const SortableTob& lhs,
const SortableTob& rhs) { return lhs.word0<rhs.word0; });
244 for(
const auto& tob : sortedTobs) {
245 etas.push_back(tob.eta);
246 phis.push_back(tob.phi);
247 word0s.push_back(tob.word0);
252 etas.clear();phis.clear();word0s.clear();
255 etas.reserve(tobs->size());
256 phis.reserve(tobs->size());
257 word0s.reserve(tobs->size());
258 std::vector<SortableTob> sortedTobs;
259 sortedTobs.reserve(tobs->size());
260 for(
const auto tob : *tobs) {
261 sortedTobs.emplace_back(SortableTob{tob->tobWord(),0.,0.});
263 std::sort(sortedTobs.begin(),sortedTobs.end(),[](
const SortableTob& lhs,
const SortableTob& rhs) { return lhs.word0<rhs.word0; });
264 for(
const auto& tob : sortedTobs) {
265 etas.push_back(tob.eta);
266 phis.push_back(tob.phi);
267 word0s.push_back(tob.word0);