Skip to content

Commit

Permalink
Backport of configurable BTagAnalyzer from 10_1_X
Browse files Browse the repository at this point in the history
  • Loading branch information
rauser committed Dec 7, 2018
1 parent b6d8bf4 commit 80acc11
Show file tree
Hide file tree
Showing 14 changed files with 9,472 additions and 1,983 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@
*.*~
#*.*#
__init__.py
*.log

4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,6 @@ To run the tests for integrating changes run:
cd RecoBTag/PerformanceMeasurements/test/
./run_tests.sh
```

The content of the output ntuple is by default empty and has to be configured according to your needs. The ```store*Variables``` options have been removed.
The new variable configuration can be customized in the file ```RecoBTag/PerformanceMeasurements/python/varGroups_cfi.py```.
New variables need also to be added (apart from adding them in the code) in ```RecoBTag/PerformanceMeasurements/python/variables_cfi.py```
754 changes: 362 additions & 392 deletions interface/EventInfoBranches.h

Large diffs are not rendered by default.

2,383 changes: 1,094 additions & 1,289 deletions interface/JetInfoBranches.h

Large diffs are not rendered by default.

37 changes: 37 additions & 0 deletions interface/VariableParser.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#ifndef VARIABLEPARSER_H
#define VARIABLEPARSER_H

#include "FWCore/ParameterSet/interface/ParameterSet.h"

#include <unordered_set>

class VariableParser {

public:

VariableParser(bool isMC = false);

std::unordered_set<std::string> parseGroupsAndVariables(std::vector<edm::ParameterSet> groupSet, std::vector<edm::ParameterSet> variableSet);
std::unordered_set<std::string> getStoredVariables();
void printStoredVariables();
void printGroups(std::vector<edm::ParameterSet> groupSet);
void printVariables(std::vector<edm::ParameterSet> variableSet);
void saveStoredVariablesToFile(std::string filename="storedVariables.log");
bool isToBeStored(std::string variableName);
bool isMC(){return isMC_;}
void resetStoredVariables(){storedVariables_.clear();}

private:

std::unordered_set<std::string> storedVariables_;
bool isMC_;

void resolveVariableName(std::string fullName, std::string* variableName, std::string* prefix);
void parseGroups(std::vector<edm::ParameterSet> groupSet, std::vector<edm::ParameterSet> variableSet);
void parseVariables(std::vector<edm::ParameterSet> variableSet);
void addVariable(edm::ParameterSet variable, bool force = false, std::string prefix = "");

};


#endif
322 changes: 145 additions & 177 deletions plugins/BTagAnalyzer.cc

Large diffs are not rendered by default.

37 changes: 16 additions & 21 deletions python/bTagAnalyzerCommon_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,30 @@
from SimTracker.TrackHistory.TrackClassifier_cff import *
bTagAnalyzerCommon = cms.PSet(
trackClassifier,
runOnData = cms.bool(False),
runFatJets = cms.bool(False),
runSubJets = cms.bool(False),
allowJetSkipping = cms.bool(True),
useSelectedTracks = cms.bool(True),
useTrackHistory = cms.bool(False),
produceJetTrackTree = cms.bool(False),
produceJetTrackTruthTree = cms.bool(False),
produceAllTrackTree = cms.bool(False),
producePtRelTemplate = cms.bool(False),
storeEventInfo = cms.bool(True),
storeJetVariables = cms.bool(True),
storeQuarkVariables = cms.bool(False),
storeHadronVariables = cms.bool(False),
storeGenVariables = cms.bool(True),
storePatMuons = cms.bool(False),
storeTagVariables = cms.bool(False),
storeTagVariablesSubJets = cms.bool(False),
storeCSVTagVariables = cms.bool(False),
storeCSVTagTrackVariables= cms.bool(False),
storeDeepFlavourVariables= cms.bool(True),
storeDeepCSVVariables = cms.bool(True),
storeDeepFlavourTagVariables = cms.bool(False),
storeCSVTagVariablesSubJets = cms.bool(False),
storeCSVTagTrackVariablesSubJets = cms.bool(False),
storePFElectronVariables = cms.bool(False),
storePFMuonVariables = cms.bool(False),
storeCTagVariables = cms.bool(False),
doCTag = cms.bool(False),
fillsvTagInfo = cms.bool(False),
runEventInfo = cms.bool(True),
runJetVariables = cms.bool(True),
runQuarkVariables = cms.bool(False),
runHadronVariables = cms.bool(False),
runGenVariables = cms.bool(True),
runPatMuons = cms.bool(False),
runTagVariables = cms.bool(False),
runTagVariablesSubJets = cms.bool(False),
runCSVTagVariables = cms.bool(False),
runCSVTagTrackVariables = cms.bool(False),
runDeepFlavourTagVariables = cms.bool(False),
runCSVTagVariablesSubJets = cms.bool(False),
runPFElectronVariables = cms.bool(False),
runPFMuonVariables = cms.bool(False),
runCTagVariables = cms.bool(False),
fillPU = cms.bool(True),
selTagger = cms.int32(2),
MaxEta = cms.double(2.5),
Expand Down
4 changes: 4 additions & 0 deletions python/bTagAnalyzer_cfi.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import FWCore.ParameterSet.Config as cms
from RecoBTag.PerformanceMeasurements.bTagAnalyzerCommon_cff import *
from RecoBTag.PerformanceMeasurements.variables_cfi import *
from RecoBTag.PerformanceMeasurements.varGroups_cfi import *
bTagAnalyzer = cms.EDAnalyzer("BTagAnalyzer",
bTagAnalyzerCommon,
variableSet,
groupSet,
# computers
svComputer = cms.string('candidateCombinedSecondaryVertexV2Computer'),
svComputerSubJets = cms.string('candidateCombinedSecondaryVertexV2Computer'),
Expand Down
4 changes: 2 additions & 2 deletions python/defaults/Moriond18.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
common = {
'eras' : ['Run2_2017'],
'miniAOD' : True,
'storeDeepFlavourTagVariables' : True,
'runDeepFlavourTagVariables' : True,
}

mc = {
Expand All @@ -11,7 +11,7 @@
}

data = {
'inputFiles' : ['/store/data/Run2017D/JetHT/MINIAOD/17Nov2017-v1/20000/0249B143-8CCC-E711-BA7C-0025905C2CD0.root'],
'inputFiles' : ['/store/data/Run2017C/JetHT/MINIAOD/17Nov2017-v1/20000/00791B22-DCD3-E711-9BF9-001E67396E64.root'],
'JPCalibration' : 'JPcalib_Data94X_2017_v1',
'dataGlobalTag' : '94X_dataRun2_ReReco_EOY17_v2',
}
Loading

0 comments on commit 80acc11

Please sign in to comment.