CMS 3D CMS Logo

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

#include <InterestingDetIdCollectionProducer.h>

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

Public Member Functions

void beginRun (edm::Run const &, const edm::EventSetup &) final
 
 InterestingDetIdCollectionProducer (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

edm::EDGetTokenT< reco::BasicClusterCollectionbasicClustersToken_
 
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, EcalSeverityLevelAlgoRcdsevLVToken_
 

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

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

Constructor & Destructor Documentation

◆ InterestingDetIdCollectionProducer()

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

ctor

Definition at line 15 of file InterestingDetIdCollectionProducer.cc.

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

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

Member Function Documentation

◆ beginRun()

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

◆ produce()

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

producer

Definition at line 47 of file InterestingDetIdCollectionProducer.cc.

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

References funct::abs(), basicClustersToken_, edm::SortedCollection< T, SORT >::begin(), caloTopology_, DetId::det(), EcalBarrel, EcalEndcap, cosmicPhotonAnalyzer_cfi::eMax, edm::SortedCollection< T, SORT >::end(), edm::SortedCollection< T, SORT >::find(), edm::EventSetup::getHandle(), CaloTopology::getSubdetectorTopology(), CaloTopology::getWindow(), iEvent, interestingDetIdCollection_, EcalTools::isNextToDead(), EEDetId::isNextToRingBoundary(), keepNextToBoundary_, keepNextToDead_, EcalRecHit::kTPSaturated, minimalEtaSize_, minimalPhiSize_, nextToDeadToken_, DetId::null(), recHitsToken_, severity_, EcalSeverityLevelAlgo::severityLevel(), severityLevel_, DetId::subdetId(), ecaldqm::topology(), and tier0::unique().

Member Data Documentation

◆ basicClustersToken_

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

◆ caloTopology_

const CaloTopology* InterestingDetIdCollectionProducer::caloTopology_
private

Definition at line 71 of file InterestingDetIdCollectionProducer.h.

Referenced by beginRun(), and produce().

◆ 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

◆ severity_

const EcalSeverityLevelAlgo* InterestingDetIdCollectionProducer::severity_
private

Definition at line 74 of file InterestingDetIdCollectionProducer.h.

Referenced by beginRun(), and produce().

◆ severityLevel_

int InterestingDetIdCollectionProducer::severityLevel_
private

◆ sevLVToken_

edm::ESGetToken<EcalSeverityLevelAlgo, EcalSeverityLevelAlgoRcd> InterestingDetIdCollectionProducer::sevLVToken_
private
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
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
EcalSeverityLevelAlgo::severityLevel
EcalSeverityLevel::SeverityLevel severityLevel(const DetId &id) const
Evaluate status from id use channelStatus from DB.
Definition: EcalSeverityLevelAlgo.cc:85
InterestingDetIdCollectionProducer::caloTopology_
const CaloTopology * caloTopology_
Definition: InterestingDetIdCollectionProducer.h:71
EBDetId
Definition: EBDetId.h:17
edm
HLT enums.
Definition: AlignableModifier.h:19
CaloTopology::getWindow
std::vector< DetId > getWindow(const DetId &id, const int &northSouthSize, const int &eastWestSize) const
Get the neighbors of the given cell in a window of given size.
Definition: CaloTopology.cc:64
InterestingDetIdCollectionProducer::severityLevel_
int severityLevel_
Definition: InterestingDetIdCollectionProducer.h:73
InterestingDetIdCollectionProducer::recHitsToken_
edm::EDGetTokenT< EcalRecHitCollection > recHitsToken_
Definition: InterestingDetIdCollectionProducer.h:62
edm::Handle
Definition: AssociativeIterator.h:50
InterestingDetIdCollectionProducer::sevLVToken_
edm::ESGetToken< EcalSeverityLevelAlgo, EcalSeverityLevelAlgoRcd > sevLVToken_
Definition: InterestingDetIdCollectionProducer.h:65
EcalBarrel
Definition: EcalSubdetector.h:10
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
ecaldqm::topology
const CaloTopology * topology(nullptr)
edm::SortedCollection::begin
const_iterator begin() const
Definition: SortedCollection.h:262
edm::ESHandle< CaloTopology >
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
EcalEndcap
Definition: EcalSubdetector.h:10
EEDetId::isNextToRingBoundary
static bool isNextToRingBoundary(EEDetId id)
Definition: EEDetId.cc:284
cosmicPhotonAnalyzer_cfi.eMax
eMax
Definition: cosmicPhotonAnalyzer_cfi.py:10
InterestingDetIdCollectionProducer::keepNextToBoundary_
bool keepNextToBoundary_
Definition: InterestingDetIdCollectionProducer.h:76
edm::SortedCollection::end
const_iterator end() const
Definition: SortedCollection.h:267
CaloTopology::getSubdetectorTopology
const CaloSubdetectorTopology * getSubdetectorTopology(const DetId &id) const
access the subdetector Topology for the given subdetector directly
Definition: CaloTopology.cc:17
InterestingDetIdCollectionProducer::interestingDetIdCollection_
std::string interestingDetIdCollection_
Definition: InterestingDetIdCollectionProducer.h:68
iEvent
int iEvent
Definition: GenABIO.cc:224
InterestingDetIdCollectionProducer::caloTopologyToken_
edm::ESGetToken< CaloTopology, CaloTopologyRecord > caloTopologyToken_
Definition: InterestingDetIdCollectionProducer.h:64
edm::EventSetup::getHandle
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:148
InterestingDetIdCollectionProducer::basicClustersToken_
edm::EDGetTokenT< reco::BasicClusterCollection > basicClustersToken_
Definition: InterestingDetIdCollectionProducer.h:63
CaloSubdetectorTopology
Definition: CaloSubdetectorTopology.h:17
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
InterestingDetIdCollectionProducer::nextToDeadToken_
edm::ESGetToken< EcalNextToDeadChannel, EcalNextToDeadChannelRcd > nextToDeadToken_
Definition: InterestingDetIdCollectionProducer.h:66
edm::SortedCollection::find
iterator find(key_type k)
Definition: SortedCollection.h:240
std
Definition: JetResolutionObject.h:76
tier0.unique
def unique(seq, keepstr=True)
Definition: tier0.py:24
InterestingDetIdCollectionProducer::minimalPhiSize_
int minimalPhiSize_
Definition: InterestingDetIdCollectionProducer.h:70
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
InterestingDetIdCollectionProducer::minimalEtaSize_
int minimalEtaSize_
Definition: InterestingDetIdCollectionProducer.h:69
InterestingDetIdCollectionProducer::keepNextToDead_
bool keepNextToDead_
Definition: InterestingDetIdCollectionProducer.h:75
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
edm::InputTag
Definition: InputTag.h:15
InterestingDetIdCollectionProducer::severity_
const EcalSeverityLevelAlgo * severity_
Definition: InterestingDetIdCollectionProducer.h:74