CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
InterestingDetIdFromSuperClusterProducer Class Reference

#include <InterestingDetIdFromSuperClusterProducer.h>

Inheritance diagram for InterestingDetIdFromSuperClusterProducer:
edm::stream::EDProducer<>

Public Member Functions

void beginRun (edm::Run const &, const edm::EventSetup &) final
 
 InterestingDetIdFromSuperClusterProducer (const edm::ParameterSet &)
 ctor More...
 
void produce (edm::Event &, const edm::EventSetup &) override
 producer More...
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Private Attributes

const CaloTopologycaloTopology_
 
edm::ESGetToken< CaloTopology, CaloTopologyRecordcaloTopologyToken_
 
std::string interestingDetIdCollection_
 
bool keepNextToBoundary_
 
bool keepNextToDead_
 
int minimalEtaSize_
 
int minimalPhiSize_
 
edm::ESGetToken< EcalNextToDeadChannel, EcalNextToDeadChannelRcdnextToDeadToken_
 
edm::EDGetTokenT< EcalRecHitCollectionrecHitsToken_
 
const EcalSeverityLevelAlgoseverity_
 
int severityLevel_
 
edm::ESGetToken< EcalSeverityLevelAlgo, EcalSeverityLevelAlgoRcdseverityLevelToken_
 
edm::EDGetTokenT< reco::SuperClusterCollectionsuperClustersToken_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

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 52 of file InterestingDetIdFromSuperClusterProducer.h.

Constructor & Destructor Documentation

◆ InterestingDetIdFromSuperClusterProducer()

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

ctor

Definition at line 15 of file InterestingDetIdFromSuperClusterProducer.cc.

15  {
16  recHitsToken_ = consumes<EcalRecHitCollection>(iConfig.getParameter<edm::InputTag>("recHitsLabel"));
18  consumes<reco::SuperClusterCollection>(iConfig.getParameter<edm::InputTag>("superClustersLabel"));
19  caloTopologyToken_ = esConsumes<CaloTopology, CaloTopologyRecord, edm::Transition::BeginRun>();
20  severityLevelToken_ = esConsumes<EcalSeverityLevelAlgo, EcalSeverityLevelAlgoRcd, edm::Transition::BeginRun>();
21  interestingDetIdCollection_ = iConfig.getParameter<std::string>("interestingDetIdCollection");
22 
23  minimalEtaSize_ = iConfig.getParameter<int>("etaSize");
24  minimalPhiSize_ = iConfig.getParameter<int>("phiSize");
25  if (minimalPhiSize_ % 2 == 0 || minimalEtaSize_ % 2 == 0)
26  edm::LogError("InterestingDetIdFromSuperClusterProducerError") << "Size of eta/phi should be odd numbers";
27 
28  //register your products
29  produces<DetIdCollection>(interestingDetIdCollection_);
30 
31  severityLevel_ = iConfig.getParameter<int>("severityLevel");
32  keepNextToDead_ = iConfig.getParameter<bool>("keepNextToDead");
33  keepNextToBoundary_ = iConfig.getParameter<bool>("keepNextToBoundary");
34  if (keepNextToDead_) {
35  nextToDeadToken_ = esConsumes<EcalNextToDeadChannel, EcalNextToDeadChannelRcd>();
36  }
37 }

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

Member Function Documentation

◆ beginRun()

void InterestingDetIdFromSuperClusterProducer::beginRun ( edm::Run const &  run,
const edm::EventSetup iSetup 
)
final

◆ produce()

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

producer

Definition at line 48 of file InterestingDetIdFromSuperClusterProducer.cc.

48  {
49  using namespace edm;
50  using namespace std;
51 
52  // take BasicClusters
54  iEvent.getByToken(superClustersToken_, pClusters);
55 
56  // take EcalRecHits
57  Handle<EcalRecHitCollection> recHitsHandle;
58  iEvent.getByToken(recHitsToken_, recHitsHandle);
59 
60  //Create empty output collections
61  std::vector<DetId> indexToStore;
62  indexToStore.reserve(1000);
63 
64  reco::SuperClusterCollection::const_iterator sclusIt;
65 
66  std::vector<DetId> xtalsToStore;
67  xtalsToStore.reserve(50);
68 
69  //loop over superclusters
70  for (sclusIt = pClusters->begin(); sclusIt != pClusters->end(); sclusIt++) {
71  //loop over subclusters
72  for (reco::CaloCluster_iterator clusIt = sclusIt->clustersBegin(); clusIt != sclusIt->clustersEnd(); ++clusIt) {
73  //PG barrel
74 
75  float eMax = 0.;
76  DetId eMaxId(0);
77 
78  std::vector<std::pair<DetId, float> > clusterDetIds = (*clusIt)->hitsAndFractions();
79  std::vector<std::pair<DetId, float> >::iterator posCurrent;
80 
81  EcalRecHit testEcalRecHit;
82 
83  for (posCurrent = clusterDetIds.begin(); posCurrent != clusterDetIds.end(); posCurrent++) {
84  EcalRecHitCollection::const_iterator itt = recHitsHandle->find((*posCurrent).first);
85  if ((!((*posCurrent).first.null())) && (itt != recHitsHandle->end()) && ((*itt).energy() > eMax)) {
86  eMax = (*itt).energy();
87  eMaxId = (*itt).id();
88  }
89  }
90 
91  if (eMaxId.null())
92  continue;
93 
94  const CaloSubdetectorTopology* topology = caloTopology_->getSubdetectorTopology(eMaxId.det(), eMaxId.subdetId());
95 
96  xtalsToStore = topology->getWindow(eMaxId, minimalEtaSize_, minimalPhiSize_);
97  std::vector<std::pair<DetId, float> > xtalsInClus = (*clusIt)->hitsAndFractions();
98 
99  for (unsigned int ii = 0; ii < xtalsInClus.size(); ii++) {
100  xtalsToStore.push_back(xtalsInClus[ii].first);
101  }
102 
103  indexToStore.insert(indexToStore.end(), xtalsToStore.begin(), xtalsToStore.end());
104  }
105  }
106 
107  for (EcalRecHitCollection::const_iterator it = recHitsHandle->begin(); it != recHitsHandle->end(); ++it) {
108  // also add recHits of dead TT if the corresponding TP is saturated
109  if (it->checkFlag(EcalRecHit::kTPSaturated)) {
110  indexToStore.push_back(it->id());
111  }
112  // add hits for severities above a threshold
113  if (severityLevel_ >= 0 && severity_->severityLevel(*it) >= severityLevel_) {
114  indexToStore.push_back(it->id());
115  }
116  if (keepNextToDead_) {
118  // also keep channels next to dead ones
119  if (EcalTools::isNextToDead(it->id(), *dch)) {
120  indexToStore.push_back(it->id());
121  }
122  }
123 
124  if (keepNextToBoundary_) {
125  // keep channels around EB/EE boundary
126  if (it->id().subdetId() == EcalBarrel) {
127  EBDetId ebid(it->id());
128  if (abs(ebid.ieta()) == 85)
129  indexToStore.push_back(it->id());
130  } else {
131  if (EEDetId::isNextToRingBoundary(it->id()))
132  indexToStore.push_back(it->id());
133  }
134  }
135  }
136 
137  //unify the vector
138  std::sort(indexToStore.begin(), indexToStore.end());
139  std::unique(indexToStore.begin(), indexToStore.end());
140 
141  auto detIdCollection = std::make_unique<DetIdCollection>(indexToStore);
142 
143  iEvent.put(std::move(detIdCollection), interestingDetIdCollection_);
144 }

References funct::abs(), edm::SortedCollection< T, SORT >::begin(), caloTopology_, DetId::det(), EcalBarrel, cosmicPhotonAnalyzer_cfi::eMax, edm::SortedCollection< T, SORT >::end(), edm::SortedCollection< T, SORT >::find(), first, edm::EventSetup::getHandle(), CaloTopology::getSubdetectorTopology(), CaloSubdetectorTopology::getWindow(), iEvent, cuy::ii, interestingDetIdCollection_, EcalTools::isNextToDead(), EEDetId::isNextToRingBoundary(), keepNextToBoundary_, keepNextToDead_, EcalRecHit::kTPSaturated, minimalEtaSize_, minimalPhiSize_, eostools::move(), nextToDeadToken_, DetId::null(), recHitsToken_, severity_, EcalSeverityLevelAlgo::severityLevel(), severityLevel_, jetUpdater_cfi::sort, DetId::subdetId(), superClustersToken_, and tier0::unique().

Member Data Documentation

◆ caloTopology_

const CaloTopology* InterestingDetIdFromSuperClusterProducer::caloTopology_
private

Definition at line 70 of file InterestingDetIdFromSuperClusterProducer.h.

Referenced by beginRun(), and produce().

◆ 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

◆ severity_

const EcalSeverityLevelAlgo* InterestingDetIdFromSuperClusterProducer::severity_
private

Definition at line 73 of file InterestingDetIdFromSuperClusterProducer.h.

Referenced by beginRun(), and produce().

◆ severityLevel_

int InterestingDetIdFromSuperClusterProducer::severityLevel_
private

◆ severityLevelToken_

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

◆ superClustersToken_

edm::EDGetTokenT<reco::SuperClusterCollection> InterestingDetIdFromSuperClusterProducer::superClustersToken_
private
InterestingDetIdFromSuperClusterProducer::keepNextToDead_
bool keepNextToDead_
Definition: InterestingDetIdFromSuperClusterProducer.h:74
InterestingDetIdFromSuperClusterProducer::caloTopology_
const CaloTopology * caloTopology_
Definition: InterestingDetIdFromSuperClusterProducer.h:70
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
InterestingDetIdFromSuperClusterProducer::nextToDeadToken_
edm::ESGetToken< EcalNextToDeadChannel, EcalNextToDeadChannelRcd > nextToDeadToken_
Definition: InterestingDetIdFromSuperClusterProducer.h:66
EcalRecHit
Definition: EcalRecHit.h:15
EcalRecHit::kTPSaturated
Definition: EcalRecHit.h:33
edm::SortedCollection< EcalRecHit >::const_iterator
std::vector< EcalRecHit >::const_iterator const_iterator
Definition: SortedCollection.h:80
InterestingDetIdFromSuperClusterProducer::superClustersToken_
edm::EDGetTokenT< reco::SuperClusterCollection > superClustersToken_
Definition: InterestingDetIdFromSuperClusterProducer.h:63
EcalSeverityLevelAlgo::severityLevel
EcalSeverityLevel::SeverityLevel severityLevel(const DetId &id) const
Evaluate status from id use channelStatus from DB.
Definition: EcalSeverityLevelAlgo.cc:85
EBDetId
Definition: EBDetId.h:17
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::PtrVectorItr
Definition: PtrVector.h:51
InterestingDetIdFromSuperClusterProducer::interestingDetIdCollection_
std::string interestingDetIdCollection_
Definition: InterestingDetIdFromSuperClusterProducer.h:67
InterestingDetIdFromSuperClusterProducer::minimalEtaSize_
int minimalEtaSize_
Definition: InterestingDetIdFromSuperClusterProducer.h:68
edm::Handle
Definition: AssociativeIterator.h:50
EcalBarrel
Definition: EcalSubdetector.h:10
InterestingDetIdFromSuperClusterProducer::keepNextToBoundary_
bool keepNextToBoundary_
Definition: InterestingDetIdFromSuperClusterProducer.h:75
InterestingDetIdFromSuperClusterProducer::severityLevelToken_
edm::ESGetToken< EcalSeverityLevelAlgo, EcalSeverityLevelAlgoRcd > severityLevelToken_
Definition: InterestingDetIdFromSuperClusterProducer.h:65
DetId
Definition: DetId.h:17
EcalTools::isNextToDead
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
edm::SortedCollection::begin
const_iterator begin() const
Definition: SortedCollection.h:262
edm::ESHandle< CaloTopology >
InterestingDetIdFromSuperClusterProducer::severityLevel_
int severityLevel_
Definition: InterestingDetIdFromSuperClusterProducer.h:72
first
auto first
Definition: CAHitNtupletGeneratorKernelsImpl.h:112
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
InterestingDetIdFromSuperClusterProducer::caloTopologyToken_
edm::ESGetToken< CaloTopology, CaloTopologyRecord > caloTopologyToken_
Definition: InterestingDetIdFromSuperClusterProducer.h:64
EEDetId::isNextToRingBoundary
static bool isNextToRingBoundary(EEDetId id)
Definition: EEDetId.cc:284
cosmicPhotonAnalyzer_cfi.eMax
eMax
Definition: cosmicPhotonAnalyzer_cfi.py:10
edm::SortedCollection::end
const_iterator end() const
Definition: SortedCollection.h:267
jetUpdater_cfi.sort
sort
Definition: jetUpdater_cfi.py:29
CaloTopology::getSubdetectorTopology
const CaloSubdetectorTopology * getSubdetectorTopology(const DetId &id) const
access the subdetector Topology for the given subdetector directly
Definition: CaloTopology.cc:17
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::EventSetup::getHandle
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:155
CaloSubdetectorTopology
Definition: CaloSubdetectorTopology.h:17
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
InterestingDetIdFromSuperClusterProducer::severity_
const EcalSeverityLevelAlgo * severity_
Definition: InterestingDetIdFromSuperClusterProducer.h:73
CaloSubdetectorTopology::getWindow
virtual std::vector< DetId > getWindow(const DetId &id, const int &northSouthSize, const int &eastWestSize) const
Definition: CaloSubdetectorTopology.cc:4
edm::SortedCollection::find
iterator find(key_type k)
Definition: SortedCollection.h:240
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
tier0.unique
def unique(seq, keepstr=True)
Definition: tier0.py:24
InterestingDetIdFromSuperClusterProducer::recHitsToken_
edm::EDGetTokenT< EcalRecHitCollection > recHitsToken_
Definition: InterestingDetIdFromSuperClusterProducer.h:62
InterestingDetIdFromSuperClusterProducer::minimalPhiSize_
int minimalPhiSize_
Definition: InterestingDetIdFromSuperClusterProducer.h:69
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
cuy.ii
ii
Definition: cuy.py:590
edm::InputTag
Definition: InputTag.h:15