CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes
EgammaHLTExtraProducer Class Reference
Inheritance diagram for EgammaHLTExtraProducer:
edm::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Classes

struct  Tokens
 

Public Member Functions

 EgammaHLTExtraProducer (const edm::ParameterSet &pset)
 
void produce (edm::StreamID streamID, edm::Event &event, const edm::EventSetup &eventSetup) const override
 
 ~EgammaHLTExtraProducer () override
 
- Public Member Functions inherited from edm::global::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const final
 
- Public Member Functions inherited from edm::global::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

std::unique_ptr< reco::PFClusterCollectionfilterPFClusIso (const std::vector< std::unique_ptr< trigger::EgammaObjectCollection >> &egTrigObjs, const edm::Handle< reco::PFClusterCollection > &pfClus, float maxDR2=0.4 *0.4) const
 
template<typename RecHitCollection >
std::unique_ptr< RecHitCollection > filterRecHits (const std::vector< std::unique_ptr< trigger::EgammaObjectCollection >> &egTrigObjs, const edm::Handle< RecHitCollection > &recHits, const CaloGeometry &geom, float maxDR2=0.4 *0.4) const
 
std::unique_ptr< reco::TrackCollectionfilterTrks (const std::vector< std::unique_ptr< trigger::EgammaObjectCollection >> &egTrigObjs, const edm::Handle< reco::TrackCollection > &trks, float maxDR2=0.4 *0.4) const
 

Static Private Member Functions

static reco::GsfTrackRefVector matchingGsfTrks (const reco::SuperClusterRef &scRef, const edm::Handle< reco::GsfTrackCollection > &gsfTrksHandle)
 
static void setGsfTracks (trigger::EgammaObject &egTrigObj, const edm::Handle< reco::GsfTrackCollection > &gsfTrksHandle)
 
static void setSeeds (trigger::EgammaObject &egTrigObj, edm::Handle< reco::ElectronSeedCollection > &eleSeedsHandle)
 
static void setVars (trigger::EgammaObject &egTrigObj, const reco::RecoEcalCandidateRef &ecalCandRef, const std::vector< edm::Handle< reco::RecoEcalCandidateIsolationMap >> &valueMapHandles)
 

Private Attributes

float minPtToSaveHits_
 
std::vector< double > recHitCountThresholds_
 
bool saveHitsPlusHalfPi_
 
bool saveHitsPlusPi_
 
const Tokens tokens_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::ProducerBase
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 78 of file EgammaHLTExtraProducer.cc.

Constructor & Destructor Documentation

◆ EgammaHLTExtraProducer()

EgammaHLTExtraProducer::EgammaHLTExtraProducer ( const edm::ParameterSet pset)
explicit

Definition at line 194 of file EgammaHLTExtraProducer.cc.

196  minPtToSaveHits_(pset.getParameter<double>("minPtToSaveHits")),
197  saveHitsPlusPi_(pset.getParameter<bool>("saveHitsPlusPi")),
198  saveHitsPlusHalfPi_(pset.getParameter<bool>("saveHitsPlusHalfPi")),
199  recHitCountThresholds_(pset.getParameter<std::vector<double>>("recHitCountThresholds")) {
200  consumesMany<reco::RecoEcalCandidateIsolationMap>();
201 
202  for (auto& tokenLabel : tokens_.egCands) {
203  produces<trigger::EgammaObjectCollection>(tokenLabel.second);
204  }
205  for (auto& tokenLabel : tokens_.ecal) {
206  produces<EcalRecHitCollection>(tokenLabel.second);
207  for (const auto& thres : recHitCountThresholds_) {
208  produces<int>("countEcalRecHits" + tokenLabel.second + "Thres" + convertToProdNameStr(thres) + "GeV");
209  }
210  }
211  for (auto& tokenLabel : tokens_.hcal) {
212  produces<HBHERecHitCollection>(tokenLabel.second);
213  for (const auto& thres : recHitCountThresholds_) {
214  produces<int>("countHcalRecHits" + tokenLabel.second + "Thres" + convertToProdNameStr(thres) + "GeV");
215  }
216  }
217  for (auto& tokenLabel : tokens_.trks) {
218  produces<reco::TrackCollection>(tokenLabel.second);
219  }
220  for (auto& tokenLabel : tokens_.pfClusIso) {
221  produces<reco::PFClusterCollection>(tokenLabel.second);
222  }
223 }

References EgammaHLTExtraProducer::Tokens::ecal, EgammaHLTExtraProducer::Tokens::egCands, EgammaHLTExtraProducer::Tokens::hcal, EgammaHLTExtraProducer::Tokens::pfClusIso, recHitCountThresholds_, tokens_, and EgammaHLTExtraProducer::Tokens::trks.

◆ ~EgammaHLTExtraProducer()

EgammaHLTExtraProducer::~EgammaHLTExtraProducer ( )
inlineoverride

Definition at line 81 of file EgammaHLTExtraProducer.cc.

81 {}

Member Function Documentation

◆ fillDescriptions()

void EgammaHLTExtraProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 225 of file EgammaHLTExtraProducer.cc.

225  {
227  desc.add<double>("minPtToSaveHits", 0.);
228  desc.add<bool>("saveHitsPlusPi", false);
229  desc.add<bool>("saveHitsPlusHalfPi", true);
230  desc.add<std::vector<double>>("recHitCountThresholds", std::vector{0., 0.5, 1.0, 1.5, 2.0});
231 
232  edm::ParameterSetDescription egCandsDesc;
233  egCandsDesc.add<edm::InputTag>("ecalCands", edm::InputTag(""));
234  egCandsDesc.add<edm::InputTag>("pixelSeeds", edm::InputTag(""));
235  egCandsDesc.add<edm::InputTag>("gsfTracks", edm::InputTag(""));
236  egCandsDesc.add<std::string>("label", "");
237  std::vector<edm::ParameterSet> egCandsDefaults(1);
238  egCandsDefaults[0].addParameter("ecalCands", edm::InputTag("hltEgammaCandidates"));
239  egCandsDefaults[0].addParameter("pixelSeeds", edm::InputTag("hltEgammaElectronPixelSeeds"));
240  egCandsDefaults[0].addParameter("gsfTracks", edm::InputTag("hltEgammaGsfTracks"));
241  egCandsDefaults[0].addParameter("label", std::string(""));
242 
243  edm::ParameterSetDescription tokenLabelDesc;
244  tokenLabelDesc.add<edm::InputTag>("src", edm::InputTag(""));
245  tokenLabelDesc.add<std::string>("label", "");
246  std::vector<edm::ParameterSet> ecalDefaults(2);
247  ecalDefaults[0].addParameter("src", edm::InputTag("hltEcalRecHit", "EcalRecHitsEB"));
248  ecalDefaults[0].addParameter("label", std::string("EcalRecHitsEB"));
249  ecalDefaults[1].addParameter("src", edm::InputTag("hltEcalRecHit", "EcalRecHitsEE"));
250  ecalDefaults[1].addParameter("label", std::string("EcalRecHitsEE"));
251  std::vector<edm::ParameterSet> hcalDefaults(1);
252  hcalDefaults[0].addParameter("src", edm::InputTag("hltHbhereco"));
253  hcalDefaults[0].addParameter("label", std::string(""));
254  std::vector<edm::ParameterSet> trksDefaults(1);
255  trksDefaults[0].addParameter("src", edm::InputTag("generalTracks"));
256  trksDefaults[0].addParameter("label", std::string(""));
257  std::vector<edm::ParameterSet> pfClusIsoDefaults(3);
258  pfClusIsoDefaults[0].addParameter("src", edm::InputTag("hltParticleFlowClusterECALL1Seeded"));
259  pfClusIsoDefaults[0].addParameter("label", std::string("Ecal"));
260  pfClusIsoDefaults[1].addParameter("src", edm::InputTag("hltParticleFlowClusterECALUnseeded"));
261  pfClusIsoDefaults[1].addParameter("label", std::string("EcalUnseeded"));
262  pfClusIsoDefaults[2].addParameter("src", edm::InputTag("hltParticleFlowClusterHCAL"));
263  pfClusIsoDefaults[2].addParameter("label", std::string("Hcal"));
264 
265  desc.addVPSet("egCands", egCandsDesc, egCandsDefaults);
266  desc.addVPSet("ecal", tokenLabelDesc, ecalDefaults);
267  desc.addVPSet("hcal", tokenLabelDesc, hcalDefaults);
268  desc.addVPSet("trks", tokenLabelDesc, trksDefaults);
269  desc.addVPSet("pfClusIso", tokenLabelDesc, pfClusIsoDefaults);
270 
271  descriptions.add(("hltEgammaHLTExtraProducer"), desc);
272 }

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), edm::ParameterSetDescription::addVPSet(), HLT_2018_cff::InputTag, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ filterPFClusIso()

std::unique_ptr< reco::PFClusterCollection > EgammaHLTExtraProducer::filterPFClusIso ( const std::vector< std::unique_ptr< trigger::EgammaObjectCollection >> &  egTrigObjs,
const edm::Handle< reco::PFClusterCollection > &  pfClus,
float  maxDR2 = 0.4 * 0.4 
) const
private

Definition at line 495 of file EgammaHLTExtraProducer.cc.

498  {
499  auto filteredPFClus = std::make_unique<reco::PFClusterCollection>();
500  if (!pfClus.isValid())
501  return filteredPFClus;
502 
503  std::vector<std::pair<float, float>> etaPhis;
504  for (const auto& egTrigObjs : egTrigObjColls) {
505  for (const auto& egTrigObj : *egTrigObjs) {
506  if (egTrigObj.pt() >= minPtToSaveHits_) {
507  etaPhis.push_back({egTrigObj.eta(), egTrigObj.phi()});
508  if (saveHitsPlusPi_)
509  etaPhis.push_back({egTrigObj.eta(), egTrigObj.phi() + 3.14159});
511  etaPhis.push_back({egTrigObj.eta(), egTrigObj.phi() + 3.14159 / 2.});
512  }
513  }
514  }
515  auto deltaR2Match = [&etaPhis, &maxDR2](float eta, float phi) {
516  for (auto& etaPhi : etaPhis) {
517  if (reco::deltaR2(eta, phi, etaPhi.first, etaPhi.second) < maxDR2)
518  return true;
519  }
520  return false;
521  };
522 
523  for (auto& clus : *pfClus) {
524  if (deltaR2Match(clus.eta(), clus.phi()))
525  filteredPFClus->push_back(clus);
526  }
527  return filteredPFClus;
528 }

References reco::deltaR2(), PVValHelper::eta, edm::HandleBase::isValid(), minPtToSaveHits_, phi, saveHitsPlusHalfPi_, and saveHitsPlusPi_.

Referenced by produce().

◆ filterRecHits()

template<typename RecHitCollection >
std::unique_ptr< RecHitCollection > EgammaHLTExtraProducer::filterRecHits ( const std::vector< std::unique_ptr< trigger::EgammaObjectCollection >> &  egTrigObjs,
const edm::Handle< RecHitCollection > &  recHits,
const CaloGeometry geom,
float  maxDR2 = 0.4 * 0.4 
) const
private

Definition at line 405 of file EgammaHLTExtraProducer.cc.

409  {
410  auto filteredHits = std::make_unique<RecHitCollection>();
411  if (!recHits.isValid())
412  return filteredHits;
413 
414  std::vector<std::pair<float, float>> etaPhis;
415  for (const auto& egTrigObjs : egTrigObjColls) {
416  for (const auto& egTrigObj : *egTrigObjs) {
417  if (egTrigObj.pt() >= minPtToSaveHits_) {
418  etaPhis.push_back({egTrigObj.eta(), egTrigObj.phi()});
419  if (saveHitsPlusPi_)
420  etaPhis.push_back({egTrigObj.eta(), egTrigObj.phi() + 3.14159});
422  etaPhis.push_back({egTrigObj.eta(), egTrigObj.phi() + 3.14159 / 2.});
423  }
424  }
425  }
426  auto deltaR2Match = [&etaPhis, &maxDR2](const GlobalPoint& pos) {
427  float eta = pos.eta();
428  float phi = pos.phi();
429  for (auto& etaPhi : etaPhis) {
430  if (reco::deltaR2(eta, phi, etaPhi.first, etaPhi.second) < maxDR2)
431  return true;
432  }
433  return false;
434  };
435 
436  for (auto& hit : *recHits) {
437  const CaloSubdetectorGeometry* subDetGeom = geom.getSubdetectorGeometry(hit.id());
438  if (subDetGeom) {
439  auto cellGeom = subDetGeom->getGeometry(hit.id());
440  if (deltaR2Match(cellGeom->getPosition()))
441  filteredHits->push_back(hit);
442  } else {
443  throw cms::Exception("GeomError") << "could not get geometry for det id " << hit.id().rawId();
444  }
445  }
446  return filteredHits;
447 }

References reco::deltaR2(), PVValHelper::eta, Exception, relativeConstraints::geom, hit::id, minPtToSaveHits_, phi, FastTrackerRecHitMaskProducer_cfi::recHits, saveHitsPlusHalfPi_, saveHitsPlusPi_, and GeomDetEnumerators::subDetGeom.

Referenced by produce().

◆ filterTrks()

std::unique_ptr< reco::TrackCollection > EgammaHLTExtraProducer::filterTrks ( const std::vector< std::unique_ptr< trigger::EgammaObjectCollection >> &  egTrigObjs,
const edm::Handle< reco::TrackCollection > &  trks,
float  maxDR2 = 0.4 * 0.4 
) const
private

Definition at line 449 of file EgammaHLTExtraProducer.cc.

452  {
453  auto filteredTrks = std::make_unique<reco::TrackCollection>();
454  if (!trks.isValid())
455  return filteredTrks;
456 
457  //so because each egamma object can have multiple eta/phi pairs
458  //easier to just make a temp vector and then copy that in with the +pi and +pi/2
459  std::vector<std::pair<float, float>> etaPhisTmp;
460  for (const auto& egTrigObjs : egTrigObjColls) {
461  for (const auto& egTrigObj : *egTrigObjs) {
462  if (egTrigObj.pt() >= minPtToSaveHits_) {
463  etaPhisTmp.push_back({egTrigObj.eta(), egTrigObj.phi()});
464  //also save the eta /phi of all gsf tracks with the object
465  for (const auto& gsfTrk : egTrigObj.gsfTracks()) {
466  etaPhisTmp.push_back({gsfTrk->eta(), gsfTrk->phi()});
467  }
468  }
469  }
470  }
471  std::vector<std::pair<float, float>> etaPhis;
472  for (const auto& etaPhi : etaPhisTmp) {
473  etaPhis.push_back(etaPhi);
474  if (saveHitsPlusPi_)
475  etaPhis.push_back({etaPhi.first, etaPhi.second + 3.14159});
477  etaPhis.push_back({etaPhi.first, etaPhi.second + 3.14159 / 2.});
478  }
479 
480  auto deltaR2Match = [&etaPhis, &maxDR2](float eta, float phi) {
481  for (auto& etaPhi : etaPhis) {
482  if (reco::deltaR2(eta, phi, etaPhi.first, etaPhi.second) < maxDR2)
483  return true;
484  }
485  return false;
486  };
487 
488  for (auto& trk : *trks) {
489  if (deltaR2Match(trk.eta(), trk.phi()))
490  filteredTrks->push_back(trk);
491  }
492  return filteredTrks;
493 }

References reco::deltaR2(), PVValHelper::eta, minPtToSaveHits_, phi, saveHitsPlusHalfPi_, saveHitsPlusPi_, and hltEgammaHLTExtra_cfi::trks.

Referenced by produce().

◆ matchingGsfTrks()

reco::GsfTrackRefVector EgammaHLTExtraProducer::matchingGsfTrks ( const reco::SuperClusterRef scRef,
const edm::Handle< reco::GsfTrackCollection > &  gsfTrksHandle 
)
staticprivate

Definition at line 359 of file EgammaHLTExtraProducer.cc.

360  {
361  if (!gsfTrksHandle.isValid()) {
362  return reco::GsfTrackRefVector();
363  }
364 
365  reco::GsfTrackRefVector gsfTrkRefs(gsfTrksHandle.id());
366  for (size_t trkNr = 0; gsfTrksHandle.isValid() && trkNr < gsfTrksHandle->size(); trkNr++) {
367  reco::GsfTrackRef trkRef(gsfTrksHandle, trkNr);
368  edm::RefToBase<TrajectorySeed> seed = trkRef->extra()->seedRef();
370  edm::RefToBase<reco::CaloCluster> caloCluster = eleSeed->caloCluster();
371  reco::SuperClusterRef scRefFromTrk = caloCluster.castTo<reco::SuperClusterRef>();
372  if (scRefFromTrk == scRef) {
373  gsfTrkRefs.push_back(trkRef);
374  }
375  }
376  return gsfTrkRefs;
377 }

References edm::HandleBase::id(), edm::HandleBase::isValid(), and SurveyInfoScenario_cff::seed.

Referenced by setGsfTracks().

◆ produce()

void EgammaHLTExtraProducer::produce ( edm::StreamID  streamID,
edm::Event event,
const edm::EventSetup eventSetup 
) const
overridevirtual

Implements edm::global::EDProducerBase.

Definition at line 274 of file EgammaHLTExtraProducer.cc.

276  {
277  std::vector<edm::Handle<reco::RecoEcalCandidateIsolationMap>> valueMapHandles;
278  event.getManyByType(valueMapHandles);
279 
280  std::vector<std::unique_ptr<trigger::EgammaObjectCollection>> egTrigObjColls;
281  for (const auto& egCandsToken : tokens_.egCands) {
282  auto ecalCandsHandle = event.getHandle(egCandsToken.first.ecalCands);
283  auto gsfTrksHandle = event.getHandle(egCandsToken.first.gsfTracks);
284  auto pixelSeedsHandle = event.getHandle(egCandsToken.first.pixelSeeds);
285 
286  auto egTrigObjs = std::make_unique<trigger::EgammaObjectCollection>();
287  for (size_t candNr = 0; ecalCandsHandle.isValid() && candNr < ecalCandsHandle->size(); candNr++) {
288  reco::RecoEcalCandidateRef candRef(ecalCandsHandle, candNr);
289  egTrigObjs->push_back(*candRef);
290  auto& egTrigObj = egTrigObjs->back();
291  setVars(egTrigObj, candRef, valueMapHandles);
292  setGsfTracks(egTrigObj, gsfTrksHandle);
293  setSeeds(egTrigObj, pixelSeedsHandle);
294  }
295  egTrigObjColls.emplace_back(std::move(egTrigObjs));
296  }
297 
298  edm::ESHandle<CaloGeometry> caloGeomHandle;
299  eventSetup.get<CaloGeometryRecord>().get(caloGeomHandle);
300 
301  auto filterAndStoreRecHits = [caloGeomHandle, &event, this](const auto& egTrigObjs, const auto& tokenLabels) {
302  for (const auto& tokenLabel : tokenLabels) {
303  auto handle = event.getHandle(tokenLabel.first);
304  auto recHits = filterRecHits(egTrigObjs, handle, *caloGeomHandle);
305  event.put(std::move(recHits), tokenLabel.second);
306  }
307  };
308 
309  auto storeCountRecHits = [&event](const auto& tokenLabels, const auto& thresholds, const std::string& prefixLabel) {
310  for (const auto& tokenLabel : tokenLabels) {
311  auto handle = event.getHandle(tokenLabel.first);
312  auto count = countRecHits(handle, thresholds);
313  for (size_t thresNr = 0; thresNr < thresholds.size(); thresNr++) {
314  const auto& thres = thresholds[thresNr];
315  event.put(std::move(count[thresNr]),
316  prefixLabel + tokenLabel.second + "Thres" + convertToProdNameStr(thres) + "GeV");
317  }
318  }
319  };
320 
321  auto filterAndStore = [&event, this](const auto& egTrigObjs, const auto& tokenLabels, auto filterFunc) {
322  for (const auto& tokenLabel : tokenLabels) {
323  auto handle = event.getHandle(tokenLabel.first);
324  auto filtered = (this->*filterFunc)(egTrigObjs, handle, 0.4 * 0.4);
325  event.put(std::move(filtered), tokenLabel.second);
326  }
327  };
328 
329  filterAndStoreRecHits(egTrigObjColls, tokens_.ecal);
330  filterAndStoreRecHits(egTrigObjColls, tokens_.hcal);
331  storeCountRecHits(tokens_.ecal, recHitCountThresholds_, "countEcalRecHits");
332  storeCountRecHits(tokens_.hcal, recHitCountThresholds_, "countHcalRecHits");
333  filterAndStore(egTrigObjColls, tokens_.pfClusIso, &EgammaHLTExtraProducer::filterPFClusIso);
334  filterAndStore(egTrigObjColls, tokens_.trks, &EgammaHLTExtraProducer::filterTrks);
335 
336  for (size_t collNr = 0; collNr < egTrigObjColls.size(); collNr++) {
337  event.put(std::move(egTrigObjColls[collNr]), tokens_.egCands[collNr].second);
338  }
339 }

References KineDebug3::count(), EgammaHLTExtraProducer::Tokens::ecal, EgammaHLTExtraProducer::Tokens::egCands, event(), filtered(), filterPFClusIso(), filterRecHits(), filterTrks(), edm::EventSetup::get(), get, patZpeak::handle, EgammaHLTExtraProducer::Tokens::hcal, eostools::move(), EgammaHLTExtraProducer::Tokens::pfClusIso, recHitCountThresholds_, FastTrackerRecHitMaskProducer_cfi::recHits, setGsfTracks(), setSeeds(), setVars(), AlCaHLTBitMon_QueryRunRegistry::string, particleFlowZeroSuppressionECAL_cff::thresholds, tokens_, and EgammaHLTExtraProducer::Tokens::trks.

◆ setGsfTracks()

void EgammaHLTExtraProducer::setGsfTracks ( trigger::EgammaObject egTrigObj,
const edm::Handle< reco::GsfTrackCollection > &  gsfTrksHandle 
)
staticprivate

Definition at line 379 of file EgammaHLTExtraProducer.cc.

380  {
381  egTrigObj.setGsfTracks(matchingGsfTrks(egTrigObj.superCluster(), gsfTrksHandle));
382 }

References matchingGsfTrks(), trigger::EgammaObject::setGsfTracks(), and trigger::EgammaObject::superCluster().

Referenced by produce().

◆ setSeeds()

void EgammaHLTExtraProducer::setSeeds ( trigger::EgammaObject egTrigObj,
edm::Handle< reco::ElectronSeedCollection > &  eleSeedsHandle 
)
staticprivate

Definition at line 384 of file EgammaHLTExtraProducer.cc.

385  {
386  if (!eleSeedsHandle.isValid()) {
388  } else {
389  reco::ElectronSeedRefVector trigObjSeeds(eleSeedsHandle.id());
390 
391  for (size_t seedNr = 0; eleSeedsHandle.isValid() && seedNr < eleSeedsHandle->size(); seedNr++) {
392  reco::ElectronSeedRef eleSeed(eleSeedsHandle, seedNr);
393  edm::RefToBase<reco::CaloCluster> caloCluster = eleSeed->caloCluster();
394  reco::SuperClusterRef scRefFromSeed = caloCluster.castTo<reco::SuperClusterRef>();
395 
396  if (scRefFromSeed == egTrigObj.superCluster()) {
397  trigObjSeeds.push_back(eleSeed);
398  }
399  }
400  egTrigObj.setSeeds(std::move(trigObjSeeds));
401  }
402 }

References edm::RefToBase< T >::castTo(), edm::HandleBase::id(), edm::HandleBase::isValid(), eostools::move(), trigger::EgammaObject::setSeeds(), and trigger::EgammaObject::superCluster().

Referenced by produce().

◆ setVars()

void EgammaHLTExtraProducer::setVars ( trigger::EgammaObject egTrigObj,
const reco::RecoEcalCandidateRef ecalCandRef,
const std::vector< edm::Handle< reco::RecoEcalCandidateIsolationMap >> &  valueMapHandles 
)
staticprivate

Definition at line 341 of file EgammaHLTExtraProducer.cc.

344  {
345  std::vector<std::pair<std::string, float>> vars;
346  for (auto& valueMapHandle : valueMapHandles) {
347  auto mapIt = valueMapHandle->find(ecalCandRef);
348  if (mapIt != valueMapHandle->end()) {
349  std::string name = valueMapHandle.provenance()->moduleLabel();
350  if (!valueMapHandle.provenance()->productInstanceName().empty()) {
351  name += "_" + valueMapHandle.provenance()->productInstanceName();
352  }
353  vars.emplace_back(std::move(name), mapIt->val);
354  }
355  }
356  egTrigObj.setVars(std::move(vars));
357 }

References eostools::move(), Skims_PA_cff::name, trigger::EgammaObject::setVars(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by produce().

Member Data Documentation

◆ minPtToSaveHits_

float EgammaHLTExtraProducer::minPtToSaveHits_
private

Definition at line 180 of file EgammaHLTExtraProducer.cc.

Referenced by filterPFClusIso(), filterRecHits(), and filterTrks().

◆ recHitCountThresholds_

std::vector<double> EgammaHLTExtraProducer::recHitCountThresholds_
private

Definition at line 183 of file EgammaHLTExtraProducer.cc.

Referenced by EgammaHLTExtraProducer(), and produce().

◆ saveHitsPlusHalfPi_

bool EgammaHLTExtraProducer::saveHitsPlusHalfPi_
private

Definition at line 182 of file EgammaHLTExtraProducer.cc.

Referenced by filterPFClusIso(), filterRecHits(), and filterTrks().

◆ saveHitsPlusPi_

bool EgammaHLTExtraProducer::saveHitsPlusPi_
private

Definition at line 181 of file EgammaHLTExtraProducer.cc.

Referenced by filterPFClusIso(), filterRecHits(), and filterTrks().

◆ tokens_

const Tokens EgammaHLTExtraProducer::tokens_
private

Definition at line 178 of file EgammaHLTExtraProducer.cc.

Referenced by EgammaHLTExtraProducer(), and produce().

edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
EgammaHLTExtraProducer::tokens_
const Tokens tokens_
Definition: EgammaHLTExtraProducer.cc:178
hit::id
unsigned int id
Definition: SiStripHitEffFromCalibTree.cc:92
particleFlowZeroSuppressionECAL_cff.thresholds
thresholds
Definition: particleFlowZeroSuppressionECAL_cff.py:31
patZpeak.handle
handle
Definition: patZpeak.py:23
EgammaHLTExtraProducer::minPtToSaveHits_
float minPtToSaveHits_
Definition: EgammaHLTExtraProducer.cc:180
CaloGeometryRecord
Definition: CaloGeometryRecord.h:30
pos
Definition: PixelAliasList.h:18
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
edm::EDConsumerBase::consumesCollector
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
Definition: EDConsumerBase.cc:71
EgammaHLTExtraProducer::Tokens::ecal
std::vector< std::pair< edm::EDGetTokenT< EcalRecHitCollection >, std::string > > ecal
Definition: EgammaHLTExtraProducer.cc:125
edm::RefVector< GsfTrackCollection >
edm::Ref< GsfTrackCollection >
trigger::EgammaObject::setVars
void setVars(std::vector< std::pair< std::string, float >> vars)
Definition: EgammaObject.cc:59
EgammaHLTExtraProducer::Tokens::egCands
std::vector< std::pair< EgObjTokens, std::string > > egCands
Definition: EgammaHLTExtraProducer.cc:123
EgammaHLTExtraProducer::Tokens::trks
std::vector< std::pair< edm::EDGetTokenT< reco::TrackCollection >, std::string > > trks
Definition: EgammaHLTExtraProducer.cc:127
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
vars
vars
Definition: DeepTauId.cc:163
EgammaHLTExtraProducer::setSeeds
static void setSeeds(trigger::EgammaObject &egTrigObj, edm::Handle< reco::ElectronSeedCollection > &eleSeedsHandle)
Definition: EgammaHLTExtraProducer.cc:384
EgammaHLTExtraProducer::saveHitsPlusPi_
bool saveHitsPlusPi_
Definition: EgammaHLTExtraProducer.cc:181
PVValHelper::eta
Definition: PVValidationHelpers.h:69
EgammaHLTExtraProducer::saveHitsPlusHalfPi_
bool saveHitsPlusHalfPi_
Definition: EgammaHLTExtraProducer.cc:182
EgammaHLTExtraProducer::Tokens::hcal
std::vector< std::pair< edm::EDGetTokenT< HBHERecHitCollection >, std::string > > hcal
Definition: EgammaHLTExtraProducer.cc:126
edm::ESHandle< CaloGeometry >
EgammaHLTExtraProducer::filterRecHits
std::unique_ptr< RecHitCollection > filterRecHits(const std::vector< std::unique_ptr< trigger::EgammaObjectCollection >> &egTrigObjs, const edm::Handle< RecHitCollection > &recHits, const CaloGeometry &geom, float maxDR2=0.4 *0.4) const
Definition: EgammaHLTExtraProducer.cc:405
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
Point3DBase< float, GlobalTag >
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
FastTrackerRecHitMaskProducer_cfi.recHits
recHits
Definition: FastTrackerRecHitMaskProducer_cfi.py:8
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
reco::GsfTrackRefVector
edm::RefVector< GsfTrackCollection > GsfTrackRefVector
vector of reference to GsfTrack in the same collection
Definition: GsfTrackFwd.h:17
KineDebug3::count
void count()
Definition: KinematicConstrainedVertexUpdatorT.h:21
reco::deltaR2
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:16
EgammaHLTExtraProducer::filterTrks
std::unique_ptr< reco::TrackCollection > filterTrks(const std::vector< std::unique_ptr< trigger::EgammaObjectCollection >> &egTrigObjs, const edm::Handle< reco::TrackCollection > &trks, float maxDR2=0.4 *0.4) const
Definition: EgammaHLTExtraProducer.cc:449
filtered
static const TGPicture * filtered(bool iBackgroundIsBlack)
Definition: FWCollectionSummaryWidget.cc:99
EgammaHLTExtraProducer::setVars
static void setVars(trigger::EgammaObject &egTrigObj, const reco::RecoEcalCandidateRef &ecalCandRef, const std::vector< edm::Handle< reco::RecoEcalCandidateIsolationMap >> &valueMapHandles)
Definition: EgammaHLTExtraProducer.cc:341
edm::RefToBase::castTo
REF castTo() const
Definition: RefToBase.h:257
trigger::EgammaObject::setGsfTracks
void setGsfTracks(reco::GsfTrackRefVector trks)
Definition: EgammaObject.h:30
EgammaHLTExtraProducer::matchingGsfTrks
static reco::GsfTrackRefVector matchingGsfTrks(const reco::SuperClusterRef &scRef, const edm::Handle< reco::GsfTrackCollection > &gsfTrksHandle)
Definition: EgammaHLTExtraProducer.cc:359
get
#define get
DDAxes::phi
trigger::EgammaObject::setSeeds
void setSeeds(reco::ElectronSeedRefVector seeds)
Definition: EgammaObject.cc:11
eostools.move
def move(src, dest)
Definition: eostools.py:511
GeomDetEnumerators::subDetGeom
constexpr SubDetector subDetGeom[21]
Definition: GeomDetEnumerators.h:40
Exception
Definition: hltDiff.cc:246
EgammaHLTExtraProducer::filterPFClusIso
std::unique_ptr< reco::PFClusterCollection > filterPFClusIso(const std::vector< std::unique_ptr< trigger::EgammaObjectCollection >> &egTrigObjs, const edm::Handle< reco::PFClusterCollection > &pfClus, float maxDR2=0.4 *0.4) const
Definition: EgammaHLTExtraProducer.cc:495
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
CaloSubdetectorGeometry
Definition: CaloSubdetectorGeometry.h:22
edm::RefToBase< TrajectorySeed >
hltEgammaHLTExtra_cfi.trks
trks
Definition: hltEgammaHLTExtra_cfi.py:43
EgammaHLTExtraProducer::Tokens::pfClusIso
std::vector< std::pair< edm::EDGetTokenT< reco::PFClusterCollection >, std::string > > pfClusIso
Definition: EgammaHLTExtraProducer.cc:128
EgammaHLTExtraProducer::setGsfTracks
static void setGsfTracks(trigger::EgammaObject &egTrigObj, const edm::Handle< reco::GsfTrackCollection > &gsfTrksHandle)
Definition: EgammaHLTExtraProducer.cc:379
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
trigger::EgammaObject::superCluster
const reco::SuperClusterRef & superCluster() const
Definition: EgammaObject.h:25
EgammaHLTExtraProducer::recHitCountThresholds_
std::vector< double > recHitCountThresholds_
Definition: EgammaHLTExtraProducer.cc:183
event
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of "!*" before the partial wildcard feature was incorporated). The per-event "cost" of each negative criterion with multiple relevant triggers is about the same as ! *was in the past
edm::HandleBase::id
ProductID id() const
Definition: HandleBase.cc:13
edm::InputTag
Definition: InputTag.h:15
SurveyInfoScenario_cff.seed
seed
Definition: SurveyInfoScenario_cff.py:295
hit
Definition: SiStripHitEffFromCalibTree.cc:88
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27