Skip to content

Commit

Permalink
Merge pull request cms-sw#24 from gpetruc/L1PF_10_6_1p2_X_egID
Browse files Browse the repository at this point in the history
Merge new HGCal cluster ID and switch it on by default
  • Loading branch information
gpetruc authored Sep 30, 2019
2 parents f4ff5f4 + 3dc8150 commit 51e4227
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 24 deletions.
Binary file not shown.
Binary file not shown.
Binary file modified L1Trigger/Phase2L1ParticleFlow/data/jecs/jecs.PU200.root
Binary file not shown.
8 changes: 1 addition & 7 deletions L1Trigger/Phase2L1ParticleFlow/interface/HGC3DClusterEgID.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,11 @@ namespace l1tpf {
for (const auto & psvar : pset.getParameter<std::vector<edm::ParameterSet>>("variables")) {
variables_.emplace_back(psvar.getParameter<std::string>("name"), psvar.getParameter<std::string>("value"));
}
for (const auto & psvar : pset.getParameter<std::vector<edm::ParameterSet>>("spectators")) {
spectators_.emplace_back(psvar.getParameter<std::string>("name"), psvar.getParameter<std::string>("value"));
}
}

void prepareTMVA() {
// Declare the variables
for (auto & var : variables_) var.declare(*reader_);
for (auto & var : spectators_) var.declareSpectator(*reader_);
// then read the weights
if (weightsFile_[0] != '/' && weightsFile_[0] != '.') {
weightsFile_ = edm::FileInPath(weightsFile_).fullPath();
Expand All @@ -52,7 +48,6 @@ namespace l1tpf {
float passID(l1t::HGCalMulticluster c, l1t::PFCluster &cpf) {
if (preselection_(c)) {
for (auto & var : variables_) var.fill(c);
for (auto & var : spectators_) var.fill(c);
float mvaOut = reader_->EvaluateMVA(method_);
if(isPUFilter_) cpf.setEgVsPUMVAOut(mvaOut);
else cpf.setEgVsPionMVAOut(mvaOut);
Expand All @@ -74,7 +69,6 @@ namespace l1tpf {
Var(const std::string & name, const std::string & expr) :
name_(name), expr_(expr) {}
void declare(TMVA::Reader & r) { r.AddVariable(name_, &val_); }
void declareSpectator(TMVA::Reader & r) { r.AddSpectator(name_, &val_); }
void fill(const l1t::HGCalMulticluster & c) { val_ = expr_(c); }
private:
std::string name_;
Expand All @@ -84,7 +78,7 @@ namespace l1tpf {

bool isPUFilter_;
StringCutObjectSelector<l1t::HGCalMulticluster> preselection_;
std::vector<Var> variables_, spectators_;
std::vector<Var> variables_;
std::string method_, weightsFile_;
std::unique_ptr<TMVA::Reader> reader_;
StringObjectFunction<l1t::HGCalMulticluster> wp_;
Expand Down
4 changes: 2 additions & 2 deletions L1Trigger/Phase2L1ParticleFlow/python/l1ParticleFlow_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
puppiPtCuts = cms.vdouble( 1.0, 2.0, 4.0 ),
puppiPtCutsPhotons = cms.vdouble( 1.0, 2.0, 4.0 ),
puppiPtSlopes = cms.vdouble( 0.3, 0.3, 0.3 ), # coefficient for pT
puppiPtSlopesPhotons = cms.vdouble( 0.3, 0.3, 0.3 ),
puppiPtSlopesPhotons = cms.vdouble( 0.4, 0.4, 0.4 ), #When e/g ID not applied, use: cms.vdouble( 0.3, 0.3, 0.3 ),
puppiPtZeros = cms.vdouble( 5.0, 7.0, 9.0 ), # ballpark pT from PU
puppiPtZerosPhotons = cms.vdouble( 3.0, 4.0, 5.0 ),
puppiAlphaSlopes = cms.vdouble( 1.5, 1.5, 2.2 ),
Expand All @@ -144,7 +144,7 @@
puppiAlphaCrops = cms.vdouble( 3 , 3 , 4 ), # max. absolute value for alpha term
puppiAlphaCropsPhotons = cms.vdouble( 3 , 3 , 4 ),
puppiPriors = cms.vdouble( 5.0, 5.0, 7.0 ),
puppiPriorsPhotons = cms.vdouble( 3.5, 3.5, 7.0 ),
puppiPriorsPhotons = cms.vdouble( 1.5, 1.5, 5.0 ), #When e/g ID not applied, use: cms.vdouble( 3.5, 3.5, 7.0 ),
# regionalize
useRelativeRegionalCoordinates = cms.bool(False),
trackRegionMode = cms.string("atCalo"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,36 +8,28 @@
emVsPionID = cms.PSet(
isPUFilter = cms.bool(False),
preselection = cms.string(""),
method = cms.string(""), # "" to be disabled
method = cms.string("BDT"), # "" to be disabled, "BDT" to be enabled
variables = cms.VPSet(
cms.PSet(name = cms.string("eta"), value = cms.string("eta()")),
cms.PSet(name = cms.string("fabs(eta)"), value = cms.string("abs(eta())")),
cms.PSet(name = cms.string("coreShowerLength"), value = cms.string("coreShowerLength()")),
cms.PSet(name = cms.string("maxLayer"), value = cms.string("maxLayer()")),
cms.PSet(name = cms.string("hOverE"), value = cms.string("hOverE()")),
cms.PSet(name = cms.string("sigmaZZ"), value = cms.string("sigmaZZ()")),
),
spectators = cms.VPSet( #Dummy variables, they don't participate in the weights but they need to be there
cms.PSet(name = cms.string("genpt"), value = cms.string("pt()")),
cms.PSet(name = cms.string("genid"), value = cms.string("pdgId()")),
),
weightsFile = cms.string("/eos/cms/store/cmst3/user/evourlio/PF_L1_SelectionWeights/PhotonVsChargedPion/MVAnalysis_BDT.weights.xml"),
wp = cms.string("-0.02")
weightsFile = cms.string("L1Trigger/Phase2L1ParticleFlow/data/hgcal_egID/Photon_vs_Pion_BDTweights.xml.gz"),
wp = cms.string("0.01")
),
emVsPUID = cms.PSet(
isPUFilter = cms.bool(True),
preselection = cms.string(""),
method = cms.string(""), # "" to be disabled
method = cms.string("BDT"), # "" to be disabled, "BDT" to be enabled
variables = cms.VPSet(
cms.PSet(name = cms.string("eta"), value = cms.string("eta()")),
cms.PSet(name = cms.string("fabs(eta)"), value = cms.string("abs(eta())")),
cms.PSet(name = cms.string("coreShowerLength"), value = cms.string("coreShowerLength()")),
cms.PSet(name = cms.string("maxLayer"), value = cms.string("maxLayer()")),
cms.PSet(name = cms.string("sigmaPhiPhiTot"), value = cms.string("sigmaPhiPhiTot()")),
),
spectators = cms.VPSet( #Dummy variables, they don't participate in the weights but they need to be there
cms.PSet(name = cms.string("genpt"), value = cms.string("pt()")),
cms.PSet(name = cms.string("genid"), value = cms.string("pdgId()")),
),
weightsFile = cms.string("/eos/cms/store/cmst3/user/evourlio/PF_L1_SelectionWeights/PhotonPionVsPU/MVAnalysis_BDT.weights.xml"),
weightsFile = cms.string("L1Trigger/Phase2L1ParticleFlow/data/hgcal_egID/Photon_Pion_vs_Neutrino_BDTweights.xml.gz"),
wp = cms.string("-0.02")
),
emOnly = cms.bool(False),
Expand Down

0 comments on commit 51e4227

Please sign in to comment.