|
|
Go to the documentation of this file.
34 ecalClusterToolsESGetTokens_{consumesCollector()},
35 isolator_(iConfig.exists(
"userIsolation") ? iConfig.getParameter<
edm::ParameterSet>(
"userIsolation")
39 useUserData_(iConfig.exists(
"userData")) {
41 photonToken_ = consumes<edm::View<reco::Photon>>(iConfig.getParameter<
edm::InputTag>(
"photonSource"));
42 electronToken_ = consumes<reco::GsfElectronCollection>(iConfig.getParameter<
edm::InputTag>(
"electronSource"));
43 hConversionsToken_ = consumes<reco::ConversionCollection>(iConfig.getParameter<
edm::InputTag>(
"conversionSource"));
44 beamLineToken_ = consumes<reco::BeamSpot>(iConfig.getParameter<
edm::InputTag>(
"beamLineSrc"));
45 embedSuperCluster_ = iConfig.getParameter<
bool>(
"embedSuperCluster");
46 embedSeedCluster_ = iConfig.getParameter<
bool>(
"embedSeedCluster");
47 embedBasicClusters_ = iConfig.getParameter<
bool>(
"embedBasicClusters");
48 embedPreshowerClusters_ = iConfig.getParameter<
bool>(
"embedPreshowerClusters");
49 embedRecHits_ = iConfig.getParameter<
bool>(
"embedRecHits");
50 reducedBarrelRecHitCollection_ = iConfig.getParameter<
edm::InputTag>(
"reducedBarrelRecHitCollection");
51 reducedBarrelRecHitCollectionToken_ = mayConsume<EcalRecHitCollection>(reducedBarrelRecHitCollection_);
52 reducedEndcapRecHitCollection_ = iConfig.getParameter<
edm::InputTag>(
"reducedEndcapRecHitCollection");
53 reducedEndcapRecHitCollectionToken_ = mayConsume<EcalRecHitCollection>(reducedEndcapRecHitCollection_);
55 addGenMatch_ = iConfig.getParameter<
bool>(
"addGenMatch");
57 embedGenMatch_ = iConfig.getParameter<
bool>(
"embedGenMatch");
63 iConfig.getParameter<std::vector<edm::InputTag>>(
"genParticleMatch"),
64 [
this](
edm::InputTag const &
tag) { return consumes<edm::Association<reco::GenParticleCollection>>(tag); });
68 addEfficiencies_ = iConfig.getParameter<
bool>(
"addEfficiencies");
69 if (addEfficiencies_) {
74 addPuppiIsolation_ = iConfig.getParameter<
bool>(
"addPuppiIsolation");
75 if (addPuppiIsolation_) {
76 PUPPIIsolation_charged_hadrons_ =
77 consumes<edm::ValueMap<float>>(iConfig.getParameter<
edm::InputTag>(
"puppiIsolationChargedHadrons"));
78 PUPPIIsolation_neutral_hadrons_ =
79 consumes<edm::ValueMap<float>>(iConfig.getParameter<
edm::InputTag>(
"puppiIsolationNeutralHadrons"));
80 PUPPIIsolation_photons_ =
81 consumes<edm::ValueMap<float>>(iConfig.getParameter<
edm::InputTag>(
"puppiIsolationPhotons"));
83 addPFClusterIso_ = iConfig.getParameter<
bool>(
"addPFClusterIso");
84 if (addPFClusterIso_) {
85 ecalPFClusterIsoT_ = consumes<edm::ValueMap<float>>(iConfig.getParameter<
edm::InputTag>(
"ecalPFClusterIsoMap"));
86 auto hcPFC = iConfig.getParameter<
edm::InputTag>(
"hcalPFClusterIsoMap");
87 if (not hcPFC.label().empty())
92 addPhotonID_ = iConfig.getParameter<
bool>(
"addPhotonID");
96 photIDSrcs_.push_back(NameTag(
"", iConfig.getParameter<
edm::InputTag>(
"photonIDSource")));
101 if (!photIDSrcs_.empty()) {
103 <<
"PATPhotonProducer: you can't specify both 'photonIDSource' and 'photonIDSources'\n";
108 for (std::vector<std::string>::const_iterator it =
names.begin(), ed =
names.end(); it != ed; ++it) {
113 if (photIDSrcs_.empty())
114 throw cms::Exception(
"Configuration") <<
"PATPhotonProducer: id addPhotonID is true, you must specify either:\n"
115 <<
"\tInputTag photonIDSource = <someTag>\n"
117 <<
"\tPSet photonIDSources = { \n"
118 <<
"\t\tInputTag <someName> = <someTag> // as many as you want \n "
122 photIDSrcs_, [
this](NameTag
const &
tag) {
return mayConsume<edm::ValueMap<Bool_t>>(
tag.second); });
124 addResolutions_ = iConfig.getParameter<
bool>(
"addResolutions");
125 if (addResolutions_) {
134 produces<std::vector<Photon>>();
137 readIsolationLabels(iConfig,
"isoDeposits", isoDepositLabels_, isoDepositTokens_);
139 readIsolationLabels(iConfig,
"isolationValues", isolationValueLabels_, isolationValueTokens_);
141 saveRegressionData_ = iConfig.getParameter<
bool>(
"saveRegressionData");
148 if (
iEvent.isRealData()) {
183 std::vector<edm::Handle<edm::Association<reco::GenParticleCollection>>> genMatches(
genMatchTokens_.size());
209 std::vector<edm::Handle<edm::ValueMap<Bool_t>>> idhandles;
210 std::vector<pat::Photon::IdPair> ids;
231 std::vector<Photon> *PATPhotons =
new std::vector<Photon>();
234 unsigned int idx = itPhoton -
photons->begin();
237 Photon aPhoton(photonRef);
248 std::vector<DetId> selectedCells;
249 bool barrel = itPhoton->isEB();
253 clusIt != itPhoton->superCluster()->clustersEnd();
256 DetId seed = lazyTools.getMaximum(**clusIt).first;
258 std::vector<DetId> dets5x5 =
261 selectedCells.insert(selectedCells.end(), dets5x5.begin(), dets5x5.end());
264 for (
const std::pair<DetId, float> &
hit : (*clusIt)->hitsAndFractions()) {
265 selectedCells.push_back(
hit.first);
271 std::sort(selectedCells.begin(), selectedCells.end());
272 std::unique(selectedCells.begin(), selectedCells.end());
285 recHits = recHitsEBHandle.product();
291 unsigned nSelectedCells = selectedCells.
size();
292 for (
unsigned icell = 0; icell < nSelectedCells; ++icell) {
298 selectedRecHits.
sort();
304 for (
size_t i = 0,
n = genMatches.size();
i <
n; ++
i) {
333 for (
size_t j = 0, nd =
deposits.size();
j < nd; ++
j) {
344 ids[
i].second = (*idhandles[
i])[photonRef];
354 bool passelectronveto =
false;
372 recHitsEBHandle.product(),
444 (*PUPPIIsolation_neutral_hadrons)[phoPtr],
445 (*PUPPIIsolation_photons)[phoPtr]);
466 PATPhotons->push_back(aPhoton);
470 std::sort(PATPhotons->begin(), PATPhotons->end(),
eTComparator_);
473 std::unique_ptr<std::vector<Photon>> myPhotons(PATPhotons);
482 iDesc.
setComment(
"PAT photon producer module");
495 "ecalPFClusterIsoMap",
edm::InputTag(
"photonEcalPFClusterIsolationProducer"),
true) and
497 "hcalPFClusterIsoMap",
edm::InputTag(
"photonHcalPFClusterIsolationProducer"),
true))
or
504 "puppiIsolationChargedHadrons",
edm::InputTag(
"egmPhotonPUPPIIsolation",
"h+-DR030-"),
true) and
506 "puppiIsolationNeutralHadrons",
edm::InputTag(
"egmPhotonPUPPIIsolation",
"h0-DR030-"),
true) and
508 "puppiIsolationPhotons",
edm::InputTag(
"egmPhotonPUPPIIsolation",
"gamma-DR030-"),
true))
or
511 iDesc.
add<
bool>(
"embedSuperCluster",
true)->setComment(
"embed external super cluster");
512 iDesc.
add<
bool>(
"embedSeedCluster",
true)->setComment(
"embed external seed cluster");
513 iDesc.
add<
bool>(
"embedBasicClusters",
true)->setComment(
"embed external basic clusters");
514 iDesc.
add<
bool>(
"embedPreshowerClusters",
true)->setComment(
"embed external preshower clusters");
515 iDesc.
add<
bool>(
"embedRecHits",
true)->setComment(
"embed external RecHits");
518 iDesc.
add<
bool>(
"addGenMatch",
true)->setComment(
"add MC matching");
519 iDesc.
add<
bool>(
"embedGenMatch",
false)->setComment(
"embed MC matched MC information");
520 std::vector<edm::InputTag> emptySourceVector;
524 ->
setComment(
"input with MC match information");
529 iDesc.
add<
bool>(
"addPhotonID",
true)->setComment(
"add photon ID variables");
535 ->
setComment(
"input with photon ID variables");
548 isoDepositsPSet.
addOptional<std::vector<edm::InputTag>>(
"user");
562 isolationValuesPSet.
addOptional<std::vector<edm::InputTag>>(
"user");
563 iDesc.
addOptional(
"isolationValues", isolationValuesPSet);
568 iDesc.
add(
"efficiencies", efficienciesPSet);
569 iDesc.
add<
bool>(
"addEfficiencies",
false);
578 iDesc.
add(
"userIsolation", isolationPSet);
581 ->
setComment(
"input with high level selection");
583 iDesc.
add<
bool>(
"saveRegressionData",
true)->setComment(
"save regression input variables");
585 descriptions.
add(
"PATPhotonProducer", iDesc);
void setSubClusDPhi3(float s)
float seedCrysIPhiOrIY() const
edm::EDGetTokenT< reco::GsfElectronCollection > electronToken_
pat::helper::MultiIsolator isolator_
void setMaxDRRawEnergy(float m)
Assists in assimilating all pat::UserData into pat objects.
ParameterDescriptionBase * add(U const &iLabel, T const &value)
std::vector< EcalRecHit >::const_iterator const_iterator
reco::SuperClusterRef superCluster() const override
Ref to SuperCluster.
float sigmaIEtaIEta() const
T const * product() const
void setMaxDRDPhi(float m)
void setSubClusDPhi2(float s)
edm::EDGetTokenT< EcalRecHitCollection > reducedEndcapRecHitCollectionToken_
float seedCrysPhiOrY() const
float maxSubClusDRRawEnergy() const
void setIsoDeposit(IsolationKeys key, const IsoDeposit &dep)
Sets the IsoDeposit associated with some key; if it is already existent, it is overwritten.
void fill(const edm::View< T > &coll, int idx, IsolationValuePairs &isolations) const
static void fillDescription(edm::ParameterSetDescription &iDesc)
void embedSuperCluster()
method to store the photon's supercluster internally
void setSubClusRawE1(float s)
edm::EDGetTokenT< edm::View< reco::Photon > > photonToken_
void setHasPixelSeed(bool flag)
bool enabled() const
'true' if this there is at least one efficiency configured
constexpr bool isUninitialized() const noexcept
void addGenParticleRef(const reco::GenParticleRef &ref)
bool embedPreshowerClusters_
float maxSubClusDRDPhi() const
edm::EDGetTokenT< edm::ValueMap< float > > ecalPFClusterIsoT_
void setSubClusDEta3(float s)
float maxSubClusDRDEta() const
ParameterDescriptionBase * addOptional(U const &iLabel, T const &value)
void push_back(T const &t)
std::vector< std::pair< pat::IsolationKeys, float > > IsolationValuePairs
const std::vector< float > & subClusDEta() const
IsolationLabels isolationValueLabels_
bool enabled() const
'true' if this there is at least one efficiency configured
float seedCrysIEtaOrIX() const
std::vector< edm::Handle< edm::ValueMap< IsoDeposit > > > IsoDepositMaps
pat::PATUserDataHelper< pat::Photon > userDataHelper_
bool enabled() const
True if it has a non null configuration.
pat::helper::EfficiencyLoader efficiencyLoader_
void fill(const reco::SuperCluster &superClus, const EcalRecHitCollection *ebRecHits, const EcalRecHitCollection *eeRecHits, const CaloGeometry *geom, const CaloTopology *topology, const reco::VertexCollection *vertices)
#define DEFINE_FWK_MODULE(type)
void setSubClusRawE2(float s)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
const std::string names[nVars_]
void setPflowIsolationVariables(const PflowIsolationVariables &pfisol)
Set Particle Flow Isolation variables.
void add(ObjectType &patObject, edm::Event const &iEvent, edm::EventSetup const &iSetup)
pat::helper::KinResolutionsLoader resolutionLoader_
void newEvent(const edm::Event &event)
To be called for each new event, reads in the ValueMaps for efficiencies.
IsolationLabels isoDepositLabels_
~PATPhotonProducer() override
std::vector< edm::EDGetTokenT< edm::ValueMap< IsoDeposit > > > isoDepositTokens_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const Point & position() const
position
void setIsolation(IsolationKeys key, float value)
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 >
pat::helper::MultiIsolator::IsolationValuePairs isolatorTmpStorage_
bool hasPixelSeed() const
Bool flagging photons having a non-zero size vector of Ref to electornPixel seeds.
void setResolutions(pat::PATObject< T > &obj) const
Sets the efficiencies for this object, using the reference to the original objects.
void embedSeedCluster()
method to store the electron's seedcluster internally
void setComment(std::string const &value)
float maxSubClusDR() const
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
const PflowIsolationVariables & getPflowIsolationVariables() const
Get Particle Flow Isolation variables block.
static void fillDescription(edm::ParameterSetDescription &iDesc)
Method for documentation and validation of PSet.
edm::EDGetTokenT< reco::BeamSpot > beamLineToken_
const CaloSubdetectorTopology * getSubdetectorTopology(const DetId &id) const
access the subdetector Topology for the given subdetector directly
ParameterDescriptionNode * ifValue(ParameterDescription< T > const &switchParameter, std::unique_ptr< ParameterDescriptionCases< T >> cases)
void setSubClusDEta2(float s)
std::vector< std::string > getParameterNamesForType(bool trackiness=true) const
std::vector< edm::EDGetTokenT< edm::ValueMap< double > > > isolationValueTokens_
PATPhotonProducer(const edm::ParameterSet &iConfig)
void setPassElectronVeto(bool flag)
const CaloTopology * ecalTopology_
std::vector< edm::Handle< edm::ValueMap< double > > > IsolationValueMaps
GreaterByEt< Photon > eTComparator_
ParameterDescriptionNode * addNode(ParameterDescriptionNode const &node)
void setAllowAnything()
allow any parameter label/value pairs
const std::vector< float > & subClusDPhi() const
void setSubClusDEta1(float s)
void newEvent(const edm::Event &event, const edm::EventSetup &setup)
To be called for each new event, reads in the EventSetup object.
void setSeedEnergy(float e)
Produces the pat::Photon.
void embedPreshowerClusters()
method to store the electron's preshower clusters
float seedCrysEtaOrX() const
std::vector< edm::EDGetTokenT< edm::ValueMap< Bool_t > > > photIDTokens_
virtual std::vector< DetId > getWindow(const DetId &id, const int &northSouthSize, const int &eastWestSize) const
std::vector< NameTag > photIDSrcs_
std::vector< edm::EDGetTokenT< edm::Association< reco::GenParticleCollection > > > genMatchTokens_
const std::vector< float > & subClusRawEnergy() const
void beginEvent(const edm::Event &event, const edm::EventSetup &eventSetup)
def unique(seq, keepstr=True)
void setMaxDRDEta(float m)
const CaloGeometry * ecalGeometry_
void embedBasicClusters()
method to store the electron's basic clusters
edm::EDGetTokenT< edm::ValueMap< float > > hcalPFClusterIsoT_
void setEfficiencies(pat::PATObject< T > &obj, const R &originalRef) const
Sets the efficiencies for this object, using the reference to the original objects.
float sigmaIEtaIPhi() const
edm::EDGetTokenT< reco::ConversionCollection > hConversionsToken_
edm::EDGetTokenT< edm::ValueMap< float > > PUPPIIsolation_photons_
void setPhotonIDs(const std::vector< IdPair > &ids)
edm::EDGetTokenT< EcalRecHitCollection > reducedBarrelRecHitCollectionToken_
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
T getParameter(std::string const &) const
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
edm::EDGetTokenT< edm::ValueMap< float > > PUPPIIsolation_neutral_hadrons_
void setSubClusDPhi1(float s)
edm::EDGetTokenT< edm::ValueMap< float > > PUPPIIsolation_charged_hadrons_
void setComment(std::string const &value)
void embedRecHits(const EcalRecHitCollection *rechits)
method to store the RecHits internally - can be called from the PATElectronProducer
const EcalClusterLazyTools::ESGetTokens ecalClusterToolsESGetTokens_
void setSubClusRawE3(float s)
void setIsolationPUPPI(float chargedhadrons_, float neutralhadrons_, float photons_)
Sets PUPPI isolation.
float sigmaIPhiIPhi() const