CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Attributes
EgammaIsoDetIdCollectionProducer< T1 > Class Template Reference
Inheritance diagram for EgammaIsoDetIdCollectionProducer< T1 >:
edm::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Types

typedef std::vector< T1 > T1Collection
 
- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
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
 

Public Member Functions

 EgammaIsoDetIdCollectionProducer (const edm::ParameterSet &)
 ctor More...
 
void produce (edm::StreamID, edm::Event &, const edm::EventSetup &) const override
 producer More...
 
- Public Member Functions inherited from edm::global::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const noexcept final
 
bool wantsGlobalRuns () const noexcept final
 
bool wantsInputProcessBlocks () const noexcept final
 
bool wantsProcessBlocks () const noexcept final
 
bool wantsStreamLuminosityBlocks () const noexcept final
 
bool wantsStreamRuns () const noexcept 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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (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::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

edm::ESGetToken< CaloGeometry, CaloGeometryRecordcaloGeometryToken_
 
edm::InputTag emObjectLabel_
 
edm::EDGetTokenT< T1CollectionemObjectToken_
 
double energyCut_
 
double etCandCut_
 
double etCut_
 
std::vector< int > flagsexclEB_
 
std::vector< int > flagsexclEE_
 
double innerRadius_
 
std::string interestingDetIdCollection_
 
double outerRadius_
 
edm::InputTag recHitsLabel_
 
edm::EDGetTokenT< EcalRecHitCollectionrecHitsToken_
 
std::vector< int > severitiesexclEB_
 
std::vector< int > severitiesexclEE_
 
edm::ESGetToken< EcalSeverityLevelAlgo, EcalSeverityLevelAlgoRcdsevLvToken_
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
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)
 
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 ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, 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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

template<class T1>
class EgammaIsoDetIdCollectionProducer< T1 >

Original author: Matthew LeBourgeois PH/CMG Modified from : RecoEcal/EgammaClusterProducers/{src,interface}/InterestingDetIdCollectionProducer.{h,cc} by Paolo Meridiani PH/CMG

Implementation: <Notes on="" implementation>="">

Definition at line 35 of file EgammaIsoDetIdCollectionProducer.cc.

Member Typedef Documentation

◆ T1Collection

template<class T1 >
typedef std::vector<T1> EgammaIsoDetIdCollectionProducer< T1 >::T1Collection

Definition at line 37 of file EgammaIsoDetIdCollectionProducer.cc.

Constructor & Destructor Documentation

◆ EgammaIsoDetIdCollectionProducer()

template<class T1 >
EgammaIsoDetIdCollectionProducer< T1 >::EgammaIsoDetIdCollectionProducer ( const edm::ParameterSet iConfig)
explicit

ctor

Definition at line 65 of file EgammaIsoDetIdCollectionProducer.cc.

References edm::EDConsumerBase::consumes(), and edm::ParameterSet::getParameter().

66  : recHitsToken_{consumes(iConfig.getParameter<edm::InputTag>("recHitsLabel"))},
67  emObjectToken_{consumes(iConfig.getParameter<edm::InputTag>("emObjectLabel"))},
70  recHitsLabel_(iConfig.getParameter<edm::InputTag>("recHitsLabel")),
71  emObjectLabel_(iConfig.getParameter<edm::InputTag>("emObjectLabel")),
72  energyCut_(iConfig.getParameter<double>("energyCut")),
73  etCut_(iConfig.getParameter<double>("etCut")),
74  etCandCut_(iConfig.getParameter<double>("etCandCut")),
75  outerRadius_(iConfig.getParameter<double>("outerRadius")),
76  innerRadius_(iConfig.getParameter<double>("innerRadius")),
77  interestingDetIdCollection_(iConfig.getParameter<std::string>("interestingDetIdCollection")) {
78  auto const& flagnamesEB = iConfig.getParameter<std::vector<std::string>>("RecHitFlagToBeExcludedEB");
79  auto const& flagnamesEE = iConfig.getParameter<std::vector<std::string>>("RecHitFlagToBeExcludedEE");
80 
81  flagsexclEB_ = StringToEnumValue<EcalRecHit::Flags>(flagnamesEB);
82  flagsexclEE_ = StringToEnumValue<EcalRecHit::Flags>(flagnamesEE);
83 
84  auto const& severitynamesEB = iConfig.getParameter<std::vector<std::string>>("RecHitSeverityToBeExcludedEB");
85 
86  severitiesexclEB_ = StringToEnumValue<EcalSeverityLevel::SeverityLevel>(severitynamesEB);
87 
88  auto const& severitynamesEE = iConfig.getParameter<std::vector<std::string>>("RecHitSeverityToBeExcludedEE");
89 
90  severitiesexclEE_ = StringToEnumValue<EcalSeverityLevel::SeverityLevel>(severitynamesEE);
91 
92  //register your products
93  produces<DetIdCollection>(interestingDetIdCollection_);
94 }
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeometryToken_
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
edm::EDGetTokenT< EcalRecHitCollection > recHitsToken_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::ESGetToken< EcalSeverityLevelAlgo, EcalSeverityLevelAlgoRcd > sevLvToken_
edm::EDGetTokenT< T1Collection > emObjectToken_

Member Function Documentation

◆ produce()

template<class T1 >
void EgammaIsoDetIdCollectionProducer< T1 >::produce ( edm::StreamID  ,
edm::Event iEvent,
const edm::EventSetup iSetup 
) const
overridevirtual

producer

Implements edm::global::EDProducerBase.

Definition at line 98 of file EgammaIsoDetIdCollectionProducer.cc.

References EcalRecHit::checkFlag(), EcalRecHit::checkFlags(), EcalRecHit::detid(), DetId::Ecal, EcalBarrel, EcalEndcap, EcalRecHit::energy(), l1tnanotables_cff::et, PVValHelper::eta, spr::find(), edm::EventSetup::getHandle(), CaloGeometry::getPosition(), iEvent, PixelPluginsPhase0_cfi::isBarrel, EcalRecHit::kGood, mag(), eostools::move(), perp(), edm::ESHandle< T >::product(), and EcalSeverityLevelAlgo::severityLevel().

100  {
101  using namespace edm;
102  using namespace std;
103 
104  auto const& emObjects = iEvent.get(emObjectToken_);
105  auto const& ecalRecHits = iEvent.get(recHitsToken_);
106 
108  const CaloGeometry* caloGeom = pG.product();
109 
111  const EcalSeverityLevelAlgo* sevLevel = sevlv.product();
112 
113  std::unique_ptr<CaloDualConeSelector<EcalRecHit>> doubleConeSel_ = nullptr;
114  if (recHitsLabel_.instance() == "EcalRecHitsEB") {
115  doubleConeSel_ =
116  std::make_unique<CaloDualConeSelector<EcalRecHit>>(innerRadius_, outerRadius_, &*pG, DetId::Ecal, EcalBarrel);
117  } else if (recHitsLabel_.instance() == "EcalRecHitsEE") {
118  doubleConeSel_ =
119  std::make_unique<CaloDualConeSelector<EcalRecHit>>(innerRadius_, outerRadius_, &*pG, DetId::Ecal, EcalEndcap);
120  }
121 
122  //Create empty output collections
123  auto detIdCollection = std::make_unique<DetIdCollection>();
124 
125  if (doubleConeSel_) { //if cone selector was created
126  for (auto const& emObj : emObjects) { //Loop over candidates
127 
128  if (emObj.et() < etCandCut_)
129  continue; //don't calculate if object hasn't enough energy
130 
131  GlobalPoint pclu(emObj.caloPosition().x(), emObj.caloPosition().y(), emObj.caloPosition().z());
132  doubleConeSel_->selectCallback(pclu, ecalRecHits, [&](const EcalRecHit& recIt) {
133  if (recIt.energy() < energyCut_)
134  return; //dont fill if below E noise value
135 
136  double et =
137  recIt.energy() * caloGeom->getPosition(recIt.detid()).perp() / caloGeom->getPosition(recIt.detid()).mag();
138 
139  if (et < etCut_)
140  return; //dont fill if below ET noise value
141 
142  bool isBarrel = false;
143  if (fabs(caloGeom->getPosition(recIt.detid()).eta() < 1.479))
144  isBarrel = true;
145 
146  int severityFlag = sevLevel->severityLevel(recIt.detid(), ecalRecHits);
147  if (isBarrel) {
148  auto sit = std::find(severitiesexclEB_.begin(), severitiesexclEB_.end(), severityFlag);
149  if (sit != severitiesexclEB_.end())
150  return;
151  } else {
152  auto sit = std::find(severitiesexclEE_.begin(), severitiesexclEE_.end(), severityFlag);
153  if (sit != severitiesexclEE_.end())
154  return;
155  }
156 
157  if (isBarrel) {
158  // new rechit flag checks
159  if (!recIt.checkFlag(EcalRecHit::kGood)) {
160  if (recIt.checkFlags(flagsexclEB_)) {
161  return;
162  }
163  }
164  } else {
165  // new rechit flag checks
166  if (!recIt.checkFlag(EcalRecHit::kGood)) {
167  if (recIt.checkFlags(flagsexclEE_)) {
168  return;
169  }
170  }
171  }
172 
173  if (std::find(detIdCollection->begin(), detIdCollection->end(), recIt.detid()) == detIdCollection->end())
174  detIdCollection->push_back(recIt.detid());
175  }); //end rechits
176 
177  } //end candidates
178 
179  } //end if cone selector was created
180 
181  iEvent.put(std::move(detIdCollection), interestingDetIdCollection_);
182 }
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeometryToken_
edm::EDGetTokenT< EcalRecHitCollection > recHitsToken_
std::string const & instance() const
Definition: InputTag.h:37
bool checkFlags(const std::vector< int > &flagsvec) const
check if one of the flags in a set is true
Definition: EcalRecHit.h:191
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
EcalSeverityLevel::SeverityLevel severityLevel(const DetId &id) const
Evaluate status from id use channelStatus from DB.
edm::ESGetToken< EcalSeverityLevelAlgo, EcalSeverityLevelAlgoRcd > sevLvToken_
int iEvent
Definition: GenABIO.cc:224
T const * product() const
Definition: ESHandle.h:86
GlobalPoint getPosition(const DetId &id) const
Get the position of a given detector id.
Definition: CaloGeometry.cc:50
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:130
T perp() const
Magnitude of transverse component.
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
const DetId & detid() const
Definition: EcalRecHit.h:73
HLT enums.
edm::EDGetTokenT< T1Collection > emObjectToken_
float energy() const
Definition: EcalRecHit.h:69
bool checkFlag(int flag) const
check if the flag is true
Definition: EcalRecHit.h:188
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ caloGeometryToken_

template<class T1 >
edm::ESGetToken<CaloGeometry, CaloGeometryRecord> EgammaIsoDetIdCollectionProducer< T1 >::caloGeometryToken_
private

Definition at line 47 of file EgammaIsoDetIdCollectionProducer.cc.

◆ emObjectLabel_

template<class T1 >
edm::InputTag EgammaIsoDetIdCollectionProducer< T1 >::emObjectLabel_
private

Definition at line 50 of file EgammaIsoDetIdCollectionProducer.cc.

◆ emObjectToken_

template<class T1 >
edm::EDGetTokenT<T1Collection> EgammaIsoDetIdCollectionProducer< T1 >::emObjectToken_
private

Definition at line 46 of file EgammaIsoDetIdCollectionProducer.cc.

◆ energyCut_

template<class T1 >
double EgammaIsoDetIdCollectionProducer< T1 >::energyCut_
private

Definition at line 51 of file EgammaIsoDetIdCollectionProducer.cc.

◆ etCandCut_

template<class T1 >
double EgammaIsoDetIdCollectionProducer< T1 >::etCandCut_
private

Definition at line 53 of file EgammaIsoDetIdCollectionProducer.cc.

◆ etCut_

template<class T1 >
double EgammaIsoDetIdCollectionProducer< T1 >::etCut_
private

Definition at line 52 of file EgammaIsoDetIdCollectionProducer.cc.

◆ flagsexclEB_

template<class T1 >
std::vector<int> EgammaIsoDetIdCollectionProducer< T1 >::flagsexclEB_
private

Definition at line 60 of file EgammaIsoDetIdCollectionProducer.cc.

◆ flagsexclEE_

template<class T1 >
std::vector<int> EgammaIsoDetIdCollectionProducer< T1 >::flagsexclEE_
private

Definition at line 61 of file EgammaIsoDetIdCollectionProducer.cc.

◆ innerRadius_

template<class T1 >
double EgammaIsoDetIdCollectionProducer< T1 >::innerRadius_
private

Definition at line 55 of file EgammaIsoDetIdCollectionProducer.cc.

◆ interestingDetIdCollection_

template<class T1 >
std::string EgammaIsoDetIdCollectionProducer< T1 >::interestingDetIdCollection_
private

Definition at line 56 of file EgammaIsoDetIdCollectionProducer.cc.

◆ outerRadius_

template<class T1 >
double EgammaIsoDetIdCollectionProducer< T1 >::outerRadius_
private

Definition at line 54 of file EgammaIsoDetIdCollectionProducer.cc.

◆ recHitsLabel_

template<class T1 >
edm::InputTag EgammaIsoDetIdCollectionProducer< T1 >::recHitsLabel_
private

Definition at line 49 of file EgammaIsoDetIdCollectionProducer.cc.

◆ recHitsToken_

template<class T1 >
edm::EDGetTokenT<EcalRecHitCollection> EgammaIsoDetIdCollectionProducer< T1 >::recHitsToken_
private

Definition at line 45 of file EgammaIsoDetIdCollectionProducer.cc.

◆ severitiesexclEB_

template<class T1 >
std::vector<int> EgammaIsoDetIdCollectionProducer< T1 >::severitiesexclEB_
private

Definition at line 58 of file EgammaIsoDetIdCollectionProducer.cc.

◆ severitiesexclEE_

template<class T1 >
std::vector<int> EgammaIsoDetIdCollectionProducer< T1 >::severitiesexclEE_
private

Definition at line 59 of file EgammaIsoDetIdCollectionProducer.cc.

◆ sevLvToken_

Definition at line 48 of file EgammaIsoDetIdCollectionProducer.cc.