Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-06-13 03:23:39

0001 /*
0002   BTVHLTOffline DQM code
0003 */
0004 //
0005 // Originally created by:  Anne-Catherine Le Bihan
0006 //                         June 2015
0007 //                         John Alison <johnalison@cmu.edu>
0008 //                         June 2020
0009 // Following the structure used in JetMetHLTOfflineSource
0010 
0011 // system include files
0012 #include <fstream>
0013 #include <iostream>
0014 #include <memory>
0015 #include <sstream>
0016 #include <string>
0017 #include <utility>
0018 #include <vector>
0019 #include <unistd.h>
0020 #include <cmath>
0021 #include <iostream>
0022 
0023 // user include files
0024 #include "DQMServices/Core/interface/DQMEDAnalyzer.h"
0025 #include "DQMServices/Core/interface/DQMStore.h"
0026 #include "DQMOffline/Trigger/plugins/TriggerDQMBase.h"
0027 #include "DataFormats/Common/interface/TriggerResults.h"
0028 #include "DataFormats/HLTReco/interface/TriggerEvent.h"
0029 #include "DataFormats/HLTReco/interface/TriggerObject.h"
0030 #include "DataFormats/HLTReco/interface/TriggerTypeDefs.h"
0031 #include "DataFormats/VertexReco/interface/Vertex.h"
0032 #include "DataFormats/BTauReco/interface/JetTag.h"
0033 #include "DataFormats/BTauReco/interface/ShallowTagInfo.h"
0034 #include "HLTrigger/HLTcore/interface/HLTConfigProvider.h"
0035 #include "FWCore/Framework/interface/MakerMacros.h"
0036 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0037 #include "FWCore/ServiceRegistry/interface/Service.h"
0038 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0039 #include "FWCore/Common/interface/TriggerNames.h"
0040 #include "CommonTools/UtilAlgos/interface/DeltaR.h"
0041 #include "DataFormats/VertexReco/interface/VertexFwd.h"
0042 #include "DataFormats/BTauReco/interface/SecondaryVertexTagInfo.h"
0043 #include "DataFormats/TrackReco/interface/Track.h"
0044 
0045 #include "TMath.h"
0046 #include "TPRegexp.h"
0047 
0048 class BTVHLTOfflineSource : public DQMEDAnalyzer {
0049 public:
0050   explicit BTVHLTOfflineSource(const edm::ParameterSet&);
0051   ~BTVHLTOfflineSource() override;
0052 
0053 private:
0054   void analyze(const edm::Event&, const edm::EventSetup&) override;
0055 
0056   std::vector<const reco::Track*> getOfflineBTagTracks(float hltJetEta,
0057                                                        float hltJetPhi,
0058                                                        edm::Handle<edm::View<reco::BaseTagInfo>> offlineIPTagHandle,
0059                                                        std::vector<float>& offlineIP3D,
0060                                                        std::vector<float>& offlineIP3DSig);
0061 
0062   typedef reco::TemplatedSecondaryVertexTagInfo<reco::CandIPTagInfo, reco::VertexCompositePtrCandidate> SVTagInfo;
0063 
0064   template <class Base>
0065   std::vector<const reco::Track*> getOnlineBTagTracks(float hltJetEta,
0066                                                       float hltJetPhi,
0067                                                       edm::Handle<std::vector<Base>> jetSVTagsColl,
0068                                                       std::vector<float>& onlineIP3D,
0069                                                       std::vector<float>& onlineIP3DSig);
0070 
0071   void bookHistograms(DQMStore::IBooker&, edm::Run const& run, edm::EventSetup const& c) override;
0072 
0073   void dqmBeginRun(edm::Run const& run, edm::EventSetup const& c) override;
0074 
0075   std::string dirname_;
0076   std::string processname_;
0077   bool verbose_;
0078 
0079   std::vector<std::pair<std::string, std::string>> custompathnamepairs_;
0080 
0081   edm::InputTag triggerSummaryLabel_;
0082   edm::InputTag triggerResultsLabel_;
0083 
0084   float turnon_threshold_loose_;
0085   float turnon_threshold_medium_;
0086   float turnon_threshold_tight_;
0087 
0088   edm::EDGetTokenT<reco::JetTagCollection> offlineDiscrTokenb_;
0089   edm::EDGetTokenT<edm::View<reco::BaseTagInfo>> offlineIPToken_;
0090 
0091   edm::EDGetTokenT<std::vector<reco::Vertex>> hltPFPVToken_;
0092   edm::EDGetTokenT<std::vector<reco::Vertex>> offlinePVToken_;
0093 
0094   edm::EDGetTokenT<edm::TriggerResults> triggerResultsToken;
0095   edm::EDGetTokenT<edm::TriggerResults> triggerResultsFUToken;
0096   edm::EDGetTokenT<trigger::TriggerEvent> triggerSummaryToken;
0097   edm::EDGetTokenT<trigger::TriggerEvent> triggerSummaryFUToken;
0098 
0099   edm::EDGetTokenT<std::vector<reco::ShallowTagInfo>> shallowTagInfosTokenPf_;
0100 
0101   edm::EDGetTokenT<std::vector<SVTagInfo>> SVTagInfosTokenPf_;
0102 
0103   edm::EDGetTokenT<reco::JetTagCollection> pfTagsToken_;
0104   edm::Handle<reco::JetTagCollection> pfTags;
0105 
0106   float minDecayLength_;
0107   float maxDecayLength_;
0108   float minJetDistance_;
0109   float maxJetDistance_;
0110   float dRTrackMatch_;
0111 
0112   HLTConfigProvider hltConfig_;
0113 
0114   class PathInfo : public TriggerDQMBase {
0115   public:
0116     PathInfo()
0117         : prescaleUsed_(-1),
0118           pathName_("unset"),
0119           filterName_("unset"),
0120           processName_("unset"),
0121           objectType_(-1),
0122           triggerType_("unset") {}
0123 
0124     ~PathInfo() override = default;
0125 
0126     PathInfo(const int prescaleUsed,
0127              const std::string& pathName,
0128              const std::string& filterName,
0129              const std::string& processName,
0130              const int type,
0131              const std::string& triggerType)
0132         : prescaleUsed_(prescaleUsed),
0133           pathName_(pathName),
0134           filterName_(filterName),
0135           processName_(processName),
0136           objectType_(type),
0137           triggerType_(triggerType) {}
0138 
0139     const std::string getLabel() const { return filterName_; }
0140     void setLabel(std::string labelName) { filterName_ = std::move(labelName); }
0141     const std::string getPath() const { return pathName_; }
0142     const int getprescaleUsed() const { return prescaleUsed_; }
0143     const std::string getProcess() const { return processName_; }
0144     const int getObjectType() const { return objectType_; }
0145     const std::string getTriggerType() const { return triggerType_; }
0146     const edm::InputTag getTag() const { return edm::InputTag(filterName_, "", processName_); }
0147     const bool operator==(const std::string& v) const { return v == pathName_; }
0148 
0149     MonitorElement* Discr = nullptr;
0150     MonitorElement* Pt = nullptr;
0151     MonitorElement* Eta = nullptr;
0152     MonitorElement* Discr_HLTvsRECO = nullptr;
0153     MonitorElement* Discr_HLTMinusRECO = nullptr;
0154     ObjME Discr_turnon_loose;
0155     ObjME Discr_turnon_medium;
0156     ObjME Discr_turnon_tight;
0157     ObjME Pt_turnon_loose;
0158     ObjME Pt_turnon_medium;
0159     ObjME Pt_turnon_tight;
0160     ObjME Eta_turnon_loose;
0161     ObjME Eta_turnon_medium;
0162     ObjME Eta_turnon_tight;
0163     ObjME Phi_turnon_loose;
0164     ObjME Phi_turnon_medium;
0165     ObjME Phi_turnon_tight;
0166     MonitorElement* PVz = nullptr;
0167     MonitorElement* fastPVz = nullptr;
0168     MonitorElement* PVz_HLTMinusRECO = nullptr;
0169     MonitorElement* fastPVz_HLTMinusRECO = nullptr;
0170     MonitorElement* n_vtx = nullptr;
0171     MonitorElement* vtx_mass = nullptr;
0172     MonitorElement* n_vtx_trks = nullptr;
0173     MonitorElement* n_sel_tracks = nullptr;
0174     MonitorElement* h_3d_ip_distance = nullptr;
0175     MonitorElement* h_3d_ip_error = nullptr;
0176     MonitorElement* h_3d_ip_sig = nullptr;
0177 
0178     //NEW
0179     MonitorElement* h_jetNSecondaryVertices = nullptr;
0180     MonitorElement* h_jet_pt = nullptr;
0181     MonitorElement* h_jet_eta = nullptr;
0182     MonitorElement* h_trackSumJetEtRatio = nullptr;
0183     MonitorElement* h_trackSip2dValAboveCharm = nullptr;
0184     MonitorElement* h_trackSip2dSigAboveCharm = nullptr;
0185     MonitorElement* h_trackSip3dValAboveCharm = nullptr;
0186     MonitorElement* h_trackSip3dSigAboveCharm = nullptr;
0187     MonitorElement* h_jetNSelectedTracks = nullptr;
0188     MonitorElement* h_jetNTracksEtaRel = nullptr;
0189     MonitorElement* h_vertexCategory = nullptr;
0190     MonitorElement* h_trackSumJetDeltaR = nullptr;
0191 
0192     MonitorElement* h_trackJetDistVal = nullptr;
0193     MonitorElement* h_trackPtRel = nullptr;
0194     MonitorElement* h_trackDeltaR = nullptr;
0195     MonitorElement* h_trackPtRatio = nullptr;
0196     MonitorElement* h_trackSip3dSig = nullptr;
0197     MonitorElement* h_trackSip2dSig = nullptr;
0198     MonitorElement* h_trackDecayLenVal = nullptr;
0199     MonitorElement* h_trackEtaRel = nullptr;
0200 
0201     MonitorElement* h_vertexEnergyRatio = nullptr;
0202     MonitorElement* h_vertexJetDeltaR = nullptr;
0203     MonitorElement* h_flightDistance2dVal = nullptr;
0204     MonitorElement* h_flightDistance2dSig = nullptr;
0205     MonitorElement* h_flightDistance3dVal = nullptr;
0206     MonitorElement* h_flightDistance3dSig = nullptr;
0207 
0208     ObjME OnlineTrkEff_Pt;
0209     ObjME OnlineTrkEff_Eta;
0210     ObjME OnlineTrkEff_3d_ip_distance;
0211     ObjME OnlineTrkEff_3d_ip_sig;
0212     ObjME OnlineTrkFake_Pt;
0213     ObjME OnlineTrkFake_Eta;
0214     ObjME OnlineTrkFake_3d_ip_distance;
0215     ObjME OnlineTrkFake_3d_ip_sig;
0216     // MonitorElement*  n_pixel_hits_;
0217     // MonitorElement*  n_total_hits_;
0218 
0219   private:
0220     int prescaleUsed_;
0221     std::string pathName_;
0222     std::string filterName_;
0223     std::string processName_;
0224     int objectType_;
0225     std::string triggerType_;
0226   };
0227 
0228   class PathInfoCollection : public std::vector<PathInfo> {
0229   public:
0230     PathInfoCollection() : std::vector<PathInfo>(){};
0231     std::vector<PathInfo>::iterator find(const std::string& pathName) { return std::find(begin(), end(), pathName); }
0232   };
0233 
0234   PathInfoCollection hltPathsAll_;
0235 };
0236 
0237 using namespace edm;
0238 using namespace reco;
0239 using namespace std;
0240 using namespace trigger;
0241 
0242 BTVHLTOfflineSource::BTVHLTOfflineSource(const edm::ParameterSet& iConfig)
0243     : dirname_(iConfig.getUntrackedParameter("dirname", std::string("HLT/BTV/"))),
0244       processname_(iConfig.getParameter<std::string>("processname")),
0245       verbose_(iConfig.getUntrackedParameter<bool>("verbose", false)),
0246       triggerSummaryLabel_(iConfig.getParameter<edm::InputTag>("triggerSummaryLabel")),
0247       triggerResultsLabel_(iConfig.getParameter<edm::InputTag>("triggerResultsLabel")),
0248       turnon_threshold_loose_(iConfig.getParameter<double>("turnon_threshold_loose")),
0249       turnon_threshold_medium_(iConfig.getParameter<double>("turnon_threshold_medium")),
0250       turnon_threshold_tight_(iConfig.getParameter<double>("turnon_threshold_tight")),
0251       offlineDiscrTokenb_(consumes<reco::JetTagCollection>(iConfig.getParameter<edm::InputTag>("offlineDiscrLabelb"))),
0252       offlineIPToken_(consumes<View<BaseTagInfo>>(iConfig.getParameter<edm::InputTag>("offlineIPLabel"))),
0253 
0254       hltPFPVToken_(consumes<std::vector<reco::Vertex>>(iConfig.getParameter<edm::InputTag>("hltPFPVLabel"))),
0255       offlinePVToken_(consumes<std::vector<reco::Vertex>>(iConfig.getParameter<edm::InputTag>("offlinePVLabel"))),
0256       triggerResultsToken(consumes<edm::TriggerResults>(triggerResultsLabel_)),
0257       triggerResultsFUToken(consumes<edm::TriggerResults>(
0258           edm::InputTag(triggerResultsLabel_.label(), triggerResultsLabel_.instance(), std::string("FU")))),
0259       triggerSummaryToken(consumes<trigger::TriggerEvent>(triggerSummaryLabel_)),
0260       triggerSummaryFUToken(consumes<trigger::TriggerEvent>(
0261           edm::InputTag(triggerSummaryLabel_.label(), triggerSummaryLabel_.instance(), std::string("FU")))),
0262       shallowTagInfosTokenPf_(
0263           consumes<vector<reco::ShallowTagInfo>>(edm::InputTag("hltDeepCombinedSecondaryVertexBJetTagsInfos"))),
0264       SVTagInfosTokenPf_(consumes<std::vector<SVTagInfo>>(edm::InputTag("hltDeepSecondaryVertexTagInfosPF"))),
0265       pfTagsToken_(consumes<reco::JetTagCollection>(iConfig.getParameter<edm::InputTag>("onlineDiscrLabelPF"))),
0266       minDecayLength_(iConfig.getParameter<double>("minDecayLength")),
0267       maxDecayLength_(iConfig.getParameter<double>("maxDecayLength")),
0268       minJetDistance_(iConfig.getParameter<double>("minJetDistance")),
0269       maxJetDistance_(iConfig.getParameter<double>("maxJetDistance")),
0270       dRTrackMatch_(iConfig.getParameter<double>("dRTrackMatch")) {
0271   std::vector<edm::ParameterSet> paths = iConfig.getParameter<std::vector<edm::ParameterSet>>("pathPairs");
0272   for (const auto& path : paths) {
0273     custompathnamepairs_.push_back(
0274         make_pair(path.getParameter<std::string>("pathname"), path.getParameter<std::string>("pathtype")));
0275   }
0276 }
0277 
0278 BTVHLTOfflineSource::~BTVHLTOfflineSource() = default;
0279 
0280 void BTVHLTOfflineSource::dqmBeginRun(const edm::Run& run, const edm::EventSetup& c) {
0281   bool changed = true;
0282   if (!hltConfig_.init(run, c, processname_, changed)) {
0283     LogDebug("BTVHLTOfflineSource") << "HLTConfigProvider failed to initialize.";
0284   }
0285 
0286   for (unsigned int idx = 0; idx != hltConfig_.size(); ++idx) {
0287     const auto& pathname = hltConfig_.triggerName(idx);
0288 
0289     for (const auto& custompathnamepair : custompathnamepairs_) {
0290       if (pathname.find(custompathnamepair.first) != std::string::npos) {
0291         hltPathsAll_.push_back(PathInfo(1, pathname, "dummy", processname_, 0, custompathnamepair.second));
0292       }
0293     }
0294   }
0295 }
0296 
0297 void BTVHLTOfflineSource::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
0298   edm::Handle<edm::TriggerResults> triggerResults;
0299   iEvent.getByToken(triggerResultsToken, triggerResults);
0300   if (!triggerResults.isValid()) {
0301     iEvent.getByToken(triggerResultsFUToken, triggerResults);
0302     if (!triggerResults.isValid()) {
0303       edm::LogInfo("BTVHLTOfflineSource") << "TriggerResults not found, skipping event";
0304       return;
0305     }
0306   }
0307 
0308   const edm::TriggerNames& triggerNames = iEvent.triggerNames(*triggerResults);
0309 
0310   edm::Handle<trigger::TriggerEvent> triggerObj;
0311   iEvent.getByToken(triggerSummaryToken, triggerObj);
0312   if (!triggerObj.isValid()) {
0313     iEvent.getByToken(triggerSummaryFUToken, triggerObj);
0314     if (!triggerObj.isValid()) {
0315       edm::LogInfo("BTVHLTOfflineSource") << "TriggerEvent not found, skipping event";
0316       return;
0317     }
0318   }
0319 
0320   edm::Handle<reco::JetTagCollection> pfTags;
0321   iEvent.getByToken(pfTagsToken_, pfTags);
0322 
0323   Handle<reco::VertexCollection> VertexHandler;
0324 
0325   Handle<reco::JetTagCollection> offlineJetTagHandlerb;
0326   iEvent.getByToken(offlineDiscrTokenb_, offlineJetTagHandlerb);
0327 
0328   Handle<View<BaseTagInfo>> offlineIPTagHandle;
0329   iEvent.getByToken(offlineIPToken_, offlineIPTagHandle);
0330 
0331   Handle<reco::VertexCollection> offlineVertexHandler;
0332   iEvent.getByToken(offlinePVToken_, offlineVertexHandler);
0333 
0334   if (verbose_ && iEvent.id().event() % 10000 == 0)
0335     cout << "Run = " << iEvent.id().run() << ", LS = " << iEvent.luminosityBlock()
0336          << ", Event = " << iEvent.id().event() << endl;
0337 
0338   if (!triggerResults.isValid())
0339     return;
0340 
0341   edm::Handle<std::vector<SVTagInfo>> jetSVTagsCollPF;
0342 
0343   for (auto& v : hltPathsAll_) {
0344     unsigned index = triggerNames.triggerIndex(v.getPath());
0345     if (!(index < triggerNames.size())) {
0346       edm::LogInfo("BTVHLTOfflineSource") << "Path " << v.getPath() << " not in menu, skipping event";
0347       continue;
0348     }
0349 
0350     if (!triggerResults->accept(index)) {
0351       edm::LogInfo("BTVHLTOfflineSource") << "Path " << v.getPath() << " not accepted, skipping event";
0352       continue;
0353     }
0354 
0355     iEvent.getByToken(SVTagInfosTokenPf_, jetSVTagsCollPF);
0356 
0357     // PF and Calo btagging
0358     if (v.getTriggerType() == "PF" && pfTags.isValid()) {
0359       const auto& iter = pfTags->begin();
0360 
0361       float Discr_online = iter->second;
0362       if (Discr_online < 0)
0363         Discr_online = -0.05;
0364 
0365       v.Discr->Fill(Discr_online);
0366       v.Pt->Fill(iter->first->pt());
0367       v.Eta->Fill(iter->first->eta());
0368 
0369       if (offlineJetTagHandlerb.isValid()) {
0370         for (auto const& iterOffb : *offlineJetTagHandlerb) {
0371           float DR = reco::deltaR(iterOffb.first->eta(), iterOffb.first->phi(), iter->first->eta(), iter->first->phi());
0372           if (DR < 0.3) {
0373             float Discr_offline = iterOffb.second;
0374             float Pt_offline = iterOffb.first->pt();
0375             float Eta_offline = iterOffb.first->eta();
0376             float Phi_offline = iterOffb.first->phi();
0377 
0378             if (Discr_offline < 0)
0379               Discr_offline = -0.05;
0380             v.Discr_HLTvsRECO->Fill(Discr_online, Discr_offline);
0381             v.Discr_HLTMinusRECO->Fill(Discr_online - Discr_offline);
0382 
0383             v.Discr_turnon_loose.denominator->Fill(Discr_offline);
0384             v.Discr_turnon_medium.denominator->Fill(Discr_offline);
0385             v.Discr_turnon_tight.denominator->Fill(Discr_offline);
0386 
0387             v.Pt_turnon_loose.denominator->Fill(Pt_offline);
0388             v.Pt_turnon_medium.denominator->Fill(Pt_offline);
0389             v.Pt_turnon_tight.denominator->Fill(Pt_offline);
0390 
0391             v.Eta_turnon_loose.denominator->Fill(Eta_offline);
0392             v.Eta_turnon_medium.denominator->Fill(Eta_offline);
0393             v.Eta_turnon_tight.denominator->Fill(Eta_offline);
0394 
0395             v.Phi_turnon_loose.denominator->Fill(Phi_offline);
0396             v.Phi_turnon_medium.denominator->Fill(Phi_offline);
0397             v.Phi_turnon_tight.denominator->Fill(Phi_offline);
0398 
0399             if (Discr_online > turnon_threshold_loose_) {
0400               v.Discr_turnon_loose.numerator->Fill(Discr_offline);
0401               v.Pt_turnon_loose.numerator->Fill(Pt_offline);
0402               v.Eta_turnon_loose.numerator->Fill(Eta_offline);
0403               v.Phi_turnon_loose.numerator->Fill(Phi_offline);
0404             }
0405             if (Discr_online > turnon_threshold_medium_) {
0406               v.Discr_turnon_medium.numerator->Fill(Discr_offline);
0407               v.Pt_turnon_medium.numerator->Fill(Pt_offline);
0408               v.Eta_turnon_medium.numerator->Fill(Eta_offline);
0409               v.Phi_turnon_medium.numerator->Fill(Phi_offline);
0410             }
0411             if (Discr_online > turnon_threshold_tight_) {
0412               v.Discr_turnon_tight.numerator->Fill(Discr_offline);
0413               v.Pt_turnon_tight.numerator->Fill(Pt_offline);
0414               v.Eta_turnon_tight.numerator->Fill(Eta_offline);
0415               v.Phi_turnon_tight.numerator->Fill(Phi_offline);
0416             }
0417 
0418             break;
0419           }
0420         }
0421       }  ///offline
0422 
0423       bool pfSVTagCollValid = (v.getTriggerType() == "PF" && jetSVTagsCollPF.isValid());
0424       if (offlineIPTagHandle.isValid() && pfSVTagCollValid) {
0425         std::vector<float> offlineIP3D;
0426         std::vector<float> offlineIP3DSig;
0427         std::vector<const reco::Track*> offlineTracks = getOfflineBTagTracks(
0428             iter->first->eta(), iter->first->phi(), offlineIPTagHandle, offlineIP3D, offlineIP3DSig);
0429         std::vector<const reco::Track*> onlineTracks;
0430         std::vector<float> onlineIP3D;
0431         std::vector<float> onlineIP3DSig;
0432         if (pfSVTagCollValid)
0433           onlineTracks = getOnlineBTagTracks<SVTagInfo>(
0434               iter->first->eta(), iter->first->phi(), jetSVTagsCollPF, onlineIP3D, onlineIP3DSig);
0435 
0436         for (unsigned int iOffTrk = 0; iOffTrk < offlineTracks.size(); ++iOffTrk) {
0437           const reco::Track* offTrk = offlineTracks.at(iOffTrk);
0438           bool hasMatch = false;
0439           float offTrkEta = offTrk->eta();
0440           float offTrkPhi = offTrk->phi();
0441 
0442           for (const reco::Track* onTrk : onlineTracks) {
0443             float DR = reco::deltaR(offTrkEta, offTrkPhi, onTrk->eta(), onTrk->phi());
0444             if (DR < dRTrackMatch_) {
0445               hasMatch = true;
0446             }
0447           }
0448 
0449           float offTrkPt = offTrk->pt();
0450           v.OnlineTrkEff_Pt.denominator->Fill(offTrkPt);
0451           if (hasMatch)
0452             v.OnlineTrkEff_Pt.numerator->Fill(offTrkPt);
0453 
0454           v.OnlineTrkEff_Eta.denominator->Fill(offTrkEta);
0455           if (hasMatch)
0456             v.OnlineTrkEff_Eta.numerator->Fill(offTrkEta);
0457 
0458           v.OnlineTrkEff_3d_ip_distance.denominator->Fill(offlineIP3D.at(iOffTrk));
0459           if (hasMatch)
0460             v.OnlineTrkEff_3d_ip_distance.numerator->Fill(offlineIP3D.at(iOffTrk));
0461 
0462           v.OnlineTrkEff_3d_ip_sig.denominator->Fill(offlineIP3DSig.at(iOffTrk));
0463           if (hasMatch)
0464             v.OnlineTrkEff_3d_ip_sig.numerator->Fill(offlineIP3DSig.at(iOffTrk));
0465         }
0466 
0467         for (unsigned int iOnTrk = 0; iOnTrk < onlineTracks.size(); ++iOnTrk) {
0468           const reco::Track* onTrk = onlineTracks.at(iOnTrk);
0469           bool hasMatch = false;
0470           float onTrkEta = onTrk->eta();
0471           float onTrkPhi = onTrk->phi();
0472 
0473           for (const reco::Track* offTrk : offlineTracks) {
0474             float DR = reco::deltaR(onTrkEta, onTrkPhi, offTrk->eta(), offTrk->phi());
0475             if (DR < dRTrackMatch_) {
0476               hasMatch = true;
0477             }
0478           }
0479 
0480           float onTrkPt = onTrk->pt();
0481           v.OnlineTrkFake_Pt.denominator->Fill(onTrkPt);
0482           if (!hasMatch)
0483             v.OnlineTrkFake_Pt.numerator->Fill(onTrkPt);
0484 
0485           v.OnlineTrkFake_Eta.denominator->Fill(onTrkEta);
0486           if (!hasMatch)
0487             v.OnlineTrkFake_Eta.numerator->Fill(onTrkEta);
0488 
0489           v.OnlineTrkFake_3d_ip_distance.denominator->Fill(onlineIP3D.at(iOnTrk));
0490           if (!hasMatch)
0491             v.OnlineTrkFake_3d_ip_distance.numerator->Fill(onlineIP3D.at(iOnTrk));
0492 
0493           v.OnlineTrkFake_3d_ip_sig.denominator->Fill(onlineIP3DSig.at(iOnTrk));
0494           if (!hasMatch)
0495             v.OnlineTrkFake_3d_ip_sig.numerator->Fill(onlineIP3DSig.at(iOnTrk));
0496         }
0497       }
0498 
0499       iEvent.getByToken(hltPFPVToken_, VertexHandler);
0500       if (VertexHandler.isValid()) {
0501         v.PVz->Fill(VertexHandler->begin()->z());
0502         if (offlineVertexHandler.isValid()) {
0503           v.PVz_HLTMinusRECO->Fill(VertexHandler->begin()->z() - offlineVertexHandler->begin()->z());
0504         }
0505       }
0506     }  // PFTagsValid
0507 
0508     // additional plots from tag info collections
0509     /////////////////////////////////////////////
0510 
0511     edm::Handle<std::vector<reco::ShallowTagInfo>> shallowTagInfosPf;
0512     iEvent.getByToken(shallowTagInfosTokenPf_, shallowTagInfosPf);
0513 
0514     //    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;
0515     //    iEvent.getByToken(caloTagInfosToken_, caloTagInfos);
0516 
0517     //    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;
0518     //    iEvent.getByToken(pfTagInfosToken_, pfTagInfos);
0519 
0520     // first try to get info from shallowTagInfos ...
0521     if (v.getTriggerType() == "PF" && shallowTagInfosPf.isValid()) {
0522       const auto& shallowTagInfoCollection = shallowTagInfosPf;
0523       for (const auto& shallowTagInfo : *shallowTagInfoCollection) {
0524         const auto& tagVars = shallowTagInfo.taggingVariables();
0525 
0526         // n secondary vertices and n selected tracks
0527         for (const auto& tagVar : tagVars.getList(reco::btau::jetNSecondaryVertices, false)) {
0528           v.h_jetNSecondaryVertices->Fill(tagVar);
0529           v.n_vtx->Fill(tagVar);
0530         }
0531 
0532         for (const auto& tagVar : tagVars.getList(reco::btau::jetNSelectedTracks, false)) {
0533           v.n_sel_tracks->Fill(tagVar);
0534           v.h_jetNSelectedTracks->Fill(tagVar);
0535         }
0536 
0537         for (const auto& tagVar : tagVars.getList(reco::btau::jetPt, false)) {
0538           v.h_jet_pt->Fill(tagVar);
0539         }
0540 
0541         for (const auto& tagVar : tagVars.getList(reco::btau::jetEta, false)) {
0542           v.h_jet_eta->Fill(tagVar);
0543         }
0544 
0545         for (const auto& tagVar : tagVars.getList(reco::btau::trackSumJetEtRatio, false)) {
0546           v.h_trackSumJetEtRatio->Fill(tagVar);
0547         }
0548 
0549         for (const auto& tagVar : tagVars.getList(reco::btau::trackSumJetDeltaR, false)) {
0550           v.h_trackSumJetDeltaR->Fill(tagVar);
0551         }
0552 
0553         for (const auto& tagVar : tagVars.getList(reco::btau::vertexCategory, false)) {
0554           v.h_vertexCategory->Fill(tagVar);
0555         }
0556 
0557         for (const auto& tagVar : tagVars.getList(reco::btau::trackSip2dValAboveCharm, false)) {
0558           v.h_trackSip2dValAboveCharm->Fill(tagVar);
0559         }
0560 
0561         for (const auto& tagVar : tagVars.getList(reco::btau::trackSip2dSigAboveCharm, false)) {
0562           v.h_trackSip2dSigAboveCharm->Fill(tagVar);
0563         }
0564 
0565         for (const auto& tagVar : tagVars.getList(reco::btau::trackSip3dValAboveCharm, false)) {
0566           v.h_trackSip3dValAboveCharm->Fill(tagVar);
0567         }
0568 
0569         for (const auto& tagVar : tagVars.getList(reco::btau::trackSip3dSigAboveCharm, false)) {
0570           v.h_trackSip3dSigAboveCharm->Fill(tagVar);
0571         }
0572 
0573         for (const auto& tagVar : tagVars.getList(reco::btau::jetNTracksEtaRel, false)) {
0574           v.h_jetNTracksEtaRel->Fill(tagVar);
0575         }
0576 
0577         // impact parameter
0578         // and new info
0579         const auto& trackSip3dVal = tagVars.getList(reco::btau::trackSip3dVal, false);
0580         const auto& trackSip3dSig = tagVars.getList(reco::btau::trackSip3dSig, false);
0581         const auto& trackJetDistVal = tagVars.getList(reco::btau::trackJetDistVal, false);
0582         const auto& trackPtRel = tagVars.getList(reco::btau::trackPtRel, false);
0583         const auto& trackSip2dSig = tagVars.getList(reco::btau::trackSip2dSig, false);
0584         const auto& trackDeltaR = tagVars.getList(reco::btau::trackDeltaR, false);
0585         const auto& trackPtRatio = tagVars.getList(reco::btau::trackPtRatio, false);
0586         const auto& trackDecayLenVal = tagVars.getList(reco::btau::trackDecayLenVal, false);
0587         const auto& trackEtaRel = tagVars.getList(reco::btau::trackEtaRel, false);
0588 
0589         for (unsigned i_trk = 0; i_trk < trackEtaRel.size(); i_trk++) {
0590           v.h_trackEtaRel->Fill(trackEtaRel[i_trk]);
0591         }
0592 
0593         for (unsigned i_trk = 0; i_trk < trackJetDistVal.size(); i_trk++) {
0594           v.h_trackJetDistVal->Fill(trackJetDistVal[i_trk]);
0595         }
0596 
0597         for (unsigned i_trk = 0; i_trk < trackPtRel.size(); i_trk++) {
0598           v.h_trackPtRel->Fill(trackPtRel[i_trk]);
0599         }
0600 
0601         for (unsigned i_trk = 0; i_trk < trackDeltaR.size(); i_trk++) {
0602           v.h_trackDeltaR->Fill(trackDeltaR[i_trk]);
0603         }
0604 
0605         for (unsigned i_trk = 0; i_trk < trackPtRatio.size(); i_trk++) {
0606           v.h_trackPtRatio->Fill(trackPtRatio[i_trk]);
0607         }
0608 
0609         for (unsigned i_trk = 0; i_trk < trackDecayLenVal.size(); i_trk++) {
0610           v.h_trackDecayLenVal->Fill(trackDecayLenVal[i_trk]);
0611         }
0612 
0613         for (unsigned i_trk = 0; i_trk < trackSip3dVal.size(); i_trk++) {
0614           float val = trackSip3dVal[i_trk];
0615           float sig = trackSip3dSig[i_trk];
0616           v.h_3d_ip_distance->Fill(val);
0617           v.h_3d_ip_error->Fill(val / sig);
0618           v.h_3d_ip_sig->Fill(sig);
0619 
0620           v.h_trackSip2dSig->Fill(trackSip2dSig[i_trk]);
0621         }
0622 
0623         // vertex mass and tracks per vertex
0624         for (const auto& tagVar : tagVars.getList(reco::btau::vertexMass, false)) {
0625           v.vtx_mass->Fill(tagVar);
0626         }
0627         for (const auto& tagVar : tagVars.getList(reco::btau::vertexNTracks, false)) {
0628           v.n_vtx_trks->Fill(tagVar);
0629         }
0630 
0631         for (const auto& tagVar : tagVars.getList(reco::btau::vertexEnergyRatio, false)) {
0632           v.h_vertexEnergyRatio->Fill(tagVar);
0633         }
0634 
0635         for (const auto& tagVar : tagVars.getList(reco::btau::vertexJetDeltaR, false)) {
0636           v.h_vertexJetDeltaR->Fill(tagVar);
0637         }
0638 
0639         for (const auto& tagVar : tagVars.getList(reco::btau::flightDistance2dVal, false)) {
0640           v.h_flightDistance2dVal->Fill(tagVar);
0641         }
0642 
0643         for (const auto& tagVar : tagVars.getList(reco::btau::flightDistance2dSig, false)) {
0644           v.h_flightDistance2dSig->Fill(tagVar);
0645         }
0646 
0647         for (const auto& tagVar : tagVars.getList(reco::btau::flightDistance3dVal, false)) {
0648           v.h_flightDistance3dVal->Fill(tagVar);
0649         }
0650 
0651         for (const auto& tagVar : tagVars.getList(reco::btau::flightDistance3dSig, false)) {
0652           v.h_flightDistance3dSig->Fill(tagVar);
0653         }
0654 
0655         // // track N total/pixel hits
0656         // for (const auto & tagVar : tagVars.getList(reco::btau::trackNPixelHits, false)) {
0657         //   v.n_pixel_hits->Fill(tagVar);}
0658         // for (const auto & tagVar : tagVars.getList(reco::btau::trackNTotalHits, false)) {
0659         //   v.n_total_hits->Fill(tagVar);}
0660       }
0661     }
0662 
0663     // ... otherwise from usual tag infos.
0664     // else
0665     // if (   (v.getTriggerType() == "PF"   && pfTagInfos.isValid())
0666     //     || (v.getTriggerType() == "Calo" && caloTagInfos.isValid()) )
0667     // {
0668     //   const auto & DiscrTagInfoCollection = (v.getTriggerType() == "PF") ? pfTagInfos : caloTagInfos;
0669 
0670     //   // loop over secondary vertex tag infos
0671     //   for (const auto & DiscrTagInfo : *DiscrTagInfoCollection) {
0672     //     v.n_vtx->Fill(DiscrTagInfo.nVertexCandidates());
0673     //     v.n_sel_tracks->Fill(DiscrTagInfo.nSelectedTracks());
0674 
0675     //     // loop over selected tracks in each tag info
0676     //     for (unsigned i_trk=0; i_trk < DiscrTagInfo.nSelectedTracks(); i_trk++) {
0677     //       const auto & ip3d = DiscrTagInfo.trackIPData(i_trk).ip3d;
0678     //       v.h_3d_ip_distance->Fill(ip3d.value());
0679     //       v.h_3d_ip_error->Fill(ip3d.error());
0680     //       v.h_3d_ip_sig->Fill(ip3d.significance());
0681     //     }
0682 
0683     //     // loop over vertex candidates in each tag info
0684     //     for (unsigned i_sv=0; i_sv < DiscrTagInfo.nVertexCandidates(); i_sv++) {
0685     //       const auto & sv = DiscrTagInfo.secondaryVertex(i_sv);
0686     //       v.vtx_mass->Fill(sv.p4().mass());
0687     //       v.n_vtx_trks->Fill(sv.nTracks());
0688 
0689     //       // loop over tracks for number of pixel and total hits
0690     //       const auto & trkIPTagInfo = DiscrTagInfo.trackIPTagInfoRef().get();
0691     //       for (const auto & trk : trkIPTagInfo->selectedTracks()) {
0692     //         v.n_pixel_hits->Fill(trk.get()->hitPattern().numberOfValidPixelHits());
0693     //         v.n_total_hits->Fill(trk.get()->hitPattern().numberOfValidHits());
0694     //       }
0695     //     }
0696     //   }
0697     // }
0698   }  //end paths loop
0699 }
0700 
0701 std::vector<const reco::Track*> BTVHLTOfflineSource::getOfflineBTagTracks(float hltJetEta,
0702                                                                           float hltJetPhi,
0703                                                                           Handle<View<BaseTagInfo>> offlineIPTagHandle,
0704                                                                           std::vector<float>& offlineIP3D,
0705                                                                           std::vector<float>& offlineIP3DSig) {
0706   std::vector<const reco::Track*> offlineTracks;
0707 
0708   for (auto const& iterOffIP : *offlineIPTagHandle) {
0709     float DR = reco::deltaR(iterOffIP.jet()->eta(), iterOffIP.jet()->phi(), hltJetEta, hltJetPhi);
0710 
0711     if (DR > 0.3)
0712       continue;
0713 
0714     const reco::IPTagInfo<vector<reco::CandidatePtr>, reco::JetTagInfo>* tagInfo =
0715         dynamic_cast<const reco::IPTagInfo<vector<reco::CandidatePtr>, reco::JetTagInfo>*>(&iterOffIP);
0716 
0717     if (!tagInfo) {
0718       throw cms::Exception("Configuration")
0719           << "BTagPerformanceAnalyzer: Extended TagInfo not of type TrackIPTagInfo. " << std::endl;
0720     }
0721 
0722     const GlobalPoint pv(tagInfo->primaryVertex()->position().x(),
0723                          tagInfo->primaryVertex()->position().y(),
0724                          tagInfo->primaryVertex()->position().z());
0725 
0726     const std::vector<reco::btag::TrackIPData>& ip = tagInfo->impactParameterData();
0727 
0728     std::vector<std::size_t> sortedIndices = tagInfo->sortedIndexes(reco::btag::IP2DSig);
0729     std::vector<reco::CandidatePtr> sortedTracks = tagInfo->sortedTracks(sortedIndices);
0730     std::vector<std::size_t> selectedIndices;
0731     vector<reco::CandidatePtr> selectedTracks;
0732     for (unsigned int n = 0; n != sortedIndices.size(); ++n) {
0733       double decayLength = (ip[sortedIndices[n]].closestToJetAxis - pv).mag();
0734       double jetDistance = ip[sortedIndices[n]].distanceToJetAxis.value();
0735       if (decayLength > minDecayLength_ && decayLength < maxDecayLength_ && fabs(jetDistance) >= minJetDistance_ &&
0736           fabs(jetDistance) < maxJetDistance_) {
0737         selectedIndices.push_back(sortedIndices[n]);
0738         selectedTracks.push_back(sortedTracks[n]);
0739       }
0740     }
0741 
0742     for (unsigned int n = 0; n != selectedIndices.size(); ++n) {
0743       const reco::Track* track = reco::btag::toTrack(selectedTracks[n]);
0744       offlineTracks.push_back(track);
0745       offlineIP3D.push_back(ip[n].ip3d.value());
0746       offlineIP3DSig.push_back(ip[n].ip3d.significance());
0747     }
0748   }
0749   return offlineTracks;
0750 }
0751 
0752 template <class Base>
0753 std::vector<const reco::Track*> BTVHLTOfflineSource::getOnlineBTagTracks(float hltJetEta,
0754                                                                          float hltJetPhi,
0755                                                                          edm::Handle<std::vector<Base>> jetSVTagsColl,
0756                                                                          std::vector<float>& onlineIP3D,
0757                                                                          std::vector<float>& onlineIP3DSig) {
0758   std::vector<const reco::Track*> onlineTracks;
0759 
0760   for (auto iterTI = jetSVTagsColl->begin(); iterTI != jetSVTagsColl->end(); ++iterTI) {
0761     float DR = reco::deltaR(iterTI->jet()->eta(), iterTI->jet()->phi(), hltJetEta, hltJetPhi);
0762     if (DR > 0.3)
0763       continue;
0764 
0765     const auto& ipInfo = *(iterTI->trackIPTagInfoRef().get());
0766     const std::vector<reco::btag::TrackIPData>& ip = ipInfo.impactParameterData();
0767 
0768     unsigned int trackSize = ipInfo.selectedTracks().size();
0769     for (unsigned int itt = 0; itt < trackSize; ++itt) {
0770       const auto ptrackRef = (ipInfo.selectedTracks()[itt]);
0771 
0772       if (ptrackRef.isAvailable()) {
0773         const reco::Track* ptrackPtr = reco::btag::toTrack(ptrackRef);
0774         onlineTracks.push_back(ptrackPtr);
0775         onlineIP3D.push_back(ip[itt].ip3d.value());
0776         onlineIP3DSig.push_back(ip[itt].ip3d.significance());
0777       }
0778     }
0779   }
0780   return onlineTracks;
0781 }
0782 
0783 void BTVHLTOfflineSource::bookHistograms(DQMStore::IBooker& iBooker, edm::Run const& run, edm::EventSetup const& c) {
0784   iBooker.setCurrentFolder(dirname_);
0785   for (auto& v : hltPathsAll_) {
0786     std::string trgPathName = HLTConfigProvider::removeVersion(v.getPath());
0787     std::string subdirName = dirname_ + "/" + trgPathName + v.getTriggerType();
0788     std::string trigPath = "(" + trgPathName + ")";
0789     iBooker.setCurrentFolder(subdirName);
0790 
0791     std::string labelname("HLT");
0792     std::string histoname(labelname + "");
0793     std::string title(labelname + "");
0794 
0795     histoname = labelname + "_Discr";
0796     title = labelname + "_Discr " + trigPath;
0797     v.Discr = iBooker.book1D(histoname.c_str(), title.c_str(), 110, -0.1, 1);
0798 
0799     histoname = labelname + "_Pt";
0800     title = labelname + "_Pt " + trigPath;
0801     v.Pt = iBooker.book1D(histoname.c_str(), title.c_str(), 100, 0, 400);
0802 
0803     histoname = labelname + "_Eta";
0804     title = labelname + "_Eta " + trigPath;
0805     v.Eta = iBooker.book1D(histoname.c_str(), title.c_str(), 60, -3.0, 3.0);
0806 
0807     histoname = "HLTvsRECO_Discr";
0808     title = "online discr vs offline discr " + trigPath;
0809     v.Discr_HLTvsRECO = iBooker.book2D(histoname.c_str(), title.c_str(), 110, -0.1, 1, 110, -0.1, 1);
0810 
0811     histoname = "HLTMinusRECO_Discr";
0812     title = "online discr minus offline discr " + trigPath;
0813     v.Discr_HLTMinusRECO = iBooker.book1D(histoname.c_str(), title.c_str(), 100, -1, 1);
0814 
0815     histoname = "Turnon_loose_Discr";
0816     title = "turn-on with loose threshold " + trigPath;
0817     v.bookME(iBooker, v.Discr_turnon_loose, histoname, title, 22, -0.1, 1.);
0818 
0819     histoname = "Turnon_medium_Discr";
0820     title = "turn-on with medium threshold " + trigPath;
0821     v.bookME(iBooker, v.Discr_turnon_medium, histoname, title, 22, -0.1, 1.);
0822 
0823     histoname = "Turnon_tight_Discr";
0824     title = "turn-on with tight threshold " + trigPath;
0825     v.bookME(iBooker, v.Discr_turnon_tight, histoname, title, 22, -0.1, 1.);
0826 
0827     histoname = "Turnon_loose_Pt";
0828     title = "turn-on with loose threshold " + trigPath;
0829     v.bookME(iBooker, v.Pt_turnon_loose, histoname, title, 50, 0., 500.);
0830 
0831     histoname = "Turnon_medium_Pt";
0832     title = "turn-on with medium threshold " + trigPath;
0833     v.bookME(iBooker, v.Pt_turnon_medium, histoname, title, 50, 0., 500.);
0834 
0835     histoname = "Turnon_tight_Pt";
0836     title = "turn-on with tight threshold " + trigPath;
0837     v.bookME(iBooker, v.Pt_turnon_tight, histoname, title, 50, 0., 500.);
0838 
0839     histoname = "Turnon_loose_Eta";
0840     title = "turn-on with loose threshold " + trigPath;
0841     v.bookME(iBooker, v.Eta_turnon_loose, histoname, title, 60, -3., 3.);
0842 
0843     histoname = "Turnon_medium_Eta";
0844     title = "turn-on with medium threshold " + trigPath;
0845     v.bookME(iBooker, v.Eta_turnon_medium, histoname, title, 60, -3., 3.);
0846 
0847     histoname = "Turnon_tight_Eta";
0848     title = "turn-on with tight threshold " + trigPath;
0849     v.bookME(iBooker, v.Eta_turnon_tight, histoname, title, 60, -3., 3.);
0850 
0851     histoname = "Turnon_loose_Phi";
0852     title = "turn-on with loose threshold " + trigPath;
0853     v.bookME(iBooker, v.Phi_turnon_loose, histoname, title, 60, -3., 3.);
0854 
0855     histoname = "Turnon_medium_Phi";
0856     title = "turn-on with medium threshold " + trigPath;
0857     v.bookME(iBooker, v.Phi_turnon_medium, histoname, title, 60, -3., 3.);
0858 
0859     histoname = "Turnon_tight_Phi";
0860     title = "turn-on with tight threshold " + trigPath;
0861     v.bookME(iBooker, v.Phi_turnon_tight, histoname, title, 60, -3., 3.);
0862 
0863     histoname = labelname + "_PVz";
0864     title = "online z(PV) " + trigPath;
0865     v.PVz = iBooker.book1D(histoname.c_str(), title.c_str(), 80, -20, 20);
0866 
0867     histoname = labelname + "_fastPVz";
0868     title = "online z(fastPV) " + trigPath;
0869     v.fastPVz = iBooker.book1D(histoname.c_str(), title.c_str(), 80, -20, 20);
0870 
0871     histoname = "HLTMinusRECO_PVz";
0872     title = "online z(PV) - offline z(PV) " + trigPath;
0873     v.PVz_HLTMinusRECO = iBooker.book1D(histoname.c_str(), title.c_str(), 200, -0.5, 0.5);
0874 
0875     histoname = "HLTMinusRECO_fastPVz";
0876     title = "online z(fastPV) - offline z(PV) " + trigPath;
0877     v.fastPVz_HLTMinusRECO = iBooker.book1D(histoname.c_str(), title.c_str(), 100, -2, 2);
0878 
0879     histoname = "n_vtx";
0880     title = "N vertex candidates " + trigPath;
0881     v.n_vtx = iBooker.book1D(histoname.c_str(), title.c_str(), 10, -0.5, 9.5);
0882 
0883     histoname = "vtx_mass";
0884     title = "secondary vertex mass (GeV)" + trigPath;
0885     v.vtx_mass = iBooker.book1D(histoname.c_str(), title.c_str(), 20, 0, 10);
0886 
0887     histoname = "n_vtx_trks";
0888     title = "N tracks associated to secondary vertex" + trigPath;
0889     v.n_vtx_trks = iBooker.book1D(histoname.c_str(), title.c_str(), 20, -0.5, 19.5);
0890 
0891     histoname = "n_sel_tracks";
0892     title = "N selected tracks" + trigPath;
0893     v.n_sel_tracks = iBooker.book1D(histoname.c_str(), title.c_str(), 25, -0.5, 24.5);
0894 
0895     histoname = "3d_ip_distance";
0896     title = "3D IP distance of tracks (cm)" + trigPath;
0897     v.h_3d_ip_distance = iBooker.book1D(histoname.c_str(), title.c_str(), 40, -0.1, 0.1);
0898 
0899     histoname = "3d_ip_error";
0900     title = "3D IP error of tracks (cm)" + trigPath;
0901     v.h_3d_ip_error = iBooker.book1D(histoname.c_str(), title.c_str(), 40, 0., 0.1);
0902 
0903     histoname = "3d_ip_sig";
0904     title = "3D IP significance of tracks (cm)" + trigPath;
0905     v.h_3d_ip_sig = iBooker.book1D(histoname.c_str(), title.c_str(), 40, -40, 40);
0906 
0907     //new
0908     histoname = "jetNSecondaryVertices";
0909     title = "jet N Secondary Vertices" + trigPath;
0910     v.h_jetNSecondaryVertices = iBooker.book1D(histoname.c_str(), title.c_str(), 10, -0.5, 9.5);
0911 
0912     histoname = "jet_pt";
0913     title = "jet pt" + trigPath;
0914     v.h_jet_pt = iBooker.book1D(histoname.c_str(), title.c_str(), 100, -0.1, 100);
0915 
0916     histoname = "jet_eta";
0917     title = "jet eta" + trigPath;
0918     v.h_jet_eta = iBooker.book1D(histoname.c_str(), title.c_str(), 100, -2.5, 2.5);
0919 
0920     histoname = "trackSumJetEtRatio";
0921     title = "trackSumJetEtRatio" + trigPath;
0922     v.h_trackSumJetEtRatio = iBooker.book1D(histoname.c_str(), title.c_str(), 100, -0.1, 1.5);
0923 
0924     histoname = "trackSip2dValAboveCharm";
0925     title = "trackSip2dSigAboveCharm" + trigPath;
0926     v.h_trackSip2dSigAboveCharm = iBooker.book1D(histoname.c_str(), title.c_str(), 100, -0.2, 0.2);
0927 
0928     histoname = "trackSip2dSigAboveCharm";
0929     title = "trackSip2dSigAboveCharm" + trigPath;
0930     v.h_trackSip2dValAboveCharm = iBooker.book1D(histoname.c_str(), title.c_str(), 100, -50, 50);
0931 
0932     histoname = "trackSip3dValAboveCharm";
0933     title = "trackSip3dValAboveCharm" + trigPath;
0934     v.h_trackSip3dValAboveCharm = iBooker.book1D(histoname.c_str(), title.c_str(), 100, -0.2, 0.2);
0935 
0936     histoname = "trackSip3dSigAboveCharm";
0937     title = "trackSip3dSigAboveCharm" + trigPath;
0938     v.h_trackSip3dSigAboveCharm = iBooker.book1D(histoname.c_str(), title.c_str(), 100, -50, 50);
0939 
0940     histoname = "jetNSelectedTracks";
0941     title = "jet N Selected Tracks" + trigPath;
0942     v.h_jetNSelectedTracks = iBooker.book1D(histoname.c_str(), title.c_str(), 42, -1.5, 40.5);
0943 
0944     histoname = "jetNTracksEtaRel";
0945     title = "jetNTracksEtaRel" + trigPath;
0946     v.h_jetNTracksEtaRel = iBooker.book1D(histoname.c_str(), title.c_str(), 42, -1.5, 40.5);
0947 
0948     histoname = "vertexCategory";
0949     title = "vertex category" + trigPath;
0950     v.h_vertexCategory = iBooker.book1D(histoname.c_str(), title.c_str(), 4, -1.5, 2.5);
0951 
0952     histoname = "trackSumJetDeltaR";
0953     title = "trackSumJetDeltaR" + trigPath;
0954     v.h_trackSumJetDeltaR = iBooker.book1D(histoname.c_str(), title.c_str(), 100, -0.1, 0.35);
0955 
0956     //new 2 below
0957     histoname = "trackJetDistVal";
0958     title = "trackJetDistVal" + trigPath;
0959     v.h_trackJetDistVal = iBooker.book1D(histoname.c_str(), title.c_str(), 100, -1, 0.01);
0960 
0961     histoname = "trackPtRel";
0962     title = "track pt rel" + trigPath;
0963     v.h_trackPtRel = iBooker.book1D(histoname.c_str(), title.c_str(), 100, -0.1, 7);
0964 
0965     histoname = "trackDeltaR";
0966     title = "trackDeltaR" + trigPath;
0967     v.h_trackDeltaR = iBooker.book1D(histoname.c_str(), title.c_str(), 160, -0.05, .47);
0968 
0969     histoname = "trackPtRatio";
0970     title = "trackPtRatio" + trigPath;
0971     v.h_trackPtRatio = iBooker.book1D(histoname.c_str(), title.c_str(), 100, -0.01, 0.3);
0972 
0973     histoname = "trackSip2dSig";
0974     title = "trackSip2dSig" + trigPath;
0975     v.h_trackSip2dSig = iBooker.book1D(histoname.c_str(), title.c_str(), 100, -55, 55);
0976 
0977     histoname = "trackDecayLenVal";
0978     title = "trackDecayLenVal" + trigPath;
0979     v.h_trackDecayLenVal = iBooker.book1D(histoname.c_str(), title.c_str(), 100, -0.1, 22);
0980 
0981     histoname = "trackEtaRel";
0982     title = "trackEtaRel" + trigPath;
0983     v.h_trackEtaRel = iBooker.book1D(histoname.c_str(), title.c_str(), 31, 0, 30);
0984 
0985     //new 3 below
0986     histoname = "vertexEnergyRatio";
0987     title = "vertexEnergyRatio" + trigPath;
0988     v.h_vertexEnergyRatio = iBooker.book1D(histoname.c_str(), title.c_str(), 100, -0.1, 3);
0989 
0990     histoname = "vertexJetDeltaR";
0991     title = "vertexJetDeltaR" + trigPath;
0992     v.h_vertexJetDeltaR = iBooker.book1D(histoname.c_str(), title.c_str(), 100, -0.01, 0.4);
0993 
0994     histoname = "flightDistance2dVal";
0995     title = "flightDistance2dVal" + trigPath;
0996     v.h_flightDistance2dVal = iBooker.book1D(histoname.c_str(), title.c_str(), 100, -0.1, 5);
0997 
0998     histoname = "flightDistance2dSig";
0999     title = "flightDistance2dSig" + trigPath;
1000     v.h_flightDistance2dSig = iBooker.book1D(histoname.c_str(), title.c_str(), 100, -10, 150);
1001 
1002     histoname = "flightDistance3dVal";
1003     title = "flightDistance3dVal" + trigPath;
1004     v.h_flightDistance3dVal = iBooker.book1D(histoname.c_str(), title.c_str(), 100, -0.1, 5);
1005 
1006     histoname = "flightDistance3dSig";
1007     title = "flightDistance3dSig" + trigPath;
1008     v.h_flightDistance3dSig = iBooker.book1D(histoname.c_str(), title.c_str(), 100, -10, 150);
1009 
1010     //end new
1011 
1012     histoname = "OnlineTrkEff_Pt";
1013     title = "Relative Online Trk Efficiency vs Pt " + trigPath;
1014     v.bookME(iBooker, v.OnlineTrkEff_Pt, histoname, title, 50, -0.5, 20.);
1015 
1016     histoname = "OnlineTrkEff_Eta";
1017     title = "Relative Online Trk Efficiency vs Eta " + trigPath;
1018     v.bookME(iBooker, v.OnlineTrkEff_Eta, histoname, title, 60, -3.0, 3.0);
1019 
1020     histoname = "OnlineTrkEff_3d_ip_distance";
1021     title = "Relative Online Trk Efficiency vs IP3D " + trigPath;
1022     v.bookME(iBooker, v.OnlineTrkEff_3d_ip_distance, histoname, title, 40, -0.1, 0.1);
1023 
1024     histoname = "OnlineTrkEff_3d_ip_sig";
1025     title = "Relative Online Trk Efficiency vs IP3D significance " + trigPath;
1026     v.bookME(iBooker, v.OnlineTrkEff_3d_ip_sig, histoname, title, 40, -40, 40);
1027 
1028     histoname = "OnlineTrkFake_Pt";
1029     title = "Relative Online Trk Fake Rate  vs Pt " + trigPath;
1030     v.bookME(iBooker, v.OnlineTrkFake_Pt, histoname, title, 50, -0.5, 20.);
1031 
1032     histoname = "OnlineTrkFake_Eta";
1033     title = "Relative Online Trk Fake Rate vs Eta " + trigPath;
1034     v.bookME(iBooker, v.OnlineTrkFake_Eta, histoname, title, 60, -3.0, 3.0);
1035 
1036     histoname = "OnlineTrkFake_3d_ip_distance";
1037     title = "Relative Online Trk Fake Rate vs IP3D " + trigPath;
1038     v.bookME(iBooker, v.OnlineTrkFake_3d_ip_distance, histoname, title, 40, -0.1, 0.1);
1039 
1040     histoname = "OnlineTrkFake_3d_ip_sig";
1041     title = "Relative Online Trk Fake Rate vs IP3D significance " + trigPath;
1042     v.bookME(iBooker, v.OnlineTrkFake_3d_ip_sig, histoname, title, 40, -40, 40);
1043 
1044     // histoname = "n_pixel_hits";
1045     // title = "N pixel hits"+trigPath;
1046     // v.n_pixel_hits = iBooker.book1D(histoname.c_str(), title.c_str(), 16, -0.5, 15.5);
1047 
1048     // histoname = "n_total_hits";
1049     // title = "N hits"+trigPath;
1050     // v.n_total_hits = iBooker.book1D(histoname.c_str(), title.c_str(), 40, -0.5, 39.5);
1051   }
1052 }
1053 
1054 // Define this as a plug-in
1055 DEFINE_FWK_MODULE(BTVHLTOfflineSource);