CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
InterestingDetIdFromSuperClusterProducer Class Reference

#include <InterestingDetIdFromSuperClusterProducer.h>

Inheritance diagram for InterestingDetIdFromSuperClusterProducer:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

virtual void beginRun (edm::Run const &, const edm::EventSetup &) overridefinal
 
 InterestingDetIdFromSuperClusterProducer (const edm::ParameterSet &)
 ctor More...
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 producer More...
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

const CaloTopologycaloTopology_
 
std::string interestingDetIdCollection_
 
bool keepNextToBoundary_
 
bool keepNextToDead_
 
int minimalEtaSize_
 
int minimalPhiSize_
 
edm::EDGetTokenT
< EcalRecHitCollection
recHitsToken_
 
const EcalSeverityLevelAlgoseverity_
 
int severityLevel_
 
edm::EDGetTokenT
< reco::SuperClusterCollection
superClustersToken_
 

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, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
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 ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
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)
 

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 
)
finaloverridevirtual
void InterestingDetIdFromSuperClusterProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
virtual

producer

Implements edm::stream::EDProducerBase.

Definition at line 60 of file InterestingDetIdFromSuperClusterProducer.cc.

References funct::abs(), caloTopology_, DetId::det(), EcalBarrel, EcalRecHit::energy(), plotBeamSpotDB::first, edm::Event::getByToken(), CaloTopology::getSubdetectorTopology(), CaloSubdetectorTopology::getWindow(), cuy::ii, interestingDetIdCollection_, EcalTools::isNextToDead(), EEDetId::isNextToRingBoundary(), keepNextToBoundary_, keepNextToDead_, EcalRecHit::kTPSaturated, minimalEtaSize_, minimalPhiSize_, DetId::null(), edm::Event::put(), recHitsToken_, severity_, EcalSeverityLevelAlgo::severityLevel(), severityLevel_, DetId::subdetId(), superClustersToken_, and ecaldqm::topology().

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  std::auto_ptr< DetIdCollection > detIdCollection (new DetIdCollection(indexToStore) ) ;
165 
166 
167  iEvent.put( detIdCollection, interestingDetIdCollection_ );
168 
169 }
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:462
std::vector< EcalRecHit >::const_iterator const_iterator
int ii
Definition: cuy.py:588
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static bool isNextToRingBoundary(EEDetId id)
Definition: EEDetId.cc:375
float energy() const
Definition: EcalRecHit.h:68
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:26
edm::EDCollection< DetId > DetIdCollection

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