CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes
BTVHLTOfflineSource Class Reference
Inheritance diagram for BTVHLTOfflineSource:

Classes

class  PathInfo
 
class  PathInfoCollection
 

Public Member Functions

 BTVHLTOfflineSource (const edm::ParameterSet &)
 
 ~BTVHLTOfflineSource () override
 

Private Types

typedef reco::TemplatedSecondaryVertexTagInfo< reco::CandIPTagInfo, reco::VertexCompositePtrCandidateSVTagInfo
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &run, edm::EventSetup const &c) override
 
void dqmBeginRun (edm::Run const &run, edm::EventSetup const &c) override
 
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)
 
template<class Base >
std::vector< const reco::Track * > getOnlineBTagTracks (float hltJetEta, float hltJetPhi, edm::Handle< std::vector< Base >> jetSVTagsColl, std::vector< float > &onlineIP3D, std::vector< float > &onlineIP3DSig)
 

Private Attributes

edm::Handle< reco::JetTagCollectioncaloTags
 
edm::EDGetTokenT< reco::JetTagCollectioncaloTagsToken_
 
std::vector< std::pair< std::string, std::string > > custompathnamepairs_
 
std::string dirname_
 
float dRTrackMatch_
 
edm::EDGetTokenT< std::vector< reco::Vertex > > hltCaloPVToken_
 
HLTConfigProvider hltConfig_
 
edm::EDGetTokenT< std::vector< reco::Vertex > > hltFastPVToken_
 
PathInfoCollection hltPathsAll_
 
edm::EDGetTokenT< std::vector< reco::Vertex > > hltPFPVToken_
 
float maxDecayLength_
 
float maxJetDistance_
 
float minDecayLength_
 
float minJetDistance_
 
edm::EDGetTokenT< reco::JetTagCollectionofflineDiscrTokenb_
 
edm::EDGetTokenT< reco::JetTagCollectionofflineDiscrTokenbb_
 
edm::EDGetTokenT< edm::View< reco::BaseTagInfo > > offlineIPToken_
 
edm::EDGetTokenT< std::vector< reco::Vertex > > offlinePVToken_
 
edm::Handle< reco::JetTagCollectionpfTags
 
edm::EDGetTokenT< reco::JetTagCollectionpfTagsToken_
 
std::string processname_
 
edm::EDGetTokenT< std::vector< reco::ShallowTagInfo > > shallowTagInfosTokenCalo_
 
edm::EDGetTokenT< std::vector< reco::ShallowTagInfo > > shallowTagInfosTokenPf_
 
edm::EDGetTokenT< std::vector< reco::SecondaryVertexTagInfo > > SVTagInfosTokenCalo_
 
edm::EDGetTokenT< std::vector< SVTagInfo > > SVTagInfosTokenPf_
 
edm::EDGetTokenT< edm::TriggerResultstriggerResultsFUToken
 
edm::InputTag triggerResultsLabel_
 
edm::EDGetTokenT< edm::TriggerResultstriggerResultsToken
 
edm::EDGetTokenT< trigger::TriggerEventtriggerSummaryFUToken
 
edm::InputTag triggerSummaryLabel_
 
edm::EDGetTokenT< trigger::TriggerEventtriggerSummaryToken
 
float turnon_threshold_loose_
 
float turnon_threshold_medium_
 
float turnon_threshold_tight_
 
bool verbose_
 

Detailed Description

Definition at line 48 of file BTVHLTOfflineSource.cc.

Member Typedef Documentation

◆ SVTagInfo

Definition at line 62 of file BTVHLTOfflineSource.cc.

Constructor & Destructor Documentation

◆ BTVHLTOfflineSource()

BTVHLTOfflineSource::BTVHLTOfflineSource ( const edm::ParameterSet iConfig)
explicit

Definition at line 240 of file BTVHLTOfflineSource.cc.

References custompathnamepairs_, edm::ParameterSet::getParameter(), castor_dqm_sourceclient_file_cfg::path, Skims_PA_cff::paths, and AlCaHLTBitMon_QueryRunRegistry::string.

241  : dirname_(iConfig.getUntrackedParameter("dirname", std::string("HLT/BTV/"))),
242  processname_(iConfig.getParameter<std::string>("processname")),
243  verbose_(iConfig.getUntrackedParameter<bool>("verbose", false)),
244  triggerSummaryLabel_(iConfig.getParameter<edm::InputTag>("triggerSummaryLabel")),
245  triggerResultsLabel_(iConfig.getParameter<edm::InputTag>("triggerResultsLabel")),
246  turnon_threshold_loose_(iConfig.getParameter<double>("turnon_threshold_loose")),
247  turnon_threshold_medium_(iConfig.getParameter<double>("turnon_threshold_medium")),
248  turnon_threshold_tight_(iConfig.getParameter<double>("turnon_threshold_tight")),
249  offlineDiscrTokenb_(consumes<reco::JetTagCollection>(iConfig.getParameter<edm::InputTag>("offlineDiscrLabelb"))),
251  consumes<reco::JetTagCollection>(iConfig.getParameter<edm::InputTag>("offlineDiscrLabelbb"))),
252  offlineIPToken_(consumes<View<BaseTagInfo>>(iConfig.getParameter<edm::InputTag>("offlineIPLabel"))),
253 
254  hltFastPVToken_(consumes<std::vector<reco::Vertex>>(iConfig.getParameter<edm::InputTag>("hltFastPVLabel"))),
255  hltPFPVToken_(consumes<std::vector<reco::Vertex>>(iConfig.getParameter<edm::InputTag>("hltPFPVLabel"))),
256  hltCaloPVToken_(consumes<std::vector<reco::Vertex>>(iConfig.getParameter<edm::InputTag>("hltCaloPVLabel"))),
257  offlinePVToken_(consumes<std::vector<reco::Vertex>>(iConfig.getParameter<edm::InputTag>("offlinePVLabel"))),
258  triggerResultsToken(consumes<edm::TriggerResults>(triggerResultsLabel_)),
259  triggerResultsFUToken(consumes<edm::TriggerResults>(
261  triggerSummaryToken(consumes<trigger::TriggerEvent>(triggerSummaryLabel_)),
262  triggerSummaryFUToken(consumes<trigger::TriggerEvent>(
265  consumes<vector<reco::ShallowTagInfo>>(edm::InputTag("hltDeepCombinedSecondaryVertexBJetTagsInfosCalo"))),
267  consumes<vector<reco::ShallowTagInfo>>(edm::InputTag("hltDeepCombinedSecondaryVertexBJetTagsInfos"))),
268  SVTagInfosTokenCalo_(consumes<std::vector<reco::SecondaryVertexTagInfo>>(
269  edm::InputTag("hltInclusiveSecondaryVertexFinderTagInfos"))),
270  SVTagInfosTokenPf_(consumes<std::vector<SVTagInfo>>(edm::InputTag("hltDeepSecondaryVertexTagInfosPF"))),
271  caloTagsToken_(consumes<reco::JetTagCollection>(iConfig.getParameter<edm::InputTag>("onlineDiscrLabelCalo"))),
272  pfTagsToken_(consumes<reco::JetTagCollection>(iConfig.getParameter<edm::InputTag>("onlineDiscrLabelPF"))),
273  minDecayLength_(iConfig.getParameter<double>("minDecayLength")),
274  maxDecayLength_(iConfig.getParameter<double>("maxDecayLength")),
275  minJetDistance_(iConfig.getParameter<double>("minJetDistance")),
276  maxJetDistance_(iConfig.getParameter<double>("maxJetDistance")),
277  dRTrackMatch_(iConfig.getParameter<double>("dRTrackMatch")) {
278  std::vector<edm::ParameterSet> paths = iConfig.getParameter<std::vector<edm::ParameterSet>>("pathPairs");
279  for (const auto& path : paths) {
280  custompathnamepairs_.push_back(
281  make_pair(path.getParameter<std::string>("pathname"), path.getParameter<std::string>("pathtype")));
282  }
283 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::EDGetTokenT< std::vector< SVTagInfo > > SVTagInfosTokenPf_
std::string const & instance() const
Definition: InputTag.h:37
edm::EDGetTokenT< std::vector< reco::ShallowTagInfo > > shallowTagInfosTokenCalo_
edm::EDGetTokenT< reco::JetTagCollection > pfTagsToken_
edm::EDGetTokenT< reco::JetTagCollection > offlineDiscrTokenb_
edm::EDGetTokenT< std::vector< reco::Vertex > > hltCaloPVToken_
std::string const & label() const
Definition: InputTag.h:36
edm::EDGetTokenT< std::vector< reco::SecondaryVertexTagInfo > > SVTagInfosTokenCalo_
edm::EDGetTokenT< std::vector< reco::Vertex > > offlinePVToken_
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< trigger::TriggerEvent > triggerSummaryFUToken
edm::InputTag triggerResultsLabel_
edm::InputTag triggerSummaryLabel_
edm::EDGetTokenT< reco::JetTagCollection > offlineDiscrTokenbb_
edm::EDGetTokenT< std::vector< reco::Vertex > > hltFastPVToken_
edm::EDGetTokenT< edm::TriggerResults > triggerResultsToken
edm::EDGetTokenT< std::vector< reco::Vertex > > hltPFPVToken_
std::vector< std::pair< std::string, std::string > > custompathnamepairs_
edm::EDGetTokenT< trigger::TriggerEvent > triggerSummaryToken
edm::EDGetTokenT< edm::View< reco::BaseTagInfo > > offlineIPToken_
edm::EDGetTokenT< std::vector< reco::ShallowTagInfo > > shallowTagInfosTokenPf_
edm::EDGetTokenT< reco::JetTagCollection > caloTagsToken_
edm::EDGetTokenT< edm::TriggerResults > triggerResultsFUToken

◆ ~BTVHLTOfflineSource()

BTVHLTOfflineSource::~BTVHLTOfflineSource ( )
overridedefault

Member Function Documentation

◆ analyze()

void BTVHLTOfflineSource::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

offline

Definition at line 304 of file BTVHLTOfflineSource.cc.

References caloTags, caloTagsToken_, gather_cfg::cout, reco::deltaR(), dRTrackMatch_, reco::TrackBase::eta(), reco::btau::flightDistance2dSig, reco::btau::flightDistance2dVal, reco::btau::flightDistance3dSig, reco::btau::flightDistance3dVal, getOfflineBTagTracks(), hltCaloPVToken_, hltFastPVToken_, hltPathsAll_, hltPFPVToken_, iEvent, edm::HandleBase::isValid(), reco::btau::jetEta, reco::btau::jetNSecondaryVertices, reco::btau::jetNSelectedTracks, reco::btau::jetNTracksEtaRel, reco::btau::jetPt, offlineDiscrTokenb_, offlineDiscrTokenbb_, offlineIPToken_, offlinePVToken_, pfTags, pfTagsToken_, reco::TrackBase::phi(), reco::TrackBase::pt(), shallowTagInfosTokenCalo_, shallowTagInfosTokenPf_, SVTagInfosTokenCalo_, SVTagInfosTokenPf_, reco::btau::trackDecayLenVal, reco::btau::trackDeltaR, reco::btau::trackEtaRel, reco::btau::trackJetDistVal, reco::btau::trackPtRatio, reco::btau::trackPtRel, reco::btau::trackSip2dSig, reco::btau::trackSip2dSigAboveCharm, reco::btau::trackSip2dValAboveCharm, reco::btau::trackSip3dSig, reco::btau::trackSip3dSigAboveCharm, reco::btau::trackSip3dVal, reco::btau::trackSip3dValAboveCharm, reco::btau::trackSumJetDeltaR, reco::btau::trackSumJetEtRatio, L1TEGammaOffline_cfi::triggerNames, triggerResults, triggerResultsFUToken, triggerResultsToken, triggerSummaryFUToken, triggerSummaryToken, turnon_threshold_loose_, turnon_threshold_medium_, turnon_threshold_tight_, findQualityFiles::v, heppy_batch::val, verbose_, reco::btau::vertexCategory, reco::btau::vertexEnergyRatio, reco::btau::vertexJetDeltaR, reco::btau::vertexMass, and reco::btau::vertexNTracks.

304  {
307  if (!triggerResults.isValid()) {
309  if (!triggerResults.isValid()) {
310  edm::LogInfo("BTVHLTOfflineSource") << "TriggerResults not found, skipping event";
311  return;
312  }
313  }
314 
315  const edm::TriggerNames& triggerNames = iEvent.triggerNames(*triggerResults);
316 
318  iEvent.getByToken(triggerSummaryToken, triggerObj);
319  if (!triggerObj.isValid()) {
320  iEvent.getByToken(triggerSummaryFUToken, triggerObj);
321  if (!triggerObj.isValid()) {
322  edm::LogInfo("BTVHLTOfflineSource") << "TriggerEvent not found, skipping event";
323  return;
324  }
325  }
326 
328  iEvent.getByToken(caloTagsToken_, caloTags);
329 
331  iEvent.getByToken(pfTagsToken_, pfTags);
332 
333  Handle<reco::VertexCollection> VertexHandler;
334 
335  Handle<reco::JetTagCollection> offlineJetTagHandlerb;
336  iEvent.getByToken(offlineDiscrTokenb_, offlineJetTagHandlerb);
337 
338  Handle<reco::JetTagCollection> offlineJetTagHandlerbb;
339  iEvent.getByToken(offlineDiscrTokenbb_, offlineJetTagHandlerbb);
340 
341  Handle<View<BaseTagInfo>> offlineIPTagHandle;
342  iEvent.getByToken(offlineIPToken_, offlineIPTagHandle);
343 
344  Handle<reco::VertexCollection> offlineVertexHandler;
345  iEvent.getByToken(offlinePVToken_, offlineVertexHandler);
346 
347  if (verbose_ && iEvent.id().event() % 10000 == 0)
348  cout << "Run = " << iEvent.id().run() << ", LS = " << iEvent.luminosityBlock()
349  << ", Event = " << iEvent.id().event() << endl;
350 
351  if (!triggerResults.isValid())
352  return;
353 
354  edm::Handle<std::vector<SVTagInfo>> jetSVTagsCollPF;
356 
357  for (auto& v : hltPathsAll_) {
358  unsigned index = triggerNames.triggerIndex(v.getPath());
359  if (!(index < triggerNames.size())) {
360  edm::LogInfo("BTVHLTOfflineSource") << "Path " << v.getPath() << " not in menu, skipping event";
361  continue;
362  }
363 
364  if (!triggerResults->accept(index)) {
365  edm::LogInfo("BTVHLTOfflineSource") << "Path " << v.getPath() << " not accepted, skipping event";
366  continue;
367  }
368 
369  if (v.getTriggerType() == "PF") {
370  iEvent.getByToken(SVTagInfosTokenPf_, jetSVTagsCollPF);
371  } else {
372  iEvent.getByToken(SVTagInfosTokenCalo_, jetSVTagsCollCalo);
373  }
374 
375  // PF and Calo btagging
376  if ((v.getTriggerType() == "PF" && pfTags.isValid()) ||
377  (v.getTriggerType() == "Calo" && caloTags.isValid() && !caloTags->empty())) {
378  const auto& iter = (v.getTriggerType() == "PF") ? pfTags->begin() : caloTags->begin();
379 
380  float Discr_online = iter->second;
381  if (Discr_online < 0)
382  Discr_online = -0.05;
383 
384  v.Discr->Fill(Discr_online);
385  v.Pt->Fill(iter->first->pt());
386  v.Eta->Fill(iter->first->eta());
387 
388  if (offlineJetTagHandlerb.isValid()) {
389  for (auto const& iterOffb : *offlineJetTagHandlerb) {
390  float DR = reco::deltaR(iterOffb.first->eta(), iterOffb.first->phi(), iter->first->eta(), iter->first->phi());
391  if (DR < 0.3) {
392  float Discr_offline = iterOffb.second;
393 
394  // offline probb and probbb must be added (if probbb isn't specified, it'll just use probb)
395  if (offlineJetTagHandlerbb.isValid()) {
396  for (auto const& iterOffbb : *offlineJetTagHandlerbb) {
397  DR = reco::deltaR(
398  iterOffbb.first->eta(), iterOffbb.first->phi(), iter->first->eta(), iter->first->phi());
399  if (DR < 0.3) {
400  Discr_offline += iterOffbb.second;
401  break;
402  }
403  }
404  }
405 
406  if (Discr_offline < 0)
407  Discr_offline = -0.05;
408  v.Discr_HLTvsRECO->Fill(Discr_online, Discr_offline);
409  v.Discr_HLTMinusRECO->Fill(Discr_online - Discr_offline);
410 
411  v.Discr_turnon_loose.denominator->Fill(Discr_offline);
412  v.Discr_turnon_medium.denominator->Fill(Discr_offline);
413  v.Discr_turnon_tight.denominator->Fill(Discr_offline);
414 
415  if (Discr_online > turnon_threshold_loose_)
416  v.Discr_turnon_loose.numerator->Fill(Discr_offline);
417  if (Discr_online > turnon_threshold_medium_)
418  v.Discr_turnon_medium.numerator->Fill(Discr_offline);
419  if (Discr_online > turnon_threshold_tight_)
420  v.Discr_turnon_tight.numerator->Fill(Discr_offline);
421 
422  break;
423  }
424  }
425  }
426 
427  bool pfSVTagCollValid = (v.getTriggerType() == "PF" && jetSVTagsCollPF.isValid());
428  bool caloSVTagCollValid = (v.getTriggerType() == "Calo" && jetSVTagsCollCalo.isValid());
429  if (offlineIPTagHandle.isValid() && (pfSVTagCollValid || caloSVTagCollValid)) {
430  std::vector<float> offlineIP3D;
431  std::vector<float> offlineIP3DSig;
432  std::vector<const reco::Track*> offlineTracks = getOfflineBTagTracks(
433  iter->first->eta(), iter->first->phi(), offlineIPTagHandle, offlineIP3D, offlineIP3DSig);
434  std::vector<const reco::Track*> onlineTracks;
435  std::vector<float> onlineIP3D;
436  std::vector<float> onlineIP3DSig;
437  if (pfSVTagCollValid)
438  onlineTracks = getOnlineBTagTracks<SVTagInfo>(
439  iter->first->eta(), iter->first->phi(), jetSVTagsCollPF, onlineIP3D, onlineIP3DSig);
440  if (caloSVTagCollValid)
441  onlineTracks = getOnlineBTagTracks<reco::SecondaryVertexTagInfo>(
442  iter->first->eta(), iter->first->phi(), jetSVTagsCollCalo, onlineIP3D, onlineIP3DSig);
443 
444  for (unsigned int iOffTrk = 0; iOffTrk < offlineTracks.size(); ++iOffTrk) {
445  const reco::Track* offTrk = offlineTracks.at(iOffTrk);
446  bool hasMatch = false;
447  float offTrkEta = offTrk->eta();
448  float offTrkPhi = offTrk->phi();
449 
450  for (const reco::Track* onTrk : onlineTracks) {
451  float DR = reco::deltaR(offTrkEta, offTrkPhi, onTrk->eta(), onTrk->phi());
452  if (DR < dRTrackMatch_) {
453  hasMatch = true;
454  }
455  }
456 
457  float offTrkPt = offTrk->pt();
458  v.OnlineTrkEff_Pt.denominator->Fill(offTrkPt);
459  if (hasMatch)
460  v.OnlineTrkEff_Pt.numerator->Fill(offTrkPt);
461 
462  v.OnlineTrkEff_Eta.denominator->Fill(offTrkEta);
463  if (hasMatch)
464  v.OnlineTrkEff_Eta.numerator->Fill(offTrkEta);
465 
466  v.OnlineTrkEff_3d_ip_distance.denominator->Fill(offlineIP3D.at(iOffTrk));
467  if (hasMatch)
468  v.OnlineTrkEff_3d_ip_distance.numerator->Fill(offlineIP3D.at(iOffTrk));
469 
470  v.OnlineTrkEff_3d_ip_sig.denominator->Fill(offlineIP3DSig.at(iOffTrk));
471  if (hasMatch)
472  v.OnlineTrkEff_3d_ip_sig.numerator->Fill(offlineIP3DSig.at(iOffTrk));
473  }
474 
475  for (unsigned int iOnTrk = 0; iOnTrk < onlineTracks.size(); ++iOnTrk) {
476  const reco::Track* onTrk = onlineTracks.at(iOnTrk);
477  bool hasMatch = false;
478  float onTrkEta = onTrk->eta();
479  float onTrkPhi = onTrk->phi();
480 
481  for (const reco::Track* offTrk : offlineTracks) {
482  float DR = reco::deltaR(onTrkEta, onTrkPhi, offTrk->eta(), offTrk->phi());
483  if (DR < dRTrackMatch_) {
484  hasMatch = true;
485  }
486  }
487 
488  float onTrkPt = onTrk->pt();
489  v.OnlineTrkFake_Pt.denominator->Fill(onTrkPt);
490  if (!hasMatch)
491  v.OnlineTrkFake_Pt.numerator->Fill(onTrkPt);
492 
493  v.OnlineTrkFake_Eta.denominator->Fill(onTrkEta);
494  if (!hasMatch)
495  v.OnlineTrkFake_Eta.numerator->Fill(onTrkEta);
496 
497  v.OnlineTrkFake_3d_ip_distance.denominator->Fill(onlineIP3D.at(iOnTrk));
498  if (!hasMatch)
499  v.OnlineTrkFake_3d_ip_distance.numerator->Fill(onlineIP3D.at(iOnTrk));
500 
501  v.OnlineTrkFake_3d_ip_sig.denominator->Fill(onlineIP3DSig.at(iOnTrk));
502  if (!hasMatch)
503  v.OnlineTrkFake_3d_ip_sig.numerator->Fill(onlineIP3DSig.at(iOnTrk));
504  }
505  }
506 
507  if (v.getTriggerType() == "PF") {
508  iEvent.getByToken(hltPFPVToken_, VertexHandler);
509  } else {
510  iEvent.getByToken(hltFastPVToken_, VertexHandler);
511  }
512  if (VertexHandler.isValid()) {
513  v.PVz->Fill(VertexHandler->begin()->z());
514  if (offlineVertexHandler.isValid()) {
515  v.PVz_HLTMinusRECO->Fill(VertexHandler->begin()->z() - offlineVertexHandler->begin()->z());
516  }
517  }
518  } // caloTagsValid or PFTagsValid
519 
520  // specific to Calo b-tagging
521  if (caloTags.isValid() && v.getTriggerType() == "Calo" && !caloTags->empty()) {
522  iEvent.getByToken(hltCaloPVToken_, VertexHandler);
523  if (VertexHandler.isValid()) {
524  v.fastPVz->Fill(VertexHandler->begin()->z());
525  if (offlineVertexHandler.isValid()) {
526  v.fastPVz_HLTMinusRECO->Fill(VertexHandler->begin()->z() - offlineVertexHandler->begin()->z());
527  }
528  }
529  }
530 
531  // additional plots from tag info collections
533 
535  iEvent.getByToken(shallowTagInfosTokenCalo_, shallowTagInfosCalo);
536 
538  iEvent.getByToken(shallowTagInfosTokenPf_, shallowTagInfosPf);
539 
540  // edm::Handle<std::vector<reco::TemplatedSecondaryVertexTagInfo<reco::IPTagInfo<edm::RefVector<std::vector<reco::Track>, reco::Track, edm::refhelper::FindUsingAdvance<std::vector<reco::Track>, reco::Track> >, reco::JTATagInfo>, reco::Vertex> > > caloTagInfos;
541  // iEvent.getByToken(caloTagInfosToken_, caloTagInfos);
542 
543  // edm::Handle<std::vector<reco::TemplatedSecondaryVertexTagInfo<reco::IPTagInfo<edm::RefVector<std::vector<reco::Track>, reco::Track, edm::refhelper::FindUsingAdvance<std::vector<reco::Track>, reco::Track> >, reco::JTATagInfo>, reco::Vertex> > > pfTagInfos;
544  // iEvent.getByToken(pfTagInfosToken_, pfTagInfos);
545 
546  // first try to get info from shallowTagInfos ...
547  if ((v.getTriggerType() == "PF" && shallowTagInfosPf.isValid()) ||
548  (v.getTriggerType() == "Calo" && shallowTagInfosCalo.isValid())) {
549  const auto& shallowTagInfoCollection = (v.getTriggerType() == "PF") ? shallowTagInfosPf : shallowTagInfosCalo;
550  for (const auto& shallowTagInfo : *shallowTagInfoCollection) {
551  const auto& tagVars = shallowTagInfo.taggingVariables();
552 
553  // n secondary vertices and n selected tracks
554  for (const auto& tagVar : tagVars.getList(reco::btau::jetNSecondaryVertices, false)) {
555  v.h_jetNSecondaryVertices->Fill(tagVar);
556  v.n_vtx->Fill(tagVar);
557  }
558 
559  for (const auto& tagVar : tagVars.getList(reco::btau::jetNSelectedTracks, false)) {
560  v.n_sel_tracks->Fill(tagVar);
561  v.h_jetNSelectedTracks->Fill(tagVar);
562  }
563 
564  for (const auto& tagVar : tagVars.getList(reco::btau::jetPt, false)) {
565  v.h_jet_pt->Fill(tagVar);
566  }
567 
568  for (const auto& tagVar : tagVars.getList(reco::btau::jetEta, false)) {
569  v.h_jet_eta->Fill(tagVar);
570  }
571 
572  for (const auto& tagVar : tagVars.getList(reco::btau::trackSumJetEtRatio, false)) {
573  v.h_trackSumJetEtRatio->Fill(tagVar);
574  }
575 
576  for (const auto& tagVar : tagVars.getList(reco::btau::trackSumJetDeltaR, false)) {
577  v.h_trackSumJetDeltaR->Fill(tagVar);
578  }
579 
580  for (const auto& tagVar : tagVars.getList(reco::btau::vertexCategory, false)) {
581  v.h_vertexCategory->Fill(tagVar);
582  }
583 
584  for (const auto& tagVar : tagVars.getList(reco::btau::trackSip2dValAboveCharm, false)) {
585  v.h_trackSip2dValAboveCharm->Fill(tagVar);
586  }
587 
588  for (const auto& tagVar : tagVars.getList(reco::btau::trackSip2dSigAboveCharm, false)) {
589  v.h_trackSip2dSigAboveCharm->Fill(tagVar);
590  }
591 
592  for (const auto& tagVar : tagVars.getList(reco::btau::trackSip3dValAboveCharm, false)) {
593  v.h_trackSip3dValAboveCharm->Fill(tagVar);
594  }
595 
596  for (const auto& tagVar : tagVars.getList(reco::btau::trackSip3dSigAboveCharm, false)) {
597  v.h_trackSip3dSigAboveCharm->Fill(tagVar);
598  }
599 
600  for (const auto& tagVar : tagVars.getList(reco::btau::jetNTracksEtaRel, false)) {
601  v.h_jetNTracksEtaRel->Fill(tagVar);
602  }
603 
604  // impact parameter
605  // and new info
606  const auto& trackSip3dVal = tagVars.getList(reco::btau::trackSip3dVal, false);
607  const auto& trackSip3dSig = tagVars.getList(reco::btau::trackSip3dSig, false);
608  const auto& trackJetDistVal = tagVars.getList(reco::btau::trackJetDistVal, false);
609  const auto& trackPtRel = tagVars.getList(reco::btau::trackPtRel, false);
610  const auto& trackSip2dSig = tagVars.getList(reco::btau::trackSip2dSig, false);
611  const auto& trackDeltaR = tagVars.getList(reco::btau::trackDeltaR, false);
612  const auto& trackPtRatio = tagVars.getList(reco::btau::trackPtRatio, false);
613  const auto& trackDecayLenVal = tagVars.getList(reco::btau::trackDecayLenVal, false);
614  const auto& trackEtaRel = tagVars.getList(reco::btau::trackEtaRel, false);
615 
616  for (unsigned i_trk = 0; i_trk < trackEtaRel.size(); i_trk++) {
617  v.h_trackEtaRel->Fill(trackEtaRel[i_trk]);
618  }
619 
620  for (unsigned i_trk = 0; i_trk < trackJetDistVal.size(); i_trk++) {
621  v.h_trackJetDistVal->Fill(trackJetDistVal[i_trk]);
622  }
623 
624  for (unsigned i_trk = 0; i_trk < trackPtRel.size(); i_trk++) {
625  v.h_trackPtRel->Fill(trackPtRel[i_trk]);
626  }
627 
628  for (unsigned i_trk = 0; i_trk < trackDeltaR.size(); i_trk++) {
629  v.h_trackDeltaR->Fill(trackDeltaR[i_trk]);
630  }
631 
632  for (unsigned i_trk = 0; i_trk < trackPtRatio.size(); i_trk++) {
633  v.h_trackPtRatio->Fill(trackPtRatio[i_trk]);
634  }
635 
636  for (unsigned i_trk = 0; i_trk < trackDecayLenVal.size(); i_trk++) {
637  v.h_trackDecayLenVal->Fill(trackDecayLenVal[i_trk]);
638  }
639 
640  for (unsigned i_trk = 0; i_trk < trackSip3dVal.size(); i_trk++) {
641  float val = trackSip3dVal[i_trk];
642  float sig = trackSip3dSig[i_trk];
643  v.h_3d_ip_distance->Fill(val);
644  v.h_3d_ip_error->Fill(val / sig);
645  v.h_3d_ip_sig->Fill(sig);
646 
647  v.h_trackSip2dSig->Fill(trackSip2dSig[i_trk]);
648  }
649 
650  // vertex mass and tracks per vertex
651  for (const auto& tagVar : tagVars.getList(reco::btau::vertexMass, false)) {
652  v.vtx_mass->Fill(tagVar);
653  }
654  for (const auto& tagVar : tagVars.getList(reco::btau::vertexNTracks, false)) {
655  v.n_vtx_trks->Fill(tagVar);
656  }
657 
658  for (const auto& tagVar : tagVars.getList(reco::btau::vertexEnergyRatio, false)) {
659  v.h_vertexEnergyRatio->Fill(tagVar);
660  }
661 
662  for (const auto& tagVar : tagVars.getList(reco::btau::vertexJetDeltaR, false)) {
663  v.h_vertexJetDeltaR->Fill(tagVar);
664  }
665 
666  for (const auto& tagVar : tagVars.getList(reco::btau::flightDistance2dVal, false)) {
667  v.h_flightDistance2dVal->Fill(tagVar);
668  }
669 
670  for (const auto& tagVar : tagVars.getList(reco::btau::flightDistance2dSig, false)) {
671  v.h_flightDistance2dSig->Fill(tagVar);
672  }
673 
674  for (const auto& tagVar : tagVars.getList(reco::btau::flightDistance3dVal, false)) {
675  v.h_flightDistance3dVal->Fill(tagVar);
676  }
677 
678  for (const auto& tagVar : tagVars.getList(reco::btau::flightDistance3dSig, false)) {
679  v.h_flightDistance3dSig->Fill(tagVar);
680  }
681 
682  // // track N total/pixel hits
683  // for (const auto & tagVar : tagVars.getList(reco::btau::trackNPixelHits, false)) {
684  // v.n_pixel_hits->Fill(tagVar);}
685  // for (const auto & tagVar : tagVars.getList(reco::btau::trackNTotalHits, false)) {
686  // v.n_total_hits->Fill(tagVar);}
687  }
688  }
689 
690  // ... otherwise from usual tag infos.
691  // else
692  // if ( (v.getTriggerType() == "PF" && pfTagInfos.isValid())
693  // || (v.getTriggerType() == "Calo" && caloTagInfos.isValid()) )
694  // {
695  // const auto & DiscrTagInfoCollection = (v.getTriggerType() == "PF") ? pfTagInfos : caloTagInfos;
696 
697  // // loop over secondary vertex tag infos
698  // for (const auto & DiscrTagInfo : *DiscrTagInfoCollection) {
699  // v.n_vtx->Fill(DiscrTagInfo.nVertexCandidates());
700  // v.n_sel_tracks->Fill(DiscrTagInfo.nSelectedTracks());
701 
702  // // loop over selected tracks in each tag info
703  // for (unsigned i_trk=0; i_trk < DiscrTagInfo.nSelectedTracks(); i_trk++) {
704  // const auto & ip3d = DiscrTagInfo.trackIPData(i_trk).ip3d;
705  // v.h_3d_ip_distance->Fill(ip3d.value());
706  // v.h_3d_ip_error->Fill(ip3d.error());
707  // v.h_3d_ip_sig->Fill(ip3d.significance());
708  // }
709 
710  // // loop over vertex candidates in each tag info
711  // for (unsigned i_sv=0; i_sv < DiscrTagInfo.nVertexCandidates(); i_sv++) {
712  // const auto & sv = DiscrTagInfo.secondaryVertex(i_sv);
713  // v.vtx_mass->Fill(sv.p4().mass());
714  // v.n_vtx_trks->Fill(sv.nTracks());
715 
716  // // loop over tracks for number of pixel and total hits
717  // const auto & trkIPTagInfo = DiscrTagInfo.trackIPTagInfoRef().get();
718  // for (const auto & trk : trkIPTagInfo->selectedTracks()) {
719  // v.n_pixel_hits->Fill(trk.get()->hitPattern().numberOfValidPixelHits());
720  // v.n_total_hits->Fill(trk.get()->hitPattern().numberOfValidHits());
721  // }
722  // }
723  // }
724  // }
725  } //end paths loop
726 }
edm::EDGetTokenT< std::vector< SVTagInfo > > SVTagInfosTokenPf_
edm::EDGetTokenT< std::vector< reco::ShallowTagInfo > > shallowTagInfosTokenCalo_
edm::EDGetTokenT< reco::JetTagCollection > pfTagsToken_
edm::EDGetTokenT< reco::JetTagCollection > offlineDiscrTokenb_
edm::EDGetTokenT< std::vector< reco::Vertex > > hltCaloPVToken_
edm::EDGetTokenT< std::vector< reco::SecondaryVertexTagInfo > > SVTagInfosTokenCalo_
edm::EDGetTokenT< std::vector< reco::Vertex > > offlinePVToken_
edm::EDGetTokenT< trigger::TriggerEvent > triggerSummaryFUToken
double pt() const
track transverse momentum
Definition: TrackBase.h:637
int iEvent
Definition: GenABIO.cc:224
edm::Handle< reco::JetTagCollection > pfTags
double phi() const
azimuthal angle of momentum vector
Definition: TrackBase.h:649
PathInfoCollection hltPathsAll_
static std::string const triggerResults
Definition: EdmProvDump.cc:47
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:30
edm::EDGetTokenT< reco::JetTagCollection > offlineDiscrTokenbb_
edm::EDGetTokenT< std::vector< reco::Vertex > > hltFastPVToken_
Log< level::Info, false > LogInfo
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:652
edm::EDGetTokenT< edm::TriggerResults > triggerResultsToken
edm::EDGetTokenT< std::vector< reco::Vertex > > hltPFPVToken_
bool isValid() const
Definition: HandleBase.h:70
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_
edm::EDGetTokenT< edm::TriggerResults > triggerResultsFUToken

◆ bookHistograms()

void BTVHLTOfflineSource::bookHistograms ( DQMStore::IBooker iBooker,
edm::Run const &  run,
edm::EventSetup const &  c 
)
overrideprivate

Definition at line 810 of file BTVHLTOfflineSource.cc.

References dqm::implementation::IBooker::book1D(), dqm::implementation::IBooker::book2D(), dirname_, hltPathsAll_, HLTConfigProvider::removeVersion(), dqm::implementation::NavigatorBase::setCurrentFolder(), AlCaHLTBitMon_QueryRunRegistry::string, runGCPTkAlMap::title, and findQualityFiles::v.

810  {
811  iBooker.setCurrentFolder(dirname_);
812  for (auto& v : hltPathsAll_) {
813  std::string trgPathName = HLTConfigProvider::removeVersion(v.getPath());
814  std::string subdirName = dirname_ + "/" + trgPathName + v.getTriggerType();
815  std::string trigPath = "(" + trgPathName + ")";
816  iBooker.setCurrentFolder(subdirName);
817 
818  std::string labelname("HLT");
819  std::string histoname(labelname + "");
820  std::string title(labelname + "");
821 
822  histoname = labelname + "_Discr";
823  title = labelname + "_Discr " + trigPath;
824  v.Discr = iBooker.book1D(histoname.c_str(), title.c_str(), 110, -0.1, 1);
825 
826  histoname = labelname + "_Pt";
827  title = labelname + "_Pt " + trigPath;
828  v.Pt = iBooker.book1D(histoname.c_str(), title.c_str(), 100, 0, 400);
829 
830  histoname = labelname + "_Eta";
831  title = labelname + "_Eta " + trigPath;
832  v.Eta = iBooker.book1D(histoname.c_str(), title.c_str(), 60, -3.0, 3.0);
833 
834  histoname = "HLTvsRECO_Discr";
835  title = "online discr vs offline discr " + trigPath;
836  v.Discr_HLTvsRECO = iBooker.book2D(histoname.c_str(), title.c_str(), 110, -0.1, 1, 110, -0.1, 1);
837 
838  histoname = "HLTMinusRECO_Discr";
839  title = "online discr minus offline discr " + trigPath;
840  v.Discr_HLTMinusRECO = iBooker.book1D(histoname.c_str(), title.c_str(), 100, -1, 1);
841 
842  histoname = "Turnon_loose_Discr";
843  title = "turn-on with loose threshold " + trigPath;
844  v.bookME(iBooker, v.Discr_turnon_loose, histoname, title, 22, -0.1, 1.);
845 
846  histoname = "Turnon_medium_Discr";
847  title = "turn-on with medium threshold " + trigPath;
848  v.bookME(iBooker, v.Discr_turnon_medium, histoname, title, 22, -0.1, 1.);
849 
850  histoname = "Turnon_tight_Discr";
851  title = "turn-on with tight threshold " + trigPath;
852  v.bookME(iBooker, v.Discr_turnon_tight, histoname, title, 22, -0.1, 1.);
853 
854  histoname = labelname + "_PVz";
855  title = "online z(PV) " + trigPath;
856  v.PVz = iBooker.book1D(histoname.c_str(), title.c_str(), 80, -20, 20);
857 
858  histoname = labelname + "_fastPVz";
859  title = "online z(fastPV) " + trigPath;
860  v.fastPVz = iBooker.book1D(histoname.c_str(), title.c_str(), 80, -20, 20);
861 
862  histoname = "HLTMinusRECO_PVz";
863  title = "online z(PV) - offline z(PV) " + trigPath;
864  v.PVz_HLTMinusRECO = iBooker.book1D(histoname.c_str(), title.c_str(), 200, -0.5, 0.5);
865 
866  histoname = "HLTMinusRECO_fastPVz";
867  title = "online z(fastPV) - offline z(PV) " + trigPath;
868  v.fastPVz_HLTMinusRECO = iBooker.book1D(histoname.c_str(), title.c_str(), 100, -2, 2);
869 
870  histoname = "n_vtx";
871  title = "N vertex candidates " + trigPath;
872  v.n_vtx = iBooker.book1D(histoname.c_str(), title.c_str(), 10, -0.5, 9.5);
873 
874  histoname = "vtx_mass";
875  title = "secondary vertex mass (GeV)" + trigPath;
876  v.vtx_mass = iBooker.book1D(histoname.c_str(), title.c_str(), 20, 0, 10);
877 
878  histoname = "n_vtx_trks";
879  title = "N tracks associated to secondary vertex" + trigPath;
880  v.n_vtx_trks = iBooker.book1D(histoname.c_str(), title.c_str(), 20, -0.5, 19.5);
881 
882  histoname = "n_sel_tracks";
883  title = "N selected tracks" + trigPath;
884  v.n_sel_tracks = iBooker.book1D(histoname.c_str(), title.c_str(), 25, -0.5, 24.5);
885 
886  histoname = "3d_ip_distance";
887  title = "3D IP distance of tracks (cm)" + trigPath;
888  v.h_3d_ip_distance = iBooker.book1D(histoname.c_str(), title.c_str(), 40, -0.1, 0.1);
889 
890  histoname = "3d_ip_error";
891  title = "3D IP error of tracks (cm)" + trigPath;
892  v.h_3d_ip_error = iBooker.book1D(histoname.c_str(), title.c_str(), 40, 0., 0.1);
893 
894  histoname = "3d_ip_sig";
895  title = "3D IP significance of tracks (cm)" + trigPath;
896  v.h_3d_ip_sig = iBooker.book1D(histoname.c_str(), title.c_str(), 40, -40, 40);
897 
898  //new
899  histoname = "jetNSecondaryVertices";
900  title = "jet N Secondary Vertices" + trigPath;
901  v.h_jetNSecondaryVertices = iBooker.book1D(histoname.c_str(), title.c_str(), 10, -0.5, 9.5);
902 
903  histoname = "jet_pt";
904  title = "jet pt" + trigPath;
905  v.h_jet_pt = iBooker.book1D(histoname.c_str(), title.c_str(), 100, -0.1, 100);
906 
907  histoname = "jet_eta";
908  title = "jet eta" + trigPath;
909  v.h_jet_eta = iBooker.book1D(histoname.c_str(), title.c_str(), 100, -2.5, 2.5);
910 
911  histoname = "trackSumJetEtRatio";
912  title = "trackSumJetEtRatio" + trigPath;
913  v.h_trackSumJetEtRatio = iBooker.book1D(histoname.c_str(), title.c_str(), 100, -0.1, 1.5);
914 
915  histoname = "trackSip2dValAboveCharm";
916  title = "trackSip2dSigAboveCharm" + trigPath;
917  v.h_trackSip2dSigAboveCharm = iBooker.book1D(histoname.c_str(), title.c_str(), 100, -0.2, 0.2);
918 
919  histoname = "trackSip2dSigAboveCharm";
920  title = "trackSip2dSigAboveCharm" + trigPath;
921  v.h_trackSip2dValAboveCharm = iBooker.book1D(histoname.c_str(), title.c_str(), 100, -50, 50);
922 
923  histoname = "trackSip3dValAboveCharm";
924  title = "trackSip3dValAboveCharm" + trigPath;
925  v.h_trackSip3dValAboveCharm = iBooker.book1D(histoname.c_str(), title.c_str(), 100, -0.2, 0.2);
926 
927  histoname = "trackSip3dSigAboveCharm";
928  title = "trackSip3dSigAboveCharm" + trigPath;
929  v.h_trackSip3dSigAboveCharm = iBooker.book1D(histoname.c_str(), title.c_str(), 100, -50, 50);
930 
931  histoname = "jetNSelectedTracks";
932  title = "jet N Selected Tracks" + trigPath;
933  v.h_jetNSelectedTracks = iBooker.book1D(histoname.c_str(), title.c_str(), 42, -1.5, 40.5);
934 
935  histoname = "jetNTracksEtaRel";
936  title = "jetNTracksEtaRel" + trigPath;
937  v.h_jetNTracksEtaRel = iBooker.book1D(histoname.c_str(), title.c_str(), 42, -1.5, 40.5);
938 
939  histoname = "vertexCategory";
940  title = "vertex category" + trigPath;
941  v.h_vertexCategory = iBooker.book1D(histoname.c_str(), title.c_str(), 4, -1.5, 2.5);
942 
943  histoname = "trackSumJetDeltaR";
944  title = "trackSumJetDeltaR" + trigPath;
945  v.h_trackSumJetDeltaR = iBooker.book1D(histoname.c_str(), title.c_str(), 100, -0.1, 0.35);
946 
947  //new 2 below
948  histoname = "trackJetDistVal";
949  title = "trackJetDistVal" + trigPath;
950  v.h_trackJetDistVal = iBooker.book1D(histoname.c_str(), title.c_str(), 100, -1, 0.01);
951 
952  histoname = "trackPtRel";
953  title = "track pt rel" + trigPath;
954  v.h_trackPtRel = iBooker.book1D(histoname.c_str(), title.c_str(), 100, -0.1, 7);
955 
956  histoname = "trackDeltaR";
957  title = "trackDeltaR" + trigPath;
958  v.h_trackDeltaR = iBooker.book1D(histoname.c_str(), title.c_str(), 160, -0.05, .47);
959 
960  histoname = "trackPtRatio";
961  title = "trackPtRatio" + trigPath;
962  v.h_trackPtRatio = iBooker.book1D(histoname.c_str(), title.c_str(), 100, -0.01, 0.3);
963 
964  histoname = "trackSip2dSig";
965  title = "trackSip2dSig" + trigPath;
966  v.h_trackSip2dSig = iBooker.book1D(histoname.c_str(), title.c_str(), 100, -55, 55);
967 
968  histoname = "trackDecayLenVal";
969  title = "trackDecayLenVal" + trigPath;
970  v.h_trackDecayLenVal = iBooker.book1D(histoname.c_str(), title.c_str(), 100, -0.1, 22);
971 
972  histoname = "trackEtaRel";
973  title = "trackEtaRel" + trigPath;
974  v.h_trackEtaRel = iBooker.book1D(histoname.c_str(), title.c_str(), 31, 0, 30);
975 
976  //new 3 below
977  histoname = "vertexEnergyRatio";
978  title = "vertexEnergyRatio" + trigPath;
979  v.h_vertexEnergyRatio = iBooker.book1D(histoname.c_str(), title.c_str(), 100, -0.1, 3);
980 
981  histoname = "vertexJetDeltaR";
982  title = "vertexJetDeltaR" + trigPath;
983  v.h_vertexJetDeltaR = iBooker.book1D(histoname.c_str(), title.c_str(), 100, -0.01, 0.4);
984 
985  histoname = "flightDistance2dVal";
986  title = "flightDistance2dVal" + trigPath;
987  v.h_flightDistance2dVal = iBooker.book1D(histoname.c_str(), title.c_str(), 100, -0.1, 5);
988 
989  histoname = "flightDistance2dSig";
990  title = "flightDistance2dSig" + trigPath;
991  v.h_flightDistance2dSig = iBooker.book1D(histoname.c_str(), title.c_str(), 100, -10, 150);
992 
993  histoname = "flightDistance3dVal";
994  title = "flightDistance3dVal" + trigPath;
995  v.h_flightDistance3dVal = iBooker.book1D(histoname.c_str(), title.c_str(), 100, -0.1, 5);
996 
997  histoname = "flightDistance3dSig";
998  title = "flightDistance3dSig" + trigPath;
999  v.h_flightDistance3dSig = iBooker.book1D(histoname.c_str(), title.c_str(), 100, -10, 150);
1000 
1001  //end new
1002 
1003  histoname = "OnlineTrkEff_Pt";
1004  title = "Relative Online Trk Efficiency vs Pt " + trigPath;
1005  v.bookME(iBooker, v.OnlineTrkEff_Pt, histoname, title, 50, -0.5, 20.);
1006 
1007  histoname = "OnlineTrkEff_Eta";
1008  title = "Relative Online Trk Efficiency vs Eta " + trigPath;
1009  v.bookME(iBooker, v.OnlineTrkEff_Eta, histoname, title, 60, -3.0, 3.0);
1010 
1011  histoname = "OnlineTrkEff_3d_ip_distance";
1012  title = "Relative Online Trk Efficiency vs IP3D " + trigPath;
1013  v.bookME(iBooker, v.OnlineTrkEff_3d_ip_distance, histoname, title, 40, -0.1, 0.1);
1014 
1015  histoname = "OnlineTrkEff_3d_ip_sig";
1016  title = "Relative Online Trk Efficiency vs IP3D significance " + trigPath;
1017  v.bookME(iBooker, v.OnlineTrkEff_3d_ip_sig, histoname, title, 40, -40, 40);
1018 
1019  histoname = "OnlineTrkFake_Pt";
1020  title = "Relative Online Trk Fake Rate vs Pt " + trigPath;
1021  v.bookME(iBooker, v.OnlineTrkFake_Pt, histoname, title, 50, -0.5, 20.);
1022 
1023  histoname = "OnlineTrkFake_Eta";
1024  title = "Relative Online Trk Fake Rate vs Eta " + trigPath;
1025  v.bookME(iBooker, v.OnlineTrkFake_Eta, histoname, title, 60, -3.0, 3.0);
1026 
1027  histoname = "OnlineTrkFake_3d_ip_distance";
1028  title = "Relative Online Trk Fake Rate vs IP3D " + trigPath;
1029  v.bookME(iBooker, v.OnlineTrkFake_3d_ip_distance, histoname, title, 40, -0.1, 0.1);
1030 
1031  histoname = "OnlineTrkFake_3d_ip_sig";
1032  title = "Relative Online Trk Fake Rate vs IP3D significance " + trigPath;
1033  v.bookME(iBooker, v.OnlineTrkFake_3d_ip_sig, histoname, title, 40, -40, 40);
1034 
1035  // histoname = "n_pixel_hits";
1036  // title = "N pixel hits"+trigPath;
1037  // v.n_pixel_hits = iBooker.book1D(histoname.c_str(), title.c_str(), 16, -0.5, 15.5);
1038 
1039  // histoname = "n_total_hits";
1040  // title = "N hits"+trigPath;
1041  // v.n_total_hits = iBooker.book1D(histoname.c_str(), title.c_str(), 40, -0.5, 39.5);
1042  }
1043 }
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
static const std::string removeVersion(const std::string &trigger)
PathInfoCollection hltPathsAll_
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:212
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98

◆ dqmBeginRun()

void BTVHLTOfflineSource::dqmBeginRun ( edm::Run const &  run,
edm::EventSetup const &  c 
)
overrideprivate

Definition at line 287 of file BTVHLTOfflineSource.cc.

References HltBtagPostValidation_cff::c, custompathnamepairs_, hltConfig_, hltPathsAll_, heavyIonCSV_trainingSettings::idx, HLTConfigProvider::init(), LogDebug, BTVHLTOfflineSource_cfi::pathname, processname_, writedatasetfile::run, HLTConfigProvider::size(), and HLTConfigProvider::triggerName().

287  {
288  bool changed = true;
289  if (!hltConfig_.init(run, c, processname_, changed)) {
290  LogDebug("BTVHLTOfflineSource") << "HLTConfigProvider failed to initialize.";
291  }
292 
293  for (unsigned int idx = 0; idx != hltConfig_.size(); ++idx) {
294  const auto& pathname = hltConfig_.triggerName(idx);
295 
296  for (const auto& custompathnamepair : custompathnamepairs_) {
297  if (pathname.find(custompathnamepair.first) != std::string::npos) {
298  hltPathsAll_.push_back(PathInfo(1, pathname, "dummy", processname_, 0, custompathnamepair.second));
299  }
300  }
301  }
302 }
const std::string & triggerName(unsigned int triggerIndex) const
unsigned int size() const
number of trigger paths in trigger table
PathInfoCollection hltPathsAll_
HLTConfigProvider hltConfig_
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d&#39;tor
std::vector< std::pair< std::string, std::string > > custompathnamepairs_
#define LogDebug(id)

◆ getOfflineBTagTracks()

std::vector< const reco::Track * > BTVHLTOfflineSource::getOfflineBTagTracks ( float  hltJetEta,
float  hltJetPhi,
edm::Handle< edm::View< reco::BaseTagInfo >>  offlineIPTagHandle,
std::vector< float > &  offlineIP3D,
std::vector< float > &  offlineIP3DSig 
)
private

Definition at line 728 of file BTVHLTOfflineSource.cc.

References listHistos::decayLength, reco::deltaR(), Exception, reco::btag::IP2DSig, electrons_cff::ip3d, mag(), maxDecayLength_, maxJetDistance_, minDecayLength_, minJetDistance_, dqmiodumpmetadata::n, MetAnalyzer::pv(), TrackCollections2monitor_cff::selectedTracks, dumpRecoGeometry_cfg::tagInfo, reco::btag::toTrack(), and HLT_2023v12_cff::track.

Referenced by analyze().

732  {
733  std::vector<const reco::Track*> offlineTracks;
734 
735  for (auto const& iterOffIP : *offlineIPTagHandle) {
736  float DR = reco::deltaR(iterOffIP.jet()->eta(), iterOffIP.jet()->phi(), hltJetEta, hltJetPhi);
737 
738  if (DR > 0.3)
739  continue;
740 
742  dynamic_cast<const reco::IPTagInfo<vector<reco::CandidatePtr>, reco::JetTagInfo>*>(&iterOffIP);
743 
744  if (!tagInfo) {
745  throw cms::Exception("Configuration")
746  << "BTagPerformanceAnalyzer: Extended TagInfo not of type TrackIPTagInfo. " << std::endl;
747  }
748 
749  const GlobalPoint pv(tagInfo->primaryVertex()->position().x(),
750  tagInfo->primaryVertex()->position().y(),
751  tagInfo->primaryVertex()->position().z());
752 
753  const std::vector<reco::btag::TrackIPData>& ip = tagInfo->impactParameterData();
754 
755  std::vector<std::size_t> sortedIndices = tagInfo->sortedIndexes(reco::btag::IP2DSig);
756  std::vector<reco::CandidatePtr> sortedTracks = tagInfo->sortedTracks(sortedIndices);
757  std::vector<std::size_t> selectedIndices;
758  vector<reco::CandidatePtr> selectedTracks;
759  for (unsigned int n = 0; n != sortedIndices.size(); ++n) {
760  double decayLength = (ip[sortedIndices[n]].closestToJetAxis - pv).mag();
761  double jetDistance = ip[sortedIndices[n]].distanceToJetAxis.value();
762  if (decayLength > minDecayLength_ && decayLength < maxDecayLength_ && fabs(jetDistance) >= minJetDistance_ &&
763  fabs(jetDistance) < maxJetDistance_) {
764  selectedIndices.push_back(sortedIndices[n]);
765  selectedTracks.push_back(sortedTracks[n]);
766  }
767  }
768 
769  for (unsigned int n = 0; n != selectedIndices.size(); ++n) {
771  offlineTracks.push_back(track);
772  offlineIP3D.push_back(ip[n].ip3d.value());
773  offlineIP3DSig.push_back(ip[n].ip3d.significance());
774  }
775  }
776  return offlineTracks;
777 }
const reco::Track * toTrack(const reco::TrackBaseRef &t)
Definition: IPTagInfo.h:24
def pv(vc)
Definition: MetAnalyzer.py:7
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:30
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())

◆ getOnlineBTagTracks()

template<class Base >
std::vector< const reco::Track * > BTVHLTOfflineSource::getOnlineBTagTracks ( float  hltJetEta,
float  hltJetPhi,
edm::Handle< std::vector< Base >>  jetSVTagsColl,
std::vector< float > &  onlineIP3D,
std::vector< float > &  onlineIP3DSig 
)
private

Definition at line 780 of file BTVHLTOfflineSource.cc.

References reco::deltaR(), electrons_cff::ip3d, and reco::btag::toTrack().

784  {
785  std::vector<const reco::Track*> onlineTracks;
786 
787  for (auto iterTI = jetSVTagsColl->begin(); iterTI != jetSVTagsColl->end(); ++iterTI) {
788  float DR = reco::deltaR(iterTI->jet()->eta(), iterTI->jet()->phi(), hltJetEta, hltJetPhi);
789  if (DR > 0.3)
790  continue;
791 
792  const auto& ipInfo = *(iterTI->trackIPTagInfoRef().get());
793  const std::vector<reco::btag::TrackIPData>& ip = ipInfo.impactParameterData();
794 
795  unsigned int trackSize = ipInfo.selectedTracks().size();
796  for (unsigned int itt = 0; itt < trackSize; ++itt) {
797  const auto ptrackRef = (ipInfo.selectedTracks()[itt]);
798 
799  if (ptrackRef.isAvailable()) {
800  const reco::Track* ptrackPtr = reco::btag::toTrack(ptrackRef);
801  onlineTracks.push_back(ptrackPtr);
802  onlineIP3D.push_back(ip[itt].ip3d.value());
803  onlineIP3DSig.push_back(ip[itt].ip3d.significance());
804  }
805  }
806  }
807  return onlineTracks;
808 }
const reco::Track * toTrack(const reco::TrackBaseRef &t)
Definition: IPTagInfo.h:24
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:30

Member Data Documentation

◆ caloTags

edm::Handle<reco::JetTagCollection> BTVHLTOfflineSource::caloTags
private

Definition at line 110 of file BTVHLTOfflineSource.cc.

Referenced by analyze().

◆ caloTagsToken_

edm::EDGetTokenT<reco::JetTagCollection> BTVHLTOfflineSource::caloTagsToken_
private

Definition at line 108 of file BTVHLTOfflineSource.cc.

Referenced by analyze().

◆ custompathnamepairs_

std::vector<std::pair<std::string, std::string> > BTVHLTOfflineSource::custompathnamepairs_
private

Definition at line 79 of file BTVHLTOfflineSource.cc.

Referenced by BTVHLTOfflineSource(), and dqmBeginRun().

◆ dirname_

std::string BTVHLTOfflineSource::dirname_
private

Definition at line 75 of file BTVHLTOfflineSource.cc.

Referenced by bookHistograms().

◆ dRTrackMatch_

float BTVHLTOfflineSource::dRTrackMatch_
private

Definition at line 117 of file BTVHLTOfflineSource.cc.

Referenced by analyze().

◆ hltCaloPVToken_

edm::EDGetTokenT<std::vector<reco::Vertex> > BTVHLTOfflineSource::hltCaloPVToken_
private

Definition at line 94 of file BTVHLTOfflineSource.cc.

Referenced by analyze().

◆ hltConfig_

HLTConfigProvider BTVHLTOfflineSource::hltConfig_
private

Definition at line 119 of file BTVHLTOfflineSource.cc.

Referenced by dqmBeginRun().

◆ hltFastPVToken_

edm::EDGetTokenT<std::vector<reco::Vertex> > BTVHLTOfflineSource::hltFastPVToken_
private

Definition at line 92 of file BTVHLTOfflineSource.cc.

Referenced by analyze().

◆ hltPathsAll_

PathInfoCollection BTVHLTOfflineSource::hltPathsAll_
private

Definition at line 232 of file BTVHLTOfflineSource.cc.

Referenced by analyze(), bookHistograms(), and dqmBeginRun().

◆ hltPFPVToken_

edm::EDGetTokenT<std::vector<reco::Vertex> > BTVHLTOfflineSource::hltPFPVToken_
private

Definition at line 93 of file BTVHLTOfflineSource.cc.

Referenced by analyze().

◆ maxDecayLength_

float BTVHLTOfflineSource::maxDecayLength_
private

Definition at line 114 of file BTVHLTOfflineSource.cc.

Referenced by getOfflineBTagTracks().

◆ maxJetDistance_

float BTVHLTOfflineSource::maxJetDistance_
private

Definition at line 116 of file BTVHLTOfflineSource.cc.

Referenced by getOfflineBTagTracks().

◆ minDecayLength_

float BTVHLTOfflineSource::minDecayLength_
private

Definition at line 113 of file BTVHLTOfflineSource.cc.

Referenced by getOfflineBTagTracks().

◆ minJetDistance_

float BTVHLTOfflineSource::minJetDistance_
private

Definition at line 115 of file BTVHLTOfflineSource.cc.

Referenced by getOfflineBTagTracks().

◆ offlineDiscrTokenb_

edm::EDGetTokenT<reco::JetTagCollection> BTVHLTOfflineSource::offlineDiscrTokenb_
private

Definition at line 88 of file BTVHLTOfflineSource.cc.

Referenced by analyze().

◆ offlineDiscrTokenbb_

edm::EDGetTokenT<reco::JetTagCollection> BTVHLTOfflineSource::offlineDiscrTokenbb_
private

Definition at line 89 of file BTVHLTOfflineSource.cc.

Referenced by analyze().

◆ offlineIPToken_

edm::EDGetTokenT<edm::View<reco::BaseTagInfo> > BTVHLTOfflineSource::offlineIPToken_
private

Definition at line 90 of file BTVHLTOfflineSource.cc.

Referenced by analyze().

◆ offlinePVToken_

edm::EDGetTokenT<std::vector<reco::Vertex> > BTVHLTOfflineSource::offlinePVToken_
private

Definition at line 95 of file BTVHLTOfflineSource.cc.

Referenced by analyze().

◆ pfTags

edm::Handle<reco::JetTagCollection> BTVHLTOfflineSource::pfTags
private

Definition at line 111 of file BTVHLTOfflineSource.cc.

Referenced by analyze().

◆ pfTagsToken_

edm::EDGetTokenT<reco::JetTagCollection> BTVHLTOfflineSource::pfTagsToken_
private

Definition at line 109 of file BTVHLTOfflineSource.cc.

Referenced by analyze().

◆ processname_

std::string BTVHLTOfflineSource::processname_
private

Definition at line 76 of file BTVHLTOfflineSource.cc.

Referenced by dqmBeginRun().

◆ shallowTagInfosTokenCalo_

edm::EDGetTokenT<std::vector<reco::ShallowTagInfo> > BTVHLTOfflineSource::shallowTagInfosTokenCalo_
private

Definition at line 102 of file BTVHLTOfflineSource.cc.

Referenced by analyze().

◆ shallowTagInfosTokenPf_

edm::EDGetTokenT<std::vector<reco::ShallowTagInfo> > BTVHLTOfflineSource::shallowTagInfosTokenPf_
private

Definition at line 103 of file BTVHLTOfflineSource.cc.

Referenced by analyze().

◆ SVTagInfosTokenCalo_

edm::EDGetTokenT<std::vector<reco::SecondaryVertexTagInfo> > BTVHLTOfflineSource::SVTagInfosTokenCalo_
private

Definition at line 105 of file BTVHLTOfflineSource.cc.

Referenced by analyze().

◆ SVTagInfosTokenPf_

edm::EDGetTokenT<std::vector<SVTagInfo> > BTVHLTOfflineSource::SVTagInfosTokenPf_
private

Definition at line 106 of file BTVHLTOfflineSource.cc.

Referenced by analyze().

◆ triggerResultsFUToken

edm::EDGetTokenT<edm::TriggerResults> BTVHLTOfflineSource::triggerResultsFUToken
private

Definition at line 98 of file BTVHLTOfflineSource.cc.

Referenced by analyze().

◆ triggerResultsLabel_

edm::InputTag BTVHLTOfflineSource::triggerResultsLabel_
private

Definition at line 82 of file BTVHLTOfflineSource.cc.

◆ triggerResultsToken

edm::EDGetTokenT<edm::TriggerResults> BTVHLTOfflineSource::triggerResultsToken
private

Definition at line 97 of file BTVHLTOfflineSource.cc.

Referenced by analyze().

◆ triggerSummaryFUToken

edm::EDGetTokenT<trigger::TriggerEvent> BTVHLTOfflineSource::triggerSummaryFUToken
private

Definition at line 100 of file BTVHLTOfflineSource.cc.

Referenced by analyze().

◆ triggerSummaryLabel_

edm::InputTag BTVHLTOfflineSource::triggerSummaryLabel_
private

Definition at line 81 of file BTVHLTOfflineSource.cc.

◆ triggerSummaryToken

edm::EDGetTokenT<trigger::TriggerEvent> BTVHLTOfflineSource::triggerSummaryToken
private

Definition at line 99 of file BTVHLTOfflineSource.cc.

Referenced by analyze().

◆ turnon_threshold_loose_

float BTVHLTOfflineSource::turnon_threshold_loose_
private

Definition at line 84 of file BTVHLTOfflineSource.cc.

Referenced by analyze().

◆ turnon_threshold_medium_

float BTVHLTOfflineSource::turnon_threshold_medium_
private

Definition at line 85 of file BTVHLTOfflineSource.cc.

Referenced by analyze().

◆ turnon_threshold_tight_

float BTVHLTOfflineSource::turnon_threshold_tight_
private

Definition at line 86 of file BTVHLTOfflineSource.cc.

Referenced by analyze().

◆ verbose_

bool BTVHLTOfflineSource::verbose_
private

Definition at line 77 of file BTVHLTOfflineSource.cc.

Referenced by analyze().