10 ATH_MSG_DEBUG(
"Initializing JfexSimMonitorAlgorithm algorithm with name: "<<
name());
60 return StatusCode::SUCCESS;
69 if(larBadChan.isValid()) {
70 timeSince = ctx.eventID().time_stamp() - larBadChan.getRange().start().time_stamp();
71 timeUntil = larBadChan.getRange().stop().time_stamp() - ctx.eventID().time_stamp();
76 if (timeUntil>=0 && timeUntil<=5) {
89 static constexpr
int jJmaxTobs = 7;
90 static constexpr
int jTAUmaxTobs = 6;
91 static constexpr
int jEMmaxTobs = 5;
101 return StatusCode::SUCCESS;
111 const EventContext& ctx,
bool simReadyFlag,
size_t maxTobs)
const {
113 if(!tobsDataCont.isValid()) {
117 if(!tobsSimCont.isValid()) {
121 bool mismatches =
false;
134 auto mask = (
label==
"jTE") ? 0x7FFFFFFE : 0xFFFFFFFE;
138 std::map<std::pair<uint8_t,uint8_t>,std::multiset<uint16_t>> tobEts_byFpga;
140 unsigned zeroTobs1 = 0;
141 unsigned zeroTobs2 = 0;
142 for(
const auto tob1 : *tobsDataCont) {
144 auto word1 = tob1->tobWord();
145 auto jfex1 = tob1->jFexNumber();
146 auto fpga1 = tob1->fpgaNumber();
148 for (
const auto tob2 : *tobsSimCont) {
149 if(
word1==0 || ((
word1&
mask) == (tob2->tobWord()&
mask) && jfex1 == tob2->jFexNumber() && fpga1 == tob2->fpgaNumber())) {
160 if(tobEts_byFpga.empty()) {
161 for (
const auto tob: *tobsSimCont) {
164 tobEts_byFpga[std::pair(tob->jFexNumber(), tob->fpgaNumber())].insert(
tobEt(tob));
169 if(
auto itr = tobEts_byFpga.find(std::pair(jfex1,fpga1)); itr != tobEts_byFpga.end()
170 && itr->second.size() == maxTobs
171 && (*itr->second.begin())==
tobEt(tob1)
186 for (
const auto tob2: *tobsSimCont) {
187 if (tob2->tobWord() == 0) {
193 if(tobsSimCont.isValid() && (tobsDataCont->size() - zeroTobs1) < (tobsSimCont->size() - zeroTobs2) ) {
204 auto itr = m_firstEvents.find(lbn);
205 if(itr==m_firstEvents.end()) {
207 itr = m_firstEvents.find(lbn);
209 lbnString = itr->second;
211 std::vector<float> detas{};std::vector<float> setas{};
212 std::vector<float> dphis{};std::vector<float> sphis{};
213 std::vector<unsigned int> dword0s{};std::vector<unsigned int> sword0s{};
223 std::cout <<
"LBN: " << std::string(lbnString) <<
" EventNumber: " << ULong64_t(evtNumber) <<
" signature: " <<
label << std::endl;
224 std::cout <<
" data : " << std::hex;
225 for (
const auto w: dword0s) std::cout <<
w <<
" ";
226 std::cout << std::endl <<
" sim : ";
227 for (
const auto w: sword0s) std::cout <<
w <<
" ";
228 std::cout << std::endl << std::dec;
232 fill(
"mismatches",simReadyMismatch,tobMismatched,lbn,lbnString,evtNumber,dtobEtas,dtobPhis,dtobWord0s,stobEtas,stobPhis,stobWord0s,Signature,eventType,IsDataTowers,IsEmulatedTowers,simReady,signatureEventType);
235 fill(
"mismatches",lbn,Signature,tobMismatched,simReady,eventType);
243 etas.clear();phis.clear();word0s.clear();
246 etas.reserve(tobs->size());
247 phis.reserve(tobs->size());
248 word0s.reserve(tobs->size());
249 std::vector<SortableTob> sortedTobs;
250 sortedTobs.reserve(tobs->size());
252 sortedTobs.emplace_back(
SortableTob{tob->tobWord(),0.,0.});
254 std::sort(sortedTobs.begin(),sortedTobs.end(),[](
const SortableTob& lhs,
const SortableTob& rhs) { return lhs.word0<rhs.word0; });
255 for(
const auto& tob : sortedTobs) {
256 etas.push_back(tob.eta);
257 phis.push_back(tob.phi);
258 word0s.push_back(tob.word0);
263 etas.clear();phis.clear();word0s.clear();
266 etas.reserve(tobs->size());
267 phis.reserve(tobs->size());
268 word0s.reserve(tobs->size());
269 std::vector<SortableTob> sortedTobs;
270 sortedTobs.reserve(tobs->size());
271 for(
const auto tob : *tobs) {
272 sortedTobs.emplace_back(SortableTob{tob->tobWord(),0.,0.});
274 std::sort(sortedTobs.begin(),sortedTobs.end(),[](
const SortableTob& lhs,
const SortableTob& rhs) { return lhs.word0<rhs.word0; });
275 for(
const auto& tob : sortedTobs) {
276 etas.push_back(tob.eta);
277 phis.push_back(tob.phi);
278 word0s.push_back(tob.word0);