CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
BTagPerformanceAnalyzerOnData Class Reference

#include <BTagPerformanceAnalyzerOnData.h>

Inheritance diagram for BTagPerformanceAnalyzerOnData:
one::DQMEDAnalyzer< T > one::dqmimplementation::DQMBaseClass< T... >

Public Member Functions

void analyze (const edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
 BTagPerformanceAnalyzerOnData (const edm::ParameterSet &pSet)
 
 ~BTagPerformanceAnalyzerOnData () override
 
- Public Member Functions inherited from one::DQMEDAnalyzer< T >
 DQMEDAnalyzer ()=default
 
 DQMEDAnalyzer (DQMEDAnalyzer< T... > const &)=delete
 
 DQMEDAnalyzer (DQMEDAnalyzer< T... > &&)=delete
 
 ~DQMEDAnalyzer () override=default
 

Private Member Functions

void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 
EtaPtBin getEtaPtBin (const int &iEta, const int &iPt)
 
bool jetRefCompare (const edm::RefToBase< reco::Jet > &j1, const edm::RefToBase< reco::Jet > &j2)
 

Private Attributes

std::vector< std::vector< std::unique_ptr< JetTagPlotter > > > binJetTagPlotters
 
std::vector< std::vector< std::unique_ptr< TagCorrelationPlotter > > > binTagCorrelationPlotters
 
std::vector< std::vector< std::unique_ptr< BaseTagInfoPlotter > > > binTagInfoPlotters
 
bool doJEC
 
std::vector< double > etaRanges
 
edm::EDGetTokenT< GenEventInfoProductgenToken
 
edm::EDGetTokenT< reco::JetCorrectorjecDataToken
 
edm::EDGetTokenT< reco::JetCorrectorjecMCToken
 
AcceptJet jetSelector
 
std::vector< edm::InputTagjetTagInputTags
 
std::vector< edm::EDGetTokenT< reco::JetTagCollection > > jetTagToken
 
std::vector< edm::ParameterSetmoduleConfig
 
std::vector< double > ptRanges
 
edm::InputTag slInfoTag
 
edm::EDGetTokenT< reco::SoftLeptonTagInfoCollectionslInfoToken
 
std::vector< std::pair< edm::InputTag, edm::InputTag > > tagCorrelationInputTags
 
std::vector< std::pair< edm::EDGetTokenT< reco::JetTagCollection >, edm::EDGetTokenT< reco::JetTagCollection > > > tagCorrelationToken
 
std::vector< std::vector< edm::InputTag > > tagInfoInputTags
 
std::vector< std::vector< edm::EDGetTokenT< edm::View< reco::BaseTagInfo > > > > tagInfoToken
 
std::vector< std::string > tiDataFormatType
 

Detailed Description

Top level steering routine for b tag performance analysis.

Definition at line 20 of file BTagPerformanceAnalyzerOnData.h.

Constructor & Destructor Documentation

BTagPerformanceAnalyzerOnData::BTagPerformanceAnalyzerOnData ( const edm::ParameterSet pSet)
explicit

Definition at line 11 of file BTagPerformanceAnalyzerOnData.cc.

References binJetTagPlotters, binTagCorrelationPlotters, binTagInfoPlotters, etaRanges, genToken, edm::ParameterSet::getParameter(), jecDataToken, jecMCToken, jetTagInputTags, jetTagToken, moduleConfig, ptRanges, slInfoToken, tagCorrelationInputTags, tagCorrelationToken, tagInfoInputTags, tagInfoToken, and tiDataFormatType.

11  :
13  pSet.getParameter<double>("etaMin"),
14  pSet.getParameter<double>("etaMax"),
15  pSet.getParameter<double>("ptRecJetMin"),
16  pSet.getParameter<double>("ptRecJetMax"),
17  0.0, 99999.0,
18  pSet.getParameter<double>("ratioMin"),
19  pSet.getParameter<double>("ratioMax"),
20  pSet.getParameter<bool>( "doJetID" )
21  ),
22  etaRanges(pSet.getParameter< vector<double> >("etaRanges")),
23  ptRanges(pSet.getParameter< vector<double> >("ptRanges")),
24  doJEC(pSet.getParameter<bool>( "doJEC" )),
25  moduleConfig(pSet.getParameter< vector<edm::ParameterSet> >("tagConfig"))
26 {
27  genToken = mayConsume<GenEventInfoProduct>(edm::InputTag("generator"));
28  slInfoToken = consumes<SoftLeptonTagInfoCollection>(pSet.getParameter<InputTag>("softLeptonInfo"));
29  jecMCToken = mayConsume<JetCorrector>(pSet.getParameter<edm::InputTag>( "JECsourceMC" ));
30  jecDataToken = consumes<JetCorrector>(pSet.getParameter<edm::InputTag>( "JECsourceData" ));
31 
32  if (etaRanges.size() <= 1)
33  etaRanges = { pSet.getParameter<double>("etaMin"), pSet.getParameter<double>("etaMax") };
34  if (ptRanges.size() <= 1)
35  ptRanges = { pSet.getParameter<double>("ptRecJetMin"), pSet.getParameter<double>("ptRecJetMax") };
36 
37  for (vector<edm::ParameterSet>::const_iterator iModule = moduleConfig.begin();
38  iModule != moduleConfig.end(); ++iModule) {
39 
40  const string& dataFormatType = iModule->exists("type") ?
41  iModule->getParameter<string>("type") :
42  "JetTag";
43  if (dataFormatType == "JetTag") {
44  const InputTag& moduleLabel = iModule->getParameter<InputTag>("label");
45  jetTagInputTags.push_back(moduleLabel);
46  binJetTagPlotters.push_back(vector<std::unique_ptr<JetTagPlotter>>()) ;
47  jetTagToken.push_back(consumes<JetTagCollection>(moduleLabel));
48  }
49  else if(dataFormatType == "TagCorrelation") {
50  const InputTag& label1 = iModule->getParameter<InputTag>("label1");
51  const InputTag& label2 = iModule->getParameter<InputTag>("label2");
52  tagCorrelationInputTags.push_back(std::pair<edm::InputTag, edm::InputTag>(label1, label2));
53  binTagCorrelationPlotters.push_back(vector<std::unique_ptr<TagCorrelationPlotter>>());
54  tagCorrelationToken.push_back(std::pair< edm::EDGetTokenT<reco::JetTagCollection>, edm::EDGetTokenT<reco::JetTagCollection> >(consumes<JetTagCollection>(label1), consumes<JetTagCollection>(label2)));
55  }
56  else {
57  vector<edm::InputTag> vIP;
58  tiDataFormatType.push_back(dataFormatType);
59  binTagInfoPlotters.push_back(vector<std::unique_ptr<BaseTagInfoPlotter>>()) ;
60  std::vector< edm::EDGetTokenT<edm::View<reco::BaseTagInfo>> > tokens;
61  if(dataFormatType == "GenericMVA") {
62  const std::vector<InputTag> listInfo = iModule->getParameter<vector<InputTag>>("listTagInfos");
63  for(unsigned int ITi=0; ITi<listInfo.size(); ITi++) {
64  tokens.push_back(consumes< View<BaseTagInfo> >(listInfo[ITi]));
65  vIP.push_back(listInfo[ITi]);
66  }
67  }
68  else {
69  const InputTag& moduleLabel = iModule->getParameter<InputTag>("label");
70  tokens.push_back(consumes< View<BaseTagInfo> >(moduleLabel));
71  vIP.push_back(moduleLabel);
72  }
73  tagInfoToken.push_back(tokens);
74  tagInfoInputTags.push_back(vIP);
75  }
76  }
77 }
T getParameter(std::string const &) const
std::vector< edm::EDGetTokenT< reco::JetTagCollection > > jetTagToken
edm::EDGetTokenT< reco::JetCorrector > jecMCToken
std::vector< std::string > tiDataFormatType
std::vector< std::pair< edm::EDGetTokenT< reco::JetTagCollection >, edm::EDGetTokenT< reco::JetTagCollection > > > tagCorrelationToken
std::vector< std::pair< edm::InputTag, edm::InputTag > > tagCorrelationInputTags
std::vector< std::vector< edm::EDGetTokenT< edm::View< reco::BaseTagInfo > > > > tagInfoToken
edm::EDGetTokenT< GenEventInfoProduct > genToken
std::vector< std::vector< std::unique_ptr< BaseTagInfoPlotter > > > binTagInfoPlotters
std::vector< std::vector< std::unique_ptr< TagCorrelationPlotter > > > binTagCorrelationPlotters
edm::EDGetTokenT< reco::SoftLeptonTagInfoCollection > slInfoToken
std::vector< std::vector< edm::InputTag > > tagInfoInputTags
std::vector< std::vector< std::unique_ptr< JetTagPlotter > > > binJetTagPlotters
std::vector< edm::ParameterSet > moduleConfig
std::vector< edm::InputTag > jetTagInputTags
edm::EDGetTokenT< reco::JetCorrector > jecDataToken
BTagPerformanceAnalyzerOnData::~BTagPerformanceAnalyzerOnData ( )
override

Definition at line 193 of file BTagPerformanceAnalyzerOnData.cc.

194 {
195  /*for (unsigned int iJetLabel = 0; iJetLabel != binJetTagPlotters.size(); ++iJetLabel) {
196  int plotterSize = binJetTagPlotters[iJetLabel].size();
197  for (int iPlotter = 0; iPlotter != plotterSize; ++iPlotter) {
198  delete binJetTagPlotters[iJetLabel][iPlotter];
199  }
200  }
201 
202  for (vector<vector<TagCorrelationPlotter*> >::iterator iJetLabel = binTagCorrelationPlotters.begin();
203  iJetLabel != binTagCorrelationPlotters.end(); ++iJetLabel)
204  for(vector<TagCorrelationPlotter*>::iterator iPlotter = iJetLabel->begin(); iPlotter != iJetLabel->end(); ++iPlotter)
205  delete *iPlotter;
206 
207  for (unsigned int iJetLabel = 0; iJetLabel != binTagInfoPlotters.size(); ++iJetLabel) {
208  int plotterSize = binTagInfoPlotters[iJetLabel].size();
209  for (int iPlotter = 0; iPlotter != plotterSize; ++iPlotter) {
210  delete binTagInfoPlotters[iJetLabel][iPlotter];
211  }
212  }*/
213 }

Member Function Documentation

void BTagPerformanceAnalyzerOnData::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 215 of file BTagPerformanceAnalyzerOnData.cc.

References edm::AssociationVector< KeyRefProd, CVal, KeyRef, SizeType, KeyReferenceHelper >::begin(), binJetTagPlotters, binTagCorrelationPlotters, binTagInfoPlotters, reco::JetCorrector::correction(), mitigatedMETSequence_cff::corrector, DEFINE_FWK_MODULE, PFTauDiscriminatorLogicalAndProducer_cfi::discr2, doJEC, edm::AssociationVector< KeyRefProd, CVal, KeyRef, SizeType, KeyReferenceHelper >::end(), Exception, genToken, edm::Event::getByToken(), edm::ProductID::id(), edm::HandleBase::isValid(), patTestJEC_cfi::jec, jecDataToken, jecMCToken, reco::BaseTagInfo::jet(), jetSelector, jetTagInputTags, jetTagToken, tablePrinter::labels, LogDebug, edm::Handle< T >::product(), edm::AssociationVector< KeyRefProd, CVal, KeyRef, SizeType, KeyReferenceHelper >::size(), findQualityFiles::size, slInfoToken, tagCorrelationInputTags, tagCorrelationToken, tagInfoInputTags, tagInfoToken, and tiDataFormatType.

216 {
217 
219  iEvent.getByToken(slInfoToken, infoHandle);
220 
221  //Get JEC
222  const JetCorrector* corrector = nullptr;
223  if(doJEC) {
224  edm::Handle<GenEventInfoProduct> genInfoHandle; //check if data or MC
225  iEvent.getByToken(genToken, genInfoHandle);
226  edm::Handle<JetCorrector> corrHandle;
227  if( !genInfoHandle.isValid() ) iEvent.getByToken(jecDataToken, corrHandle);
228  else iEvent.getByToken(jecMCToken, corrHandle);
229  corrector = corrHandle.product();
230  }
231 
232  // Look first at the jetTags
233 
234  for (unsigned int iJetLabel = 0; iJetLabel != jetTagInputTags.size(); ++iJetLabel) {
236  iEvent.getByToken(jetTagToken[iJetLabel], tagHandle);
237  //
238  // insert check on the presence of the collections
239  //
240 
241  if (!tagHandle.isValid()) {
242  edm::LogWarning("BTagPerformanceAnalyzerOnData")<<" Collection "<<jetTagInputTags[iJetLabel]<<" not present. Skipping it for this event.";
243  continue;
244  }
245 
246  const reco::JetTagCollection & tagColl = *(tagHandle.product());
247  LogDebug("Info") << "Found " << tagColl.size() << " B candidates in collection " << jetTagInputTags[iJetLabel];
248 
249  int plotterSize = binJetTagPlotters[iJetLabel].size();
250  for (JetTagCollection::const_iterator tagI = tagColl.begin(); tagI != tagColl.end(); ++tagI) {
251 
252  //JEC
253  double jec = 1.0;
254  if(doJEC && corrector) {
255  jec = corrector->correction(*(tagI->first));
256  }
257 
258  if (!jetSelector(*(tagI->first), -1, infoHandle, jec))
259  continue;
260 
261  for (int iPlotter = 0; iPlotter != plotterSize; ++iPlotter) {
262  bool inBin = binJetTagPlotters[iJetLabel][iPlotter]->etaPtBin().inBin(*tagI->first, jec);
263  // Fill histograms if in desired pt/rapidity bin.
264  if (inBin)
265  binJetTagPlotters[iJetLabel][iPlotter]->analyzeTag(*tagI, jec, -1);
266  }
267  }
268  for (int iPlotter = 0; iPlotter != plotterSize; ++iPlotter) {
269  binJetTagPlotters[iJetLabel][iPlotter]->analyzeTag();
270  }
271  }
272 
273  // Now look at Tag Correlations
274  for (unsigned int iJetLabel = 0; iJetLabel != tagCorrelationInputTags.size(); ++iJetLabel) {
275  const std::pair< edm::EDGetTokenT<reco::JetTagCollection>, edm::EDGetTokenT<reco::JetTagCollection> >& inputTokens = tagCorrelationToken[iJetLabel];
277  iEvent.getByToken(inputTokens.first, tagHandle1);
278  const reco::JetTagCollection& tagColl1 = *(tagHandle1.product());
279 
281  iEvent.getByToken(inputTokens.second, tagHandle2);
282  const reco::JetTagCollection& tagColl2 = *(tagHandle2.product());
283 
284  int plotterSize = binTagCorrelationPlotters[iJetLabel].size();
285  for (JetTagCollection::const_iterator tagI = tagColl1.begin(); tagI != tagColl1.end(); ++tagI) {
286  //JEC
287  double jec = 1.0;
288  if(doJEC && corrector) {
289  jec = corrector->correction(*(tagI->first));
290  }
291 
292  if (!jetSelector(*(tagI->first), -1, infoHandle, jec))
293  continue;
294 
295  for(int iPlotter = 0; iPlotter != plotterSize; ++iPlotter) {
296  bool inBin = binTagCorrelationPlotters[iJetLabel][iPlotter]->etaPtBin().inBin(*(tagI->first), jec);
297 
298  if(inBin)
299  {
300  double discr2 = tagColl2[tagI->first];
301  binTagCorrelationPlotters[iJetLabel][iPlotter]->analyzeTags(tagI->second, discr2, -1);
302  }
303  }
304  }
305  }
306 
307  // Now look at the TagInfos
308  for (unsigned int iJetLabel = 0; iJetLabel != tiDataFormatType.size(); ++iJetLabel) {
309  int plotterSize = binTagInfoPlotters[iJetLabel].size();
310  for (int iPlotter = 0; iPlotter != plotterSize; ++iPlotter)
311  binTagInfoPlotters[iJetLabel][iPlotter]->setEventSetup(iSetup);
312 
313  vector<edm::EDGetTokenT<edm::View<reco::BaseTagInfo>> > & tokens = tagInfoToken[iJetLabel];
314  //check number of tag infos = expected number of tag infos
315  vector<string> labels = binTagInfoPlotters[iJetLabel][0]->tagInfoRequirements();
316  if (labels.empty())
317  labels.push_back("label");
318  if (labels.size() != tokens.size()) throw cms::Exception("Configuration") << "Different number of Tag Infos than expected" << labels.size() << tokens.size() << endl;
319 
320  unsigned int nInputTags = tokens.size();
321  vector< edm::Handle< View<BaseTagInfo> > > tagInfoHandles(nInputTags);
322  edm::ProductID jetProductID;
323  unsigned int nTagInfos = 0;
324  for (unsigned int iInputTags = 0; iInputTags < tokens.size(); ++iInputTags) {
325  edm::Handle< View<BaseTagInfo> > & tagInfoHandle = tagInfoHandles[iInputTags];
326  iEvent.getByToken(tokens[iInputTags], tagInfoHandle);
327  //
328  // protect against missing products
329  //
330  if (tagInfoHandle.isValid() == false) {
331  edm::LogWarning("BTagPerformanceAnalyzerOnData")<<" Collection "<<tagInfoInputTags[iJetLabel][iInputTags]<<" not present. Skipping it for this event.";
332  continue;
333  }
334 
335  unsigned int size = tagInfoHandle->size();
336  LogDebug("Info") << "Found " << size << " B candidates in collection " << tagInfoInputTags[iJetLabel][iInputTags];
337  edm::ProductID thisProductID = (size > 0) ? (*tagInfoHandle)[0].jet().id() : edm::ProductID();
338  if (iInputTags == 0) {
339  jetProductID = thisProductID;
340  nTagInfos = size;
341  } else if (jetProductID != thisProductID)
342  throw cms::Exception("Configuration") << "TagInfos are referencing a different jet collection." << endl;
343  else if (nTagInfos != size)
344  throw cms::Exception("Configuration") << "TagInfo collections are having a different size." << endl;
345  }
346 
347  for (unsigned int iTagInfos = 0; iTagInfos < nTagInfos; ++iTagInfos) {
348  vector<const BaseTagInfo*> baseTagInfos(nInputTags);
349  edm::RefToBase<Jet> jetRef;
350  for (unsigned int iTagInfo = 0; iTagInfo < nInputTags; iTagInfo++) {
351  const BaseTagInfo &baseTagInfo = (*tagInfoHandles[iTagInfo])[iTagInfos];
352  if (iTagInfo == 0)
353  jetRef = baseTagInfo.jet();
354  else if (baseTagInfo.jet() != jetRef)
355  throw cms::Exception("Configuration") << "TagInfos pointing to different jets." << endl;
356  baseTagInfos[iTagInfo] = &baseTagInfo;
357  }
358 
359  //JEC
360  double jec = 1.0;
361  if(doJEC && corrector) {
362  jec = corrector->correction(*(jetRef));
363  }
364 
365  if (!jetSelector(*jetRef, -1, infoHandle, jec))
366  continue;
367 
368  for (int iPlotter = 0; iPlotter != plotterSize; ++iPlotter) {
369  bool inBin = binTagInfoPlotters[iJetLabel][iPlotter]->etaPtBin().inBin(*jetRef, jec);
370  // Fill histograms if in desired pt/rapidity bin.
371  if (inBin)
372  binTagInfoPlotters[iJetLabel][iPlotter]->analyzeTag(baseTagInfos, jec, -1);
373  }
374  }
375  }
376 }
#define LogDebug(id)
size
Write out results.
std::vector< edm::EDGetTokenT< reco::JetTagCollection > > jetTagToken
transient_vector_type::const_iterator const_iterator
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
edm::EDGetTokenT< reco::JetCorrector > jecMCToken
std::vector< std::string > tiDataFormatType
std::vector< std::pair< edm::EDGetTokenT< reco::JetTagCollection >, edm::EDGetTokenT< reco::JetTagCollection > > > tagCorrelationToken
const_iterator end() const
double correction(const LorentzVector &fJet) const
get correction using Jet information only
Definition: JetCorrector.h:49
std::vector< std::pair< edm::InputTag, edm::InputTag > > tagCorrelationInputTags
std::vector< std::vector< edm::EDGetTokenT< edm::View< reco::BaseTagInfo > > > > tagInfoToken
edm::EDGetTokenT< GenEventInfoProduct > genToken
virtual edm::RefToBase< Jet > jet(void) const
returns a polymorphic reference to the tagged jet
Definition: BaseTagInfo.h:24
std::vector< std::vector< std::unique_ptr< BaseTagInfoPlotter > > > binTagInfoPlotters
std::vector< std::vector< std::unique_ptr< TagCorrelationPlotter > > > binTagCorrelationPlotters
bool isValid() const
Definition: HandleBase.h:74
edm::EDGetTokenT< reco::SoftLeptonTagInfoCollection > slInfoToken
std::vector< std::vector< edm::InputTag > > tagInfoInputTags
T const * product() const
Definition: Handle.h:74
std::vector< std::vector< std::unique_ptr< JetTagPlotter > > > binJetTagPlotters
std::vector< edm::InputTag > jetTagInputTags
edm::EDGetTokenT< reco::JetCorrector > jecDataToken
ProductIndex id() const
Definition: ProductID.h:38
const_iterator begin() const
size_type size() const
void BTagPerformanceAnalyzerOnData::bookHistograms ( DQMStore::IBooker ibook,
edm::Run const &  run,
edm::EventSetup const &  es 
)
overrideprivate

Definition at line 79 of file BTagPerformanceAnalyzerOnData.cc.

References binJetTagPlotters, binTagCorrelationPlotters, binTagInfoPlotters, TagInfoPlotterFactory::buildPlotter(), etaRanges, getEtaPtBin(), edm::InputTag::label(), moduleConfig, ptRanges, and plotscripts::setTDRStyle().

Referenced by jetRefCompare().

80 {
81  // Book all histograms.
82 
83  // iterate over ranges:
84  const int iEtaStart = -1 ; // this will be the inactive one
85  const int iEtaEnd = etaRanges.size() > 2 ? etaRanges.size() - 1 : 0; // if there is only one bin defined, leave it as the inactive one
86  const int iPtStart = -1 ; // this will be the inactive one
87  const int iPtEnd = ptRanges.size() > 2 ? ptRanges.size() - 1 : 0; // if there is only one bin defined, leave it as the inactive one
88  setTDRStyle();
89 
90  TagInfoPlotterFactory theFactory;
91  int iTag = -1; int iTagCorr = -1; int iInfoTag = -1;
92  for (vector<edm::ParameterSet>::const_iterator iModule = moduleConfig.begin();
93  iModule != moduleConfig.end(); ++iModule) {
94 
95  const string& dataFormatType = iModule->exists("type") ?
96  iModule->getParameter<string>("type") :
97  "JetTag";
98  if (dataFormatType == "JetTag") {
99  iTag++;
100  const string& folderName = iModule->getParameter<string>("folder");
101 
102  bool doDifferentialPlots = false;
103  double discrCut = -999.;
104  if (iModule->exists("differentialPlots") && iModule->getParameter<bool>("differentialPlots") == true) {
105  doDifferentialPlots = true;
106  discrCut = iModule->getParameter<double>("discrCut");
107  }
108 
109  // eta loop
110  for (int iEta = iEtaStart ; iEta < iEtaEnd ; ++iEta) {
111  // pt loop
112  for (int iPt = iPtStart ; iPt < iPtEnd ; ++iPt) {
113 
114  const EtaPtBin& etaPtBin = getEtaPtBin(iEta, iPt);
115 
116  // Instantiate the generic b tag plotter
117  binJetTagPlotters.at(iTag).push_back(std::make_unique<JetTagPlotter>(folderName, etaPtBin, iModule->getParameter<edm::ParameterSet>("parameters"), 0, false, ibook, false, doDifferentialPlots, discrCut));
118 
119  }
120  }
121 
122  } else if (dataFormatType == "TagCorrelation") {
123  iTagCorr++;
124  const InputTag& label1 = iModule->getParameter<InputTag>("label1");
125  const InputTag& label2 = iModule->getParameter<InputTag>("label2");
126 
127  // eta loop
128  for (int iEta = iEtaStart ; iEta != iEtaEnd ; ++iEta) {
129  // pt loop
130  for(int iPt = iPtStart ; iPt != iPtEnd ; ++iPt) {
131  const EtaPtBin& etaPtBin = getEtaPtBin(iEta, iPt);
132  // Instantiate the generic b tag correlation plotter
133  binTagCorrelationPlotters.at(iTagCorr).push_back(
134  std::make_unique<TagCorrelationPlotter>(label1.label(), label2.label(), etaPtBin,
135  iModule->getParameter<edm::ParameterSet>("parameters"),
136  0, false, false, ibook)
137  );
138  }
139  }
140  } else {
141  iInfoTag++;
142  // tag info retrievel is deferred (needs availability of EventSetup)
143  const InputTag& moduleLabel = iModule->getParameter<InputTag>("label");
144  const string& folderName = iModule->getParameter<string>("folder");
145 
146  // eta loop
147  for (int iEta = iEtaStart ; iEta < iEtaEnd ; ++iEta) {
148  // pt loop
149  for (int iPt = iPtStart ; iPt < iPtEnd ; ++iPt) {
150  const EtaPtBin& etaPtBin = getEtaPtBin(iEta, iPt);
151 
152  // Instantiate the tagInfo plotter
153  binTagInfoPlotters.at(iInfoTag).push_back(theFactory.buildPlotter(dataFormatType, moduleLabel.label(),
154  etaPtBin, iModule->getParameter<edm::ParameterSet>("parameters"), folderName,
155  0, false, ibook)
156  );
157  }
158  }
159  }
160  }
161 }
def setTDRStyle()
Definition: plotscripts.py:89
std::vector< std::vector< std::unique_ptr< BaseTagInfoPlotter > > > binTagInfoPlotters
std::vector< std::vector< std::unique_ptr< TagCorrelationPlotter > > > binTagCorrelationPlotters
std::vector< std::vector< std::unique_ptr< JetTagPlotter > > > binJetTagPlotters
std::vector< edm::ParameterSet > moduleConfig
EtaPtBin getEtaPtBin(const int &iEta, const int &iPt)
std::string const & label() const
Definition: InputTag.h:36
std::unique_ptr< BaseTagInfoPlotter > buildPlotter(const std::string &dataFormatType, const std::string &tagName, const EtaPtBin &etaPtBin, const edm::ParameterSet &pSet, const std::string &folderName, unsigned int mc, bool wf, DQMStore::IBooker &ibook)
EtaPtBin BTagPerformanceAnalyzerOnData::getEtaPtBin ( const int &  iEta,
const int &  iPt 
)
private

Definition at line 163 of file BTagPerformanceAnalyzerOnData.cc.

References histoStyle::EtaPtBin, etaRanges, and ptRanges.

Referenced by bookHistograms(), and jetRefCompare().

164 {
165  // DEFINE BTagBin:
166  bool etaActive_ , ptActive_;
167  double etaMin_, etaMax_, ptMin_, ptMax_;
168 
169  if ( iEta != -1 ) {
170  etaActive_ = true;
171  etaMin_ = etaRanges[iEta];
172  etaMax_ = etaRanges[iEta+1];
173  }
174  else {
175  etaActive_ = false;
176  etaMin_ = etaRanges[0];
177  etaMax_ = etaRanges[etaRanges.size() - 1];
178  }
179 
180  if ( iPt != -1 ) {
181  ptActive_ = true;
182  ptMin_ = ptRanges[iPt];
183  ptMax_ = ptRanges[iPt+1];
184  }
185  else {
186  ptActive_ = false;
187  ptMin_ = ptRanges[0];
188  ptMax_ = ptRanges[ptRanges.size() - 1];
189  }
190  return EtaPtBin(etaActive_, etaMin_, etaMax_, ptActive_, ptMin_ , ptMax_);
191 }
bool BTagPerformanceAnalyzerOnData::jetRefCompare ( const edm::RefToBase< reco::Jet > &  j1,
const edm::RefToBase< reco::Jet > &  j2 
)
inlineprivate

Definition at line 31 of file BTagPerformanceAnalyzerOnData.h.

References bookHistograms(), getEtaPtBin(), edm::RefToBase< T >::id(), and edm::RefToBase< T >::key().

32  {
33  return j1.id() < j2.id() || (j1.id() == j2.id() && j1.key() < j2.key());
34  }
ProductID id() const
Definition: RefToBase.h:242
size_t key() const
Definition: RefToBase.h:250

Member Data Documentation

std::vector< std::vector<std::unique_ptr<JetTagPlotter> > > BTagPerformanceAnalyzerOnData::binJetTagPlotters
private
std::vector< std::vector<std::unique_ptr<TagCorrelationPlotter> > > BTagPerformanceAnalyzerOnData::binTagCorrelationPlotters
private
std::vector< std::vector<std::unique_ptr<BaseTagInfoPlotter> > > BTagPerformanceAnalyzerOnData::binTagInfoPlotters
private
bool BTagPerformanceAnalyzerOnData::doJEC
private

Definition at line 44 of file BTagPerformanceAnalyzerOnData.h.

Referenced by analyze().

std::vector<double> BTagPerformanceAnalyzerOnData::etaRanges
private
edm::EDGetTokenT<GenEventInfoProduct> BTagPerformanceAnalyzerOnData::genToken
private

Definition at line 59 of file BTagPerformanceAnalyzerOnData.h.

Referenced by analyze(), and BTagPerformanceAnalyzerOnData().

edm::EDGetTokenT<reco::JetCorrector> BTagPerformanceAnalyzerOnData::jecDataToken
private

Definition at line 58 of file BTagPerformanceAnalyzerOnData.h.

Referenced by analyze(), and BTagPerformanceAnalyzerOnData().

edm::EDGetTokenT<reco::JetCorrector> BTagPerformanceAnalyzerOnData::jecMCToken
private

Definition at line 57 of file BTagPerformanceAnalyzerOnData.h.

Referenced by analyze(), and BTagPerformanceAnalyzerOnData().

AcceptJet BTagPerformanceAnalyzerOnData::jetSelector
private

Definition at line 42 of file BTagPerformanceAnalyzerOnData.h.

Referenced by analyze().

std::vector<edm::InputTag> BTagPerformanceAnalyzerOnData::jetTagInputTags
private

Definition at line 50 of file BTagPerformanceAnalyzerOnData.h.

Referenced by analyze(), and BTagPerformanceAnalyzerOnData().

std::vector< edm::EDGetTokenT<reco::JetTagCollection> > BTagPerformanceAnalyzerOnData::jetTagToken
private

Definition at line 61 of file BTagPerformanceAnalyzerOnData.h.

Referenced by analyze(), and BTagPerformanceAnalyzerOnData().

std::vector<edm::ParameterSet> BTagPerformanceAnalyzerOnData::moduleConfig
private
std::vector<double> BTagPerformanceAnalyzerOnData::ptRanges
private
edm::InputTag BTagPerformanceAnalyzerOnData::slInfoTag
private

Definition at line 45 of file BTagPerformanceAnalyzerOnData.h.

edm::EDGetTokenT<reco::SoftLeptonTagInfoCollection> BTagPerformanceAnalyzerOnData::slInfoToken
private

Definition at line 60 of file BTagPerformanceAnalyzerOnData.h.

Referenced by analyze(), and BTagPerformanceAnalyzerOnData().

std::vector< std::pair<edm::InputTag, edm::InputTag> > BTagPerformanceAnalyzerOnData::tagCorrelationInputTags
private

Definition at line 51 of file BTagPerformanceAnalyzerOnData.h.

Referenced by analyze(), and BTagPerformanceAnalyzerOnData().

std::vector< std::pair<edm::EDGetTokenT<reco::JetTagCollection>, edm::EDGetTokenT<reco::JetTagCollection> > > BTagPerformanceAnalyzerOnData::tagCorrelationToken
private

Definition at line 62 of file BTagPerformanceAnalyzerOnData.h.

Referenced by analyze(), and BTagPerformanceAnalyzerOnData().

std::vector< std::vector<edm::InputTag> > BTagPerformanceAnalyzerOnData::tagInfoInputTags
private

Definition at line 52 of file BTagPerformanceAnalyzerOnData.h.

Referenced by analyze(), and BTagPerformanceAnalyzerOnData().

std::vector<std::vector <edm::EDGetTokenT<edm::View<reco::BaseTagInfo> > > > BTagPerformanceAnalyzerOnData::tagInfoToken
private

Definition at line 63 of file BTagPerformanceAnalyzerOnData.h.

Referenced by analyze(), and BTagPerformanceAnalyzerOnData().

std::vector<std::string> BTagPerformanceAnalyzerOnData::tiDataFormatType
private

Definition at line 41 of file BTagPerformanceAnalyzerOnData.h.

Referenced by analyze(), and BTagPerformanceAnalyzerOnData().