#include <RecoLocalCalo/HcalHitSelection/src/HcalHitSelection.cc>
Public Member Functions | |
HcalHitSelection (const edm::ParameterSet &) | |
~HcalHitSelection () | |
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, int severityThreshold=0) |
Private Attributes | |
edm::InputTag | hbheTag |
edm::InputTag | hfTag |
int | hoSeverityLevel |
edm::InputTag | hoTag |
std::vector< edm::InputTag > | interestingDetIdCollections |
edm::ESHandle< HcalChannelQuality > | theHcalChStatus |
edm::ESHandle < HcalSeverityLevelComputer > | theHcalSevLvlComputer |
std::set< DetId > | toBeKept |
Description: [one line class summary]
Implementation: [Notes on implementation]
Definition at line 47 of file HcalHitSelection.cc.
HcalHitSelection::HcalHitSelection | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 107 of file HcalHitSelection.cc.
References edm::ParameterSet::getParameter(), hbheTag, hfTag, hoSeverityLevel, hoTag, interestingDetIdCollections, and edm::InputTag::label().
{ hbheTag=iConfig.getParameter<edm::InputTag>("hbheTag"); hfTag=iConfig.getParameter<edm::InputTag>("hfTag"); hoTag=iConfig.getParameter<edm::InputTag>("hoTag"); interestingDetIdCollections = iConfig.getParameter< std::vector<edm::InputTag> >("interestingDetIds"); hoSeverityLevel=iConfig.getParameter<int>("hoSeverityLevel"); produces<HBHERecHitCollection>(hbheTag.label()); produces<HFRecHitCollection>(hfTag.label()); produces<HORecHitCollection>(hoTag.label()); }
HcalHitSelection::~HcalHitSelection | ( | ) |
Definition at line 124 of file HcalHitSelection.cc.
{ // do anything here that needs to be done at desctruction time // (e.g. close files, deallocate resources etc.) }
void HcalHitSelection::beginJob | ( | void | ) | [private, virtual] |
void HcalHitSelection::endJob | ( | void | ) | [private, virtual] |
void HcalHitSelection::produce | ( | edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [private, virtual] |
Implements edm::EDProducer.
Definition at line 139 of file HcalHitSelection.cc.
References edm::EventSetup::get(), edm::Event::getByLabel(), hbheTag, hfTag, hoSeverityLevel, hoTag, interestingDetIdCollections, edm::HandleBase::isValid(), edm::InputTag::label(), edm::Event::put(), skim(), lumiQTWidget::t, theHcalChStatus, theHcalSevLvlComputer, and toBeKept.
{ iSetup.get<HcalChannelQualityRcd>().get(theHcalChStatus); iSetup.get<HcalSeverityLevelComputerRcd>().get(theHcalSevLvlComputer); edm::Handle<HBHERecHitCollection> hbhe; edm::Handle<HFRecHitCollection> hf; edm::Handle<HORecHitCollection> ho; iEvent.getByLabel(hbheTag,hbhe); iEvent.getByLabel(hfTag,hf); iEvent.getByLabel(hoTag,ho); toBeKept.clear(); edm::Handle<DetIdCollection > detId; for( unsigned int t = 0; t < interestingDetIdCollections.size(); ++t ) { iEvent.getByLabel(interestingDetIdCollections[t],detId); if (!detId.isValid()){ edm::LogError("MissingInput")<<"the collection of interesting detIds:"<<interestingDetIdCollections[t]<<" is not found."; continue; } toBeKept.insert(detId->begin(),detId->end()); } std::auto_ptr<HBHERecHitCollection> hbhe_out(new HBHERecHitCollection()); skim(hbhe,hbhe_out); iEvent.put(hbhe_out,hbheTag.label()); std::auto_ptr<HFRecHitCollection> hf_out(new HFRecHitCollection()); skim(hf,hf_out); iEvent.put(hf_out,hfTag.label()); std::auto_ptr<HORecHitCollection> ho_out(new HORecHitCollection()); skim(ho,ho_out,hoSeverityLevel); iEvent.put(ho_out,hoTag.label()); }
void HcalHitSelection::skim | ( | const edm::Handle< CollectionType > & | input, |
std::auto_ptr< CollectionType > & | output, | ||
int | severityThreshold = 0 |
||
) | [private] |
Definition at line 70 of file HcalHitSelection.cc.
References begin, end, theHcalChStatus, theHcalSevLvlComputer, and toBeKept.
Referenced by produce().
{ output->reserve(input->size()); typename CollectionType::const_iterator begin=input->begin(); typename CollectionType::const_iterator end=input->end(); typename CollectionType::const_iterator hit=begin; for (;hit!=end;++hit){ // edm::LogError("HcalHitSelection")<<"the hit pointer is"<<&(*hit); const DetId & id = hit->detid(); const uint32_t & recHitFlag = hit->flags(); // edm::LogError("HcalHitSelection")<<"the hit id and flag are "<<id.rawId()<<" "<<recHitFlag; const uint32_t & dbStatusFlag = theHcalChStatus->getValues(id)->getValue(); int severityLevel = theHcalSevLvlComputer->getSeverityLevel(id, recHitFlag, dbStatusFlag); //anything that is not "good" goes in if (severityLevel>severityThreshold){ output->push_back(*hit); }else{ //chek on the detid list if (toBeKept.find(id)!=toBeKept.end()) output->push_back(*hit); } } }
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().
int HcalHitSelection::hoSeverityLevel [private] |
Definition at line 58 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 59 of file HcalHitSelection.cc.
Referenced by HcalHitSelection(), and produce().
Definition at line 62 of file HcalHitSelection.cc.
Definition at line 63 of file HcalHitSelection.cc.
std::set<DetId> HcalHitSelection::toBeKept [private] |
Definition at line 64 of file HcalHitSelection.cc.