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

VID Feature Requests for 75X #9659

Merged
merged 78 commits into from
Jul 10, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
267fa00
first version of VID validation tool
lgray Jun 15, 2015
6a4d5e0
give per-cut hash information then hash all of that into the total
lgray Jun 15, 2015
857b45e
boiler plate for expression evaluator cuts
lgray Jun 15, 2015
5ac77f3
working on ExpressionEvaluator cuts
lgray Jun 15, 2015
99e5879
implement expression evaluator cut in VID
lgray Jun 15, 2015
bd151ea
turn off debug output of ExpressionEvaluator and fix naming bug in Ve…
lgray Jun 15, 2015
cac812d
add value() accessor to VID cuts
lgray Jun 16, 2015
366d841
add VIDCutFlowResult result digest and bitmap manipulator
lgray Jun 17, 2015
c49a2ca
add name to each CutFlowResult
lgray Jun 17, 2015
8acce90
correct logic in cut flow decision
lgray Jun 17, 2015
cc7e6cb
make python wrapper for vid::CutFlowResult
lgray Jun 17, 2015
c14d0ab
add cutFlowResult to VersionedIdProducer
lgray Jun 17, 2015
5f64981
add value to muon pog cuts, change muon pog cuts to switch
lgray Jun 20, 2015
d30a34c
change to FWLiteEnabler and updates to python classes
lgray Jun 25, 2015
ce3d570
use std::map in vid::CutFlowResult
lgray Jun 25, 2015
d0b2665
stash some further developments for cut digest
lgray Jun 27, 2015
303b351
Update effAreaPhotons_cone03_pfPhotons.txt
skyriacoCMS Jun 15, 2015
1e0146b
Electron MVA implementation (work in progress, doesn't build in this …
ikrav May 24, 2015
347e59f
A few updates to MVA code, now it builds
ikrav May 24, 2015
fa8b736
A few changes to the MVA class
ikrav May 24, 2015
d119899
MVA weights for non-triggering PHYS14 electron MVA
ikrav May 24, 2015
3e9d92a
Further updates of this MVA implementation
ikrav May 24, 2015
d2d099e
Improvement to the MVA estimator classes
ikrav Jun 11, 2015
000e91e
Added MVA cut, producer, and one full configuration to VID
ikrav Jun 11, 2015
910f348
Followed a few tips from Lindsey: fixed a memory leak, and the cause …
ikrav Jun 12, 2015
cb6f2a1
Partial modifications of the new MVA classes toward the factory/plugi…
ikrav Jun 12, 2015
7c6438a
Next steps in MVA implementation for electron ID. This version does n…
ikrav Jun 16, 2015
46d54da
Fixed compiler errors
ikrav Jun 17, 2015
7fa3779
Changed MVA name field to match class name. Added consistent configur…
ikrav Jun 17, 2015
c8f1293
More changes to MVA implementation
ikrav Jun 18, 2015
b5d75c4
More changes to MVA implementation
ikrav Jun 18, 2015
625b452
Added value() function to conform the new way of cut implementation.
ikrav Jun 18, 2015
d23b02b
Moving to templated MVA producer. This commit does not compile
ikrav Jun 18, 2015
8e5fd72
Another step in the right direction
ikrav Jun 18, 2015
95e9c7c
Another step
ikrav Jun 18, 2015
c40b220
A few more fixes, and now the templated MVA compiles
ikrav Jun 18, 2015
c0c8711
Adjusted cut values for MVA cuts for WP80 and WP90 to give roughly th…
ikrav Jun 18, 2015
803d692
Working on the issue if CTF track reference, this is not final.
ikrav Jun 19, 2015
2ceaf25
The fix for the CTF track reference issue
ikrav Jun 19, 2015
07389a6
First steps toward photon MVA esimator and producer implementation.
ikrav Jun 21, 2015
c68ec02
More development of the VID MVA. This version compiles
ikrav Jun 21, 2015
a1e37f5
A fix
ikrav Jun 21, 2015
c076fd6
Minor adjustments
ikrav Jun 22, 2015
ef08eb9
Added the new MVA for photons, V0 trained on Spring15
ikrav Jun 22, 2015
56d1fd7
baseline of ObjectModifier plugin system, towards VID-by-value
lgray Jun 28, 2015
1b12edd
add guts to ObjectModifier
lgray Jun 28, 2015
3808870
use regular edm::Event and add edm::EventSetup, ObjectModifiers will …
lgray Jun 28, 2015
e4cd06e
modified object producers for MiniAOD -> MiniAOD reprocessing or poss…
lgray Jun 28, 2015
cb136cd
configuring for HEEP V6.0
Sam-Harper Jun 28, 2015
8fed351
move MicroEventContent to its own file
lgray Jun 29, 2015
bcd4dde
add reMiniAOD config and add empty modification list to all places wh…
lgray Jun 29, 2015
9d74367
more descriptive file name
lgray Jun 29, 2015
58b007a
add appropriate import statements to event content
lgray Jun 29, 2015
27f0537
enable MINIAODfromMINIAOD in cmsDriver.py
lgray Jun 29, 2015
a66e5b3
add skeleton of EG shower shape modifier
lgray Jun 30, 2015
fc4b57d
working example of object editors for EGM
lgray Jun 30, 2015
0bab17b
VID by value working, still testing
lgray Jul 2, 2015
b0c2be0
validate no vmap to vmap
lgray Jul 3, 2015
13ed787
update all valuemap based cuts to check for valuemap or ask for embed…
lgray Jul 3, 2015
04f8fca
documentation, bugfix, and address code review for vid::CutFlowResult
lgray Jul 4, 2015
5bed138
move ModifyObjectValueBase to CommonTools/CandAlgos
lgray Jul 4, 2015
7eb8895
Float_t -> float for electron mva
lgray Jul 4, 2015
9afd93b
fix logic in checking for products in photon mva producers
lgray Jul 4, 2015
baa9535
Point PatAlgos/plugins BuildFile at the right place...
lgray Jul 4, 2015
eb4b3a2
add pat::UserData hooks to VersionedIdProducer
lgray Jul 4, 2015
4851448
fix bug in MVA cut
lgray Jul 4, 2015
e30b2fc
add masking information to python wrapper
lgray Jul 4, 2015
343f4a9
set pog approved IDs
lgray Jul 4, 2015
74ebe1d
update MiniAOD to latest IDs
lgray Jul 4, 2015
ed92daa
add self-checking to python classes
lgray Jul 4, 2015
cf40f4c
fix naming of modified object producers + add in hooks object mods in…
lgray Jul 6, 2015
7651ef6
fix up issues with getting products in modifiers
lgray Jul 6, 2015
af17071
move object mods to be directly in miniaod
lgray Jul 6, 2015
5c6b902
fix indexing
lgray Jul 6, 2015
7e1ddb8
remove local copies of data files
lgray Jul 6, 2015
bbd6535
fix patch area identification
VinInn Jun 29, 2015
6f6d932
fix a bug in using valuemaps in miniaodfromminiaod
lgray Jul 8, 2015
156b815
point pyfwlite script at relval
lgray Jul 9, 2015
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
1 change: 1 addition & 0 deletions CommonTools/CandAlgos/BuildFile.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<use name="SimGeneral/HepPDTRecord"/>
<use name="FWCore/Framework"/>
<use name="FWCore/ParameterSet"/>
<use name="DataFormats/PatCandidates"/>
<export>
<lib name="1"/>
</export>
61 changes: 61 additions & 0 deletions CommonTools/CandAlgos/interface/ModifyObjectValueBase.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#ifndef __CommonTools_CandAlgos_ModifyObjectValueBase_h__
#define __CommonTools_CandAlgos_ModifyObjectValueBase_h__

#include "DataFormats/PatCandidates/interface/Electron.h"
#include "DataFormats/PatCandidates/interface/Photon.h"
#include "DataFormats/PatCandidates/interface/Muon.h"
#include "DataFormats/PatCandidates/interface/Tau.h"
#include "DataFormats/PatCandidates/interface/Jet.h"

#include "FWCore/Utilities/interface/Exception.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/Framework/interface/ConsumesCollector.h"

#include <string>

class ModifyObjectValueBase {
public:
ModifyObjectValueBase(const edm::ParameterSet& conf) :
name_( conf.getParameter<std::string>("modifierName") ) {}

virtual ~ModifyObjectValueBase() {}

virtual void setEvent(const edm::Event&) {}
virtual void setEventContent(const edm::EventSetup&) {}
virtual void setConsumes(edm::ConsumesCollector&) {}

virtual void modifyObject(pat::Electron&) const {
throw cms::Exception("InvalidConfiguration")
<< name_ << " is not configured to handle electrons!";
}
virtual void modifyObject(pat::Photon&) const {
throw cms::Exception("InvalidConfiguration")
<< name_ << " is not configured to handle photons!";
}
virtual void modifyObject(pat::Muon&) const {
throw cms::Exception("InvalidConfiguration")
<< name_ << " is not configured to handle muons!";
}
virtual void modifyObject(pat::Tau&) const {
throw cms::Exception("InvalidConfiguration")
<< name_ << " is not configured to handle taus!";
}
virtual void modifyObject(pat::Jet&) const {
throw cms::Exception("InvalidConfiguration")
<< name_ << " is not configured to handle jets!";
}

const std::string& name() const { return name_; }

private:
const std::string name_;
};

#if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__)
#include "FWCore/PluginManager/interface/PluginFactory.h"
typedef edmplugin::PluginFactory< ModifyObjectValueBase* (const edm::ParameterSet&) > ModifyObjectValueFactory;
#endif

#endif
4 changes: 4 additions & 0 deletions CommonTools/CandAlgos/src/ModifyObjectValueBase.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#include "CommonTools/CandAlgos/interface/ModifyObjectValueBase.h"

EDM_REGISTER_PLUGINFACTORY(ModifyObjectValueFactory,"ModifyObjectValueFactory");

2 changes: 1 addition & 1 deletion CommonTools/Utils/interface/ExpressionEvaluator.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class ExpressionEvaluator {
ExpressionEvaluator(const char * pkg, const char * iname, const std::string & iexpr);
~ExpressionEvaluator();

template< typename EXPR>
template<typename EXPR, typename... CArgs>
EXPR * expr() const {
typedef EXPR * factoryP();
return reinterpret_cast<factoryP*>(m_expr)();
Expand Down
6 changes: 3 additions & 3 deletions CommonTools/Utils/src/ExpressionEvaluator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include <regex>
#include <dlfcn.h>

#define VI_DEBUG
// #define VI_DEBUG

#ifdef VI_DEBUG
#include <iostream>
Expand Down Expand Up @@ -40,7 +40,7 @@ namespace {
}

std::string patchArea() {
auto n1 = execSysCommand("scram tool tag cmssw CMSSW_BASE");
auto n1 = execSysCommand("pushd $CMSSW_BASE > /dev/null;scram tool tag cmssw CMSSW_BASE; popd > /dev/null");
n1.pop_back();
COUT << "base area " << n1 << std::endl;
return n1[0]=='/' ? n1 : std::string();
Expand Down Expand Up @@ -89,7 +89,7 @@ ExpressionEvaluator::ExpressionEvaluator(const char * pkg, const char * iname, s
} else {
// look in release is a patch area
auto paDir = patchArea();
if (paDir.empty()) throw cms::Exception("ExpressionEvaluator", pch + " file not found neither in " + baseDir + " nor in " + relDir);
if (paDir.empty()) throw cms::Exception("ExpressionEvaluator", "error in opening patch area for "+ baseDir);
std::string file = paDir + incDir + pch + ".cxxflags";
COUT << "file in base release area: " << file << std::endl;
std::ifstream ss(file.c_str());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
EventInterpretation = {
'top' : 'CommonTools.ParticleFlow.EITopPAG_cff'
'top' : 'CommonTools.ParticleFlow.EITopPAG_cff',
'MiniAODfromMiniAOD' : 'PhysicsTools.PatAlgos.slimming.MiniAODfromMiniAOD_cff'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggested this as a hack.
Full implementation should deal with this as a separate step or a separate option in the configBuilder.
(plan to have it in 76X)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For now, for people to use it, is this fine?
This will need to go into 74X as well, so we should decide what we want quickly.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's OK for me in a short term, as long as this stays for some private recipes.
If MiniAODfromMiniAOD turns into an official workflow (with central production implied), then the steps better be defined appropriately.

}
3 changes: 3 additions & 0 deletions DataFormats/EgammaCandidates/interface/Photon.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,9 @@ namespace reco {

{}
} ;
const ShowerShape& showerShapeVariables() const { return showerShapeBlock_; }
const ShowerShape& full5x5_showerShapeVariables() const { return full5x5_showerShapeBlock_; }

void setShowerShapeVariables ( const ShowerShape& a ) { showerShapeBlock_ = a ;}
void full5x5_setShowerShapeVariables ( const ShowerShape& a ) { full5x5_showerShapeBlock_ = a ;}

Expand Down
57 changes: 36 additions & 21 deletions DataFormats/FWLite/python/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,13 +222,18 @@ def getByLabel (self, *args):
# handle is always the last argument
argsList = list (args)
handle = argsList.pop()
if len(argsList)==1 and \
( isinstance (argsList[0], tuple) or
isinstance (argsList[0], list) ) :
if len (argsList) > 3:
raise RuntimeError, "getByLabel Error: label tuple has too " \
"many arguments '%s'" % argsList[0]
argsList = list(argsList[0])
if len(argsList)==1 :
if( isinstance (argsList[0], tuple) or
isinstance (argsList[0], list) ) :
if len (argsList[0]) > 3:
raise RuntimeError, "getByLabel Error: label tuple has too " \
"many arguments '%s'" % argsList[0]
argsList = list(*argsList[0])
if( type(argsList[0]) is str and ":" in argsList[0] ):
if argsList[0].count(":") > 3:
raise RuntimeError, "getByLabel Error: label tuple has too " \
"many arguments '%s'" % argsList[0].split(":")
argsList = argsList[0].split(":")
while len(argsList) < 3:
argsList.append ('')
(moduleLabel, productInstanceLabel, processLabel) = argsList
Expand Down Expand Up @@ -375,13 +380,18 @@ def getByLabel (self, *args):
# handle is always the last argument
argsList = list (args)
handle = argsList.pop()
if len(argsList)==1 and \
( isinstance (argsList[0], tuple) or
isinstance (argsList[0], list) ) :
if len (argsList) > 3:
raise RuntimeError, "getByLabel Error: label tuple has too " \
"many arguments '%s'" % argsList[0]
argsList = list(argsList[0])
if len(argsList)==1 :
if( isinstance (argsList[0], tuple) or
isinstance (argsList[0], list) ) :
if len (argsList[0]) > 3:
raise RuntimeError, "getByLabel Error: label tuple has too " \
"many arguments '%s'" % argsList[0]
argsList = list(*argsList[0])
if( type(argsList[0]) is str and ":" in argsList[0] ):
if argsList[0].count(":") > 3:
raise RuntimeError, "getByLabel Error: label tuple has too " \
"many arguments '%s'" % argsList[0].split(":")
argsList = argsList[0].split(":")
while len(argsList) < 3:
argsList.append ('')
(moduleLabel, productInstanceLabel, processLabel) = argsList
Expand Down Expand Up @@ -546,13 +556,18 @@ def getByLabel (self, *args):
# handle is always the last argument
argsList = list (args)
handle = argsList.pop()
if len(argsList)==1 and \
( isinstance (argsList[0], tuple) or
isinstance (argsList[0], list) ) :
if len (argsList) > 3:
raise RuntimeError, "getByLabel Error: label tuple has too " \
"many arguments '%s'" % argsList[0]
argsList = list(argsList[0])
if len(argsList)==1 :
if( isinstance (argsList[0], tuple) or
isinstance (argsList[0], list) ) :
if len (argsList[0]) > 3:
raise RuntimeError, "getByLabel Error: label tuple has too " \
"many arguments '%s'" % argsList[0]
argsList = list(*argsList[0])
if( type(argsList[0]) is str and ":" in argsList[0] ):
if argsList[0].count(":") > 3:
raise RuntimeError, "getByLabel Error: label tuple has too " \
"many arguments '%s'" % argsList[0].split(":")
argsList = argsList[0].split(":")
while len(argsList) < 3:
argsList.append ('')
(moduleLabel, productInstanceLabel, processLabel) = argsList
Expand Down
112 changes: 112 additions & 0 deletions DataFormats/PatCandidates/interface/VIDCutFlowResult.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
#ifndef __DataFormats_PatCandidates_VIDResult_H__
#define __DataFormats_PatCandidates_VIDResult_H__

#include <map>
#include <vector>
#include <string>

/*********
*
* Class: vid::CutFlowResult
* Author: L. Gray (FNAL)
*
* A synthesis of the output of a VID selector into an easily
* manipulated class, such that cuts can be masked and sidebands
* created without major intervention on the part of the person
* doing analysis.
*
* The class is self-describing and the original cut-names, the
* values cut upon, the result of each cut used, and final cutflow
* decision can be accessed with this class. Using this information
* the cut flow can be masked interactively by the user, allowing
* for a large degree of flexibility at the analysis level.
*
*********/

namespace vid {
class CutFlowResult {
template<class T> friend class VersionedSelector;
public:

CutFlowResult() : bitmap_(0) {}
CutFlowResult(const std::string& name,
const std::string& hash,
const std::map<std::string,unsigned>& n2idx,
const std::vector<double>& values,
unsigned bitmap,
unsigned mask = 0);

// get the original name of this cutflow
const std::string& cutFlowName() const { return name_; }
// get the md5 hash for this cutflow
const std::string& cutFlowHash() const { return hash_; }
// did this cutflow (in its current state!) pass?
bool cutFlowPassed() const {
const unsigned all_pass = (1 << indices_.size()) - 1;
return (all_pass&bitmap_) == all_pass;
}
// how many cuts in this cutflow?
size_t cutFlowSize() const { return indices_.size(); }

// get the name of a cut in the cutflow
// indexed by order it was executed
const std::string& getNameAtIndex(const unsigned idx) const;

// get the individual cut result (pass/fail) either by name or by index
bool getCutResultByIndex(const unsigned idx) const;
bool getCutResultByName(const std::string& name) const;

// return true if the cut as index/name is masked out
bool isCutMasked(const unsigned idx) const;
bool isCutMasked(const std::string& name) const;

// get the value of variable that was cut on, either by name or by index
double getValueCutUpon(const unsigned idx) const;
double getValueCutUpon(const std::string& name) const;

// create a new copy of this cutflow masking out the listed cuts
// can be done either by name or by index
CutFlowResult getCutFlowResultMasking(const unsigned idx) const;
CutFlowResult getCutFlowResultMasking(const std::string& name) const;

CutFlowResult getCutFlowResultMasking(const std::vector<unsigned>& idxs) const;
CutFlowResult getCutFlowResultMasking(const std::vector<std::string>& names) const;

private:
std::string name_, hash_;
unsigned bitmap_, mask_;
std::vector<double> values_;
std::vector<std::string> names_;
std::vector<unsigned> indices_;

CutFlowResult(const std::string& name,
const std::string& hash,
const std::vector<std::string>& names,
const std::vector<unsigned>& indices,
const std::vector<double>& values,
unsigned bitmap,
unsigned mask) :
name_(name),
hash_(hash),
bitmap_(bitmap),
mask_(mask),
values_(values),
names_(names),
indices_(indices) {}


bool getMaskBit(const unsigned idx) const {
return (bool)(0x1&(mask_>>idx));
}

bool getCutBit(const unsigned idx) const {
return (bool)(0x1&(bitmap_>>idx));
}

bool getCutValue(const unsigned idx) const {
return values_[idx];
}
};
}

#endif
Loading