33 : isolator_(iConfig.exists(
"userIsolation") ? iConfig.getParameter<
edm::
ParameterSet>(
"userIsolation")
37 useUserData_(iConfig.exists(
"userData")) {
61 iConfig.
getParameter<std::vector<edm::InputTag>>(
"genParticleMatch"),
62 [
this](
edm::InputTag const &
tag) { return consumes<edm::Association<reco::GenParticleCollection>>(tag); });
85 if (not hcPFC.label().empty())
101 <<
"PATPhotonProducer: you can't specify both 'photonIDSource' and 'photonIDSources'\n";
106 for (std::vector<std::string>::const_iterator it = names.begin(), ed = names.end(); it != ed; ++it) {
112 throw cms::Exception(
"Configuration") <<
"PATPhotonProducer: id addPhotonID is true, you must specify either:\n" 113 <<
"\tInputTag photonIDSource = <someTag>\n" 115 <<
"\tPSet photonIDSources = { \n" 116 <<
"\t\tInputTag <someName> = <someTag> // as many as you want \n " 123 if (addResolutions_) {
132 produces<std::vector<Photon>>();
179 std::vector<edm::Handle<edm::Association<reco::GenParticleCollection>>> genMatches(
genMatchTokens_.size());
205 std::vector<edm::Handle<edm::ValueMap<Bool_t>>> idhandles;
206 std::vector<pat::Photon::IdPair>
ids;
227 std::vector<Photon> *PATPhotons =
new std::vector<Photon>();
230 unsigned int idx = itPhoton - photons->begin();
233 Photon aPhoton(photonRef);
234 auto phoPtr = photons->ptrAt(idx);
244 std::vector<DetId> selectedCells;
245 bool barrel = itPhoton->isEB();
249 clusIt != itPhoton->superCluster()->clustersEnd();
252 DetId seed = lazyTools.getMaximum(**clusIt).first;
254 std::vector<DetId> dets5x5 =
257 selectedCells.insert(selectedCells.end(), dets5x5.begin(), dets5x5.end());
260 for (
const std::pair<DetId, float> &
hit : (*clusIt)->hitsAndFractions()) {
261 selectedCells.push_back(
hit.first);
267 std::sort(selectedCells.begin(), selectedCells.end());
268 std::unique(selectedCells.begin(), selectedCells.end());
281 recHits = recHitsEBHandle.product();
283 recHits = recHitsEEHandle.
product();
287 unsigned nSelectedCells = selectedCells.
size();
288 for (
unsigned icell = 0; icell < nSelectedCells; ++icell) {
290 if (it != recHits->
end()) {
294 selectedRecHits.
sort();
300 for (
size_t i = 0,
n = genMatches.size();
i <
n; ++
i) {
329 for (
size_t j = 0, nd =
deposits.size();
j < nd; ++
j) {
340 ids[
i].second = (*idhandles[
i])[photonRef];
350 bool passelectronveto =
false;
368 recHitsEBHandle.product(),
440 (*PUPPIIsolation_neutral_hadrons)[phoPtr],
441 (*PUPPIIsolation_photons)[phoPtr]);
462 PATPhotons->push_back(aPhoton);
466 std::sort(PATPhotons->begin(), PATPhotons->end(),
eTComparator_);
469 std::unique_ptr<std::vector<Photon>> myPhotons(PATPhotons);
478 iDesc.
setComment(
"PAT photon producer module");
491 "ecalPFClusterIsoMap",
edm::InputTag(
"photonEcalPFClusterIsolationProducer"),
true) and
493 "hcalPFClusterIsoMap",
edm::InputTag(
"photonHcalPFClusterIsolationProducer"),
true))
or 500 "puppiIsolationChargedHadrons",
edm::InputTag(
"egmPhotonPUPPIIsolation",
"h+-DR030-"),
true) and
502 "puppiIsolationNeutralHadrons",
edm::InputTag(
"egmPhotonPUPPIIsolation",
"h0-DR030-"),
true) and
504 "puppiIsolationPhotons",
edm::InputTag(
"egmPhotonPUPPIIsolation",
"gamma-DR030-"),
true))
or 507 iDesc.
add<
bool>(
"embedSuperCluster",
true)->setComment(
"embed external super cluster");
508 iDesc.
add<
bool>(
"embedSeedCluster",
true)->setComment(
"embed external seed cluster");
509 iDesc.
add<
bool>(
"embedBasicClusters",
true)->setComment(
"embed external basic clusters");
510 iDesc.
add<
bool>(
"embedPreshowerClusters",
true)->setComment(
"embed external preshower clusters");
511 iDesc.
add<
bool>(
"embedRecHits",
true)->setComment(
"embed external RecHits");
514 iDesc.
add<
bool>(
"addGenMatch",
true)->setComment(
"add MC matching");
515 iDesc.
add<
bool>(
"embedGenMatch",
false)->setComment(
"embed MC matched MC information");
516 std::vector<edm::InputTag> emptySourceVector;
520 ->
setComment(
"input with MC match information");
525 iDesc.
add<
bool>(
"addPhotonID",
true)->setComment(
"add photon ID variables");
531 ->
setComment(
"input with photon ID variables");
544 isoDepositsPSet.
addOptional<std::vector<edm::InputTag>>(
"user");
558 isolationValuesPSet.
addOptional<std::vector<edm::InputTag>>(
"user");
559 iDesc.
addOptional(
"isolationValues", isolationValuesPSet);
564 iDesc.
add(
"efficiencies", efficienciesPSet);
565 iDesc.
add<
bool>(
"addEfficiencies",
false);
574 iDesc.
add(
"userIsolation", isolationPSet);
577 ->
setComment(
"input with high level selection");
579 iDesc.
add<
bool>(
"saveRegressionData",
true)->setComment(
"save regression input variables");
581 descriptions.
add(
"PATPhotonProducer", iDesc);
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
bool enabled() const
'true' if this there is at least one efficiency configured
float sigmaIPhiIPhi() const
bool embedPreshowerClusters_
void setPflowIsolationVariables(const PflowIsolationVariables &pfisol)
Set Particle Flow Isolation variables.
T getParameter(std::string const &) const
void setComment(std::string const &value)
Assists in assimilating all pat::UserData into pat objects.
ParameterDescriptionNode * ifValue(ParameterDescription< T > const &switchParameter, std::unique_ptr< ParameterDescriptionCases< T >> cases)
void newEvent(const edm::Event &event)
To be called for each new event, reads in the ValueMaps for efficiencies.
const std::vector< float > & subClusRawEnergy() const
pat::PATUserDataHelper< pat::Photon > userDataHelper_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
float maxSubClusDRRawEnergy() const
ParameterDescriptionBase * addOptional(U const &iLabel, T const &value)
float maxSubClusDRDEta() const
edm::EDGetTokenT< EcalRecHitCollection > reducedEndcapRecHitCollectionToken_
bool existsAs(std::string const ¶meterName, bool trackiness=true) const
checks if a parameter exists as a given type
std::vector< edm::Handle< edm::ValueMap< IsoDeposit > > > IsoDepositMaps
void setSubClusDPhi3(float s)
std::pair< std::string, edm::InputTag > NameTag
bool getByToken(EDGetToken token, Handle< PROD > &result) const
void setAllowAnything()
allow any parameter label/value pairs
std::vector< edm::EDGetTokenT< edm::ValueMap< Bool_t > > > photIDTokens_
void fill(const reco::SuperCluster &superClus, const EcalRecHitCollection *ebRecHits, const EcalRecHitCollection *eeRecHits, const CaloGeometry *geom, const CaloTopology *topology, const reco::VertexCollection *vertices)
void setMaxDRRawEnergy(float m)
edm::EDGetTokenT< reco::BeamSpot > beamLineToken_
void embedSeedCluster()
method to store the electron's seedcluster internally
edm::EDGetTokenT< edm::View< reco::Photon > > photonToken_
std::vector< EcalRecHit >::const_iterator const_iterator
void setSubClusDPhi2(float s)
edm::EDGetTokenT< edm::ValueMap< float > > ecalPFClusterIsoT_
void push_back(T const &t)
float seedCrysPhiOrY() const
ParameterDescriptionNode * addNode(ParameterDescriptionNode const &node)
std::vector< edm::EDGetTokenT< edm::Association< reco::GenParticleCollection > > > genMatchTokens_
void embedRecHits(const EcalRecHitCollection *rechits)
method to store the RecHits internally - can be called from the PATElectronProducer ...
void setIsolationPUPPI(float chargedhadrons_, float neutralhadrons_, float photons_)
Sets PUPPI isolation.
pat::helper::KinResolutionsLoader resolutionLoader_
float sigmaIEtaIEta() const
edm::EDGetTokenT< edm::ValueMap< float > > hcalPFClusterIsoT_
GreaterByEt< Photon > eTComparator_
const CaloGeometry * ecalGeometry_
float sigmaIEtaIPhi() const
reco::SuperClusterRef superCluster() const override
Ref to SuperCluster.
void setResolutions(pat::PATObject< T > &obj) const
Sets the efficiencies for this object, using the reference to the original objects.
const std::string names[nVars_]
edm::InputTag reducedEndcapRecHitCollection_
bool enabled() const
'true' if this there is at least one efficiency configured
static void fillDescription(edm::ParameterSetDescription &iDesc)
std::vector< std::string > getParameterNamesForType(bool trackiness=true) const
bool enabled() const
True if it has a non null configuration.
IsolationLabels isoDepositLabels_
void setIsolation(IsolationKeys key, float value)
void setComment(std::string const &value)
pat::helper::MultiIsolator::IsolationValuePairs isolatorTmpStorage_
void setIsoDeposit(IsolationKeys key, const IsoDeposit &dep)
Sets the IsoDeposit associated with some key; if it is already existent, it is overwritten.
#define DEFINE_FWK_MODULE(type)
void beginEvent(const edm::Event &event, const edm::EventSetup &eventSetup)
const CaloTopology * ecalTopology_
float seedCrysIPhiOrIY() const
IsolationLabels isolationValueLabels_
void setMaxDRDEta(float m)
std::vector< edm::EDGetTokenT< edm::ValueMap< IsoDeposit > > > isoDepositTokens_
pat::helper::EfficiencyLoader efficiencyLoader_
void newEvent(const edm::Event &event, const edm::EventSetup &setup)
To be called for each new event, reads in the EventSetup object.
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
float maxSubClusDR() const
def unique(seq, keepstr=True)
void setPhotonIDs(const std::vector< IdPair > &ids)
float seedCrysIEtaOrIX() const
void embedBasicClusters()
method to store the electron's basic clusters
edm::EDGetTokenT< edm::ValueMap< float > > PUPPIIsolation_photons_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void setPassElectronVeto(bool flag)
float maxSubClusDRDPhi() const
void setSeedEnergy(float e)
void setSubClusDPhi1(float s)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
~PATPhotonProducer() override
std::vector< NameTag > photIDSrcs_
void setSubClusDEta1(float s)
pat::helper::MultiIsolator isolator_
float seedCrysEtaOrX() const
void embedPreshowerClusters()
method to store the electron's preshower clusters
const_iterator end() const
void readIsolationLabels(const edm::ParameterSet &iConfig, const char *psetName, IsolationLabels &labels, std::vector< edm::EDGetTokenT< edm::ValueMap< T > > > &tokens)
void embedSuperCluster()
method to store the photon's supercluster internally
std::vector< std::pair< pat::IsolationKeys, float > > IsolationValuePairs
void addGenParticleRef(const reco::GenParticleRef &ref)
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 >
virtual std::vector< DetId > getWindow(const DetId &id, const int &northSouthSize, const int &eastWestSize) const
void setHasPixelSeed(bool flag)
edm::EDGetTokenT< edm::ValueMap< float > > PUPPIIsolation_charged_hadrons_
T const * product() const
static void fillDescription(edm::ParameterSetDescription &iDesc)
Method for documentation and validation of PSet.
void setSubClusDEta2(float s)
bool hasPixelSeed() const
Bool flagging photons having a non-zero size vector of Ref to electornPixel seeds.
void setEfficiencies(pat::PATObject< T > &obj, const R &originalRef) const
Sets the efficiencies for this object, using the reference to the original objects.
void setSubClusRawE2(float s)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
const CaloSubdetectorTopology * getSubdetectorTopology(const DetId &id) const
access the subdetector Topology for the given subdetector directly
const std::vector< float > & subClusDEta() const
void setMaxDRDPhi(float m)
iterator find(key_type k)
const std::vector< float > & subClusDPhi() const
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
void setSubClusDEta3(float s)
edm::EDGetTokenT< edm::ValueMap< float > > PUPPIIsolation_neutral_hadrons_
void setSubClusRawE1(float s)
PATPhotonProducer(const edm::ParameterSet &iConfig)
bool isUninitialized() const
const Point & position() const
position
void setSubClusRawE3(float s)
edm::EDGetTokenT< EcalRecHitCollection > reducedBarrelRecHitCollectionToken_
const PflowIsolationVariables & getPflowIsolationVariables() const
Get Particle Flow Isolation variables block.
std::vector< edm::EDGetTokenT< edm::ValueMap< double > > > isolationValueTokens_
edm::InputTag reducedBarrelRecHitCollection_
std::vector< edm::Handle< edm::ValueMap< double > > > IsolationValueMaps
edm::EDGetTokenT< reco::ConversionCollection > hConversionsToken_
void fill(const edm::View< T > &coll, int idx, IsolationValuePairs &isolations) const
Produces the pat::Photon.
edm::EDGetTokenT< reco::GsfElectronCollection > electronToken_