CMS 3D CMS Logo

DQMHcalIterativePhiSymAlCaReco.cc
Go to the documentation of this file.
1 /*
2  * \file DQMHcalIterativePhiSymAlCaReco.cc
3  *
4  * \author Sunanda Banerjee
5  *
6  *
7  *
8  * Description: Monitoring of Iterative Phi Symmetry Calibration Stream
9  */
10 
20 
21 // DQM include files
22 
25 
26 // work on collections
27 
32 
35 
36 #include <string>
37 
39 public:
42 
43  static void fillDescriptions(edm::ConfigurationDescriptions &descriptions);
44 
45 protected:
46  // void beginRun(const edm::Run& r, const edm::EventSetup& c);
47  void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override;
48  void analyze(const edm::Event &e, const edm::EventSetup &c) override;
49 
50  void dqmEndRun(const edm::Run &r, const edm::EventSetup &c) override {}
51 
52 private:
53  static constexpr int maxDepth_ = 7;
54  //
55  // Monitor elements
56  //
58 
62 
71 
75 };
76 
77 // ******************************************
78 // constructors
79 // *****************************************
80 
82  //
83  // Input from configurator file
84  //
85  folderName_ = ps.getParameter<std::string>("folderName");
86 
87  // histogram parameters
88  tok_ho_ = consumes<HORecHitCollection>(ps.getParameter<edm::InputTag>("hoInput"));
89  tok_hf_ = consumes<HFRecHitCollection>(ps.getParameter<edm::InputTag>("hfInput"));
90  tok_hbhe_ = consumes<HBHERecHitCollection>(ps.getParameter<edm::InputTag>("hbheInput"));
91 
92  // Distribution of rechits in iPhi, iEta
93  hiDistr_y_nbin_ = ps.getUntrackedParameter<int>("hiDistr_y_nbin", 72);
94  hiDistr_y_min_ = ps.getUntrackedParameter<double>("hiDistr_y_min", 0.5);
95  hiDistr_y_max_ = ps.getUntrackedParameter<double>("hiDistr_y_max", 72.5);
96  hiDistr_x_nbin_ = ps.getUntrackedParameter<int>("hiDistr_x_nbin", 83);
97  hiDistr_x_min_ = ps.getUntrackedParameter<double>("hiDistr_x_min", -41.5);
98  hiDistr_x_max_ = ps.getUntrackedParameter<double>("hiDistr_x_max", 41.5);
99 }
100 
102 
105  desc.add<std::string>("folderName", "ALCAStreamHcalIterativePhiSym");
106  desc.add<edm::InputTag>("hbheInput", edm::InputTag("hbhereco"));
107  desc.add<edm::InputTag>("hfInput", edm::InputTag("hfreco"));
108  desc.add<edm::InputTag>("hoInput", edm::InputTag("horeco"));
109  desc.addUntracked<int>("hiDistr_y_nbin", 72);
110  desc.addUntracked<double>("hiDistr_y_min", 0.5);
111  desc.addUntracked<double>("hiDistr_y_max", 72.5);
112  desc.addUntracked<int>("hiDistr_x_nbin", 83);
113  desc.addUntracked<double>("hiDistr_x_min", -41.5);
114  desc.addUntracked<double>("hiDistr_x_max", 41.5);
115  descriptions.add("dqmHcalIterativePhiSymAlCaReco", desc);
116 }
117 
118 //--------------------------------------------------------
120  edm::Run const &irun,
121  edm::EventSetup const &isetup) {
122  // create and cd into new folder
123  ibooker.setCurrentFolder(folderName_);
124 
125  // book some histograms 1D
126  hiDistrHBHEsize1D_ = ibooker.book1D("DistrHBHEsize", "Size of HBHE Collection", 100, 0.0, 10000.0);
127  hiDistrHFsize1D_ = ibooker.book1D("DistrHFsize", "Size of HF Collection", 100, 0.0, 10000.0);
128  hiDistrHOsize1D_ = ibooker.book1D("DistrHOsize", "Size of HO Collection", 100, 0.0, 3000.0);
129 
130  // Eta-phi occupancy
131  for (int k = 0; k < maxDepth_; ++k) {
132  char name[20], title[20];
133  sprintf(name, "MBdepth%d", (k + 1));
134  sprintf(title, "Depth %d", (k + 1));
135  hiDistr2D_[k] = ibooker.book2D(
137  hiDistr2D_[k]->setAxisTitle("i#phi ", 2);
138  hiDistr2D_[k]->setAxisTitle("i#eta ", 1);
139  }
140 }
141 
142 //--------------------------------------------------------
143 
144 //-------------------------------------------------------------
145 
147  // First HBHE RecHits
149  iEvent.getByToken(tok_hbhe_, hbheMB);
150  if (!hbheMB.isValid()) {
151  edm::LogWarning("DQMHcal") << "DQMHcalIterativePhiSymAlCaReco: Error! can't get HBHE RecHit Collection!";
152  } else {
153  const HBHERecHitCollection Hithbhe = *(hbheMB.product());
154  hiDistrHBHEsize1D_->Fill(Hithbhe.size());
155  for (HBHERecHitCollection::const_iterator hbheItr = Hithbhe.begin(); hbheItr != Hithbhe.end(); hbheItr++) {
156  HcalDetId hid = HcalDetId(hbheItr->detid());
157  int id = hid.depth() - 1;
158  if ((id >= 0) && (id < maxDepth_))
159  hiDistr2D_[id]->Fill(hid.ieta(), hid.iphi(), hbheItr->energy());
160  }
161  }
162 
163  // Then HF RecHits
165  iEvent.getByToken(tok_hf_, hfMB);
166  if (!hfMB.isValid()) {
167  edm::LogWarning("DQMHcal") << "DQMHcalIterativePhiSymAlCaReco: Error! can't get HF RecHit Collection!";
168  } else {
169  const HFRecHitCollection Hithf = *(hfMB.product());
170  hiDistrHFsize1D_->Fill(Hithf.size());
171  for (HFRecHitCollection::const_iterator hfItr = Hithf.begin(); hfItr != Hithf.end(); hfItr++) {
172  HcalDetId hid = HcalDetId(hfItr->detid());
173  int id = hid.depth() - 1;
174  if ((id >= 0) && (id < maxDepth_))
175  hiDistr2D_[id]->Fill(hid.ieta(), hid.iphi(), hfItr->energy());
176  }
177  }
178 
179  // And finally HO RecHits
181  iEvent.getByToken(tok_ho_, hoMB);
182  if (!hoMB.isValid()) {
183  edm::LogWarning("DQMHcal") << "DQMHcalIterativePhiSymAlCaReco: Error! can't get HO RecHit Collection!";
184  } else {
185  const HORecHitCollection Hitho = *(hoMB.product());
186  hiDistrHOsize1D_->Fill(Hitho.size());
187  for (HORecHitCollection::const_iterator hoItr = Hitho.begin(); hoItr != Hitho.end(); hoItr++) {
188  HcalDetId hid = HcalDetId(hoItr->detid());
189  int id = hid.depth() - 1;
190  if ((id >= 0) && (id < maxDepth_))
191  hiDistr2D_[id]->Fill(hid.ieta(), hid.iphi(), hoItr->energy());
192  }
193  }
194 
195 } // analyze
196 
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
edm::EDGetTokenT< HBHERecHitCollection > tok_hbhe_
object to monitor
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
size_type size() const
T const * product() const
Definition: Handle.h:70
std::vector< T >::const_iterator const_iterator
DQMHcalIterativePhiSymAlCaReco(const edm::ParameterSet &)
edm::EDGetTokenT< HFRecHitCollection > tok_hf_
T getUntrackedParameter(std::string const &, T const &) const
void Fill(long long x)
int iEvent
Definition: GenABIO.cc:224
constexpr int ieta() const
get the cell ieta
Definition: HcalDetId.h:155
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
const_iterator begin() const
void analyze(const edm::Event &e, const edm::EventSetup &c) override
const_iterator end() const
void dqmEndRun(const edm::Run &r, const edm::EventSetup &c) override
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:221
void add(std::string const &label, ParameterSetDescription const &psetDescription)
bool isValid() const
Definition: HandleBase.h:70
Log< level::Warning, false > LogWarning
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
edm::EDGetTokenT< HORecHitCollection > tok_ho_
constexpr int iphi() const
get the cell iphi
Definition: HcalDetId.h:157
Definition: Run.h:45
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
constexpr int depth() const
get the tower depth
Definition: HcalDetId.h:164