48 bool LLRW(
float pqcd,
float ptop,
float phbb,
float &
w) {
54 denom = pqcd*(1.-topfrac)+ptop*topfrac;
64 bool CalcRelPt (
float muonPt,
float muonEta,
float muonPhi,
float jetPt,
float jetEta,
float jetPhi,
float &RelPt) {
69 float muonT, muonX, muonY, muonZ,
muon, jetT, jetX, jetY, jetZ,
jet, scprod;
71 muonT = 2.*
atan(
exp(-muonEta) );
73 if ( (std::abs(muonT) > 0.) && (std::abs(jetT) > 0.) ) {
74 muon = muonPt/std::abs(
sin(muonT) );
75 muonX = muonPt*
cos(muonPhi);
76 muonY = muonPt*
sin(muonPhi);
78 jet = jetPt/std::abs(
sin(jetT) );
79 jetX = jetPt*
cos(jetPhi);
80 jetY = jetPt*
sin(jetPhi);
82 scprod = (muonX*jetX + muonY*jetY + muonZ*jetZ)/(
muon*
jet);
84 if ( (1. - scprod) > 0. ) {
85 RelPt =
muon * sqrt(1. - scprod);
104 if(
m_trigDecTool->ExperimentalAndExpertMethods().isHLTTruncated()) {
106 return StatusCode::SUCCESS;
112 bool Eofflinepv(
false);
113 float offlinepvz(-1.e6);
114 float offlinepvx(-1.e6);
115 float offlinepvy(-1.e6);
126 return StatusCode::FAILURE;
129 if ( offlinepv->
size() ) {
131 offlinepvz = offlinepv->
front()->z();
132 offlinepvx = offlinepv->
front()->x();
133 offlinepvy = offlinepv->
front()->y();
134 OffNVtx = offlinepv->
size() ;
135 for (
unsigned int j = 0; j<offlinepv->
size(); j++) {
136 if ( (*(offlinepv))[j]->nTrackParticles()==0 )
continue;
137 if ( (*(offlinepv))[j]->
vertexType()==0 )
continue;
138 OffxVtx = (*(offlinepv))[j]->x();
139 OffyVtx = (*(offlinepv))[j]->y();
140 OffzVtx = (*(offlinepv))[j]->z();
141 fill(
"TrigBjetMonitor",OffxVtx,OffyVtx,OffzVtx);
143 fill(
"TrigBjetMonitor",OffNVtx);
152 ATH_MSG_DEBUG(
" Size of the AllChains trigger container: " << size_AllChains );
153 for (
int i =0;
i<size_AllChains;
i++) {
160 bool mujetChain(
false);
161 bool bjetChain(
true);
162 bool L2bjetChain(
false);
169 ATH_MSG_DEBUG(
" Trigger chain from AllChains list: " << trigName <<
" has fired !!! " );
174 const bool expressPass =
passBits & TrigDefs::Express_passed;
185 std::size_t
found = trigName.find(
"HLT_mu");
186 if (
found!=std::string::npos) mujetChain =
true;
188 found = trigName.find(
"a10sd_cssk");
189 if (
found!=std::string::npos) L2bjetChain =
true;
190 else bjetChain =
true;
193 ATH_MSG_DEBUG(
" ===> Run 3 access to Trigger Item: " << trigName );
194 ATH_MSG_DEBUG(
" bjetChain: " << bjetChain <<
" mujetChain: " << mujetChain <<
" L2bjetChain: " << L2bjetChain );
214 std::string NameH =
"PVz_tr_"+trigName;
220 fill(
"TrigBjetMonitor",PVz_tr);
222 NameH =
"DiffOnOffPVz_tr_"+trigName;
225 DiffOnOffPVz_tr = vtx->z()-offlinepvz;
227 fill(
"TrigBjetMonitor",DiffOnOffPVz_tr);
229 NameH =
"PVx_tr_"+trigName;
234 fill(
"TrigBjetMonitor",PVx_tr);
236 NameH =
"DiffOnOffPVx_tr_"+trigName;
239 DiffOnOffPVx_tr = vtx->x()-offlinepvx;
241 fill(
"TrigBjetMonitor",DiffOnOffPVx_tr);
243 NameH =
"PVy_tr_"+trigName;
248 fill(
"TrigBjetMonitor",PVy_tr);
250 NameH =
"DiffOnOffPVy_tr_"+trigName;
253 DiffOnOffPVy_tr = vtx->y()-offlinepvy;
255 fill(
"TrigBjetMonitor",DiffOnOffPVy_tr);
259 std::string NpvH =
"nPV_tr_"+trigName;
263 fill(
"TrigBjetMonitor",nPV_tr);
272 std::string nJetH =
"LargeR_nJet_"+trigName;
274 nJet = onlinejets.size();
276 fill(
"TrigBjetMonitor",nJet);
277 for(
const auto& jetLinkInfo : onlinejets) {
285 std::string NameH =
"GN2XTrig_pqcd_tr_"+trigName;
289 GN2XTrig_pqcd = pqcd_accessor(*
jet);
291 fill(
"TrigBjetMonitor",GN2XTrig_pqcd);
293 NameH =
"GN2XTrig_ptop_tr_"+trigName;
297 GN2XTrig_ptop = ptop_accessor(*
jet);
299 fill(
"TrigBjetMonitor",GN2XTrig_ptop);
301 NameH =
"GN2XTrig_phbb_tr_"+trigName;
305 GN2XTrig_phbb = phbb_accessor(*
jet);
307 fill(
"TrigBjetMonitor",GN2XTrig_phbb);
309 NameH =
"GN2XTrig_mv_tr_"+trigName;
312 ATH_MSG_DEBUG(
" GN2XTrig_pqcd: " << GN2XTrig_pqcd <<
" GN2XTrig_ptop: " << GN2XTrig_ptop <<
" GN2XTrig_phbb: " << GN2XTrig_phbb );
313 theLLRW =
LLRW (GN2XTrig_pqcd, GN2XTrig_ptop, GN2XTrig_phbb, GN2XTrig_mv);
314 ATH_MSG_DEBUG(
" GN2XTrig_mv: " << GN2XTrig_mv <<
" LLRW: " << theLLRW);
315 if ( theLLRW )
fill(
"TrigBjetMonitor",GN2XTrig_mv);
319 NameH =
"LargeR_jetPt_"+trigName;
322 LargeR_jetPt = (
jet->pt())*1.
e-3;
324 fill(
"TrigBjetMonitor",LargeR_jetPt);
327 NameH =
"LargeR_jetEta_"+trigName;
330 LargeR_jetEta =
jet->eta();
333 NameH =
"LargeR_jetPhi_"+trigName;
336 LargeR_jetPhi =
jet->phi();
337 ATH_MSG_DEBUG(
" LargeR_jetEta: " << LargeR_jetEta <<
" LargeR_jetPhi : " << LargeR_jetPhi);
338 fill(
"TrigBjetMonitor",LargeR_jetEta,LargeR_jetPhi);
341 NameH =
"LargeR_jetMass_"+trigName;
344 LargeR_jetMass = (
jet->m())*1.
e-3;
346 fill(
"TrigBjetMonitor",LargeR_jetMass);
350 NameH =
"GN2Xv01_pqcd_tr_"+trigName;
354 GN2Xv01_pqcd = pqcd_accessor0(*
jet);
356 fill(
"TrigBjetMonitor",GN2Xv01_pqcd);
358 NameH =
"GN2Xv01_ptop_tr_"+trigName;
362 GN2Xv01_ptop = ptop_accessor0(*
jet);
364 fill(
"TrigBjetMonitor",GN2Xv01_ptop);
366 NameH =
"GN2Xv01_phbb_tr_"+trigName;
370 GN2Xv01_phbb = phbb_accessor0(*
jet);
372 fill(
"TrigBjetMonitor",GN2Xv01_phbb);
374 NameH =
"GN2Xv01_mv_tr_"+trigName;
377 ATH_MSG_DEBUG(
" GN2Xv01_pqcd: " << GN2Xv01_pqcd <<
" GN2Xv01_ptop: " << GN2Xv01_ptop <<
" GN2Xv01_phbb: " << GN2Xv01_phbb );
378 theLLRW =
LLRW (GN2Xv01_pqcd, GN2Xv01_ptop, GN2Xv01_phbb, GN2Xv01_mv);
379 ATH_MSG_DEBUG(
" GN2Xv01_mv: " << GN2Xv01_mv <<
" LLRW: " << theLLRW);
380 if ( theLLRW )
fill(
"TrigBjetMonitor",GN2Xv01_mv);
392 std::string nMuonH =
"nMuon_"+trigName;
394 nMuon = onlinemuons.size();
395 fill(
"TrigBjetMonitor",nMuon);
399 std::string nJetH =
"nJet_"+trigName;
401 nJet = onlinejets.size();
402 fill(
"TrigBjetMonitor",nJet);
404 if (nMuon*nJet > 0) {
406 float muonPt1(0.), muonEta1(0.), muonPhi1(0.), muonZ1(0.), jetPt1(0.), jetEta1(0.), jetPhi1(0.), jetZ1(0.), muonZ(0.);
407 double GN1_mv(0.), GN2_mv(0.);
408 bool theLLR(
false), theLLR_GN1(
false), theLLR_GN2(
false);
409 bool plotDeltaZ(
false);
411 for(
const auto& muonLinkInfo : onlinemuons) {
414 std::string NameH =
"muonPt_"+trigName;
417 muonPt = (
muon->pt())*1.
e-3;
419 fill(
"TrigBjetMonitor",muonPt);
421 NameH =
"muonEta_"+trigName;
424 muonEta =
muon->eta();
426 fill(
"TrigBjetMonitor",muonEta);
428 NameH =
"muonPhi_"+trigName;
431 muonPhi =
muon->phi();
434 auto link =
muon->combinedTrackParticleLink();
435 if (link.isValid()) {
453 for(
const auto& jetLinkInfo : onlinejets) {
456 NameH =
"jetPt_"+trigName;
459 jetPt = (
jet->pt())*1.
e-3;
461 fill(
"TrigBjetMonitor",jetPt);
463 NameH =
"jetEta_"+trigName;
468 fill(
"TrigBjetMonitor",jetEta);
470 NameH =
"jetPhi_"+trigName;
484 auto btaggingLinkInfo = TrigCompositeUtils::findLink<xAOD::BTaggingContainer>(jetLinkInfo.source,
m_btaggingLinkName);
486 if ( btaggingLinkInfo.isValid() ) {
487 obj_storing_btag = *(btaggingLinkInfo.link);
490 obj_storing_btag = *(jetLinkInfo.link);
502 if (GN1pu_accessor.
isAvailable(*obj_storing_btag)) {
503 double GN1_pu(0.), GN1_pc(0.), GN1_pb(0.);
504 GN1_pu = GN1pu_accessor(*obj_storing_btag);
506 GN1_pc = GN1pc_accessor(*obj_storing_btag);
508 GN1_pb = GN1pb_accessor(*obj_storing_btag);
510 theLLR =
LLR (GN1_pu, GN1_pc, GN1_pb, GN1_mv);
512 if ( !theLLR ) GN1_mv=-100.;
515 if (GN2pu_accessor.
isAvailable(*obj_storing_btag)) {
516 double GN2_pu(0.), GN2_pc(0.), GN2_pb(0.);
517 GN2_pu = GN2pu_accessor(*obj_storing_btag);
519 GN2_pc = GN2pc_accessor(*obj_storing_btag);
521 GN2_pb = GN2pb_accessor(*obj_storing_btag);
523 theLLR =
LLR (GN2_pu, GN2_pc, GN2_pb, GN2_mv);
525 if ( !theLLR ) GN2_mv=-100.;
541 std::string DeltaRH =
"DeltaR_"+trigName;
544 float DeltaEta = muonEta1 - jetEta1;
546 DeltaR = sqrt( DeltaEta*DeltaEta + DeltaPhi*DeltaPhi );
551 std::string DeltaZH =
"DeltaZ_"+trigName;
554 DeltaZ = std::abs(muonZ1-jetZ1);
556 if (plotDeltaZ)
fill(
"TrigBjetMonitor",DeltaZ);
559 std::string RatioPtH =
"RatioPt_"+trigName;
563 if (jetPt1 > 0.) RatioPt = muonPt1/jetPt1;
565 if (RatioPt > 0.)
fill(
"TrigBjetMonitor",RatioPt);
568 std::string RelPtH =
"RelPt_"+trigName;
572 bool calc_relpt =
CalcRelPt (muonPt1, muonEta1, muonPhi1, jetPt1, jetEta1, jetPhi1, RelPt);
576 std::string wGN1H =
"wGN1_"+trigName;
579 wGN1 =
float(GN1_mv);
581 if (calc_relpt && theLLR_GN1)
fill(
"TrigBjetMonitor",wGN1,RelPt);
584 std::string wGN2H =
"wGN2_"+trigName;
587 wGN2 =
float(GN2_mv);
589 if (calc_relpt && theLLR_GN2)
fill(
"TrigBjetMonitor",wGN2,RelPt);
604 std::string nJetH =
"nJet_"+trigName;
606 nJet = onlinejets.size();
607 fill(
"TrigBjetMonitor",nJet);
611 for(
const auto& jetLinkInfo : onlinejets) {
614 std::string NameH =
"jetPt_"+trigName;
617 jetPt = (
jet->pt())*1.
e-3;
619 fill(
"TrigBjetMonitor",jetPt);
621 NameH =
"jetEta_"+trigName;
626 NameH =
"jetPhi_"+trigName;
630 ATH_MSG_DEBUG(
" jetEta: " << jetEta <<
" jetPhi : " << jetPhi);
631 fill(
"TrigBjetMonitor",jetEta,jetPhi);
639 if ( vtxname.compare(0, 4,
"HLT_")==0 ) vtxname.erase(0,4);
640 auto vertexLinkInfo = TrigCompositeUtils::findLink<xAOD::VertexContainer>(jetLinkInfo.source, vtxname );
643 NameH =
"PVz_jet_"+trigName;
648 fill(
"TrigBjetMonitor",PVz_jet);
649 NameH =
"PVx_jet_"+trigName;
654 fill(
"TrigBjetMonitor",PVx_jet);
655 NameH =
"PVy_jet_"+trigName;
660 fill(
"TrigBjetMonitor",PVy_jet);
669 auto btaggingLinkInfo = TrigCompositeUtils::findLink<xAOD::BTaggingContainer>(jetLinkInfo.source,
m_btaggingLinkName);
670 if ( btaggingLinkInfo.isValid() ) {
671 obj_storing_btag = *(btaggingLinkInfo.link);
674 obj_storing_btag = *(jetLinkInfo.link);
685 bool GN1_available = GN1pu_accessor.
isAvailable(*obj_storing_btag);
686 bool GN2_available = GN2pu_accessor.
isAvailable(*obj_storing_btag);
687 NameH =
"GN1_pu_tr_"+trigName;
690 GN1_pu = GN1_available ? GN1pu_accessor(*obj_storing_btag) : 0.0;
692 fill(
"TrigBjetMonitor",GN1_pu);
694 NameH =
"GN1_pc_tr_"+trigName;
697 GN1_pc = GN1_available ? GN1pc_accessor(*obj_storing_btag) : 0.0;
699 fill(
"TrigBjetMonitor",GN1_pc);
701 NameH =
"GN1_pb_tr_"+trigName;
704 GN1_pb = GN1_available ? GN1pb_accessor(*obj_storing_btag) : 0.0;
706 fill(
"TrigBjetMonitor",GN1_pb);
708 NameH =
"GN1_mv_tr_"+trigName;
711 theLLR =
LLR (GN1_pu, GN1_pc, GN1_pb, GN1_mv);
712 if ( theLLR )
fill(
"TrigBjetMonitor",GN1_mv);
716 NameH =
"GN2_pu_tr_"+trigName;
719 GN2_pu = GN2_available ? GN2pu_accessor(*obj_storing_btag) : 0.0;
721 fill(
"TrigBjetMonitor",GN2_pu);
723 NameH =
"GN2_pc_tr_"+trigName;
726 GN2_pc = GN2_available ? GN2pc_accessor(*obj_storing_btag) : 0.0;
728 fill(
"TrigBjetMonitor",GN2_pc);
730 NameH =
"GN2_pb_tr_"+trigName;
733 GN2_pb = GN2_available ? GN2pb_accessor(*obj_storing_btag) : 0.0;
735 fill(
"TrigBjetMonitor",GN2_pb);
737 NameH =
"GN2_mv_tr_"+trigName;
740 theLLR =
LLR (GN2_pu, GN2_pc, GN2_pb, GN2_mv);
741 if ( theLLR )
fill(
"TrigBjetMonitor",GN2_mv);
746 const auto track_it_pair =
m_trigDecTool->associateToEventView(theTracks, jetLinkInfo.source,
"roi");
753 ATH_MSG_DEBUG(
" Track " <<
count <<
" with pT " << (*it)->pt() <<
" from BJet with pT " << (*jetLinkInfo.link)->pt() );
754 ATH_MSG_DEBUG(
" Track " <<
count <<
" with pT/eta/phi " << (*it)->pt() <<
"/" << (*it)->eta() <<
"/" << (*it)->phi() );
757 std::string NameH =
"trkPt_"+trigName;
760 trkPt = ((*it)->pt())*1.
e-3;
762 fill(
"TrigBjetMonitor",trkPt);
763 NameH =
"trkEta_"+trigName;
766 trkEta = (*it)->eta();
767 NameH =
"trkPhi_"+trigName;
770 trkPhi = (*it)->phi();
771 ATH_MSG_DEBUG(
" trkEta: " << trkEta <<
" trkPhi : " << trkPhi);
772 fill(
"TrigBjetMonitor",trkEta,trkPhi);
773 NameH =
"d0_"+trigName;
778 fill(
"TrigBjetMonitor",
d0);
779 NameH =
"z0_"+trigName;
784 fill(
"TrigBjetMonitor",
z0);
785 NameH =
"ed0_"+trigName;
788 ed0 =
Amg::error((*it)->definingParametersCovMatrix(), 0);
790 fill(
"TrigBjetMonitor",ed0);
791 NameH =
"sd0_"+trigName;
795 if (ed0 > 0.) sd0 = std::abs(
d0)/ed0;
797 fill(
"TrigBjetMonitor",sd0);
798 NameH =
"ez0_"+trigName;
801 ez0 =
Amg::error((*it)->definingParametersCovMatrix(), 1);
803 fill(
"TrigBjetMonitor",ez0);
810 ATH_MSG_DEBUG(
" Total number of triggered b-jets: " << ijet <<
" nJet : " << nJet);
811 ATH_MSG_DEBUG(
" Total number of triggered tracks associated to the b-jets: " << itrack);
812 std::string nTrackH =
"nTrack_"+trigName;
815 fill(
"TrigBjetMonitor",nTrack);
822 ATH_MSG_DEBUG(
" Chain " << trigName <<
" is declared for the Express Stream but it is NOT in the Express Stream in an Express Job");
826 ATH_MSG_DEBUG(
" Trigger chain from AllChains list: " << trigName <<
" has not fired " );
832 return StatusCode::SUCCESS;