CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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::stream::EDProducer<>

Public Member Functions

 HcalHitSelection (const edm::ParameterSet &)
 
 ~HcalHitSelection () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Private Member Functions

void produce (edm::Event &, const edm::EventSetup &) override
 
template<typename CollectionType >
void skim (const edm::Handle< CollectionType > &input, CollectionType &output, int severityThreshold=0) const
 

Private Attributes

edm::InputTag hbheTag
 
edm::InputTag hfTag
 
int hoSeverityLevel
 
edm::InputTag hoTag
 
edm::ESGetToken< HcalTopology,
HcalRecNumberingRecord
htopoToken_
 
std::vector< edm::InputTaginterestingDetIdCollections
 
edm::ESGetToken
< HcalChannelQuality,
HcalChannelQualityRcd
qualToken_
 
edm::ESGetToken
< HcalSeverityLevelComputer,
HcalSeverityLevelComputerRcd
sevToken_
 
const HcalChannelQualitytheHcalChStatus
 
const HcalSeverityLevelComputertheHcalSevLvlComputer
 
const HcalTopologytheHcalTopology_
 
std::set< DetIdtoBeKept
 
edm::EDGetTokenT
< HBHERecHitCollection
tok_hbhe_
 
edm::EDGetTokenT
< HFRecHitCollection
tok_hf_
 
edm::EDGetTokenT
< HORecHitCollection
tok_ho_
 
std::vector< edm::EDGetTokenT
< DetIdCollection > > 
toks_did_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T...>
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T...>
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 49 of file HcalHitSelection.cc.

Constructor & Destructor Documentation

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

Definition at line 121 of file HcalHitSelection.cc.

References edm::ParameterSet::getParameter(), hbheTag, hfTag, hoSeverityLevel, hoTag, htopoToken_, mps_fire::i, interestingDetIdCollections, edm::InputTag::label(), qualToken_, sevToken_, tok_hbhe_, tok_hf_, tok_ho_, and toks_did_.

122  : hbheTag(iConfig.getParameter<edm::InputTag>("hbheTag")),
123  hoTag(iConfig.getParameter<edm::InputTag>("hoTag")),
124  hfTag(iConfig.getParameter<edm::InputTag>("hfTag")),
125  theHcalTopology_(nullptr),
126  theHcalChStatus(nullptr),
127  theHcalSevLvlComputer(nullptr) {
128  // register for data access
129  tok_hbhe_ = consumes<HBHERecHitCollection>(hbheTag);
130  tok_hf_ = consumes<HFRecHitCollection>(hfTag);
131  tok_ho_ = consumes<HORecHitCollection>(hoTag);
132 
133  interestingDetIdCollections = iConfig.getParameter<std::vector<edm::InputTag> >("interestingDetIds");
134 
135  const unsigned nLabels = interestingDetIdCollections.size();
136  for (unsigned i = 0; i != nLabels; i++)
137  toks_did_.push_back(consumes<DetIdCollection>(interestingDetIdCollections[i]));
138 
139  hoSeverityLevel = iConfig.getParameter<int>("hoSeverityLevel");
140 
141  produces<HBHERecHitCollection>(hbheTag.label());
142  produces<HFRecHitCollection>(hfTag.label());
143  produces<HORecHitCollection>(hoTag.label());
144 
145  // ES tokens
146  htopoToken_ = esConsumes<HcalTopology, HcalRecNumberingRecord>();
147  qualToken_ = esConsumes<HcalChannelQuality, HcalChannelQualityRcd>(edm::ESInputTag("", "withTopo"));
148  sevToken_ = esConsumes<HcalSeverityLevelComputer, HcalSeverityLevelComputerRcd>();
149 }
std::vector< edm::InputTag > interestingDetIdCollections
const HcalChannelQuality * theHcalChStatus
edm::EDGetTokenT< HORecHitCollection > tok_ho_
std::vector< edm::EDGetTokenT< DetIdCollection > > toks_did_
edm::ESGetToken< HcalChannelQuality, HcalChannelQualityRcd > qualToken_
edm::InputTag hoTag
edm::InputTag hfTag
const HcalSeverityLevelComputer * theHcalSevLvlComputer
edm::EDGetTokenT< HBHERecHitCollection > tok_hbhe_
edm::ESGetToken< HcalTopology, HcalRecNumberingRecord > htopoToken_
edm::EDGetTokenT< HFRecHitCollection > tok_hf_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const HcalTopology * theHcalTopology_
std::string const & label() const
Definition: InputTag.h:36
edm::InputTag hbheTag
edm::ESGetToken< HcalSeverityLevelComputer, HcalSeverityLevelComputerRcd > sevToken_
HcalHitSelection::~HcalHitSelection ( )
override

Definition at line 151 of file HcalHitSelection.cc.

151  {
152  // do anything here that needs to be done at desctruction time
153  // (e.g. close files, deallocate resources etc.)
154 }

Member Function Documentation

void HcalHitSelection::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 161 of file HcalHitSelection.cc.

References edm::Event::getByToken(), edm::EventSetup::getData(), hbheTag, hfTag, hcalSimParameters_cfi::ho, hoSeverityLevel, hoTag, htopoToken_, interestingDetIdCollections, edm::HandleBase::isValid(), edm::InputTag::label(), eostools::move(), edm::Event::put(), qualToken_, sevToken_, skim(), submitPVValidationJobs::t, theHcalChStatus, theHcalSevLvlComputer, theHcalTopology_, toBeKept, tok_hbhe_, tok_hf_, tok_ho_, and toks_did_.

161  {
165 
169 
170  iEvent.getByToken(tok_hbhe_, hbhe);
171  iEvent.getByToken(tok_hf_, hf);
172  iEvent.getByToken(tok_ho_, ho);
173 
174  toBeKept.clear();
176  for (unsigned int t = 0; t < toks_did_.size(); ++t) {
177  iEvent.getByToken(toks_did_[t], detId);
178  if (!detId.isValid()) {
179  edm::LogError("MissingInput") << "the collection of interesting detIds:" << interestingDetIdCollections[t]
180  << " is not found.";
181  continue;
182  }
183  toBeKept.insert(detId->begin(), detId->end());
184  }
185 
186  auto hbhe_out = std::make_unique<HBHERecHitCollection>();
187  skim(hbhe, *hbhe_out);
188  iEvent.put(std::move(hbhe_out), hbheTag.label());
189 
190  auto hf_out = std::make_unique<HFRecHitCollection>();
191  skim(hf, *hf_out);
192  iEvent.put(std::move(hf_out), hfTag.label());
193 
194  auto ho_out = std::make_unique<HORecHitCollection>();
195  skim(ho, *ho_out, hoSeverityLevel);
196  iEvent.put(std::move(ho_out), hoTag.label());
197 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
std::vector< edm::InputTag > interestingDetIdCollections
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
std::set< DetId > toBeKept
const HcalChannelQuality * theHcalChStatus
edm::EDGetTokenT< HORecHitCollection > tok_ho_
std::vector< edm::EDGetTokenT< DetIdCollection > > toks_did_
Log< level::Error, false > LogError
edm::ESGetToken< HcalChannelQuality, HcalChannelQualityRcd > qualToken_
edm::InputTag hoTag
edm::InputTag hfTag
bool getData(T &iHolder) const
Definition: EventSetup.h:128
const HcalSeverityLevelComputer * theHcalSevLvlComputer
def move
Definition: eostools.py:511
edm::EDGetTokenT< HBHERecHitCollection > tok_hbhe_
void skim(const edm::Handle< CollectionType > &input, CollectionType &output, int severityThreshold=0) const
bool isValid() const
Definition: HandleBase.h:70
edm::ESGetToken< HcalTopology, HcalRecNumberingRecord > htopoToken_
edm::EDGetTokenT< HFRecHitCollection > tok_hf_
const HcalTopology * theHcalTopology_
std::string const & label() const
Definition: InputTag.h:36
edm::InputTag hbheTag
edm::ESGetToken< HcalSeverityLevelComputer, HcalSeverityLevelComputerRcd > sevToken_
template<class CollectionType >
void HcalHitSelection::skim ( const edm::Handle< CollectionType > &  input,
CollectionType &  output,
int  severityThreshold = 0 
) const
private

Definition at line 80 of file HcalHitSelection.cc.

References SplitLinear::begin, dataset::end, HcalTopology::getMergePositionFlag(), HcalSeverityLevelComputer::getSeverityLevel(), HcalChannelStatus::getValue(), HcalCondObjectContainer< Item >::getValues(), HcalEndcap, HcalTopology::idFront(), theHcalChStatus, theHcalSevLvlComputer, theHcalTopology_, and toBeKept.

Referenced by produce().

82  {
83  output.reserve(input->size());
84  typename CollectionType::const_iterator begin = input->begin();
85  typename CollectionType::const_iterator end = input->end();
86  typename CollectionType::const_iterator hit = begin;
87 
88  for (; hit != end; ++hit) {
89  // edm::LogError("HcalHitSelection")<<"the hit pointer is"<<&(*hit);
90  HcalDetId id = hit->detid();
91  if (theHcalTopology_->getMergePositionFlag() && id.subdet() == HcalEndcap) {
92  id = theHcalTopology_->idFront(id);
93  }
94  const uint32_t& recHitFlag = hit->flags();
95  // edm::LogError("HcalHitSelection")<<"the hit id and flag are "<<id.rawId()<<" "<<recHitFlag;
96 
97  const uint32_t& dbStatusFlag = theHcalChStatus->getValues(id)->getValue();
98  int severityLevel = theHcalSevLvlComputer->getSeverityLevel(id, recHitFlag, dbStatusFlag);
99  //anything that is not "good" goes in
100  if (severityLevel > severityThreshold) {
101  output.push_back(*hit);
102  } else {
103  //chek on the detid list
104  if (toBeKept.find(id) != toBeKept.end())
105  output.push_back(*hit);
106  }
107  }
108 }
std::set< DetId > toBeKept
const HcalChannelQuality * theHcalChStatus
const Item * getValues(DetId fId, bool throwOnFail=true) const
bool getMergePositionFlag() const
Definition: HcalTopology.h:167
const HcalSeverityLevelComputer * theHcalSevLvlComputer
int getSeverityLevel(const DetId &myid, const uint32_t &myflag, const uint32_t &mystatus) const
const HcalTopology * theHcalTopology_
string end
Definition: dataset.py:937
HcalDetId idFront(const HcalDetId &id) const
Definition: HcalTopology.h:170
uint32_t getValue() const

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().

int HcalHitSelection::hoSeverityLevel
private

Definition at line 62 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().

edm::ESGetToken<HcalTopology, HcalRecNumberingRecord> HcalHitSelection::htopoToken_
private

Definition at line 74 of file HcalHitSelection.cc.

Referenced by HcalHitSelection(), and produce().

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

Definition at line 63 of file HcalHitSelection.cc.

Referenced by HcalHitSelection(), and produce().

edm::ESGetToken<HcalChannelQuality, HcalChannelQualityRcd> HcalHitSelection::qualToken_
private

Definition at line 75 of file HcalHitSelection.cc.

Referenced by HcalHitSelection(), and produce().

Definition at line 76 of file HcalHitSelection.cc.

Referenced by HcalHitSelection(), and produce().

const HcalChannelQuality* HcalHitSelection::theHcalChStatus
private

Definition at line 67 of file HcalHitSelection.cc.

Referenced by produce(), and skim().

const HcalSeverityLevelComputer* HcalHitSelection::theHcalSevLvlComputer
private

Definition at line 68 of file HcalHitSelection.cc.

Referenced by produce(), and skim().

const HcalTopology* HcalHitSelection::theHcalTopology_
private

Definition at line 64 of file HcalHitSelection.cc.

Referenced by produce(), and skim().

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

Definition at line 69 of file HcalHitSelection.cc.

Referenced by produce(), and skim().

edm::EDGetTokenT<HBHERecHitCollection> HcalHitSelection::tok_hbhe_
private

Definition at line 58 of file HcalHitSelection.cc.

Referenced by HcalHitSelection(), and produce().

edm::EDGetTokenT<HFRecHitCollection> HcalHitSelection::tok_hf_
private

Definition at line 60 of file HcalHitSelection.cc.

Referenced by HcalHitSelection(), and produce().

edm::EDGetTokenT<HORecHitCollection> HcalHitSelection::tok_ho_
private

Definition at line 59 of file HcalHitSelection.cc.

Referenced by HcalHitSelection(), and produce().

std::vector<edm::EDGetTokenT<DetIdCollection> > HcalHitSelection::toks_did_
private

Definition at line 61 of file HcalHitSelection.cc.

Referenced by HcalHitSelection(), and produce().