10 ATH_MSG_DEBUG(
"Initializing JfexSimMonitorAlgorithm algorithm with name: "<<
name());
67 return StatusCode::SUCCESS;
76 if(larBadChan.isValid()) {
77 timeSince = ctx.eventID().time_stamp() - larBadChan.getRange().start().time_stamp();
78 timeUntil = larBadChan.getRange().stop().time_stamp() - ctx.eventID().time_stamp();
87 static constexpr
int jJmaxTobs = 7;
88 static constexpr
int jTAUmaxTobs = 6;
89 static constexpr
int jEMmaxTobs = 5;
99 return StatusCode::SUCCESS;
109 const EventContext& ctx,
bool simReadyFlag,
size_t maxTobs)
const {
111 if(!tobsDataCont.isValid()) {
115 if(!tobsSimCont.isValid()) {
119 bool mismatches =
false;
131 auto mask = (
label==
"jTE") ? 0x7FFFFFFE : 0xFFFFFFFE;
135 std::map<std::pair<uint8_t,uint8_t>,std::multiset<uint16_t>> tobEts_byFpga;
137 unsigned zeroTobs1 = 0;
138 unsigned zeroTobs2 = 0;
139 for(
const auto tob1 : *tobsDataCont) {
141 auto word1 = tob1->tobWord();
142 auto jfex1 = tob1->jFexNumber();
143 auto fpga1 = tob1->fpgaNumber();
145 for (
const auto tob2 : *tobsSimCont) {
146 if(
word1==0 || ((
word1&
mask) == (tob2->tobWord()&
mask) && jfex1 == tob2->jFexNumber() && fpga1 == tob2->fpgaNumber())) {
157 if(tobEts_byFpga.empty()) {
158 for (
const auto tob: *tobsSimCont) {
161 tobEts_byFpga[std::pair(tob->jFexNumber(), tob->fpgaNumber())].insert(
tobEt(tob));
166 if(
auto itr = tobEts_byFpga.find(std::pair(jfex1,fpga1)); itr != tobEts_byFpga.end()
167 && itr->second.size() == maxTobs
168 && (*itr->second.begin())==
tobEt(tob1)
183 for (
const auto tob2: *tobsSimCont) {
184 if (tob2->tobWord() == 0) {
190 if(tobsSimCont.isValid() && (tobsDataCont->size() - zeroTobs1) < (tobsSimCont->size() - zeroTobs2) ) {
201 auto itr = m_firstEvents.find(lbn);
202 if(itr==m_firstEvents.end()) {
204 itr = m_firstEvents.find(lbn);
206 lbnString = itr->second;
208 std::vector<float> detas{};std::vector<float> setas{};
209 std::vector<float> dphis{};std::vector<float> sphis{};
210 std::vector<unsigned int> dword0s{};std::vector<unsigned int> sword0s{};
220 std::cout <<
"LBN: " << std::string(lbnString) <<
" EventNumber: " << ULong64_t(evtNumber) <<
" signature: " <<
label << std::endl;
221 std::cout <<
" data : " << std::hex;
222 for (
const auto w: dword0s) std::cout <<
w <<
" ";
223 std::cout << std::endl <<
" sim : ";
224 for (
const auto w: sword0s) std::cout <<
w <<
" ";
225 std::cout << std::endl << std::dec;
228 fill(
"mismatches",tobMismatched,lbn,lbnString,evtNumber,dtobEtas,dtobPhis,dtobWord0s,stobEtas,stobPhis,stobWord0s,Signature,eventType,IsDataTowers,IsEmulatedTowers,simReady,eventType);
229 fill(
"mismatches_count",lbn,Signature,simReady,eventType);
232 fill(
"mismatches",lbn,Signature,tobMismatched,simReady,eventType);
240 etas.clear();phis.clear();word0s.clear();
243 etas.reserve(tobs->size());
244 phis.reserve(tobs->size());
245 word0s.reserve(tobs->size());
246 std::vector<SortableTob> sortedTobs;
247 sortedTobs.reserve(tobs->size());
249 sortedTobs.emplace_back(
SortableTob{tob->tobWord(),0.,0.});
251 std::sort(sortedTobs.begin(),sortedTobs.end(),[](
const SortableTob& lhs,
const SortableTob& rhs) { return lhs.word0<rhs.word0; });
252 for(
const auto& tob : sortedTobs) {
253 etas.push_back(tob.eta);
254 phis.push_back(tob.phi);
255 word0s.push_back(tob.word0);
260 etas.clear();phis.clear();word0s.clear();
263 etas.reserve(tobs->size());
264 phis.reserve(tobs->size());
265 word0s.reserve(tobs->size());
266 std::vector<SortableTob> sortedTobs;
267 sortedTobs.reserve(tobs->size());
268 for(
const auto tob : *tobs) {
269 sortedTobs.emplace_back(SortableTob{tob->tobWord(),0.,0.});
271 std::sort(sortedTobs.begin(),sortedTobs.end(),[](
const SortableTob& lhs,
const SortableTob& rhs) { return lhs.word0<rhs.word0; });
272 for(
const auto& tob : sortedTobs) {
273 etas.push_back(tob.eta);
274 phis.push_back(tob.phi);
275 word0s.push_back(tob.word0);