CMS 3D CMS Logo

NoiseRates.cc
Go to the documentation of this file.
1 //
2 // NoiseRates.cc
3 //
4 // description: Calculation for single particle response corrections
5 //
6 // author: J.P. Chou, Brown
7 //
8 //
9 
12 
13 //
14 // constructors and destructor
15 //
16 
18  // DQM ROOT output
19  outputFile_ = iConfig.getUntrackedParameter<std::string>("outputFile", "myfile.root");
20 
21  // set parameters
22  rbxCollName_ = iConfig.getUntrackedParameter<edm::InputTag>("rbxCollName");
23  minRBXEnergy_ = iConfig.getUntrackedParameter<double>("minRBXEnergy");
24  minHitEnergy_ = iConfig.getUntrackedParameter<double>("minHitEnergy");
25 
26  tok_rbx_ = consumes<reco::HcalNoiseRBXCollection>(rbxCollName_);
27 
28  useAllHistos_ = iConfig.getUntrackedParameter<bool>("useAllHistos", false);
29 
30  // Hcal Noise Summary
31  noisetoken_ = consumes<HcalNoiseSummary>(iConfig.getParameter<edm::InputTag>("noiselabel"));
32 }
33 
35 
36 //
37 // member functions
38 //
39 
41  ib.setCurrentFolder("NoiseRatesV/NoiseRatesTask");
42 
43  // book histograms
44  Char_t histo[100];
45 
46  // Lumi block is not drawn; the rest are
47  if (useAllHistos_) {
48  sprintf(histo, "hLumiBlockCount");
49  hLumiBlockCount_ = ib.book1D(histo, histo, 1, -0.5, 0.5);
50  }
51 
52  sprintf(histo, "hRBXEnergy");
53  hRBXEnergy_ = ib.book1D(histo, histo, 300, 0, 3000);
54 
55  sprintf(histo, "hRBXEnergyType1");
56  hRBXEnergyType1_ = ib.book1D(histo, histo, 300, 0, 3000);
57 
58  sprintf(histo, "hRBXEnergyType2");
59  hRBXEnergyType2_ = ib.book1D(histo, histo, 300, 0, 3000);
60 
61  sprintf(histo, "hRBXEnergyType3");
62  hRBXEnergyType3_ = ib.book1D(histo, histo, 300, 0, 3000);
63 
64  sprintf(histo, "hRBXNHits");
65  hRBXNHits_ = ib.book1D(histo, histo, 73, -0.5, 72.5);
66 
67  // HcalNoiseSummary
68 
69  sprintf(histo, "nNNumChannels");
70  nNNumChannels_ = ib.book1D(histo, histo, 100, 0, 100);
71  sprintf(histo, "nNSumE");
72  nNSumE_ = ib.book1D(histo, histo, 100, 0, 5000);
73  sprintf(histo, "nNSumEt");
74  nNSumEt_ = ib.book1D(histo, histo, 100, 0, 2000);
75 
76  sprintf(histo, "sNNumChannels");
77  sNNumChannels_ = ib.book1D(histo, histo, 100, 0, 100);
78  sprintf(histo, "sNSumE");
79  sNSumE_ = ib.book1D(histo, histo, 100, 0, 5000);
80  sprintf(histo, "sNSumEt");
81  sNSumEt_ = ib.book1D(histo, histo, 100, 0, 2000);
82 
83  sprintf(histo, "iNNumChannels");
84  iNNumChannels_ = ib.book1D(histo, histo, 100, 0, 100);
85  sprintf(histo, "iNSumE");
86  iNSumE_ = ib.book1D(histo, histo, 100, 0, 5000);
87  sprintf(histo, "iNSumEt");
88  iNSumEt_ = ib.book1D(histo, histo, 100, 0, 2000);
89 
90  sprintf(histo, "hNoise_maxZeros");
91  hNoise_maxZeros_ = ib.book1D(histo, histo, 80, 0, 80);
92  sprintf(histo, "hNoise_maxHPDHits");
93  hNoise_maxHPDHits_ = ib.book1D(histo, histo, 20, 0, 20);
94  sprintf(histo, "hNoise_maxHPDNoOtherHits");
95  hNoise_maxHPDNoOtherHits_ = ib.book1D(histo, histo, 20, 0, 20);
96 }
97 
98 // ------------ method called to for each event ------------
99 void NoiseRates::analyze(const edm::Event &iEvent, const edm::EventSetup &evSetup) {
100  // get the lumi section
101  int lumiSection = iEvent.luminosityBlock();
102  lumiCountMap_[lumiSection]++;
103 
104  // get the RBX Noise collection
106  iEvent.getByToken(tok_rbx_, handle);
107  if (!handle.isValid()) {
109  << " could not find HcalNoiseRBXCollection named " << rbxCollName_ << ".\n";
110  return;
111  }
112 
113  // get the Noise summary object
115  iEvent.getByToken(noisetoken_, summary_h);
116  if (!summary_h.isValid()) {
117  throw edm::Exception(edm::errors::ProductNotFound) << " could not find HcalNoiseSummary.\n";
118  return;
119  }
120  const HcalNoiseSummary summary = *summary_h;
121 
122  // Fill the Noise Summary histograms
123  nNNumChannels_->Fill(summary.numNegativeNoiseChannels());
124  nNSumE_->Fill(summary.NegativeNoiseSumE());
125  nNSumEt_->Fill(summary.NegativeNoiseSumEt());
126 
127  sNNumChannels_->Fill(summary.numSpikeNoiseChannels());
128  sNSumE_->Fill(summary.spikeNoiseSumE());
129  sNSumEt_->Fill(summary.spikeNoiseSumEt());
130 
131  iNNumChannels_->Fill(summary.numIsolatedNoiseChannels());
132  iNSumE_->Fill(summary.isolatedNoiseSumE());
133  iNSumEt_->Fill(summary.isolatedNoiseSumEt());
134 
135  hNoise_maxZeros_->Fill(summary.maxZeros());
136  hNoise_maxHPDHits_->Fill(summary.maxHPDHits());
137  hNoise_maxHPDNoOtherHits_->Fill(summary.maxHPDNoOtherHits());
138 
139  // loop over the RBXs and fill the histograms
140  for (reco::HcalNoiseRBXCollection::const_iterator it = handle->begin(); it != handle->end(); ++it) {
141  const reco::HcalNoiseRBX &rbx = (*it);
142 
143  double energy = rbx.recHitEnergy(minHitEnergy_);
144 
145  int nhits = rbx.numRecHits(minHitEnergy_);
146 
147  if (energy < minRBXEnergy_)
148  continue;
149 
151 
152  if (nhits <= 9)
154  else if (nhits <= 18)
156  else
158 
160 
161  } // done looping over RBXs
162 }
163 
164 // define this as a plug-in
NoiseRates::outputFile_
std::string outputFile_
Definition: NoiseRates.h:51
NoiseRates::sNSumE_
MonitorElement * sNSumE_
Definition: NoiseRates.h:78
NoiseRates::hLumiBlockCount_
MonitorElement * hLumiBlockCount_
Definition: NoiseRates.h:64
HcalNoiseSummary
Definition: HcalNoiseSummary.h:31
reco::HcalNoiseRBX::numRecHits
int numRecHits(double threshold=1.5) const
Definition: HcalNoiseRBX.cc:110
NoiseRates::noisetoken_
edm::EDGetTokenT< HcalNoiseSummary > noisetoken_
Definition: NoiseRates.h:62
patZpeak.handle
handle
Definition: patZpeak.py:23
edm::Run
Definition: Run.h:45
NoiseRates::iNNumChannels_
MonitorElement * iNNumChannels_
Definition: NoiseRates.h:81
timingPdfMaker.histo
histo
Definition: timingPdfMaker.py:279
NoiseRates.h
NoiseRates::~NoiseRates
~NoiseRates() override
Definition: NoiseRates.cc:34
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
edm::Handle
Definition: AssociativeIterator.h:50
NoiseRates::minHitEnergy_
double minHitEnergy_
Definition: NoiseRates.h:57
EDMException.h
edm::errors::ProductNotFound
Definition: EDMException.h:33
NoiseRates::hNoise_maxHPDNoOtherHits_
MonitorElement * hNoise_maxHPDNoOtherHits_
Definition: NoiseRates.h:87
NoiseRates::sNNumChannels_
MonitorElement * sNNumChannels_
Definition: NoiseRates.h:77
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
NoiseRates::hNoise_maxZeros_
MonitorElement * hNoise_maxZeros_
Definition: NoiseRates.h:85
NoiseRates::hRBXEnergyType3_
MonitorElement * hRBXEnergyType3_
Definition: NoiseRates.h:68
NoiseRates::NoiseRates
NoiseRates(const edm::ParameterSet &)
Definition: NoiseRates.cc:17
dqm::impl::MonitorElement::Fill
void Fill(long long x)
Definition: MonitorElement.h:290
NoiseRates::iNSumEt_
MonitorElement * iNSumEt_
Definition: NoiseRates.h:83
NoiseRates::useAllHistos_
bool useAllHistos_
Definition: NoiseRates.h:59
NoiseRates::nNNumChannels_
MonitorElement * nNNumChannels_
Definition: NoiseRates.h:73
HCALHighEnergyHPDFilter_cfi.energy
energy
Definition: HCALHighEnergyHPDFilter_cfi.py:5
NoiseRates::hRBXNHits_
MonitorElement * hRBXNHits_
Definition: NoiseRates.h:69
NoiseRates::bookHistograms
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: NoiseRates.cc:40
NoiseRates::hRBXEnergyType2_
MonitorElement * hRBXEnergyType2_
Definition: NoiseRates.h:67
nhits
Definition: HIMultiTrackSelector.h:42
NoiseRates::hNoise_maxHPDHits_
MonitorElement * hNoise_maxHPDHits_
Definition: NoiseRates.h:86
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
NoiseRates::sNSumEt_
MonitorElement * sNSumEt_
Definition: NoiseRates.h:79
NoiseRates
Definition: NoiseRates.h:41
edm::ParameterSet
Definition: ParameterSet.h:47
iEvent
int iEvent
Definition: GenABIO.cc:224
edmLumisInFiles.summary
summary
Definition: edmLumisInFiles.py:39
cuy.ib
ib
Definition: cuy.py:662
edm::EventSetup
Definition: EventSetup.h:58
NoiseRates::minRBXEnergy_
double minRBXEnergy_
Definition: NoiseRates.h:56
NoiseRates::rbxCollName_
edm::InputTag rbxCollName_
Definition: NoiseRates.h:54
writedatasetfile.run
run
Definition: writedatasetfile.py:27
NoiseRates::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: NoiseRates.cc:99
reco::HcalNoiseRBX
Definition: HcalNoiseRBX.h:32
NoiseRates::tok_rbx_
edm::EDGetTokenT< reco::HcalNoiseRBXCollection > tok_rbx_
Definition: NoiseRates.h:55
Exception
Definition: hltDiff.cc:245
NoiseRates::iNSumE_
MonitorElement * iNSumE_
Definition: NoiseRates.h:82
NoiseRates::nNSumE_
MonitorElement * nNSumE_
Definition: NoiseRates.h:74
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
dqm::implementation::IBooker
Definition: DQMStore.h:43
NoiseRates::hRBXEnergyType1_
MonitorElement * hRBXEnergyType1_
Definition: NoiseRates.h:66
reco::HcalNoiseRBX::recHitEnergy
double recHitEnergy(double theshold=1.5) const
Definition: HcalNoiseRBX.cc:76
NoiseRates::lumiCountMap_
std::map< int, int > lumiCountMap_
Definition: NoiseRates.h:90
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
NoiseRates::nNSumEt_
MonitorElement * nNSumEt_
Definition: NoiseRates.h:75
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15
NoiseRates::hRBXEnergy_
MonitorElement * hRBXEnergy_
Definition: NoiseRates.h:65