46 bool LLRW(
float pqcd,
float ptop,
float phbb,
float &
w) {
52 denom = pqcd*(1.-topfrac)+ptop*topfrac;
62 bool CalcRelPt (
float muonPt,
float muonEta,
float muonPhi,
float jetPt,
float jetEta,
float jetPhi,
float &RelPt) {
67 float muonT, muonX, muonY, muonZ,
muon, jetT, jetX, jetY, jetZ,
jet, scprod;
69 muonT = 2.*
atan(
exp(-muonEta) );
71 if ( (std::abs(muonT) > 0.) && (std::abs(jetT) > 0.) ) {
72 muon = muonPt/std::abs(
sin(muonT) );
73 muonX = muonPt*
cos(muonPhi);
74 muonY = muonPt*
sin(muonPhi);
76 jet = jetPt/std::abs(
sin(jetT) );
77 jetX = jetPt*
cos(jetPhi);
78 jetY = jetPt*
sin(jetPhi);
80 scprod = (muonX*jetX + muonY*jetY + muonZ*jetZ)/(
muon*
jet);
82 if ( (1. - scprod) > 0. ) {
83 RelPt =
muon * sqrt(1. - scprod);
102 if(
m_trigDecTool->ExperimentalAndExpertMethods().isHLTTruncated()) {
104 return StatusCode::SUCCESS;
110 bool Eofflinepv(
false);
111 float offlinepvz(-1.e6);
112 float offlinepvx(-1.e6);
113 float offlinepvy(-1.e6);
124 return StatusCode::FAILURE;
127 if ( offlinepv->
size() ) {
129 offlinepvz = offlinepv->
front()->z();
130 offlinepvx = offlinepv->
front()->x();
131 offlinepvy = offlinepv->
front()->y();
132 OffNVtx = offlinepv->
size() ;
133 for (
unsigned int j = 0; j<offlinepv->
size(); j++) {
134 if ( (*(offlinepv))[j]->nTrackParticles()==0 )
continue;
135 if ( (*(offlinepv))[j]->
vertexType()==0 )
continue;
136 OffxVtx = (*(offlinepv))[j]->x();
137 OffyVtx = (*(offlinepv))[j]->y();
138 OffzVtx = (*(offlinepv))[j]->z();
139 fill(
"TrigBjetMonitor",OffxVtx,OffyVtx,OffzVtx);
141 fill(
"TrigBjetMonitor",OffNVtx);
150 ATH_MSG_DEBUG(
" Size of the AllChains trigger container: " << size_AllChains );
151 for (
int i =0;
i<size_AllChains;
i++) {
158 bool mujetChain(
false);
159 bool bjetChain(
true);
160 bool L2bjetChain(
false);
167 ATH_MSG_DEBUG(
" Trigger chain from AllChains list: " << trigName <<
" has fired !!! " );
172 const bool expressPass =
passBits & TrigDefs::Express_passed;
183 std::size_t
found = trigName.find(
"HLT_mu");
184 if (
found!=std::string::npos) mujetChain =
true;
186 found = trigName.find(
"a10sd_cssk");
187 if (
found!=std::string::npos) L2bjetChain =
true;
188 else bjetChain =
true;
191 ATH_MSG_DEBUG(
" ===> Run 3 access to Trigger Item: " << trigName );
192 ATH_MSG_DEBUG(
" bjetChain: " << bjetChain <<
" mujetChain: " << mujetChain <<
" L2bjetChain: " << L2bjetChain );
212 std::string NameH =
"PVz_tr_"+trigName;
218 fill(
"TrigBjetMonitor",PVz_tr);
220 NameH =
"DiffOnOffPVz_tr_"+trigName;
223 DiffOnOffPVz_tr = vtx->z()-offlinepvz;
225 fill(
"TrigBjetMonitor",DiffOnOffPVz_tr);
227 NameH =
"PVx_tr_"+trigName;
232 fill(
"TrigBjetMonitor",PVx_tr);
234 NameH =
"DiffOnOffPVx_tr_"+trigName;
237 DiffOnOffPVx_tr = vtx->x()-offlinepvx;
239 fill(
"TrigBjetMonitor",DiffOnOffPVx_tr);
241 NameH =
"PVy_tr_"+trigName;
246 fill(
"TrigBjetMonitor",PVy_tr);
248 NameH =
"DiffOnOffPVy_tr_"+trigName;
251 DiffOnOffPVy_tr = vtx->y()-offlinepvy;
253 fill(
"TrigBjetMonitor",DiffOnOffPVy_tr);
257 std::string NpvH =
"nPV_tr_"+trigName;
261 fill(
"TrigBjetMonitor",nPV_tr);
270 std::string nJetH =
"LargeR_nJet_"+trigName;
272 nJet = onlinejets.size();
274 fill(
"TrigBjetMonitor",nJet);
275 for(
const auto& jetLinkInfo : onlinejets) {
283 std::string NameH =
"GN2XTrig_pqcd_tr_"+trigName;
287 GN2XTrig_pqcd = pqcd_accessor(*
jet);
289 fill(
"TrigBjetMonitor",GN2XTrig_pqcd);
291 NameH =
"GN2XTrig_ptop_tr_"+trigName;
295 GN2XTrig_ptop = ptop_accessor(*
jet);
297 fill(
"TrigBjetMonitor",GN2XTrig_ptop);
299 NameH =
"GN2XTrig_phbb_tr_"+trigName;
303 GN2XTrig_phbb = phbb_accessor(*
jet);
305 fill(
"TrigBjetMonitor",GN2XTrig_phbb);
307 NameH =
"GN2XTrig_mv_tr_"+trigName;
310 ATH_MSG_DEBUG(
" GN2XTrig_pqcd: " << GN2XTrig_pqcd <<
" GN2XTrig_ptop: " << GN2XTrig_ptop <<
" GN2XTrig_phbb: " << GN2XTrig_phbb );
311 theLLRW =
LLRW (GN2XTrig_pqcd, GN2XTrig_ptop, GN2XTrig_phbb, GN2XTrig_mv);
312 ATH_MSG_DEBUG(
" GN2XTrig_mv: " << GN2XTrig_mv <<
" LLRW: " << theLLRW);
313 if ( theLLRW )
fill(
"TrigBjetMonitor",GN2XTrig_mv);
317 NameH =
"LargeR_jetPt_"+trigName;
320 LargeR_jetPt = (
jet->pt())*1.
e-3;
322 fill(
"TrigBjetMonitor",LargeR_jetPt);
325 NameH =
"LargeR_jetEta_"+trigName;
328 LargeR_jetEta =
jet->eta();
331 NameH =
"LargeR_jetPhi_"+trigName;
334 LargeR_jetPhi =
jet->phi();
335 ATH_MSG_DEBUG(
" LargeR_jetEta: " << LargeR_jetEta <<
" LargeR_jetPhi : " << LargeR_jetPhi);
336 fill(
"TrigBjetMonitor",LargeR_jetEta,LargeR_jetPhi);
339 NameH =
"LargeR_jetMass_"+trigName;
342 LargeR_jetMass = (
jet->m())*1.
e-3;
344 fill(
"TrigBjetMonitor",LargeR_jetMass);
348 NameH =
"GN2Xv01_pqcd_tr_"+trigName;
352 GN2Xv01_pqcd = pqcd_accessor0(*
jet);
354 fill(
"TrigBjetMonitor",GN2Xv01_pqcd);
356 NameH =
"GN2Xv01_ptop_tr_"+trigName;
360 GN2Xv01_ptop = ptop_accessor0(*
jet);
362 fill(
"TrigBjetMonitor",GN2Xv01_ptop);
364 NameH =
"GN2Xv01_phbb_tr_"+trigName;
368 GN2Xv01_phbb = phbb_accessor0(*
jet);
370 fill(
"TrigBjetMonitor",GN2Xv01_phbb);
372 NameH =
"GN2Xv01_mv_tr_"+trigName;
375 ATH_MSG_DEBUG(
" GN2Xv01_pqcd: " << GN2Xv01_pqcd <<
" GN2Xv01_ptop: " << GN2Xv01_ptop <<
" GN2Xv01_phbb: " << GN2Xv01_phbb );
376 theLLRW =
LLRW (GN2Xv01_pqcd, GN2Xv01_ptop, GN2Xv01_phbb, GN2Xv01_mv);
377 ATH_MSG_DEBUG(
" GN2Xv01_mv: " << GN2Xv01_mv <<
" LLRW: " << theLLRW);
378 if ( theLLRW )
fill(
"TrigBjetMonitor",GN2Xv01_mv);
390 std::string nMuonH =
"nMuon_"+trigName;
392 nMuon = onlinemuons.size();
393 fill(
"TrigBjetMonitor",nMuon);
397 std::string nJetH =
"nJet_"+trigName;
399 nJet = onlinejets.size();
400 fill(
"TrigBjetMonitor",nJet);
402 if (nMuon*nJet > 0) {
404 float muonPt1(0.), muonEta1(0.), muonPhi1(0.), muonZ1(0.), jetPt1(0.), jetEta1(0.), jetPhi1(0.), jetZ1(0.), muonZ(0.);
405 double GN1_mv(0.), GN2_mv(0.);
406 bool theLLR(
false), theLLR_GN1(
false), theLLR_GN2(
false);
407 bool plotDeltaZ(
false);
409 for(
const auto& muonLinkInfo : onlinemuons) {
412 std::string NameH =
"muonPt_"+trigName;
415 muonPt = (
muon->pt())*1.
e-3;
417 fill(
"TrigBjetMonitor",muonPt);
419 NameH =
"muonEta_"+trigName;
422 muonEta =
muon->eta();
424 fill(
"TrigBjetMonitor",muonEta);
426 NameH =
"muonPhi_"+trigName;
429 muonPhi =
muon->phi();
432 auto link =
muon->combinedTrackParticleLink();
433 if (link.isValid()) {
451 for(
const auto& jetLinkInfo : onlinejets) {
454 NameH =
"jetPt_"+trigName;
457 jetPt = (
jet->pt())*1.
e-3;
459 fill(
"TrigBjetMonitor",jetPt);
461 NameH =
"jetEta_"+trigName;
466 fill(
"TrigBjetMonitor",jetEta);
468 NameH =
"jetPhi_"+trigName;
482 auto btaggingLinkInfo = TrigCompositeUtils::findLink<xAOD::BTaggingContainer>(jetLinkInfo.source,
m_btaggingLinkName);
484 if ( btaggingLinkInfo.isValid() ) {
485 obj_storing_btag = *(btaggingLinkInfo.link);
488 obj_storing_btag = *(jetLinkInfo.link);
500 if (GN1pu_accessor.
isAvailable(*obj_storing_btag)) {
501 double GN1_pu(0.), GN1_pc(0.), GN1_pb(0.);
502 GN1_pu = GN1pu_accessor(*obj_storing_btag);
504 GN1_pc = GN1pc_accessor(*obj_storing_btag);
506 GN1_pb = GN1pb_accessor(*obj_storing_btag);
508 theLLR =
LLR (GN1_pu, GN1_pc, GN1_pb, GN1_mv);
510 if ( !theLLR ) GN1_mv=-100.;
513 if (GN2pu_accessor.
isAvailable(*obj_storing_btag)) {
514 double GN2_pu(0.), GN2_pc(0.), GN2_pb(0.);
515 GN2_pu = GN2pu_accessor(*obj_storing_btag);
517 GN2_pc = GN2pc_accessor(*obj_storing_btag);
519 GN2_pb = GN2pb_accessor(*obj_storing_btag);
521 theLLR =
LLR (GN2_pu, GN2_pc, GN2_pb, GN2_mv);
523 if ( !theLLR ) GN2_mv=-100.;
539 std::string DeltaRH =
"DeltaR_"+trigName;
542 float DeltaEta = muonEta1 - jetEta1;
544 DeltaR = sqrt( DeltaEta*DeltaEta + DeltaPhi*DeltaPhi );
549 std::string DeltaZH =
"DeltaZ_"+trigName;
552 DeltaZ = std::abs(muonZ1-jetZ1);
554 if (plotDeltaZ)
fill(
"TrigBjetMonitor",DeltaZ);
557 std::string RatioPtH =
"RatioPt_"+trigName;
561 if (jetPt1 > 0.) RatioPt = muonPt1/jetPt1;
563 if (RatioPt > 0.)
fill(
"TrigBjetMonitor",RatioPt);
566 std::string RelPtH =
"RelPt_"+trigName;
570 bool calc_relpt =
CalcRelPt (muonPt1, muonEta1, muonPhi1, jetPt1, jetEta1, jetPhi1, RelPt);
574 std::string wGN1H =
"wGN1_"+trigName;
577 wGN1 =
float(GN1_mv);
579 if (calc_relpt && theLLR_GN1)
fill(
"TrigBjetMonitor",wGN1,RelPt);
582 std::string wGN2H =
"wGN2_"+trigName;
585 wGN2 =
float(GN2_mv);
587 if (calc_relpt && theLLR_GN2)
fill(
"TrigBjetMonitor",wGN2,RelPt);
602 std::string nJetH =
"nJet_"+trigName;
604 nJet = onlinejets.size();
605 fill(
"TrigBjetMonitor",nJet);
609 for(
const auto& jetLinkInfo : onlinejets) {
612 std::string NameH =
"jetPt_"+trigName;
615 jetPt = (
jet->pt())*1.
e-3;
617 fill(
"TrigBjetMonitor",jetPt);
619 NameH =
"jetEta_"+trigName;
624 NameH =
"jetPhi_"+trigName;
628 ATH_MSG_DEBUG(
" jetEta: " << jetEta <<
" jetPhi : " << jetPhi);
629 fill(
"TrigBjetMonitor",jetEta,jetPhi);
637 if ( vtxname.compare(0, 4,
"HLT_")==0 ) vtxname.erase(0,4);
638 auto vertexLinkInfo = TrigCompositeUtils::findLink<xAOD::VertexContainer>(jetLinkInfo.source, vtxname );
641 NameH =
"PVz_jet_"+trigName;
646 fill(
"TrigBjetMonitor",PVz_jet);
647 NameH =
"PVx_jet_"+trigName;
652 fill(
"TrigBjetMonitor",PVx_jet);
653 NameH =
"PVy_jet_"+trigName;
658 fill(
"TrigBjetMonitor",PVy_jet);
667 auto btaggingLinkInfo = TrigCompositeUtils::findLink<xAOD::BTaggingContainer>(jetLinkInfo.source,
m_btaggingLinkName);
668 if ( btaggingLinkInfo.isValid() ) {
669 obj_storing_btag = *(btaggingLinkInfo.link);
672 obj_storing_btag = *(jetLinkInfo.link);
683 bool GN1_available = GN1pu_accessor.
isAvailable(*obj_storing_btag);
684 bool GN2_available = GN2pu_accessor.
isAvailable(*obj_storing_btag);
685 NameH =
"GN1_pu_tr_"+trigName;
688 GN1_pu = GN1_available ? GN1pu_accessor(*obj_storing_btag) : 0.0;
690 fill(
"TrigBjetMonitor",GN1_pu);
692 NameH =
"GN1_pc_tr_"+trigName;
695 GN1_pc = GN1_available ? GN1pc_accessor(*obj_storing_btag) : 0.0;
697 fill(
"TrigBjetMonitor",GN1_pc);
699 NameH =
"GN1_pb_tr_"+trigName;
702 GN1_pb = GN1_available ? GN1pb_accessor(*obj_storing_btag) : 0.0;
704 fill(
"TrigBjetMonitor",GN1_pb);
706 NameH =
"GN1_mv_tr_"+trigName;
709 theLLR =
LLR (GN1_pu, GN1_pc, GN1_pb, GN1_mv);
710 if ( theLLR )
fill(
"TrigBjetMonitor",GN1_mv);
714 NameH =
"GN2_pu_tr_"+trigName;
717 GN2_pu = GN2_available ? GN2pu_accessor(*obj_storing_btag) : 0.0;
719 fill(
"TrigBjetMonitor",GN2_pu);
721 NameH =
"GN2_pc_tr_"+trigName;
724 GN2_pc = GN2_available ? GN2pc_accessor(*obj_storing_btag) : 0.0;
726 fill(
"TrigBjetMonitor",GN2_pc);
728 NameH =
"GN2_pb_tr_"+trigName;
731 GN2_pb = GN2_available ? GN2pb_accessor(*obj_storing_btag) : 0.0;
733 fill(
"TrigBjetMonitor",GN2_pb);
735 NameH =
"GN2_mv_tr_"+trigName;
738 theLLR =
LLR (GN2_pu, GN2_pc, GN2_pb, GN2_mv);
739 if ( theLLR )
fill(
"TrigBjetMonitor",GN2_mv);
744 const auto track_it_pair =
m_trigDecTool->associateToEventView(theTracks, jetLinkInfo.source,
"roi");
751 ATH_MSG_DEBUG(
" Track " <<
count <<
" with pT " << (*it)->pt() <<
" from BJet with pT " << (*jetLinkInfo.link)->pt() );
752 ATH_MSG_DEBUG(
" Track " <<
count <<
" with pT/eta/phi " << (*it)->pt() <<
"/" << (*it)->eta() <<
"/" << (*it)->phi() );
755 std::string NameH =
"trkPt_"+trigName;
758 trkPt = ((*it)->pt())*1.
e-3;
760 fill(
"TrigBjetMonitor",trkPt);
761 NameH =
"trkEta_"+trigName;
764 trkEta = (*it)->eta();
765 NameH =
"trkPhi_"+trigName;
768 trkPhi = (*it)->phi();
769 ATH_MSG_DEBUG(
" trkEta: " << trkEta <<
" trkPhi : " << trkPhi);
770 fill(
"TrigBjetMonitor",trkEta,trkPhi);
771 NameH =
"d0_"+trigName;
776 fill(
"TrigBjetMonitor",
d0);
777 NameH =
"z0_"+trigName;
782 fill(
"TrigBjetMonitor",
z0);
783 NameH =
"ed0_"+trigName;
786 ed0 =
Amg::error((*it)->definingParametersCovMatrix(), 0);
788 fill(
"TrigBjetMonitor",ed0);
789 NameH =
"sd0_"+trigName;
793 if (ed0 > 0.) sd0 = std::abs(
d0)/ed0;
795 fill(
"TrigBjetMonitor",sd0);
796 NameH =
"ez0_"+trigName;
799 ez0 =
Amg::error((*it)->definingParametersCovMatrix(), 1);
801 fill(
"TrigBjetMonitor",ez0);
808 ATH_MSG_DEBUG(
" Total number of triggered b-jets: " << ijet <<
" nJet : " << nJet);
809 ATH_MSG_DEBUG(
" Total number of triggered tracks associated to the b-jets: " << itrack);
810 std::string nTrackH =
"nTrack_"+trigName;
813 fill(
"TrigBjetMonitor",nTrack);
820 ATH_MSG_DEBUG(
" Chain " << trigName <<
" is declared for the Express Stream but it is NOT in the Express Stream in an Express Job");
824 ATH_MSG_DEBUG(
" Trigger chain from AllChains list: " << trigName <<
" has not fired " );
830 return StatusCode::SUCCESS;