Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] First series of updates for 10_2_X #289

Open
wants to merge 15 commits into
base: CMSSW_10_2_X
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMSSW.arch
Original file line number Diff line number Diff line change
@@ -1 +1 @@
slc6_amd64_gcc630
slc7_amd64_gcc700
2 changes: 1 addition & 1 deletion CMSSW.release
Original file line number Diff line number Diff line change
@@ -1 +1 @@
CMSSW_9_4_9
CMSSW_10_2_9
11 changes: 10 additions & 1 deletion bootstrap_jenkins.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,20 @@ function cms-merge-commit()
git cms-init --upstream-only

echo "---> Merging recipes..."
git cms-merge-topic UAEDF-tomc:eleCutBasedId_94X_V2
git cms-merge-topic cms-egamma:EgammaID_1023 ## for Photon ID Fall17 V2 (will be included in 10_2_10)
git cms-merge-topic cms-egamma:EgammaPostRecoTools
## add recipes here

echo "---> Running git cms-checkdeps"
git cms-checkdeps -a

echo "---> Adding TreeWrapper"
git clone -o upstream https://github.com/blinkseb/TreeWrapper.git cp3_llbb/TreeWrapper

if [ -d "cp3_llbb/Framework" ]; then
if ! python -c 'import requests' 2>/dev/null ; then
pushd "cp3_llbb/Framework" &> /dev/null
source "$(dirname $0)/install_requests.sh"
popd &> /dev/null
fi
fi
72 changes: 72 additions & 0 deletions install_requests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# no shebang, must be sourced

## based on S�bastien Brochet's install-tensorflow.sh script in cp3-llbb/HHTools)

reqversion="2.21.0"

## deduce source location from the script name
if [[ -z "${ZSH_NAME}" ]]; then
thisscript="$(readlink -f ${BASH_SOURCE})"
else
thisscript="$(readlink -f ${0})"
fi
pipinstall="$(dirname ${thisscript})/.python"

# Check if in CMSSW
if [ -z "$CMSSW_BASE" ]; then
echo "You must use this package inside a CMSSW environment"
return 1
fi
pymajmin=$(python -c 'import sys; print(".".join(str(num) for num in sys.version_info[:2]))')
if [[ "${pymajmin}" != "2.7" ]]; then
echo "--> Only python 2.7 is supported"
return 1
fi

# Check if it is already installed
scram tool info py2-requests > /dev/null 2> /dev/null
if [ $? -eq 0 ]; then
echo "--> already installed (according to scram)"
return 0
fi

# First, download and install pip, if needed
bk_pythonpath="${PYTHONPATH}"
python -m pip --version > /dev/null 2> /dev/null
if [ $? -ne 0 ]; then
echo "--> No pip found, bootstrapping in ${pipinstall}"
[ -d "${pipinstall}" ] || mkdir "${pipinstall}"
if [ ! -f "${pipinstall}/bin/pip" ]; then
wget -O "${pipinstall}/get-pip.py" "https://bootstrap.pypa.io/get-pip.py"
python "${pipinstall}/get-pip.py" --prefix="${pipinstall}" --no-setuptools
fi
export PYTHONPATH="${pipinstall}/lib/python${pymajmin}/site-packages:${PYTHONPATH}"
fi

## install dependencies
installpath="${CMSSW_BASE}/install/py2-requests"
echo "--> Installing requests"
python -m pip install --prefix="${installpath}" --ignore-installed --upgrade --upgrade-strategy=only-if-needed requests=="${reqversion}"

# root_interface toolfile
toolfile="${installpath}/py2-requests.xml"
cat <<EOF_TOOLFILE >"${toolfile}"
<tool name="py2-requests" version="${reqversion}">
<info url="http://python-requests.org/"/>
<client>
<environment name="PY2_REQUESTS_BASE" default="${installpath}"/>
<runtime name="LD_LIBRARY_PATH" value="\$PY2_REQUESTS_BASE/lib" type="path"/>
<runtime name="PYTHONPATH" value="\$PY2_REQUESTS_BASE/lib/python${pymajmin}/site-packages" type="path"/>
</client>
</tool>
EOF_TOOLFILE

## cleanup
rm -rf "${pipinstall}"
export PYTHONPATH="${bk_pythonpath}"

echo "--> Updating environment"
scram setup "${toolfile}"
eval `scram runtime -sh` ## cmsenv

echo "--> requests is installed. The package can normally be installed with 'scram b' now"
1 change: 1 addition & 0 deletions interface/Analyzer.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ namespace Framework {
tree(tree_),
m_systematics(config.getUntrackedParameter<bool>("systematics", false)) {
}
virtual ~Analyzer() = default;

virtual void analyze(const edm::Event&, const edm::EventSetup&, const ProducersManager&, const AnalyzersManager&, const CategoryManager&) = 0;
virtual void doConsumes(const edm::ParameterSet&, edm::ConsumesCollector&& collector) {}
Expand Down
1 change: 1 addition & 0 deletions interface/AnalyzerGetter.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ namespace Framework {

class AnalyzerGetter {
public:
virtual ~AnalyzerGetter() noexcept(false); // to silence warning, and because subclass ExTreeMaker inherits a throwing constructor
virtual const Framework::Analyzer& getAnalyzer(const std::string& name) const = 0;
virtual bool analyzerExists(const std::string& name) const = 0;
};
1 change: 1 addition & 0 deletions interface/BTaggingScaleFactors.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class BTaggingScaleFactors {
m_tree(tree) {
// Empty
}
virtual ~BTaggingScaleFactors() = default;

virtual void create_branches(const edm::ParameterSet&) final;

Expand Down
2 changes: 2 additions & 0 deletions interface/BinnedValues.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ class BinnedValues {

BinnedValues() = default;

virtual ~BinnedValues() = default;

private:
template <typename _Value>
std::vector<_Value> get(Histogram<_Value, float>& h, const std::vector<float>& bins, bool& outOfRange) const {
Expand Down
2 changes: 2 additions & 0 deletions interface/BinnedValuesJSONParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ class BinnedValuesJSONParser {
parse_file(file);
}

virtual ~BinnedValuesJSONParser() = default;

virtual BinnedValues&& get_values() final {
return std::move(m_values);
}
Expand Down
2 changes: 2 additions & 0 deletions interface/Category.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ struct CategoryMetadata {

class Category {
public:
virtual ~Category() = default;

virtual void configure(const edm::ParameterSet& config) {};

virtual bool event_in_category_pre_analyzers(const ProducersManager& producers) const = 0;
Expand Down
1 change: 1 addition & 0 deletions interface/Filter.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ namespace Framework {
Filter(const std::string& name, const edm::ParameterSet& config):
m_name(name) {
}
virtual ~Filter() = default;

virtual bool filter(edm::Event&, const edm::EventSetup&) = 0;
virtual void doConsumes(const edm::ParameterSet&, edm::ConsumesCollector&& collector) {}
Expand Down
2 changes: 1 addition & 1 deletion interface/Framework.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class ExTreeMaker: public edm::EDProducer, ProducerGetter, AnalyzerGetter {

public:
explicit ExTreeMaker(const edm::ParameterSet&);
~ExTreeMaker();
virtual ~ExTreeMaker();

private:
virtual void beginJob() override;
Expand Down
1 change: 1 addition & 0 deletions interface/Histogram.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class Histogram {
m_errors_low.reset(new T[m_size]);
m_errors_high.reset(new T[m_size]);
}
virtual ~Histogram() = default;

static size_t findBin(const std::vector<_Bin>& array, _Bin value) {
for (std::size_t i = 0; i < array.size() - 1; i++) {
Expand Down
1 change: 1 addition & 0 deletions interface/Identifiable.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class Identifiable {
ids(tree["ids"].write<std::vector<std::map<std::string, bool>>>()) {
// Empty
}
virtual ~Identifiable() = default;

template <class T> void produce_id(const edm::Ref<T>& ref) {
std::map<std::string, bool> ids_;
Expand Down
2 changes: 2 additions & 0 deletions interface/Producer.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ namespace Framework {
m_systematics(config.getUntrackedParameter<bool>("systematics", false)) {
}

virtual ~Producer() = default;

//! Main method of the producer, called for each event.
/*!
* You have direct access to the event via the CMSSW interface with the @p event and @p setup parameters.
Expand Down
1 change: 1 addition & 0 deletions interface/ProducerGetter.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ namespace Framework {

class ProducerGetter {
public:
virtual ~ProducerGetter() noexcept(false); // to silence warning, and because subclass ExTreeMaker inherits a throwing constructor
virtual const Framework::Producer& getProducer(const std::string& name) const = 0;
virtual bool producerExists(const std::string& name) const = 0;
};
1 change: 1 addition & 0 deletions interface/ScaleFactors.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class ScaleFactors {
m_tree(tree) {
// Empty
}
virtual ~ScaleFactors() = default;

virtual void create_branches(const edm::ParameterSet&) final;
virtual void create_branch(const std::string& scale_factor, const std::string& branch_name);
Expand Down
12 changes: 9 additions & 3 deletions python/ElectronsProducer.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import FWCore.ParameterSet.Config as cms

mvaTag = "Run2Fall17IsoV2"

default_configuration = cms.PSet(
type = cms.string('electrons'),
prefix = cms.string('electron_'),
Expand All @@ -12,11 +14,15 @@
cms.InputTag("egmGsfElectronIDs:cutBasedElectronID-Fall17-94X-V2-veto"),
cms.InputTag("egmGsfElectronIDs:cutBasedElectronID-Fall17-94X-V2-loose"),
cms.InputTag("egmGsfElectronIDs:cutBasedElectronID-Fall17-94X-V2-medium"),
cms.InputTag("egmGsfElectronIDs:cutBasedElectronID-Fall17-94X-V2-tight")
cms.InputTag("egmGsfElectronIDs:cutBasedElectronID-Fall17-94X-V2-tight"),
cms.InputTag("egmGsfElectronIDs:mvaEleID-Fall17-iso-V2-wp80"),
cms.InputTag("egmGsfElectronIDs:mvaEleID-Fall17-iso-V2-wp90"),
cms.InputTag("egmGsfElectronIDs:mvaEleID-Fall17-noIso-V2-wp80"),
cms.InputTag("egmGsfElectronIDs:mvaEleID-Fall17-noIso-V2-wp90")
),
mva_id = cms.untracked.PSet(
values=cms.untracked.InputTag("electronMVAValueMapProducer:ElectronMVAEstimatorRun2Fall17IsoV1Values"),
categories=cms.untracked.InputTag("electronMVAValueMapProducer:ElectronMVAEstimatorRun2Fall17IsoV1Categories")),
values=cms.untracked.InputTag("electronMVAValueMapProducer:ElectronMVAEstimator{0}Values".format(mvaTag)),
categories=cms.untracked.InputTag("electronMVAValueMapProducer:ElectronMVAEstimator{0}Categories".format(mvaTag))),
scale_factors = cms.untracked.PSet(
## name=cms.untracked.FileInPath(),
)
Expand Down
Loading