44 #include <Math/VectorUtil.h> 71 template<
class T,
class V>
173 isMC_ (iConfig.getParameter<
bool>(
"isMC")),
174 deltaR_ (iConfig.getParameter<double>(
"deltaR")),
175 ptThreshold_ (iConfig.getParameter<double>(
"ptThreshold")),
233 vars_.push_back(0.0);
263 consumes<edm::ValueMap<float>>(
tag);
266 consumes<double>(
tag);
301 <<
" failed to find a standard AOD or miniAOD vertex collection " << std::endl;
304 vtxN_ = vertices->size();
314 <<
" failed to find a standard AOD or miniAOD pileup collection " << std::endl;
318 for(
const auto&
pu : *pileup)
320 int bx =
pu.getBunchCrossing();
337 <<
" failed to find a standard AOD or miniAOD genParticle collection " << std::endl;
352 <<
" failed to find a standard AOD or miniAOD particle collection " << std::endl;
373 int nEle = src->size();
375 for(
int iEle = 0; iEle < nEle; ++iEle) {
377 const auto ele = src->ptrAt(iEle);
379 eleQ_ = ele->charge();
380 ele3Q_ = ele->chargeInfo().isGsfCtfScPixConsistent;
386 for (
int iVar = 0; iVar <
nVars_; ++iVar) {
425 int &ancestorPID,
int &ancestorStatus){
427 if( particle ==
nullptr ){
428 edm::LogError (
"ElectronNtuplizer") <<
"ElectronNtuplizer: ERROR! null candidate pointer, this should never happen";
437 ancestorPID = particle->
pdgId();
438 ancestorStatus = particle->
status();
444 template<
class T,
class V>
454 for(
size_t i=0;
i<prunedGenParticles->size();
i++){
463 closestElectron = particle;
469 if( !(closestElectron !=
nullptr && dR <
deltaR_) ) {
474 int ancestorPID = -999;
475 int ancestorStatus = -999;
478 if( ancestorPID == -999 && ancestorStatus == -999 ){
481 edm::LogError (
"ElectronNtuplizer") <<
"ElectronNtuplizer: ERROR! null candidate pointer, this should never happen";
485 if(
abs(ancestorPID) > 50 && ancestorStatus == 2 )
488 if(
abs(ancestorPID) == 15 && ancestorStatus == 2 )
521 desc.
add<
bool>(
"isMC");
522 desc.
add<
double>(
"deltaR", 0.1);
523 desc.
add<
double>(
"ptThreshold", 5.0);
525 desc.
addUntracked<std::vector<std::string>>(
"eleMVALabels");
526 desc.
addUntracked<std::vector<std::string>>(
"eleMVAValMaps");
527 desc.
addUntracked<std::vector<std::string>>(
"eleMVAValMapLabels");
528 desc.
addUntracked<std::vector<std::string>>(
"eleMVACats");
529 desc.
addUntracked<std::vector<std::string>>(
"eleMVACatLabels");
static const std::string kSharedResource
const std::string getName(int index) const
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
EventNumber_t event() const
const double ptThreshold_
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
const edm::EDGetToken srcMiniAOD_
const edm::EDGetToken verticesMiniAOD_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
std::vector< edm::InputTag > getHelperInputTags() const
edm::LuminosityBlockNumber_t luminosityBlock() const
virtual const Candidate * mother(size_type i=0) const =0
return pointer to mother
T * make(const Args &...args) const
make new ROOT object
std::vector< edm::EDGetTokenT< edm::ValueMap< int > > > mvaCatTokens_
std::vector< float > mvaValues_
const edm::EDGetToken vertices_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
virtual int status() const =0
status word
void addDefault(ParameterSetDescription const &psetDescription)
~ElectronMVANtuplizer() override
virtual const LorentzVector & p4() const =0
four-momentum Lorentz vector
virtual int pdgId() const =0
PDG identifier.
std::vector< int > mvaPasses_
const std::vector< std::string > valMapBranchNames_
Abs< T >::type abs(const T &t)
std::vector< int > mvaCats_
ElectronMVANtuplizer(const edm::ParameterSet &)
int matchToTruth(const T &el, const V &genParticles, int &genIdx)
const int getNVars() const
ParameterDescriptionBase * add(U const &iLabel, T const &value)
const edm::EDGetToken genParticlesMiniAOD_
const std::vector< std::string > eleMapBranchNames_
std::vector< float > vars_
MVAVariableManager< reco::GsfElectron > mvaVarMngr_
float getValue(int index, const edm::Ptr< ParticleType > &ptclPtr, const edm::EventBase &iEvent) const
std::vector< edm::EDGetTokenT< edm::ValueMap< float > > > valMapTokens_
void analyze(const edm::Event &, const edm::EventSetup &) override
const edm::EDGetToken pileupMiniAOD_
void findFirstNonElectronMother2(const reco::Candidate *particle, int &ancestorPID, int &ancestorStatus)
const std::vector< std::string > mvaCatTags_
std::vector< edm::EDGetTokenT< edm::ValueMap< bool > > > eleMapTokens_
const edm::EDGetToken pileup_
const edm::EDGetToken src_
const edm::EDGetToken genParticles_
const std::vector< std::string > mvaCatBranchNames_
std::vector< edm::InputTag > getGlobalInputTags() const
const std::vector< std::string > eleMapTags_
const std::vector< std::string > valMapTags_