CMS 3D CMS Logo

DQMHcalDiJetsAlCaReco.cc
Go to the documentation of this file.
1 /*
2  * \file DQMHcalPhiSymAlCaReco.cc
3  *
4  * \author Olga Kodolova
5  *
6  *
7  *
8  * Description: Monitoring of Phi Symmetry Calibration Stream
9  */
10 
15 
16 // DQM include files
17 
19 
20 // work on collections
21 
26 
27 // #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h"
28 // #include "Geometry/CaloGeometry/interface/CaloCellGeometry.h"
29 // #include "DataFormats/HcalDetId/interface/HcalSubdetector.h"
30 
32 
33 using namespace std;
34 using namespace edm;
35 using namespace reco;
36 
37 // ******************************************
38 // constructors
39 // *****************************************
40 
42  //
43  // Input from configurator file
44  //
45  folderName_ = iConfig.getUntrackedParameter<string>("FolderName", "ALCAStreamHcalDiJets");
46 
47  jets_ = consumes<CaloJetCollection>(iConfig.getParameter<edm::InputTag>("jetsInput"));
48  ec_ = consumes<EcalRecHitCollection>(iConfig.getParameter<edm::InputTag>("ecInput"));
49  hbhe_ = consumes<HBHERecHitCollection>(iConfig.getParameter<edm::InputTag>("hbheInput"));
50  ho_ = consumes<HORecHitCollection>(iConfig.getParameter<edm::InputTag>("hoInput"));
51  hf_ = consumes<HFRecHitCollection>(iConfig.getParameter<edm::InputTag>("hfInput"));
52 
53  saveToFile_ = iConfig.getUntrackedParameter<bool>("SaveToFile", false);
54  fileName_ = iConfig.getUntrackedParameter<string>("FileName", "MonitorAlCaHcalDiJets.root");
55 }
56 
58 
59 //--------------------------------------------------------
61  edm::Run const & /* iRun*/,
62  edm::EventSetup const & /* iSetup */) {
63  // create and cd into new folder
65 
66  // book some histograms 1D
67  hiDistrRecHitEnergyEBEE_ = ibooker.book1D("RecHitEnergyEBEE", "the number of hits inside jets", 100, 0, 800);
69  hiDistrRecHitEnergyEBEE_->setAxisTitle("# rechits", 2);
70 
71  hiDistrRecHitEnergyHBHE_ = ibooker.book1D("RecHitEnergyHBHE", "the number of hits inside jets", 100, 0, 800);
73  hiDistrRecHitEnergyHBHE_->setAxisTitle("# rechits", 2);
74 
75  hiDistrRecHitEnergyHF_ = ibooker.book1D("RecHitEnergyHF", "the number of hits inside jets", 150, 0, 1500);
77  hiDistrRecHitEnergyHF_->setAxisTitle("# rechits", 2);
78 
79  hiDistrRecHitEnergyHO_ = ibooker.book1D("RecHitEnergyHO", "the number of hits inside jets", 100, 0, 100);
81  hiDistrRecHitEnergyHO_->setAxisTitle("# rechits", 2);
82 
83  hiDistrProbeJetEnergy_ = ibooker.book1D("ProbeJetEnergy", "the energy of probe jets", 250, 0, 2500);
86 
87  hiDistrProbeJetEta_ = ibooker.book1D("ProbeJetEta", "the number of probe jets", 100, -5., 5.);
89  hiDistrProbeJetEta_->setAxisTitle("# jets", 2);
90 
91  hiDistrProbeJetPhi_ = ibooker.book1D("ProbeJetPhi", "the number of probe jets", 50, -3.14, 3.14);
93  hiDistrProbeJetPhi_->setAxisTitle("# jets", 2);
94 
95  hiDistrTagJetEnergy_ = ibooker.book1D("TagJetEnergy", "the energy of tsg jets", 250, 0, 2500);
96  hiDistrTagJetEnergy_->setAxisTitle("E, GeV", 1);
97  hiDistrTagJetEnergy_->setAxisTitle("# jets", 2);
98 
99  hiDistrTagJetEta_ = ibooker.book1D("TagJetEta", "the number of tag jets", 100, -5., 5.);
100  hiDistrTagJetEta_->setAxisTitle("#eta", 1);
101  hiDistrTagJetEta_->setAxisTitle("# jets", 2);
102 
103  hiDistrTagJetPhi_ = ibooker.book1D("TagJetPhi", "the number of tag jets", 50, -3.14, 3.14);
104  hiDistrTagJetPhi_->setAxisTitle("#phi", 1);
105  hiDistrTagJetPhi_->setAxisTitle("# jets", 2);
106 
107  hiDistrEtThirdJet_ = ibooker.book1D("EtThirdJet", "Et of the third jet", 90, 0, 90);
108 
109  //==================================================================================
110 }
111 
112 //-------------------------------------------------------------
113 
115  eventCounter_++;
116 
117  CaloJet jet1, jet2, jet3;
118  Float_t etVetoJet;
119 
121  iEvent.getByToken(jets_, jets);
122 
123  if (!jets.isValid()) {
124  LogDebug("") << "DQMHcalDiJetsAlCaReco: Error! can't getjet product!" << std::endl;
125  return;
126  }
127 
128  if (jets->size() > 1) {
129  jet1 = (*jets)[0];
130  jet2 = (*jets)[1];
131  if (fabs(jet1.eta()) > fabs(jet2.eta())) {
132  CaloJet jet = jet1;
133  jet1 = jet2;
134  jet2 = jet;
135  }
136  // if(fabs(jet1.eta())>eta_1 || (fabs(jet2.eta())-jet_R) < eta_2){
137  // return;}
138  } else {
139  return;
140  }
141 
143  hiDistrTagJetEta_->Fill(jet1.eta());
144  hiDistrTagJetPhi_->Fill(jet1.phi());
145 
147  hiDistrProbeJetEta_->Fill(jet2.eta());
148  hiDistrProbeJetPhi_->Fill(jet2.phi());
149 
150  if (jets->size() > 2) {
151  jet3 = (*jets)[2];
152  etVetoJet = jet3.et();
153  hiDistrEtThirdJet_->Fill(etVetoJet);
154  } else {
155  etVetoJet = 0.;
156  hiDistrEtThirdJet_->Fill(etVetoJet);
157  }
158 
160  iEvent.getByToken(ec_, ec);
161 
162  if (!ec.isValid()) {
163  LogDebug("") << "DQMHcalDiJetsAlCaReco: Error! can't get ec product!" << std::endl;
164  return;
165  }
166 
167  for (EcalRecHitCollection::const_iterator ecItr = (*ec).begin(); ecItr != (*ec).end(); ++ecItr) {
168  hiDistrRecHitEnergyEBEE_->Fill(ecItr->energy());
169  }
170 
172  iEvent.getByToken(hbhe_, hbhe);
173 
174  if (!hbhe.isValid()) {
175  LogDebug("") << "DQMHcalDiJetsAlCaReco: Error! can't get hbhe product!" << std::endl;
176  return;
177  }
178 
179  for (HBHERecHitCollection::const_iterator hbheItr = hbhe->begin(); hbheItr != hbhe->end(); hbheItr++) {
180  hiDistrRecHitEnergyHBHE_->Fill(hbheItr->energy());
181  }
182 
184  iEvent.getByToken(ho_, ho);
185 
186  if (!ho.isValid()) {
187  LogDebug("") << "DQMHcalDiJetsAlCaReco: Error! can't get ho product!" << std::endl;
188  return;
189  }
190 
191  for (HORecHitCollection::const_iterator hoItr = ho->begin(); hoItr != ho->end(); hoItr++) {
192  hiDistrRecHitEnergyHO_->Fill(hoItr->energy());
193  }
194 
196  iEvent.getByToken(hf_, hf);
197 
198  if (!hf.isValid()) {
199  LogDebug("") << "DQMHcalDiJetsAlCaReco: Error! can't get hf product!" << std::endl;
200  return;
201  }
202 
203  for (HFRecHitCollection::const_iterator hfItr = hf->begin(); hfItr != hf->end(); hfItr++) {
204  hiDistrRecHitEnergyHF_->Fill(hfItr->energy());
205  }
206 
207 } // analyze
#define LogDebug(id)
edm::EDGetTokenT< reco::CaloJetCollection > jets_
object to monitor
MonitorElement * hiDistrTagJetEnergy_
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
void analyze(const edm::Event &e, const edm::EventSetup &c) override
MonitorElement * hiDistrRecHitEnergyHF_
double eta() const final
momentum pseudorapidity
Jets made from CaloTowers.
Definition: CaloJet.h:29
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
std::string fileName_
Output file name if required.
MonitorElement * hiDistrTagJetPhi_
MonitorElement * hiDistrTagJetEta_
std::vector< EcalRecHit >::const_iterator const_iterator
MonitorElement * hiDistrRecHitEnergyEBEE_
void Fill(long long x)
int iEvent
Definition: GenABIO.cc:224
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
double et() const final
transverse energy
edm::EDGetTokenT< HORecHitCollection > ho_
vector< PseudoJet > jets
edm::EDGetTokenT< HFRecHitCollection > hf_
double energy() const final
energy
MonitorElement * hiDistrProbeJetEta_
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:106
bool isValid() const
Definition: HandleBase.h:74
DQMHcalDiJetsAlCaReco(const edm::ParameterSet &)
const_iterator end() const
MonitorElement * hiDistrProbeJetPhi_
edm::EDGetTokenT< HBHERecHitCollection > hbhe_
bool saveToFile_
Write to file.
fixed size matrix
HLT enums.
edm::EDGetTokenT< EcalRecHitCollection > ec_
MonitorElement * hiDistrRecHitEnergyHBHE_
MonitorElement * hiDistrProbeJetEnergy_
MonitorElement * hiDistrRecHitEnergyHO_
std::string folderName_
DQM folder name.
double phi() const final
momentum azimuthal angle
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
MonitorElement * hiDistrEtThirdJet_
const_iterator begin() const
Definition: Run.h:45
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override