CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
RazorVarAnalyzer.cc
Go to the documentation of this file.
2 
5 
8 
11 
12 #include <cmath>
13 
14 //------------------------------------------------------------------------------
15 // A simple constructor which takes as inoput only the name of the PF jet collection
18  m_eleCollectionTag(conf.getUntrackedParameter<edm::InputTag>("eleCollectionName",edm::InputTag("hltPixelMatchElectronsActivity"))),
19  m_jetCollectionTag(conf.getUntrackedParameter<edm::InputTag>("jetCollectionName",edm::InputTag("hltCaloJetIDPassed"))),
20  m_muCollectionTag(conf.getUntrackedParameter<edm::InputTag>("muCollectionName",edm::InputTag("hltL3MuonCandidates"))),
21  m_razorVarCollectionTag(conf.getUntrackedParameter<edm::InputTag>("razorVarCollectionName")){
22 }
23 
24 //------------------------------------------------------------------------------
25 // Nothing to destroy: the DQM service thinks about everything
27 
28 //------------------------------------------------------------------------------
29 // Usual analyze method
31 
32  //count the number of jets with a minimal selection
34  iEvent.getByLabel(m_jetCollectionTag,calojets_handle);
35 
36  unsigned int njets = 0;
37  for(reco::CaloJetCollection::const_iterator it = calojets_handle->begin(); it != calojets_handle->end(); ++it){
38  if(it->pt() >= 30. && fabs(it->eta()) <= 3.0){
39  njets++;
40  }
41  }
42 
43  //count the number of muons
45  iEvent.getByLabel(m_muCollectionTag,muon_handle);
46 
47  unsigned int nmu_loose = 0;
48  unsigned int nmu_tight = 0;
49  if(muon_handle.isValid()){
50  for(std::vector<reco::RecoChargedCandidate>::const_iterator it = muon_handle->begin(); it != muon_handle->end(); ++it){
51  if(it->pt() >= 15 && fabs(it->eta()) <= 2.1) nmu_tight++;
52  if(it->pt() >= 10 && fabs(it->eta()) <= 2.4) nmu_loose++;
53  }
54  }
55 
56  //count the number of electrons
58  iEvent.getByLabel(m_eleCollectionTag,ele_handle);
59 
60  unsigned int nele_loose = 0;
61  unsigned int nele_tight = 0;
62  if(ele_handle.isValid()){
63  for(reco::ElectronCollection::const_iterator it = ele_handle->begin(); it != ele_handle->end(); ++it){
64  if(it->pt() >= 20 && fabs(it->eta()) <= 2.5) nele_tight++;
65  if(it->pt() >= 10 && fabs(it->eta()) <= 2.5) nele_loose++;
66  }
67  }
68 
69  //now get the box number: {'MuEle':0,'MuMu':1,'EleEle':2,'Mu':3,'Ele':4,'Had':5}
70  unsigned int box_num = 5;
71  if(nmu_tight > 0 && nele_tight > 0){
72  box_num = 0;
73  }else if(nmu_tight > 0 && nmu_loose > 1){
74  box_num = 1;
75  }else if(nele_tight > 0 && nele_loose > 1){
76  box_num = 2;
77  }else if(nmu_tight > 0){
78  box_num = 3;
79  }else if(nele_tight > 0){
80  box_num = 4;
81  }
82 
83  edm::Handle<std::vector<double> > razorvar_handle;
84  iEvent.getByLabel(m_razorVarCollectionTag,razorvar_handle);
85 
86  if(razorvar_handle->size() > 1){
87  const double MR = razorvar_handle->at(0);
88  const double R = razorvar_handle->at(1);
89  m_rsqMRFullyInc->Fill(MR,R*R);
90  if(njets >= 4) m_rsqMRInc4J->Fill(MR,R*R);
91  if(njets >= 6) m_rsqMRInc6J->Fill(MR,R*R);
92  if(njets >= 8) m_rsqMRInc8J->Fill(MR,R*R);
93  if(njets >= 10) m_rsqMRInc10J->Fill(MR,R*R);
94  if(njets >= 12) m_rsqMRInc12J->Fill(MR,R*R);
95  if(njets >= 14) m_rsqMRInc14J->Fill(MR,R*R);
96 
97  //now fill the boxes
98  if(box_num == 0) m_rsqMREleMu->Fill(MR,R*R);
99  if(box_num == 1) m_rsqMRMuMu->Fill(MR,R*R);
100  if(box_num == 2) m_rsqMREleEle->Fill(MR,R*R);
101  if(box_num == 3) m_rsqMRMu->Fill(MR,R*R);
102  if(box_num == 4) m_rsqMREle->Fill(MR,R*R);
103  if(box_num == 5) m_rsqMRHad->Fill(MR,R*R);
104 
105  //finally the multijet boxes - think ttbar
106  //muon boxes: muons are not in jets
107  if( box_num == 3 && njets >= 4) m_rsqMRMuMJ->Fill(MR,R*R);
108  //ele boxes: electrons are in jets
109  else if( box_num == 4 && njets >= 5) m_rsqMREleMJ->Fill(MR,R*R);
110  //fill the Had box
111  else if( box_num == 5 && njets >= 6) m_rsqMRHadMJ->Fill(MR,R*R);
112  }
113 
114 }
115 
117 }
118 
119 //------------------------------------------------------------------------------
120 // Function to book the Monitoring Elements.
122 
123  //the full inclusive histograms
124  m_rsqMRFullyInc = bookH2withSumw2("rsqMRFullyInc",
125  "M_{R} vs R^{2} (All Events)",
126  400,0.,4000.,
127  50,0.,1.,
128  "M_{R} [GeV]",
129  "R^{2}");
130  m_rsqMRInc4J = bookH2withSumw2("rsqMRInc4J",
131  "M_{R} vs R^{2} (>= 4j)",
132  400,0.,4000.,
133  50,0.,1.,
134  "M_{R} [GeV]",
135  "R^{2}");
136  m_rsqMRInc6J = bookH2withSumw2("rsqMRInc6J",
137  "M_{R} vs R^{2} (>= 6j)",
138  400,0.,4000.,
139  50,0.,1.,
140  "M_{R} [GeV]",
141  "R^{2}");
142  m_rsqMRInc8J = bookH2withSumw2("rsqMRInc8J",
143  "M_{R} vs R^{2} (>= 8j)",
144  400,0.,4000.,
145  50,0.,1.,
146  "M_{R} [GeV]",
147  "R^{2}");
148  m_rsqMRInc10J = bookH2withSumw2("rsqMRInc10J",
149  "M_{R} vs R^{2} (>= 10j)",
150  400,0.,4000.,
151  50,0.,1.,
152  "M_{R} [GeV]",
153  "R^{2}");
154  m_rsqMRInc12J = bookH2withSumw2("rsqMRInc12J",
155  "M_{R} vs R^{2} (>= 12j)",
156  400,0.,4000.,
157  50,0.,1.,
158  "M_{R} [GeV]",
159  "R^{2}");
160  m_rsqMRInc14J = bookH2withSumw2("rsqMRInc14J",
161  "M_{R} vs R^{2} (>= 14j)",
162  400,0.,4000.,
163  50,0.,1.,
164  "M_{R} [GeV]",
165  "R^{2}");
166 
167  //the by box histograms
168  m_rsqMREleMu = bookH2withSumw2("rsqMREleMu",
169  "M_{R} vs R^{2} (EleMu box)",
170  400,0.,4000.,
171  50,0.,1.,
172  "M_{R} [GeV]",
173  "R^{2}");
174  m_rsqMRMuMu = bookH2withSumw2("rsqMRMuMu",
175  "M_{R} vs R^{2} (MuMu box)",
176  400,0.,4000.,
177  50,0.,1.,
178  "M_{R} [GeV]",
179  "R^{2}");
180  m_rsqMREleEle = bookH2withSumw2("rsqMREleEle",
181  "M_{R} vs R^{2} (EleEle box)",
182  400,0.,4000.,
183  50,0.,1.,
184  "M_{R} [GeV]",
185  "R^{2}");
186  m_rsqMRMu = bookH2withSumw2("rsqMRMu",
187  "M_{R} vs R^{2} (Mu box)",
188  400,0.,4000.,
189  50,0.,1.,
190  "M_{R} [GeV]",
191  "R^{2}");
192  m_rsqMREle = bookH2withSumw2("rsqMREle",
193  "M_{R} vs R^{2} (Ele box)",
194  400,0.,4000.,
195  50,0.,1.,
196  "M_{R} [GeV]",
197  "R^{2}");
198  m_rsqMRHad = bookH2withSumw2("rsqMRHad",
199  "M_{R} vs R^{2} (Had box)",
200  400,0.,4000.,
201  50,0.,1.,
202  "M_{R} [GeV]",
203  "R^{2}");
204 
205  //the by box histograms
206  m_rsqMRMuMJ = bookH2withSumw2("rsqMRMuMJ",
207  "M_{R} vs R^{2} (Mu box >= 4j)",
208  400,0.,4000.,
209  50,0.,1.,
210  "M_{R} [GeV]",
211  "R^{2}");
212  m_rsqMREleMJ = bookH2withSumw2("rsqMREleMJ",
213  "M_{R} vs R^{2} (Ele box >= 5j)",
214  400,0.,4000.,
215  50,0.,1.,
216  "M_{R} [GeV]",
217  "R^{2}");
218  m_rsqMRHadMJ = bookH2withSumw2("rsqMRHadMJ",
219  "M_{R} vs R^{2} (Had box >= 6j)",
220  400,0.,4000.,
221  50,0.,1.,
222  "M_{R} [GeV]",
223  "R^{2}");
224 
225 
226 }
227 
MonitorElement * m_rsqMRInc12J
MonitorElement * m_rsqMRHadMJ
MonitorElement * bookH2withSumw2(const std::string &name, const std::string &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, const std::string &titleX="", const std::string &titleY="", Option_t *option="COLZ")
MonitorElement * m_rsqMREle
MonitorElement * m_rsqMRInc6J
edm::InputTag m_muCollectionTag
virtual void endRun(edm::Run const &, edm::EventSetup const &)
virtual void analyze(const edm::Event &, const edm::EventSetup &)
edm::InputTag m_jetCollectionTag
void Fill(long long x)
MonitorElement * m_rsqMREleMJ
MonitorElement * m_rsqMRInc8J
MonitorElement * m_rsqMRMu
int iEvent
Definition: GenABIO.cc:243
MonitorElement * m_rsqMRMuMJ
edm::InputTag m_razorVarCollectionTag
RazorVarAnalyzer(const edm::ParameterSet &)
MonitorElement * m_rsqMREleMu
MonitorElement * m_rsqMRMuMu
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
tuple conf
Definition: dbtoconf.py:185
MonitorElement * m_rsqMRInc14J
MonitorElement * m_rsqMRInc4J
MonitorElement * m_rsqMREleEle
virtual ~RazorVarAnalyzer()
edm::InputTag m_eleCollectionTag
virtual void bookMEs()
MonitorElement * m_rsqMRHad
MonitorElement * m_rsqMRInc10J
MonitorElement * m_rsqMRFullyInc
Definition: Run.h:33