41 LogDebug(
"BTVHLTOfflineSource") <<
"constructor....";
48 turnon_threshold_loose_ = iConfig.
getParameter<
double>(
"turnon_threshold_loose");
49 turnon_threshold_medium_ = iConfig.
getParameter<
double>(
"turnon_threshold_medium");
50 turnon_threshold_tight_ = iConfig.
getParameter<
double>(
"turnon_threshold_tight");
51 triggerSummaryToken = consumes <trigger::TriggerEvent> (triggerSummaryLabel_);
52 triggerResultsToken = consumes <edm::TriggerResults> (triggerResultsLabel_);
53 triggerSummaryFUToken = consumes <trigger::TriggerEvent> (
edm::InputTag(triggerSummaryLabel_.label(),triggerSummaryLabel_.instance(),
std::string(
"FU")));
55 shallowTagInfosTokenCalo_ = consumes<vector<reco::ShallowTagInfo> > (
edm::InputTag(
"hltDeepCombinedSecondaryVertexBJetTagsInfosCalo"));
56 shallowTagInfosTokenPf_ = consumes<vector<reco::ShallowTagInfo> > (
edm::InputTag(
"hltDeepCombinedSecondaryVertexBJetTagsInfos"));
70 std::vector<edm::ParameterSet> paths = iConfig.
getParameter<std::vector<edm::ParameterSet> >(
"pathPairs");
71 for(
auto &
path : paths) {
72 custompathnamepairs_.push_back(make_pair(
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 pathname_ = hltConfig_.triggerName(
i);
90 filtername_ =
"dummy";
91 unsigned int usedPrescale = 1;
92 unsigned int objectType = 0;
95 for (
auto & custompathnamepair : custompathnamepairs_) {
96 if(pathname_.find(custompathnamepair.first) != std::string::npos) {
97 triggerType = custompathnamepair.second;
98 hltPathsAll_.push_back(
99 PathInfo(usedPrescale, pathname_,
"dummy", processname_, objectType, triggerType));
109 iEvent.
getByToken(triggerResultsToken, triggerResults_);
110 if(!triggerResults_.isValid()) {
111 iEvent.
getByToken(triggerResultsFUToken,triggerResults_);
112 if(!triggerResults_.isValid()) {
113 edm::LogInfo(
"BTVHLTOfflineSource") <<
"TriggerResults not found, " 121 iEvent.
getByToken(triggerSummaryToken,triggerObj_);
122 if(!triggerObj_.isValid()) {
123 iEvent.
getByToken(triggerSummaryFUToken,triggerObj_);
124 if(!triggerObj_.isValid()) {
125 edm::LogInfo(
"BTVHLTOfflineSource") <<
"TriggerEvent not found, " 137 iEvent.
getByToken(offlineDiscrTokenb_, offlineJetTagHandlerb);
140 iEvent.
getByToken(offlineDiscrTokenbb_, offlineJetTagHandlerbb);
143 iEvent.
getByToken(offlinePVToken_, offlineVertexHandler);
145 if(verbose_ && iEvent.
id().
event()%10000==0)
148 if(!triggerResults_.isValid())
return;
150 for(
auto &
v : hltPathsAll_) {
151 unsigned index = triggerNames_.triggerIndex(
v.getPath());
152 if (!(index < triggerNames_.size())) {
157 if ( (
v.getTriggerType() ==
"PF" && pfTags.isValid())
158 || (
v.getTriggerType() ==
"Calo" && caloTags.isValid() && !caloTags->empty()) )
160 const auto & iter = (
v.getTriggerType() ==
"PF") ? pfTags->begin() : caloTags->begin();
162 float Discr_online = iter->second;
163 if (Discr_online<0) Discr_online = -0.05;
165 v.Discr->Fill(Discr_online);
166 v.Pt->Fill(iter->first->pt());
167 v.Eta->Fill(iter->first->eta());
169 if(offlineJetTagHandlerb.
isValid()){
170 for (
auto const & iterOffb : *offlineJetTagHandlerb){
171 float DR =
reco::deltaR(iterOffb.first->eta(),iterOffb.first->phi(),iter->first->eta(),iter->first->phi());
173 float Discr_offline = iterOffb.second;
176 if(offlineJetTagHandlerbb.
isValid()){
177 for (
auto const & iterOffbb : *offlineJetTagHandlerbb){
178 DR =
reco::deltaR(iterOffbb.first->eta(),iterOffbb.first->phi(),iter->first->eta(),iter->first->phi());
180 Discr_offline += iterOffbb.second;
186 if (Discr_offline<0) Discr_offline = -0.05;
187 v.Discr_HLTvsRECO->Fill(Discr_online, Discr_offline);
188 v.Discr_HLTMinusRECO->Fill(Discr_online - Discr_offline);
190 v.Discr_turnon_loose .denominator->Fill(Discr_offline);
191 v.Discr_turnon_medium.denominator->Fill(Discr_offline);
192 v.Discr_turnon_tight .denominator->Fill(Discr_offline);
194 if (Discr_online > turnon_threshold_loose_)
v.Discr_turnon_loose .numerator->Fill(Discr_offline);
195 if (Discr_online > turnon_threshold_medium_)
v.Discr_turnon_medium.numerator->Fill(Discr_offline);
196 if (Discr_online > turnon_threshold_tight_)
v.Discr_turnon_tight .numerator->Fill(Discr_offline);
203 if (
v.getTriggerType() ==
"PF") {
204 iEvent.
getByToken(hltPFPVToken_, VertexHandler);
206 iEvent.
getByToken(hltFastPVToken_, VertexHandler);
209 v.PVz->Fill(VertexHandler->begin()->z());
210 if (offlineVertexHandler.
isValid()) {
211 v.PVz_HLTMinusRECO->Fill(VertexHandler->begin()->z()-offlineVertexHandler->begin()->z());
217 if (caloTags.isValid() &&
v.getTriggerType() ==
"Calo" && !caloTags->empty()) {
218 iEvent.
getByToken(hltCaloPVToken_, VertexHandler);
220 v.fastPVz->Fill(VertexHandler->begin()->z());
221 if (offlineVertexHandler.
isValid()) {
222 v.fastPVz_HLTMinusRECO->Fill(VertexHandler->begin()->z()-offlineVertexHandler->begin()->z());
231 iEvent.
getByToken(shallowTagInfosTokenPf_, shallowTagInfosPf);
232 iEvent.
getByToken(shallowTagInfosTokenCalo_, shallowTagInfosCalo);
237 if ( (
v.getTriggerType() ==
"PF" && shallowTagInfosPf.isValid())
238 || (
v.getTriggerType() ==
"Calo" && shallowTagInfosCalo.isValid()) )
240 const auto & shallowTagInfoCollection = (
v.getTriggerType() ==
"PF") ? shallowTagInfosPf : shallowTagInfosCalo;
241 for (
const auto & shallowTagInfo : *shallowTagInfoCollection) {
242 const auto & tagVars = shallowTagInfo.taggingVariables();
246 v.n_vtx->Fill(tagVar);
249 v.n_sel_tracks->Fill(tagVar);}
254 for (
unsigned i_trk=0; i_trk <
trackSip3dVal.size(); i_trk++) {
257 v.h_3d_ip_distance->Fill(val);
258 v.h_3d_ip_error->Fill(val/sig);
259 v.h_3d_ip_sig->Fill(sig);
264 v.vtx_mass->Fill(tagVar);}
266 v.n_vtx_trks->Fill(tagVar);}
318 for(
auto &
v : hltPathsAll_){
321 std::string subdirName = dirname_ +
"/"+ trgPathName +
v.getTriggerType();
329 histoname = labelname+
"_Discr";
330 title = labelname+
"_Discr "+trigPath;
331 v.Discr = iBooker.
book1D(histoname.c_str(),title.c_str(),110,-0.1,1);
333 histoname = labelname+
"_Pt";
334 title = labelname+
"_Pt "+trigPath;
335 v.Pt = iBooker.
book1D(histoname.c_str(),title.c_str(),100,0,400);
337 histoname = labelname+
"_Eta";
338 title = labelname+
"_Eta "+trigPath;
339 v.Eta = iBooker.
book1D(histoname.c_str(),title.c_str(),60,-3.0,3.0);
341 histoname =
"HLTvsRECO_Discr";
342 title =
"online discr vs offline discr "+trigPath;
343 v.Discr_HLTvsRECO = iBooker.
book2D(histoname.c_str(),title.c_str(),110,-0.1,1,110,-0.1,1);
345 histoname =
"HLTMinusRECO_Discr";
346 title =
"online discr minus offline discr "+trigPath;
347 v.Discr_HLTMinusRECO = iBooker.
book1D(histoname.c_str(),title.c_str(),100,-1,1);
349 histoname =
"Turnon_loose_Discr";
350 title =
"turn-on with loose threshold "+trigPath;
351 v.bookME(iBooker,
v.Discr_turnon_loose, histoname, title, 22, -0.1, 1.);
353 histoname =
"Turnon_medium_Discr";
354 title =
"turn-on with medium threshold "+trigPath;
355 v.bookME(iBooker,
v.Discr_turnon_medium, histoname, title, 22, -0.1, 1.);
357 histoname =
"Turnon_tight_Discr";
358 title =
"turn-on with tight threshold "+trigPath;
359 v.bookME(iBooker,
v.Discr_turnon_tight, histoname, title, 22, -0.1, 1.);
361 histoname = labelname+
"_PVz";
362 title =
"online z(PV) "+trigPath;
363 v.PVz = iBooker.
book1D(histoname.c_str(),title.c_str(),80,-20,20);
365 histoname = labelname+
"_fastPVz";
366 title =
"online z(fastPV) "+trigPath;
367 v.fastPVz = iBooker.
book1D(histoname.c_str(),title.c_str(),80,-20,20);
369 histoname =
"HLTMinusRECO_PVz";
370 title =
"online z(PV) - offline z(PV) "+trigPath;
371 v.PVz_HLTMinusRECO = iBooker.
book1D(histoname.c_str(),title.c_str(),200,-0.5,0.5);
373 histoname =
"HLTMinusRECO_fastPVz";
374 title =
"online z(fastPV) - offline z(PV) "+trigPath;
375 v.fastPVz_HLTMinusRECO = iBooker.
book1D(histoname.c_str(),title.c_str(),100,-2,2);
378 title =
"N vertex candidates "+trigPath;
379 v.n_vtx = iBooker.
book1D(histoname.c_str(),title.c_str(), 10, -0.5, 9.5);
381 histoname =
"vtx_mass";
382 title =
"secondary vertex mass (GeV)"+trigPath;
383 v.vtx_mass = iBooker.
book1D(histoname.c_str(), title.c_str(), 20, 0, 10);
385 histoname =
"n_vtx_trks";
386 title =
"N tracks associated to secondary vertex"+trigPath;
387 v.n_vtx_trks = iBooker.
book1D(histoname.c_str(), title.c_str(), 20, -0.5, 19.5);
389 histoname =
"n_sel_tracks";
390 title =
"N selected tracks"+trigPath;
391 v.n_sel_tracks = iBooker.
book1D(histoname.c_str(), title.c_str(), 25, -0.5, 24.5);
393 histoname =
"3d_ip_distance";
394 title =
"3D IP distance of tracks (cm)"+trigPath;
395 v.h_3d_ip_distance = iBooker.
book1D(histoname.c_str(), title.c_str(), 40, -0.1, 0.1);
397 histoname =
"3d_ip_error";
398 title =
"3D IP error of tracks (cm)"+trigPath;
399 v.h_3d_ip_error = iBooker.
book1D(histoname.c_str(), title.c_str(), 40, 0., 0.1);
401 histoname =
"3d_ip_sig";
402 title =
"3D IP significance of tracks (cm)"+trigPath;
403 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 &)
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
#define DEFINE_FWK_MODULE(type)
edm::LuminosityBlockNumber_t luminosityBlock() const
static const std::string removeVersion(const std::string &trigger)
void setCurrentFolder(std::string const &fullpath)
MonitorElement * book1D(Args &&...args)
~BTVHLTOfflineSource() override
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
MonitorElement * book2D(Args &&...args)
void dqmBeginRun(edm::Run const &run, edm::EventSetup const &c) override
void bookHistograms(DQMStore::IBooker &, edm::Run const &run, edm::EventSetup const &c) override
edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const override