Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10035 from lgray/egm_id_74X_v2
EGM IDs for CMSSW 74X Redux
- Loading branch information
Showing
112 changed files
with
5,075 additions
and
146 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Oops, something went wrong.