CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 getUntrackedParameter(std::string const &, T const &) const
const edm::EventSetup & c
edm::EDGetTokenT< HBHERecHitCollection > tok_hbhe_
object to monitor
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
uint16_t *__restrict__ id
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
std::vector< T >::const_iterator const_iterator
DQMHcalIterativePhiSymAlCaReco(const edm::ParameterSet &)
edm::EDGetTokenT< HFRecHitCollection > tok_hf_
void Fill(long long x)
int iEvent
Definition: GenABIO.cc:224
constexpr int iphi() const
get the cell iphi
Definition: HcalDetId.h:157
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
constexpr int ieta() const
get the cell ieta
Definition: HcalDetId.h:155
void analyze(const edm::Event &e, const edm::EventSetup &c) override
ParameterDescriptionBase * add(U const &iLabel, T const &value)
bool isValid() const
Definition: HandleBase.h:70
const_iterator end() const
T const * product() const
Definition: Handle.h:70
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:177
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
void add(std::string const &label, ParameterSetDescription const &psetDescription)
size_type size() const
constexpr int depth() const
get the tower depth
Definition: HcalDetId.h:164
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_
const_iterator begin() const
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)