CMS 3D CMS Logo

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

Public Member Functions

 InterestingDetIdFromSuperClusterProducer (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 final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () 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 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< 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, EcalSeverityLevelAlgoRcdseverityLevelToken_
 
edm::EDGetTokenT< reco::SuperClusterCollectionsuperClustersToken_
 

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

Adapted from InterestingDetIdCollectionProducer by J.Bendavid

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

The following classes of "interesting id" are considered

1.All rechits included in all subclusters, plus in a region around  the seed of each subcluster
  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 49 of file InterestingDetIdFromSuperClusterProducer.cc.

Constructor & Destructor Documentation

◆ InterestingDetIdFromSuperClusterProducer()

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

ctor

Definition at line 75 of file InterestingDetIdFromSuperClusterProducer.cc.

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

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

Member Function Documentation

◆ produce()

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

producer

Implements edm::global::EDProducerBase.

Definition at line 100 of file InterestingDetIdFromSuperClusterProducer.cc.

References funct::abs(), edm::SortedCollection< T, SORT >::begin(), caloTopologyToken_, DetId::det(), EcalBarrel, cosmicPhotonAnalyzer_cfi::eMax, edm::SortedCollection< T, SORT >::end(), edm::SortedCollection< T, SORT >::find(), dqmdumpme::first, edm::EventSetup::getData(), edm::EventSetup::getHandle(), iEvent, cuy::ii, interestingDetIdCollection_, EcalTools::isNextToDead(), EEDetId::isNextToRingBoundary(), ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, keepNextToBoundary_, keepNextToDead_, EcalRecHit::kTPSaturated, minimalEtaSize_, minimalPhiSize_, eostools::move(), nextToDeadToken_, DetId::null(), recHitsToken_, ErrorSummaryFilter_cfi::severity, severityLevel_, severityLevelToken_, jetUpdater_cfi::sort, DetId::subdetId(), superClustersToken_, HLT_2024v12_cff::topology, and tier0::unique().

102  {
103  using namespace edm;
104  using namespace std;
105 
106  auto const& caloTopology = iSetup.getData(caloTopologyToken_);
107 
108  auto const& severity = iSetup.getData(severityLevelToken_);
109  // take BasicClusters
111  iEvent.getByToken(superClustersToken_, pClusters);
112 
113  // take EcalRecHits
114  Handle<EcalRecHitCollection> recHitsHandle;
115  iEvent.getByToken(recHitsToken_, recHitsHandle);
116 
117  //Create empty output collections
118  std::vector<DetId> indexToStore;
119  indexToStore.reserve(1000);
120 
121  reco::SuperClusterCollection::const_iterator sclusIt;
122 
123  std::vector<DetId> xtalsToStore;
124  xtalsToStore.reserve(50);
125 
126  //loop over superclusters
127  for (sclusIt = pClusters->begin(); sclusIt != pClusters->end(); sclusIt++) {
128  //loop over subclusters
129  for (reco::CaloCluster_iterator clusIt = sclusIt->clustersBegin(); clusIt != sclusIt->clustersEnd(); ++clusIt) {
130  //PG barrel
131 
132  float eMax = 0.;
133  DetId eMaxId(0);
134 
135  std::vector<std::pair<DetId, float> > clusterDetIds = (*clusIt)->hitsAndFractions();
136  std::vector<std::pair<DetId, float> >::iterator posCurrent;
137 
138  EcalRecHit testEcalRecHit;
139 
140  for (posCurrent = clusterDetIds.begin(); posCurrent != clusterDetIds.end(); posCurrent++) {
141  EcalRecHitCollection::const_iterator itt = recHitsHandle->find((*posCurrent).first);
142  if ((!((*posCurrent).first.null())) && (itt != recHitsHandle->end()) && ((*itt).energy() > eMax)) {
143  eMax = (*itt).energy();
144  eMaxId = (*itt).id();
145  }
146  }
147 
148  if (eMaxId.null())
149  continue;
150 
151  const CaloSubdetectorTopology* topology = caloTopology.getSubdetectorTopology(eMaxId.det(), eMaxId.subdetId());
152 
153  xtalsToStore = topology->getWindow(eMaxId, minimalEtaSize_, minimalPhiSize_);
154  std::vector<std::pair<DetId, float> > xtalsInClus = (*clusIt)->hitsAndFractions();
155 
156  for (unsigned int ii = 0; ii < xtalsInClus.size(); ii++) {
157  xtalsToStore.push_back(xtalsInClus[ii].first);
158  }
159 
160  indexToStore.insert(indexToStore.end(), xtalsToStore.begin(), xtalsToStore.end());
161  }
162  }
163 
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  //unify the vector
195  std::sort(indexToStore.begin(), indexToStore.end());
196  std::unique(indexToStore.begin(), indexToStore.end());
197 
198  auto detIdCollection = std::make_unique<DetIdCollection>(indexToStore);
199 
200  iEvent.put(std::move(detIdCollection), interestingDetIdCollection_);
201 }
edm::ESGetToken< CaloTopology, CaloTopologyRecord > caloTopologyToken_
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
const_iterator begin() const
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:130
ii
Definition: cuy.py:589
edm::ESGetToken< EcalNextToDeadChannel, EcalNextToDeadChannelRcd > nextToDeadToken_
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
edm::EDGetTokenT< reco::SuperClusterCollection > superClustersToken_
iterator find(key_type k)
HLT enums.
edm::ESGetToken< EcalSeverityLevelAlgo, EcalSeverityLevelAlgoRcd > severityLevelToken_
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ caloTopologyToken_

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

◆ interestingDetIdCollection_

std::string InterestingDetIdFromSuperClusterProducer::interestingDetIdCollection_
private

◆ keepNextToBoundary_

bool InterestingDetIdFromSuperClusterProducer::keepNextToBoundary_
private

◆ keepNextToDead_

bool InterestingDetIdFromSuperClusterProducer::keepNextToDead_
private

◆ minimalEtaSize_

int InterestingDetIdFromSuperClusterProducer::minimalEtaSize_
private

◆ minimalPhiSize_

int InterestingDetIdFromSuperClusterProducer::minimalPhiSize_
private

◆ nextToDeadToken_

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

◆ recHitsToken_

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

◆ severityLevel_

int InterestingDetIdFromSuperClusterProducer::severityLevel_
private

◆ severityLevelToken_

edm::ESGetToken<EcalSeverityLevelAlgo, EcalSeverityLevelAlgoRcd> InterestingDetIdFromSuperClusterProducer::severityLevelToken_
private

◆ superClustersToken_

edm::EDGetTokenT<reco::SuperClusterCollection> InterestingDetIdFromSuperClusterProducer::superClustersToken_
private