test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
28 // #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h"
29 // #include "Geometry/CaloGeometry/interface/CaloCellGeometry.h"
30 // #include "DataFormats/HcalDetId/interface/HcalSubdetector.h"
31 
34 
35 using namespace std;
36 using namespace edm;
37 using namespace reco;
38 
39 // ******************************************
40 // constructors
41 // *****************************************
42 
44 eventCounter_(0)
45 {
47 //
48 // Input from configurator file
49 //
50  folderName_ = iConfig.getUntrackedParameter<string>("FolderName","ALCAStreamHcalDiJets");
51 
52 
53  jets_= consumes<CaloJetCollection>(iConfig.getParameter<edm::InputTag>("jetsInput"));
54  ec_= consumes<EcalRecHitCollection>(iConfig.getParameter<edm::InputTag>("ecInput"));
55  hbhe_= consumes<HBHERecHitCollection>(iConfig.getParameter<edm::InputTag>("hbheInput"));
56  ho_= consumes<HORecHitCollection>(iConfig.getParameter<edm::InputTag>("hoInput"));
57  hf_= consumes<HFRecHitCollection>(iConfig.getParameter<edm::InputTag>("hfInput"));
58 
59  saveToFile_= iConfig.getUntrackedParameter<bool>("SaveToFile",false);
60  fileName_= iConfig.getUntrackedParameter<string>("FileName","MonitorAlCaHcalDiJets.root");
61 
62 }
63 
65 {}
66 
67 //--------------------------------------------------------
69 
70 
71  // create and cd into new folder
73 
74  // book some histograms 1D
75  hiDistrRecHitEnergyEBEE_ = dbe_->book1D("RecHitEnergyEBEE", "the number of hits inside jets", 100, 0, 800);
77  hiDistrRecHitEnergyEBEE_->setAxisTitle("# rechits", 2);
78 
79  hiDistrRecHitEnergyHBHE_ = dbe_->book1D("RecHitEnergyHBHE", "the number of hits inside jets", 100,0, 800);
81  hiDistrRecHitEnergyHBHE_->setAxisTitle("# rechits", 2);
82 
83  hiDistrRecHitEnergyHF_ = dbe_->book1D("RecHitEnergyHF", "the number of hits inside jets", 150,0, 1500);
85  hiDistrRecHitEnergyHF_->setAxisTitle("# rechits", 2);
86 
87  hiDistrRecHitEnergyHO_ = dbe_->book1D("RecHitEnergyHO", "the number of hits inside jets", 100,0, 100);
89  hiDistrRecHitEnergyHO_->setAxisTitle("# rechits", 2);
90 
91  hiDistrProbeJetEnergy_ = dbe_->book1D("ProbeJetEnergy", "the energy of probe jets", 250,0, 2500);
94 
95  hiDistrProbeJetEta_ = dbe_->book1D("ProbeJetEta", "the number of probe jets", 100, -5., 5.);
97  hiDistrProbeJetEta_->setAxisTitle("# jets", 2);
98 
99  hiDistrProbeJetPhi_ = dbe_->book1D("ProbeJetPhi", "the number of probe jets", 50, -3.14, 3.14);
100  hiDistrProbeJetPhi_->setAxisTitle("#phi", 1);
101  hiDistrProbeJetPhi_->setAxisTitle("# jets", 2);
102 
103  hiDistrTagJetEnergy_ = dbe_->book1D("TagJetEnergy", "the energy of tsg jets", 250,0, 2500);
104  hiDistrTagJetEnergy_->setAxisTitle("E, GeV", 1);
105  hiDistrTagJetEnergy_->setAxisTitle("# jets", 2);
106 
107  hiDistrTagJetEta_ = dbe_->book1D("TagJetEta", "the number of tag jets", 100, -5., 5.);
108  hiDistrTagJetEta_->setAxisTitle("#eta", 1);
109  hiDistrTagJetEta_->setAxisTitle("# jets", 2);
110 
111  hiDistrTagJetPhi_ = dbe_->book1D("TagJetPhi", "the number of tag jets", 50, -3.14, 3.14);
112  hiDistrTagJetPhi_->setAxisTitle("#phi", 1);
113  hiDistrTagJetPhi_->setAxisTitle("# jets", 2);
114 
115  hiDistrEtThirdJet_ = dbe_->book1D("EtThirdJet", "Et of the third jet", 90, 0, 90);
116 
117 
118 //==================================================================================
119 
120 
121 }
122 
123 //--------------------------------------------------------
124 void DQMHcalDiJetsAlCaReco::beginRun(const edm::Run& r, const EventSetup& context) {
125 
126 }
127 
128 //--------------------------------------------------------
130  const EventSetup& context) {
131 
132 }
133 
134 //-------------------------------------------------------------
135 
137  const EventSetup& iSetup ){
138 
139 
140  eventCounter_++;
141 
142  CaloJet jet1, jet2, jet3;
143  Float_t etVetoJet;
144 
146  iEvent.getByToken(jets_,jets);
147 
148  if(!jets.isValid()){
149  LogDebug("") << "DQMHcalDiJetsAlCaReco: Error! can't getjet product!" << std::endl;
150  return ;
151  }
152 
153 
154 
155  if(jets->size()>1){
156  jet1 = (*jets)[0];
157  jet2 = (*jets)[1];
158  if(fabs(jet1.eta())>fabs(jet2.eta())){
159  CaloJet jet = jet1;
160  jet1 = jet2;
161  jet2 = jet;
162  }
163  // if(fabs(jet1.eta())>eta_1 || (fabs(jet2.eta())-jet_R) < eta_2){ return;}
164  } else {return;}
165 
167  hiDistrTagJetEta_->Fill(jet1.eta());
168  hiDistrTagJetPhi_->Fill(jet1.phi());
169 
171  hiDistrProbeJetEta_->Fill(jet2.eta());
172  hiDistrProbeJetPhi_->Fill(jet2.phi());
173 
174  if(jets->size()>2){
175  jet3 = (*jets)[2];
176  etVetoJet = jet3.et();
177  hiDistrEtThirdJet_->Fill(etVetoJet);
178  } else { etVetoJet = 0.; hiDistrEtThirdJet_->Fill(etVetoJet); }
179 
180 
181 
183  iEvent.getByToken(ec_,ec);
184 
185  if(!ec.isValid()){
186  LogDebug("") << "DQMHcalDiJetsAlCaReco: Error! can't get ec product!" << std::endl;
187  return ;
188  }
189 
190 
191  for(EcalRecHitCollection::const_iterator ecItr = (*ec).begin();
192  ecItr != (*ec).end(); ++ecItr)
193  {
194  hiDistrRecHitEnergyEBEE_->Fill(ecItr->energy());
195  }
196 
197 
198 
199 
201  iEvent.getByToken(hbhe_, hbhe);
202 
203  if(!hbhe.isValid()){
204  LogDebug("") << "DQMHcalDiJetsAlCaReco: Error! can't get hbhe product!" << std::endl;
205  return ;
206  }
207 
208 
209  for(HBHERecHitCollection::const_iterator hbheItr=hbhe->begin();
210  hbheItr!=hbhe->end(); hbheItr++)
211  {
212  hiDistrRecHitEnergyHBHE_->Fill(hbheItr->energy());
213  }
214 
215 
217  iEvent.getByToken(ho_, ho);
218 
219  if(!ho.isValid()){
220  LogDebug("") << "DQMHcalDiJetsAlCaReco: Error! can't get ho product!" << std::endl;
221  return ;
222  }
223 
224 
225  for(HORecHitCollection::const_iterator hoItr=ho->begin();
226  hoItr!=ho->end(); hoItr++)
227  {
228  hiDistrRecHitEnergyHO_->Fill(hoItr->energy());
229 
230  }
231 
232 
233 
234 
236  iEvent.getByToken(hf_, hf);
237 
238  if(!hf.isValid()){
239  LogDebug("") << "DQMHcalDiJetsAlCaReco: Error! can't get hf product!" << std::endl;
240  return ;
241  }
242 
243 
244  for(HFRecHitCollection::const_iterator hfItr=hf->begin();
245  hfItr!=hf->end(); hfItr++)
246  {
247  hiDistrRecHitEnergyHF_->Fill(hfItr->energy());
248  }
249 
250 } //analyze
251 
252 
253 
254 
255 //--------------------------------------------------------
257  const EventSetup& context) {
258 }
259 //--------------------------------------------------------
260 void DQMHcalDiJetsAlCaReco::endRun(const Run& r, const EventSetup& context){
261 
262 }
263 //--------------------------------------------------------
265 
266  if (saveToFile_) {
267  dbe_->save(fileName_);
268  }
269 
270 }
271 
272 
#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 beginRun(const edm::Run &r, const edm::EventSetup &c)
MonitorElement * hiDistrRecHitEnergyHF_
Jets made from CaloTowers.
Definition: CaloJet.h:29
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:954
virtual double et() const
transverse energy
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
virtual float phi() const
momentum azimuthal angle
std::string fileName_
Output file name if required.
MonitorElement * hiDistrTagJetPhi_
MonitorElement * hiDistrTagJetEta_
std::vector< EcalRecHit >::const_iterator const_iterator
MonitorElement * hiDistrRecHitEnergyEBEE_
return((rh^lh)&mask)
void Fill(long long x)
virtual double energy() const
energy
int iEvent
Definition: GenABIO.cc:230
void beginLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &context)
edm::EDGetTokenT< HORecHitCollection > ho_
virtual float eta() const
momentum pseudorapidity
vector< PseudoJet > jets
edm::EDGetTokenT< HFRecHitCollection > hf_
MonitorElement * hiDistrProbeJetEta_
void endLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c)
bool isValid() const
Definition: HandleBase.h:76
DQMHcalDiJetsAlCaReco(const edm::ParameterSet &)
MonitorElement * hiDistrProbeJetPhi_
edm::EDGetTokenT< HBHERecHitCollection > hbhe_
bool saveToFile_
Write to file.
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", const uint32_t run=0, const uint32_t lumi=0, SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE", const bool resetMEsAfterWriting=false)
Definition: DQMStore.cc:2540
edm::EDGetTokenT< EcalRecHitCollection > ec_
MonitorElement * hiDistrRecHitEnergyHBHE_
MonitorElement * hiDistrProbeJetEnergy_
MonitorElement * hiDistrRecHitEnergyHO_
std::string folderName_
DQM folder name.
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
MonitorElement * hiDistrEtThirdJet_
void analyze(const edm::Event &e, const edm::EventSetup &c)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:667
Definition: Run.h:41
void endRun(const edm::Run &r, const edm::EventSetup &c)