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 Member Functions | Private Attributes
HcalHitSelection Class Reference

#include <RecoLocalCalo/HcalHitSelection/src/HcalHitSelection.cc>

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

Public Member Functions

 HcalHitSelection (const edm::ParameterSet &)
 
 ~HcalHitSelection ()
 
- 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 Member Functions

virtual void beginJob ()
 
virtual void endJob ()
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
template<typename CollectionType >
void skim (const edm::Handle< CollectionType > &input, std::auto_ptr< CollectionType > &output)
 

Private Attributes

edm::InputTag hbheTag
 
edm::InputTag hfTag
 
edm::InputTag hoTag
 
std::vector< edm::InputTaginterestingDetIdCollections
 
edm::ESHandle< HcalChannelQualitytheHcalChStatus
 
edm::ESHandle
< HcalSeverityLevelComputer
theHcalSevLvlComputer
 
std::set< DetIdtoBeKept
 

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

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 47 of file HcalHitSelection.cc.

Constructor & Destructor Documentation

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

Definition at line 106 of file HcalHitSelection.cc.

References edm::ParameterSet::getParameter(), hbheTag, hfTag, hoTag, interestingDetIdCollections, and edm::InputTag::label().

107 {
108  hbheTag=iConfig.getParameter<edm::InputTag>("hbheTag");
109  hfTag=iConfig.getParameter<edm::InputTag>("hfTag");
110  hoTag=iConfig.getParameter<edm::InputTag>("hoTag");
111 
112  interestingDetIdCollections = iConfig.getParameter< std::vector<edm::InputTag> >("interestingDetIds");
113 
114  produces<HBHERecHitCollection>(hbheTag.label());
115  produces<HFRecHitCollection>(hfTag.label());
116  produces<HORecHitCollection>(hoTag.label());
117 
118 }
T getParameter(std::string const &) const
std::vector< edm::InputTag > interestingDetIdCollections
edm::InputTag hoTag
edm::InputTag hfTag
std::string const & label() const
Definition: InputTag.h:25
edm::InputTag hbheTag
HcalHitSelection::~HcalHitSelection ( )

Definition at line 121 of file HcalHitSelection.cc.

122 {
123 
124  // do anything here that needs to be done at desctruction time
125  // (e.g. close files, deallocate resources etc.)
126 
127 }

Member Function Documentation

void HcalHitSelection::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 177 of file HcalHitSelection.cc.

178 {
179 }
void HcalHitSelection::endJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 183 of file HcalHitSelection.cc.

183  {
184 }
void HcalHitSelection::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

Implements edm::EDProducer.

Definition at line 136 of file HcalHitSelection.cc.

References edm::EventSetup::get(), edm::Event::getByLabel(), hbheTag, hfTag, hoTag, interestingDetIdCollections, edm::HandleBase::isValid(), edm::InputTag::label(), edm::Event::put(), skim(), matplotRender::t, theHcalChStatus, theHcalSevLvlComputer, and toBeKept.

137 {
140 
144 
145  iEvent.getByLabel(hbheTag,hbhe);
146  iEvent.getByLabel(hfTag,hf);
147  iEvent.getByLabel(hoTag,ho);
148 
149  toBeKept.clear();
151  for( unsigned int t = 0; t < interestingDetIdCollections.size(); ++t )
152  {
154  if (!detId.isValid())
155  continue;
156  toBeKept.insert(detId->begin(),detId->end());
157  }
158 
159  std::auto_ptr<HBHERecHitCollection> hbhe_out(new HBHERecHitCollection());
160  skim(hbhe,hbhe_out);
161  iEvent.put(hbhe_out,hbheTag.label());
162 
163  std::auto_ptr<HFRecHitCollection> hf_out(new HFRecHitCollection());
164  skim(hf,hf_out);
165  iEvent.put(hf_out,hfTag.label());
166 
167  std::auto_ptr<HORecHitCollection> ho_out(new HORecHitCollection());
168  skim(ho,ho_out);
169  iEvent.put(ho_out,hoTag.label());
170 
171 
172 
173 }
void skim(const edm::Handle< CollectionType > &input, std::auto_ptr< CollectionType > &output)
std::vector< edm::InputTag > interestingDetIdCollections
std::set< DetId > toBeKept
edm::ESHandle< HcalChannelQuality > theHcalChStatus
edm::InputTag hoTag
edm::InputTag hfTag
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:84
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:359
edm::SortedCollection< HBHERecHit > HBHERecHitCollection
const T & get() const
Definition: EventSetup.h:55
std::string const & label() const
Definition: InputTag.h:25
edm::ESHandle< HcalSeverityLevelComputer > theHcalSevLvlComputer
edm::SortedCollection< HFRecHit > HFRecHitCollection
edm::InputTag hbheTag
edm::SortedCollection< HORecHit > HORecHitCollection
template<class CollectionType >
void HcalHitSelection::skim ( const edm::Handle< CollectionType > &  input,
std::auto_ptr< CollectionType > &  output 
)
private

Definition at line 69 of file HcalHitSelection.cc.

References begin, end, theHcalChStatus, theHcalSevLvlComputer, and toBeKept.

Referenced by produce().

69  {
70  output->reserve(input->size());
71  typename CollectionType::const_iterator begin=input->begin();
72  typename CollectionType::const_iterator end=input->end();
73  typename CollectionType::const_iterator hit=begin;
74 
75  for (;hit!=end;++hit){
76  // edm::LogError("HcalHitSelection")<<"the hit pointer is"<<&(*hit);
77  const DetId & id = hit->detid();
78  const uint32_t & recHitFlag = hit->flags();
79  // edm::LogError("HcalHitSelection")<<"the hit id and flag are "<<id.rawId()<<" "<<recHitFlag;
80 
81  const uint32_t & dbStatusFlag = theHcalChStatus->getValues(id)->getValue();
82  int severityLevel = theHcalSevLvlComputer->getSeverityLevel(id, recHitFlag, dbStatusFlag);
83  //anything that is not "good" goes in
84  if (severityLevel!=0){
85  output->push_back(*hit);
86  }else{
87  //chek on the detid list
88  if (toBeKept.find(id)!=toBeKept.end())
89  output->push_back(*hit);
90  }
91  }
92 }
std::set< DetId > toBeKept
edm::ESHandle< HcalChannelQuality > theHcalChStatus
#define end
Definition: vmac.h:38
Definition: DetId.h:20
edm::ESHandle< HcalSeverityLevelComputer > theHcalSevLvlComputer
#define begin
Definition: vmac.h:31

Member Data Documentation

edm::InputTag HcalHitSelection::hbheTag
private

Definition at line 57 of file HcalHitSelection.cc.

Referenced by HcalHitSelection(), and produce().

edm::InputTag HcalHitSelection::hfTag
private

Definition at line 57 of file HcalHitSelection.cc.

Referenced by HcalHitSelection(), and produce().

edm::InputTag HcalHitSelection::hoTag
private

Definition at line 57 of file HcalHitSelection.cc.

Referenced by HcalHitSelection(), and produce().

std::vector<edm::InputTag> HcalHitSelection::interestingDetIdCollections
private

Definition at line 58 of file HcalHitSelection.cc.

Referenced by HcalHitSelection(), and produce().

edm::ESHandle<HcalChannelQuality> HcalHitSelection::theHcalChStatus
private

Definition at line 61 of file HcalHitSelection.cc.

Referenced by produce(), and skim().

edm::ESHandle<HcalSeverityLevelComputer> HcalHitSelection::theHcalSevLvlComputer
private

Definition at line 62 of file HcalHitSelection.cc.

Referenced by produce(), and skim().

std::set<DetId> HcalHitSelection::toBeKept
private

Definition at line 63 of file HcalHitSelection.cc.

Referenced by produce(), and skim().