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 hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 

Private Attributes

const CaloTopologycaloTopology_
 
std::string interestingDetIdCollection_
 
bool keepNextToBoundary_
 
bool keepNextToDead_
 
int minimalEtaSize_
 
int minimalPhiSize_
 
edm::EDGetTokenT< EcalRecHitCollectionrecHitsToken_
 
const EcalSeverityLevelAlgoseverity_
 
int severityLevel_
 
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 47 of file InterestingDetIdFromSuperClusterProducer.h.

Constructor & Destructor Documentation

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

ctor

Definition at line 23 of file InterestingDetIdFromSuperClusterProducer.cc.

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

24 {
25 
26  recHitsToken_ =
27  consumes<EcalRecHitCollection>(iConfig.getParameter< edm::InputTag > ("recHitsLabel"));
29  consumes<reco::SuperClusterCollection>(iConfig.getParameter< edm::InputTag >("superClustersLabel"));
30 
31  interestingDetIdCollection_ = iConfig.getParameter<std::string>("interestingDetIdCollection");
32 
33  minimalEtaSize_ = iConfig.getParameter<int> ("etaSize");
34  minimalPhiSize_ = iConfig.getParameter<int> ("phiSize");
35  if ( minimalPhiSize_ % 2 == 0 || minimalEtaSize_ % 2 == 0)
36  edm::LogError("InterestingDetIdFromSuperClusterProducerError") << "Size of eta/phi should be odd numbers";
37 
38  //register your products
39  produces< DetIdCollection > (interestingDetIdCollection_) ;
40 
41  severityLevel_ = iConfig.getParameter<int>("severityLevel");
42  keepNextToDead_ = iConfig.getParameter<bool>("keepNextToDead");
43  keepNextToBoundary_ = iConfig.getParameter<bool>("keepNextToBoundary");
44 }
T getParameter(std::string const &) const
edm::EDGetTokenT< reco::SuperClusterCollection > superClustersToken_

Member Function Documentation

void InterestingDetIdFromSuperClusterProducer::beginRun ( edm::Run const &  run,
const edm::EventSetup iSetup 
)
final
void InterestingDetIdFromSuperClusterProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

producer

Definition at line 60 of file InterestingDetIdFromSuperClusterProducer.cc.

References funct::abs(), edm::SortedCollection< T, SORT >::begin(), caloTopology_, DetId::det(), EcalBarrel, photonPostprocessing_cfi::eMax, edm::SortedCollection< T, SORT >::end(), edm::SortedCollection< T, SORT >::find(), plotBeamSpotDB::first, edm::Event::getByToken(), CaloTopology::getSubdetectorTopology(), CaloSubdetectorTopology::getWindow(), cuy::ii, interestingDetIdCollection_, EcalTools::isNextToDead(), EEDetId::isNextToRingBoundary(), keepNextToBoundary_, keepNextToDead_, EcalRecHit::kTPSaturated, minimalEtaSize_, minimalPhiSize_, eostools::move(), DetId::null(), edm::Event::put(), recHitsToken_, severity_, EcalSeverityLevelAlgo::severityLevel(), severityLevel_, DetId::subdetId(), superClustersToken_, ecaldqm::topology(), and tier0::unique().

62 {
63  using namespace edm;
64  using namespace std;
65 
66  // take BasicClusters
68  iEvent.getByToken(superClustersToken_, pClusters);
69 
70  // take EcalRecHits
71  Handle<EcalRecHitCollection> recHitsHandle;
72  iEvent.getByToken(recHitsToken_,recHitsHandle);
73 
74  //Create empty output collections
75  std::vector<DetId> indexToStore;
76  indexToStore.reserve(1000);
77 
78  reco::SuperClusterCollection::const_iterator sclusIt;
79 
80  std::vector<DetId> xtalsToStore;
81  xtalsToStore.reserve(50);
82 
83  //loop over superclusters
84  for (sclusIt=pClusters->begin(); sclusIt!=pClusters->end(); sclusIt++) {
85  //loop over subclusters
86  for (reco::CaloCluster_iterator clusIt = sclusIt->clustersBegin(); clusIt!=sclusIt->clustersEnd(); ++clusIt) {
87  //PG barrel
88 
89  float eMax=0.;
90  DetId eMaxId(0);
91 
92  std::vector<std::pair<DetId,float> > clusterDetIds = (*clusIt)->hitsAndFractions();
93  std::vector<std::pair<DetId,float> >::iterator posCurrent;
94 
95  EcalRecHit testEcalRecHit;
96 
97  for(posCurrent = clusterDetIds.begin(); posCurrent != clusterDetIds.end(); posCurrent++)
98  {
99  EcalRecHitCollection::const_iterator itt = recHitsHandle->find((*posCurrent).first);
100  if ((!((*posCurrent).first.null())) && (itt != recHitsHandle->end()) && ((*itt).energy() > eMax) )
101  {
102  eMax = (*itt).energy();
103  eMaxId = (*itt).id();
104  }
105  }
106 
107  if (eMaxId.null())
108  continue;
109 
110  const CaloSubdetectorTopology* topology = caloTopology_->getSubdetectorTopology(eMaxId.det(),eMaxId.subdetId());
111 
112  xtalsToStore=topology->getWindow(eMaxId,minimalEtaSize_,minimalPhiSize_);
113  std::vector<std::pair<DetId,float > > xtalsInClus=(*clusIt)->hitsAndFractions();
114 
115  for (unsigned int ii=0;ii<xtalsInClus.size();ii++)
116  {
117  xtalsToStore.push_back(xtalsInClus[ii].first);
118  }
119 
120  indexToStore.insert(indexToStore.end(),xtalsToStore.begin(),xtalsToStore.end());
121  }
122  }
123 
124 
125 
126  for (EcalRecHitCollection::const_iterator it = recHitsHandle->begin(); it != recHitsHandle->end(); ++it) {
127  // also add recHits of dead TT if the corresponding TP is saturated
128  if ( it->checkFlag(EcalRecHit::kTPSaturated) ) {
129  indexToStore.push_back(it->id());
130  }
131  // add hits for severities above a threshold
132  if ( severityLevel_>=0 &&
134 
135  indexToStore.push_back(it->id());
136  }
137  if (keepNextToDead_) {
138  // also keep channels next to dead ones
139  if (EcalTools::isNextToDead(it->id(), iSetup)) {
140  indexToStore.push_back(it->id());
141  }
142  }
143 
144  if (keepNextToBoundary_){
145  // keep channels around EB/EE boundary
146  if (it->id().subdetId() == EcalBarrel){
147  EBDetId ebid(it->id());
148  if (abs(ebid.ieta())== 85)
149  indexToStore.push_back(it->id());
150  } else {
151 
152  if (EEDetId::isNextToRingBoundary(it->id()))
153  indexToStore.push_back(it->id());
154  }
155 
156  }
157 
158  }
159 
160  //unify the vector
161  std::sort(indexToStore.begin(),indexToStore.end());
162  std::unique(indexToStore.begin(),indexToStore.end());
163 
164  auto detIdCollection = std::make_unique<DetIdCollection>(indexToStore);
165 
166 
167  iEvent.put(std::move(detIdCollection), interestingDetIdCollection_ );
168 
169 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:125
static bool isNextToDead(const DetId &id, const edm::EventSetup &es)
true if the channel is near a dead one (in the 3x3)
Definition: EcalTools.cc:52
EcalSeverityLevel::SeverityLevel severityLevel(const DetId &id) const
Evaluate status from id use channelStatus from DB.
CaloTopology const * topology(0)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
std::vector< EcalRecHit >::const_iterator const_iterator
def unique(seq, keepstr=True)
Definition: tier0.py:25
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static bool isNextToRingBoundary(EEDetId id)
Definition: EEDetId.cc:284
ii
Definition: cuy.py:590
const_iterator end() const
Definition: DetId.h:18
virtual std::vector< DetId > getWindow(const DetId &id, const int &northSouthSize, const int &eastWestSize) const
edm::EDGetTokenT< reco::SuperClusterCollection > superClustersToken_
const CaloSubdetectorTopology * getSubdetectorTopology(const DetId &id) const
access the subdetector Topology for the given subdetector directly
Definition: CaloTopology.cc:20
iterator find(key_type k)
HLT enums.
def move(src, dest)
Definition: eostools.py:511
const_iterator begin() const

Member Data Documentation

const CaloTopology* InterestingDetIdFromSuperClusterProducer::caloTopology_
private

Definition at line 62 of file InterestingDetIdFromSuperClusterProducer.h.

Referenced by beginRun(), and produce().

std::string InterestingDetIdFromSuperClusterProducer::interestingDetIdCollection_
private
bool InterestingDetIdFromSuperClusterProducer::keepNextToBoundary_
private
bool InterestingDetIdFromSuperClusterProducer::keepNextToDead_
private
int InterestingDetIdFromSuperClusterProducer::minimalEtaSize_
private
int InterestingDetIdFromSuperClusterProducer::minimalPhiSize_
private
edm::EDGetTokenT<EcalRecHitCollection> InterestingDetIdFromSuperClusterProducer::recHitsToken_
private
const EcalSeverityLevelAlgo* InterestingDetIdFromSuperClusterProducer::severity_
private

Definition at line 65 of file InterestingDetIdFromSuperClusterProducer.h.

Referenced by beginRun(), and produce().

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