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
InterestingDetIdCollectionProducer Class Reference

#include <InterestingDetIdCollectionProducer.h>

Inheritance diagram for InterestingDetIdCollectionProducer:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

Public Member Functions

void beginRun (edm::Run &, const edm::EventSetup &)
 
 InterestingDetIdCollectionProducer (const edm::ParameterSet &)
 ctor More...
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 producer More...
 
 ~InterestingDetIdCollectionProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Private Attributes

edm::InputTag basicClusters_
 
const CaloTopologycaloTopology_
 
std::string interestingDetIdCollection_
 
bool keepNextToBoundary_
 
bool keepNextToDead_
 
int minimalEtaSize_
 
int minimalPhiSize_
 
edm::InputTag recHitsLabel_
 
const EcalSeverityLevelAlgoseverity_
 
int severityLevel_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

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

Constructor & Destructor Documentation

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

ctor

Definition at line 26 of file InterestingDetIdCollectionProducer.cc.

References basicClusters_, edm::ParameterSet::getParameter(), interestingDetIdCollection_, keepNextToBoundary_, keepNextToDead_, minimalEtaSize_, minimalPhiSize_, recHitsLabel_, and severityLevel_.

27 {
28 
29  recHitsLabel_ = iConfig.getParameter< edm::InputTag > ("recHitsLabel");
30  basicClusters_ = iConfig.getParameter< edm::InputTag > ("basicClustersLabel");
31 
32  interestingDetIdCollection_ = iConfig.getParameter<std::string>("interestingDetIdCollection");
33 
34  minimalEtaSize_ = iConfig.getParameter<int> ("etaSize");
35  minimalPhiSize_ = iConfig.getParameter<int> ("phiSize");
36  if ( minimalPhiSize_ % 2 == 0 || minimalEtaSize_ % 2 == 0)
37  edm::LogError("InterestingDetIdCollectionProducerError") << "Size of eta/phi should be odd numbers";
38 
39  //register your products
40  produces< DetIdCollection > (interestingDetIdCollection_) ;
41 
42  severityLevel_ = iConfig.getParameter<int>("severityLevel");
43  keepNextToDead_ = iConfig.getParameter<bool>("keepNextToDead");
44  keepNextToBoundary_ = iConfig.getParameter<bool>("keepNextToBoundary");
45 }
T getParameter(std::string const &) const
InterestingDetIdCollectionProducer::~InterestingDetIdCollectionProducer ( )

Definition at line 48 of file InterestingDetIdCollectionProducer.cc.

49 {}

Member Function Documentation

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

Reimplemented from edm::EDProducer.

Definition at line 51 of file InterestingDetIdCollectionProducer.cc.

References caloTopology_, edm::EventSetup::get(), edm::ESHandle< class >::product(), and severity_.

52 {
53  edm::ESHandle<CaloTopology> theCaloTopology;
54  iSetup.get<CaloTopologyRecord>().get(theCaloTopology);
55  caloTopology_ = &(*theCaloTopology);
56 
58  iSetup.get<EcalSeverityLevelAlgoRcd>().get(sevLv);
59  severity_ = sevLv.product();
60 }
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
void InterestingDetIdCollectionProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
virtual

producer

Implements edm::EDProducer.

Definition at line 64 of file InterestingDetIdCollectionProducer.cc.

References abs, basicClusters_, caloTopology_, DetId::det(), EcalBarrel, jptDQMConfig_cff::eMax, CaloRecHit::energy(), first, edm::Event::getByLabel(), CaloTopology::getSubdetectorTopology(), CaloSubdetectorTopology::getWindow(), interestingDetIdCollection_, EcalTools::isNextToDead(), EEDetId::isNextToRingBoundary(), keepNextToBoundary_, keepNextToDead_, EcalRecHit::kTPSaturated, minimalEtaSize_, minimalPhiSize_, DetId::null(), edm::Event::put(), recHitsLabel_, severity_, EcalSeverityLevelAlgo::severityLevel(), severityLevel_, python.multivaluedict::sort(), and DetId::subdetId().

66 {
67  using namespace edm;
68  using namespace std;
69 
70  // take BasicClusters
72  iEvent.getByLabel(basicClusters_, pClusters);
73 
74  // take EcalRecHits
75  Handle<EcalRecHitCollection> recHitsHandle;
76  iEvent.getByLabel(recHitsLabel_,recHitsHandle);
77 
78  //Create empty output collections
79  std::vector<DetId> indexToStore;
80  indexToStore.reserve(1000);
81 
82  reco::BasicClusterCollection::const_iterator clusIt;
83 
84  std::vector<DetId> xtalsToStore;
85  xtalsToStore.reserve(50);
86  for (clusIt=pClusters->begin(); clusIt!=pClusters->end(); 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  for (EcalRecHitCollection::const_iterator it = recHitsHandle->begin(); it != recHitsHandle->end(); ++it) {
126  // also add recHits of dead TT if the corresponding TP is saturated
127  if ( it->checkFlag(EcalRecHit::kTPSaturated) ) {
128  indexToStore.push_back(it->id());
129  }
130  // add hits for severities above a threshold
131  if ( severityLevel_>=0 &&
133 
134  indexToStore.push_back(it->id());
135  }
136  if (keepNextToDead_) {
137  // also keep channels next to dead ones
138  if (EcalTools::isNextToDead(it->id(), iSetup)) {
139  indexToStore.push_back(it->id());
140  }
141  }
142 
143  if (keepNextToBoundary_){
144  // keep channels around EB/EE boundary
145  if (it->id().subdetId() == EcalBarrel){
146  EBDetId ebid(it->id());
147  if (abs(ebid.ieta())== 85)
148  indexToStore.push_back(it->id());
149  } else {
150 
151  if (EEDetId::isNextToRingBoundary(it->id()))
152  indexToStore.push_back(it->id());
153  }
154 
155  }
156 
157  }
158 
159  //unify the vector
160  std::sort(indexToStore.begin(),indexToStore.end());
161  std::unique(indexToStore.begin(),indexToStore.end());
162 
163  std::auto_ptr< DetIdCollection > detIdCollection (new DetIdCollection(indexToStore) ) ;
164 
165 
166  iEvent.put( detIdCollection, interestingDetIdCollection_ );
167 
168 }
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:53
std::vector< EcalRecHit >::const_iterator const_iterator
#define abs(x)
Definition: mlp_lapack.h:159
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
float energy() const
Definition: CaloRecHit.h:19
static bool isNextToRingBoundary(EEDetId id)
Definition: EEDetId.cc:391
bool first
Definition: L1TdeRCT.cc:94
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
Definition: DetId.h:20
virtual std::vector< DetId > getWindow(const DetId &id, const int &northSouthSize, const int &eastWestSize) const
const CaloSubdetectorTopology * getSubdetectorTopology(const DetId &id) const
access the subdetector Topology for the given subdetector directly
Definition: CaloTopology.cc:26
edm::EDCollection< DetId > DetIdCollection
EcalSeverityLevel::SeverityLevel severityLevel(const DetId &id, const EcalRecHitCollection &rhs) const
Evaluate status from id.

Member Data Documentation

edm::InputTag InterestingDetIdCollectionProducer::basicClusters_
private
const CaloTopology* InterestingDetIdCollectionProducer::caloTopology_
private

Definition at line 61 of file InterestingDetIdCollectionProducer.h.

Referenced by beginRun(), and produce().

std::string InterestingDetIdCollectionProducer::interestingDetIdCollection_
private
bool InterestingDetIdCollectionProducer::keepNextToBoundary_
private
bool InterestingDetIdCollectionProducer::keepNextToDead_
private
int InterestingDetIdCollectionProducer::minimalEtaSize_
private
int InterestingDetIdCollectionProducer::minimalPhiSize_
private
edm::InputTag InterestingDetIdCollectionProducer::recHitsLabel_
private
const EcalSeverityLevelAlgo* InterestingDetIdCollectionProducer::severity_
private

Definition at line 64 of file InterestingDetIdCollectionProducer.h.

Referenced by beginRun(), and produce().

int InterestingDetIdCollectionProducer::severityLevel_
private