40 LogDebug(
"BTVHLTOfflineSource") <<
"constructor....";
47 turnon_threshold_loose_ = iConfig.
getParameter<
double>(
"turnon_threshold_loose");
48 turnon_threshold_medium_ = iConfig.
getParameter<
double>(
"turnon_threshold_medium");
49 turnon_threshold_tight_ = iConfig.
getParameter<
double>(
"turnon_threshold_tight");
50 triggerSummaryToken = consumes<trigger::TriggerEvent>(triggerSummaryLabel_);
52 triggerSummaryFUToken = consumes<trigger::TriggerEvent>(
54 triggerResultsFUToken = consumes<edm::TriggerResults>(
56 shallowTagInfosTokenCalo_ =
57 consumes<vector<reco::ShallowTagInfo> >(
edm::InputTag(
"hltDeepCombinedSecondaryVertexBJetTagsInfosCalo"));
58 shallowTagInfosTokenPf_ =
59 consumes<vector<reco::ShallowTagInfo> >(
edm::InputTag(
"hltDeepCombinedSecondaryVertexBJetTagsInfos"));
73 std::vector<edm::ParameterSet>
paths = iConfig.
getParameter<std::vector<edm::ParameterSet> >(
"pathPairs");
74 for (
auto&
path : paths) {
75 custompathnamepairs_.push_back(
84 if (!hltConfig_.init(run, c, processname_, changed)) {
85 LogDebug(
"BTVHLTOfflineSource") <<
"HLTConfigProvider failed to initialize.";
88 for (
unsigned int i = 0;
i != hltConfig_.size(); ++
i) {
89 const auto&
pathname = hltConfig_.triggerName(
i);
91 for (
auto& custompathnamepair : custompathnamepairs_) {
92 if (
pathname.find(custompathnamepair.first) != std::string::npos) {
93 hltPathsAll_.push_back(
PathInfo(1,
pathname,
"dummy", processname_, 0, custompathnamepair.second));
104 edm::LogInfo(
"BTVHLTOfflineSource") <<
"TriggerResults not found, " 112 iEvent.
getByToken(triggerSummaryToken, triggerObj_);
113 if (!triggerObj_.isValid()) {
114 iEvent.
getByToken(triggerSummaryFUToken, triggerObj_);
115 if (!triggerObj_.isValid()) {
116 edm::LogInfo(
"BTVHLTOfflineSource") <<
"TriggerEvent not found, " 128 iEvent.
getByToken(offlineDiscrTokenb_, offlineJetTagHandlerb);
131 iEvent.
getByToken(offlineDiscrTokenbb_, offlineJetTagHandlerbb);
134 iEvent.
getByToken(offlinePVToken_, offlineVertexHandler);
136 if (verbose_ && iEvent.
id().
event() % 10000 == 0)
138 <<
", Event = " << iEvent.
id().
event() << endl;
143 for (
auto&
v : hltPathsAll_) {
144 unsigned index = triggerNames_.triggerIndex(
v.getPath());
145 if (!(index < triggerNames_.size())) {
150 if ((
v.getTriggerType() ==
"PF" && pfTags.isValid()) ||
151 (
v.getTriggerType() ==
"Calo" && caloTags.isValid() && !caloTags->empty())) {
152 const auto& iter = (
v.getTriggerType() ==
"PF") ? pfTags->begin() : caloTags->begin();
154 float Discr_online = iter->second;
155 if (Discr_online < 0)
156 Discr_online = -0.05;
158 v.Discr->Fill(Discr_online);
159 v.Pt->Fill(iter->first->pt());
160 v.Eta->Fill(iter->first->eta());
162 if (offlineJetTagHandlerb.
isValid()) {
163 for (
auto const& iterOffb : *offlineJetTagHandlerb) {
164 float DR =
reco::deltaR(iterOffb.first->eta(), iterOffb.first->phi(), iter->first->eta(), iter->first->phi());
166 float Discr_offline = iterOffb.second;
169 if (offlineJetTagHandlerbb.
isValid()) {
170 for (
auto const& iterOffbb : *offlineJetTagHandlerbb) {
172 iterOffbb.first->eta(), iterOffbb.first->phi(), iter->first->eta(), iter->first->phi());
174 Discr_offline += iterOffbb.second;
180 if (Discr_offline < 0)
181 Discr_offline = -0.05;
182 v.Discr_HLTvsRECO->Fill(Discr_online, Discr_offline);
183 v.Discr_HLTMinusRECO->Fill(Discr_online - Discr_offline);
185 v.Discr_turnon_loose.denominator->Fill(Discr_offline);
186 v.Discr_turnon_medium.denominator->Fill(Discr_offline);
187 v.Discr_turnon_tight.denominator->Fill(Discr_offline);
189 if (Discr_online > turnon_threshold_loose_)
190 v.Discr_turnon_loose.numerator->Fill(Discr_offline);
191 if (Discr_online > turnon_threshold_medium_)
192 v.Discr_turnon_medium.numerator->Fill(Discr_offline);
193 if (Discr_online > turnon_threshold_tight_)
194 v.Discr_turnon_tight.numerator->Fill(Discr_offline);
201 if (
v.getTriggerType() ==
"PF") {
202 iEvent.
getByToken(hltPFPVToken_, VertexHandler);
204 iEvent.
getByToken(hltFastPVToken_, VertexHandler);
207 v.PVz->Fill(VertexHandler->begin()->z());
208 if (offlineVertexHandler.
isValid()) {
209 v.PVz_HLTMinusRECO->Fill(VertexHandler->begin()->z() - offlineVertexHandler->begin()->z());
215 if (caloTags.isValid() &&
v.getTriggerType() ==
"Calo" && !caloTags->empty()) {
216 iEvent.
getByToken(hltCaloPVToken_, VertexHandler);
218 v.fastPVz->Fill(VertexHandler->begin()->z());
219 if (offlineVertexHandler.
isValid()) {
220 v.fastPVz_HLTMinusRECO->Fill(VertexHandler->begin()->z() - offlineVertexHandler->begin()->z());
228 iEvent.
getByToken(shallowTagInfosTokenPf_, shallowTagInfosPf);
229 iEvent.
getByToken(shallowTagInfosTokenCalo_, shallowTagInfosCalo);
234 if ((
v.getTriggerType() ==
"PF" && shallowTagInfosPf.isValid()) ||
235 (
v.getTriggerType() ==
"Calo" && shallowTagInfosCalo.isValid())) {
236 const auto& shallowTagInfoCollection = (
v.getTriggerType() ==
"PF") ? shallowTagInfosPf : shallowTagInfosCalo;
237 for (
const auto& shallowTagInfo : *shallowTagInfoCollection) {
238 const auto& tagVars = shallowTagInfo.taggingVariables();
242 v.n_vtx->Fill(tagVar);
245 v.n_sel_tracks->Fill(tagVar);
251 for (
unsigned i_trk = 0; i_trk <
trackSip3dVal.size(); i_trk++) {
254 v.h_3d_ip_distance->Fill(val);
255 v.h_3d_ip_error->Fill(val / sig);
256 v.h_3d_ip_sig->Fill(sig);
261 v.vtx_mass->Fill(tagVar);
264 v.n_vtx_trks->Fill(tagVar);
315 for (
auto&
v : hltPathsAll_) {
317 std::string subdirName = dirname_ +
"/" + trgPathName +
v.getTriggerType();
325 histoname = labelname +
"_Discr";
326 title = labelname +
"_Discr " + trigPath;
327 v.Discr = iBooker.
book1D(histoname.c_str(), title.c_str(), 110, -0.1, 1);
329 histoname = labelname +
"_Pt";
330 title = labelname +
"_Pt " + trigPath;
331 v.Pt = iBooker.
book1D(histoname.c_str(), title.c_str(), 100, 0, 400);
333 histoname = labelname +
"_Eta";
334 title = labelname +
"_Eta " + trigPath;
335 v.Eta = iBooker.
book1D(histoname.c_str(), title.c_str(), 60, -3.0, 3.0);
337 histoname =
"HLTvsRECO_Discr";
338 title =
"online discr vs offline discr " + trigPath;
339 v.Discr_HLTvsRECO = iBooker.
book2D(histoname.c_str(), title.c_str(), 110, -0.1, 1, 110, -0.1, 1);
341 histoname =
"HLTMinusRECO_Discr";
342 title =
"online discr minus offline discr " + trigPath;
343 v.Discr_HLTMinusRECO = iBooker.
book1D(histoname.c_str(), title.c_str(), 100, -1, 1);
345 histoname =
"Turnon_loose_Discr";
346 title =
"turn-on with loose threshold " + trigPath;
347 v.bookME(iBooker,
v.Discr_turnon_loose, histoname, title, 22, -0.1, 1.);
349 histoname =
"Turnon_medium_Discr";
350 title =
"turn-on with medium threshold " + trigPath;
351 v.bookME(iBooker,
v.Discr_turnon_medium, histoname, title, 22, -0.1, 1.);
353 histoname =
"Turnon_tight_Discr";
354 title =
"turn-on with tight threshold " + trigPath;
355 v.bookME(iBooker,
v.Discr_turnon_tight, histoname, title, 22, -0.1, 1.);
357 histoname = labelname +
"_PVz";
358 title =
"online z(PV) " + trigPath;
359 v.PVz = iBooker.
book1D(histoname.c_str(), title.c_str(), 80, -20, 20);
361 histoname = labelname +
"_fastPVz";
362 title =
"online z(fastPV) " + trigPath;
363 v.fastPVz = iBooker.
book1D(histoname.c_str(), title.c_str(), 80, -20, 20);
365 histoname =
"HLTMinusRECO_PVz";
366 title =
"online z(PV) - offline z(PV) " + trigPath;
367 v.PVz_HLTMinusRECO = iBooker.
book1D(histoname.c_str(), title.c_str(), 200, -0.5, 0.5);
369 histoname =
"HLTMinusRECO_fastPVz";
370 title =
"online z(fastPV) - offline z(PV) " + trigPath;
371 v.fastPVz_HLTMinusRECO = iBooker.
book1D(histoname.c_str(), title.c_str(), 100, -2, 2);
374 title =
"N vertex candidates " + trigPath;
375 v.n_vtx = iBooker.
book1D(histoname.c_str(), title.c_str(), 10, -0.5, 9.5);
377 histoname =
"vtx_mass";
378 title =
"secondary vertex mass (GeV)" + trigPath;
379 v.vtx_mass = iBooker.
book1D(histoname.c_str(), title.c_str(), 20, 0, 10);
381 histoname =
"n_vtx_trks";
382 title =
"N tracks associated to secondary vertex" + trigPath;
383 v.n_vtx_trks = iBooker.
book1D(histoname.c_str(), title.c_str(), 20, -0.5, 19.5);
385 histoname =
"n_sel_tracks";
386 title =
"N selected tracks" + trigPath;
387 v.n_sel_tracks = iBooker.
book1D(histoname.c_str(), title.c_str(), 25, -0.5, 24.5);
389 histoname =
"3d_ip_distance";
390 title =
"3D IP distance of tracks (cm)" + trigPath;
391 v.h_3d_ip_distance = iBooker.
book1D(histoname.c_str(), title.c_str(), 40, -0.1, 0.1);
393 histoname =
"3d_ip_error";
394 title =
"3D IP error of tracks (cm)" + trigPath;
395 v.h_3d_ip_error = iBooker.
book1D(histoname.c_str(), title.c_str(), 40, 0., 0.1);
397 histoname =
"3d_ip_sig";
398 title =
"3D IP significance of tracks (cm)" + trigPath;
399 v.h_3d_ip_sig = iBooker.
book1D(histoname.c_str(), title.c_str(), 40, -40, 40);
void analyze(const edm::Event &, const edm::EventSetup &) override
BTVHLTOfflineSource(const edm::ParameterSet &)
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX)
T getParameter(std::string const &) const
EventNumber_t event() const
T getUntrackedParameter(std::string const &, T const &) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
void setCurrentFolder(std::string const &fullpath)
edm::LuminosityBlockNumber_t luminosityBlock() const
static const std::string removeVersion(const std::string &trigger)
#define DEFINE_FWK_MODULE(type)
~BTVHLTOfflineSource() override
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
void dqmBeginRun(edm::Run const &run, edm::EventSetup const &c) override
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
void bookHistograms(DQMStore::IBooker &, edm::Run const &run, edm::EventSetup const &c) override
edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const override