Skip to content

Commit

Permalink
Merge pull request #11 from gpetruc/micro-from700
Browse files Browse the repository at this point in the history
nonZS cluster shapes as userFloats: 70X version
  • Loading branch information
arizzi committed Apr 16, 2014
2 parents 5ea3775 + 19a2f66 commit 3684f74
Show file tree
Hide file tree
Showing 10 changed files with 2,677 additions and 2,487 deletions.
27 changes: 24 additions & 3 deletions PhysicsTools/PatAlgos/plugins/PATElectronSlimmer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
#include "DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h"
#include "DataFormats/PatCandidates/interface/PackedCandidate.h"
#include "CommonTools/UtilAlgos/interface/StringCutObjectSelector.h"

#include "RecoEcal/EgammaCoreTools/interface/EcalClusterLazyTools.h"
#include "FWCore/Utilities/interface/isFinite.h"

namespace pat {

Expand All @@ -48,6 +49,7 @@ namespace pat {
edm::EDGetTokenT<edm::Association<pat::PackedCandidateCollection>> pf2pc_;
edm::EDGetTokenT<pat::PackedCandidateCollection> pc_;
bool linkToPackedPF_;
StringCutObjectSelector<pat::Electron> saveNonZSClusterShapes_;
};

} // namespace
Expand All @@ -65,14 +67,17 @@ pat::PATElectronSlimmer::PATElectronSlimmer(const edm::ParameterSet & iConfig) :
dropShapes_(iConfig.getParameter<std::string>("dropShapes")),
dropExtrapolations_(iConfig.getParameter<std::string>("dropExtrapolations")),
dropClassifications_(iConfig.getParameter<std::string>("dropClassifications")),
linkToPackedPF_(iConfig.getParameter<bool>("linkToPackedPFCandidates"))
linkToPackedPF_(iConfig.getParameter<bool>("linkToPackedPFCandidates")),
saveNonZSClusterShapes_(iConfig.getParameter<std::string>("saveNonZSClusterShapes"))
{
produces<std::vector<pat::Electron> >();
if (linkToPackedPF_) {
reco2pf_ = consumes<edm::ValueMap<std::vector<reco::PFCandidateRef>>>(iConfig.getParameter<edm::InputTag>("recoToPFMap"));
pf2pc_ = consumes<edm::Association<pat::PackedCandidateCollection>>(iConfig.getParameter<edm::InputTag>("packedPFCandidates"));
pc_ = consumes<pat::PackedCandidateCollection>(iConfig.getParameter<edm::InputTag>("packedPFCandidates"));
}
mayConsume<EcalRecHitCollection>(edm::InputTag("reducedEcalRecHitsEB"));
mayConsume<EcalRecHitCollection>(edm::InputTag("reducedEcalRecHitsEE"));
}

void
Expand All @@ -91,6 +96,9 @@ pat::PATElectronSlimmer::produce(edm::Event & iEvent, const edm::EventSetup & iS
iEvent.getByToken(pf2pc_, pf2pc);
iEvent.getByToken(pc_, pc);
}
edm::InputTag reducedBarrelRecHitCollection("reducedEcalRecHitsEB");
edm::InputTag reducedEndcapRecHitCollection("reducedEcalRecHitsEE");
noZS::EcalClusterLazyTools lazyToolsNoZS(iEvent, iSetup, reducedBarrelRecHitCollection, reducedEndcapRecHitCollection);

auto_ptr<vector<pat::Electron> > out(new vector<pat::Electron>());
out->reserve(src->size());
Expand Down Expand Up @@ -128,7 +136,20 @@ pat::PATElectronSlimmer::produce(edm::Event & iEvent, const edm::EventSetup & iS
} else {
electron.refToOrig_ = reco::CandidatePtr(pc.id());
}
}
}
if (saveNonZSClusterShapes_(electron)) {
std::vector<float> vCov = lazyToolsNoZS.localCovariances(*( electron.superCluster()->seed()));
float r9 = lazyToolsNoZS.e3x3( *( electron.superCluster()->seed())) / electron.superCluster()->rawEnergy() ;
float sigmaIetaIeta = ( !edm::isNotFinite(vCov[0]) ) ? sqrt(vCov[0]) : 0;
float sigmaIetaIphi = vCov[1];
float sigmaIphiIphi = ( !edm::isNotFinite(vCov[2]) ) ? sqrt(vCov[2]) : 0;
float e15o55 = lazyToolsNoZS.e1x5( *( electron.superCluster()->seed()) ) / lazyToolsNoZS.e5x5( *( electron.superCluster()->seed()) );
electron.addUserFloat("sigmaIetaIeta_NoZS", sigmaIetaIeta);
electron.addUserFloat("sigmaIetaIphi_NoZS", sigmaIetaIphi);
electron.addUserFloat("sigmaIphiIphi_NoZS", sigmaIphiIphi);
electron.addUserFloat("r9_NoZS", r9);
electron.addUserFloat("e1x5_over_e5x5_NoZS", e15o55);
}

}

Expand Down
24 changes: 23 additions & 1 deletion PhysicsTools/PatAlgos/plugins/PATPhotonSlimmer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
#include "DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h"
#include "DataFormats/PatCandidates/interface/PackedCandidate.h"
#include "CommonTools/UtilAlgos/interface/StringCutObjectSelector.h"
#include "RecoEcal/EgammaCoreTools/interface/EcalClusterLazyTools.h"
#include "FWCore/Utilities/interface/isFinite.h"

namespace pat {

Expand All @@ -39,6 +41,7 @@ namespace pat {
edm::EDGetTokenT<edm::Association<pat::PackedCandidateCollection>> pf2pc_;
edm::EDGetTokenT<pat::PackedCandidateCollection> pc_;
bool linkToPackedPF_;
StringCutObjectSelector<pat::Photon> saveNonZSClusterShapes_;
};

} // namespace
Expand All @@ -50,14 +53,17 @@ pat::PATPhotonSlimmer::PATPhotonSlimmer(const edm::ParameterSet & iConfig) :
dropPreshowerClusters_(iConfig.getParameter<std::string>("dropPreshowerClusters")),
dropSeedCluster_(iConfig.getParameter<std::string>("dropSeedCluster")),
dropRecHits_(iConfig.getParameter<std::string>("dropRecHits")),
linkToPackedPF_(iConfig.getParameter<bool>("linkToPackedPFCandidates"))
linkToPackedPF_(iConfig.getParameter<bool>("linkToPackedPFCandidates")),
saveNonZSClusterShapes_(iConfig.getParameter<std::string>("saveNonZSClusterShapes"))
{
produces<std::vector<pat::Photon> >();
if (linkToPackedPF_) {
reco2pf_ = consumes<edm::ValueMap<std::vector<reco::PFCandidateRef>>>(iConfig.getParameter<edm::InputTag>("recoToPFMap"));
pf2pc_ = consumes<edm::Association<pat::PackedCandidateCollection>>(iConfig.getParameter<edm::InputTag>("packedPFCandidates"));
pc_ = consumes<pat::PackedCandidateCollection>(iConfig.getParameter<edm::InputTag>("packedPFCandidates"));
}
mayConsume<EcalRecHitCollection>(edm::InputTag("reducedEcalRecHitsEB"));
mayConsume<EcalRecHitCollection>(edm::InputTag("reducedEcalRecHitsEE"));
}

void
Expand All @@ -76,6 +82,9 @@ pat::PATPhotonSlimmer::produce(edm::Event & iEvent, const edm::EventSetup & iSet
iEvent.getByToken(pf2pc_, pf2pc);
iEvent.getByToken(pc_, pc);
}
edm::InputTag reducedBarrelRecHitCollection("reducedEcalRecHitsEB");
edm::InputTag reducedEndcapRecHitCollection("reducedEcalRecHitsEE");
noZS::EcalClusterLazyTools lazyToolsNoZS(iEvent, iSetup, reducedBarrelRecHitCollection, reducedEndcapRecHitCollection);

auto_ptr<vector<pat::Photon> > out(new vector<pat::Photon>());
out->reserve(src->size());
Expand Down Expand Up @@ -108,6 +117,19 @@ pat::PATPhotonSlimmer::produce(edm::Event & iEvent, const edm::EventSetup & iSet
photon.refToOrig_ = reco::CandidatePtr(pc.id());
}
}
if (saveNonZSClusterShapes_(photon)) {
std::vector<float> vCov = lazyToolsNoZS.localCovariances(*( photon.superCluster()->seed()));
float r9 = lazyToolsNoZS.e3x3( *( photon.superCluster()->seed())) / photon.superCluster()->rawEnergy() ;
float sigmaIetaIeta = ( !edm::isNotFinite(vCov[0]) ) ? sqrt(vCov[0]) : 0;
float sigmaIetaIphi = vCov[1];
float sigmaIphiIphi = ( !edm::isNotFinite(vCov[2]) ) ? sqrt(vCov[2]) : 0;
float e15o55 = lazyToolsNoZS.e1x5( *( photon.superCluster()->seed()) ) / lazyToolsNoZS.e5x5( *( photon.superCluster()->seed()) );
photon.addUserFloat("sigmaIetaIeta_NoZS", sigmaIetaIeta);
photon.addUserFloat("sigmaIetaIphi_NoZS", sigmaIetaIphi);
photon.addUserFloat("sigmaIphiIphi_NoZS", sigmaIphiIphi);
photon.addUserFloat("r9_NoZS", r9);
photon.addUserFloat("e1x5_over_e5x5_NoZS", e15o55);
}
}

iEvent.put(out);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@
linkToPackedPFCandidates = cms.bool(True),
recoToPFMap = cms.InputTag("particleBasedIsolation","gedGsfElectrons"),
packedPFCandidates = cms.InputTag("packedPFCandidates"),
saveNonZSClusterShapes = cms.string("pt > 5"), # save additional user floats: (sigmaIetaIeta,sigmaIphiIphi,sigmaIetaIphi,r9,e1x5_over_e5x5)_NoZS
)

Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@
linkToPackedPFCandidates = cms.bool(True),
recoToPFMap = cms.InputTag("particleBasedIsolation","gedPhotons"),
packedPFCandidates = cms.InputTag("packedPFCandidates"),
saveNonZSClusterShapes = cms.string("(r9()>0.8 || chargedHadronIso()<20 || chargedHadronIso()<0.3*pt())"), # save additional user floats: (sigmaIetaIeta,sigmaIphiIphi,sigmaIetaIphi,r9,e1x5_over_e5x5)_NoZS
)
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "Geometry/CaloTopology/interface/CaloTopology.h"

#include "DataFormats/ParticleFlowReco/interface/PFCluster.h"
#include "RecoEcal/EgammaCoreTools/interface/EcalClusterTools.h"

/**\class PFECALSuperClusterProducer
Expand All @@ -38,8 +39,6 @@ class CaloSubdetectorGeometry;
class DetId;
class GBRForest;
class GBRWrapperRcd;
class EcalClusterTools;


class PFECALSuperClusterProducer : public edm::EDProducer {
public:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

#include "DataFormats/VertexReco/interface/Vertex.h"
#include "DataFormats/EcalRecHit/interface/EcalRecHit.h"
#include "RecoEcal/EgammaCoreTools/interface/EcalClusterTools.h"

#include "DataFormats/Common/interface/ValueMap.h"

Expand Down
Loading

0 comments on commit 3684f74

Please sign in to comment.