Skip to content

Commit

Permalink
Merge pull request #32372 from bainbrid/LowPtElectrons_userFloats_106X
Browse files Browse the repository at this point in the history
Add low-pT electrons to MINIAOD, update ID, improve end user experience (back port of 31220)
  • Loading branch information
cmsbuild authored Dec 9, 2020
2 parents 8d5ea35 + 541fb89 commit 5fa77db
Show file tree
Hide file tree
Showing 30 changed files with 1,262 additions and 394 deletions.
14 changes: 7 additions & 7 deletions CommonTools/MVAUtils/BuildFile.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<use name="CondFormats/EgammaObjects"/>
<use name="FWCore/ParameterSet"/>
<use name="FWCore/Utilities"/>
<use name="CondFormats/DataRecord"/>
<use name="roottmva"/>
<use name="tinyxml2"/>

<use name="CommonTools/Utils"/>
<use name="CondFormats/EgammaObjects"/>
<use name="FWCore/ParameterSet"/>
<use name="FWCore/Utilities"/>
<use name="CondFormats/DataRecord"/>
<use name="roottmva"/>
<use name="tinyxml2"/>
<export>
<lib name="1"/>
</export>
4 changes: 4 additions & 0 deletions CommonTools/MVAUtils/bin/BuildFile.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<use name="CommonTools/MVAUtils"/>

<bin name="convertXMLToGBRForestROOT" file="convertXMLToGBRForestROOT.cc">
</bin>
34 changes: 34 additions & 0 deletions CommonTools/MVAUtils/bin/convertXMLToGBRForestROOT.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#include "CommonTools/MVAUtils/interface/GBRForestTools.h"

#include "TFile.h"

#include <boost/filesystem.hpp>
#include <iostream>

int main(int argc, char **argv) {
if (argc != 3) {
std::cout << "Please pass a (gzipped) BDT weight file and a name for the output ROOT file." << std::endl;
return 1;
}

char *inputFileName = argv[1];
char *outputFileName = argv[2];

if (!boost::filesystem::exists(inputFileName)) {
std::cout << "Input file " << inputFileName << " does not exists." << std::endl;
return 1;
}

if (boost::filesystem::exists(outputFileName)) {
std::cout << "Output file " << outputFileName << " already exists." << std::endl;
return 1;
}

auto gbrForest = createGBRForest(inputFileName);
std::cout << "Read GBRForest " << inputFileName << " successfully." << std::endl;

TFile{outputFileName, "RECREATE"}.WriteObject(gbrForest.get(), "gbrForest");
std::cout << "GBRForest written to " << outputFileName << " successfully." << std::endl;

return 0;
}
12 changes: 12 additions & 0 deletions CommonTools/MVAUtils/src/GBRForestTools.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#include "FWCore/ParameterSet/interface/FileInPath.h"
#include "FWCore/Utilities/interface/Exception.h"

#include "TFile.h"

#include <cstdio>
#include <cstdlib>
#include <RVersion.h>
Expand Down Expand Up @@ -117,6 +119,16 @@ namespace {
}

std::unique_ptr<GBRForest> init(const std::string& weightsFileFullPath, std::vector<std::string>& varNames) {
//
// Load weights file, for ROOT file
//
if (reco::details::hasEnding(weightsFileFullPath, ".root")) {
TFile gbrForestFile(weightsFileFullPath.c_str());
std::unique_ptr<GBRForest> up(reinterpret_cast<GBRForest*>(gbrForestFile.Get("gbrForest")));
gbrForestFile.Close("nodelete");
return up;
}

//
// Load weights file, for gzipped or raw xml file
//
Expand Down
2 changes: 2 additions & 0 deletions DataFormats/PatCandidates/src/classes_def_objects.xml
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,8 @@
<class name="std::vector<edm::Ptr<pat::PackedCandidate> >" />
<class name="edm::Wrapper<edm::Ptr<pat::PackedCandidate> >" />
<class name="edm::Wrapper<std::vector<edm::Ptr<pat::PackedCandidate> > >" />
<class name="edm::ValueMap<edm::Ptr<pat::PackedCandidate> >" />
<class name="edm::Wrapper<edm::ValueMap<edm::Ptr<pat::PackedCandidate> > >" />

<class name="std::vector<edm::Ptr<pat::PackedGenParticle> >" />
<class name="edm::Wrapper<edm::Ptr<pat::PackedGenParticle> >" />
Expand Down
1 change: 1 addition & 0 deletions PhysicsTools/PatAlgos/plugins/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<use name="HLTrigger/HLTcore"/>
<use name="DataFormats/PatCandidates"/>
<use name="DataFormats/BTauReco"/>
<use name="DataFormats/Common"/>
<use name="DataFormats/JetReco"/>
<use name="DataFormats/MuonReco"/>
<use name="DataFormats/TrackReco"/>
Expand Down
Loading

0 comments on commit 5fa77db

Please sign in to comment.