45 bool CalcRelPt (
float muonPt,
float muonEta,
float muonPhi,
float jetPt,
float jetEta,
float jetPhi,
float &RelPt) {
50 float muonT, muonX, muonY, muonZ,
muon, jetT, jetX, jetY, jetZ,
jet, scprod;
52 muonT = 2.*
atan(
exp(-muonEta) );
54 if ( (std::abs(muonT) > 0.) && (std::abs(jetT) > 0.) ) {
55 muon = muonPt/std::abs(
sin(muonT) );
56 muonX = muonPt*
cos(muonPhi);
57 muonY = muonPt*
sin(muonPhi);
59 jet = jetPt/std::abs(
sin(jetT) );
60 jetX = jetPt*
cos(jetPhi);
61 jetY = jetPt*
sin(jetPhi);
63 scprod = (muonX*jetX + muonY*jetY + muonZ*jetZ)/(
muon*
jet);
65 if ( (1. - scprod) > 0. ) {
66 RelPt =
muon * sqrt(1. - scprod);
88 bool Eofflinepv(
false);
89 float offlinepvz(-1.e6);
90 float offlinepvx(-1.e6);
91 float offlinepvy(-1.e6);
102 return StatusCode::FAILURE;
105 if ( offlinepv->
size() ) {
107 offlinepvz = offlinepv->
front()->z();
108 offlinepvx = offlinepv->
front()->x();
109 offlinepvy = offlinepv->
front()->y();
110 OffNVtx = offlinepv->
size() ;
111 for (
unsigned int j = 0; j<offlinepv->
size(); j++){
112 OffxVtx = (*(offlinepv))[j]->x();
113 OffyVtx = (*(offlinepv))[j]->y();
114 OffzVtx = (*(offlinepv))[j]->z();
115 fill(
"TrigBjetMonitor",OffxVtx,OffyVtx,OffzVtx);
117 fill(
"TrigBjetMonitor",OffNVtx);
126 ATH_MSG_DEBUG(
" Size of the AllChains trigger container: " << size_AllChains );
127 for (
int i =0;
i<size_AllChains;
i++){
134 bool mujetChain(
false);
135 bool bjetChain(
true);
143 ATH_MSG_DEBUG(
" Trigger chain from AllChains list: " << trigName <<
" has fired !!! " );
148 const bool expressPass =
passBits & TrigDefs::Express_passed;
158 std::size_t
found = trigName.find(
"HLT_mu");
159 if (
found!=std::string::npos) {
165 ATH_MSG_DEBUG(
" ===> Run 3 access to Trigger Item: " << trigName);
184 std::string NameH =
"PVz_tr_"+trigName;
190 fill(
"TrigBjetMonitor",PVz_tr);
192 NameH =
"DiffOnOffPVz_tr_"+trigName;
195 DiffOnOffPVz_tr = vtx->z()-offlinepvz;
197 fill(
"TrigBjetMonitor",DiffOnOffPVz_tr);
199 NameH =
"PVx_tr_"+trigName;
204 fill(
"TrigBjetMonitor",PVx_tr);
206 NameH =
"DiffOnOffPVx_tr_"+trigName;
209 DiffOnOffPVx_tr = vtx->x()-offlinepvx;
211 fill(
"TrigBjetMonitor",DiffOnOffPVx_tr);
213 NameH =
"PVy_tr_"+trigName;
218 fill(
"TrigBjetMonitor",PVy_tr);
220 NameH =
"DiffOnOffPVy_tr_"+trigName;
223 DiffOnOffPVy_tr = vtx->y()-offlinepvy;
225 fill(
"TrigBjetMonitor",DiffOnOffPVy_tr);
229 std::string NpvH =
"nPV_tr_"+trigName;
233 fill(
"TrigBjetMonitor",nPV_tr);
239 std::string nMuonH =
"nMuon_"+trigName;
241 nMuon = onlinemuons.size();
242 fill(
"TrigBjetMonitor",nMuon);
246 std::string nJetH =
"nJet_"+trigName;
248 nJet = onlinejets.size();
249 fill(
"TrigBjetMonitor",nJet);
251 if (nMuon*nJet > 0) {
253 float muonPt1(0.), muonEta1(0.), muonPhi1(0.), muonZ1(0.), jetPt1(0.), jetEta1(0.), jetPhi1(0.), jetZ1(0.), muonZ(0.);
254 double GN1_mv(0.), GN2_mv(0.);
255 bool theLLR(
false), theLLR_GN1(
false), theLLR_GN2(
false);
256 bool plotDeltaZ(
false);
258 for(
const auto& muonLinkInfo : onlinemuons) {
261 std::string NameH =
"muonPt_"+trigName;
264 muonPt = (
muon->pt())*1.
e-3;
266 fill(
"TrigBjetMonitor",muonPt);
268 NameH =
"muonEta_"+trigName;
271 muonEta =
muon->eta();
273 fill(
"TrigBjetMonitor",muonEta);
275 NameH =
"muonPhi_"+trigName;
278 muonPhi =
muon->phi();
281 auto link =
muon->combinedTrackParticleLink();
282 if (link.isValid()) {
300 for(
const auto& jetLinkInfo : onlinejets) {
303 NameH =
"jetPt_"+trigName;
306 jetPt = (
jet->pt())*1.
e-3;
308 fill(
"TrigBjetMonitor",jetPt);
310 NameH =
"jetEta_"+trigName;
315 fill(
"TrigBjetMonitor",jetEta);
317 NameH =
"jetPhi_"+trigName;
331 auto btaggingLinkInfo = TrigCompositeUtils::findLink<xAOD::BTaggingContainer>(jetLinkInfo.source,
m_btaggingLinkName);
333 if ( btaggingLinkInfo.isValid() ) {
337 double GN1_pu(0.), GN1_pc(0.), GN1_pb(0.);
338 btag->
pu(
"GN120220813",GN1_pu);
340 btag->
pc(
"GN120220813",GN1_pc);
342 btag->
pb(
"GN120220813",GN1_pb);
344 theLLR =
LLR (GN1_pu, GN1_pc, GN1_pb, GN1_mv);
346 if ( !theLLR ) GN1_mv=-100.;
349 double GN2_pu(0.), GN2_pc(0.), GN2_pb(0.);
350 btag->
pu(
"GN220240122",GN2_pu);
352 btag->
pc(
"GN220240122",GN2_pc);
354 btag->
pb(
"GN220240122",GN2_pb);
356 theLLR =
LLR (GN2_pu, GN2_pc, GN2_pb, GN2_mv);
358 if ( !theLLR ) GN2_mv=-100.;
376 std::string DeltaRH =
"DeltaR_"+trigName;
379 float DeltaEta = muonEta1 - jetEta1;
381 DeltaR = sqrt( DeltaEta*DeltaEta + DeltaPhi*DeltaPhi );
386 std::string DeltaZH =
"DeltaZ_"+trigName;
389 DeltaZ = std::abs(muonZ1-jetZ1);
391 if (plotDeltaZ)
fill(
"TrigBjetMonitor",DeltaZ);
394 std::string RatioPtH =
"RatioPt_"+trigName;
398 if (jetPt1 > 0.) RatioPt = muonPt1/jetPt1;
400 if (RatioPt > 0.)
fill(
"TrigBjetMonitor",RatioPt);
403 std::string RelPtH =
"RelPt_"+trigName;
407 bool calc_relpt =
CalcRelPt (muonPt1, muonEta1, muonPhi1, jetPt1, jetEta1, jetPhi1, RelPt);
411 std::string wGN1H =
"wGN1_"+trigName;
414 wGN1 =
float(GN1_mv);
416 if (calc_relpt && theLLR_GN1)
fill(
"TrigBjetMonitor",wGN1,RelPt);
419 std::string wGN2H =
"wGN2_"+trigName;
422 wGN2 =
float(GN2_mv);
424 if (calc_relpt && theLLR_GN2)
fill(
"TrigBjetMonitor",wGN2,RelPt);
439 std::string nJetH =
"nJet_"+trigName;
441 nJet = onlinejets.size();
442 fill(
"TrigBjetMonitor",nJet);
446 for(
const auto& jetLinkInfo : onlinejets) {
449 std::string NameH =
"jetPt_"+trigName;
452 jetPt = (
jet->pt())*1.
e-3;
454 fill(
"TrigBjetMonitor",jetPt);
456 NameH =
"jetEta_"+trigName;
461 NameH =
"jetPhi_"+trigName;
465 ATH_MSG_DEBUG(
" jetEta: " << jetEta <<
" jetPhi : " << jetPhi);
466 fill(
"TrigBjetMonitor",jetEta,jetPhi);
474 if ( vtxname.compare(0, 4,
"HLT_")==0 ) vtxname.erase(0,4);
475 auto vertexLinkInfo = TrigCompositeUtils::findLink<xAOD::VertexContainer>(jetLinkInfo.source, vtxname );
478 NameH =
"PVz_jet_"+trigName;
483 fill(
"TrigBjetMonitor",PVz_jet);
484 NameH =
"PVx_jet_"+trigName;
489 fill(
"TrigBjetMonitor",PVx_jet);
490 NameH =
"PVy_jet_"+trigName;
495 fill(
"TrigBjetMonitor",PVy_jet);
504 auto btaggingLinkInfo = TrigCompositeUtils::findLink<xAOD::BTaggingContainer>(jetLinkInfo.source,
m_btaggingLinkName);
505 ATH_CHECK( btaggingLinkInfo.isValid() ) ;
511 NameH =
"GN1_pu_tr_"+trigName;
514 btag->
pu(
"GN120220813",GN1_pu);
516 fill(
"TrigBjetMonitor",GN1_pu);
518 NameH =
"GN1_pc_tr_"+trigName;
521 btag->
pc(
"GN120220813",GN1_pc);
523 fill(
"TrigBjetMonitor",GN1_pc);
525 NameH =
"GN1_pb_tr_"+trigName;
528 btag->
pb(
"GN120220813",GN1_pb);
530 fill(
"TrigBjetMonitor",GN1_pb);
532 NameH =
"GN1_mv_tr_"+trigName;
535 theLLR =
LLR (GN1_pu, GN1_pc, GN1_pb, GN1_mv);
536 if ( theLLR )
fill(
"TrigBjetMonitor",GN1_mv);
541 NameH =
"GN2_pu_tr_"+trigName;
544 btag->
pu(
"GN220240122",GN2_pu);
546 fill(
"TrigBjetMonitor",GN2_pu);
548 NameH =
"GN2_pc_tr_"+trigName;
551 btag->
pc(
"GN220240122",GN2_pc);
553 fill(
"TrigBjetMonitor",GN2_pc);
555 NameH =
"GN2_pb_tr_"+trigName;
558 btag->
pb(
"GN220240122",GN2_pb);
560 fill(
"TrigBjetMonitor",GN2_pb);
562 NameH =
"GN2_mv_tr_"+trigName;
565 theLLR =
LLR (GN2_pu, GN2_pc, GN2_pb, GN2_mv);
566 if ( theLLR )
fill(
"TrigBjetMonitor",GN2_mv);
571 const auto track_it_pair =
m_trigDecTool->associateToEventView(theTracks, jetLinkInfo.source,
"roi");
578 ATH_MSG_DEBUG(
" Track " <<
count <<
" with pT " << (*it)->pt() <<
" from BJet with pT " << (*jetLinkInfo.link)->pt() );
579 ATH_MSG_DEBUG(
" Track " <<
count <<
" with pT/eta/phi " << (*it)->pt() <<
"/" << (*it)->eta() <<
"/" << (*it)->phi() );
582 std::string NameH =
"trkPt_"+trigName;
585 trkPt = ((*it)->pt())*1.
e-3;
587 fill(
"TrigBjetMonitor",trkPt);
588 NameH =
"trkEta_"+trigName;
591 trkEta = (*it)->eta();
592 NameH =
"trkPhi_"+trigName;
595 trkPhi = (*it)->phi();
596 ATH_MSG_DEBUG(
" trkEta: " << trkEta <<
" trkPhi : " << trkPhi);
597 fill(
"TrigBjetMonitor",trkEta,trkPhi);
598 NameH =
"d0_"+trigName;
603 fill(
"TrigBjetMonitor",
d0);
604 NameH =
"z0_"+trigName;
609 fill(
"TrigBjetMonitor",
z0);
610 NameH =
"ed0_"+trigName;
613 ed0 =
Amg::error((*it)->definingParametersCovMatrix(), 0);
615 fill(
"TrigBjetMonitor",ed0);
616 NameH =
"sd0_"+trigName;
620 if (ed0 > 0.) sd0 = std::abs(
d0)/ed0;
622 fill(
"TrigBjetMonitor",sd0);
623 NameH =
"ez0_"+trigName;
626 ez0 =
Amg::error((*it)->definingParametersCovMatrix(), 1);
628 fill(
"TrigBjetMonitor",ez0);
635 ATH_MSG_DEBUG(
" Total number of triggered b-jets: " << ijet <<
" nJet : " << nJet);
636 ATH_MSG_DEBUG(
" Total number of triggered tracks associated to the b-jets: " << itrack);
637 std::string nTrackH =
"nTrack_"+trigName;
640 fill(
"TrigBjetMonitor",nTrack);
647 ATH_MSG_DEBUG(
" Chain " << trigName <<
" is declared for the Express Stream but it is NOT in the Express Stream in an Express Job");
651 ATH_MSG_DEBUG(
" Trigger chain from AllChains list: " << trigName <<
" has not fired " );
657 return StatusCode::SUCCESS;