15 using namespace RecoBTag;
18 partonKinematics(pSet.getParameter< bool >(
"partonKinematics")),
20 pSet.getParameter<double>(
"etaMin"),
21 pSet.getParameter<double>(
"etaMax"),
22 pSet.getParameter<double>(
"ptRecJetMin"),
23 pSet.getParameter<double>(
"ptRecJetMax"),
25 pSet.getParameter<double>(
"ratioMin"),
26 pSet.getParameter<double>(
"ratioMax")
28 etaRanges(pSet.getParameter< vector<double> >(
"etaRanges")),
29 ptRanges(pSet.getParameter< vector<double> >(
"ptRanges")),
30 produceEps(pSet.getParameter< bool >(
"produceEps")),
31 producePs(pSet.getParameter< bool >(
"producePs")),
32 psBaseName(pSet.getParameter<std::string>(
"psBaseName" )),
33 epsBaseName(pSet.getParameter<std::string>(
"epsBaseName" )),
34 inputFile(pSet.getParameter<std::string>(
"inputfile" )),
35 update(pSet.getParameter<bool>(
"update" )),
36 allHisto(pSet.getParameter<bool>(
"allHistograms" )),
37 finalize(pSet.getParameter< bool >(
"finalizePlots")),
38 finalizeOnly(pSet.getParameter< bool >(
"finalizeOnly")),
39 slInfoTag(pSet.getParameter<edm::
InputTag>(
"softLeptonInfo")),
40 moduleConfig(pSet.getParameter< vector<edm::
ParameterSet> >(
"tagConfig")),
41 mcPlots_(pSet.getParameter< bool >(
"mcPlots"))
64 const int iEtaStart = -1 ;
65 const int iEtaEnd =
etaRanges.size() - 1 ;
66 const int iPtStart = -1 ;
67 const int iPtEnd =
ptRanges.size() - 1 ;
72 for (vector<edm::ParameterSet>::const_iterator iModule =
moduleConfig.begin();
75 const string& dataFormatType = iModule->exists(
"type") ?
76 iModule->getParameter<
string>(
"type") :
78 if (dataFormatType ==
"JetTag") {
80 const string& folderName = iModule->getParameter<
string>(
"folder");
84 vector<BTagDifferentialPlot*> * differentialPlotsConstantEta =
new vector<BTagDifferentialPlot*> () ;
85 vector<BTagDifferentialPlot*> * differentialPlotsConstantPt =
new vector<BTagDifferentialPlot*> () ;
90 const double& effBConst =
91 iModule->getParameter<
edm::ParameterSet>(
"parameters").getParameter<double>(
"effBConst");
95 for (
int iEta = iEtaStart ; iEta < iEtaEnd ; ++iEta ) {
98 differentialPlotsConstantEta->push_back ( etaConstDifferentialPlot );
101 for (
int iPt = iPtStart ; iPt < iPtEnd ; ++iPt ) {
105 differentialPlotsConstantPt->push_back ( ptConstDifferentialPlot );
110 for (
int iEta = iEtaStart ; iEta < iEtaEnd ; ++iEta ) {
112 for (
int iPt = iPtStart ; iPt < iPtEnd ; ++iPt ) {
123 (*differentialPlotsConstantEta)[iEta+1]->addBinPlotter ( jetTagPlotter ) ;
124 (*differentialPlotsConstantPt )[iPt+1] ->addBinPlotter ( jetTagPlotter ) ;
131 differentialPlots.back().reserve(differentialPlotsConstantEta->size()+differentialPlotsConstantPt->size()) ;
139 delete differentialPlotsConstantEta ;
140 delete differentialPlotsConstantPt ;
142 }
else if(dataFormatType ==
"TagCorrelation") {
149 for (
int iEta = iEtaStart ; iEta != iEtaEnd ; ++iEta) {
151 for(
int iPt = iPtStart ; iPt != iPtEnd ; ++iPt) {
163 const string& folderName = iModule->getParameter<
string>(
"folder");
170 for (
int iEta = iEtaStart ; iEta < iEtaEnd ; ++iEta ) {
172 for (
int iPt = iPtStart ; iPt < iPtEnd ; ++iPt ) {
196 bool etaActive_ , ptActive_;
197 double etaMin_, etaMax_, ptMin_, ptMax_ ;
220 return EtaPtBin(etaActive_ , etaMin_ , etaMax_ ,
221 ptActive_ , ptMin_ , ptMax_ );
226 for (
unsigned int iJetLabel = 0; iJetLabel !=
binJetTagPlotters.size(); ++iJetLabel) {
228 for (
int iPlotter = 0; iPlotter != plotterSize; ++iPlotter) {
241 for(vector<TagCorrelationPlotter*>::iterator iPlotter = iJetLabel->begin(); iPlotter != iJetLabel->end(); ++iPlotter)
244 for (
unsigned int iJetLabel = 0; iJetLabel !=
binTagInfoPlotters.size(); ++iJetLabel) {
246 for (
int iPlotter = 0; iPlotter != plotterSize; ++iPlotter) {
263 for (
unsigned int iJetLabel = 0; iJetLabel !=
jetTagInputTags.size(); ++iJetLabel) {
280 tagI != tagColl.
end(); ++tagI) {
283 if (!
jetSelector(*(tagI->first), -1, infoHandle))
continue;
284 for (
int iPlotter = 0; iPlotter != plotterSize; ++iPlotter) {
285 bool inBin =
binJetTagPlotters[iJetLabel][iPlotter]->etaPtBin().inBin(*tagI->first);
297 iEvent.
getByLabel(inputTags.first, tagHandle1);
301 iEvent.
getByLabel(inputTags.second, tagHandle2);
309 for(
int iPlotter = 0; iPlotter != plotterSize; ++iPlotter) {
314 double discr2 = tagColl2[tagI->first];
322 for (
unsigned int iJetLabel = 0; iJetLabel !=
tiDataFormatType.size(); ++iJetLabel) {
324 for (
int iPlotter = 0; iPlotter != plotterSize; ++iPlotter)
328 if (inputTags.empty()) {
334 labels.push_back(
"label");
335 for (vector<string>::const_iterator iLabels = labels.begin();
336 iLabels != labels.end(); ++iLabels) {
339 inputTags.push_back(inputTag);
343 unsigned int nInputTags = inputTags.size();
344 vector< edm::Handle< View<BaseTagInfo> > > tagInfoHandles(nInputTags);
346 unsigned int nTagInfos = 0;
347 for (
unsigned int iInputTags = 0; iInputTags < inputTags.size(); ++iInputTags) {
349 iEvent.
getByLabel(inputTags[iInputTags], tagInfoHandle);
353 if (tagInfoHandle.
isValid() ==
false){
354 edm::LogWarning(
"BTagPerformanceAnalyzerOnData")<<
" Collection "<<inputTags[iInputTags]<<
" not present. Skipping it for this event.";
359 unsigned int size = tagInfoHandle->size();
360 LogDebug(
"Info") <<
"Found " << size <<
" B candidates in collection " << inputTags[iInputTags];
362 if (iInputTags == 0) {
363 jetProductID = thisProductID;
365 }
else if (jetProductID != thisProductID)
366 throw cms::Exception(
"Configuration") <<
"TagInfos are referencing a different jet collection." << endl;
367 else if (nTagInfos != size)
368 throw cms::Exception(
"Configuration") <<
"TagInfo collections are having a different size." << endl;
371 for (
unsigned int iTagInfos = 0; iTagInfos < nTagInfos; ++iTagInfos) {
372 vector<const BaseTagInfo*> baseTagInfos(nInputTags);
374 for (
unsigned int iTagInfo = 0; iTagInfo < nInputTags; iTagInfo++) {
375 const BaseTagInfo &baseTagInfo = (*tagInfoHandles[iTagInfo])[iTagInfos];
377 jetRef = baseTagInfo.
jet();
378 else if (baseTagInfo.
jet() != jetRef)
379 throw cms::Exception(
"Configuration") <<
"TagInfos pointing to different jets." << endl;
380 baseTagInfos[iTagInfo] = &baseTagInfo;
386 for (
int iPlotter = 0; iPlotter != plotterSize; ++iPlotter) {
400 for (
unsigned int iJetLabel = 0; iJetLabel !=
binJetTagPlotters.size(); ++iJetLabel) {
402 for (
int iPlotter = 0; iPlotter != plotterSize; ++iPlotter) {
412 (**iPlotter).process();
419 for (
unsigned int iJetLabel = 0; iJetLabel !=
binTagInfoPlotters.size(); ++iJetLabel) {
421 for (
int iPlotter = 0; iPlotter != plotterSize; ++iPlotter) {
transient_vector_type::const_iterator const_iterator
#define DEFINE_FWK_MODULE(type)
const_iterator end() const
virtual edm::RefToBase< Jet > jet(void) const
returns a polymorphic reference to the tagged jet
BaseTagInfoPlotter * buildPlotter(const std::string &dataFormatType, const std::string &tagName, const EtaPtBin &etaPtBin, const edm::ParameterSet &pSet, const std::string &folderName, const bool &update, const bool &mc, const bool &wf)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
virtual std::vector< std::string > tagInfoRequirements() const
T const * product() const
const_iterator begin() const
tuple size
Write out results.