MA5SandBox: cms_exo_17_015.cpp

File cms_exo_17_015.cpp, 7.0 KB (added by Benjamin Fuks, 4 years ago)
Line 
1#include "SampleAnalyzer/User/Analyzer/cms_exo_17_015.h"
2using namespace MA5;
3
4// -----------------------------------------------------------------------------
5// Initialize
6// function called one time at the beginning of the analysis
7// -----------------------------------------------------------------------------
8bool cms_exo_17_015::Initialize(const MA5::Configuration& cfg, const std::map<std::string,std::string>& parameters)
9{
10 // General information
11 INFO << " <><><><><><><><><><><><><><><><><><><><><><><><>" << endmsg;
12 INFO << " <> Analysis: CMS-EXO-17-015 <>" << endmsg;
13 INFO << " <> arXiv:1811.10151 <>" << endmsg;
14 INFO << " <> (1 muon + >= 1 jet + MET) <>" << endmsg;
15 INFO << " <> Recasted by: B. Fuks and A. Jueid <>" << endmsg;
16 INFO << " <> Contacts: fuks@lpthe.jussieu.fr <>" << endmsg;
17 INFO << " <> adil.hep@gmail.com <>" << endmsg;
18 INFO << " <> Based on MadAnalysis 5 v1.8 <>" << endmsg;
19 INFO << " <><><><><><><><><><><><><><><><><><><><><><><><>" << endmsg;
20
21 // Definition of the signal region
22 Manager()->AddRegionSelection("SR");
23
24 // cuts
25 Manager()->AddCut("SignalMuon");
26 Manager()->AddCut("SignalJet");
27 Manager()->AddCut("bTagVeto");
28 Manager()->AddCut("TauVeto");
29 Manager()->AddCut("ElectronVeto");
30 Manager()->AddCut("ZmassVeto");
31 Manager()->AddCut("Etmiss > 100 GeV");
32 Manager()->AddCut("DPhijetMET > 0.5");
33 Manager()->AddCut("DPhimuMET > 0.5");
34 Manager()->AddCut("MT > 500 GeV");
35
36 // Histograms
37 Manager()->AddHisto("Mmuj", 20, 0.0, 2000.0);
38 return true;
39}
40
41// -----------------------------------------------------------------------------
42// Finalize
43// function called one time at the end of the analysis
44// -----------------------------------------------------------------------------
45void cms_exo_17_015::Finalize(const SampleFormat& summary, const std::vector<SampleFormat>& files)
46{
47}
48
49// -----------------------------------------------------------------------------
50// Execute
51// function called each time one event is read
52// -----------------------------------------------------------------------------
53bool cms_exo_17_015::Execute(SampleFormat& sample, const EventFormat& event)
54{
55 // Event weight
56 double myWeight;
57 if(Configuration().IsNoEventWeight()) myWeight=1.;
58 else if(event.mc()->weight()!=0.) myWeight=event.mc()->weight();
59 else { return false; } // Event with a 0 weight -> can be skipped
60 Manager()->InitializeForNewEvent(myWeight);
61
62 // Security for empty events
63 if (event.rec()==0) return true;
64
65 // Jets
66 std::vector<const RecJetFormat*> SignalJets;
67 unsigned int nb=0;
68 for(unsigned int ii=0; ii<event.rec()->jets().size(); ii++)
69 {
70 const RecJetFormat *CurrentJet = &(event.rec()->jets()[ii]);
71 // Pseudorapidity acceptance
72 if (CurrentJet->abseta() < 2.4) //continue;
73 // Signal jets
74 SignalJets.push_back(CurrentJet);
75 // b-tagged jets (we will veto those jets to reduce ttbar background)
76 if ( CurrentJet->pt()>30. && CurrentJet->btag()) nb++;
77 }
78
79 // Electrons with pt > 15 and |eta| < 2.5
80 // unsigned int ne=0;
81 std::vector<const RecLeptonFormat*> LooseElectrons;
82 for(unsigned int ie=0; ie<event.rec()->electrons().size(); ie++)
83 {
84 const RecLeptonFormat* CurrentElectron = &(event.rec()->electrons()[ie]);
85 double pt = CurrentElectron->pt();
86 double iso = (PHYSICS->Isol->eflow->sumIsolation(CurrentElectron,event.rec(),0.4,0.,IsolationEFlow::ALL_COMPONENTS))/pt;
87 // Pseudorapidity, pt and isolation basic cuts
88 if( CurrentElectron->eta()<2.5 && pt>15. && iso<0.4 ) LooseElectrons.push_back(CurrentElectron);
89 }
90
91 // Loose Muons with pt > 10 GeV and |eta| < 2.4
92 // Signal Muons with pt > 60 GeV and iso < 0.15
93 std::vector<const RecLeptonFormat*> LooseMuons;
94 std::vector<const RecLeptonFormat*> SignalMuons;
95 for(unsigned int im=0; im<event.rec()->muons().size(); im++)
96 {
97 const RecLeptonFormat* CurrentMuon = &(event.rec()->muons()[im]);
98 double pt = CurrentMuon->pt();
99 double iso = (PHYSICS->Isol->eflow->sumIsolation(CurrentMuon,event.rec(),0.4,0.,IsolationEFlow::ALL_COMPONENTS))/pt;
100 if ( CurrentMuon->abseta() >= 2.4 ) continue;
101 if ( pt > 10. && iso < 0.25 ) LooseMuons.push_back(CurrentMuon);
102 if ( pt > 60. && iso < 0.15 ) SignalMuons.push_back(CurrentMuon);
103 }
104
105 bool LeadingMuon = false;
106 if ( SignalMuons.size() > 0 ) LeadingMuon=true;
107
108 // hadronic taus with pT > 20 GeV and |eta| < 2.3
109 unsigned int ntau = 0;
110 for (unsigned int it=0; it < event.rec()->taus().size(); it++)
111 {
112 const RecTauFormat *CurrentTau = &(event.rec()->taus()[it]);
113 // Pseudorapidity and pt basic cuts
114 if ( CurrentTau->pt() > 20.0 && CurrentTau->abseta()< 2.3 ) ntau++;
115 }
116
117 if ( !Manager()->ApplyCut(LeadingMuon, "SignalMuon")) return true;
118
119 // Leading jet requirements
120 SignalJets = PHYSICS->Isol->JetCleaning(SignalJets, LooseElectrons, 0.2);
121 SignalJets = PHYSICS->Isol->JetCleaning(SignalJets, SignalMuons, 0.2);
122
123 bool dR_jet_muon = false;
124 int jm(-1);
125 for ( unsigned int ii = 0; ii < SignalMuons.size(); ii++ ) {
126 if ( SignalJets.size() == 0 ) continue;
127 if ( SignalJets[0]->dr(SignalMuons[ii]) < 0.5 ) continue;
128 jm=ii;
129 dR_jet_muon = true;
130 }
131
132 bool SignalJet = false;
133 if ( SignalJets.size() > 0 ) {
134 if ( SignalJets[0]->pt() > 100. && dR_jet_muon ) SignalJet = true;
135 }
136
137 if ( !Manager()->ApplyCut(SignalJet, "SignalJet")) return true;
138 if ( !Manager()->ApplyCut(nb==0, "bTagVeto") ) return true;
139 if ( !Manager()->ApplyCut(ntau==0, "TauVeto") ) return true;
140 if ( !Manager()->ApplyCut(LooseElectrons.size()==0, "ElectronVeto") ) return true;
141
142
143 // Off-Z
144 bool ZMassWindow = true;
145 for (unsigned int ii=1; ii<LooseMuons.size(); ii++ )
146 {
147 if(SignalMuons[jm]->charge()*LooseMuons[ii]->charge() < 0)
148 {
149 double mmumu = (SignalMuons[0]->momentum() + LooseMuons[ii]->momentum()).M();
150 if(std::abs(mmumu - 91.1876) < 10.) {ZMassWindow=false; break;}
151 }
152 }
153 if ( !Manager()->ApplyCut(ZMassWindow, "ZmassVeto") ) return true;
154
155 // Cut on MET
156 MALorentzVector pMET = event.rec()->MET().momentum();
157 double MET = pMET.Pt();
158 if ( !Manager()->ApplyCut((MET > 100.0), "Etmiss > 100 GeV")) return true;
159
160 // MET isolation
161 double dphi1 = SignalJets[0]->dphi_0_pi(pMET);
162 double dphi2 = SignalMuons[jm]->dphi_0_pi(pMET);
163 if ( !Manager()->ApplyCut(dphi1 > 0.5, "DPhijetMET > 0.5") ) return true;
164 if ( !Manager()->ApplyCut(dphi2 > 0.5, "DPhimuMET > 0.5") ) return true;
165
166 // Now requiring that mT(leading muon, MET) > 500 GeV
167 double mT = SignalMuons[jm]->mt_met(pMET);
168 if ( !Manager()->ApplyCut(mT > 500., "MT > 500 GeV") ) return true;
169
170 // Now fill Histogram corresponding to Fig. 3 of the CMS paper
171 double mLQ = ( SignalMuons[0]->momentum() + SignalJets[0]->momentum() ).M();
172 Manager()->FillHisto("Mmuj", mLQ);
173
174 return true;
175}
176