1 | #include "SampleAnalyzer/User/Analyzer/cms_sus_17_001.h"
|
---|
2 | using namespace MA5;
|
---|
3 | using namespace std;
|
---|
4 |
|
---|
5 | // -----------------------------------------------------------------------------
|
---|
6 | // Initialize
|
---|
7 | // function called one time at the beginning of the analysis
|
---|
8 | // -----------------------------------------------------------------------------
|
---|
9 | bool cms_sus_17_001::Initialize(const MA5::Configuration& cfg, const std::map<std::string,std::string>& parameters)
|
---|
10 | {
|
---|
11 | INFO << " <><><><><><><><><><><><><><><><><><><><><><><><><>" << endmsg;
|
---|
12 | INFO << " <> Analysis: CMS-SUS-17-001 <>" << endmsg;
|
---|
13 | INFO << " <> (stops with OS2L) <>" << endmsg;
|
---|
14 | INFO << " <> Recaster: S.~Bein, S.-M.~Choi, S.~Jeong, <>" << endmsg;
|
---|
15 | INFO << " <> D.-W.~Kang, J.~Li, J.~Sonneveld <>" << endmsg;
|
---|
16 | INFO << " <><><><><><><><><><><><><><><><><><><><><><><><><>" << endmsg;
|
---|
17 | // initialize variables, histos
|
---|
18 |
|
---|
19 | // Manager()->AddRegionSelection("SR_curflow");
|
---|
20 | Manager()->AddRegionSelection("SRA0");
|
---|
21 | Manager()->AddRegionSelection("SRA1");
|
---|
22 | Manager()->AddRegionSelection("SRA2");
|
---|
23 |
|
---|
24 | Manager()->AddCut("2OSL");
|
---|
25 | Manager()->AddCut("mll20");
|
---|
26 | Manager()->AddCut("mllZ");
|
---|
27 | Manager()->AddCut("nj2");
|
---|
28 | Manager()->AddCut("nb1");
|
---|
29 | Manager()->AddCut("met80");
|
---|
30 | Manager()->AddCut("s5");
|
---|
31 | Manager()->AddCut("cphi80");
|
---|
32 | Manager()->AddCut("cphi96");
|
---|
33 |
|
---|
34 | // Manager()->AddCut("mt2ll140","SR_curflow");
|
---|
35 |
|
---|
36 | Manager()->AddCut("met200a0","SRA0");
|
---|
37 | Manager()->AddCut("mt2ll14","SRA0");
|
---|
38 |
|
---|
39 | Manager()->AddCut("met200a1","SRA1");
|
---|
40 | Manager()->AddCut("mt2ll24","SRA1");
|
---|
41 |
|
---|
42 | Manager()->AddCut("mt2ll240","SRA2");
|
---|
43 | // float bins[] = {0,20,40,60,80,100,150,250,350};
|
---|
44 |
|
---|
45 | // hmt2ll = new TH1F("hmt2ll","ht2ll",8,bins);
|
---|
46 | // Manager()->AddHisto("mt2ll (combined flavor)",8,0,350);
|
---|
47 |
|
---|
48 | return true;
|
---|
49 | }
|
---|
50 |
|
---|
51 | // -----------------------------------------------------------------------------
|
---|
52 | // Finalize
|
---|
53 | // function called one time at the end of the analysis
|
---|
54 | // -----------------------------------------------------------------------------
|
---|
55 | void cms_sus_17_001::Finalize(const SampleFormat& summary, const std::vector<SampleFormat>& files)
|
---|
56 | {
|
---|
57 | // // saving histos
|
---|
58 | // TFile * f = new TFile("hists.root","recreate");
|
---|
59 | // hmt2ll->Write();
|
---|
60 | //
|
---|
61 | // for(int i=1;i<=8;i++)
|
---|
62 | // {
|
---|
63 | // cout<<"bin number "<<i<<" bin content: "<<hmt2ll->GetBinContent(i)<<endl;
|
---|
64 | // }
|
---|
65 | //
|
---|
66 | // f->Close();
|
---|
67 | }
|
---|
68 |
|
---|
69 | // -----------------------------------------------------------------------------
|
---|
70 | // Execute
|
---|
71 | // function called each time one event is read
|
---|
72 | // -----------------------------------------------------------------------------
|
---|
73 | bool cms_sus_17_001::Execute(SampleFormat& sample, const EventFormat& event)
|
---|
74 | {
|
---|
75 |
|
---|
76 | vector<const RecLeptonFormat*> SignalMuons,SignalElectrons;
|
---|
77 | vector<const RecJetFormat*> SignalJets;
|
---|
78 |
|
---|
79 |
|
---|
80 | // ***************************************************************************
|
---|
81 | // Example of analysis with reconstructed objects
|
---|
82 | // Concerned samples :
|
---|
83 | // - LHCO samples
|
---|
84 | // - LHE/STDHEP/HEPMC samples after applying jet-clustering algorithm
|
---|
85 | // ***************************************************************************
|
---|
86 |
|
---|
87 | double myEventWeight = 1.;
|
---|
88 | if(Configuration().IsNoEventWeight()) myEventWeight=1;
|
---|
89 | else if(event.mc()->weight()!=0.) myEventWeight=event.mc()->weight();
|
---|
90 | Manager()->InitializeForNewEvent(myEventWeight);
|
---|
91 |
|
---|
92 | if (event.rec()!=0)
|
---|
93 | {
|
---|
94 | // cout << "---------------NEW EVENT-------------------" << endl;
|
---|
95 |
|
---|
96 | for (unsigned int i=0;i<event.rec()->electrons().size();i++)
|
---|
97 | {
|
---|
98 | const RecLeptonFormat* elec = &(event.rec()->electrons()[i]);
|
---|
99 | if(elec->pt() > 20.0 && fabs(elec->eta())<2.4)
|
---|
100 | SignalElectrons.push_back(elec);
|
---|
101 | }
|
---|
102 |
|
---|
103 | for (unsigned int i=0;i<event.rec()->muons().size();i++)
|
---|
104 | {
|
---|
105 | const RecLeptonFormat* mu = &(event.rec()->muons()[i]);
|
---|
106 | if(mu->pt()>20.0 && fabs(mu->eta())<2.4)
|
---|
107 | SignalMuons.push_back(mu);
|
---|
108 | }
|
---|
109 |
|
---|
110 | int nb=0;
|
---|
111 | for (unsigned int i=0;i<event.rec()->jets().size();i++)
|
---|
112 | {
|
---|
113 | const RecJetFormat* jet = &(event.rec()->jets()[i]);
|
---|
114 | if(jet->pt()>30 && fabs(jet->eta())<2.4)
|
---|
115 | {
|
---|
116 | SignalJets.push_back(jet);
|
---|
117 | if(jet->btag()) nb++;
|
---|
118 | }
|
---|
119 | }
|
---|
120 |
|
---|
121 | // The MET
|
---|
122 | MALorentzVector pTmiss = event.rec()->MET().momentum();
|
---|
123 | double MET = pTmiss.Pt();
|
---|
124 |
|
---|
125 | int lep_charge_sum=0;
|
---|
126 | for(unsigned int i=0;i<SignalElectrons.size();i++)
|
---|
127 | {
|
---|
128 | if(SignalElectrons[i]->charge()>0) lep_charge_sum++;
|
---|
129 | if(SignalElectrons[i]->charge()<0) lep_charge_sum--;
|
---|
130 | }
|
---|
131 |
|
---|
132 | for(unsigned int i=0;i<SignalMuons.size();i++)
|
---|
133 | {
|
---|
134 | if(SignalMuons[i]->charge()>0) lep_charge_sum++;
|
---|
135 | if(SignalMuons[i]->charge()<0) lep_charge_sum--;
|
---|
136 | }
|
---|
137 |
|
---|
138 | // leading lepton
|
---|
139 | double ptl1=0;
|
---|
140 | if(SignalElectrons.size()>0&&SignalMuons.size()>0)
|
---|
141 | {
|
---|
142 | ptl1=SignalElectrons[0]->pt();
|
---|
143 | if(ptl1<SignalMuons[0]->pt()) ptl1=SignalMuons[0]->pt();
|
---|
144 | }
|
---|
145 | if(SignalElectrons.size()>1)
|
---|
146 | {
|
---|
147 | ptl1=SignalElectrons[0]->pt();
|
---|
148 | }
|
---|
149 | if(SignalMuons.size()>1)
|
---|
150 | {
|
---|
151 | ptl1=SignalMuons[0]->pt();
|
---|
152 | }
|
---|
153 |
|
---|
154 | // cut 2osl.
|
---|
155 | if(!Manager()->ApplyCut((SignalMuons.size()+SignalElectrons.size()==2)&&lep_charge_sum==0&&ptl1>25.0,"2OSL")){
|
---|
156 | return true;
|
---|
157 | }
|
---|
158 |
|
---|
159 | // cut mll20
|
---|
160 | double mll=0;
|
---|
161 | if(SignalElectrons.size()>0&&SignalMuons.size()>0)
|
---|
162 | mll=(SignalMuons[0]->momentum()+SignalElectrons[0]->momentum()).M();
|
---|
163 | if(SignalElectrons.size()>1)
|
---|
164 | mll=(SignalElectrons[1]->momentum()+SignalElectrons[0]->momentum()).M();
|
---|
165 | if(SignalMuons.size()>1)
|
---|
166 | mll=(SignalMuons[1]->momentum()+SignalMuons[0]->momentum()).M();
|
---|
167 |
|
---|
168 | if(!Manager()->ApplyCut(mll>20.0,"mll20"))
|
---|
169 | {
|
---|
170 | return true;
|
---|
171 | }
|
---|
172 |
|
---|
173 | // mll not around Z
|
---|
174 | int zveto=0;
|
---|
175 |
|
---|
176 | if(SignalElectrons.size()>1 || SignalMuons.size()>1)
|
---|
177 | {
|
---|
178 | if(fabs(mll-91.2)<15.0) zveto=1;
|
---|
179 | }
|
---|
180 |
|
---|
181 | if(!Manager()->ApplyCut(zveto==0,"mllZ"))
|
---|
182 | {
|
---|
183 | return true;
|
---|
184 | }
|
---|
185 |
|
---|
186 | // cut nj
|
---|
187 | if(!Manager()->ApplyCut(SignalJets.size()>=2,"nj2"))
|
---|
188 | {
|
---|
189 | return true;
|
---|
190 | }
|
---|
191 |
|
---|
192 | // cut nb
|
---|
193 | if(!Manager()->ApplyCut(nb>=1,"nb1"))
|
---|
194 | {
|
---|
195 | return true;
|
---|
196 | }
|
---|
197 |
|
---|
198 | // met
|
---|
199 | if(!Manager()->ApplyCut(MET>80,"met80"))
|
---|
200 | {
|
---|
201 | return true;
|
---|
202 | }
|
---|
203 |
|
---|
204 | // s
|
---|
205 | double s=0;
|
---|
206 | for(int i=0;i<SignalJets.size();i++)
|
---|
207 | {
|
---|
208 | s+=SignalJets[i]->pt();
|
---|
209 | }
|
---|
210 | for(int i=0;i<SignalMuons.size();i++)
|
---|
211 | {
|
---|
212 | s+=SignalMuons[i]->pt();
|
---|
213 | }
|
---|
214 | for(int i=0;i<SignalElectrons.size();i++)
|
---|
215 | {
|
---|
216 | s+=SignalElectrons[i]->pt();
|
---|
217 | }
|
---|
218 |
|
---|
219 | s=MET/sqrt(s);
|
---|
220 |
|
---|
221 | if(!Manager()->ApplyCut(s>5,"s5"))
|
---|
222 | {
|
---|
223 | return true;
|
---|
224 | }
|
---|
225 |
|
---|
226 | // dphi jet-met
|
---|
227 | double dphij1=99;
|
---|
228 | double dphij2=99;
|
---|
229 |
|
---|
230 | if(SignalJets.size()>1)
|
---|
231 | {
|
---|
232 | dphij1=SignalJets[0]->dphi_0_pi(pTmiss);
|
---|
233 | dphij2=SignalJets[1]->dphi_0_pi(pTmiss);
|
---|
234 | }
|
---|
235 |
|
---|
236 | if(!Manager()->ApplyCut(cos(dphij1)<0.8,"cphi80"))
|
---|
237 | {
|
---|
238 | return true;
|
---|
239 | }
|
---|
240 |
|
---|
241 | if(!Manager()->ApplyCut(cos(dphij2)<0.96,"cphi96"))
|
---|
242 | {
|
---|
243 | return true;
|
---|
244 | }
|
---|
245 |
|
---|
246 | // end of table 1
|
---|
247 |
|
---|
248 | // mt2ll
|
---|
249 |
|
---|
250 | double mt2ll=0;
|
---|
251 | if(SignalElectrons.size()>0&&SignalMuons.size()>0)
|
---|
252 | {
|
---|
253 | MA5::ParticleBaseFormat *p1 = new MA5::ParticleBaseFormat(*SignalElectrons[0]);
|
---|
254 | MA5::ParticleBaseFormat *p2 = new MA5::ParticleBaseFormat(*SignalMuons[0]);
|
---|
255 | mt2ll=PHYSICS->Transverse->MT2(p1,p2,event.rec()->MET(),0);
|
---|
256 | }
|
---|
257 | if(SignalElectrons.size()>1)
|
---|
258 | {
|
---|
259 | MA5::ParticleBaseFormat *p1 = new MA5::ParticleBaseFormat(*SignalElectrons[0]);
|
---|
260 | MA5::ParticleBaseFormat *p2 = new MA5::ParticleBaseFormat(*SignalElectrons[1]);
|
---|
261 | mt2ll=PHYSICS->Transverse->MT2(p1,p2,event.rec()->MET(),0);
|
---|
262 | }
|
---|
263 | if(SignalMuons.size()>1)
|
---|
264 | {
|
---|
265 | MA5::ParticleBaseFormat *p1 = new MA5::ParticleBaseFormat(*SignalMuons[0]);
|
---|
266 | MA5::ParticleBaseFormat *p2 = new MA5::ParticleBaseFormat(*SignalMuons[1]);
|
---|
267 | mt2ll=PHYSICS->Transverse->MT2(p1,p2,event.rec()->MET(),0);
|
---|
268 | }
|
---|
269 |
|
---|
270 | // hmt2ll->Fill(mt2ll);
|
---|
271 |
|
---|
272 | //sr_cutflow
|
---|
273 |
|
---|
274 | // if(!Manager()->ApplyCut(mt2ll>140,"mt2ll140")) return true;
|
---|
275 |
|
---|
276 | // sra0
|
---|
277 |
|
---|
278 | if(!Manager()->ApplyCut(MET>200,"met200a0")) return true;
|
---|
279 | if(!Manager()->ApplyCut(mt2ll>100 && mt2ll<140,"mt2ll14")) return true;
|
---|
280 |
|
---|
281 | //sra1
|
---|
282 |
|
---|
283 | if(!Manager()->ApplyCut(MET>200,"met200a1")) return true;
|
---|
284 | if(!Manager()->ApplyCut(mt2ll>140 && mt2ll<240,"mt2ll24")) return true;
|
---|
285 |
|
---|
286 | //sra2
|
---|
287 |
|
---|
288 | if(!Manager()->ApplyCut(mt2ll>240,"mt2ll240")) return true;
|
---|
289 |
|
---|
290 |
|
---|
291 | }
|
---|
292 |
|
---|
293 | return true;
|
---|
294 | }
|
---|
295 |
|
---|