User will overwrite this function. Histogram booking is no longer done in C++. This function is called in execute once the filters are all passed.
56 {
57
58 ATH_MSG_DEBUG(
"MistimedStreamMonitorAlgorith::fillHistograms");
59
60
63
64 unsigned int readoutConfigID = runParameters->runParameters(1)->readoutConfigID();
65 ATH_MSG_DEBUG(
"RunParameters:: readoutConfigID " << readoutConfigID);
66
68
69 unsigned int channelID = 0;
70 unsigned int numFadcSlices = 0;
71 unsigned int l1aFadcSlice = 0;
72 unsigned int readout80ModePpm = 0;
73
74
75 if ( readoutConfigJSON->readoutConfigJSON(readoutConfigID)->channelId() == readoutConfigID){
77 channelID = readoutConfigJSON->readoutConfigJSON(readoutConfigID)->channelId();
78 numFadcSlices = readoutConfigJSON->readoutConfigJSON(readoutConfigID)->numFadcSlices();
79 l1aFadcSlice = readoutConfigJSON->readoutConfigJSON(readoutConfigID)->l1aFadcSlice();
80 readout80ModePpm = readoutConfigJSON->readoutConfigJSON(readoutConfigID)->readout80ModePpm();
85 }
86
87
89 if(!jetElementTES.isValid()){
90 ATH_MSG_ERROR(
"No JetElement container found in TES "<< m_jetElementLocation);
91 return StatusCode::FAILURE;
92 }
93
94
95 SG::ReadHandle<xAOD::CPMTowerContainer> cpmTowerTES(m_cpmTowerLocation, ctx);
96 if(!cpmTowerTES.isValid()){
97 ATH_MSG_ERROR(
"No CPMTower container found in TES "<< m_cpmTowerLocation);
98 return StatusCode::FAILURE;
99 }
100
101
102 SG::ReadHandle<xAOD::TriggerTowerContainer> triggerTowerTES(m_xAODTriggerTowerContainerName, ctx);
103 if(!triggerTowerTES.isValid()){
104 ATH_MSG_ERROR(
"No Trigger Tower container found in TES "<< m_xAODTriggerTowerContainerName);
105 return StatusCode::FAILURE;
106 }
107
108
110 unsigned int currentRunNo = ctx.eventID().run_number();
111 unsigned int currentEventNo = ctx.eventID().event_number();
112
116
117 Monitored::Scalar<int> cutFlowX = Monitored::Scalar<int>("cutFlowX", 0);
118
119
121 fill(m_packageName,cutFlowX);
122
123
124
125 if(readout80ModePpm){
126 if(numFadcSlices < 9){
127 ATH_MSG_DEBUG(
"Number of ADC slices < 9 for 80 MHz readout, algorithm cannot run, aborting...");
128 return StatusCode::SUCCESS;
129 }
130 if(l1aFadcSlice < 4){
131 ATH_MSG_DEBUG(
"L1a readout pointer < 4 for 80 MHz readout, algorithm cannot run, aborting...");
132 return StatusCode::SUCCESS;
133 }
134 if(numFadcSlices - l1aFadcSlice < 4){
135 ATH_MSG_DEBUG(
"L1a readout pointer is at "<< l1aFadcSlice <<
" with "<< numFadcSlices <<
"slices at 80 MHz readout mode, algorithm cannot run, aborting...");
136 return StatusCode::SUCCESS;
137 }
138 }
139 else {
140 if(numFadcSlices < 5){
141 ATH_MSG_DEBUG(
"Number of ADC slices < 5 for 40 MHz readout, algorithm cannot run, aborting...");
142 return StatusCode::SUCCESS;
143 }
144 if(l1aFadcSlice < 2){
145 ATH_MSG_DEBUG(
"L1a readout pointer < 2 for 40 MHz readout, algorithm cannot run, aborting...");
146 return StatusCode::SUCCESS;
147 }
148 if(numFadcSlices - l1aFadcSlice < 2){
149 ATH_MSG_DEBUG(
"L1a readout pointer is at "<< l1aFadcSlice <<
" with "<< numFadcSlices <<
"slices at 40 MHz readout mode, algorithm cannot run, aborting...");
150 return StatusCode::SUCCESS;
151 }
152 }
154 fill(m_packageName,cutFlowX);
155
156
158 ATH_MSG_DEBUG(
"TrigDec don't pass HLT_mistimemonj400_L1All");
159 return StatusCode::SUCCESS;
160 }
161
163 fill(m_packageName,cutFlowX);
164
165
166
167 bool legacyTrigger= false;
168 bool phase1Trigger= false;
169 std::string trigger = "";
170
171 if (m_usephaseI) {
172 for (const auto &item: m_efexItems) {
174 phase1Trigger= true;
175 trigger = "eFex";
176 }
177 }
178 for (const auto &item: m_jfexItems) {
180 phase1Trigger= true;
181 trigger = "jFex";
182 }
183 }
184 for (const auto &item: m_gfexItems) {
186 phase1Trigger= true;
187 trigger = "gFex";
188 }
189 }
190 }
191 else if (m_uselegacy) {
193 legacyTrigger= true;
194 }
195 }
196 else {
197 ATH_MSG_ERROR(
"No system selected, this should not happen, abort.");
198 return StatusCode::FAILURE;
199 }
200
201
202 if ( (legacyTrigger==false) and (phase1Trigger==false) ) {
204 return StatusCode::SUCCESS;
205 }
206
208 fill(m_packageName,cutFlowX);
209
210
211
212 int good3Counter = 0;
213 int good2Counter = 0;
214 int eFexintimeCounter = 0;
215 int eFexoutoftimeCounter = 0;
216 int jFexCounter = 0;
217 int gFexCounter = 0;
218
219 double dEta = 0.,
dPhi = 0., dPhi1 = 0., dR = 0.;
220 double etaIn = 0., phiIn = 0., etIn = 0.;
221 double etaOut = 0., phiOut = 0., etOut = 0.;
222 bool overlap = false;
223
225 if(!jFexSRJetContainer.
isValid()) {
226 ATH_MSG_WARNING(
"No jFex SR Jet container found in storegate "<< m_jFexSRJetContainerKey<<
". Will be skipped!");
227 }
228
229
230
231
232
233
234 std::unique_ptr<xAOD::TriggerTowerContainer> ttContainer = std::make_unique<xAOD::TriggerTowerContainer>();
235 std::unique_ptr<xAOD::TriggerTowerAuxContainer> ttContainerAux = std::make_unique<xAOD::TriggerTowerAuxContainer>();
236 ttContainer->setStore(ttContainerAux.get());
237
238 static const SG::Accessor<float> pulseClassificationAcc("pulseClassification");
239
240
242
243 float ttPulseCategory = 0;
244 const std::vector<uint16_t>& ttADC = (
tt)->
adc();
245 std::vector<uint16_t> readoutCorrectedADC;
246 if(!readout80ModePpm){
247
248 readoutCorrectedADC.push_back(ttADC.at(l1aFadcSlice-2));
249 readoutCorrectedADC.push_back(ttADC.at(l1aFadcSlice-1));
250 readoutCorrectedADC.push_back(ttADC.at(l1aFadcSlice));
251 readoutCorrectedADC.push_back(ttADC.at(l1aFadcSlice+1));
252 readoutCorrectedADC.push_back(ttADC.at(l1aFadcSlice+2));
253 }
254 else{
255 readoutCorrectedADC.push_back(ttADC.at(l1aFadcSlice-4));
256 readoutCorrectedADC.push_back(ttADC.at(l1aFadcSlice-2));
257 readoutCorrectedADC.push_back(ttADC.at(l1aFadcSlice));
258 readoutCorrectedADC.push_back(ttADC.at(l1aFadcSlice+2));
259 readoutCorrectedADC.push_back(ttADC.at(l1aFadcSlice+4));
260 }
261
262
263 auto maxValIterator = std::max_element(readoutCorrectedADC.begin(), readoutCorrectedADC.end());
264 int maxADCval = *maxValIterator;
265 int adcPeakPositon = std::distance(std::begin(readoutCorrectedADC), maxValIterator);
266
267 if(maxADCval < 70){
268 ttPulseCategory = 0.1;
269 }
270 else if(maxADCval == 1023) {
271 ttPulseCategory = 1;
272 }
273 else{
274 bool goodQual =
pulseQuality(readoutCorrectedADC, adcPeakPositon);
275
276 if(adcPeakPositon == 2){
277 if(goodQual){
278
279 good2Counter++;
280 ttPulseCategory = 3;
281 }
282 else{
283
284 ttPulseCategory = 4;
285 }
286 }
287 else if(adcPeakPositon == 3){
288 if(goodQual){
289
290 good3Counter++;
291 ttPulseCategory = 5;
292 }
293 else{
294
295 ttPulseCategory = 6;
296 }
297 }
298 else{
299
300 ttPulseCategory = 2;
301 }
302
303 if (trigger == "jFex") {
306 for(auto tob : *jFexSRJetRoI) {
307 etaIn = tob->eta();
308 phiIn = tob->phi();
309 etIn = tob->tobEt()/5;
310
311 if( (adcPeakPositon == 3) and (goodQual) ) {
314 dEta = std::abs(etaIn-etaOut);
315 dPhi = std::abs(phiIn-phiOut);
316 if ((phiIn < 0) and (phiOut > 0)){
317 dPhi1 = std::abs((phiIn+2*
M_PI)-phiOut);
318 if (dPhi1 < dPhi) {
320 }
321 }
322 else if ((phiIn > 0) and (phiOut < 0)){
323 dPhi1 = std::abs(phiIn-(phiOut+2*
M_PI));
324 if (dPhi1 < dPhi) {
326 }
327 }
328 dR = TMath::Sqrt(dEta*dEta+dPhi*dPhi);
329 if ((dR < .2) and (etIn > 160.)) {
330 overlap = true;
331 }
332 }
333 }
334 }
335
336 if (trigger == "gFex") {
337
338 for (const auto& key : m_gFexJetTobKeyList){
339 SG::ReadHandle<xAOD::gFexJetRoIContainer> jetContainer (key, ctx);
340
341 if ( !jetContainer.isValid() ) {
343 }
344 else {
347 for(auto tob : *gFexJetRoI) {
348 etaIn = tob->eta();
349 phiIn = tob->phi();
350 etIn = tob->gFexTobEt()/10;
351
352 if( (adcPeakPositon == 3) and (goodQual) ) {
355 dEta = std::abs(etaIn-etaOut);
356 dPhi = std::abs(phiIn-phiOut);
357 if ((phiIn < 0) and (phiOut > 0)){
358 dPhi1 = std::abs((phiIn+2*
M_PI)-phiOut);
359 if (dPhi1 < dPhi) {
361 }
362 }
363 else if ((phiIn > 0) and (phiOut < 0)){
364 dPhi1 = std::abs(phiIn-(phiOut+2*
M_PI));
365 if (dPhi1 < dPhi) {
367 }
368 }
369 dR = TMath::Sqrt(dEta*dEta+dPhi*dPhi);
370 if ((dR < .2) and (etIn > 100.)) {
371 overlap = true;
372 }
373 }
374 }
375 }
376 }
377 }
378
379 }
380
381
383 ttContainer->push_back(newTT);
385 pulseClassificationAcc(*newTT) = ttPulseCategory;
386 }
387
388
389 for(auto key : {"L1_eEMxRoI","L1_eEMxRoIOutOfTime"}) {
390
393
394 for(auto tob : *emTobs) {
395 if (tob->et() > 5000) {
396 if (tob->bcn4() == ((ctx.eventID().bunch_crossing_id()) & 0xf )) {
397 eFexintimeCounter++;
398 }
399 else if (tob->bcn4() == (((ctx.eventID().bunch_crossing_id())+1) & 0xf )) {
400 eFexoutoftimeCounter++;
401 }
402 }
403 }
404
405 }
406
407
410 for(auto tob : *gFexLRJetRoI) {
411 if (tob->et() > 50) {
412 gFexCounter++;
413 }
414 }
415
416
419 for(auto tob : *jFexJetRoI) {
420 if (tob->et() > 25) {
421 jFexCounter++;
422 }
423 }
424
425 if ((good3Counter < 2) and (m_isIons == false)) {
426
427 return StatusCode::SUCCESS;
428 }
430 fill(m_packageName,cutFlowX);
431
432 if ((trigger == "eFex") and (eFexoutoftimeCounter < 2)) {
433
434 return StatusCode::SUCCESS;
435 }
437 fill(m_packageName,cutFlowX);
438
439 if( (good2Counter > 3) or
440 ((trigger == "eFex") and (eFexintimeCounter > 3)) or
441 ((trigger == "jFex") and (jFexCounter > 3)) or
442 ((trigger == "gFex") and (gFexCounter > 3)) ){
443
444 return StatusCode::SUCCESS;
445 }
447 fill(m_packageName,cutFlowX);
448
449 if (trigger == "eFex") {
454
455 for(auto tob : *emTobs) {
456 etaIn = tob->eta();
457 phiIn = tob->phi();
458 etIn = tob->et()/1000;
459
460 for(auto tobOut : *emTobsOut) {
461 etaOut = tobOut->eta();
462 phiOut = tobOut->phi();
463 etOut = tobOut->et()/1000;
464
465 dEta = std::abs(etaIn-etaOut);
466 dPhi = std::abs(phiIn-phiOut);
467 if ((phiIn < 0) and (phiOut > 0)){
468 dPhi1 = std::abs((phiIn+2*
M_PI)-phiOut);
469 if (dPhi1 < dPhi) {
471 }
472 }
473 else if ((phiIn > 0) and (phiOut < 0)){
474 dPhi1 = std::abs(phiIn-(phiOut+2*
M_PI));
475 if (dPhi1 < dPhi) {
477 }
478 }
479 dR = TMath::Sqrt(dEta*dEta+dPhi*dPhi);
480 if ((dR < .2) and (etIn > 26.) and (etOut > 26.)){
481 overlap = true;
482 }
483 }
484 }
485 }
486
487 if ((legacyTrigger) and !(phase1Trigger)){
488 overlap = true;
489 }
490
491 if ((overlap==false) and (m_isIons == false)) {
492
493 return StatusCode::SUCCESS;
494 }
496 fill(m_packageName,cutFlowX);
497
498
499
500 std::lock_guard<std::mutex> lock(m_mutex);
501 m_event_counter[lumiNo]+=1;
503
504 if( (m_event_counter[lumiNo] <m_maxEvents) && (eventCounter < m_maxEvents) ){
506
507
508 auto eventMonitor_legacy= Monitored::Scalar<std::string>("eventMonitor_legacy", "Event"+std::to_string(eventCounter)+"="+std::to_string(currentEventNo));
509 auto eventMonitor_phaseI= Monitored::Scalar<std::string>("eventMonitor_phaseI", "Event"+std::to_string(eventCounter)+"_"+trigger+"="+std::to_string(currentEventNo));
510 auto lbMonitor= Monitored::Scalar<std::string>("lbMonitor", std::to_string(lumiNo));
512 if (legacyTrigger) {
513 fill(groupName, eventMonitor_legacy, lbMonitor );
514 }
515 if (phase1Trigger) {
516 fill(groupName, eventMonitor_phaseI, lbMonitor );
517 }
518
519
520 std::vector<MonitorTT> vecMonTTDecor;
521
522
523
526 ATH_MSG_DEBUG(
"tt->pulseClassification :: " << pulseClassificationAcc(*tt));
527 }
528
529 groupName =
"EventofInterest_" + std::to_string(eventCounter) +
"_";
530 auto bcidWord = Monitored::Scalar<uint8_t>("bcidWord", 0);
531 auto pulseCat = Monitored::Scalar<float>("pulseCat", 0);
532
533 for (auto& myTower : vecMonTTDecor) {
536 pulseCat = pulseClassificationAcc(*myTower.tower);
537 bcidWord = (myTower.tower)->bcidVec()[0];
539
540
541 if (layer == 0) {
543 if(pulseCat > 0.5 && bcidWord > 0) {
545 }
546 }
547 else if(layer == 1 ) {
549 if(pulseCat > 0.5 && bcidWord > 0 )
ATH_CHECK(
fillPPMEtaPhi(myTower, groupName+
"TT_HAD",
"bcidWord", bcidWord) );
550 }
551 }
552
553
554
555 std::vector<MonitorCPM> vecMonCPM;
558 }
559
560
561 auto etalut = Monitored::Scalar<double>("etalut", 0);
562 auto philut = Monitored::Scalar<double>("philut", 0);
563
564
565 auto emLUT0 = Monitored::Scalar<int>("emLUT0", 0);
566 auto emLUT1 = Monitored::Scalar<int>("emLUT1", 0);
567 auto emLUT2 = Monitored::Scalar<int>("emLUT2", 0);
568 auto hadLUT0 = Monitored::Scalar<int>("hadLUT0", 0);
569 auto hadLUT1 = Monitored::Scalar<int>("hadLUT1", 0);
570 auto hadLUT2 = Monitored::Scalar<int>("hadLUT2", 0);
571
572
573 for (auto& myTower : vecMonCPM) {
574
575 std::vector<uint8_t> cpmEMenergy = (myTower.tower)->emEnergyVec();
576 std::vector<uint8_t> cpmHADenergy = (myTower.tower)->hadEnergyVec();
577
578 etalut = myTower.etaScaled;
579
580 for (
auto phi: myTower.phiScaled) {
581
583
584 if(cpmEMenergy.size() > 2){
585 ATH_MSG_DEBUG(
"CPM :: emLUT0 :: " <<
static_cast<unsigned>(cpmEMenergy.at(0)) <<
":: emLUT1 :: " <<
static_cast<unsigned>(cpmEMenergy.at(1)) <<
":: emLUT2 :: " <<
static_cast<unsigned>(cpmEMenergy.at(2)));
586
587 emLUT0 = static_cast<int>(cpmEMenergy.at(0));
588 if(cpmEMenergy.at(0) > 0)
fill(groupName+
"lut_EM0",etalut,philut, emLUT0);
589
590 emLUT1 = static_cast<int>(cpmEMenergy.at(1));
591 if(cpmEMenergy.at(1) > 0)
fill(groupName+
"lut_EM1",etalut,philut, emLUT1);
592
593 emLUT2 = static_cast<int>(cpmEMenergy.at(2));
594 if(cpmEMenergy.at(2) > 0)
fill(groupName+
"lut_EM2",etalut,philut, emLUT2);
595 }
596 if(cpmHADenergy.size() > 2){
597 ATH_MSG_DEBUG(
"CPM :: hadLUT0 :: " <<
static_cast<unsigned>(cpmHADenergy.at(0)) <<
":: hadLUT1 :: " <<
static_cast<unsigned>(cpmHADenergy.at(1)) <<
":: hadLUT2 :: " <<
static_cast<unsigned>(cpmHADenergy.at(2)));
598
599 hadLUT0 = static_cast<int>(cpmHADenergy.at(0));
600 if(cpmHADenergy.at(0) > 0)
fill(groupName+
"lut_HAD0",etalut,philut, hadLUT0);
601 hadLUT1 = static_cast<int>(cpmHADenergy.at(1));
602 if(cpmHADenergy.at(1) > 0)
fill(groupName+
"lut_HAD1",etalut,philut, hadLUT1);
603 hadLUT2 = static_cast<int>(cpmHADenergy.at(2));
604 if(cpmHADenergy.at(2) > 0)
fill(groupName+
"lut_HAD2",etalut,philut, hadLUT2);
605 }
606 }
607 }
608
609 std::vector<MonitorJE> vecMonJE;
610
611
614 }
615
616
617 for (auto& jet : vecMonJE) {
618
619 std::vector<uint16_t> jepEMenergy = (jet.element)->emJetElementETVec();
620 std::vector<uint16_t> jepHADenergy = (jet.element)->hadJetElementETVec();
621
622 for (
auto eta: jet.etaScaled) {
624 if ( std::abs(
eta) > 2.5){
625 for (
auto phi: jet.phiScaled) {
627 if(jepEMenergy.size() > 2){
628 ATH_MSG_DEBUG(
"JetElement :: emLUT0 :: " <<
static_cast<unsigned>(jepEMenergy.at(0)) <<
":: emLUT1 :: " <<
static_cast<unsigned>(jepEMenergy.at(1)) <<
":: emLUT2 :: " <<
static_cast<unsigned>(jepEMenergy.at(2)));
629
630 emLUT0 = static_cast<int>(jepEMenergy.at(0));
631 if(jepEMenergy.at(0) > 0)
fill(groupName+
"lut_EM0",etalut,philut, emLUT0);
632
633 emLUT1 = static_cast<int>(jepEMenergy.at(1));
634 if(jepEMenergy.at(1) > 0)
fill(groupName+
"lut_EM1",etalut,philut, emLUT1);
635
636 emLUT2 = static_cast<int>(jepEMenergy.at(2));
637 if(jepEMenergy.at(2) > 0)
fill(groupName+
"lut_EM2",etalut,philut, emLUT2);
638 }
639 if(jepHADenergy.size()> 2){
640 ATH_MSG_DEBUG(
"JetElement :: hadLUT0 :: " <<
static_cast<unsigned>(jepHADenergy.at(0)) <<
":: hadLUT1 :: " <<
static_cast<unsigned>(jepHADenergy.at(1)) <<
":: hadLUT2 :: " <<
static_cast<unsigned>(jepHADenergy.at(2)));
641
642 hadLUT0 = static_cast<int>(jepHADenergy.at(0));
643 if(jepHADenergy.at(0) > 0)
fill(groupName+
"lut_HAD0",etalut,philut, hadLUT0);
644
645 hadLUT1 = static_cast<int>(jepHADenergy.at(1));
646 if(jepHADenergy.at(1) > 0)
fill(groupName+
"lut_HAD1",etalut,philut, hadLUT1);
647
648 hadLUT2 = static_cast<int>(jepHADenergy.at(2));
649 if(jepHADenergy.at(2) > 0)
fill(groupName+
"lut_HAD2",etalut,philut, hadLUT2);
650 }
651 }
652 }
653 }
654 }
655
656 SG::ReadHandle<xAOD::eFexEMRoIContainer>eFexContainer(m_eFexEMContainerKey, ctx);
657 if ( !eFexContainer.isValid() ) {
658 ATH_MSG_WARNING(
"No eFex EM container found in storegate "<< eFexContainer.key());
659 }
660
661
662 auto TOBeT = Monitored::Scalar<float>("TOBTransverseEnergy",0.0);
663 auto TOBeta = Monitored::Scalar<float>("TOBEta",0.0);
664 auto TOBphi = Monitored::Scalar<float>("TOBPhi",0.0);
665 auto TOBeT_max = Monitored::Scalar<float>("TOBTransverseEnergy_max",0.0);
666 auto TOBeta_max = Monitored::Scalar<float>("TOBEta_max",0.0);
667 auto TOBphi_max = Monitored::Scalar<float>("TOBPhi_max",0.0);
668 auto TOBeT_max_in = Monitored::Scalar<float>("TOBTransverseEnergy_max",0.0);
669 auto TOBeta_max_in = Monitored::Scalar<float>("TOBEta_max",0.0);
670 auto TOBphi_max_in = Monitored::Scalar<float>("TOBPhi_max",0.0);
671
672 TOBeT_max = 0;
673 TOBeT_max_in = 0;
674
675 for(auto key : {"L1_eEMxRoI","L1_eEMxRoIOutOfTime"}) {
676
679
680 for(auto tob : *emTobs) {
681 TOBeT = tob->et()/1000;
682 TOBeta = tob->eta();
683
684
685 if (tob->phi() < 0) {
686 TOBphi = tob->phi()+2*
M_PI;
687 }
688 else {
689 TOBphi = tob->phi();
690 }
691
692
693 if (tob->bcn4() == (((ctx.eventID().bunch_crossing_id())-1) & 0xf )) {
694 if (TOBeT > 0.0){
695 fill(groupName+
"Efex0", TOBeta, TOBphi, TOBeT);
696 }
697 }
698 else if (tob->bcn4() == ((ctx.eventID().bunch_crossing_id()) & 0xf )) {
699 if (TOBeT > 0.0){
700 if (TOBeT_max_in < TOBeT) {
701 TOBeT_max_in = tob->et()/1000;
702 TOBeta_max_in = tob->eta();
703 if (tob->phi() < 0) {
704 TOBphi_max_in = tob->phi()+2*
M_PI;
705 }
706 else {
707 TOBphi_max_in = tob->phi();
708 }
709 }
710 fill(groupName+
"Efex1", TOBeta, TOBphi, TOBeT);
711 }
712 }
713 else if (tob->bcn4() == (((ctx.eventID().bunch_crossing_id())+1) & 0xf )) {
714 if (TOBeT > 0.0){
715 if (TOBeT_max < TOBeT) {
716 TOBeT_max = tob->et()/1000;
717 TOBeta_max = tob->eta();
718 if (tob->phi() < 0) {
719 TOBphi_max = tob->phi()+2*
M_PI;
720 }
721 else {
722 TOBphi_max = tob->phi();
723 }
724 }
725 fill(groupName+
"Efex2", TOBeta, TOBphi, TOBeT);
726 }
727 }
728 }
729 }
730 if (trigger == "eFex") {
731 fill(
"Efex_maxTOB_in", TOBeT_max_in);
732 fill(
"Efex_maxTOB_out", TOBeT_max);
733 fill(
"Efex_maxTOB_out", TOBeta_max, TOBphi_max);
734 fill(
"Efex_maxTOB_in", TOBeta_max_in, TOBphi_max_in);
735 }
736
737
738 auto jFexEt = Monitored::Scalar<int> ("jFexEt",0);
739 auto jFexeta = Monitored::Scalar<float>("jFexEta",0.0);
740 auto jFexphi = Monitored::Scalar<float>("jFexPhi",0.0);
741
742
745 ATH_MSG_WARNING(
"No jFex Tower container valid in storegate with key: "<< m_jFexDataTowerKey<<
". Will be skipped!");
746 }
747
748
749 SG::ReadHandle<xAOD::jFexTowerContainer> jEmulatedTowerContainer;
750 jEmulatedTowerContainer = SG::ReadHandle<xAOD::jFexTowerContainer>(m_EmulTowerKey,ctx);
751 if(!jEmulatedTowerContainer.
isValid()) {
752 ATH_MSG_WARNING(
"No jFex Tower container valid in storegate with key: "<< jEmulatedTowerContainer.
key()<<
". Will be skipped!");
753 }
754 else {
756 jFexEt=emulTower->et_count().at(0);
757
758 jFexeta=emulTower->eta()+1
e-5;
759 if (emulTower->phi() < 0) {
760 jFexphi=emulTower->phi()+2*
M_PI;
761 }
762 else {
763 jFexphi=emulTower->phi();
764 }
765 if (jFexEt > 175) {
766 fill(groupName+
"JfexEmulated",jFexeta,jFexphi, jFexEt);
767 }
768 }
769 }
770
771 TOBeT_max = 0;
778 }
779 else {
781 }
782 if (TOBeT_max < jFexEt) {
787 }
788 else {
790 }
791 }
792 fill(groupName+
"JfexSRJet", jFexeta, jFexphi, jFexEt);
793 }
794 if (trigger == "jFex") {
795 fill(
"Jfex_maxTOB", TOBeT_max);
796 fill(
"Jfex_maxTOB", TOBeta_max, TOBphi_max);
797 }
798
800 if(!jFexTauContainer.
isValid()) {
801 ATH_MSG_WARNING(
"No jFex Tau container found in storegate "<< m_jFexTauContainerKey<<
". Will be skipped!");
802 }
803 else {
810 }
811 else {
813 }
814 fill(groupName+
"JfexTau", jFexeta, jFexphi, jFexEt);
815 }
816 }
817
818 auto gFexEt = Monitored::Scalar<int> ("gFexEt",0);
819 auto gFexEta = Monitored::Scalar<float>("gFexEta",0.0);
820 auto gFexPhi = Monitored::Scalar<float>("gFexPhi",0.0);
821 int key_index = 0;
822
823 TOBeT_max = 0;
824
825 for (const auto& key : m_gFexJetTobKeyList){
826 SG::ReadHandle<xAOD::gFexJetRoIContainer> jetContainer (key, ctx);
827
828 if ( !jetContainer.isValid() ) {
830 }
831 else {
837 }
838 else {
840 }
841 if (TOBeT_max < gFexEt) {
846 }
847 else {
849 }
850 }
851 if (key_index == 0) {
852 fill(groupName+
"GfexSRJet",gFexEta, gFexPhi, gFexEt);
853 }
854 else if (key_index == 1) {
855 fill(groupName+
"GfexLRJet",gFexEta, gFexPhi, gFexEt);
856 }
857 }
858 }
859 key_index++;
860 }
861 if (trigger == "gFex") {
862 fill(
"Gfex_maxTOB", TOBeT_max);
863 fill(
"Gfex_maxTOB", TOBeta_max, TOBphi_max);
864 }
865
866 }
867 else {
868 auto eventMonitor_all_legacy= Monitored::Scalar<std::string>("eventMonitor_all_legacy", std::to_string(currentEventNo));
869 auto eventMonitor_all_phaseI= Monitored::Scalar<std::string>("eventMonitor_all_phaseI", trigger+"="+std::to_string(currentEventNo));
870 auto lbMonitor_all= Monitored::Scalar<std::string>("lbMonitor_all", std::to_string(lumiNo));
871 if (legacyTrigger) {
872 fill(
"Event_all_", eventMonitor_all_legacy, lbMonitor_all );
873 }
874 if (phase1Trigger) {
875 fill(
"Event_all_", eventMonitor_all_phaseI, lbMonitor_all );
876 }
877
878 SG::ReadHandle<xAOD::eFexEMRoIContainer>eFexContainer(m_eFexEMContainerKey, ctx);
879 if ( !eFexContainer.isValid() ) {
880 ATH_MSG_WARNING(
"No eFex EM container found in storegate "<< eFexContainer.key());
881 }
882
883
884 auto TOBeT = Monitored::Scalar<float>("TOBTransverseEnergy",0.0);
885 auto TOBeta = Monitored::Scalar<float>("TOBEta",0.0);
886 auto TOBphi = Monitored::Scalar<float>("TOBPhi",0.0);
887 auto TOBeT_max = Monitored::Scalar<float>("TOBTransverseEnergy_max",0.0);
888 auto TOBeta_max = Monitored::Scalar<float>("TOBEta_max",0.0);
889 auto TOBphi_max = Monitored::Scalar<float>("TOBPhi_max",0.0);
890 auto TOBeT_max_in = Monitored::Scalar<float>("TOBTransverseEnergy_max",0.0);
891 auto TOBeta_max_in = Monitored::Scalar<float>("TOBEta_max",0.0);
892 auto TOBphi_max_in = Monitored::Scalar<float>("TOBPhi_max",0.0);
893
894 TOBeT_max = 0;
895 TOBeT_max_in = 0;
896
897 for(auto key : {"L1_eEMxRoI","L1_eEMxRoIOutOfTime"}) {
898
901
902 for(auto tob : *emTobs) {
903 TOBeT = tob->et()/1000;
904 TOBeta = tob->eta();
905
906
907 if (tob->phi() < 0) {
908 TOBphi = tob->phi()+2*
M_PI;
909 }
910 else {
911 TOBphi = tob->phi();
912 }
913
914 if (tob->bcn4() == ((ctx.eventID().bunch_crossing_id()) & 0xf )) {
915 if (TOBeT > 0.0){
916 if (TOBeT_max_in < TOBeT) {
917 TOBeT_max_in = tob->et()/1000;
918 TOBeta_max_in = tob->eta();
919 if (tob->phi() < 0) {
920 TOBphi_max_in = tob->phi()+2*
M_PI;
921 }
922 else {
923 TOBphi_max_in = tob->phi();
924 }
925 }
926 }
927 }
928 else if (tob->bcn4() == (((ctx.eventID().bunch_crossing_id())+1) & 0xf )) {
929 if (TOBeT > 0.0){
930 if (TOBeT_max < TOBeT) {
931 TOBeT_max = tob->et()/1000;
932 TOBeta_max = tob->eta();
933 if (tob->phi() < 0) {
934 TOBphi_max = tob->phi()+2*
M_PI;
935 }
936 else {
937 TOBphi_max = tob->phi();
938 }
939 }
940 }
941 }
942 }
943 }
944 if (trigger == "eFex") {
945 fill(
"Efex_maxTOB_in", TOBeT_max_in);
946 fill(
"Efex_maxTOB_out", TOBeT_max);
947 fill(
"Efex_maxTOB_out", TOBeta_max, TOBphi_max);
948 fill(
"Efex_maxTOB_in", TOBeta_max_in, TOBphi_max_in);
949 }
950
951
952 auto jFexEt = Monitored::Scalar<int> ("jFexEt",0);
953 auto jFexeta = Monitored::Scalar<float>("jFexEta",0.0);
954 auto jFexphi = Monitored::Scalar<float>("jFexPhi",0.0);
955
956
959 ATH_MSG_WARNING(
"No jFex Tower container valid in storegate with key: "<< m_jFexDataTowerKey<<
". Will be skipped!");
960 }
961
962 TOBeT_max = 0;
969 }
970 else {
972 }
973 if (TOBeT_max < jFexEt) {
978 }
979 else {
981 }
982 }
983 }
984 if (trigger == "jFex") {
985 fill(
"Jfex_maxTOB", TOBeT_max);
986 fill(
"Jfex_maxTOB", TOBeta_max, TOBphi_max);
987 }
988
989 auto gFexEt = Monitored::Scalar<int> ("gFexEt",0);
990 auto gFexEta = Monitored::Scalar<float>("gFexEta",0.0);
991 auto gFexPhi = Monitored::Scalar<float>("gFexPhi",0.0);
992
993 TOBeT_max = 0;
994
995 for (const auto& key : m_gFexJetTobKeyList){
996 SG::ReadHandle<xAOD::gFexJetRoIContainer> jetContainer (key, ctx);
997
998 if ( !jetContainer.isValid() ) {
1000 }
1001 else {
1007 }
1008 else {
1010 }
1011 if (TOBeT_max < gFexEt) {
1016 }
1017 else {
1019 }
1020 }
1021 }
1022 }
1023 }
1024 if (trigger == "gFex") {
1025 fill(
"Gfex_maxTOB", TOBeT_max);
1026 fill(
"Gfex_maxTOB", TOBeta_max, TOBphi_max);
1027 }
1028
1029 }
1030
1031 return StatusCode::SUCCESS;
1032}
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define CHECK(...)
Evaluate an expression and check for errors.
ServiceHandle< StoreGateSvc > & evtStore()
SG::ReadHandle< xAOD::EventInfo > GetEventInfo(const EventContext &) const
Return a ReadHandle for an EventInfo object (get run/event numbers, etc.)
StatusCode makeTowerCPM(const xAOD::CPMTower *cpm, std::vector< MonitorCPM > &vecMonCPM) const
std::atomic< int > m_eventCounter
bool pulseQuality(const std::vector< uint16_t > &ttPulse, int peakSlice) const
PublicToolHandle< Trig::TrigDecisionTool > m_trigDec
SG::ReadHandleKey< xAOD::jFexTowerContainer > m_jFexDataTowerKey
StatusCode fillPPMEtaPhi(MonitorTT &monTT, const std::string &groupName, const std::string &weightName, double weight) const
SG::ReadHandleKey< xAOD::jFexTauRoIContainer > m_jFexTauContainerKey
StatusCode makeTowerJE(const xAOD::JetElement *je, std::vector< MonitorJE > &vecMonJE) const
SG::ReadHandleKey< xAOD::jFexSRJetRoIContainer > m_jFexSRJetContainerKey
StatusCode makeTowerPPM(const xAOD::TriggerTower *tt, std::vector< MonitorTT > &vecMonTT) const
Helper functions.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
virtual const std::string & key() const override final
Return the StoreGate ID for the referenced object.
uint32_t tobWord() const
The "raw" 32-bit word describing the object candidate.
uint32_t tobWord() const
The "raw" 32-bit word describing the object candidate.
bool dPhi(const xAOD::TauJet &tau, const xAOD::CaloVertexedTopoCluster &cluster, float &out)
bool dEta(const xAOD::TauJet &tau, const xAOD::CaloVertexedTopoCluster &cluster, float &out)
static const unsigned int requireDecision
retrieve(aClass, aKey=None)
eFexEMRoIContainer_v1 eFexEMRoIContainer
gFexJetRoI_v1 gFexJetRoI
Define the latest version of the gFexJetRoI class.
JetElement_v2 JetElement
Define the latest version of the JetElement class.
gFexJetRoIContainer_v1 gFexJetRoIContainer
jFexTowerContainer_v1 jFexTowerContainer
Define the latest version of the TriggerTower container.
CPMTower_v2 CPMTower
Define the latest version of the CPMTower class.
TriggerTower_v2 TriggerTower
Define the latest version of the TriggerTower class.
jFexTauRoI_v1 jFexTauRoI
Define the latest version of the jFexSRJetRoI class.
jFexSRJetRoI_v1 jFexSRJetRoI
Define the latest version of the jFexSRJetRoI class.
jFexSRJetRoIContainer_v1 jFexSRJetRoIContainer
jFexTower_v1 jFexTower
Define the latest version of the TriggerTower class.
void fill(H5::Group &out_file, size_t iterations)