CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
InterestingDetIdFromSuperClusterProducer Class Reference
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
 
 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
 
const EDProduceroperator= (const EDProducer &)=delete
 

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<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::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 49 of file InterestingDetIdFromSuperClusterProducer.cc.

Constructor & Destructor Documentation

◆ InterestingDetIdFromSuperClusterProducer()

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

ctor

Definition at line 78 of file InterestingDetIdFromSuperClusterProducer.cc.

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

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

Member Function Documentation

◆ beginRun()

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

Definition at line 102 of file InterestingDetIdFromSuperClusterProducer.cc.

References caloTopology_, caloTopologyToken_, edm::EventSetup::getHandle(), edm::ESHandle< T >::product(), severity_, and severityLevelToken_.

102  {
103  edm::ESHandle<CaloTopology> theCaloTopology = iSetup.getHandle(caloTopologyToken_);
104  caloTopology_ = &(*theCaloTopology);
105 
107  severity_ = sevLv.product();
108 }
edm::ESGetToken< CaloTopology, CaloTopologyRecord > caloTopologyToken_
T const * product() const
Definition: ESHandle.h:86
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:151
edm::ESGetToken< EcalSeverityLevelAlgo, EcalSeverityLevelAlgoRcd > severityLevelToken_

◆ produce()

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

producer

Definition at line 111 of file InterestingDetIdFromSuperClusterProducer.cc.

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().

111  {
112  using namespace edm;
113  using namespace std;
114 
115  // take BasicClusters
117  iEvent.getByToken(superClustersToken_, pClusters);
118 
119  // take EcalRecHits
120  Handle<EcalRecHitCollection> recHitsHandle;
121  iEvent.getByToken(recHitsToken_, recHitsHandle);
122 
123  //Create empty output collections
124  std::vector<DetId> indexToStore;
125  indexToStore.reserve(1000);
126 
127  reco::SuperClusterCollection::const_iterator sclusIt;
128 
129  std::vector<DetId> xtalsToStore;
130  xtalsToStore.reserve(50);
131 
132  //loop over superclusters
133  for (sclusIt = pClusters->begin(); sclusIt != pClusters->end(); sclusIt++) {
134  //loop over subclusters
135  for (reco::CaloCluster_iterator clusIt = sclusIt->clustersBegin(); clusIt != sclusIt->clustersEnd(); ++clusIt) {
136  //PG barrel
137 
138  float eMax = 0.;
139  DetId eMaxId(0);
140 
141  std::vector<std::pair<DetId, float> > clusterDetIds = (*clusIt)->hitsAndFractions();
142  std::vector<std::pair<DetId, float> >::iterator posCurrent;
143 
144  EcalRecHit testEcalRecHit;
145 
146  for (posCurrent = clusterDetIds.begin(); posCurrent != clusterDetIds.end(); posCurrent++) {
147  EcalRecHitCollection::const_iterator itt = recHitsHandle->find((*posCurrent).first);
148  if ((!((*posCurrent).first.null())) && (itt != recHitsHandle->end()) && ((*itt).energy() > eMax)) {
149  eMax = (*itt).energy();
150  eMaxId = (*itt).id();
151  }
152  }
153 
154  if (eMaxId.null())
155  continue;
156 
157  const CaloSubdetectorTopology* topology = caloTopology_->getSubdetectorTopology(eMaxId.det(), eMaxId.subdetId());
158 
159  xtalsToStore = topology->getWindow(eMaxId, minimalEtaSize_, minimalPhiSize_);
160  std::vector<std::pair<DetId, float> > xtalsInClus = (*clusIt)->hitsAndFractions();
161 
162  for (unsigned int ii = 0; ii < xtalsInClus.size(); ii++) {
163  xtalsToStore.push_back(xtalsInClus[ii].first);
164  }
165 
166  indexToStore.insert(indexToStore.end(), xtalsToStore.begin(), xtalsToStore.end());
167  }
168  }
169 
170  for (EcalRecHitCollection::const_iterator it = recHitsHandle->begin(); it != recHitsHandle->end(); ++it) {
171  // also add recHits of dead TT if the corresponding TP is saturated
172  if (it->checkFlag(EcalRecHit::kTPSaturated)) {
173  indexToStore.push_back(it->id());
174  }
175  // add hits for severities above a threshold
176  if (severityLevel_ >= 0 && severity_->severityLevel(*it) >= severityLevel_) {
177  indexToStore.push_back(it->id());
178  }
179  if (keepNextToDead_) {
181  // also keep channels next to dead ones
182  if (EcalTools::isNextToDead(it->id(), *dch)) {
183  indexToStore.push_back(it->id());
184  }
185  }
186 
187  if (keepNextToBoundary_) {
188  // keep channels around EB/EE boundary
189  if (it->id().subdetId() == EcalBarrel) {
190  EBDetId ebid(it->id());
191  if (abs(ebid.ieta()) == 85)
192  indexToStore.push_back(it->id());
193  } else {
194  if (EEDetId::isNextToRingBoundary(it->id()))
195  indexToStore.push_back(it->id());
196  }
197  }
198  }
199 
200  //unify the vector
201  std::sort(indexToStore.begin(), indexToStore.end());
202  std::unique(indexToStore.begin(), indexToStore.end());
203 
204  auto detIdCollection = std::make_unique<DetIdCollection>(indexToStore);
205 
206  iEvent.put(std::move(detIdCollection), interestingDetIdCollection_);
207 }
std::vector< EcalRecHit >::const_iterator const_iterator
EcalSeverityLevel::SeverityLevel severityLevel(const DetId &id) const
Evaluate status from id use channelStatus from DB.
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
virtual std::vector< DetId > getWindow(const DetId &id, const int &northSouthSize, const int &eastWestSize) const
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:151
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
const CaloSubdetectorTopology * getSubdetectorTopology(const DetId &id) const
access the subdetector Topology for the given subdetector directly
Definition: CaloTopology.cc:17
edm::EDGetTokenT< reco::SuperClusterCollection > superClustersToken_
iterator find(key_type k)
HLT enums.
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ caloTopology_

const CaloTopology* InterestingDetIdFromSuperClusterProducer::caloTopology_
private

Definition at line 67 of file InterestingDetIdFromSuperClusterProducer.cc.

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 70 of file InterestingDetIdFromSuperClusterProducer.cc.

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