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::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 HcalNoiseInfoProducer (const edm::ParameterSet &)
 
 ~HcalNoiseInfoProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

void fillcalotwrs (edm::Event &, const edm::EventSetup &, HcalNoiseRBXArray &, HcalNoiseSummary &) const
 
void filldigis (edm::Event &, const edm::EventSetup &, HcalNoiseRBXArray &, HcalNoiseSummary &)
 
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 &) override
 

Private Attributes

float adc2fC [128]
 
HcalNoiseAlgo algo_
 
double calibdigiHBHEthreshold_
 
std::vector< int > calibdigiHBHEtimeslices_
 
double calibdigiHFthreshold_
 
std::vector< int > calibdigiHFtimeslices_
 
edm::EDGetTokenT
< CaloTowerCollection
calotower_token_
 
std::string caloTowerCollName_
 
std::string digiCollName_
 
bool fillCaloTowers_
 
bool fillDigis_
 
bool fillRecHits_
 
bool fillTracks_
 
edm::EDGetTokenT
< HBHEDigiCollection
hbhedigi_token_
 
edm::EDGetTokenT
< HBHERecHitCollection
hbherechit_token_
 
uint32_t HcalAcceptSeverityLevel_
 
edm::EDGetTokenT
< HcalCalibDigiCollection
hcalcalibdigi_token_
 
std::vector< int > HcalRecHitFlagsToBeExcluded_
 
int maxCaloTowerIEta_
 
int maxProblemRBXs_
 
double maxTrackEta_
 
double minHighHitE_
 
double minLowHitE_
 
double minR45HitE_
 
double minRecHitE_
 
double minTrackPt_
 
std::string recHitCollName_
 
double TotalCalibCharge
 
edm::EDGetTokenT
< reco::TrackCollection
track_token_
 
std::string trackCollName_
 
double TS4TS5EnergyThreshold_
 
std::vector< std::pair< double,
double > > 
TS4TS5LowerCut_
 
std::vector< std::pair< double,
double > > 
TS4TS5UpperCut_
 
bool useCalibDigi_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- 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)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 45 of file HcalNoiseInfoProducer.h.

Constructor & Destructor Documentation

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

Definition at line 30 of file HcalNoiseInfoProducer.cc.

References adc2fC, calibdigiHBHEthreshold_, calibdigiHBHEtimeslices_, calibdigiHFthreshold_, calibdigiHFtimeslices_, calotower_token_, caloTowerCollName_, digiCollName_, edm::ParameterSet::exists(), edm::ParameterSet::existsAs(), fillCaloTowers_, fillDigis_, fillRecHits_, fillTracks_, edm::ParameterSet::getParameter(), hbhedigi_token_, hbherechit_token_, HcalAcceptSeverityLevel_, hcalcalibdigi_token_, HcalRecHitFlagsToBeExcluded_, i, maxCaloTowerIEta_, maxProblemRBXs_, maxTrackEta_, minHighHitE_, minLowHitE_, minR45HitE_, minRecHitE_, minTrackPt_, recHitCollName_, python.multivaluedict::sort(), AlCaHLTBitMon_QueryRunRegistry::string, track_token_, trackCollName_, TS4TS5EnergyThreshold_, TS4TS5LowerCut_, TS4TS5UpperCut_, and useCalibDigi_.

30  : algo_(iConfig)
31 {
32  // set the parameters
33  fillDigis_ = iConfig.getParameter<bool>("fillDigis");
34  fillRecHits_ = iConfig.getParameter<bool>("fillRecHits");
35  fillCaloTowers_ = iConfig.getParameter<bool>("fillCaloTowers");
36  fillTracks_ = iConfig.getParameter<bool>("fillTracks");
37 
38  maxProblemRBXs_ = iConfig.getParameter<int>("maxProblemRBXs");
39 
40  maxCaloTowerIEta_ = iConfig.getParameter<int>("maxCaloTowerIEta");
41  maxTrackEta_ = iConfig.getParameter<double>("maxTrackEta");
42  minTrackPt_ = iConfig.getParameter<double>("minTrackPt");
43 
44  digiCollName_ = iConfig.getParameter<std::string>("digiCollName");
45  recHitCollName_ = iConfig.getParameter<std::string>("recHitCollName");
46  caloTowerCollName_ = iConfig.getParameter<std::string>("caloTowerCollName");
47  trackCollName_ = iConfig.getParameter<std::string>("trackCollName");
48 
49  minRecHitE_ = iConfig.getParameter<double>("minRecHitE");
50  minLowHitE_ = iConfig.getParameter<double>("minLowHitE");
51  minHighHitE_ = iConfig.getParameter<double>("minHighHitE");
52  if(iConfig.existsAs<double>("minR45HitE"))
53  minR45HitE_ = iConfig.getParameter<double>("minR45HitE");
54 
55  HcalAcceptSeverityLevel_ = iConfig.getParameter<uint32_t>("HcalAcceptSeverityLevel");
56  if (iConfig.exists("HcalRecHitFlagsToBeExcluded"))
57  HcalRecHitFlagsToBeExcluded_ = iConfig.getParameter<std::vector<int> >("HcalRecHitFlagsToBeExcluded");
58  else{
59  edm::LogWarning("MisConfiguration")<<"the module is missing the parameter HcalAcceptSeverityLevel. created empty.";
61  }
62 
63  // Digi threshold and time slices to use for HBHE and HF calibration digis
64  useCalibDigi_ = true;
65  if(iConfig.existsAs<double>("calibdigiHBHEthreshold") == false) useCalibDigi_ = false;
66  if(iConfig.existsAs<double>("calibdigiHFthreshold") == false) useCalibDigi_ = false;
67  if(iConfig.existsAs<std::vector<int> >("calibdigiHBHEtimeslices") == false) useCalibDigi_ = false;
68  if(iConfig.existsAs<std::vector<int> >("calibdigiHFtimeslices") == false) useCalibDigi_ = false;
69 
70  if(useCalibDigi_ == true)
71  {
72  calibdigiHBHEthreshold_ = iConfig.getParameter<double>("calibdigiHBHEthreshold");
73  calibdigiHBHEtimeslices_ = iConfig.getParameter<std::vector<int> >("calibdigiHBHEtimeslices");
74  calibdigiHFthreshold_ = iConfig.getParameter<double>("calibdigiHFthreshold");
75  calibdigiHFtimeslices_ = iConfig.getParameter<std::vector<int> >("calibdigiHFtimeslices");
76  }
77  else
78  {
80  calibdigiHBHEtimeslices_ = std::vector<int>();
82  calibdigiHFtimeslices_ = std::vector<int>();
83  }
84 
85  TS4TS5EnergyThreshold_ = iConfig.getParameter<double>("TS4TS5EnergyThreshold");
86 
87  std::vector<double> TS4TS5UpperThresholdTemp = iConfig.getParameter<std::vector<double> >("TS4TS5UpperThreshold");
88  std::vector<double> TS4TS5UpperCutTemp = iConfig.getParameter<std::vector<double> >("TS4TS5UpperCut");
89  std::vector<double> TS4TS5LowerThresholdTemp = iConfig.getParameter<std::vector<double> >("TS4TS5LowerThreshold");
90  std::vector<double> TS4TS5LowerCutTemp = iConfig.getParameter<std::vector<double> >("TS4TS5LowerCut");
91 
92  for(int i = 0; i < (int)TS4TS5UpperThresholdTemp.size() && i < (int)TS4TS5UpperCutTemp.size(); i++)
93  TS4TS5UpperCut_.push_back(std::pair<double, double>(TS4TS5UpperThresholdTemp[i], TS4TS5UpperCutTemp[i]));
94  sort(TS4TS5UpperCut_.begin(), TS4TS5UpperCut_.end());
95 
96  for(int i = 0; i < (int)TS4TS5LowerThresholdTemp.size() && i < (int)TS4TS5LowerCutTemp.size(); i++)
97  TS4TS5LowerCut_.push_back(std::pair<double, double>(TS4TS5LowerThresholdTemp[i], TS4TS5LowerCutTemp[i]));
98  sort(TS4TS5LowerCut_.begin(), TS4TS5LowerCut_.end());
99 
100  // if digis are filled, then rechits must also be filled
101  if(fillDigis_ && !fillRecHits_) {
102  fillRecHits_=true;
103  edm::LogWarning("HCalNoiseInfoProducer") << " forcing fillRecHits to be true if fillDigis is true.\n";
104  }
105 
106  const float adc2fCTemp[128]={-0.5,0.5,1.5,2.5,3.5,4.5,5.5,6.5,7.5,8.5,9.5,10.5,11.5,12.5,
107  13.5,15.,17.,19.,21.,23.,25.,27.,29.5,32.5,35.5,38.5,42.,46.,50.,54.5,59.5,
108  64.5,59.5,64.5,69.5,74.5,79.5,84.5,89.5,94.5,99.5,104.5,109.5,114.5,119.5,
109  124.5,129.5,137.,147.,157.,167.,177.,187.,197.,209.5,224.5,239.5,254.5,272.,
110  292.,312.,334.5,359.5,384.5,359.5,384.5,409.5,434.5,459.5,484.5,509.5,534.5,
111  559.5,584.5,609.5,634.5,659.5,684.5,709.5,747.,797.,847.,897.,947.,997.,
112  1047.,1109.5,1184.5,1259.5,1334.5,1422.,1522.,1622.,1734.5,1859.5,1984.5,
113  1859.5,1984.5,2109.5,2234.5,2359.5,2484.5,2609.5,2734.5,2859.5,2984.5,
114  3109.5,3234.5,3359.5,3484.5,3609.5,3797.,4047.,4297.,4547.,4797.,5047.,
115  5297.,5609.5,5984.5,6359.5,6734.5,7172.,7672.,8172.,8734.5,9359.5,9984.5};
116  for(int i = 0; i < 128; i++)
117  adc2fC[i] = adc2fCTemp[i];
118 
119  hbhedigi_token_ = consumes<HBHEDigiCollection>(edm::InputTag(digiCollName_));
120  hcalcalibdigi_token_ = consumes<HcalCalibDigiCollection>(edm::InputTag("hcalDigis"));
121  hbherechit_token_ = consumes<HBHERecHitCollection>(edm::InputTag(recHitCollName_));
122  calotower_token_ = consumes<CaloTowerCollection>(edm::InputTag(caloTowerCollName_));
123  track_token_ = consumes<reco::TrackCollection>(edm::InputTag(trackCollName_));
124 
125  // we produce a vector of HcalNoiseRBXs
126  produces<HcalNoiseRBXCollection>();
127  // we also produce a noise summary
128  produces<HcalNoiseSummary>();
129 }
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
std::vector< int > calibdigiHFtimeslices_
std::vector< int > HcalRecHitFlagsToBeExcluded_
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:184
std::vector< std::pair< double, double > > TS4TS5LowerCut_
bool exists(std::string const &parameterName) const
checks if a parameter exists
edm::EDGetTokenT< HcalCalibDigiCollection > hcalcalibdigi_token_
edm::EDGetTokenT< HBHEDigiCollection > hbhedigi_token_
std::vector< std::pair< double, double > > TS4TS5UpperCut_
edm::EDGetTokenT< reco::TrackCollection > track_token_
edm::EDGetTokenT< HBHERecHitCollection > hbherechit_token_
std::vector< int > calibdigiHBHEtimeslices_
edm::EDGetTokenT< CaloTowerCollection > calotower_token_
HcalNoiseInfoProducer::~HcalNoiseInfoProducer ( )

Definition at line 132 of file HcalNoiseInfoProducer.cc.

133 {
134 }

Member Function Documentation

void HcalNoiseInfoProducer::fillcalotwrs ( edm::Event iEvent,
const edm::EventSetup iSetup,
HcalNoiseRBXArray array,
HcalNoiseSummary summary 
) const
private

Definition at line 667 of file HcalNoiseInfoProducer.cc.

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

Referenced by produce().

668 {
669  // get the calotowers
671  // iEvent.getByLabel(caloTowerCollName_, handle);
672  iEvent.getByToken(calotower_token_, handle);
673 
674  if(!handle.isValid()) {
676  << " could not find CaloTowerCollection named " << caloTowerCollName_ << "\n.";
677  return;
678  }
679 
680  summary.emenergy_ = summary.hadenergy_ = 0.0;
681 
682  // loop over all of the calotower information
683  for(CaloTowerCollection::const_iterator it = handle->begin(); it!=handle->end(); ++it) {
684  const CaloTower& twr=(*it);
685 
686  // create a persistent reference to the tower
687  edm::Ref<CaloTowerCollection> myRef(handle, it-handle->begin());
688 
689  // get all of the hpd's that are pointed to by the calotower
690  std::vector<std::vector<HcalNoiseHPD>::iterator> hpditervec;
691  array.findHPD(twr, hpditervec);
692 
693  // loop over the hpd's and add the reference to the RefVectors
694  for(std::vector<std::vector<HcalNoiseHPD>::iterator>::iterator it=hpditervec.begin();
695  it!=hpditervec.end(); ++it)
696  (*it)->calotowers_.push_back(myRef);
697 
698  // skip over anything with |ieta|>maxCaloTowerIEta
699  if(twr.ietaAbs()>maxCaloTowerIEta_) {
700  summary.emenergy_ += twr.emEnergy();
701  summary.hadenergy_ += twr.hadEnergy();
702  }
703  }
704 
705  return;
706 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:446
std::vector< CaloTower >::const_iterator const_iterator
double emEnergy() const
Definition: CaloTower.h:94
tuple handle
Definition: patZpeak.py:22
std::vector< HcalNoiseHPD >::iterator findHPD(int hpdindex)
bool isValid() const
Definition: HandleBase.h:76
double hadEnergy() const
Definition: CaloTower.h:95
int ietaAbs() const
Definition: CaloTower.h:170
edm::EDGetTokenT< CaloTowerCollection > calotower_token_
void HcalNoiseInfoProducer::filldigis ( edm::Event iEvent,
const edm::EventSetup iSetup,
HcalNoiseRBXArray array,
HcalNoiseSummary summary 
)
private

Definition at line 310 of file HcalNoiseInfoProducer.cc.

References ecalMGPA::adc(), HcalCoderDb::adc2fC(), adc2fC, reco::HcalNoiseRBX::allCharge_, edm::RefVector< C, T, F >::begin(), reco::HcalNoiseHPD::big5Charge_, reco::HcalNoiseHPD::bigCharge_, HcalNoiseSummary::calibCharge_, HcalNoiseSummary::calibChargegt15TS45_, HcalNoiseSummary::calibChargeTS45_, HcalNoiseSummary::calibCountgt15TS45_, HcalNoiseSummary::calibCountHF_, HcalNoiseSummary::calibCountTS45_, calibdigiHBHEthreshold_, calibdigiHBHEtimeslices_, calibdigiHFthreshold_, calibdigiHFtimeslices_, HcalCalibDetId::calibFlavor(), counter, digiCollName_, HcalSeverityLevelComputer::dropChannel(), edm::RefVector< C, T, F >::end(), edm::hlt::Exception, reco::HcalNoiseRBXArray::findHPD(), reco::HcalNoiseRBXArray::findRBX(), edm::EventSetup::get(), edm::Event::getByToken(), HcalChannelStatus::getValue(), HcalCondObjectContainer< Item >::getValues(), patZpeak::handle, hbhedigi_token_, HcalBarrel, hcalcalibdigi_token_, HcalChannelStatus::HcalCellExcludeFromHBHENoiseSummary, HcalEndcap, HcalForward, HcalCalibDetId::HOCrosstalk, i, HBHEDataFrame::id(), edm::HandleBase::isValid(), reco::HcalNoiseHPD::maxZeros_, HcalCalibrations::pedestal(), edm::ESHandle< class >::product(), edm::errors::ProductNotFound, DetId::rawId(), HI_PhotonSkim_cff::rechits, reco::HcalNoiseHPD::rechits_, CaloSamples::size(), TotalCalibCharge, reco::HcalNoiseHPD::totalZeros_, and HBHEDataFrame::zsMarkAndPass().

Referenced by produce().

311 {
312  // Some initialization
313  TotalCalibCharge = 0;
314 
315  // Starting with this version (updated by Jeff Temple on Dec. 6, 2012), the "TS45" names in the variables are mis-nomers. The actual time slices used are determined from the digiTimeSlices_ variable, which may not be limited to only time slices 4 and 5. For now, "TS45" name kept, because that is what is used in HcalNoiseSummary object (in GetCalibCountTS45, etc.). Likewise, the charge value in 'gt15' is now configurable, though the name remains the same. For HBHE, we track both the number of calibration channels (NcalibTS45) and the number of calibration channels above threshold (NcalibTS45gt15). For HF, we track only the number of channels above the given threshold in the given time window (NcalibHFgtX). Default for HF in 2012 is to use the full time sample with effectively no threshold (threshold=-999)
316  int NcalibTS45=0;
317  int NcalibTS45gt15=0;
318  int NcalibHFgtX=0;
319 
320  double chargecalibTS45=0;
321  double chargecalibgt15TS45=0;
322 
323  // get the conditions and channel quality
324  edm::ESHandle<HcalDbService> conditions;
325  iSetup.get<HcalDbRecord>().get(conditions);
327  iSetup.get<HcalChannelQualityRcd>().get("withTopo",qualhandle);
328  const HcalChannelQuality* myqual = qualhandle.product();
330  iSetup.get<HcalSeverityLevelComputerRcd>().get(mycomputer);
331  const HcalSeverityLevelComputer* mySeverity = mycomputer.product();
332 
333  // get the digis
335  // iEvent.getByLabel(digiCollName_, handle);
336  iEvent.getByToken(hbhedigi_token_, handle);
337 
338  if(!handle.isValid()) {
339  throw edm::Exception(edm::errors::ProductNotFound) << " could not find HBHEDigiCollection named " << digiCollName_ << "\n.";
340  return;
341  }
342 
343  // loop over all of the digi information
344  for(HBHEDigiCollection::const_iterator it=handle->begin(); it!=handle->end(); ++it) {
345  const HBHEDataFrame &digi=(*it);
346  HcalDetId cell = digi.id();
347  DetId detcell=(DetId)cell;
348 
349  // check on cells to be ignored and dropped
350  const HcalChannelStatus* mydigistatus=myqual->getValues(detcell.rawId());
351  if(mySeverity->dropChannel(mydigistatus->getValue())) continue;
352  if(digi.zsMarkAndPass()) continue;
353  // Drop if exclude bit set
354  if ((mydigistatus->getValue() & (1 <<HcalChannelStatus::HcalCellExcludeFromHBHENoiseSummary))==1) continue;
355 
356  // get the calibrations and coder
357  const HcalCalibrations& calibrations=conditions->getHcalCalibrations(cell);
358  const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
359  const HcalQIEShape* shape = conditions->getHcalShape(channelCoder);
360  HcalCoderDb coder (*channelCoder, *shape);
361 
362  // match the digi to an rbx and hpd
363  HcalNoiseRBX &rbx=(*array.findRBX(digi));
364  HcalNoiseHPD &hpd=(*array.findHPD(digi));
365 
366  // determine if the digi is one the highest energy hits in the HPD
367  // this works because the rechits are sorted by energy (see fillrechits() below)
368  bool isBig=false, isBig5=false, isRBX=false;
369  int counter=0;
372  rit!=rechits.end(); ++rit, ++counter) {
373  if((*rit)->id() == digi.id()) {
374  if(counter==0) isBig=isBig5=true; // digi is also the highest energy rechit
375  if(counter<5) isBig5=true; // digi is one of 5 highest energy rechits
376  isRBX=true;
377  }
378  }
379 
380  // loop over each of the digi's time slices
381  int totalzeros=0;
382  CaloSamples tool;
383  coder.adc2fC(digi,tool);
384  for(int ts=0; ts<tool.size(); ++ts) {
385 
386  // count zero's
387  if(digi[ts].adc()==0) {
388  ++hpd.totalZeros_;
389  ++totalzeros;
390  }
391 
392  // get the fC's
393  double corrfc = tool[ts]-calibrations.pedestal(digi[ts].capid());
394 
395  // fill the relevant digi arrays
396  if(isBig) hpd.bigCharge_[ts]+=corrfc;
397  if(isBig5) hpd.big5Charge_[ts]+=corrfc;
398  if(isRBX) rbx.allCharge_[ts]+=corrfc;
399  }
400 
401  // record the maximum number of zero's found
402  if(totalzeros>hpd.maxZeros_)
403  hpd.maxZeros_=totalzeros;
404  }
405 
406  // get the calibration digis
408  // iEvent.getByLabel("hcalDigis", hCalib);
409  iEvent.getByToken(hcalcalibdigi_token_, hCalib);
410 
411  // get total charge in calibration channels
412  if(hCalib.isValid() == true)
413  {
414  for(HcalCalibDigiCollection::const_iterator digi = hCalib->begin(); digi != hCalib->end(); digi++)
415  {
416  if(digi->id().hcalSubdet() == 0)
417  continue;
418 
419  /*
420  HcalCalibDetId cell = digi->id();
421  DetId detcell = (DetId)cell;
422 
423  const HcalChannelStatus* mydigistatus=myqual->getValues(detcell.rawId());
424 
425  if(mySeverity->dropChannel(mydigistatus->getValue()))
426  continue;
427  if(digi->zsMarkAndPass())
428  continue;
429 
430  const HcalQIECoder *channelCoder = conditions->getHcalCoder(cell);
431  const HcalQIEShape* shape = conditions->getHcalShape(channelCoder);
432  HcalCoderDb coder(*channelCoder, *shape);
433 
434  CaloSamples tool;
435  coder.adc2fC(*digi, tool);
436 
437  for(int i = 0; i < (int)digi->size(); i++)
438  TotalCalibCharge = TotalCalibCharge + tool[i];
439  */
440 
441  // Original code computes total calib charge over all digis. While I think it would be more useful to skip
442  // zs mark-and-pass channels, I keep this computation as is. Individual HBHE and HF variables do skip
443  // the m-p channels. -- Jeff Temple, 6 December 2012
444 
445  for(int i = 0; i < (int)digi->size(); i++)
446  TotalCalibCharge = TotalCalibCharge + adc2fC[digi->sample(i).adc()&0xff];
447 
448 
449  HcalCalibDetId myid=(HcalCalibDetId)digi->id();
451  continue; // ignore HOCrosstalk channels
452  if(digi->zsMarkAndPass()) continue; // skip "mark-and-pass" channels when computing charge in calib channels
453 
454 
455  if (digi->id().hcalSubdet()==HcalForward) // check HF
456  {
457  double sumChargeHF=0;
458  for (unsigned int i=0;i<calibdigiHFtimeslices_.size();++i)
459  {
460  // skip unphysical time slices
462  continue;
463  sumChargeHF+=adc2fC[digi->sample(calibdigiHFtimeslices_[i]).adc()&0xff];
464  }
465  if (sumChargeHF>calibdigiHFthreshold_) ++NcalibHFgtX;
466  } // end of HF check
467  else if (digi->id().hcalSubdet()==HcalBarrel || digi->id().hcalSubdet()==HcalEndcap) // now check HBHE
468  {
469  double sumChargeHBHE=0;
470  for (unsigned int i=0;i<calibdigiHBHEtimeslices_.size();++i)
471  {
472  // skip unphysical time slices
474  continue;
475  sumChargeHBHE+=adc2fC[digi->sample(calibdigiHBHEtimeslices_[i]).adc()&0xff];
476  }
477  ++NcalibTS45;
478  chargecalibTS45+=sumChargeHBHE;
479  if (sumChargeHBHE>calibdigiHBHEthreshold_)
480  {
481  ++NcalibTS45gt15;
482  chargecalibgt15TS45+=sumChargeHBHE;
483  }
484  } // end of HBHE check
485  } // loop on HcalCalibDigiCollection
486  } // if (hCalib.isValid()==true)
487 
488  summary.calibCharge_ = TotalCalibCharge;
489  summary.calibCountTS45_=NcalibTS45;
490  summary.calibCountgt15TS45_=NcalibTS45gt15;
491  summary.calibChargeTS45_=chargecalibTS45;
492  summary.calibChargegt15TS45_=chargecalibgt15TS45;
493  summary.calibCountHF_=NcalibHFgtX;
494 
495  return;
496 }
int adc(sample_type sample)
get the ADC sample (12 bits)
int i
Definition: DBlmapReader.cc:9
std::vector< int > calibdigiHFtimeslices_
bool zsMarkAndPass() const
was ZS MarkAndPass?
Definition: HBHEDataFrame.h:30
CalibDetType calibFlavor() const
get the flavor of this calibration detid
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:446
int adc() const
get the ADC sample
Definition: HcalQIESample.h:22
int size() const
total number of samples in the digi
Definition: HBHEDataFrame.h:26
std::vector< HBHEDataFrame >::const_iterator const_iterator
std::vector< float > bigCharge_
Definition: HcalNoiseHPD.h:137
std::vector< float > big5Charge_
Definition: HcalNoiseHPD.h:138
double pedestal(int fCapId) const
get pedestal for capid=0..3
const Item * getValues(DetId fId, bool throwOnFail=true) const
const_iterator end() const
Termination of iteration.
Definition: RefVector.h:249
const_iterator begin() const
Initialize an iterator over the RefVector.
Definition: RefVector.h:244
edm::RefVector< HBHERecHitCollection > rechits_
Definition: HcalNoiseHPD.h:141
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
HcalNoiseRBXArray::iterator findRBX(int rbxindex)
edm::EDGetTokenT< HcalCalibDigiCollection > hcalcalibdigi_token_
tuple handle
Definition: patZpeak.py:22
std::vector< HcalNoiseHPD >::iterator findHPD(int hpdindex)
bool dropChannel(const uint32_t &mystatus) const
edm::EDGetTokenT< HBHEDigiCollection > hbhedigi_token_
bool isValid() const
Definition: HandleBase.h:76
std::vector< float > allCharge_
Definition: HcalNoiseRBX.h:115
Definition: DetId.h:18
int size() const
get the size
Definition: CaloSamples.h:24
const HcalQIESample & sample(int i) const
access a sample
Definition: HBHEDataFrame.h:39
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:86
static std::atomic< unsigned int > counter
std::vector< int > calibdigiHBHEtimeslices_
const HcalDetId & id() const
Definition: HBHEDataFrame.h:22
uint32_t getValue() const
void HcalNoiseInfoProducer::fillOtherSummaryVariables ( HcalNoiseSummary summary,
const CommonHcalNoiseRBXData data 
) const
private

Definition at line 214 of file HcalNoiseInfoProducer.cc.

References algo_, HcalNoiseSummary::cnthit10_, HcalNoiseSummary::cnthit25_, CommonHcalNoiseRBXData::e10ts(), CommonHcalNoiseRBXData::e2ts(), HcalNoiseSummary::filterstatus_, HcalNoiseSummary::hasBadRBXRechitR45Loose_, HcalNoiseSummary::hasBadRBXRechitR45Tight_, HcalNoiseSummary::hasBadRBXTS4TS5_, 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::passLooseRBXRechitR45(), HcalNoiseAlgo::passLooseTiming(), HcalNoiseAlgo::passLooseZeros(), HcalNoiseAlgo::passRatioThreshold(), HcalNoiseAlgo::passTightHits(), HcalNoiseAlgo::passTightNoiseFilter(), HcalNoiseAlgo::passTightRatio(), HcalNoiseAlgo::passTightRBXRechitR45(), HcalNoiseAlgo::passTightTiming(), HcalNoiseAlgo::passTightZeros(), CommonHcalNoiseRBXData::PassTS4TS5(), HcalNoiseAlgo::passZerosThreshold(), CommonHcalNoiseRBXData::ratio(), CommonHcalNoiseRBXData::RBXEMF(), CommonHcalNoiseRBXData::rbxTowers(), HcalNoiseSummary::rms10_, HcalNoiseSummary::rms25_, HcalNoiseSummary::tightnoisetwrs_, and CommonHcalNoiseRBXData::validRatio().

Referenced by produce().

215 {
216  // charge ratio
217  if(algo_.passRatioThreshold(data) && data.validRatio()) {
218  if(data.ratio()<summary.minE2Over10TS()) {
219  summary.mine2ts_ = data.e2ts();
220  summary.mine10ts_ = data.e10ts(); }
221  if(data.ratio()>summary.maxE2Over10TS()) {
222  summary.maxe2ts_ = data.e2ts();
223  summary.maxe10ts_ = data.e10ts();
224  }
225  }
226 
227  // ADC zeros
228  if(algo_.passZerosThreshold(data)) {
229  if(data.numZeros()>summary.maxZeros()) {
230  summary.maxzeros_ = data.numZeros();
231  }
232  }
233 
234  // hits count
235  if(data.numHPDHits() > summary.maxHPDHits()) {
236  summary.maxhpdhits_ = data.numHPDHits();
237  }
238  if(data.numRBXHits() > summary.maxRBXHits()) {
239  summary.maxrbxhits_ = data.numRBXHits();
240  }
241  if(data.numHPDNoOtherHits() > summary.maxHPDNoOtherHits()) {
242  summary.maxhpdhitsnoother_ = data.numHPDNoOtherHits();
243  }
244 
245  // TS4TS5
246  if(data.PassTS4TS5() == false)
247  summary.hasBadRBXTS4TS5_ = true;
248 
249  if(algo_.passLooseRBXRechitR45(data) == false)
250  summary.hasBadRBXRechitR45Loose_ = true;
251  if(algo_.passTightRBXRechitR45(data) == false)
252  summary.hasBadRBXRechitR45Tight_ = true;
253 
254  // hit timing
255  if(data.minLowEHitTime()<summary.min10GeVHitTime()) {
256  summary.min10_ = data.minLowEHitTime();
257  }
258  if(data.maxLowEHitTime()>summary.max10GeVHitTime()) {
259  summary.max10_ = data.maxLowEHitTime();
260  }
261  summary.rms10_ += data.lowEHitTimeSqrd();
262  summary.cnthit10_ += data.numLowEHits();
263  if(data.minHighEHitTime()<summary.min25GeVHitTime()) {
264  summary.min25_ = data.minHighEHitTime();
265  }
266  if(data.maxHighEHitTime()>summary.max25GeVHitTime()) {
267  summary.max25_ = data.maxHighEHitTime();
268  }
269  summary.rms25_ += data.highEHitTimeSqrd();
270  summary.cnthit25_ += data.numHighEHits();
271 
272  // EMF
273  if(algo_.passEMFThreshold(data)) {
274  if(summary.minHPDEMF() > data.HPDEMF()) {
275  summary.minhpdemf_ = data.HPDEMF();
276  }
277  if(summary.minRBXEMF() > data.RBXEMF()) {
278  summary.minrbxemf_ = data.RBXEMF();
279  }
280  }
281 
282  // summary flag
283  if(!algo_.passLooseRatio(data)) summary.filterstatus_ |= 0x1;
284  if(!algo_.passLooseHits(data)) summary.filterstatus_ |= 0x2;
285  if(!algo_.passLooseZeros(data)) summary.filterstatus_ |= 0x4;
286  if(!algo_.passLooseTiming(data)) summary.filterstatus_ |= 0x8;
287 
288  if(!algo_.passTightRatio(data)) summary.filterstatus_ |= 0x100;
289  if(!algo_.passTightHits(data)) summary.filterstatus_ |= 0x200;
290  if(!algo_.passTightZeros(data)) summary.filterstatus_ |= 0x400;
291  if(!algo_.passTightTiming(data)) summary.filterstatus_ |= 0x800;
292 
293  if(!algo_.passHighLevelNoiseFilter(data)) summary.filterstatus_ |= 0x10000;
294 
295  // summary refvectors
297  if(!algo_.passLooseNoiseFilter(data))
298  join(summary.loosenoisetwrs_, data.rbxTowers());
299  if(!algo_.passTightNoiseFilter(data))
300  join(summary.tightnoisetwrs_, data.rbxTowers());
302  join(summary.hlnoisetwrs_, data.rbxTowers());
303 
304  return;
305 }
double e10ts(void) const
Definition: HcalNoiseAlgo.h:23
double HPDEMF(void) const
Definition: HcalNoiseAlgo.h:38
double e2ts(void) const
Definition: HcalNoiseAlgo.h:22
edm::RefVector< CaloTowerCollection > hlnoisetwrs_
double lowEHitTimeSqrd(void) const
Definition: HcalNoiseAlgo.h:31
bool passTightRatio(const CommonHcalNoiseRBXData &) const
double minLowEHitTime(void) const
Definition: HcalNoiseAlgo.h:29
bool passLooseRatio(const CommonHcalNoiseRBXData &) const
bool passTightRBXRechitR45(const CommonHcalNoiseRBXData &) const
double maxHighEHitTime(void) const
Definition: HcalNoiseAlgo.h:34
bool passTightTiming(const CommonHcalNoiseRBXData &) const
double maxLowEHitTime(void) const
Definition: HcalNoiseAlgo.h:30
int numLowEHits(void) const
Definition: HcalNoiseAlgo.h:32
double ratio(void) const
Definition: HcalNoiseAlgo.h:21
float maxE2Over10TS(void) const
edm::RefVector< CaloTowerCollection > loosenoisetwrs_
bool passLooseRBXRechitR45(const CommonHcalNoiseRBXData &) const
float min25GeVHitTime(void) const
bool passHighLevelNoiseFilter(const CommonHcalNoiseRBXData &) const
double RBXEMF(void) const
Definition: HcalNoiseAlgo.h:37
int numRBXHits(void) const
Definition: HcalNoiseAlgo.h:26
float min10GeVHitTime(void) const
double highEHitTimeSqrd(void) const
Definition: HcalNoiseAlgo.h:35
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:36
bool passRatioThreshold(const CommonHcalNoiseRBXData &) const
int numHPDNoOtherHits(void) const
Definition: HcalNoiseAlgo.h:27
int numZeros(void) const
Definition: HcalNoiseAlgo.h:28
bool passZerosThreshold(const CommonHcalNoiseRBXData &) const
float minHPDEMF(void) const
bool passLooseNoiseFilter(const CommonHcalNoiseRBXData &) const
edm::RefVector< CaloTowerCollection > rbxTowers(void) const
Definition: HcalNoiseAlgo.h:40
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:33
float minRBXEMF(void) const
bool PassTS4TS5(void) const
Definition: HcalNoiseAlgo.h:39
bool passEMFThreshold(const CommonHcalNoiseRBXData &) const
int maxHPDHits(void) const
int numHPDHits(void) const
Definition: HcalNoiseAlgo.h:25
float max25GeVHitTime(void) const
float max10GeVHitTime(void) const
bool validRatio(void) const
Definition: HcalNoiseAlgo.h:24
bool passTightHits(const CommonHcalNoiseRBXData &) const
void HcalNoiseInfoProducer::fillrechits ( edm::Event iEvent,
const edm::EventSetup iSetup,
HcalNoiseRBXArray array,
HcalNoiseSummary summary 
) const
private

Definition at line 500 of file HcalNoiseInfoProducer.cc.

References CaloRecHit::detid(), CaloRecHit::energy(), HcalNoiseSummary::energyInLaserRegion_, HcalNoiseSummary::energyInNonLaserRegion_, edm::hlt::Exception, reco::HcalNoiseRBXArray::findHPD(), CaloRecHit::flags(), HcalNoiseSummary::flatnoisee_, HcalNoiseSummary::flatnoiseet_, edm::EventSetup::get(), edm::Event::getByToken(), CaloGeometry::getPosition(), HcalSeverityLevelComputer::getSeverityLevel(), HcalChannelStatus::getValue(), HcalCondObjectContainer< Item >::getValues(), patZpeak::handle, HcalCaloFlagLabels::HBHEFlatNoise, HcalCaloFlagLabels::HBHEIsolatedNoise, HcalCaloFlagLabels::HBHENegativeNoise, hbherechit_token_, HcalCaloFlagLabels::HBHESpikeNoise, HcalCaloFlagLabels::HBHETriangleNoise, HcalCaloFlagLabels::HBHETS4TS5Noise, HcalAcceptSeverityLevel_, HcalChannelStatus::HcalBadLaserSignal, HcalChannelStatus::HcalCellExcludeFromHBHENoiseSummary, HcalChannelStatus::HcalCellExcludeFromHBHENoiseSummaryR45, HcalRecHitFlagsToBeExcluded_, HcalNoiseSummary::hitsInLaserRegion_, HcalNoiseSummary::hitsInNonLaserRegion_, i, HBHERecHit::id(), HcalNoiseSummary::isolnoisee_, HcalNoiseSummary::isolnoiseet_, edm::HandleBase::isValid(), HcalNoiseSummary::negativenoisee_, HcalNoiseSummary::negativenoiseet_, HcalNoiseSummary::nflatnoise_, HcalNoiseSummary::nisolnoise_, HcalNoiseSummary::nnegativenoise_, HcalNoiseSummary::nspikenoise_, HcalNoiseSummary::ntrianglenoise_, HcalNoiseSummary::nts4ts5noise_, edm::ESHandle< class >::product(), edm::errors::ProductNotFound, recHitCollName_, HcalNoiseSummary::rechitCount15_, HcalNoiseSummary::rechitCount_, HcalNoiseSummary::rechitEnergy15_, HcalNoiseSummary::rechitEnergy_, HcalSeverityLevelComputer::recoveredRecHit(), reco::HcalNoiseHPD::refrechitset_, HcalNoiseSummary::spikenoisee_, HcalNoiseSummary::spikenoiseet_, HcalNoiseSummary::trianglenoisee_, HcalNoiseSummary::trianglenoiseet_, HcalNoiseSummary::ts4ts5noisee_, and HcalNoiseSummary::ts4ts5noiseet_.

Referenced by produce().

501 {
502  // get the HCAL channel status map
504  iSetup.get<HcalChannelQualityRcd>().get( "withTopo", hcalChStatus );
505  const HcalChannelQuality* dbHcalChStatus = hcalChStatus.product();
506 
507  // get the severity level computer
508  edm::ESHandle<HcalSeverityLevelComputer> hcalSevLvlComputerHndl;
509  iSetup.get<HcalSeverityLevelComputerRcd>().get(hcalSevLvlComputerHndl);
510  const HcalSeverityLevelComputer* hcalSevLvlComputer = hcalSevLvlComputerHndl.product();
511 
512  // get the calo geometry
514  iSetup.get<CaloGeometryRecord>().get(pG);
515  const CaloGeometry* geo = pG.product();
516 
517  // get the rechits
519  // iEvent.getByLabel(recHitCollName_, handle);
520  iEvent.getByToken(hbherechit_token_, handle);
521 
522  if(!handle.isValid()) {
524  << " could not find HBHERecHitCollection named " << recHitCollName_ << "\n.";
525  return;
526  }
527 
528  summary.rechitCount_ = 0;
529  summary.rechitCount15_ = 0;
530  summary.rechitEnergy_ = 0;
531  summary.rechitEnergy15_ = 0;
532 
533  summary.hitsInLaserRegion_=0;
534  summary.hitsInNonLaserRegion_=0;
535  summary.energyInLaserRegion_=0;
536  summary.energyInNonLaserRegion_=0;
537 
538 
539 
540  // loop over all of the rechit information
541  for(HBHERecHitCollection::const_iterator it=handle->begin(); it!=handle->end(); ++it) {
542  const HBHERecHit &rechit=(*it);
543 
544  // skip bad rechits (other than those flagged by the isolated noise, triangle, flat, and spike algorithms)
545  const DetId id = rechit.detid();
546  uint32_t recHitFlag = rechit.flags();
547  uint32_t isolbitset = (1 << HcalCaloFlagLabels::HBHEIsolatedNoise);
548  uint32_t flatbitset = (1 << HcalCaloFlagLabels::HBHEFlatNoise);
549  uint32_t spikebitset = (1 << HcalCaloFlagLabels::HBHESpikeNoise);
550  uint32_t trianglebitset = (1 << HcalCaloFlagLabels::HBHETriangleNoise);
551  uint32_t ts4ts5bitset = (1 << HcalCaloFlagLabels::HBHETS4TS5Noise);
552  uint32_t negativebitset = (1 << HcalCaloFlagLabels::HBHENegativeNoise);
553  for(unsigned int i=0; i<HcalRecHitFlagsToBeExcluded_.size(); i++) {
554  uint32_t bitset = (1 << HcalRecHitFlagsToBeExcluded_[i]);
555  recHitFlag = (recHitFlag & bitset) ? recHitFlag-bitset : recHitFlag;
556  }
557  const uint32_t dbStatusFlag = dbHcalChStatus->getValues(id)->getValue();
558 
559  // Ignore rechit if exclude bit set, regardless of severity of other bits
560  if ((dbStatusFlag & (1 <<HcalChannelStatus::HcalCellExcludeFromHBHENoiseSummary))==1) continue;
561 
562  int severityLevel = hcalSevLvlComputer->getSeverityLevel(id, recHitFlag, dbStatusFlag);
563  bool isRecovered = hcalSevLvlComputer->recoveredRecHit(id, recHitFlag);
564  if(severityLevel!=0 && !isRecovered && severityLevel>static_cast<int>(HcalAcceptSeverityLevel_)) continue;
565 
566  // do some rechit counting and energies
567  summary.rechitCount_ = summary.rechitCount_ + 1;
568  summary.rechitEnergy_ = summary.rechitEnergy_ + rechit.energy();
569  if ((dbStatusFlag & (1 <<HcalChannelStatus::HcalBadLaserSignal))==1) // hit comes from a region where no laser calibration pulse is normally seen
570  {
571  ++summary.hitsInNonLaserRegion_;
572  summary.energyInNonLaserRegion_+=rechit.energy();
573  }
574  else // hit comes from region where laser calibration pulse is seen
575  {
576  ++summary.hitsInLaserRegion_;
577  summary.energyInLaserRegion_+=rechit.energy();
578  }
579 
580  if(rechit.energy() > 1.5)
581  {
582  summary.rechitCount15_ = summary.rechitCount15_ + 1;
583  summary.rechitEnergy15_ = summary.rechitEnergy15_ + rechit.energy();
584  }
585 
586  // if it was ID'd as isolated noise, update the summary object
587  if(rechit.flags() & isolbitset) {
588  summary.nisolnoise_++;
589  summary.isolnoisee_ += rechit.energy();
590  GlobalPoint gp = geo->getPosition(rechit.id());
591  double et = rechit.energy()*gp.perp()/gp.mag();
592  summary.isolnoiseet_ += et;
593  }
594 
595  if(rechit.flags() & flatbitset) {
596  summary.nflatnoise_++;
597  summary.flatnoisee_ += rechit.energy();
598  GlobalPoint gp = geo->getPosition(rechit.id());
599  double et = rechit.energy()*gp.perp()/gp.mag();
600  summary.flatnoiseet_ += et;
601  }
602 
603  if(rechit.flags() & spikebitset) {
604  summary.nspikenoise_++;
605  summary.spikenoisee_ += rechit.energy();
606  GlobalPoint gp = geo->getPosition(rechit.id());
607  double et = rechit.energy()*gp.perp()/gp.mag();
608  summary.spikenoiseet_ += et;
609  }
610 
611  if(rechit.flags() & trianglebitset) {
612  summary.ntrianglenoise_++;
613  summary.trianglenoisee_ += rechit.energy();
614  GlobalPoint gp = geo->getPosition(rechit.id());
615  double et = rechit.energy()*gp.perp()/gp.mag();
616  summary.trianglenoiseet_ += et;
617  }
618 
619  if(rechit.flags() & ts4ts5bitset) {
620  if ((dbStatusFlag & (1 <<HcalChannelStatus::HcalCellExcludeFromHBHENoiseSummaryR45))==0) // only add to TS4TS5 if the bit is not marked as "HcalCellExcludeFromHBHENoiseSummaryR45"
621  {
622  summary.nts4ts5noise_++;
623  summary.ts4ts5noisee_ += rechit.energy();
624  GlobalPoint gp = geo->getPosition(rechit.id());
625  double et = rechit.energy()*gp.perp()/gp.mag();
626  summary.ts4ts5noiseet_ += et;
627  }
628  }
629 
630  if(rechit.flags() & negativebitset) {
631  summary.nnegativenoise_++;
632  summary.negativenoisee_ += rechit.energy();
633  GlobalPoint gp = geo->getPosition(rechit.id());
634  double et = rechit.energy()*gp.perp()/gp.mag();
635  summary.negativenoiseet_ += et;
636  }
637 
638  // find the hpd that the rechit is in
639  HcalNoiseHPD& hpd=(*array.findHPD(rechit));
640 
641  // create a persistent reference to the rechit
642  edm::Ref<HBHERecHitCollection> myRef(handle, it-handle->begin());
643 
644  // store it in a place so that it remains sorted by energy
645  hpd.refrechitset_.insert(myRef);
646 
647  } // end loop over rechits
648 
649  // loop over all HPDs and transfer the information from refrechitset_ to rechits_;
650  for(HcalNoiseRBXArray::iterator rbxit=array.begin(); rbxit!=array.end(); ++rbxit) {
651  for(std::vector<HcalNoiseHPD>::iterator hpdit=rbxit->hpds_.begin(); hpdit!=rbxit->hpds_.end(); ++hpdit) {
652 
653  // loop over all of the entries in the set and add them to rechits_
655  it=hpdit->refrechitset_.begin(); it!=hpdit->refrechitset_.end(); ++it) {
656  hpdit->rechits_.push_back(*it);
657  }
658  }
659  }
660  // now the rechits in all the HPDs are sorted by energy!
661 
662  return;
663 }
int i
Definition: DBlmapReader.cc:9
std::vector< int > HcalRecHitFlagsToBeExcluded_
T perp() const
Definition: PV3DBase.h:72
const DetId & detid() const
Definition: CaloRecHit.h:20
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:446
HcalDetId id() const
get the id
Definition: HBHERecHit.h:23
std::set< edm::Ref< HBHERecHitCollection >, RefHBHERecHitEnergyComparison > refrechitset_
Definition: HcalNoiseHPD.h:145
std::vector< HBHERecHit >::const_iterator const_iterator
const Item * getValues(DetId fId, bool throwOnFail=true) const
T mag() const
Definition: PV3DBase.h:67
float energy() const
Definition: CaloRecHit.h:17
bool recoveredRecHit(const DetId &myid, const uint32_t &myflag) const
uint32_t flags() const
Definition: CaloRecHit.h:21
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
Definition: DetId.h:18
edm::EDGetTokenT< HBHERecHitCollection > hbherechit_token_
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:86
int getSeverityLevel(const DetId &myid, const uint32_t &myflag, const uint32_t &mystatus) const
double energyInNonLaserRegion_
uint32_t getValue() const
void HcalNoiseInfoProducer::filltracks ( edm::Event iEvent,
const edm::EventSetup iSetup,
HcalNoiseSummary summary 
) const
private

Definition at line 710 of file HcalNoiseInfoProducer.cc.

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

Referenced by produce().

711 {
713  // iEvent.getByLabel(trackCollName_, handle);
714  iEvent.getByToken(track_token_, handle);
715 
716  // don't throw exception, just return quietly
717  if(!handle.isValid()) {
718  // throw edm::Exception(edm::errors::ProductNotFound)
719  // << " could not find trackCollection named " << trackCollName_ << "\n.";
720  return;
721  }
722 
723  summary.trackenergy_=0.0;
724  for(reco::TrackCollection::const_iterator iTrack = handle->begin(); iTrack!=handle->end(); ++iTrack) {
725  reco::Track trk=*iTrack;
726  if(trk.pt()<minTrackPt_ || fabs(trk.eta())>maxTrackEta_) continue;
727 
728  summary.trackenergy_ += trk.p();
729  }
730 
731  return;
732 }
double p() const
momentum vector magnitude
Definition: TrackBase.h:663
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:446
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:699
double pt() const
track transverse momentum
Definition: TrackBase.h:669
tuple handle
Definition: patZpeak.py:22
bool isValid() const
Definition: HandleBase.h:76
edm::EDGetTokenT< reco::TrackCollection > track_token_
void HcalNoiseInfoProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::EDProducer.

Definition at line 143 of file HcalNoiseInfoProducer.cc.

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

144 {
145  // this is what we're going to actually write to the EDM
146  std::auto_ptr<HcalNoiseRBXCollection> result1(new HcalNoiseRBXCollection);
147  std::auto_ptr<HcalNoiseSummary> result2(new HcalNoiseSummary);
148 
149  // define an empty HcalNoiseRBXArray that we're going to fill
150  HcalNoiseRBXArray rbxarray;
151  HcalNoiseSummary &summary=*result2;
152 
153  // fill them with the various components
154  // digi assumes that rechit information is available
155  if(fillRecHits_) fillrechits(iEvent, iSetup, rbxarray, summary);
156  if(fillDigis_) filldigis(iEvent, iSetup, rbxarray, summary);
157  if(fillCaloTowers_) fillcalotwrs(iEvent, iSetup, rbxarray, summary);
158  if(fillTracks_) filltracks(iEvent, iSetup, summary);
159 
160  // Why is this here? Shouldn't it have been in the filldigis method? Any reason for TotalCalibCharge to be defined outside filldigis(...) ?-- Jeff, 7/2/12
161  //if(fillDigis_) summary.calibCharge_ = TotalCalibCharge;
162 
163  // select those RBXs which are interesting
164  // also look for the highest energy RBX
165  HcalNoiseRBXArray::iterator maxit=rbxarray.begin();
166  double maxenergy=-999;
167  bool maxwritten=false;
168  for(HcalNoiseRBXArray::iterator rit = rbxarray.begin(); rit!=rbxarray.end(); ++rit) {
169  HcalNoiseRBX &rbx=(*rit);
172 
173  // find the highest energy rbx
174  if(data.energy()>maxenergy) {
175  maxenergy=data.energy();
176  maxit=rit;
177  maxwritten=false;
178  }
179 
180  // find out if the rbx is problematic/noisy/etc.
181  bool writerbx = algo_.isProblematic(data) || !algo_.passLooseNoiseFilter(data) ||
183 
184  // fill variables in the summary object not filled elsewhere
186 
187  if(writerbx) {
188  summary.nproblemRBXs_++;
189  if(summary.nproblemRBXs_<=maxProblemRBXs_) {
190  result1->push_back(rbx);
191  if(maxit==rit) maxwritten=true;
192  }
193  }
194  } // end loop over rbxs
195 
196  // if we still haven't written the maximum energy rbx, write it now
197  if(!maxwritten) {
198  HcalNoiseRBX &rbx=(*maxit);
199 
200  // add the RBX to the event
201  result1->push_back(rbx);
202  }
203 
204  // put the rbxcollection and summary into the EDM
205  iEvent.put(result1);
206  iEvent.put(result2);
207 
208  return;
209 }
std::vector< HcalNoiseRBX > HcalNoiseRBXCollection
Definition: HcalNoiseRBX.h:26
bool isProblematic(const CommonHcalNoiseRBXData &) const
void fillrechits(edm::Event &, const edm::EventSetup &, HcalNoiseRBXArray &, HcalNoiseSummary &) const
std::vector< std::pair< double, double > > TS4TS5LowerCut_
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:113
std::vector< std::pair< double, double > > TS4TS5UpperCut_
bool passLooseNoiseFilter(const CommonHcalNoiseRBXData &) const
void filldigis(edm::Event &, const edm::EventSetup &, HcalNoiseRBXArray &, HcalNoiseSummary &)
bool passTightNoiseFilter(const CommonHcalNoiseRBXData &) const
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
void filltracks(edm::Event &, const edm::EventSetup &, HcalNoiseSummary &) const
void fillOtherSummaryVariables(HcalNoiseSummary &summary, const CommonHcalNoiseRBXData &data) const

Member Data Documentation

float reco::HcalNoiseInfoProducer::adc2fC[128]
private

Definition at line 124 of file HcalNoiseInfoProducer.h.

Referenced by filldigis(), and HcalNoiseInfoProducer().

HcalNoiseAlgo reco::HcalNoiseInfoProducer::algo_
private

Definition at line 105 of file HcalNoiseInfoProducer.h.

Referenced by fillOtherSummaryVariables(), and produce().

double reco::HcalNoiseInfoProducer::calibdigiHBHEthreshold_
private

Definition at line 110 of file HcalNoiseInfoProducer.h.

Referenced by filldigis(), and HcalNoiseInfoProducer().

std::vector<int> reco::HcalNoiseInfoProducer::calibdigiHBHEtimeslices_
private

Definition at line 111 of file HcalNoiseInfoProducer.h.

Referenced by filldigis(), and HcalNoiseInfoProducer().

double reco::HcalNoiseInfoProducer::calibdigiHFthreshold_
private

Definition at line 113 of file HcalNoiseInfoProducer.h.

Referenced by filldigis(), and HcalNoiseInfoProducer().

std::vector<int> reco::HcalNoiseInfoProducer::calibdigiHFtimeslices_
private

Definition at line 114 of file HcalNoiseInfoProducer.h.

Referenced by filldigis(), and HcalNoiseInfoProducer().

edm::EDGetTokenT<CaloTowerCollection> reco::HcalNoiseInfoProducer::calotower_token_
private

Definition at line 99 of file HcalNoiseInfoProducer.h.

Referenced by fillcalotwrs(), and HcalNoiseInfoProducer().

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

Definition at line 93 of file HcalNoiseInfoProducer.h.

Referenced by fillcalotwrs(), and HcalNoiseInfoProducer().

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

Definition at line 91 of file HcalNoiseInfoProducer.h.

Referenced by filldigis(), and HcalNoiseInfoProducer().

bool reco::HcalNoiseInfoProducer::fillCaloTowers_
private

Definition at line 80 of file HcalNoiseInfoProducer.h.

Referenced by HcalNoiseInfoProducer(), and produce().

bool reco::HcalNoiseInfoProducer::fillDigis_
private

Definition at line 78 of file HcalNoiseInfoProducer.h.

Referenced by HcalNoiseInfoProducer(), and produce().

bool reco::HcalNoiseInfoProducer::fillRecHits_
private

Definition at line 79 of file HcalNoiseInfoProducer.h.

Referenced by HcalNoiseInfoProducer(), and produce().

bool reco::HcalNoiseInfoProducer::fillTracks_
private

Definition at line 81 of file HcalNoiseInfoProducer.h.

Referenced by HcalNoiseInfoProducer(), and produce().

edm::EDGetTokenT<HBHEDigiCollection> reco::HcalNoiseInfoProducer::hbhedigi_token_
private

Definition at line 96 of file HcalNoiseInfoProducer.h.

Referenced by filldigis(), and HcalNoiseInfoProducer().

edm::EDGetTokenT<HBHERecHitCollection> reco::HcalNoiseInfoProducer::hbherechit_token_
private

Definition at line 98 of file HcalNoiseInfoProducer.h.

Referenced by fillrechits(), and HcalNoiseInfoProducer().

uint32_t reco::HcalNoiseInfoProducer::HcalAcceptSeverityLevel_
private

Definition at line 121 of file HcalNoiseInfoProducer.h.

Referenced by fillrechits(), and HcalNoiseInfoProducer().

edm::EDGetTokenT<HcalCalibDigiCollection> reco::HcalNoiseInfoProducer::hcalcalibdigi_token_
private

Definition at line 97 of file HcalNoiseInfoProducer.h.

Referenced by filldigis(), and HcalNoiseInfoProducer().

std::vector<int> reco::HcalNoiseInfoProducer::HcalRecHitFlagsToBeExcluded_
private

Definition at line 122 of file HcalNoiseInfoProducer.h.

Referenced by fillrechits(), and HcalNoiseInfoProducer().

int reco::HcalNoiseInfoProducer::maxCaloTowerIEta_
private

Definition at line 87 of file HcalNoiseInfoProducer.h.

Referenced by fillcalotwrs(), and HcalNoiseInfoProducer().

int reco::HcalNoiseInfoProducer::maxProblemRBXs_
private

Definition at line 84 of file HcalNoiseInfoProducer.h.

Referenced by HcalNoiseInfoProducer(), and produce().

double reco::HcalNoiseInfoProducer::maxTrackEta_
private

Definition at line 88 of file HcalNoiseInfoProducer.h.

Referenced by filltracks(), and HcalNoiseInfoProducer().

double reco::HcalNoiseInfoProducer::minHighHitE_
private

Definition at line 104 of file HcalNoiseInfoProducer.h.

Referenced by HcalNoiseInfoProducer(), and produce().

double reco::HcalNoiseInfoProducer::minLowHitE_
private

Definition at line 104 of file HcalNoiseInfoProducer.h.

Referenced by HcalNoiseInfoProducer(), and produce().

double reco::HcalNoiseInfoProducer::minR45HitE_
private

Definition at line 104 of file HcalNoiseInfoProducer.h.

Referenced by HcalNoiseInfoProducer(), and produce().

double reco::HcalNoiseInfoProducer::minRecHitE_
private

Definition at line 104 of file HcalNoiseInfoProducer.h.

Referenced by HcalNoiseInfoProducer(), and produce().

double reco::HcalNoiseInfoProducer::minTrackPt_
private

Definition at line 89 of file HcalNoiseInfoProducer.h.

Referenced by filltracks(), and HcalNoiseInfoProducer().

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

Definition at line 92 of file HcalNoiseInfoProducer.h.

Referenced by fillrechits(), and HcalNoiseInfoProducer().

double reco::HcalNoiseInfoProducer::TotalCalibCharge
private

Definition at line 102 of file HcalNoiseInfoProducer.h.

Referenced by filldigis().

edm::EDGetTokenT<reco::TrackCollection> reco::HcalNoiseInfoProducer::track_token_
private

Definition at line 100 of file HcalNoiseInfoProducer.h.

Referenced by filltracks(), and HcalNoiseInfoProducer().

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

Definition at line 94 of file HcalNoiseInfoProducer.h.

Referenced by HcalNoiseInfoProducer().

double reco::HcalNoiseInfoProducer::TS4TS5EnergyThreshold_
private

Definition at line 117 of file HcalNoiseInfoProducer.h.

Referenced by HcalNoiseInfoProducer(), and produce().

std::vector<std::pair<double, double> > reco::HcalNoiseInfoProducer::TS4TS5LowerCut_
private

Definition at line 119 of file HcalNoiseInfoProducer.h.

Referenced by HcalNoiseInfoProducer(), and produce().

std::vector<std::pair<double, double> > reco::HcalNoiseInfoProducer::TS4TS5UpperCut_
private

Definition at line 118 of file HcalNoiseInfoProducer.h.

Referenced by HcalNoiseInfoProducer(), and produce().

bool reco::HcalNoiseInfoProducer::useCalibDigi_
private

Definition at line 107 of file HcalNoiseInfoProducer.h.

Referenced by HcalNoiseInfoProducer().