10 template <
typename T,
typename V>
13 for (
unsigned int i = 0;
i < association.
size(); ++
i) {
23 std::set<std::string>
keepSetJet{
"jetNSecondaryVertices",
27 "chargedHadronEnergyFraction",
28 "neutralHadronEnergyFraction",
29 "photonEnergyFraction",
30 "electronEnergyFraction",
32 "chargedHadronMultiplicity",
33 "neutralHadronMultiplicity",
35 "electronMultiplicity",
38 "hadronPhotonMultiplicity",
42 "trackChi2",
"trackNTotalHits",
"trackNPixelHits",
"trackSip3dVal",
"trackSip3dSig",
43 "trackSip2dVal",
"trackSip2dSig",
"trackPtRel",
"trackDeltaR",
"trackPtRatio",
44 "trackSip3dSig_0",
"trackSip3dSig_1",
"trackSip3dSig_2",
"trackSip3dSig_3",
"trackMomentum",
45 "trackEta",
"trackPhi",
"trackDecayLenVal",
"trackDecayLenSig",
"trackJetDistVal",
46 "trackJetDistSig",
"trackSumJetEtRatio",
"trackSumJetDeltaR",
"trackEtaRel" 55 "vertexBoostOverSqrtJetPt",
56 "flightDistance1dVal",
57 "flightDistance1dSig",
58 "flightDistance2dVal",
59 "flightDistance2dSig",
60 "flightDistance3dVal",
61 "flightDistance3dSig"};
67 hlTriggerResults_ = consumes<edm::TriggerResults>(iConfig.
getParameter<
InputTag>(
"TriggerResults"));
70 [
this](
edm::InputTag const &
tag) { return mayConsume<reco::JetTagCollection>(tag); });
74 shallowTagInfosTokenPf_ =
75 consumes<std::vector<reco::ShallowTagInfo>>(
edm::InputTag(
"hltDeepCombinedSecondaryVertexBJetTagsInfos"));
76 m_mcPartons = consumes<JetFlavourMatchingCollection>(iConfig.
getParameter<
InputTag>(
"mcPartons"));
77 hltPathNames_ = iConfig.
getParameter<std::vector<std::string>>(
"HLTPathNames");
82 m_mcPartons_Label =
label.module;
84 for (
unsigned int i = 0;
i < JetTagCollection_.size();
i++) {
86 JetTagCollection_Label.push_back(
label.module);
90 hlTriggerResults_Label =
label.module;
92 for (
unsigned int i = 0;
i < m_mcLabels.size(); ++
i)
93 m_mcFlavours.push_back(mc.getParameter<std::vector<unsigned int>>(m_mcLabels[
i]));
94 m_mcMatching = m_mcPartons_Label !=
"none";
98 HCALSpecialsNames[HEP17] =
"HEP17";
99 HCALSpecialsNames[HEP18] =
"HEP18";
100 HCALSpecialsNames[HEM17] =
"HEM17";
120 triggerConfChanged_ =
true;
123 hltConfigProvider_.init(iRun, iSetup,
label.process, triggerConfChanged_);
124 const std::vector<std::string> &allHltPathNames = hltConfigProvider_.triggerNames();
127 for (
size_t trgs = 0; trgs < hltPathNames_.size(); trgs++) {
128 unsigned int found = 1;
130 for (
size_t it = 0; it < allHltPathNames.size(); ++it) {
131 found = allHltPathNames.at(it).find(hltPathNames_[trgs]);
136 hltPathIndexs_.push_back(it_mem);
140 for (
size_t trgs = 0; trgs < hltPathNames_.size(); trgs++) {
141 if (hltPathIndexs_[trgs] < 0) {
142 _isfoundHLTs.push_back(
false);
144 _isfoundHLTs.push_back(
true);
150 bool trigRes =
false;
157 if (hlTriggerResults_Label.empty() || hlTriggerResults_Label ==
"NULL") {
158 edm::LogInfo(
"NoTriggerResults") <<
"TriggerResults ==> Empty";
161 iEvent.
getByToken(hlTriggerResults_, TriggerResulsHandler);
162 if (TriggerResulsHandler.
isValid())
165 edm::LogInfo(
"NoTriggerResults") <<
"TriggerResults ==> not readable";
171 if (m_mcMatching && !m_mcPartons_Label.empty() && m_mcPartons_Label !=
"NULL") {
179 for (
unsigned int ind = 0; ind < hltPathNames_.size(); ind++) {
182 if (!_isfoundHLTs[ind])
184 if (!triggerResults.
accept(hltPathIndexs_[ind]))
188 if (!JetTagCollection_Label[ind].
empty() && JetTagCollection_Label[ind] !=
"NULL") {
189 iEvent.
getByToken(JetTagCollection_[ind], JetTagHandler);
190 iEvent.
getByToken(shallowTagInfosTokenPf_, shallowTagInfosPf);
199 for (
auto iter = JetTagHandler->
begin(); iter != JetTagHandler->
end(); iter++) {
203 edm::LogInfo(
"NoCollection") <<
"Collection " << JetTagCollection_Label[ind] <<
" ==> not found";
207 if (shallowTagInfosPf.isValid()) {
208 for (
auto &
info : *(shallowTagInfosPf)) {
223 edm::LogInfo(
"NoCollection") <<
"No shallowTagInfosPf collection";
226 for (
auto &BtagJT : JetTag) {
227 std::map<HCALSpecials, bool> inmodule;
228 inmodule[HEP17] = (BtagJT.first->phi() >= -0.87) && (BtagJT.first->phi() < -0.52) && (BtagJT.first->eta() > 1.3);
229 inmodule[HEP18] = (BtagJT.first->phi() >= -0.52) && (BtagJT.first->phi() < -0.17) && (BtagJT.first->eta() > 1.3);
230 inmodule[HEM17] = (BtagJT.first->phi() >= -0.87) && (BtagJT.first->phi() < -0.52) && (BtagJT.first->eta() < -1.3);
233 H1_.at(ind)[JetTagCollection_Label[ind]]->Fill(std::fmax(0.0, BtagJT.second));
234 for (
auto i : HCALSpecialsNames) {
235 if (inmodule[
i.first])
236 H1mod_.at(ind)[JetTagCollection_Label[ind]][
i.first]->Fill(std::fmax(0.0, BtagJT.second));
239 int m =
closestJet(BtagJT.first, *h_mcPartons, m_mcRadius);
240 unsigned int flavour = (m != -1) ?
abs((*h_mcPartons)[
m].second.getFlavour()) : 0;
241 for (
unsigned int i = 0;
i < m_mcLabels.size(); ++
i) {
244 auto it =
std::find(flav_collection.begin(), flav_collection.end(),
flavour);
245 if (it == flav_collection.end())
248 label += flavour_str;
249 H1_.at(ind)[
label]->Fill(std::fmax(0.0, BtagJT.second));
250 for (
auto j : HCALSpecialsNames) {
251 if (inmodule[j.first])
252 H1mod_.at(ind)[
label][j.first]->Fill(
253 std::fmax(0.0, BtagJT.second));
256 label = JetTagCollection_Label[ind] +
"___";
257 label += flavour_str;
263 H2_.at(ind)[
label]->Fill(std::fmax(0.0, BtagJT.second),
265 for (
auto j : HCALSpecialsNames) {
266 if (inmodule[j.first])
267 H2mod_.at(ind)[
label][j.first]->Fill(std::fmax(0.0, BtagJT.second), BtagJT.first->pt());
269 labelEta +=
"_disc_eta";
270 H2Eta_.at(ind)[labelEta]->Fill(std::fmax(0.0, BtagJT.second),
271 BtagJT.first->eta());
272 labelPhi +=
"_disc_phi";
273 H2Phi_.at(ind)[labelPhi]->Fill(std::fmax(0.0, BtagJT.second),
274 BtagJT.first->phi());
275 labelEtaPhi +=
"_eta_phi";
276 H2EtaPhi_.at(ind)[labelEtaPhi]->Fill(BtagJT.first->eta(),
277 BtagJT.first->phi());
278 labelEtaPhi_threshold +=
"_eta_phi_disc05";
279 if (BtagJT.second > 0.5) {
280 H2EtaPhi_threshold_.at(ind)[labelEtaPhi_threshold]->Fill(
282 BtagJT.first->phi());
297 assert(hltPathNames_.size() == JetTagCollection_.size());
299 for (
unsigned int ind = 0; ind < hltPathNames_.size(); ind++) {
303 dqmFolder = Form(
"%s/Discriminator/%s", mainFolder_.c_str(), hltPathNames_[ind].c_str());
304 H1_.push_back(std::map<std::string, MonitorElement *>());
305 H2_.push_back(std::map<std::string, MonitorElement *>());
308 H2Eta_.push_back(std::map<std::string, MonitorElement *>());
309 H2Phi_.push_back(std::map<std::string, MonitorElement *>());
310 H2EtaPhi_.push_back(std::map<std::string, MonitorElement *>());
311 H2EtaPhi_threshold_.push_back(std::map<std::string, MonitorElement *>());
315 if (!JetTagCollection_Label[ind].
empty() && JetTagCollection_Label[ind] !=
"NULL") {
316 H1_.back()[JetTagCollection_Label[ind]] = ibooker.
book1D(
317 JetTagCollection_Label[ind] +
"_all", JetTagCollection_Label[ind] +
"_all", btagBins, btagL, btagU);
318 H1_.back()[JetTagCollection_Label[ind]]->
setAxisTitle(JetTagCollection_Label[ind] +
"discriminant", 1);
322 for (
int i = 0;
i < 100;
i++) {
325 H1_.back()[inpt] = ibooker.
book1D(inpt, inpt, 105, -5, 100.);
331 for (
int i = 0;
i < 100;
i++) {
334 H1_.back()[inpt] = ibooker.
book1D(inpt, inpt, 105, -5, 100.);
340 for (
int i = 0;
i < 100;
i++) {
343 H1_.back()[inpt] = ibooker.
book1D(inpt, inpt, 105, -5, 100.);
349 for (
auto i : HCALSpecialsNames) {
351 H1mod_.back()[JetTagCollection_Label[ind]][
i.first] = ibooker.
book1D(
352 JetTagCollection_Label[ind] +
"_all", JetTagCollection_Label[ind] +
"_all", btagBins, btagL, btagU);
353 H1mod_.back()[JetTagCollection_Label[ind]][
i.first]->
setAxisTitle(JetTagCollection_Label[ind] +
"discriminant",
365 double etamin = -2.4;
368 for (
unsigned int i = 0;
i < m_mcLabels.size(); ++
i) {
375 if (!JetTagCollection_Label[ind].
empty() && JetTagCollection_Label[ind] !=
"NULL") {
376 label = JetTagCollection_Label[ind] +
"__";
381 label, Form(
"%s %s", JetTagCollection_Label[ind].c_str(), flavour.c_str()), btagBins, btagL, btagU);
383 for (
auto j : HCALSpecialsNames) {
386 label, Form(
"%s %s", JetTagCollection_Label[ind].c_str(), flavour.c_str()), btagBins, btagL, btagU);
390 label = JetTagCollection_Label[ind] +
"___";
394 labelEtaPhi_threshold =
label;
395 label += flavour +
"_disc_pT";
396 labelEta += flavour +
"_disc_eta";
397 labelPhi += flavour +
"_disc_phi";
398 labelEtaPhi += flavour +
"_eta_phi";
399 labelEtaPhi_threshold += flavour +
"_eta_phi_disc05";
402 H2_.back()[
label] = ibooker.
book2D(label, label, btagBins, btagL, btagU, nBinsPt, pTmin, pTMax);
404 H2_.back()[
label]->setAxisTitle(
"disc", 1);
405 for (
auto j : HCALSpecialsNames) {
407 H2mod_.back()[
label][j.first] = ibooker.
book2D(label, label, btagBins, btagL, btagU, nBinsPt, pTmin, pTMax);
409 H2mod_.back()[
label][j.first]->setAxisTitle(
"disc", 1);
412 H2Eta_.back()[labelEta] = ibooker.
book2D(labelEta, labelEta, btagBins, btagL, btagU, nBinsEta, etamin, etaMax);
414 H2Eta_.back()[labelEta]->setAxisTitle(
"disc", 1);
415 H2Phi_.back()[labelPhi] = ibooker.
book2D(labelPhi, labelPhi, btagBins, btagL, btagU, nBinsPhi, phimin, phiMax);
417 H2Phi_.back()[labelPhi]->setAxisTitle(
"disc", 1);
418 H2EtaPhi_.back()[labelEtaPhi] =
419 ibooker.
book2D(labelEtaPhi, labelEtaPhi, nBinsEta, etamin, etaMax, nBinsPhi, phimin, phiMax);
421 H2EtaPhi_.back()[labelEtaPhi]->setAxisTitle(
"eta", 1);
422 H2EtaPhi_threshold_.back()[labelEtaPhi_threshold] = ibooker.
book2D(
423 labelEtaPhi_threshold, labelEtaPhi_threshold, nBinsEta, etamin, etaMax, nBinsPhi, phimin, phiMax);
424 H2EtaPhi_threshold_.back()[labelEtaPhi_threshold]->
setAxisTitle(
"phi", 2);
425 H2EtaPhi_threshold_.back()[labelEtaPhi_threshold]->setAxisTitle(
"eta", 1);
T getParameter(std::string const &) const
const char *const TaggingVariableTokens[]
bool getByToken(EDGetToken token, Handle< PROD > &result) const
JetFloatAssociation::value_type JetTag
bool accept() const
Has at least one path accepted the event?
const_iterator end() const
const_iterator begin() const
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
std::vector< std::string > getParameterNamesForType(bool trackiness=true) const
Vector momentum() const final
spatial momentum vector
#define DEFINE_FWK_MODULE(type)
Container::value_type value_type
void setCurrentFolder(std::string const &fullpath)
const_iterator end() const
MonitorElement * book1D(Args &&...args)
Abs< T >::type abs(const T &t)
auto vector_transform(std::vector< InputType > const &input, Function predicate) -> std::vector< typename std::remove_cv< typename std::remove_reference< decltype(predicate(input.front()))>::type >::type >
T const * product() const
MonitorElement * book2D(Args &&...args)
static std::string const triggerResults("TriggerResults")
void labelsForToken(EDGetToken iToken, Labels &oLabels) const
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
const_iterator begin() const