7 template <
typename T,
typename V>
10 for (
unsigned int i = 0;
i < association.
size(); ++
i) {
24 hlTriggerResults_ = consumes<edm::TriggerResults>(iConfig.
getParameter<
InputTag> (
"TriggerResults"));
26 m_mcPartons = consumes<JetFlavourMatchingCollection>(iConfig.getParameter<
InputTag> (
"mcPartons") );
27 hltPathNames_ = iConfig.getParameter< std::vector<std::string> > (
"HLTPathNames");
32 m_mcPartons_Label =
label.module;
34 for(
unsigned int i=0;
i<JetTagCollection_.size() ;
i++){
36 JetTagCollection_Label.push_back(
label.module);
40 hlTriggerResults_Label =
label.module;
42 for (
unsigned int i = 0;
i < m_mcLabels.size(); ++
i)
43 m_mcFlavours.push_back( mc.getParameter<std::vector<unsigned int> >(m_mcLabels[
i]) );
44 m_mcMatching = m_mcPartons_Label !=
"none" ;
58 triggerConfChanged_ =
true;
61 hltConfigProvider_.init(iRun, iSetup,
label.process, triggerConfChanged_);
62 const std::vector< std::string > & allHltPathNames = hltConfigProvider_.triggerNames();
65 for (
size_t trgs=0; trgs<hltPathNames_.size(); trgs++) {
66 unsigned int found = 1;
68 for (
size_t it=0 ; it < allHltPathNames.size() ; ++it )
70 found = allHltPathNames.at(it).find(hltPathNames_[trgs]);
76 hltPathIndexs_.push_back(it_mem);
80 for (
size_t trgs=0; trgs<hltPathNames_.size(); trgs++) {
81 if ( hltPathIndexs_[trgs] < 0 ) {
82 _isfoundHLTs.push_back(
false);
85 _isfoundHLTs.push_back(
true);
101 if ( hlTriggerResults_Label ==
"" || hlTriggerResults_Label ==
"NULL" )
103 edm::LogInfo(
"NoTriggerResults") <<
"TriggerResults ==> Empty";
106 iEvent.
getByToken(hlTriggerResults_, TriggerResulsHandler);
107 if (TriggerResulsHandler.isValid()) trigRes=
true;
108 if ( !trigRes ) {
edm::LogInfo(
"NoTriggerResults") <<
"TriggerResults ==> not readable";
return;}
112 if (m_mcMatching && m_mcPartons_Label!=
"" && m_mcPartons_Label !=
"NULL" ) {
114 if (h_mcPartons.isValid()) MCOK=
true;
119 for (
unsigned int ind=0; ind<hltPathNames_.size();ind++) {
122 if ( !_isfoundHLTs[ind])
continue;
126 if (JetTagCollection_Label[ind] !=
"" && JetTagCollection_Label[ind] !=
"NULL" )
128 iEvent.
getByToken(JetTagCollection_[ind], JetTagHandler);
129 if (JetTagHandler.isValid()) BtagOK=
true;
133 if (BtagOK)
for (
auto iter = JetTagHandler->begin(); iter != JetTagHandler->end(); iter++ )
138 edm::LogInfo(
"NoCollection") <<
"Collection " << JetTagCollection_Label[ind] <<
" ==> not found";
return;
141 for (
auto & BtagJT: JetTag) {
143 H1_.at(ind)[JetTagCollection_Label[ind]] ->
Fill(std::fmax(0.0,BtagJT.second));
145 int m =
closestJet(BtagJT.first, *h_mcPartons, m_mcRadius);
146 unsigned int flavour = (m != -1) ?
abs((*h_mcPartons)[
m].second.getFlavour()) : 0;
147 for (
unsigned int i = 0;
i < m_mcLabels.size(); ++
i) {
148 TString flavour_str= m_mcLabels[
i].c_str();
150 auto it =
std::find(flav_collection.begin(), flav_collection.end(),
flavour);
151 if (it== flav_collection.end())
continue;
152 TString
label=JetTagCollection_Label[ind] +
"__";
154 H1_.at(ind)[label.Data()]->Fill(std::fmax(0.0,BtagJT.second));
155 label=JetTagCollection_Label[ind] +
"___";
157 label+=TString(
"_disc_pT");
158 H2_.at(ind)[label.Data()]->Fill(std::fmax(0.0,BtagJT.second),BtagJT.first->pt());
173 assert(hltPathNames_.size()== JetTagCollection_.size());
175 for (
unsigned int ind=0; ind<hltPathNames_.size();ind++){
179 dqmFolder = Form(
"HLT/BTag/Discriminator/%s",hltPathNames_[ind].c_str());
180 H1_.push_back(std::map<std::string, MonitorElement *>());
181 H2_.push_back(std::map<std::string, MonitorElement *>());
185 if ( JetTagCollection_Label[ind] !=
"" && JetTagCollection_Label[ind] !=
"NULL" ) {
186 H1_.back()[JetTagCollection_Label[ind]] = ibooker.
book1D(JetTagCollection_Label[ind] +
"_all", (JetTagCollection_Label[ind]+
"_all").c_str(), btagBins, btagL, btagU );
187 H1_.back()[JetTagCollection_Label[ind]] -> setAxisTitle(JetTagCollection_Label[ind] +
"discriminant",1);
193 for (
unsigned int i = 0;
i < m_mcLabels.size(); ++
i)
195 TString
flavour= m_mcLabels[
i].c_str();
197 if ( JetTagCollection_Label[ind] !=
"" && JetTagCollection_Label[ind] !=
"NULL" ) {
198 label=JetTagCollection_Label[ind]+
"__";
202 H1_.back()[label.Data()] = ibooker.
book1D(label.Data(), Form(
"%s %s",JetTagCollection_Label[ind].c_str(),flavour.Data()), btagBins, btagL, btagU );
204 label=JetTagCollection_Label[ind]+
"___";
205 label+=flavour+TString(
"_disc_pT");
208 H2_.back()[label.Data()] = ibooker.
book2D( label.Data(), label.Data(), btagBins, btagL, btagU, nBinsPt, pTmin, pTMax );
210 H2_.back()[label.Data()]->setAxisTitle(
"disc",1);
T getParameter(std::string const &) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
JetFloatAssociation::value_type JetTag
virtual Vector momentum() const
spatial momentum vector
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 >
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
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
MonitorElement * book1D(Args &&...args)
Abs< T >::type abs(const T &t)
Container::value_type value_type
void setCurrentFolder(const std::string &fullpath)
MonitorElement * book2D(Args &&...args)
static std::string const triggerResults("TriggerResults")
void labelsForToken(EDGetToken iToken, Labels &oLabels) const
int flavour(const Candidate &part)
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)