1 #ifndef CommonTools_ParticleFlow_IsolatedPFCandidateSelectorDefinition
2 #define CommonTools_ParticleFlow_IsolatedPFCandidateSelectorDefinition
22 doDeltaBetaCorrection_(
cfg.getParameter<
bool>(
"doDeltaBetaCorrection")),
23 deltaBetaIsolationValueMapToken_(iC.mayConsume<IsoMap>(
cfg.getParameter<
edm::InputTag >(
"deltaBetaIsolationValueMap") ) ),
24 deltaBetaFactor_(
cfg.getParameter<
double>(
"deltaBetaFactor")),
25 isRelative_(
cfg.getParameter<
bool>(
"isRelative")),
37 std::vector< edm::Handle<IsoMap> >
38 isoMapsCharged(isolationValueMapChargedTokens_.size());
39 for(
unsigned iMap = 0; iMap<isolationValueMapChargedTokens_.size(); ++iMap) {
40 e.
getByToken(isolationValueMapChargedTokens_[iMap], isoMapsCharged[iMap]);
45 std::vector< edm::Handle<IsoMap> >
46 isoMapsNeutral(isolationValueMapNeutralTokens_.size());
47 for(
unsigned iMap = 0; iMap<isolationValueMapNeutralTokens_.size(); ++iMap) {
48 e.
getByToken(isolationValueMapNeutralTokens_[iMap], isoMapsNeutral[iMap]);
52 if(doDeltaBetaCorrection_) {
53 e.
getByToken(deltaBetaIsolationValueMapToken_, dBetaH);
57 for( collection::const_iterator pfc = hc->begin();
58 pfc != hc->end(); ++pfc, ++
key) {
62 double isoSumCharged=0.0;
63 double isoSumNeutral=0.0;
65 for(
unsigned iMap = 0; iMap<isoMapsCharged.size(); ++iMap) {
66 const IsoMap & isoMap = *(isoMapsCharged[iMap]);
67 double val = isoMap[candidate];
71 for(
unsigned iMap = 0; iMap<isoMapsNeutral.size(); ++iMap) {
72 const IsoMap & isoMap = *(isoMapsNeutral[iMap]);
73 double val = isoMap[candidate];
78 if ( doDeltaBetaCorrection_ ) {
79 const IsoMap& isoMap = *dBetaH;
80 double dBetaVal = isoMap[candidate];
81 double dBetaCorIsoSumNeutral = isoSumNeutral + deltaBetaFactor_*dBetaVal;
82 isoSumNeutral = dBetaCorIsoSumNeutral>0 ? dBetaCorIsoSumNeutral : 0;
85 double isoSum=isoSumCharged+isoSumNeutral;
88 isoSum /= candidate->pt();
91 if ( isoSum>isolationCut_ ) {
99 selected_.back().setSourceCandidatePtr( ptrToMother );
IsolatedPFCandidateSelectorDefinition(const edm::ParameterSet &cfg, edm::ConsumesCollector &&iC)
edm::ValueMap< double > IsoMap
bool getByToken(EDGetToken token, Handle< PROD > &result) const
isolationCut_(cfg.getParameter< double >("isolationCut"))
tuple isoSum
===> require is not the leading lepton and opposite to the leading lepton
auto vector_transform(std::vector< InputType > const &input, Function predicate) -> std::vector< typename std::remove_cv< typename std::remove_reference< decltype(predicate(input.front()))>::type >::type >
edm::EDGetTokenT< IsoMap > deltaBetaIsolationValueMapToken_
std::vector< edm::EDGetTokenT< IsoMap > > isolationValueMapChargedTokens_
void select(const HandleToCollection &hc, const edm::Event &e, const edm::EventSetup &s)
std::vector< edm::EDGetTokenT< IsoMap > > isolationValueMapNeutralTokens_
bool doDeltaBetaCorrection_
Particle reconstructed by the particle flow algorithm.