CMS 3D CMS Logo

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

Public Member Functions

 InterestingDetIdCollectionProducer (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::EDGetTokenT< reco::BasicClusterCollectionbasicClustersToken_
 
edm::ESGetToken< CaloTopology, CaloTopologyRecordcaloTopologyToken_
 
std::string interestingDetIdCollection_
 
bool keepNextToBoundary_
 
bool keepNextToDead_
 
int minimalEtaSize_
 
int minimalPhiSize_
 
edm::ESGetToken< EcalNextToDeadChannel, EcalNextToDeadChannelRcdnextToDeadToken_
 
edm::EDGetTokenT< EcalRecHitCollectionrecHitsToken_
 
int severityLevel_
 
edm::ESGetToken< EcalSeverityLevelAlgo, EcalSeverityLevelAlgoRcdsevLVToken_
 

Additional Inherited Members

- 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
 
- 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

Original author: Paolo Meridiani PH/CMG

Make a collection of detids to be kept tipically in a AOD rechit collection

The following classes of "interesting id" are considered

1.in a region around  the seed of the cluster collection specified
  by paramter basicClusters. The size of the region is specified by
  minimalEtaSize_, minimalPhiSize_

2. if the severity of the hit is >= severityLevel_
   If severityLevel=0 this class is ignored

3. Channels next to dead ones,  keepNextToDead_ is true
4. Channels next to the EB/EE transition if keepNextToBoundary_ is true

Definition at line 50 of file InterestingDetIdCollectionProducer.cc.

Constructor & Destructor Documentation

◆ InterestingDetIdCollectionProducer()

InterestingDetIdCollectionProducer::InterestingDetIdCollectionProducer ( const edm::ParameterSet iConfig)
explicit

ctor

Definition at line 77 of file InterestingDetIdCollectionProducer.cc.

References basicClustersToken_, caloTopologyToken_, edm::ParameterSet::getParameter(), interestingDetIdCollection_, keepNextToBoundary_, keepNextToDead_, minimalEtaSize_, minimalPhiSize_, nextToDeadToken_, recHitsToken_, severityLevel_, sevLVToken_, and AlCaHLTBitMon_QueryRunRegistry::string.

77  {
78  recHitsToken_ = consumes<EcalRecHitCollection>(iConfig.getParameter<edm::InputTag>("recHitsLabel"));
80  consumes<reco::BasicClusterCollection>(iConfig.getParameter<edm::InputTag>("basicClustersLabel"));
81  caloTopologyToken_ = esConsumes<CaloTopology, CaloTopologyRecord>();
82  sevLVToken_ = esConsumes<EcalSeverityLevelAlgo, EcalSeverityLevelAlgoRcd>();
83  nextToDeadToken_ = esConsumes<EcalNextToDeadChannel, EcalNextToDeadChannelRcd>();
84 
85  interestingDetIdCollection_ = iConfig.getParameter<std::string>("interestingDetIdCollection");
86 
87  minimalEtaSize_ = iConfig.getParameter<int>("etaSize");
88  minimalPhiSize_ = iConfig.getParameter<int>("phiSize");
89  if (minimalPhiSize_ % 2 == 0 || minimalEtaSize_ % 2 == 0)
90  edm::LogError("InterestingDetIdCollectionProducerError") << "Size of eta/phi should be odd numbers";
91 
92  //register your products
93  produces<DetIdCollection>(interestingDetIdCollection_);
94 
95  severityLevel_ = iConfig.getParameter<int>("severityLevel");
96  keepNextToDead_ = iConfig.getParameter<bool>("keepNextToDead");
97  keepNextToBoundary_ = iConfig.getParameter<bool>("keepNextToBoundary");
98 }
edm::ESGetToken< EcalNextToDeadChannel, EcalNextToDeadChannelRcd > nextToDeadToken_
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
Log< level::Error, false > LogError
edm::EDGetTokenT< EcalRecHitCollection > recHitsToken_
edm::ESGetToken< EcalSeverityLevelAlgo, EcalSeverityLevelAlgoRcd > sevLVToken_
edm::EDGetTokenT< reco::BasicClusterCollection > basicClustersToken_
edm::ESGetToken< CaloTopology, CaloTopologyRecord > caloTopologyToken_

Member Function Documentation

◆ produce()

void InterestingDetIdCollectionProducer::produce ( edm::StreamID  ,
edm::Event iEvent,
const edm::EventSetup iSetup 
) const
overridevirtual

producer

Implements edm::global::EDProducerBase.

Definition at line 101 of file InterestingDetIdCollectionProducer.cc.

References funct::abs(), basicClustersToken_, edm::SortedCollection< T, SORT >::begin(), caloTopologyToken_, DetId::det(), ALCARECOPPSCalTrackBasedSel_cff::detid, EcalBarrel, EcalEndcap, cosmicPhotonAnalyzer_cfi::eMax, edm::SortedCollection< T, SORT >::end(), edm::SortedCollection< T, SORT >::find(), edm::EventSetup::getData(), edm::EventSetup::getHandle(), iEvent, interestingDetIdCollection_, EcalTools::isNextToDead(), EEDetId::isNextToRingBoundary(), ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, keepNextToBoundary_, keepNextToDead_, EcalRecHit::kTPSaturated, minimalEtaSize_, minimalPhiSize_, nextToDeadToken_, DetId::null(), recHitsToken_, ErrorSummaryFilter_cfi::severity, severityLevel_, sevLVToken_, jetUpdater_cfi::sort, DetId::subdetId(), HLT_2024v14_cff::topology, and tier0::unique().

103  {
104  using namespace edm;
105  using namespace std;
106 
107  auto const& caloTopology = iSetup.getData(caloTopologyToken_);
108 
109  auto const& severity = iSetup.getData(sevLVToken_);
110 
111  // take BasicClusters
113  iEvent.getByToken(basicClustersToken_, pClusters);
114 
115  // take EcalRecHits
116  Handle<EcalRecHitCollection> recHitsHandle;
117  iEvent.getByToken(recHitsToken_, recHitsHandle);
118 
119  //Create empty output collections
120  std::vector<DetId> indexToStore;
121  indexToStore.reserve(1000);
122 
123  reco::BasicClusterCollection::const_iterator clusIt;
124 
125  std::vector<DetId> xtalsToStore;
126  xtalsToStore.reserve(50);
127  for (clusIt = pClusters->begin(); clusIt != pClusters->end(); clusIt++) {
128  const std::vector<std::pair<DetId, float> >& clusterDetIds = clusIt->hitsAndFractions();
129  for (const auto& detidpair : clusterDetIds) {
130  indexToStore.push_back(detidpair.first);
131  }
132 
133  //below checks and additional code are only relevant for EB/EE, not for ES
134  if (clusterDetIds.front().first.subdetId() == EcalBarrel || clusterDetIds.front().first.subdetId() == EcalEndcap) {
135  std::vector<std::pair<DetId, float> >::const_iterator posCurrent;
136 
137  float eMax = 0.;
138  DetId eMaxId(0);
139 
140  EcalRecHit testEcalRecHit;
141 
142  for (posCurrent = clusterDetIds.begin(); posCurrent != clusterDetIds.end(); posCurrent++) {
143  EcalRecHitCollection::const_iterator itt = recHitsHandle->find((*posCurrent).first);
144  if ((!((*posCurrent).first.null())) && (itt != recHitsHandle->end()) && ((*itt).energy() > eMax)) {
145  eMax = (*itt).energy();
146  eMaxId = (*itt).id();
147  }
148  }
149 
150  if (eMaxId.null())
151  continue;
152 
153  const CaloSubdetectorTopology* topology = caloTopology.getSubdetectorTopology(eMaxId.det(), eMaxId.subdetId());
154 
155  xtalsToStore = topology->getWindow(eMaxId, minimalEtaSize_, minimalPhiSize_);
156 
157  for (const auto& detid : xtalsToStore) {
158  indexToStore.push_back(detid);
159  }
160  }
161  }
162 
164  for (EcalRecHitCollection::const_iterator it = recHitsHandle->begin(); it != recHitsHandle->end(); ++it) {
165  // also add recHits of dead TT if the corresponding TP is saturated
166  if (it->checkFlag(EcalRecHit::kTPSaturated)) {
167  indexToStore.push_back(it->id());
168  }
169  // add hits for severities above a threshold
170  if (severityLevel_ >= 0 && severity.severityLevel(*it) >= severityLevel_) {
171  indexToStore.push_back(it->id());
172  }
173  if (keepNextToDead_) {
175  // also keep channels next to dead ones
176  if (EcalTools::isNextToDead(it->id(), *dch)) {
177  indexToStore.push_back(it->id());
178  }
179  }
180 
181  if (keepNextToBoundary_) {
182  // keep channels around EB/EE boundary
183  if (it->id().subdetId() == EcalBarrel) {
184  EBDetId ebid(it->id());
185  if (abs(ebid.ieta()) == 85)
186  indexToStore.push_back(it->id());
187  } else {
189  indexToStore.push_back(it->id());
190  }
191  }
192  }
193  }
194 
195  //unify the vector
196  std::sort(indexToStore.begin(), indexToStore.end());
197  std::unique(indexToStore.begin(), indexToStore.end());
198 
199  iEvent.put(std::make_unique<DetIdCollection>(indexToStore), interestingDetIdCollection_);
200 }
edm::ESGetToken< EcalNextToDeadChannel, EcalNextToDeadChannelRcd > nextToDeadToken_
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
std::vector< EcalRecHit >::const_iterator const_iterator
int iEvent
Definition: GenABIO.cc:224
def unique(seq, keepstr=True)
Definition: tier0.py:24
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static bool isNextToRingBoundary(EEDetId id)
Definition: EEDetId.cc:284
edm::EDGetTokenT< EcalRecHitCollection > recHitsToken_
edm::ESGetToken< EcalSeverityLevelAlgo, EcalSeverityLevelAlgoRcd > sevLVToken_
const_iterator begin() const
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:130
const_iterator end() const
static bool isNextToDead(const DetId &id, const EcalNextToDeadChannel &es)
true if the channel is near a dead one (in the 3x3)
Definition: EcalTools.cc:54
Definition: DetId.h:17
iterator find(key_type k)
HLT enums.
edm::EDGetTokenT< reco::BasicClusterCollection > basicClustersToken_
edm::ESGetToken< CaloTopology, CaloTopologyRecord > caloTopologyToken_

Member Data Documentation

◆ basicClustersToken_

edm::EDGetTokenT<reco::BasicClusterCollection> InterestingDetIdCollectionProducer::basicClustersToken_
private

◆ caloTopologyToken_

edm::ESGetToken<CaloTopology, CaloTopologyRecord> InterestingDetIdCollectionProducer::caloTopologyToken_
private

◆ interestingDetIdCollection_

std::string InterestingDetIdCollectionProducer::interestingDetIdCollection_
private

◆ keepNextToBoundary_

bool InterestingDetIdCollectionProducer::keepNextToBoundary_
private

◆ keepNextToDead_

bool InterestingDetIdCollectionProducer::keepNextToDead_
private

◆ minimalEtaSize_

int InterestingDetIdCollectionProducer::minimalEtaSize_
private

◆ minimalPhiSize_

int InterestingDetIdCollectionProducer::minimalPhiSize_
private

◆ nextToDeadToken_

edm::ESGetToken<EcalNextToDeadChannel, EcalNextToDeadChannelRcd> InterestingDetIdCollectionProducer::nextToDeadToken_
private

◆ recHitsToken_

edm::EDGetTokenT<EcalRecHitCollection> InterestingDetIdCollectionProducer::recHitsToken_
private

◆ severityLevel_

int InterestingDetIdCollectionProducer::severityLevel_
private

◆ sevLVToken_

edm::ESGetToken<EcalSeverityLevelAlgo, EcalSeverityLevelAlgoRcd> InterestingDetIdCollectionProducer::sevLVToken_
private