276 if (!triggerResults.
isValid()) {
278 if (!triggerResults.
isValid()) {
279 edm::LogInfo(
"BTVHLTOfflineSource") <<
"TriggerResults not found, skipping event";
291 edm::LogInfo(
"BTVHLTOfflineSource") <<
"TriggerEvent not found, skipping event";
318 <<
", Event = " << iEvent.
id().
event() << endl;
328 if (!(index < triggerNames.
size())) {
329 edm::LogInfo(
"BTVHLTOfflineSource") <<
"Path " <<
v.getPath() <<
" not in menu, skipping event";
333 if (!triggerResults->accept(index)) {
334 edm::LogInfo(
"BTVHLTOfflineSource") <<
"Path " <<
v.getPath() <<
" not accepted, skipping event";
338 if (
v.getTriggerType() ==
"PF") {
345 if ((
v.getTriggerType() ==
"PF" && pfTags.
isValid()) ||
346 (
v.getTriggerType() ==
"Calo" && caloTags.
isValid() && !caloTags->empty())) {
347 const auto& iter = (
v.getTriggerType() ==
"PF") ? pfTags->begin() : caloTags->begin();
349 float Discr_online = iter->second;
350 if (Discr_online < 0)
351 Discr_online = -0.05;
353 v.Discr->Fill(Discr_online);
354 v.Pt->Fill(iter->first->pt());
355 v.Eta->Fill(iter->first->eta());
357 if (offlineJetTagHandlerb.
isValid()) {
358 for (
auto const& iterOffb : *offlineJetTagHandlerb) {
359 float DR =
reco::deltaR(iterOffb.first->eta(), iterOffb.first->phi(), iter->first->eta(), iter->first->phi());
361 float Discr_offline = iterOffb.second;
364 if (offlineJetTagHandlerbb.
isValid()) {
365 for (
auto const& iterOffbb : *offlineJetTagHandlerbb) {
367 iterOffbb.first->eta(), iterOffbb.first->phi(), iter->first->eta(), iter->first->phi());
369 Discr_offline += iterOffbb.second;
375 if (Discr_offline < 0)
376 Discr_offline = -0.05;
377 v.Discr_HLTvsRECO->Fill(Discr_online, Discr_offline);
378 v.Discr_HLTMinusRECO->Fill(Discr_online - Discr_offline);
380 v.Discr_turnon_loose.denominator->Fill(Discr_offline);
381 v.Discr_turnon_medium.denominator->Fill(Discr_offline);
382 v.Discr_turnon_tight.denominator->Fill(Discr_offline);
385 v.Discr_turnon_loose.numerator->Fill(Discr_offline);
387 v.Discr_turnon_medium.numerator->Fill(Discr_offline);
389 v.Discr_turnon_tight.numerator->Fill(Discr_offline);
396 bool pfSVTagCollValid = (
v.getTriggerType() ==
"PF" && jetSVTagsCollPF.
isValid());
397 bool caloSVTagCollValid = (
v.getTriggerType() ==
"Calo" && jetSVTagsCollCalo.
isValid());
398 if (offlineIPTagHandle.
isValid() && (pfSVTagCollValid || caloSVTagCollValid)) {
399 std::vector<float> offlineIP3D;
400 std::vector<float> offlineIP3DSig;
402 iter->first->eta(), iter->first->phi(), offlineIPTagHandle, offlineIP3D, offlineIP3DSig);
403 std::vector<const reco::Track*> onlineTracks;
404 std::vector<float> onlineIP3D;
405 std::vector<float> onlineIP3DSig;
406 if (pfSVTagCollValid)
407 onlineTracks = getOnlineBTagTracks<SVTagInfo>(
408 iter->first->eta(), iter->first->phi(), jetSVTagsCollPF, onlineIP3D, onlineIP3DSig);
409 if (caloSVTagCollValid)
410 onlineTracks = getOnlineBTagTracks<reco::SecondaryVertexTagInfo>(
411 iter->first->eta(), iter->first->phi(), jetSVTagsCollCalo, onlineIP3D, onlineIP3DSig);
413 for (
unsigned int iOffTrk = 0; iOffTrk < offlineTracks.size(); ++iOffTrk) {
414 const reco::Track* offTrk = offlineTracks.at(iOffTrk);
415 bool hasMatch =
false;
416 float offTrkEta = offTrk->
eta();
417 float offTrkPhi = offTrk->
phi();
420 float DR =
reco::deltaR(offTrkEta, offTrkPhi, onTrk->eta(), onTrk->phi());
426 float offTrkPt = offTrk->
pt();
427 v.OnlineTrkEff_Pt.denominator->Fill(offTrkPt);
429 v.OnlineTrkEff_Pt.numerator->Fill(offTrkPt);
431 v.OnlineTrkEff_Eta.denominator->Fill(offTrkEta);
433 v.OnlineTrkEff_Eta.numerator->Fill(offTrkEta);
435 v.OnlineTrkEff_3d_ip_distance.denominator->Fill(offlineIP3D.at(iOffTrk));
437 v.OnlineTrkEff_3d_ip_distance.numerator->Fill(offlineIP3D.at(iOffTrk));
439 v.OnlineTrkEff_3d_ip_sig.denominator->Fill(offlineIP3DSig.at(iOffTrk));
441 v.OnlineTrkEff_3d_ip_sig.numerator->Fill(offlineIP3DSig.at(iOffTrk));
444 for (
unsigned int iOnTrk = 0; iOnTrk < onlineTracks.size(); ++iOnTrk) {
445 const reco::Track* onTrk = onlineTracks.at(iOnTrk);
446 bool hasMatch =
false;
447 float onTrkEta = onTrk->
eta();
448 float onTrkPhi = onTrk->
phi();
457 float onTrkPt = onTrk->
pt();
458 v.OnlineTrkFake_Pt.denominator->Fill(onTrkPt);
460 v.OnlineTrkFake_Pt.numerator->Fill(onTrkPt);
462 v.OnlineTrkFake_Eta.denominator->Fill(onTrkEta);
464 v.OnlineTrkFake_Eta.numerator->Fill(onTrkEta);
466 v.OnlineTrkFake_3d_ip_distance.denominator->Fill(onlineIP3D.at(iOnTrk));
468 v.OnlineTrkFake_3d_ip_distance.numerator->Fill(onlineIP3D.at(iOnTrk));
470 v.OnlineTrkFake_3d_ip_sig.denominator->Fill(onlineIP3DSig.at(iOnTrk));
472 v.OnlineTrkFake_3d_ip_sig.numerator->Fill(onlineIP3DSig.at(iOnTrk));
476 if (
v.getTriggerType() ==
"PF") {
482 v.PVz->Fill(VertexHandler->begin()->z());
483 if (offlineVertexHandler.
isValid()) {
484 v.PVz_HLTMinusRECO->Fill(VertexHandler->begin()->z() - offlineVertexHandler->begin()->z());
490 if (caloTags.
isValid() &&
v.getTriggerType() ==
"Calo" && !caloTags->empty()) {
493 v.fastPVz->Fill(VertexHandler->begin()->z());
494 if (offlineVertexHandler.
isValid()) {
495 v.fastPVz_HLTMinusRECO->Fill(VertexHandler->begin()->z() - offlineVertexHandler->begin()->z());
516 if ((
v.getTriggerType() ==
"PF" && shallowTagInfosPf.
isValid()) ||
517 (
v.getTriggerType() ==
"Calo" && shallowTagInfosCalo.
isValid())) {
518 const auto& shallowTagInfoCollection = (
v.getTriggerType() ==
"PF") ? shallowTagInfosPf : shallowTagInfosCalo;
519 for (
const auto& shallowTagInfo : *shallowTagInfoCollection) {
520 const auto& tagVars = shallowTagInfo.taggingVariables();
524 v.n_vtx->Fill(tagVar);
527 v.n_sel_tracks->Fill(tagVar);
533 for (
unsigned i_trk = 0; i_trk <
trackSip3dVal.size(); i_trk++) {
536 v.h_3d_ip_distance->Fill(val);
537 v.h_3d_ip_error->Fill(val / sig);
538 v.h_3d_ip_sig->Fill(sig);
543 v.vtx_mass->Fill(tagVar);
546 v.n_vtx_trks->Fill(tagVar);
EventNumber_t event() const
edm::EDGetTokenT< std::vector< SVTagInfo > > SVTagInfosTokenPf_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
edm::EDGetTokenT< std::vector< reco::ShallowTagInfo > > shallowTagInfosTokenCalo_
edm::EDGetTokenT< reco::JetTagCollection > pfTagsToken_
edm::EDGetTokenT< reco::JetTagCollection > offlineDiscrTokenb_
unsigned int triggerIndex(std::string_view name) const
edm::LuminosityBlockNumber_t luminosityBlock() const
double phi() const
azimuthal angle of momentum vector
edm::EDGetTokenT< std::vector< reco::Vertex > > hltCaloPVToken_
edm::EDGetTokenT< std::vector< reco::SecondaryVertexTagInfo > > SVTagInfosTokenCalo_
edm::EDGetTokenT< std::vector< reco::Vertex > > offlinePVToken_
edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const override
edm::EDGetTokenT< trigger::TriggerEvent > triggerSummaryFUToken
double eta() const
pseudorapidity of momentum vector
edm::Handle< reco::JetTagCollection > pfTags
double pt() const
track transverse momentum
PathInfoCollection hltPathsAll_
static std::string const triggerResults
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
edm::EDGetTokenT< reco::JetTagCollection > offlineDiscrTokenbb_
edm::EDGetTokenT< std::vector< reco::Vertex > > hltFastPVToken_
Log< level::Info, false > LogInfo
edm::EDGetTokenT< edm::TriggerResults > triggerResultsToken
edm::EDGetTokenT< std::vector< reco::Vertex > > hltPFPVToken_
float turnon_threshold_loose_
std::vector< const reco::Track * > getOfflineBTagTracks(float hltJetEta, float hltJetPhi, edm::Handle< edm::View< reco::BaseTagInfo >> offlineIPTagHandle, std::vector< float > &offlineIP3D, std::vector< float > &offlineIP3DSig)
edm::EDGetTokenT< trigger::TriggerEvent > triggerSummaryToken
edm::EDGetTokenT< edm::View< reco::BaseTagInfo > > offlineIPToken_
edm::EDGetTokenT< std::vector< reco::ShallowTagInfo > > shallowTagInfosTokenPf_
edm::Handle< reco::JetTagCollection > caloTags
edm::EDGetTokenT< reco::JetTagCollection > caloTagsToken_
float turnon_threshold_tight_
edm::EDGetTokenT< edm::TriggerResults > triggerResultsFUToken
float turnon_threshold_medium_