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
reco::HcalNoiseInfoProducer Class Reference

#include <HcalNoiseInfoProducer.h>

Inheritance diagram for reco::HcalNoiseInfoProducer:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

Public Member Functions

 HcalNoiseInfoProducer (const edm::ParameterSet &)
 
 ~HcalNoiseInfoProducer ()
 
- 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 beginRun (edm::Run &, const edm::EventSetup &)
 
virtual void endJob ()
 
virtual void endRun (edm::Run &, const edm::EventSetup &)
 
void fillcalotwrs (edm::Event &, const edm::EventSetup &, HcalNoiseRBXArray &, HcalNoiseSummary &) const
 
void filldigis (edm::Event &, const edm::EventSetup &, HcalNoiseRBXArray &) const
 
void fillOtherSummaryVariables (HcalNoiseSummary &summary, const CommonHcalNoiseRBXData &data) const
 
void fillrechits (edm::Event &, const edm::EventSetup &, HcalNoiseRBXArray &, HcalNoiseSummary &) const
 
void filltracks (edm::Event &, const edm::EventSetup &, HcalNoiseSummary &) const
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 

Private Attributes

HcalNoiseAlgo algo_
 
std::string caloTowerCollName_
 
std::string digiCollName_
 
bool fillCaloTowers_
 
bool fillDigis_
 
bool fillRecHits_
 
bool fillTracks_
 
uint32_t HcalAcceptSeverityLevel_
 
int maxCaloTowerIEta_
 
int maxProblemRBXs_
 
double maxTrackEta_
 
double minHighHitE_
 
double minLowHitE_
 
double minRecHitE_
 
double minTrackPt_
 
std::string recHitCollName_
 
std::string trackCollName_
 

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

Definition at line 38 of file HcalNoiseInfoProducer.h.

Constructor & Destructor Documentation

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

Definition at line 33 of file HcalNoiseInfoProducer.cc.

References caloTowerCollName_, digiCollName_, fillCaloTowers_, fillDigis_, fillRecHits_, fillTracks_, edm::ParameterSet::getParameter(), HcalAcceptSeverityLevel_, maxCaloTowerIEta_, maxProblemRBXs_, maxTrackEta_, minHighHitE_, minLowHitE_, minRecHitE_, minTrackPt_, recHitCollName_, and trackCollName_.

33  : algo_(iConfig)
34 {
35  // set the parameters
36  fillDigis_ = iConfig.getParameter<bool>("fillDigis");
37  fillRecHits_ = iConfig.getParameter<bool>("fillRecHits");
38  fillCaloTowers_ = iConfig.getParameter<bool>("fillCaloTowers");
39  fillTracks_ = iConfig.getParameter<bool>("fillTracks");
40 
41  maxProblemRBXs_ = iConfig.getParameter<int>("maxProblemRBXs");
42 
43  maxCaloTowerIEta_ = iConfig.getParameter<int>("maxCaloTowerIEta");
44  maxTrackEta_ = iConfig.getParameter<double>("maxTrackEta");
45  minTrackPt_ = iConfig.getParameter<double>("minTrackPt");
46 
47  digiCollName_ = iConfig.getParameter<std::string>("digiCollName");
48  recHitCollName_ = iConfig.getParameter<std::string>("recHitCollName");
49  caloTowerCollName_ = iConfig.getParameter<std::string>("caloTowerCollName");
50  trackCollName_ = iConfig.getParameter<std::string>("trackCollName");
51 
52  minRecHitE_ = iConfig.getParameter<double>("minRecHitE");
53  minLowHitE_ = iConfig.getParameter<double>("minLowHitE");
54  minHighHitE_ = iConfig.getParameter<double>("minHighHitE");
55 
56  HcalAcceptSeverityLevel_ = iConfig.getParameter<uint32_t>("HcalAcceptSeverityLevel");
57 
58  // if digis are filled, then rechits must also be filled
59  if(fillDigis_ && !fillRecHits_) {
60  fillRecHits_=true;
61  edm::LogWarning("HCalNoiseInfoProducer") << " forcing fillRecHits to be true if fillDigis is true.\n";
62  }
63 
64  // we produce a vector of HcalNoiseRBXs
65  produces<HcalNoiseRBXCollection>();
66  // we also produce a noise summary
67  produces<HcalNoiseSummary>();
68 }
T getParameter(std::string const &) const
HcalNoiseInfoProducer::~HcalNoiseInfoProducer ( )

Definition at line 71 of file HcalNoiseInfoProducer.cc.

72 {
73 }

Member Function Documentation

void HcalNoiseInfoProducer::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 148 of file HcalNoiseInfoProducer.cc.

149 {
150  return;
151 }
void HcalNoiseInfoProducer::beginRun ( edm::Run ,
const edm::EventSetup  
)
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 164 of file HcalNoiseInfoProducer.cc.

165 {
166  return;
167 }
void HcalNoiseInfoProducer::endJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 155 of file HcalNoiseInfoProducer.cc.

156 {
157  return;
158 }
void HcalNoiseInfoProducer::endRun ( edm::Run ,
const edm::EventSetup  
)
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 171 of file HcalNoiseInfoProducer.cc.

172 {
173  return;
174 }
void HcalNoiseInfoProducer::fillcalotwrs ( edm::Event iEvent,
const edm::EventSetup iSetup,
HcalNoiseRBXArray array,
HcalNoiseSummary summary 
) const
private

Definition at line 430 of file HcalNoiseInfoProducer.cc.

References caloTowerCollName_, CaloTower::emEnergy(), HcalNoiseSummary::emenergy_, edm::hlt::Exception, reco::HcalNoiseRBXArray::findHPD(), edm::Event::getByLabel(), CaloTower::hadEnergy(), HcalNoiseSummary::hadenergy_, patZpeak::handle, CaloTower::ietaAbs(), edm::HandleBase::isValid(), maxCaloTowerIEta_, and edm::errors::ProductNotFound.

Referenced by produce().

431 {
432  // get the calotowers
434  iEvent.getByLabel(caloTowerCollName_, handle);
435  if(!handle.isValid()) {
437  << " could not find CaloTowerCollection named " << caloTowerCollName_ << "\n.";
438  return;
439  }
440 
441  summary.emenergy_ = summary.hadenergy_ = 0.0;
442 
443  // loop over all of the calotower information
444  for(CaloTowerCollection::const_iterator it = handle->begin(); it!=handle->end(); ++it) {
445  const CaloTower& twr=(*it);
446 
447  // create a persistent reference to the tower
448  edm::Ref<CaloTowerCollection> myRef(handle, it-handle->begin());
449 
450  // get all of the hpd's that are pointed to by the calotower
451  std::vector<std::vector<HcalNoiseHPD>::iterator> hpditervec;
452  array.findHPD(twr, hpditervec);
453 
454  // loop over the hpd's and add the reference to the RefVectors
455  for(std::vector<std::vector<HcalNoiseHPD>::iterator>::iterator it=hpditervec.begin();
456  it!=hpditervec.end(); ++it)
457  (*it)->calotowers_.push_back(myRef);
458 
459  // skip over anything with |ieta|>maxCaloTowerIEta
460  if(twr.ietaAbs()>maxCaloTowerIEta_) {
461  summary.emenergy_ += twr.emEnergy();
462  summary.hadenergy_ += twr.hadEnergy();
463  }
464  }
465 
466  return;
467 }
std::vector< CaloTower >::const_iterator const_iterator
double emEnergy() const
Definition: CaloTower.h:79
tuple handle
Definition: patZpeak.py:22
std::vector< HcalNoiseHPD >::iterator findHPD(int hpdindex)
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:359
double hadEnergy() const
Definition: CaloTower.h:80
int ietaAbs() const
Definition: CaloTower.h:155
void HcalNoiseInfoProducer::filldigis ( edm::Event iEvent,
const edm::EventSetup iSetup,
HcalNoiseRBXArray array 
) const
private

Definition at line 265 of file HcalNoiseInfoProducer.cc.

References ecalMGPA::adc(), HcalCoderDb::adc2fC(), reco::HcalNoiseRBX::allCharge_, edm::RefVector< C, T, F >::begin(), reco::HcalNoiseHPD::big5Charge_, reco::HcalNoiseHPD::bigCharge_, cmsDriverOptions::counter, digiCollName_, HcalSeverityLevelComputer::dropChannel(), edm::RefVector< C, T, F >::end(), edm::hlt::Exception, reco::HcalNoiseRBXArray::findHPD(), reco::HcalNoiseRBXArray::findRBX(), edm::EventSetup::get(), edm::Event::getByLabel(), HcalChannelStatus::getValue(), HcalCondObjectContainer< Item >::getValues(), patZpeak::handle, HBHEDataFrame::id(), edm::HandleBase::isValid(), reco::HcalNoiseHPD::maxZeros_, HcalCalibrations::pedestal(), edm::ESHandle< class >::product(), edm::errors::ProductNotFound, DetId::rawId(), reco::HcalNoiseHPD::rechits_, CaloSamples::size(), reco::HcalNoiseHPD::totalZeros_, and HBHEDataFrame::zsMarkAndPass().

Referenced by produce().

266 {
267 
268  // get the conditions and channel quality
269  edm::ESHandle<HcalDbService> conditions;
270  iSetup.get<HcalDbRecord>().get(conditions);
271  const HcalQIEShape* shape = conditions->getHcalShape();
273  iSetup.get<HcalChannelQualityRcd>().get(qualhandle);
274  const HcalChannelQuality* myqual = qualhandle.product();
276  iSetup.get<HcalSeverityLevelComputerRcd>().get(mycomputer);
277  const HcalSeverityLevelComputer* mySeverity = mycomputer.product();
278 
279  // get the digis
281  iEvent.getByLabel(digiCollName_, handle);
282  if(!handle.isValid()) {
283  throw edm::Exception(edm::errors::ProductNotFound) << " could not find HBHEDigiCollection named " << digiCollName_ << "\n.";
284  return;
285  }
286 
287  // loop over all of the digi information
288  for(HBHEDigiCollection::const_iterator it=handle->begin(); it!=handle->end(); ++it) {
289  const HBHEDataFrame &digi=(*it);
290  HcalDetId cell = digi.id();
291  DetId detcell=(DetId)cell;
292 
293  // check on cells to be ignored and dropped
294  const HcalChannelStatus* mydigistatus=myqual->getValues(detcell.rawId());
295  if(mySeverity->dropChannel(mydigistatus->getValue())) continue;
296  if(digi.zsMarkAndPass()) continue;
297 
298  // get the calibrations and coder
299  const HcalCalibrations& calibrations=conditions->getHcalCalibrations(cell);
300  const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
301  HcalCoderDb coder (*channelCoder, *shape);
302 
303  // match the digi to an rbx and hpd
304  HcalNoiseRBX &rbx=(*array.findRBX(digi));
305  HcalNoiseHPD &hpd=(*array.findHPD(digi));
306 
307  // determine if the digi is one the highest energy hits in the HPD
308  // this works because the rechits are sorted by energy (see fillrechits() below)
309  bool isBig=false, isBig5=false, isRBX=false;
310  int counter=0;
313  rit!=rechits.end(); ++rit, ++counter) {
314  if((*rit)->id() == digi.id()) {
315  if(counter==0) isBig=isBig5=true; // digi is also the highest energy rechit
316  if(counter<5) isBig5=true; // digi is one of 5 highest energy rechits
317  isRBX=true;
318  }
319  }
320 
321  // loop over each of the digi's time slices
322  int totalzeros=0;
323  CaloSamples tool;
324  coder.adc2fC(digi,tool);
325  for(int ts=0; ts<tool.size(); ++ts) {
326 
327  // count zero's
328  if(digi[ts].adc()==0) {
329  ++hpd.totalZeros_;
330  ++totalzeros;
331  }
332 
333  // get the fC's
334  double corrfc = tool[ts]-calibrations.pedestal(digi[ts].capid());
335 
336  // fill the relevant digi arrays
337  if(isBig) hpd.bigCharge_[ts]+=corrfc;
338  if(isBig5) hpd.big5Charge_[ts]+=corrfc;
339  if(isRBX) rbx.allCharge_[ts]+=corrfc;
340  }
341 
342  // record the maximum number of zero's found
343  if(totalzeros>hpd.maxZeros_)
344  hpd.maxZeros_=totalzeros;
345  }
346 
347  return;
348 }
int adc(sample_type sample)
get the ADC sample (12 bits)
bool zsMarkAndPass() const
was ZS MarkAndPass?
Definition: HBHEDataFrame.h:30
std::vector< T >::const_iterator const_iterator
std::vector< float > bigCharge_
Definition: HcalNoiseHPD.h:134
std::vector< float > big5Charge_
Definition: HcalNoiseHPD.h:135
double pedestal(int fCapId) const
get pedestal for capid=0..3
const_iterator end() const
Termination of iteration.
Definition: RefVector.h:242
const_iterator begin() const
Initialize an iterator over the RefVector.
Definition: RefVector.h:237
edm::RefVector< HBHERecHitCollection > rechits_
Definition: HcalNoiseHPD.h:138
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
HcalNoiseRBXArray::iterator findRBX(int rbxindex)
tuple handle
Definition: patZpeak.py:22
std::vector< HcalNoiseHPD >::iterator findHPD(int hpdindex)
bool dropChannel(const uint32_t &mystatus) const
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:359
std::vector< float > allCharge_
Definition: HcalNoiseRBX.h:105
Definition: DetId.h:20
int size() const
get the size
Definition: CaloSamples.h:24
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
const HcalDetId & id() const
Definition: HBHEDataFrame.h:22
uint32_t getValue() const
const Item * getValues(DetId fId) const
void HcalNoiseInfoProducer::fillOtherSummaryVariables ( HcalNoiseSummary summary,
const CommonHcalNoiseRBXData data 
) const
private

Definition at line 178 of file HcalNoiseInfoProducer.cc.

References algo_, HcalNoiseSummary::cnthit10_, HcalNoiseSummary::cnthit25_, CommonHcalNoiseRBXData::e10ts(), CommonHcalNoiseRBXData::e2ts(), HcalNoiseSummary::filterstatus_, CommonHcalNoiseRBXData::highEHitTimeSqrd(), HcalNoiseSummary::hlnoisetwrs_, CommonHcalNoiseRBXData::HPDEMF(), join(), HcalNoiseSummary::loosenoisetwrs_, CommonHcalNoiseRBXData::lowEHitTimeSqrd(), HcalNoiseSummary::max10_, HcalNoiseSummary::max10GeVHitTime(), HcalNoiseSummary::max25_, HcalNoiseSummary::max25GeVHitTime(), HcalNoiseSummary::maxe10ts_, HcalNoiseSummary::maxE2Over10TS(), HcalNoiseSummary::maxe2ts_, CommonHcalNoiseRBXData::maxHighEHitTime(), HcalNoiseSummary::maxHPDHits(), HcalNoiseSummary::maxhpdhits_, HcalNoiseSummary::maxhpdhitsnoother_, HcalNoiseSummary::maxHPDNoOtherHits(), CommonHcalNoiseRBXData::maxLowEHitTime(), HcalNoiseSummary::maxRBXHits(), HcalNoiseSummary::maxrbxhits_, HcalNoiseSummary::maxZeros(), HcalNoiseSummary::maxzeros_, HcalNoiseSummary::min10_, HcalNoiseSummary::min10GeVHitTime(), HcalNoiseSummary::min25_, HcalNoiseSummary::min25GeVHitTime(), HcalNoiseSummary::mine10ts_, HcalNoiseSummary::minE2Over10TS(), HcalNoiseSummary::mine2ts_, CommonHcalNoiseRBXData::minHighEHitTime(), HcalNoiseSummary::minHPDEMF(), HcalNoiseSummary::minhpdemf_, CommonHcalNoiseRBXData::minLowEHitTime(), HcalNoiseSummary::minRBXEMF(), HcalNoiseSummary::minrbxemf_, CommonHcalNoiseRBXData::numHighEHits(), CommonHcalNoiseRBXData::numHPDHits(), CommonHcalNoiseRBXData::numHPDNoOtherHits(), CommonHcalNoiseRBXData::numLowEHits(), CommonHcalNoiseRBXData::numRBXHits(), CommonHcalNoiseRBXData::numZeros(), HcalNoiseAlgo::passEMFThreshold(), HcalNoiseAlgo::passHighLevelNoiseFilter(), HcalNoiseAlgo::passLooseHits(), HcalNoiseAlgo::passLooseNoiseFilter(), HcalNoiseAlgo::passLooseRatio(), HcalNoiseAlgo::passLooseTiming(), HcalNoiseAlgo::passLooseZeros(), HcalNoiseAlgo::passRatioThreshold(), HcalNoiseAlgo::passTightHits(), HcalNoiseAlgo::passTightNoiseFilter(), HcalNoiseAlgo::passTightRatio(), HcalNoiseAlgo::passTightTiming(), HcalNoiseAlgo::passTightZeros(), HcalNoiseAlgo::passZerosThreshold(), CommonHcalNoiseRBXData::ratio(), CommonHcalNoiseRBXData::RBXEMF(), CommonHcalNoiseRBXData::rbxTowers(), HcalNoiseSummary::rms10_, HcalNoiseSummary::rms25_, HcalNoiseSummary::tightnoisetwrs_, and CommonHcalNoiseRBXData::validRatio().

Referenced by produce().

179 {
180  // charge ratio
181  if(algo_.passRatioThreshold(data) && data.validRatio()) {
182  if(data.ratio()<summary.minE2Over10TS()) {
183  summary.mine2ts_ = data.e2ts();
184  summary.mine10ts_ = data.e10ts(); }
185  if(data.ratio()>summary.maxE2Over10TS()) {
186  summary.maxe2ts_ = data.e2ts();
187  summary.maxe10ts_ = data.e10ts();
188  }
189  }
190 
191  // ADC zeros
192  if(algo_.passZerosThreshold(data)) {
193  if(data.numZeros()>summary.maxZeros()) {
194  summary.maxzeros_ = data.numZeros();
195  }
196  }
197 
198  // hits count
199  if(data.numHPDHits() > summary.maxHPDHits()) {
200  summary.maxhpdhits_ = data.numHPDHits();
201  }
202  if(data.numRBXHits() > summary.maxRBXHits()) {
203  summary.maxrbxhits_ = data.numRBXHits();
204  }
205  if(data.numHPDNoOtherHits() > summary.maxHPDNoOtherHits()) {
206  summary.maxhpdhitsnoother_ = data.numHPDNoOtherHits();
207  }
208 
209  // hit timing
210  if(data.minLowEHitTime()<summary.min10GeVHitTime()) {
211  summary.min10_ = data.minLowEHitTime();
212  }
213  if(data.maxLowEHitTime()>summary.max10GeVHitTime()) {
214  summary.max10_ = data.maxLowEHitTime();
215  }
216  summary.rms10_ += data.lowEHitTimeSqrd();
217  summary.cnthit10_ += data.numLowEHits();
218  if(data.minHighEHitTime()<summary.min25GeVHitTime()) {
219  summary.min25_ = data.minHighEHitTime();
220  }
221  if(data.maxHighEHitTime()>summary.max25GeVHitTime()) {
222  summary.max25_ = data.maxHighEHitTime();
223  }
224  summary.rms25_ += data.highEHitTimeSqrd();
225  summary.cnthit25_ += data.numHighEHits();
226 
227  // EMF
228  if(algo_.passEMFThreshold(data)) {
229  if(summary.minHPDEMF() > data.HPDEMF()) {
230  summary.minhpdemf_ = data.HPDEMF();
231  }
232  if(summary.minRBXEMF() > data.RBXEMF()) {
233  summary.minrbxemf_ = data.RBXEMF();
234  }
235  }
236 
237  // summary flag
238  if(!algo_.passLooseRatio(data)) summary.filterstatus_ |= 0x1;
239  if(!algo_.passLooseHits(data)) summary.filterstatus_ |= 0x2;
240  if(!algo_.passLooseZeros(data)) summary.filterstatus_ |= 0x4;
241  if(!algo_.passLooseTiming(data)) summary.filterstatus_ |= 0x8;
242 
243  if(!algo_.passTightRatio(data)) summary.filterstatus_ |= 0x100;
244  if(!algo_.passTightHits(data)) summary.filterstatus_ |= 0x200;
245  if(!algo_.passTightZeros(data)) summary.filterstatus_ |= 0x400;
246  if(!algo_.passTightTiming(data)) summary.filterstatus_ |= 0x800;
247 
248  if(!algo_.passHighLevelNoiseFilter(data)) summary.filterstatus_ |= 0x10000;
249 
250  // summary refvectors
252  if(!algo_.passLooseNoiseFilter(data))
253  join(summary.loosenoisetwrs_, data.rbxTowers());
254  if(!algo_.passTightNoiseFilter(data))
255  join(summary.tightnoisetwrs_, data.rbxTowers());
257  join(summary.hlnoisetwrs_, data.rbxTowers());
258 
259  return;
260 }
double e10ts(void) const
Definition: HcalNoiseAlgo.h:21
double HPDEMF(void) const
Definition: HcalNoiseAlgo.h:36
double e2ts(void) const
Definition: HcalNoiseAlgo.h:20
edm::RefVector< CaloTowerCollection > hlnoisetwrs_
double lowEHitTimeSqrd(void) const
Definition: HcalNoiseAlgo.h:29
bool passTightRatio(const CommonHcalNoiseRBXData &) const
double minLowEHitTime(void) const
Definition: HcalNoiseAlgo.h:27
bool passLooseRatio(const CommonHcalNoiseRBXData &) const
double maxHighEHitTime(void) const
Definition: HcalNoiseAlgo.h:32
bool passTightTiming(const CommonHcalNoiseRBXData &) const
double maxLowEHitTime(void) const
Definition: HcalNoiseAlgo.h:28
int numLowEHits(void) const
Definition: HcalNoiseAlgo.h:30
double ratio(void) const
Definition: HcalNoiseAlgo.h:19
float maxE2Over10TS(void) const
edm::RefVector< CaloTowerCollection > loosenoisetwrs_
float min25GeVHitTime(void) const
bool passHighLevelNoiseFilter(const CommonHcalNoiseRBXData &) const
double RBXEMF(void) const
Definition: HcalNoiseAlgo.h:35
int numRBXHits(void) const
Definition: HcalNoiseAlgo.h:24
float min10GeVHitTime(void) const
double highEHitTimeSqrd(void) const
Definition: HcalNoiseAlgo.h:33
float minE2Over10TS(void) const
bool passLooseZeros(const CommonHcalNoiseRBXData &) const
int maxRBXHits(void) const
bool passTightZeros(const CommonHcalNoiseRBXData &) const
int numHighEHits(void) const
Definition: HcalNoiseAlgo.h:34
bool passRatioThreshold(const CommonHcalNoiseRBXData &) const
int numHPDNoOtherHits(void) const
Definition: HcalNoiseAlgo.h:25
int numZeros(void) const
Definition: HcalNoiseAlgo.h:26
bool passZerosThreshold(const CommonHcalNoiseRBXData &) const
float minHPDEMF(void) const
bool passLooseNoiseFilter(const CommonHcalNoiseRBXData &) const
edm::RefVector< CaloTowerCollection > rbxTowers(void) const
Definition: HcalNoiseAlgo.h:37
bool passLooseHits(const CommonHcalNoiseRBXData &) const
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
int maxZeros(void) const
edm::RefVector< CaloTowerCollection > tightnoisetwrs_
bool passLooseTiming(const CommonHcalNoiseRBXData &) const
bool passTightNoiseFilter(const CommonHcalNoiseRBXData &) const
int maxHPDNoOtherHits(void) const
double minHighEHitTime(void) const
Definition: HcalNoiseAlgo.h:31
float minRBXEMF(void) const
bool passEMFThreshold(const CommonHcalNoiseRBXData &) const
int maxHPDHits(void) const
int numHPDHits(void) const
Definition: HcalNoiseAlgo.h:23
float max25GeVHitTime(void) const
float max10GeVHitTime(void) const
bool validRatio(void) const
Definition: HcalNoiseAlgo.h:22
bool passTightHits(const CommonHcalNoiseRBXData &) const
void HcalNoiseInfoProducer::fillrechits ( edm::Event iEvent,
const edm::EventSetup iSetup,
HcalNoiseRBXArray array,
HcalNoiseSummary summary 
) const
private

Definition at line 352 of file HcalNoiseInfoProducer.cc.

References CaloRecHit::detid(), CaloRecHit::energy(), ExpressReco_HICollisions_FallBack::et, edm::hlt::Exception, reco::HcalNoiseRBXArray::findHPD(), CaloRecHit::flags(), edm::EventSetup::get(), edm::Event::getByLabel(), CaloGeometry::getPosition(), HcalSeverityLevelComputer::getSeverityLevel(), HcalChannelStatus::getValue(), HcalCondObjectContainer< Item >::getValues(), patZpeak::handle, HcalCaloFlagLabels::HBHEIsolatedNoise, HcalAcceptSeverityLevel_, HBHERecHit::id(), HcalNoiseSummary::isolnoisee_, HcalNoiseSummary::isolnoiseet_, edm::HandleBase::isValid(), HcalNoiseSummary::nisolnoise_, edm::ESHandle< class >::product(), edm::errors::ProductNotFound, recHitCollName_, HcalSeverityLevelComputer::recoveredRecHit(), and reco::HcalNoiseHPD::refrechitset_.

Referenced by produce().

353 {
354  // get the HCAL channel status map
355  edm::ESHandle<HcalChannelQuality> hcalChStatus;
356  iSetup.get<HcalChannelQualityRcd>().get( hcalChStatus );
357  const HcalChannelQuality* dbHcalChStatus = hcalChStatus.product();
358 
359  // get the severity level computer
360  edm::ESHandle<HcalSeverityLevelComputer> hcalSevLvlComputerHndl;
361  iSetup.get<HcalSeverityLevelComputerRcd>().get(hcalSevLvlComputerHndl);
362  const HcalSeverityLevelComputer* hcalSevLvlComputer = hcalSevLvlComputerHndl.product();
363 
364  // get the calo geometry
366  iSetup.get<CaloGeometryRecord>().get(pG);
367  const CaloGeometry* geo = pG.product();
368 
369  // get the rechits
371  iEvent.getByLabel(recHitCollName_, handle);
372  if(!handle.isValid()) {
374  << " could not find HBHERecHitCollection named " << recHitCollName_ << "\n.";
375  return;
376  }
377 
378  // loop over all of the rechit information
379  for(HBHERecHitCollection::const_iterator it=handle->begin(); it!=handle->end(); ++it) {
380  const HBHERecHit &rechit=(*it);
381 
382  // skip bad rechits (other than those flagged by the isolated noise algorithm)
383  const DetId id = rechit.detid();
384  uint32_t recHitFlag = rechit.flags();
385  uint32_t noisebitset = (1 << HcalCaloFlagLabels::HBHEIsolatedNoise);
386  recHitFlag = (recHitFlag & noisebitset) ? recHitFlag-noisebitset : recHitFlag;
387  const uint32_t dbStatusFlag = dbHcalChStatus->getValues(id)->getValue();
388  int severityLevel = hcalSevLvlComputer->getSeverityLevel(id, recHitFlag, dbStatusFlag);
389  bool isRecovered = hcalSevLvlComputer->recoveredRecHit(id, recHitFlag);
390  if(severityLevel!=0 && !isRecovered && severityLevel>static_cast<int>(HcalAcceptSeverityLevel_)) continue;
391 
392  // if it was ID'd as isolated noise, update the summary object
393  if(rechit.flags() & noisebitset) {
394  ++summary.nisolnoise_;
395  summary.isolnoisee_ += rechit.energy();
396  GlobalPoint gp = geo->getPosition(rechit.id());
397  double et = rechit.energy()*gp.perp()/gp.mag();
398  summary.isolnoiseet_ += et;
399  }
400 
401  // find the hpd that the rechit is in
402  HcalNoiseHPD& hpd=(*array.findHPD(rechit));
403 
404  // create a persistent reference to the rechit
405  edm::Ref<HBHERecHitCollection> myRef(handle, it-handle->begin());
406 
407  // store it in a place so that it remains sorted by energy
408  hpd.refrechitset_.insert(myRef);
409 
410  } // end loop over rechits
411 
412  // loop over all HPDs and transfer the information from refrechitset_ to rechits_;
413  for(HcalNoiseRBXArray::iterator rbxit=array.begin(); rbxit!=array.end(); ++rbxit) {
414  for(std::vector<HcalNoiseHPD>::iterator hpdit=rbxit->hpds_.begin(); hpdit!=rbxit->hpds_.end(); ++hpdit) {
415 
416  // loop over all of the entries in the set and add them to rechits_
418  it=hpdit->refrechitset_.begin(); it!=hpdit->refrechitset_.end(); ++it) {
419  hpdit->rechits_.push_back(*it);
420  }
421  }
422  }
423  // now the rechits in all the HPDs are sorted by energy!
424 
425  return;
426 }
T perp() const
Definition: PV3DBase.h:66
const DetId & detid() const
Definition: CaloRecHit.h:21
HcalDetId id() const
get the id
Definition: HBHERecHit.h:21
std::set< edm::Ref< HBHERecHitCollection >, RefHBHERecHitEnergyComparison > refrechitset_
Definition: HcalNoiseHPD.h:142
std::vector< T >::const_iterator const_iterator
T mag() const
Definition: PV3DBase.h:61
float energy() const
Definition: CaloRecHit.h:19
bool recoveredRecHit(const DetId &myid, const uint32_t &myflag) const
uint32_t flags() const
Definition: CaloRecHit.h:22
tuple handle
Definition: patZpeak.py:22
std::vector< HcalNoiseHPD >::iterator findHPD(int hpdindex)
const GlobalPoint & getPosition(const DetId &id) const
Get the position of a given detector id.
Definition: CaloGeometry.cc:68
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:359
Definition: DetId.h:20
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
int getSeverityLevel(const DetId &myid, const uint32_t &myflag, const uint32_t &mystatus) const
uint32_t getValue() const
const Item * getValues(DetId fId) const
void HcalNoiseInfoProducer::filltracks ( edm::Event iEvent,
const edm::EventSetup iSetup,
HcalNoiseSummary summary 
) const
private

Definition at line 471 of file HcalNoiseInfoProducer.cc.

References reco::TrackBase::eta(), edm::Event::getByLabel(), patZpeak::handle, edm::HandleBase::isValid(), maxTrackEta_, minTrackPt_, reco::TrackBase::p(), reco::TrackBase::pt(), trackCollName_, and HcalNoiseSummary::trackenergy_.

Referenced by produce().

472 {
474  iEvent.getByLabel(trackCollName_, handle);
475 
476  // don't throw exception, just return quietly
477  if(!handle.isValid()) {
478  // throw edm::Exception(edm::errors::ProductNotFound)
479  // << " could not find trackCollection named " << trackCollName_ << "\n.";
480  return;
481  }
482 
483  summary.trackenergy_=0.0;
484  for(reco::TrackCollection::const_iterator iTrack = handle->begin(); iTrack!=handle->end(); ++iTrack) {
485  reco::Track trk=*iTrack;
486  if(trk.pt()<minTrackPt_ || fabs(trk.eta())>maxTrackEta_) continue;
487 
488  summary.trackenergy_ += trk.p();
489  }
490 
491  return;
492 }
double p() const
momentum vector magnitude
Definition: TrackBase.h:128
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:140
double pt() const
track transverse momentum
Definition: TrackBase.h:130
tuple handle
Definition: patZpeak.py:22
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:359
void HcalNoiseInfoProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

Implements edm::EDProducer.

Definition at line 82 of file HcalNoiseInfoProducer.cc.

References algo_, runTheMatrix::data, CommonHcalNoiseRBXData::energy(), fillCaloTowers_, fillcalotwrs(), filldigis(), fillDigis_, fillOtherSummaryVariables(), fillrechits(), fillRecHits_, filltracks(), fillTracks_, HcalNoiseAlgo::isProblematic(), maxProblemRBXs_, minHighHitE_, minLowHitE_, minRecHitE_, HcalNoiseSummary::nproblemRBXs_, HcalNoiseAlgo::passHighLevelNoiseFilter(), HcalNoiseAlgo::passLooseNoiseFilter(), HcalNoiseAlgo::passTightNoiseFilter(), edm::Event::put(), and edmLumisInFiles::summary.

83 {
84  // this is what we're going to actually write to the EDM
85  std::auto_ptr<HcalNoiseRBXCollection> result1(new HcalNoiseRBXCollection);
86  std::auto_ptr<HcalNoiseSummary> result2(new HcalNoiseSummary);
87 
88  // define an empty HcalNoiseRBXArray that we're going to fill
89  HcalNoiseRBXArray rbxarray;
90  HcalNoiseSummary &summary=*result2;
91 
92  // fill them with the various components
93  // digi assumes that rechit information is available
94  if(fillRecHits_) fillrechits(iEvent, iSetup, rbxarray, summary);
95  if(fillDigis_) filldigis(iEvent, iSetup, rbxarray);
96  if(fillCaloTowers_) fillcalotwrs(iEvent, iSetup, rbxarray, summary);
97  if(fillTracks_) filltracks(iEvent, iSetup, summary);
98 
99  // select those RBXs which are interesting
100  // also look for the highest energy RBX
101  HcalNoiseRBXArray::iterator maxit=rbxarray.begin();
102  double maxenergy=-999;
103  bool maxwritten=false;
104  for(HcalNoiseRBXArray::iterator rit = rbxarray.begin(); rit!=rbxarray.end(); ++rit) {
105  HcalNoiseRBX &rbx=(*rit);
107 
108  // find the highest energy rbx
109  if(data.energy()>maxenergy) {
110  maxenergy=data.energy();
111  maxit=rit;
112  maxwritten=false;
113  }
114 
115  // find out if the rbx is problematic/noisy/etc.
116  bool writerbx = algo_.isProblematic(data) || !algo_.passLooseNoiseFilter(data) ||
118 
119  // fill variables in the summary object not filled elsewhere
121 
122  if(writerbx) {
123  summary.nproblemRBXs_++;
124  if(summary.nproblemRBXs_<=maxProblemRBXs_) {
125  result1->push_back(rbx);
126  if(maxit==rit) maxwritten=true;
127  }
128  }
129  } // end loop over rbxs
130 
131  // if we still haven't written the maximum energy rbx, write it now
132  if(!maxwritten) {
133  HcalNoiseRBX &rbx=(*maxit);
134 
135  // add the RBX to the event
136  result1->push_back(rbx);
137  }
138 
139  // put the rbxcollection and summary into the EDM
140  iEvent.put(result1);
141  iEvent.put(result2);
142 
143  return;
144 }
std::vector< HcalNoiseRBX > HcalNoiseRBXCollection
Definition: HcalNoiseRBX.h:26
bool isProblematic(const CommonHcalNoiseRBXData &) const
void fillrechits(edm::Event &, const edm::EventSetup &, HcalNoiseRBXArray &, HcalNoiseSummary &) const
void filldigis(edm::Event &, const edm::EventSetup &, HcalNoiseRBXArray &) const
void fillcalotwrs(edm::Event &, const edm::EventSetup &, HcalNoiseRBXArray &, HcalNoiseSummary &) const
bool passHighLevelNoiseFilter(const CommonHcalNoiseRBXData &) const
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:84
bool passLooseNoiseFilter(const CommonHcalNoiseRBXData &) const
bool passTightNoiseFilter(const CommonHcalNoiseRBXData &) const
void filltracks(edm::Event &, const edm::EventSetup &, HcalNoiseSummary &) const
void fillOtherSummaryVariables(HcalNoiseSummary &summary, const CommonHcalNoiseRBXData &data) const

Member Data Documentation

HcalNoiseAlgo reco::HcalNoiseInfoProducer::algo_
private

Definition at line 94 of file HcalNoiseInfoProducer.h.

Referenced by fillOtherSummaryVariables(), and produce().

std::string reco::HcalNoiseInfoProducer::caloTowerCollName_
private

Definition at line 90 of file HcalNoiseInfoProducer.h.

Referenced by fillcalotwrs(), and HcalNoiseInfoProducer().

std::string reco::HcalNoiseInfoProducer::digiCollName_
private

Definition at line 88 of file HcalNoiseInfoProducer.h.

Referenced by filldigis(), and HcalNoiseInfoProducer().

bool reco::HcalNoiseInfoProducer::fillCaloTowers_
private

Definition at line 77 of file HcalNoiseInfoProducer.h.

Referenced by HcalNoiseInfoProducer(), and produce().

bool reco::HcalNoiseInfoProducer::fillDigis_
private

Definition at line 75 of file HcalNoiseInfoProducer.h.

Referenced by HcalNoiseInfoProducer(), and produce().

bool reco::HcalNoiseInfoProducer::fillRecHits_
private

Definition at line 76 of file HcalNoiseInfoProducer.h.

Referenced by HcalNoiseInfoProducer(), and produce().

bool reco::HcalNoiseInfoProducer::fillTracks_
private

Definition at line 78 of file HcalNoiseInfoProducer.h.

Referenced by HcalNoiseInfoProducer(), and produce().

uint32_t reco::HcalNoiseInfoProducer::HcalAcceptSeverityLevel_
private

Definition at line 96 of file HcalNoiseInfoProducer.h.

Referenced by fillrechits(), and HcalNoiseInfoProducer().

int reco::HcalNoiseInfoProducer::maxCaloTowerIEta_
private

Definition at line 84 of file HcalNoiseInfoProducer.h.

Referenced by fillcalotwrs(), and HcalNoiseInfoProducer().

int reco::HcalNoiseInfoProducer::maxProblemRBXs_
private

Definition at line 81 of file HcalNoiseInfoProducer.h.

Referenced by HcalNoiseInfoProducer(), and produce().

double reco::HcalNoiseInfoProducer::maxTrackEta_
private

Definition at line 85 of file HcalNoiseInfoProducer.h.

Referenced by filltracks(), and HcalNoiseInfoProducer().

double reco::HcalNoiseInfoProducer::minHighHitE_
private

Definition at line 93 of file HcalNoiseInfoProducer.h.

Referenced by HcalNoiseInfoProducer(), and produce().

double reco::HcalNoiseInfoProducer::minLowHitE_
private

Definition at line 93 of file HcalNoiseInfoProducer.h.

Referenced by HcalNoiseInfoProducer(), and produce().

double reco::HcalNoiseInfoProducer::minRecHitE_
private

Definition at line 93 of file HcalNoiseInfoProducer.h.

Referenced by HcalNoiseInfoProducer(), and produce().

double reco::HcalNoiseInfoProducer::minTrackPt_
private

Definition at line 86 of file HcalNoiseInfoProducer.h.

Referenced by filltracks(), and HcalNoiseInfoProducer().

std::string reco::HcalNoiseInfoProducer::recHitCollName_
private

Definition at line 89 of file HcalNoiseInfoProducer.h.

Referenced by fillrechits(), and HcalNoiseInfoProducer().

std::string reco::HcalNoiseInfoProducer::trackCollName_
private

Definition at line 91 of file HcalNoiseInfoProducer.h.

Referenced by filltracks(), and HcalNoiseInfoProducer().