44 bool LLRW(
float pqcd,
float ptop,
float phbb,
float &
w) {
50 denom = pqcd*(1.-topfrac)+ptop*topfrac;
60 bool CalcRelPt (
float muonPt,
float muonEta,
float muonPhi,
float jetPt,
float jetEta,
float jetPhi,
float &RelPt) {
65 float muonT, muonX, muonY, muonZ,
muon, jetT, jetX, jetY, jetZ,
jet, scprod;
67 muonT = 2.*
atan(
exp(-muonEta) );
69 if ( (std::abs(muonT) > 0.) && (std::abs(jetT) > 0.) ) {
70 muon = muonPt/std::abs(
sin(muonT) );
71 muonX = muonPt*
cos(muonPhi);
72 muonY = muonPt*
sin(muonPhi);
74 jet = jetPt/std::abs(
sin(jetT) );
75 jetX = jetPt*
cos(jetPhi);
76 jetY = jetPt*
sin(jetPhi);
78 scprod = (muonX*jetX + muonY*jetY + muonZ*jetZ)/(
muon*
jet);
80 if ( (1. - scprod) > 0. ) {
81 RelPt =
muon * sqrt(1. - scprod);
103 bool Eofflinepv(
false);
104 float offlinepvz(-1.e6);
105 float offlinepvx(-1.e6);
106 float offlinepvy(-1.e6);
117 return StatusCode::FAILURE;
120 if ( offlinepv->
size() ) {
122 offlinepvz = offlinepv->
front()->z();
123 offlinepvx = offlinepv->
front()->x();
124 offlinepvy = offlinepv->
front()->y();
125 OffNVtx = offlinepv->
size() ;
126 for (
unsigned int j = 0; j<offlinepv->
size(); j++){
127 OffxVtx = (*(offlinepv))[j]->x();
128 OffyVtx = (*(offlinepv))[j]->y();
129 OffzVtx = (*(offlinepv))[j]->z();
130 fill(
"TrigBjetMonitor",OffxVtx,OffyVtx,OffzVtx);
132 fill(
"TrigBjetMonitor",OffNVtx);
141 ATH_MSG_DEBUG(
" Size of the AllChains trigger container: " << size_AllChains );
142 for (
int i =0;
i<size_AllChains;
i++){
149 bool mujetChain(
false);
150 bool bjetChain(
true);
151 bool L2bjetChain(
false);
158 ATH_MSG_DEBUG(
" Trigger chain from AllChains list: " << trigName <<
" has fired !!! " );
163 const bool expressPass =
passBits & TrigDefs::Express_passed;
174 std::size_t
found = trigName.find(
"HLT_mu");
175 if (
found!=std::string::npos) mujetChain =
true;
177 found = trigName.find(
"a10sd_cssk");
178 if (
found!=std::string::npos) L2bjetChain =
true;
179 else bjetChain =
true;
182 ATH_MSG_DEBUG(
" ===> Run 3 access to Trigger Item: " << trigName );
183 ATH_MSG_DEBUG(
" bjetChain: " << bjetChain <<
" mujetChain: " << mujetChain <<
" L2bjetChain: " << L2bjetChain );
203 std::string NameH =
"PVz_tr_"+trigName;
209 fill(
"TrigBjetMonitor",PVz_tr);
211 NameH =
"DiffOnOffPVz_tr_"+trigName;
214 DiffOnOffPVz_tr = vtx->z()-offlinepvz;
216 fill(
"TrigBjetMonitor",DiffOnOffPVz_tr);
218 NameH =
"PVx_tr_"+trigName;
223 fill(
"TrigBjetMonitor",PVx_tr);
225 NameH =
"DiffOnOffPVx_tr_"+trigName;
228 DiffOnOffPVx_tr = vtx->x()-offlinepvx;
230 fill(
"TrigBjetMonitor",DiffOnOffPVx_tr);
232 NameH =
"PVy_tr_"+trigName;
237 fill(
"TrigBjetMonitor",PVy_tr);
239 NameH =
"DiffOnOffPVy_tr_"+trigName;
242 DiffOnOffPVy_tr = vtx->y()-offlinepvy;
244 fill(
"TrigBjetMonitor",DiffOnOffPVy_tr);
248 std::string NpvH =
"nPV_tr_"+trigName;
252 fill(
"TrigBjetMonitor",nPV_tr);
260 for(
const auto& jetLinkInfo : onlinejets) {
262 std::string nJetH =
"LargeR_nJet_"+trigName;
264 nJet = onlinejets.size();
266 fill(
"TrigBjetMonitor",nJet);
271 std::string NameH =
"GN2Xv01_pqcd_tr_"+trigName;
275 GN2Xv01_pqcd = pqcd_accessor(*
jet);
277 fill(
"TrigBjetMonitor",GN2Xv01_pqcd);
279 NameH =
"GN2Xv01_ptop_tr_"+trigName;
283 GN2Xv01_ptop = ptop_accessor(*
jet);
285 fill(
"TrigBjetMonitor",GN2Xv01_ptop);
287 NameH =
"GN2Xv01_phbb_tr_"+trigName;
291 GN2Xv01_phbb = phbb_accessor(*
jet);
293 fill(
"TrigBjetMonitor",GN2Xv01_phbb);
295 NameH =
"GN2Xv01_mv_tr_"+trigName;
298 ATH_MSG_DEBUG(
" GN2Xv01_pqcd: " << GN2Xv01_pqcd <<
" GN2Xv01_ptop: " << GN2Xv01_ptop <<
" GN2Xv01_phbb: " << GN2Xv01_phbb );
299 theLLRW =
LLRW (GN2Xv01_pqcd, GN2Xv01_ptop, GN2Xv01_phbb, GN2Xv01_mv);
300 ATH_MSG_DEBUG(
" GN2Xv01_mv: " << GN2Xv01_mv <<
" LLRW: " << theLLRW);
301 if ( theLLRW )
fill(
"TrigBjetMonitor",GN2Xv01_mv);
304 NameH =
"LargeR_jetPt_"+trigName;
307 LargeR_jetPt = (
jet->pt())*1.
e-3;
309 fill(
"TrigBjetMonitor",LargeR_jetPt);
312 NameH =
"LargeR_jetEta_"+trigName;
315 LargeR_jetEta =
jet->eta();
318 NameH =
"LargeR_jetPhi_"+trigName;
321 LargeR_jetPhi =
jet->phi();
322 ATH_MSG_DEBUG(
" LargeR_jetEta: " << LargeR_jetEta <<
" LargeR_jetPhi : " << LargeR_jetPhi);
323 fill(
"TrigBjetMonitor",LargeR_jetEta,LargeR_jetPhi);
326 NameH =
"LargeR_jetMass_"+trigName;
329 LargeR_jetMass = (
jet->m())*1.
e-3;
331 fill(
"TrigBjetMonitor",LargeR_jetMass);
341 std::string nMuonH =
"nMuon_"+trigName;
343 nMuon = onlinemuons.size();
344 fill(
"TrigBjetMonitor",nMuon);
348 std::string nJetH =
"nJet_"+trigName;
350 nJet = onlinejets.size();
351 fill(
"TrigBjetMonitor",nJet);
353 if (nMuon*nJet > 0) {
355 float muonPt1(0.), muonEta1(0.), muonPhi1(0.), muonZ1(0.), jetPt1(0.), jetEta1(0.), jetPhi1(0.), jetZ1(0.), muonZ(0.);
356 double GN1_mv(0.), GN2_mv(0.);
357 bool theLLR(
false), theLLR_GN1(
false), theLLR_GN2(
false);
358 bool plotDeltaZ(
false);
360 for(
const auto& muonLinkInfo : onlinemuons) {
363 std::string NameH =
"muonPt_"+trigName;
366 muonPt = (
muon->pt())*1.
e-3;
368 fill(
"TrigBjetMonitor",muonPt);
370 NameH =
"muonEta_"+trigName;
373 muonEta =
muon->eta();
375 fill(
"TrigBjetMonitor",muonEta);
377 NameH =
"muonPhi_"+trigName;
380 muonPhi =
muon->phi();
383 auto link =
muon->combinedTrackParticleLink();
384 if (link.isValid()) {
402 for(
const auto& jetLinkInfo : onlinejets) {
405 NameH =
"jetPt_"+trigName;
408 jetPt = (
jet->pt())*1.
e-3;
410 fill(
"TrigBjetMonitor",jetPt);
412 NameH =
"jetEta_"+trigName;
417 fill(
"TrigBjetMonitor",jetEta);
419 NameH =
"jetPhi_"+trigName;
433 auto btaggingLinkInfo = TrigCompositeUtils::findLink<xAOD::BTaggingContainer>(jetLinkInfo.source,
m_btaggingLinkName);
435 if ( btaggingLinkInfo.isValid() ) {
439 double GN1_pu(0.), GN1_pc(0.), GN1_pb(0.);
440 btag->
pu(
"GN120220813",GN1_pu);
442 btag->
pc(
"GN120220813",GN1_pc);
444 btag->
pb(
"GN120220813",GN1_pb);
446 theLLR =
LLR (GN1_pu, GN1_pc, GN1_pb, GN1_mv);
448 if ( !theLLR ) GN1_mv=-100.;
451 double GN2_pu(0.), GN2_pc(0.), GN2_pb(0.);
452 btag->
pu(
"GN220240122",GN2_pu);
454 btag->
pc(
"GN220240122",GN2_pc);
456 btag->
pb(
"GN220240122",GN2_pb);
458 theLLR =
LLR (GN2_pu, GN2_pc, GN2_pb, GN2_mv);
460 if ( !theLLR ) GN2_mv=-100.;
478 std::string DeltaRH =
"DeltaR_"+trigName;
481 float DeltaEta = muonEta1 - jetEta1;
483 DeltaR = sqrt( DeltaEta*DeltaEta + DeltaPhi*DeltaPhi );
488 std::string DeltaZH =
"DeltaZ_"+trigName;
491 DeltaZ = std::abs(muonZ1-jetZ1);
493 if (plotDeltaZ)
fill(
"TrigBjetMonitor",DeltaZ);
496 std::string RatioPtH =
"RatioPt_"+trigName;
500 if (jetPt1 > 0.) RatioPt = muonPt1/jetPt1;
502 if (RatioPt > 0.)
fill(
"TrigBjetMonitor",RatioPt);
505 std::string RelPtH =
"RelPt_"+trigName;
509 bool calc_relpt =
CalcRelPt (muonPt1, muonEta1, muonPhi1, jetPt1, jetEta1, jetPhi1, RelPt);
513 std::string wGN1H =
"wGN1_"+trigName;
516 wGN1 =
float(GN1_mv);
518 if (calc_relpt && theLLR_GN1)
fill(
"TrigBjetMonitor",wGN1,RelPt);
521 std::string wGN2H =
"wGN2_"+trigName;
524 wGN2 =
float(GN2_mv);
526 if (calc_relpt && theLLR_GN2)
fill(
"TrigBjetMonitor",wGN2,RelPt);
541 std::string nJetH =
"nJet_"+trigName;
543 nJet = onlinejets.size();
544 fill(
"TrigBjetMonitor",nJet);
548 for(
const auto& jetLinkInfo : onlinejets) {
551 std::string NameH =
"jetPt_"+trigName;
554 jetPt = (
jet->pt())*1.
e-3;
556 fill(
"TrigBjetMonitor",jetPt);
558 NameH =
"jetEta_"+trigName;
563 NameH =
"jetPhi_"+trigName;
567 ATH_MSG_DEBUG(
" jetEta: " << jetEta <<
" jetPhi : " << jetPhi);
568 fill(
"TrigBjetMonitor",jetEta,jetPhi);
576 if ( vtxname.compare(0, 4,
"HLT_")==0 ) vtxname.erase(0,4);
577 auto vertexLinkInfo = TrigCompositeUtils::findLink<xAOD::VertexContainer>(jetLinkInfo.source, vtxname );
580 NameH =
"PVz_jet_"+trigName;
585 fill(
"TrigBjetMonitor",PVz_jet);
586 NameH =
"PVx_jet_"+trigName;
591 fill(
"TrigBjetMonitor",PVx_jet);
592 NameH =
"PVy_jet_"+trigName;
597 fill(
"TrigBjetMonitor",PVy_jet);
606 auto btaggingLinkInfo = TrigCompositeUtils::findLink<xAOD::BTaggingContainer>(jetLinkInfo.source,
m_btaggingLinkName);
607 ATH_CHECK( btaggingLinkInfo.isValid() ) ;
613 NameH =
"GN1_pu_tr_"+trigName;
616 btag->
pu(
"GN120220813",GN1_pu);
618 fill(
"TrigBjetMonitor",GN1_pu);
620 NameH =
"GN1_pc_tr_"+trigName;
623 btag->
pc(
"GN120220813",GN1_pc);
625 fill(
"TrigBjetMonitor",GN1_pc);
627 NameH =
"GN1_pb_tr_"+trigName;
630 btag->
pb(
"GN120220813",GN1_pb);
632 fill(
"TrigBjetMonitor",GN1_pb);
634 NameH =
"GN1_mv_tr_"+trigName;
637 theLLR =
LLR (GN1_pu, GN1_pc, GN1_pb, GN1_mv);
638 if ( theLLR )
fill(
"TrigBjetMonitor",GN1_mv);
643 NameH =
"GN2_pu_tr_"+trigName;
646 btag->
pu(
"GN220240122",GN2_pu);
648 fill(
"TrigBjetMonitor",GN2_pu);
650 NameH =
"GN2_pc_tr_"+trigName;
653 btag->
pc(
"GN220240122",GN2_pc);
655 fill(
"TrigBjetMonitor",GN2_pc);
657 NameH =
"GN2_pb_tr_"+trigName;
660 btag->
pb(
"GN220240122",GN2_pb);
662 fill(
"TrigBjetMonitor",GN2_pb);
664 NameH =
"GN2_mv_tr_"+trigName;
667 theLLR =
LLR (GN2_pu, GN2_pc, GN2_pb, GN2_mv);
668 if ( theLLR )
fill(
"TrigBjetMonitor",GN2_mv);
673 const auto track_it_pair =
m_trigDecTool->associateToEventView(theTracks, jetLinkInfo.source,
"roi");
680 ATH_MSG_DEBUG(
" Track " <<
count <<
" with pT " << (*it)->pt() <<
" from BJet with pT " << (*jetLinkInfo.link)->pt() );
681 ATH_MSG_DEBUG(
" Track " <<
count <<
" with pT/eta/phi " << (*it)->pt() <<
"/" << (*it)->eta() <<
"/" << (*it)->phi() );
684 std::string NameH =
"trkPt_"+trigName;
687 trkPt = ((*it)->pt())*1.
e-3;
689 fill(
"TrigBjetMonitor",trkPt);
690 NameH =
"trkEta_"+trigName;
693 trkEta = (*it)->eta();
694 NameH =
"trkPhi_"+trigName;
697 trkPhi = (*it)->phi();
698 ATH_MSG_DEBUG(
" trkEta: " << trkEta <<
" trkPhi : " << trkPhi);
699 fill(
"TrigBjetMonitor",trkEta,trkPhi);
700 NameH =
"d0_"+trigName;
705 fill(
"TrigBjetMonitor",
d0);
706 NameH =
"z0_"+trigName;
711 fill(
"TrigBjetMonitor",
z0);
712 NameH =
"ed0_"+trigName;
715 ed0 =
Amg::error((*it)->definingParametersCovMatrix(), 0);
717 fill(
"TrigBjetMonitor",ed0);
718 NameH =
"sd0_"+trigName;
722 if (ed0 > 0.) sd0 = std::abs(
d0)/ed0;
724 fill(
"TrigBjetMonitor",sd0);
725 NameH =
"ez0_"+trigName;
728 ez0 =
Amg::error((*it)->definingParametersCovMatrix(), 1);
730 fill(
"TrigBjetMonitor",ez0);
737 ATH_MSG_DEBUG(
" Total number of triggered b-jets: " << ijet <<
" nJet : " << nJet);
738 ATH_MSG_DEBUG(
" Total number of triggered tracks associated to the b-jets: " << itrack);
739 std::string nTrackH =
"nTrack_"+trigName;
742 fill(
"TrigBjetMonitor",nTrack);
749 ATH_MSG_DEBUG(
" Chain " << trigName <<
" is declared for the Express Stream but it is NOT in the Express Stream in an Express Job");
753 ATH_MSG_DEBUG(
" Trigger chain from AllChains list: " << trigName <<
" has not fired " );
759 return StatusCode::SUCCESS;