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_
 
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)
 
- 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

Implementation: <Notes on="" implementation>="">

Definition at line 34 of file InterestingDetIdCollectionProducer.h.

Constructor & Destructor Documentation

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

ctor

Definition at line 24 of file InterestingDetIdCollectionProducer.cc.

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

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

Definition at line 44 of file InterestingDetIdCollectionProducer.cc.

45 {}

Member Function Documentation

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

Reimplemented from edm::EDProducer.

Definition at line 47 of file InterestingDetIdCollectionProducer.cc.

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

48 {
49  edm::ESHandle<CaloTopology> theCaloTopology;
50  iSetup.get<CaloTopologyRecord>().get(theCaloTopology);
51  caloTopology_ = &(*theCaloTopology);
52 
54  iSetup.get<EcalSeverityLevelAlgoRcd>().get(sevLv);
55  severity_ = sevLv.product();
56 }
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 60 of file InterestingDetIdCollectionProducer.cc.

References basicClusters_, caloTopology_, DetId::det(), jptDQMConfig_cff::eMax, CaloRecHit::energy(), spr::find(), edm::Event::getByLabel(), CaloTopology::getSubdetectorTopology(), CaloSubdetectorTopology::getWindow(), interestingDetIdCollection_, EcalRecHit::kTPSaturated, minimalEtaSize_, minimalPhiSize_, DetId::null(), edm::Event::put(), recHitsLabel_, severity_, EcalSeverityLevelAlgo::severityLevel(), severityLevel_, and DetId::subdetId().

62 {
63  using namespace edm;
64  using namespace std;
65 
66  // take BasicClusters
68  iEvent.getByLabel(basicClusters_, pClusters);
69 
70  // take EcalRecHits
71  Handle<EcalRecHitCollection> recHitsHandle;
72  iEvent.getByLabel(recHitsLabel_,recHitsHandle);
73 
74  //Create empty output collections
75  std::auto_ptr< DetIdCollection > detIdCollection (new DetIdCollection() ) ;
76 
77  reco::BasicClusterCollection::const_iterator clusIt;
78 
79  for (clusIt=pClusters->begin(); clusIt!=pClusters->end(); clusIt++) {
80  //PG barrel
81 
82  float eMax=0.;
83  DetId eMaxId(0);
84 
85  std::vector<std::pair<DetId,float> > clusterDetIds = (*clusIt).hitsAndFractions();
86  std::vector<std::pair<DetId,float> >::iterator posCurrent;
87 
88  EcalRecHit testEcalRecHit;
89 
90  for(posCurrent = clusterDetIds.begin(); posCurrent != clusterDetIds.end(); posCurrent++)
91  {
92  EcalRecHitCollection::const_iterator itt = recHitsHandle->find((*posCurrent).first);
93  if ((!((*posCurrent).first.null())) && (itt != recHitsHandle->end()) && ((*itt).energy() > eMax) )
94  {
95  eMax = (*itt).energy();
96  eMaxId = (*itt).id();
97  }
98  }
99 
100  if (eMaxId.null())
101  continue;
102 
103  const CaloSubdetectorTopology* topology = caloTopology_->getSubdetectorTopology(eMaxId.det(),eMaxId.subdetId());
104  std::vector<DetId> xtalsToStore=topology->getWindow(eMaxId,minimalEtaSize_,minimalPhiSize_);
105  std::vector<std::pair<DetId,float > > xtalsInClus=(*clusIt).hitsAndFractions();
106 
107  for (unsigned int ii=0;ii<xtalsInClus.size();ii++)
108  {
109  if (std::find(xtalsToStore.begin(),xtalsToStore.end(),xtalsInClus[ii].first) == xtalsToStore.end())
110  xtalsToStore.push_back(xtalsInClus[ii].first);
111  }
112 
113  for (unsigned int iCry=0;iCry<xtalsToStore.size();iCry++)
114  {
115  if (
116  std::find(detIdCollection->begin(),detIdCollection->end(),xtalsToStore[iCry]) == detIdCollection->end()
117  )
118  detIdCollection->push_back(xtalsToStore[iCry]);
119  }
120  }
121 
122  // also add recHits of dead TT if the corresponding TP is saturated
123  for (EcalRecHitCollection::const_iterator it = recHitsHandle->begin(); it != recHitsHandle->end(); ++it) {
124  if ( it->checkFlag(EcalRecHit::kTPSaturated) ) {
125  if ( std::find( detIdCollection->begin(), detIdCollection->end(), it->id() ) == detIdCollection->end()
126  ) {
127  detIdCollection->push_back( it->id() );
128  }
129  }else if ( severityLevel_>=0 && severity_->severityLevel(*it) >=severityLevel_){
130  detIdCollection->push_back( it->id() );
131  }
132 
133  }
134 
135  // std::cout << "Interesting DetId Collection size is " << detIdCollection->size() << " BCs are " << pClusters->size() << std::endl;
136  iEvent.put( detIdCollection, interestingDetIdCollection_ );
137 
138 }
std::vector< T >::const_iterator const_iterator
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
EcalSeverityLevel severityLevel(const DetId &id, const EcalRecHitCollection &rhs) const
Evaluate status from id.
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:84
float energy() const
Definition: CaloRecHit.h:19
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:355
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

Member Data Documentation

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

Definition at line 50 of file InterestingDetIdCollectionProducer.h.

Referenced by beginRun(), and produce().

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

Definition at line 53 of file InterestingDetIdCollectionProducer.h.

Referenced by beginRun(), and produce().

int InterestingDetIdCollectionProducer::severityLevel_
private