CMS 3D CMS Logo

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