CMS 3D CMS Logo

ExoticaDQM.cc
Go to the documentation of this file.
2 
3 using namespace edm;
4 using namespace std;
5 using namespace reco;
6 using namespace trigger;
7 
8 typedef vector<string> vstring;
9 
10 //
11 // -- Constructor
12 //
14 
15  edm::LogInfo("ExoticaDQM") << " Starting ExoticaDQM " << "\n" ;
16 
17  typedef std::vector<edm::InputTag> vtag;
18 
19  // Get parameters from configuration file
20  // Trigger
21  TriggerToken_ = consumes<TriggerResults>(
22  ps.getParameter<edm::InputTag>("TriggerResults"));
23  HltPaths_ = ps.getParameter<vector<string> >("HltPaths");
24  //
25  VertexToken_ = consumes<reco::VertexCollection>(
26  ps.getParameter<InputTag>("vertexCollection"));
27  //
28  ElectronToken_ = consumes<reco::GsfElectronCollection>(
29  ps.getParameter<InputTag>("electronCollection"));
30  //
31  MuonToken_ = consumes<reco::MuonCollection>(
32  ps.getParameter<InputTag>("muonCollection"));
33  //
34  PhotonToken_ = consumes<reco::PhotonCollection>(
35  ps.getParameter<InputTag>("photonCollection"));
36  //
37  PFJetToken_ = consumes<reco::PFJetCollection>(
38  ps.getParameter<InputTag>("pfJetCollection"));
39  //
40  DiJetPFJetCollection_ = ps.getParameter<std::vector<edm::InputTag> >("DiJetPFJetCollection");
41  for (std::vector<edm::InputTag>::const_iterator jetlabel = DiJetPFJetCollection_.begin(), jetlabelEnd = DiJetPFJetCollection_.end(); jetlabel != jetlabelEnd; ++jetlabel) {
42  DiJetPFJetToken_.push_back(consumes<reco::PFJetCollection>(*jetlabel));
43  }
44  //
45  PFMETToken_ = consumes<reco::PFMETCollection>(
46  ps.getParameter<InputTag>("pfMETCollection"));
47  //
48  ecalBarrelRecHitToken_ = consumes<EBRecHitCollection>(
49  ps.getUntrackedParameter<InputTag>("ecalBarrelRecHit", InputTag("reducedEcalRecHitsEB")));
50  //
51  ecalEndcapRecHitToken_ = consumes<EERecHitCollection>(
52  ps.getUntrackedParameter<InputTag>("ecalEndcapRecHit", InputTag("reducedEcalRecHitsEE")));
53  //
54  TrackToken_ = consumes<reco::TrackCollection>(
55  ps.getParameter<InputTag>("trackCollection"));
56  //
57  MuonDispToken_ = consumes<reco::TrackCollection>(
58  ps.getParameter<InputTag>("displacedMuonCollection"));
59  //
60  MuonDispSAToken_ = consumes<reco::TrackCollection>(
61  ps.getParameter<InputTag>("displacedSAMuonCollection"));
62  //
63  GenParticleToken_ = consumes<reco::GenParticleCollection>(
64  ps.getParameter<InputTag>("genParticleCollection"));
65 
66  JetCorrectorToken_ = consumes<reco::JetCorrector>(
67  ps.getParameter<edm::InputTag>("jetCorrector"));
68 
69  //Cuts - MultiJets
70  jetID = new reco::helper::JetIDHelper(ps.getParameter<ParameterSet>("JetIDParams"), consumesCollector());
71 
72  //Varibles and Cuts for each Module:
73  //Dijet
74  dijet_PFJet1_pt_cut_ = ps.getParameter<double>("dijet_PFJet1_pt_cut");
75  dijet_PFJet2_pt_cut_ = ps.getParameter<double>("dijet_PFJet2_pt_cut");
76  //DiMuon
77  dimuon_Muon1_pt_cut_ = ps.getParameter<double>("dimuon_Muon1_pt_cut");
78  dimuon_Muon2_pt_cut_ = ps.getParameter<double>("dimuon_Muon2_pt_cut");
79  //DiElectron
80  dielectron_Electron1_pt_cut_ = ps.getParameter<double>("dielectron_Electron2_pt_cut");
81  dielectron_Electron2_pt_cut_ = ps.getParameter<double>("dielectron_Electron2_pt_cut");
82  //DiPhoton
83  diphoton_Photon1_pt_cut_ = ps.getParameter<double>("diphoton_Photon2_pt_cut");
84  diphoton_Photon2_pt_cut_ = ps.getParameter<double>("diphoton_Photon2_pt_cut");
85  //MonoJet
86  monojet_PFJet_pt_cut_ = ps.getParameter<double>("monojet_PFJet_pt_cut");
87  monojet_PFJet_met_cut_ = ps.getParameter<double>("monojet_PFJet_met_cut");
88  //MonoMuon
89  monomuon_Muon_pt_cut_ = ps.getParameter<double>("monomuon_Muon_pt_cut");
90  monomuon_Muon_met_cut_ = ps.getParameter<double>("monomuon_Muon_met_cut");
91  //MonoElectron
92  monoelectron_Electron_pt_cut_ = ps.getParameter<double>("monoelectron_Electron_pt_cut");
93  monoelectron_Electron_met_cut_ = ps.getParameter<double>("monoelectron_Electron_met_cut");
94  //MonoPhoton
95  monophoton_Photon_pt_cut_ = ps.getParameter<double>("monophoton_Photon_pt_cut");
96  monophoton_Photon_met_cut_ = ps.getParameter<double>("monophoton_Photon_met_cut");
97  // Displaced lepton or jet
98  dispFermion_eta_cut_ = ps.getParameter<double>("dispFermion_eta_cut");
99  dispFermion_pt_cut_ = ps.getParameter<double>("dispFermion_pt_cut");
100 }
101 
102 //
103 // -- Destructor
104 //
106  edm::LogInfo("ExoticaDQM") << " Deleting ExoticaDQM " << "\n" ;
107 }
108 
109 //
110 // -- Book histograms
111 //
113  edm::EventSetup const&) {
114  bei.cd();
115 
116  //--- DiJet
117  for (unsigned int icoll = 0; icoll < DiJetPFJetCollection_.size(); ++icoll) {
118  std::stringstream ss;
119  ss << "Physics/Exotica/Dijets/" << DiJetPFJetCollection_[icoll].label();
120  bei.setCurrentFolder(ss.str());
121  //bei.setCurrentFolder("Physics/Exotica/Dijets");
122  dijet_PFJet_pt.push_back(bei.book1D("dijet_PFJet_pt", "Pt of PFJet (GeV)", 50, 30.0 , 5000));
123  dijet_PFJet_eta.push_back(bei.book1D("dijet_PFJet_eta", "#eta (PFJet)", 50, -2.5, 2.5));
124  dijet_PFJet_phi.push_back(bei.book1D("dijet_PFJet_phi", "#phi (PFJet)", 50, -3.14,3.14));
125  dijet_PFJet_rapidity.push_back(bei.book1D("dijet_PFJet_rapidity", "Rapidity (PFJet)", 50, -6.0,6.0));
126  dijet_PFJet_mass.push_back(bei.book1D("dijet_PFJet_mass", "Mass (PFJets)", 50, 0., 500.));
127  dijet_deltaPhiPFJet1PFJet2.push_back(bei.book1D("dijet_deltaPhiPFJet1PFJet2", "#Delta#phi(Leading PFJet, Sub PFJet)", 40, 0., 3.15));
128  dijet_deltaEtaPFJet1PFJet2.push_back(bei.book1D("dijet_deltaEtaPFJet1PFJet2", "#Delta#eta(Leading PFJet, Sub PFJet)", 40, -5., 5.));
129  dijet_deltaRPFJet1PFJet2.push_back(bei.book1D("dijet_deltaRPFJet1PFJet2", "#DeltaR(Leading PFJet, Sub PFJet)", 50, 0., 6.));
130  dijet_invMassPFJet1PFJet2.push_back(bei.book1D("dijet_invMassPFJet1PFJet2", "Leading PFJet, SubLeading PFJet Invariant mass (GeV)", 50, 0. , 8000.));
131  dijet_PFchef.push_back(bei.book1D("dijet_PFchef", "Leading PFJet CHEF", 50, 0.0 , 1.0));
132  dijet_PFnhef.push_back(bei.book1D("dijet_PFnhef", "Leading PFJet NHEF", 50, 0.0 , 1.0));
133  dijet_PFcemf.push_back(bei.book1D("dijet_PFcemf", "Leading PFJet CEMF", 50, 0.0 , 1.0));
134  dijet_PFnemf.push_back(bei.book1D("dijet_PFnemf", "Leading PFJEt NEMF", 50, 0.0 , 1.0));
135  dijet_PFJetMulti.push_back(bei.book1D("dijet_PFJetMulti", "No. of PFJets", 10, 0., 10.));
136  }
137  //--- DiMuon
138  bei.setCurrentFolder("Physics/Exotica/DiMuons");
139  dimuon_Muon_pt = bei.book1D("dimuon_Muon_pt", "Pt of Muon (GeV)", 50, 30.0 , 2000);
140  dimuon_Muon_eta = bei.book1D("dimuon_Muon_eta", "#eta (Muon)", 50, -2.5, 2.5);
141  dimuon_Muon_phi = bei.book1D("dimuon_Muon_phi", "#phi (Muon)", 50, -3.14,3.14);
142  dimuon_Charge = bei.book1D("dimuon_Charge", "Charge of the Muon", 10, -5., 5.);
143  dimuon_deltaEtaMuon1Muon2 = bei.book1D("dimuon_deltaEtaMuon1Muon2", "#Delta#eta(Leading Muon, Sub Muon)", 40, -5., 5.);
144  dimuon_deltaPhiMuon1Muon2 = bei.book1D("dimuon_deltaPhiMuon1Muon2", "#Delta#phi(Leading Muon, Sub Muon)", 40, 0., 3.15);
145  dimuon_deltaRMuon1Muon2 = bei.book1D("dimuon_deltaRMuon1Muon2", "#DeltaR(Leading Muon, Sub Muon)", 50, 0., 6.);
146  dimuon_invMassMuon1Muon2 = bei.book1D("dimuon_invMassMuon1Muon2", "Leading Muon, SubLeading Muon Low Invariant mass (GeV)", 50, 500. , 4500.);
147  dimuon_MuonMulti = bei.book1D("dimuon_MuonMulti", "No. of Muons", 10, 0., 10.);
148  //--- DiElectrons
149  bei.setCurrentFolder("Physics/Exotica/DiElectrons");
150  dielectron_Electron_pt = bei.book1D("dielectron_Electron_pt", "Pt of Electron (GeV)", 50, 30.0 , 2000);
151  dielectron_Electron_eta = bei.book1D("dielectron_Electron_eta", "#eta (Electron)", 50, -2.5, 2.5);
152  dielectron_Electron_phi = bei.book1D("dielectron_Electron_phi", "#phi (Electron)", 50, -3.14,3.14);
153  dielectron_Charge = bei.book1D("dielectron_Charge", "Charge of the Electron", 10, -5., 5.);
154  dielectron_deltaEtaElectron1Electron2 = bei.book1D("dielectron_deltaEtaElectron1Electron2", "#Delta#eta(Leading Electron, Sub Electron)", 40, -5., 5.);
155  dielectron_deltaPhiElectron1Electron2 = bei.book1D("dielectron_deltaPhiElectron1Electron2", "#Delta#phi(Leading Electron, Sub Electron)", 40, 0., 3.15);
156  dielectron_deltaRElectron1Electron2 = bei.book1D("dielectron_deltaRElectron1Electron2", "#DeltaR(Leading Electron, Sub Electron)", 50, 0., 6.);
157  dielectron_invMassElectron1Electron2 = bei.book1D("dielectron_invMassElectron1Electron2", "Leading Electron, SubLeading Electron Invariant mass (GeV)", 50, 500. , 4500.);
158  dielectron_ElectronMulti = bei.book1D("dielectron_ElectronMulti", "No. of Electrons", 10, 0., 10.);
159  //--- DiPhotons
160  bei.setCurrentFolder("Physics/Exotica/DiPhotons");
161  diphoton_Photon_energy = bei.book1D("diphoton_Photon_energy", "Energy of Photon (GeV)", 50, 30.0 , 300);
162  diphoton_Photon_et = bei.book1D("diphoton_Photon_et", "Et of Photon (GeV)", 50, 30.0 , 300);
163  diphoton_Photon_pt = bei.book1D("diphoton_Photon_pt", "Pt of Photon (GeV)", 50, 30.0 , 300);
164  diphoton_Photon_eta = bei.book1D("diphoton_Photon_eta", "#eta (Photon)", 50, -2.5, 2.5);
165  diphoton_Photon_etasc = bei.book1D("diphoton_Photon_etasc", "#eta sc(Photon)", 50, -2.5, 2.5);
166  diphoton_Photon_phi = bei.book1D("diphoton_Photon_phi", "#phi (Photon)", 50, -3.14,3.14);
167  diphoton_Photon_hovere_eb = bei.book1D("diphoton_Photon_hovere_eb", "H/E (Photon) EB", 50, 0., 0.50);
168  diphoton_Photon_hovere_ee = bei.book1D("diphoton_Photon_hovere_ee", "H/E (Photon) EE", 50, 0., 0.50);
169  diphoton_Photon_sigmaietaieta_eb = bei.book1D("diphoton_Photon_sigmaietaieta_eb", "#sigma_{i #eta i #eta} (Photon) EB", 50, 0., 0.03);
170  diphoton_Photon_sigmaietaieta_ee = bei.book1D("diphoton_Photon_sigmaietaieta_ee", "#sigma_{i #eta i #eta} (Photon) EE", 50, 0., 0.03);
171  diphoton_Photon_trksumptsolidconedr03_eb = bei.book1D("diphoton_Photon_trksumptsolidconedr03_eb", "TrkSumPtDr03 (Photon) EB", 50, 0., 15.);
172  diphoton_Photon_trksumptsolidconedr03_ee = bei.book1D("diphoton_Photon_trksumptsolidconedr03_ee", "TrkSumPtDr03 (Photon) EE", 50, 0., 15.);
173  diphoton_Photon_e1x5e5x5_eb = bei.book1D("diphoton_Photon_e1x5e5x5_eb", "E_{1x5}/E_{5x5} (Photon) EB", 50, 0., 1.);
174  diphoton_Photon_e1x5e5x5_ee = bei.book1D("diphoton_Photon_e1x5e5x5_ee", "E_{1x5}/E_{5x5} (Photon) EE", 50, 0., 1.);
175  diphoton_Photon_e2x5e5x5_eb = bei.book1D("diphoton_Photon_e2x5e5x5_eb", "E_{2x5}/E_{5x5} (Photon) EB", 50, 0., 1.);
176  diphoton_Photon_e2x5e5x5_ee = bei.book1D("diphoton_Photon_e2x5e5x5_ee", "E_{2x5}/E_{5x5} (Photon) EE", 50, 0., 1.);
177  diphoton_deltaEtaPhoton1Photon2 = bei.book1D("diphoton_deltaEtaPhoton1Photon2", "#Delta#eta(SubLeading Photon, Sub Photon)", 40, -5., 5.);
178  diphoton_deltaPhiPhoton1Photon2 = bei.book1D("diphoton_deltaPhiPhoton1Photon2", "#Delta#phi(SubLeading Photon, Sub Photon)", 40, 0., 3.15);
179  diphoton_deltaRPhoton1Photon2 = bei.book1D("diphoton_deltaRPhoton1Photon2", "#DeltaR(SubLeading Photon, Sub Photon)", 50, 0., 6.);
180  diphoton_invMassPhoton1Photon2 = bei.book1D("diphoton_invMassPhoton1Photon2", "SubLeading Photon, SubSubLeading Photon Invariant mass (GeV)", 50, 500. , 4500.);
181  diphoton_PhotonMulti = bei.book1D("diphoton_PhotonMulti", "No. of Photons", 10, 0., 10.);
182  //--- MonoJet
183  bei.setCurrentFolder("Physics/Exotica/MonoJet");
184  monojet_PFJet_pt = bei.book1D("monojet_PFJet_pt", "Pt of MonoJet (GeV)", 50, 30.0 , 1000);
185  monojet_PFJet_eta = bei.book1D("monojet_PFJet_eta", "#eta(MonoJet)", 50, -2.5, 2.5);
186  monojet_PFJet_phi = bei.book1D("monojet_PFJet_phi", "#phi(MonoJet)", 50, -3.14,3.14);
187  monojet_PFMet = bei.book1D("monojet_PFMet", "Pt of PFMET (GeV)", 40, 0.0 , 1000);
188  monojet_PFMet_phi = bei.book1D("monojet_PFMet_phi", "#phi(PFMET #phi)", 50, -3.14,3.14);
189  monojet_PFJetPtOverPFMet = bei.book1D("monojet_PFJetPtOverPFMet", "Pt of MonoJet/MET (GeV)", 40, 0.0 , 5.);
190  monojet_deltaPhiPFJetPFMet = bei.book1D("monojet_deltaPhiPFJetPFMet", "#Delta#phi(MonoJet, PFMet)", 40, 0., 3.15);
191  monojet_PFchef = bei.book1D("monojet_PFchef", "MonojetJet CHEF", 50, 0.0 , 1.0);
192  monojet_PFnhef = bei.book1D("monojet_PFnhef", "MonojetJet NHEF", 50, 0.0 , 1.0);
193  monojet_PFcemf = bei.book1D("monojet_PFcemf", "MonojetJet CEMF", 50, 0.0 , 1.0);
194  monojet_PFnemf = bei.book1D("monojet_PFnemf", "MonojetJet NEMF", 50, 0.0 , 1.0);
195  monojet_PFJetMulti = bei.book1D("monojet_PFJetMulti", "No. of PFJets", 10, 0., 10.);
196  //--- MonoMuon
197  bei.setCurrentFolder("Physics/Exotica/MonoMuon");
198  monomuon_Muon_pt = bei.book1D("monomuon_Muon_pt", "Pt of Monomuon (GeV)", 50, 30.0 , 2000);
199  monomuon_Muon_eta = bei.book1D("monomuon_Muon_eta", "#eta(Monomuon)", 50, -2.5, 2.5);
200  monomuon_Muon_phi = bei.book1D("monomuon_Muon_phi", "#phi(Monomuon)", 50, -3.14,3.14);
201  monomuon_Charge = bei.book1D("monomuon_Charge", "Charge of the MonoMuon", 10, -5., 5.);
202  monomuon_PFMet = bei.book1D("monomuon_PFMet", "Pt of PFMET (GeV)", 40, 0.0 , 2000);
203  monomuon_PFMet_phi = bei.book1D("monomuon_PFMet_phi", "PFMET #phi", 50, -3.14,3.14);
204  monomuon_MuonPtOverPFMet = bei.book1D("monomuon_MuonPtOverPFMet", "Pt of Monomuon/PFMet", 40, 0.0 , 5.);
205  monomuon_deltaPhiMuonPFMet = bei.book1D("monomuon_deltaPhiMuonPFMet", "#Delta#phi(Monomuon, PFMet)", 40, 0., 3.15);
206  monomuon_TransverseMass = bei.book1D("monomuon_TransverseMass", "Transverse Mass M_{T} GeV", 40, 200., 3000.);
207  monomuon_MuonMulti = bei.book1D("monomuon_MuonMulti", "No. of Muons", 10, 0., 10.);
208  //--- MonoElectron
209  bei.setCurrentFolder("Physics/Exotica/MonoElectron");
210  monoelectron_Electron_pt = bei.book1D("monoelectron_Electron_pt", "Pt of Monoelectron (GeV)", 50, 30.0 , 4000);
211  monoelectron_Electron_eta = bei.book1D("monoelectron_Electron_eta", "#eta(MonoElectron)", 50, -2.5, 2.5);
212  monoelectron_Electron_phi = bei.book1D("monoelectron_Electron_phi", "#phi(MonoElectron)", 50, -3.14,3.14);
213  monoelectron_Charge = bei.book1D("monoelectron_Charge", "Charge of the MonoElectron", 10, -5., 5.);
214  monoelectron_PFMet = bei.book1D("monoelectron_PFMet", "Pt of PFMET (GeV)", 40, 0.0 , 4000);
215  monoelectron_PFMet_phi = bei.book1D("monoelectron_PFMet_phi", "PFMET #phi", 50, -3.14,3.14);
216  monoelectron_ElectronPtOverPFMet = bei.book1D("monoelectron_ElectronPtOverPFMet", "Pt of Monoelectron/PFMet", 40, 0.0 , 5.);
217  monoelectron_deltaPhiElectronPFMet = bei.book1D("monoelectron_deltaPhiElectronPFMet", "#Delta#phi(MonoElectron, PFMet)", 40, 0., 3.15);
218  monoelectron_TransverseMass = bei.book1D("monoelectron_TransverseMass", "Transverse Mass M_{T} GeV", 40, 200., 4000.);
219  monoelectron_ElectronMulti = bei.book1D("monoelectron_ElectronMulti", "No. of Electrons", 10, 0., 10.);
220 
221  //--- DiPhotons
222  bei.setCurrentFolder("Physics/Exotica/MonoPhotons");
223  monophoton_Photon_energy = bei.book1D("monophoton_Photon_energy", "Energy of Leading Photon (GeV)", 50, 30.0 , 1000);
224  monophoton_Photon_et = bei.book1D("monophoton_Photon_et", "Et of Leading Photon (GeV)", 50, 30.0 , 1000);
225  monophoton_Photon_pt = bei.book1D("monophoton_Photon_pt", "Pt of Leading Photon (GeV)", 50, 30.0 , 1000);
226  monophoton_Photon_eta = bei.book1D("monophoton_Photon_eta", "#eta (Leading Photon)", 50, -2.5, 2.5);
227  monophoton_Photon_etasc = bei.book1D("monophoton_Photon_etasc", "#eta sc(Leading Photon)", 50, -2.5, 2.5);
228  monophoton_Photon_phi = bei.book1D("monophoton_Photon_phi", "#phi(Leading Photon)", 50, -3.14,3.14);
229  monophoton_Photon_hovere = bei.book1D("monophoton_Photon_hovere", "H/E (Leading Photon)", 50, 0., 0.50);
230  monophoton_Photon_sigmaietaieta = bei.book1D("monophoton_Photon_sigmaietaieta", "#sigma_{i #eta i #eta} (Leading Photon)", 50, 0., 0.03);
231  monophoton_Photon_trksumptsolidconedr03 = bei.book1D("monophoton_Photon_trksumptsolidconedr03", "TrkSumPtDr03 (Leading Photon)", 50, 0., 15.);
232  monophoton_Photon_e1x5e5x5 = bei.book1D("monophoton_Photon_e1x5e5x5", "E_{1x5}/E_{5x5} (Leading Photon)", 50, 0., 1.);
233  monophoton_Photon_e2x5e5x5 = bei.book1D("monophoton_Photon_e2x5e5x5", "E_{2x5}/E_{5x5} (Leading Photon)", 50, 0., 1.);
234  monophoton_PFMet = bei.book1D("monophoton_PFMet", "Pt of PFMET (GeV)", 40, 0.0 , 1000);
235  monophoton_PFMet_phi = bei.book1D("monophoton_PFMet_phi", "PFMET #phi", 50, -3.14,3.14);
236  monophoton_PhotonPtOverPFMet = bei.book1D("monophoton_PhotonPtOverPFMet", "Pt of Monophoton/PFMet", 40, 0.0 , 5.);
237  monophoton_deltaPhiPhotonPFMet = bei.book1D("monophoton_deltaPhiPhotonPFMet", "#Delta#phi(SubLeading Photon, PFMet)", 40, 0., 3.15);
238  monophoton_PhotonMulti = bei.book1D("monophoton_PhotonMulti", "No. of Photons", 10, 0., 10.);
239 
240  //--- Displaced Leptons (filled using only leptons from long-lived stop decay).
241  bei.setCurrentFolder("Physics/Exotica/DisplacedFermions");
242  dispElec_track_effi_lxy = bei.bookProfile("dispElec_track_effi_lxy","Electron channel; transverse decay length (cm); track reco efficiency", 10, 0., 100., -999., 999, "");
243  dispElec_elec_effi_lxy = bei.bookProfile("dispElec_elec_effi_lxy" ,"Electron channel; transverse decay length (cm); electron reco efficiency", 10, 0., 100., -999., 999, "");
244  dispMuon_track_effi_lxy = bei.bookProfile("dispMuon_track_effi_lxy","Muon channel; transverse decay length (cm); track reco efficiency", 10, 0., 100., -999., 999, "");
245  dispMuon_muon_effi_lxy = bei.bookProfile("dispMuon_muon_effi_lxy" ,"Muon channel; transverse decay length (cm); muon reco efficiency", 10, 0., 100., -999., 999, "");
246  dispMuon_muonDisp_effi_lxy = bei.bookProfile("dispMuon_muonDisp_effi_lxy","Muon channel; transverse decay length (cm); displacedMuon reco efficiency", 10, 0., 100., -999., 999, "");
247  dispMuon_muonDispSA_effi_lxy = bei.bookProfile("dispMuon_muonDispSA_effi_lxy","Muon channel; transverse decay length (cm); displacedSAMuon reco efficiency", 10, 0., 400., -999., 999, "");
248  //--- Displaced Jets (filled using only tracks or jets from long-lived stop decay).
249  dispJet_track_effi_lxy = bei.bookProfile("dispJet_track_effi_lxy" ,"Jet channel; transverse decay length (cm); track reco efficiency", 10, 0., 100., -999., 999, "");
250 
251  bei.cd();
252 }
253 
254 
255 //
256 // -- Analyze
257 //
259 
260  // objects
261 
262  //Trigger
263  bool ValidTriggers = iEvent.getByToken(TriggerToken_, TriggerResults_);
264  if (!ValidTriggers) return;
265 
266  // Vertices
267  bool ValidVertices = iEvent.getByToken(VertexToken_, VertexCollection_);
268  if (!ValidVertices) return;
269 
270  // Electrons
271  bool ValidGedGsfElectron = iEvent.getByToken(ElectronToken_, ElectronCollection_);
272  if(!ValidGedGsfElectron) return;
273 
274  // Muons
275  bool ValidPFMuon = iEvent.getByToken(MuonToken_, MuonCollection_);
276  if(!ValidPFMuon) return;
277 
278  // Jets
279  bool ValidPFJet = iEvent.getByToken(PFJetToken_, pfJetCollection_);
280  pfjets = *pfJetCollection_;
281  if(!ValidPFJet) return;
282 
283  // PFMETs
284  bool ValidPFMET = iEvent.getByToken(PFMETToken_, pfMETCollection_);
285  if(!ValidPFMET) return;
286 
287  // Photons
288  bool ValidCaloPhoton = iEvent.getByToken(PhotonToken_, PhotonCollection_);
289  if(!ValidCaloPhoton) return;
290 
291  // Tracks
292  bool ValidTracks = iEvent.getByToken(TrackToken_, TrackCollection_);
293  if (!ValidTracks) return;
294 
295  // Special collections for displaced particles
296  iEvent.getByToken(MuonDispToken_, MuonDispCollection_);
297  iEvent.getByToken(MuonDispSAToken_, MuonDispSACollection_);
298 
299  // MC truth
300  bool ValidGenParticles = iEvent.getByToken(GenParticleToken_, GenCollection_);
301 
302  // JetCorrector
303  bool ValidJetCorrector = iEvent.getByToken( JetCorrectorToken_, JetCorrector_ );
304 
305  //Trigger
306 
307  int N_Triggers = TriggerResults_->size();
308  int N_GoodTriggerPaths = HltPaths_.size();
309  bool triggered_event = false;
310  const edm::TriggerNames& trigName = iEvent.triggerNames(*TriggerResults_);
311  for (int i_Trig = 0; i_Trig < N_Triggers; ++i_Trig) {
312  if (TriggerResults_.product()->accept(i_Trig)) {
313  for (int n = 0; n < N_GoodTriggerPaths; n++) {
314  if (trigName.triggerName(i_Trig).find(HltPaths_[n])!=std::string::npos){
315  triggered_event = true;
316  }
317  }
318  }
319  }
320  if (triggered_event == false) return;
321 
322  for(int i=0; i<2; i++){
323  //Jets
324  PFJetPx[i] = 0.; PFJetPy[i] = 0.; PFJetPt[i] = 0.; PFJetEta[i] = 0.; PFJetPhi[i] = 0.;
325  PFJetNHEF[i] = 0.; PFJetCHEF[i] = 0.; PFJetNEMF[i] = 0.; PFJetCEMF[i] = 0.;
326  //Muons
327  MuonPx[i] = 0.; MuonPy[i] = 0.; MuonPt[i] = 0.;
328  MuonEta[i] = 0.; MuonPhi[i] = 0.; MuonCharge[i] = 0.;
329  //Electrons
330  ElectronPx[i] = 0.; ElectronPy[i] = 0.; ElectronPt[i] = 0.;
331  ElectronEta[i] = 0.; ElectronPhi[i] = 0.; ElectronCharge[i] = 0.;
332  //Photons
333  PhotonEnergy[i] = 0.; PhotonPt[i] = 0.; PhotonEt[i] = 0.; PhotonEta[i] = 0.; PhotonEtaSc[i] = 0.; PhotonPhi[i] = 0.; PhotonHoverE[i] = 0.;
334  PhotonSigmaIetaIeta[i] = 0.; PhotonTrkSumPtSolidConeDR03[i] = 0.; PhotonE1x5E5x5[i] = 0.; PhotonE2x5E5x5[i] = 0.;
335  }
336 
337  //Getting information from the RecoObjects
338  dijet_countPFJet_=0;
339  monojet_countPFJet_=0;
340 
341  PFJetCollection::const_iterator pfjet_ = pfjets.begin();
342  for(; pfjet_ != pfjets.end(); ++pfjet_){
343  double scale = 1.;
344  if (ValidJetCorrector) scale = JetCorrector_->correction(*pfjet_);
345  if(scale*pfjet_->pt()>PFJetPt[0]){
346  PFJetPt[1] = PFJetPt[0];
347  PFJetPx[1] = PFJetPx[0];
348  PFJetPy[1] = PFJetPy[0];
349  PFJetEta[1] = PFJetEta[0];
350  PFJetPhi[1] = PFJetPhi[0];
351  PFJetRapidity[1] = PFJetRapidity[0];
352  PFJetMass[1] = PFJetMass[0];
353  PFJetNHEF[1] = PFJetNHEF[0];
354  PFJetCHEF[1] = PFJetCHEF[0];
355  PFJetNEMF[1] = PFJetNEMF[0];
356  PFJetCEMF[1] = PFJetCEMF[0];
357  //
358  PFJetPt[0] = scale*pfjet_->pt();
359  PFJetPx[0] = scale*pfjet_->px();
360  PFJetPy[0] = scale*pfjet_->py();
361  PFJetEta[0] = pfjet_->eta();
362  PFJetPhi[0] = pfjet_->phi();
363  PFJetRapidity[0] = pfjet_->rapidity();
364  PFJetMass[0] = pfjet_->mass();
365  PFJetNHEF[0] = pfjet_->neutralHadronEnergyFraction();
366  PFJetCHEF[0] = pfjet_->chargedHadronEnergyFraction();
367  PFJetNEMF[0] = pfjet_->neutralEmEnergyFraction();
368  PFJetCEMF[0] = pfjet_->chargedEmEnergyFraction();
369  }
370  else if(scale*pfjet_->pt()<PFJetPt[0] && scale*pfjet_->pt()>PFJetPt[1] ){
371  PFJetPt[1] = scale*pfjet_->pt();
372  PFJetPx[1] = scale*pfjet_->px();
373  PFJetPy[1] = scale*pfjet_->py();
374  PFJetEta[1] = pfjet_->eta();
375  PFJetPhi[1] = pfjet_->phi();
376  PFJetRapidity[1] = pfjet_->rapidity();
377  PFJetMass[1] = pfjet_->mass();
378  PFJetNHEF[1] = pfjet_->neutralHadronEnergyFraction();
379  PFJetCHEF[1] = pfjet_->chargedHadronEnergyFraction();
380  PFJetNEMF[1] = pfjet_->neutralEmEnergyFraction();
381  PFJetCEMF[1] = pfjet_->chargedEmEnergyFraction();
382  }
383  else{}
384  if(scale*pfjet_->pt()>dijet_PFJet1_pt_cut_) dijet_countPFJet_++;
385  if(scale*pfjet_->pt()>dijet_PFJet1_pt_cut_) monojet_countPFJet_++;
386  }
387 
388  VertexCollection vertexCollection = *(VertexCollection_.product());
389  reco::VertexCollection::const_iterator primaryVertex_ = vertexCollection.begin();
390 
391  dimuon_countMuon_ = 0;
392  monomuon_countMuon_ = 0;
393  reco::MuonCollection::const_iterator muon_ = MuonCollection_->begin();
394  for(; muon_ != MuonCollection_->end(); muon_++){
395  // Muon High Pt ID
396  bool HighPt = false;
397  if ( muon_->isGlobalMuon()
398  && muon_->globalTrack()->hitPattern().numberOfValidMuonHits() >0
399  && muon_->numberOfMatchedStations() > 1
400  && muon_->innerTrack()->hitPattern().trackerLayersWithMeasurement() > 5
401  && muon_->innerTrack()->hitPattern().numberOfValidPixelHits() > 0
402  && muon_->muonBestTrack()->ptError()/muon_->muonBestTrack()->pt() < 0.3
403  && fabs(muon_->muonBestTrack()->dxy(primaryVertex_->position())) < 0.2
404  && fabs(muon_->bestTrack()->dz(primaryVertex_->position())) < 0.5
405  && fabs(muon_->eta()) <2.1
406  ) HighPt = true;
407 
408  if (HighPt == true ){
409  if(muon_->pt()>MuonPt[0]){
410  MuonPt[1] = MuonPt[0];
411  MuonPx[1] = MuonPx[0];
412  MuonPy[1] = MuonPy[0];
413  MuonEta[1] = MuonEta[0];
414  MuonPhi[1] = MuonPhi[0];
415  MuonCharge[1] = MuonCharge[0];
416  //
417  MuonPt[0] = muon_->pt();
418  MuonPx[0] = muon_->px();
419  MuonPy[0] = muon_->py();
420  MuonEta[0] = muon_->eta();
421  MuonPhi[0] = muon_->phi();
422  MuonCharge[0] = muon_->charge();
423  }
424  }
425  if (muon_->pt() > dimuon_Muon1_pt_cut_) dimuon_countMuon_++;
426  if (muon_->pt() > dimuon_Muon1_pt_cut_) monomuon_countMuon_++;
427  }
428 
429  dielectron_countElectron_ = 0;
430  monoelectron_countElectron_ = 0;
431  reco::GsfElectronCollection::const_iterator electron_ = ElectronCollection_->begin();
432  for(; electron_ != ElectronCollection_->end(); electron_++){
433  //HEEP Selection 4.1 (some cuts)
434  if (electron_->e5x5()<=0) continue;
435  if (electron_->gsfTrack().isNull()) continue;
436  bool HEPP_ele = false;
437  double sceta = electron_->caloPosition().eta();
438  double dEtaIn = fabs(electron_->deltaEtaSuperClusterTrackAtVtx());
439  double dPhiIn = fabs(electron_->deltaPhiSuperClusterTrackAtVtx());
440  double HoverE = electron_->hadronicOverEm();
441  int missingHits = electron_->gsfTrack()->hitPattern().numberOfLostTrackerHits(HitPattern::MISSING_INNER_HITS);
442  double dxy = electron_->gsfTrack()->dxy(primaryVertex_->position());
443  double tkIso = electron_->dr03TkSumPt();
444  double e2x5Fraction = electron_->e2x5Max()/electron_->e5x5();
445  double e1x5Fraction = electron_->e1x5()/electron_->e5x5();
446  double scSigmaIetaIeta = electron_->scSigmaIEtaIEta();
447  if (electron_->ecalDriven() && electron_->pt()>35.) {
448  if (fabs(sceta)<1.442) { // barrel
449  if ( fabs(dEtaIn)<0.005
450  && fabs(dPhiIn)<0.06
451  && HoverE<0.05
452  && tkIso<5.
453  && missingHits<=1
454  && fabs(dxy)<0.02
455  && (e2x5Fraction>0.94 || e1x5Fraction>0.83)
456  ) HEPP_ele =true;
457  }else if (fabs(sceta)>1.56 && fabs(sceta)<2.5) { // endcap
458  if ( fabs(dEtaIn)<0.007
459  && fabs(dPhiIn)<0.06
460  && HoverE<0.05
461  && tkIso<5.
462  && missingHits<=1
463  && fabs(dxy)<0.02
464  && scSigmaIetaIeta<0.03
465  ) HEPP_ele =true;
466  }
467  }
468  //
469  if (HEPP_ele == false) continue;
470  if(electron_->pt()>ElectronPt[0] ){
471  ElectronPt[1] = ElectronPt[0];
472  ElectronPx[1] = ElectronPx[0];
473  ElectronPy[1] = ElectronPy[0];
474  ElectronEta[1] = ElectronEta[0];
475  ElectronPhi[1] = ElectronPhi[0];
476  ElectronCharge[1] = ElectronCharge[0];
477  //
478  ElectronPt[0] = electron_->pt();
479  ElectronPx[0] = electron_->px();
480  ElectronPy[0] = electron_->py();
481  ElectronEta[0] = electron_->eta();
482  ElectronPhi[0] = electron_->phi();
483  ElectronCharge[0] = electron_->charge();
484  }
485  if (electron_->pt() > dielectron_Electron1_pt_cut_) dielectron_countElectron_++;
486  if (electron_->pt() > dielectron_Electron1_pt_cut_) monoelectron_countElectron_++;
487  }
488 
489 
490  diphoton_countPhoton_ = 0.;
491  reco::PhotonCollection::const_iterator photon_ = PhotonCollection_->begin();
492  for(; photon_ != PhotonCollection_->end(); ++photon_){
493  if(photon_->pt()>PhotonPt[0] ){
494  PhotonEnergy[1] = PhotonEnergy[0];
495  PhotonPt[1] = PhotonPt[0];
496  PhotonEt[1] = PhotonEt[0];
497  PhotonEta[1] = PhotonEta[0];
498  PhotonEtaSc[1] = PhotonEtaSc[0];
499  PhotonPhi[1] = PhotonPhi[0];
500  PhotonHoverE[1] = PhotonHoverE[0];
501  PhotonSigmaIetaIeta[1] = PhotonSigmaIetaIeta[0];
502  PhotonTrkSumPtSolidConeDR03[1] = PhotonTrkSumPtSolidConeDR03[0];
503  PhotonE1x5E5x5[1] = PhotonE1x5E5x5[0];
504  PhotonE2x5E5x5[1] = PhotonE2x5E5x5[0];
505 
506  PhotonEnergy[0] = photon_->energy();
507  PhotonPt[0] = photon_->pt();
508  PhotonEt[0] = photon_->et();
509  PhotonEta[0] = photon_->eta();
510  PhotonEtaSc[0] = photon_->caloPosition().eta();
511  PhotonPhi[0] = photon_->phi();
512  PhotonHoverE[0] = photon_->hadronicOverEm();
513  PhotonSigmaIetaIeta[0] = photon_->sigmaIetaIeta();
514  PhotonTrkSumPtSolidConeDR03[0] = photon_->trkSumPtSolidConeDR03();
515  PhotonE1x5E5x5[0] = photon_->e1x5()/photon_->e5x5();
516  PhotonE2x5E5x5[0] = photon_->e2x5()/photon_->e5x5();
517 
518  if (photon_->pt() > dielectron_Electron1_pt_cut_) diphoton_countPhoton_ ++;
519  }
520  }
521 
522  //
523  // Analyze
524  //
525 
526  //Resonances
527  analyzeDiJets(iEvent);
528  analyzeDiMuons(iEvent);
529  analyzeDiElectrons(iEvent);
530  analyzeDiPhotons(iEvent);
531 
532  //MonoSearches
533  analyzeMonoJets(iEvent);
534  analyzeMonoMuons(iEvent);
535  analyzeMonoElectrons(iEvent);
536 
537  //LongLived
538  if (ValidGenParticles) {
539  analyzeDisplacedLeptons(iEvent, iSetup);
540  analyzeDisplacedJets(iEvent, iSetup);
541  }
542 }
543 
545 
546  //=== This is designed to run on MC events in which a pair of long-lived stop quarks each decay to a displaced lepton + displaced b jet.
547 
548  // Initialisation
549 
550  const unsigned int stop1 = 1000006; // PDG identifier of top squark1
551  const unsigned int stop2 = 2000006; // PDG identifier of top squark2
552  const float deltaRcut = 0.01; // Cone size for matching reco to true leptons.
553  const float invPtcut = 0.1; // Cut in 1/Pt consistency for matching reco tracks to genParticles.
554 
555  //--- Measure the efficiency to reconstruct leptons from long-lived stop quark decay.
556 
557  for (const reco::GenParticle& gen : *GenCollection_){
558  unsigned int idPdg = abs(gen.pdgId());
559  // Find electrons/muons from long-lived stop decay.
560  if (idPdg == stop1 || idPdg == stop2) {
561  unsigned int nDau = gen.numberOfDaughters();
562  for (unsigned int i = 0; i < nDau; i++) {
563  const reco::GenParticle* dau = (const reco::GenParticle*) gen.daughter(i);
564  // Only measure efficiency using leptons passing pt & eta cuts. (The pt cut is almost irrelevant, since leptons from stop decay are hard).
565  if (fabs(dau->eta()) < dispFermion_eta_cut_ && dau->pt() > dispFermion_pt_cut_) {
566  unsigned int pdgIdDau = abs(dau->pdgId());
567 
568  if (pdgIdDau == 11 || pdgIdDau == 13) { // electron or muon from stop decay
569 
570  // Get transverse decay length of stop quark.
571  float lxy = dau->vertex().rho();
572 
573  // Get momentum vector of daughter genParticle trajectory extrapolated to beam-line.
574  GlobalVector genP = this->getGenParticleTrajectoryAtBeamline(iSetup, dau);
575 
576  if (pdgIdDau == 11) { // electron from stop decay
577 
578  // Find matching reco track if any.
579  bool recoedTrk = false;
580  for(const reco::Track& trk : *TrackCollection_){
581  if (reco::deltaR(genP, trk) < deltaRcut && fabs(1/dau->pt() - 1/trk.pt()) < invPtcut) {
582  //cout<<"MATCH ELEC TRK "<<dau->pt()<<" "<<trk.pt()<<" "<<reco::deltaR(genP, trk)<<endl;
583  recoedTrk = true;
584  }
585  }
586  dispElec_track_effi_lxy->Fill(lxy, recoedTrk);
587 
588  // Find matching reco electron if any.
589  bool recoedE = false;
590  for(const reco::GsfElectron& eReco : *ElectronCollection_){
591  if (reco::deltaR(genP, eReco) < deltaRcut && fabs(1/dau->pt() - 1/eReco.pt()) < invPtcut) recoedE = true;
592  }
593  dispElec_elec_effi_lxy->Fill(lxy, recoedE);
594 
595  } else if (pdgIdDau == 13) { // muon from stop decay
596 
597  // Find matching reco track if any.
598  bool recoedTrk = false;
599  for(const reco::Track& trk : *TrackCollection_){
600  if (reco::deltaR(genP, trk) < deltaRcut && fabs(1/dau->pt() - 1/trk.pt()) < invPtcut) {
601  //cout<<"MATCH MUON TRK "<<dau->pt()<<" "<<trk.pt()<<" "<<reco::deltaR(genP, trk)<<endl;
602  recoedTrk = true;
603  }
604  }
605  dispMuon_track_effi_lxy->Fill(lxy, recoedTrk);
606 
607  // Find matching reco muon, if any, in normal global muon collection.
608  bool recoedMu = false;
609  for(const reco::Muon& muReco : *MuonCollection_){
610  if (reco::deltaR(genP, muReco) < deltaRcut && fabs(1/dau->pt() - 1/muReco.pt()) < invPtcut) recoedMu = true;
611  }
612  dispMuon_muon_effi_lxy->Fill(lxy, recoedMu);
613 
614  // Find matching reco muon, if any, in displaced global muon collection.
615  bool recoedMuDisp = false;
616  for(const reco::Track& muDispReco : *MuonDispCollection_){
617  if (reco::deltaR(genP, muDispReco) < deltaRcut && fabs(1/dau->pt() - 1/muDispReco.pt()) < invPtcut) recoedMuDisp = true;
618  }
619  dispMuon_muonDisp_effi_lxy->Fill(lxy, recoedMuDisp);
620 
621  // Find matching reco muon, if any, in displaced SA muon collection.
622  bool recoedMuDispSA = false;
623  for(const reco::Track& muDispSAReco : *MuonDispSACollection_){
624  if (reco::deltaR(genP, muDispSAReco) < deltaRcut && fabs(1/dau->pt() - 1/muDispSAReco.pt()) < invPtcut) recoedMuDispSA = true;
625  }
626  dispMuon_muonDispSA_effi_lxy->Fill(lxy, recoedMuDispSA);
627  }
628  }
629  }
630  }
631  }
632  }
633 }
635 
636  //=== This is designed to run on MC events in which a pair of long-lived stop quarks each decay to a displaced lepton + displaced b jet.
637 
638  // Initialisation
639 
640  // Define function to identify R-hadrons containing stop quarks from PDG particle code.
641  // N.B. Jets originate not just from stop quark, but also from its partner SM quark inside the R hadron.
642  auto isRhadron = [](unsigned int pdgId){return (pdgId/100) == 10006 || (pdgId/1000) == 1006;};
643 
644  const float deltaRcut = 0.01; // Cone size for matching reco tracks to genParticles.
645  const float invPtcut = 0.1; // Cut in 1/Pt consistency for matching reco tracks to genParticles.
646 
647  //--- Measure the efficiency to reconstruct tracks in jet(s) from long-lived stop quark decay.
648 
649  for (const reco::GenParticle& gen : *GenCollection_){
650  unsigned int idPdg = abs(gen.pdgId());
651  // Only measure efficiency using charged e, mu pi, K, p
652  if (idPdg == 11 || idPdg == 13 || idPdg == 211 || idPdg == 321 || idPdg == 2212) {
653  // Only measure efficiency using leptons passing pt & eta cuts. (The pt cut is almost irrelevant, since leptons from stop decay are hard).
654  if (fabs(gen.eta()) < dispFermion_eta_cut_ && gen.pt() > dispFermion_pt_cut_) {
655 
656  // Check if this particle came (maybe indirectly) from an R hadron decay.
657  const reco::GenParticle* genMoth = &gen;
658  const reco::GenParticle* genRhadron = nullptr;
659  bool foundParton = false;
660  while (genMoth->numberOfMothers() > 0) {
661  genMoth = (const reco::GenParticle*) genMoth->mother(0);
662  unsigned int idPdgMoth = abs(genMoth->pdgId());
663  // Check that the R-hadron decayed via a quark/gluon before yielding genParticle "gen".
664  // This ensures that gen is from the jet, and not a lepton produced directly from the stop quark decay.
665  if ( (idPdgMoth >= 1 && idPdgMoth <= 6) || idPdgMoth == 21) foundParton = true;
666  // Note if ancestor was R hadron
667  if (isRhadron( idPdgMoth )) {
668  genRhadron = genMoth;
669  break;
670  }
671  }
672 
673  if (foundParton && genRhadron != nullptr) { // This GenParticle came (maybe indirectly) from an R hadron decay.
674 
675  // Get transverse decay length of R hadron.
676  float lxy = genRhadron->daughter(0)->vertex().rho();
677 
678  // Get momentum vector of genParticle trajectory extrapolated to beam-line.
679  GlobalVector genP = this->getGenParticleTrajectoryAtBeamline(iSetup, &gen);
680 
681  // Find matching reco track if any.
682  bool recoedTrk = false;
683  for(const reco::Track& trk : *TrackCollection_){
684  if (reco::deltaR(genP, trk) < deltaRcut && fabs(1/gen.pt() - 1/trk.pt()) < invPtcut) {
685  //cout<<"MATCH TRK "<<gen.pt()<<" "<<trk.pt()<<" "<<reco::deltaR(gen, trk)<<endl;
686  recoedTrk = true;
687  }
688  }
689  dispJet_track_effi_lxy->Fill(lxy, recoedTrk);
690  }
691  }
692  }
693  }
694 }
696  //=== Estimate the momentum vector that a GenParticle would have at its trajectory's point of closest
697  //=== approach to the beam-line.
698 
699  // Get the magnetic field
700  edm::ESHandle<MagneticField> theMagField;
701  iSetup.get<IdealMagneticFieldRecord>().get(theMagField);
702 
703  // Make FreeTrajectoryState of this gen particle
704  FreeTrajectoryState fts(GlobalPoint(gen->vx(),gen->vy(),gen->vz()),
705  GlobalVector(gen->px(),gen->py(),gen->pz()),
706  gen->charge(),
707  theMagField.product());
708 
709  // Get trajectory closest to beam line
710  TSCBLBuilderNoMaterial tscblBuilder;
711  const BeamSpot beamspot; // Simple beam-spot at (0,0,0). Good enough.
712  TrajectoryStateClosestToBeamLine tsAtClosestApproach = tscblBuilder(fts, beamspot);
713 
714  GlobalVector p = tsAtClosestApproach.trackStateAtPCA().momentum();
715 
716  return p;
717 }
718 
720  for (unsigned int icoll = 0; icoll < DiJetPFJetCollection_.size(); ++icoll) {
721  dijet_countPFJet_=0;
722  bool ValidDiJetPFJets = iEvent.getByToken(DiJetPFJetToken_[icoll], DiJetpfJetCollection_);
723  if (!ValidDiJetPFJets) continue;
724  DiJetpfjets = *DiJetpfJetCollection_;
725  for(int i=0; i<2; i++){
726  PFJetPx[i] = 0.; PFJetPy[i] = 0.; PFJetPt[i] = 0.; PFJetEta[i] = 0.; PFJetPhi[i] = 0.;
727  PFJetNHEF[i] = 0.; PFJetCHEF[i] = 0.; PFJetNEMF[i] = 0.; PFJetCEMF[i] = 0.;
728  }
729  PFJetCollection::const_iterator DiJetpfjet_ = DiJetpfjets.begin();
730  for(; DiJetpfjet_ != DiJetpfjets.end(); ++DiJetpfjet_){
731  double scale = 1.;
732  if(scale*DiJetpfjet_->pt()>PFJetPt[0]){
733  PFJetPt[1] = PFJetPt[0];
734  PFJetPx[1] = PFJetPx[0];
735  PFJetPy[1] = PFJetPy[0];
736  PFJetEta[1] = PFJetEta[0];
737  PFJetPhi[1] = PFJetPhi[0];
738  PFJetRapidity[1] = DiJetpfjet_->rapidity();
739  PFJetMass[1] = DiJetpfjet_->mass();
740  PFJetNHEF[1] = PFJetNHEF[0];
741  PFJetCHEF[1] = PFJetCHEF[0];
742  PFJetNEMF[1] = PFJetNEMF[0];
743  PFJetCEMF[1] = PFJetCEMF[0];
744  PFJetPt[0] = scale*DiJetpfjet_->pt();
745  PFJetPx[0] = scale*DiJetpfjet_->px();
746  PFJetPy[0] = scale*DiJetpfjet_->py();
747  PFJetEta[0] = DiJetpfjet_->eta();
748  PFJetPhi[0] = DiJetpfjet_->phi();
749  PFJetRapidity[0] = DiJetpfjet_->rapidity();
750  PFJetMass[0] = DiJetpfjet_->mass();
751  PFJetNHEF[0] = DiJetpfjet_->neutralHadronEnergyFraction();
752  PFJetCHEF[0] = DiJetpfjet_->chargedHadronEnergyFraction();
753  PFJetNEMF[0] = DiJetpfjet_->neutralEmEnergyFraction();
754  PFJetCEMF[0] = DiJetpfjet_->chargedEmEnergyFraction();
755  }else if(scale*DiJetpfjet_->pt()<PFJetPt[0] && scale*DiJetpfjet_->pt()>PFJetPt[1] ){
756  PFJetPt[1] = scale*DiJetpfjet_->pt();
757  PFJetPx[1] = scale*DiJetpfjet_->px();
758  PFJetPy[1] = scale*DiJetpfjet_->py();
759  PFJetEta[1] = DiJetpfjet_->eta();
760  PFJetPhi[1] = DiJetpfjet_->phi();
761  PFJetRapidity[1] = DiJetpfjet_->rapidity();
762  PFJetMass[1] = DiJetpfjet_->mass();
763  PFJetNHEF[1] = DiJetpfjet_->neutralHadronEnergyFraction();
764  PFJetCHEF[1] = DiJetpfjet_->chargedHadronEnergyFraction();
765  PFJetNEMF[1] = DiJetpfjet_->neutralEmEnergyFraction();
766  PFJetCEMF[1] = DiJetpfjet_->chargedEmEnergyFraction();
767  }else{}
768  if(scale*DiJetpfjet_->pt()>dijet_PFJet1_pt_cut_) dijet_countPFJet_++;
769  }
770  if(PFJetPt[0]> dijet_PFJet1_pt_cut_ && PFJetPt[1]> dijet_PFJet2_pt_cut_){
771  dijet_PFJet_pt[icoll]->Fill(PFJetPt[0]);
772  dijet_PFJet_eta[icoll]->Fill(PFJetEta[0]);
773  dijet_PFJet_phi[icoll]->Fill(PFJetPhi[0]);
774  dijet_PFJet_rapidity[icoll]->Fill(PFJetRapidity[0]);
775  dijet_PFJet_mass[icoll]->Fill(PFJetMass[0]);
776  dijet_PFJet_pt[icoll]->Fill(PFJetPt[1]);
777  dijet_PFJet_eta[icoll]->Fill(PFJetEta[1]);
778  dijet_PFJet_phi[icoll]->Fill(PFJetPhi[1]);
779  dijet_PFJet_rapidity[icoll]->Fill(PFJetRapidity[1]);
780  dijet_PFJet_mass[icoll]->Fill(PFJetMass[1]);
781  dijet_deltaPhiPFJet1PFJet2[icoll]->Fill(deltaPhi(PFJetPhi[0],PFJetPhi[1]));
782  dijet_deltaEtaPFJet1PFJet2[icoll]->Fill(PFJetEta[0]-PFJetEta[1]);
783  dijet_deltaRPFJet1PFJet2[icoll]->Fill(deltaR(PFJetEta[0],PFJetPhi[0],PFJetEta[1],PFJetPhi[1]));
784  dijet_invMassPFJet1PFJet2[icoll]->Fill(sqrt(2*PFJetPt[0]*PFJetPt[1]*(cosh(PFJetEta[0]-PFJetEta[1])-cos(PFJetPhi[0]-PFJetPhi[1]))));
785  dijet_PFchef[icoll]->Fill(PFJetCHEF[0]);
786  dijet_PFnhef[icoll]->Fill(PFJetNHEF[0]);
787  dijet_PFcemf[icoll]->Fill(PFJetCEMF[0]);
788  dijet_PFnemf[icoll]->Fill(PFJetNEMF[0]);
789  dijet_PFJetMulti[icoll]->Fill(dijet_countPFJet_);
790  }
791  }
792 }
793 
795  if(MuonPt[0] > dimuon_Muon1_pt_cut_ && MuonPt[1]> dimuon_Muon2_pt_cut_ && MuonCharge[0]*MuonCharge[1] == -1){
796  dimuon_Muon_pt->Fill(MuonPt[0]);
797  dimuon_Muon_eta->Fill(MuonEta[0]);
798  dimuon_Muon_phi->Fill(MuonPhi[0]);
799  dimuon_Muon_pt->Fill(MuonPt[1]);
800  dimuon_Muon_eta->Fill(MuonEta[1]);
801  dimuon_Muon_phi->Fill(MuonPhi[1]);
802  dimuon_Charge->Fill(MuonCharge[0]);
803  dimuon_Charge->Fill(MuonCharge[1]);
804  dimuon_deltaPhiMuon1Muon2->Fill(deltaPhi(MuonPhi[0],MuonPhi[1]));
805  dimuon_deltaEtaMuon1Muon2->Fill(MuonEta[0]-MuonEta[1]);
806  dimuon_deltaRMuon1Muon2->Fill(deltaR(MuonEta[0],MuonPhi[0],MuonEta[1],MuonPhi[1]));
807  dimuon_invMassMuon1Muon2->Fill(sqrt(2*MuonPt[0]*MuonPt[1]*(cosh(MuonEta[0]-MuonEta[1])-cos(MuonPhi[0]-MuonPhi[1]))));
808  dimuon_MuonMulti->Fill(dimuon_countMuon_);
809  }
810 }
811 
813  if(ElectronPt[0] > dielectron_Electron1_pt_cut_ && ElectronPt[1]> dielectron_Electron2_pt_cut_ && ElectronCharge[0]*ElectronCharge[1] == -1.){
814  dielectron_Electron_pt->Fill(ElectronPt[0]);
815  dielectron_Electron_eta->Fill(ElectronEta[0]);
816  dielectron_Electron_phi->Fill(ElectronPhi[0]);
817  dielectron_Electron_pt->Fill(ElectronPt[1]);
818  dielectron_Electron_eta->Fill(ElectronEta[1]);
819  dielectron_Electron_phi->Fill(ElectronPhi[1]);
820  dielectron_Charge->Fill(ElectronCharge[0]);
821  dielectron_Charge->Fill(ElectronCharge[1]);
822  dielectron_deltaPhiElectron1Electron2->Fill(deltaPhi(ElectronPhi[0],ElectronPhi[1]));
823  dielectron_deltaEtaElectron1Electron2->Fill(ElectronEta[0]-ElectronEta[1]);
824  dielectron_deltaRElectron1Electron2->Fill(deltaR(ElectronEta[0],ElectronPhi[0],ElectronEta[1],ElectronPhi[1]));
825  dielectron_invMassElectron1Electron2->Fill(sqrt(2*ElectronPt[0]*ElectronPt[1]*(cosh(ElectronEta[0]-ElectronEta[1])-cos(ElectronPhi[0]-ElectronPhi[1]))));
826  dielectron_ElectronMulti->Fill(dielectron_countElectron_);
827  }
828 }
829 
831  if(PhotonPt[0] > diphoton_Photon1_pt_cut_ && PhotonPt[1]> diphoton_Photon2_pt_cut_ ){
832  diphoton_Photon_energy->Fill(PhotonEnergy[0]);
833  diphoton_Photon_pt->Fill(PhotonPt[0]);
834  diphoton_Photon_et->Fill(PhotonEt[0]);
835  diphoton_Photon_eta->Fill(PhotonEta[0]);
836  diphoton_Photon_etasc->Fill(PhotonEtaSc[0]);
837  diphoton_Photon_phi->Fill(PhotonPhi[0]);
838  if (fabs(PhotonEtaSc[0]) < 1.442){
839  diphoton_Photon_hovere_eb->Fill(PhotonHoverE[0]);
840  diphoton_Photon_sigmaietaieta_eb->Fill(PhotonSigmaIetaIeta[0]);
841  diphoton_Photon_trksumptsolidconedr03_eb->Fill(PhotonTrkSumPtSolidConeDR03[0]);
842  diphoton_Photon_e1x5e5x5_eb->Fill(PhotonE1x5E5x5[0]);
843  diphoton_Photon_e2x5e5x5_eb->Fill(PhotonE2x5E5x5[0]);
844  }
845  if (fabs(PhotonEtaSc[0]) > 1.566 && fabs(PhotonEtaSc[0]) < 2.5){
846  diphoton_Photon_hovere_ee->Fill(PhotonHoverE[0]);
847  diphoton_Photon_sigmaietaieta_ee->Fill(PhotonSigmaIetaIeta[0]);
848  diphoton_Photon_trksumptsolidconedr03_ee->Fill(PhotonTrkSumPtSolidConeDR03[0]);
849  diphoton_Photon_e1x5e5x5_ee->Fill(PhotonE1x5E5x5[0]);
850  diphoton_Photon_e2x5e5x5_ee->Fill(PhotonE2x5E5x5[0]);
851  }
852  diphoton_Photon_energy->Fill(PhotonEnergy[1]);
853  diphoton_Photon_pt->Fill(PhotonPt[1]);
854  diphoton_Photon_et->Fill(PhotonEt[1]);
855  diphoton_Photon_eta->Fill(PhotonEta[1]);
856  diphoton_Photon_etasc->Fill(PhotonEtaSc[1]);
857  diphoton_Photon_phi->Fill(PhotonPhi[1]);
858  if (fabs(PhotonEtaSc[1]) < 1.4442){
859  diphoton_Photon_hovere_eb->Fill(PhotonHoverE[1]);
860  diphoton_Photon_sigmaietaieta_eb->Fill(PhotonSigmaIetaIeta[1]);
861  diphoton_Photon_trksumptsolidconedr03_eb->Fill(PhotonTrkSumPtSolidConeDR03[1]);
862  diphoton_Photon_e1x5e5x5_eb->Fill(PhotonE1x5E5x5[1]);
863  diphoton_Photon_e2x5e5x5_eb->Fill(PhotonE2x5E5x5[1]);
864  }
865  if (fabs(PhotonEtaSc[1]) > 1.566 && fabs(PhotonEtaSc[1]) < 2.5){
866  diphoton_Photon_hovere_ee->Fill(PhotonHoverE[1]);
867  diphoton_Photon_sigmaietaieta_ee->Fill(PhotonSigmaIetaIeta[1]);
868  diphoton_Photon_trksumptsolidconedr03_ee->Fill(PhotonTrkSumPtSolidConeDR03[1]);
869  diphoton_Photon_e1x5e5x5_ee->Fill(PhotonE1x5E5x5[1]);
870  diphoton_Photon_e2x5e5x5_ee->Fill(PhotonE2x5E5x5[1]);
871  }
872  diphoton_deltaPhiPhoton1Photon2->Fill(deltaPhi(PhotonPhi[0],PhotonPhi[1]));
873  diphoton_deltaEtaPhoton1Photon2->Fill(PhotonEta[0]-PhotonEta[1]);
874  diphoton_deltaRPhoton1Photon2->Fill(deltaR(PhotonEta[0],PhotonPhi[0],PhotonEta[1],PhotonPhi[1]));
875  diphoton_invMassPhoton1Photon2->Fill(sqrt(2*PhotonPt[0]*PhotonPt[1]*(cosh(PhotonEta[0]-PhotonEta[1])-cos(PhotonPhi[0]-PhotonPhi[1]))));
876  diphoton_PhotonMulti->Fill(diphoton_countPhoton_);
877  }
878 }
879 
881  const PFMETCollection *pfmetcol = pfMETCollection_.product();
882  const PFMET pfmet = pfmetcol->front();
883  if(PFJetPt[0]> monojet_PFJet_pt_cut_ && pfmet.et() > monojet_PFJet_met_cut_){
884  monojet_PFJet_pt->Fill(PFJetPt[0]);
885  monojet_PFJet_eta->Fill(PFJetEta[0]);
886  monojet_PFJet_phi->Fill(PFJetPhi[0]);
887  monojet_PFMet->Fill(pfmet.et());
888  monojet_PFMet_phi->Fill(pfmet.phi());
889  monojet_PFJetPtOverPFMet->Fill(PFJetPt[0]/pfmet.et());
890  monojet_deltaPhiPFJetPFMet->Fill(deltaPhi(PFJetPhi[0],pfmet.phi()));
891  monojet_PFchef->Fill(PFJetCHEF[0]);
892  monojet_PFnhef->Fill(PFJetNHEF[0]);
893  monojet_PFcemf->Fill(PFJetCEMF[0]);
894  monojet_PFnemf->Fill(PFJetNEMF[0]);
895  monojet_PFJetMulti->Fill(monojet_countPFJet_);
896  }
897 }
898 
900  const PFMETCollection *pfmetcol = pfMETCollection_.product();
901  const PFMET pfmet = pfmetcol->front();
902  if(MuonPt[0]> monomuon_Muon_pt_cut_ && pfmet.et() > monomuon_Muon_met_cut_){
903  monomuon_Muon_pt->Fill(MuonPt[0]);
904  monomuon_Muon_eta->Fill(MuonEta[0]);
905  monomuon_Muon_phi->Fill(MuonPhi[0]);
906  monomuon_Charge->Fill(MuonCharge[0]);
907  monomuon_PFMet->Fill(pfmet.et());
908  monomuon_PFMet_phi->Fill(pfmet.phi());
909  monomuon_MuonPtOverPFMet->Fill(MuonPt[0]/pfmet.et());
910  monomuon_deltaPhiMuonPFMet->Fill(deltaPhi(MuonPhi[0],pfmet.phi()));
911  monomuon_TransverseMass->Fill(sqrt(2*MuonPt[0]*pfmet.et()*(1-cos(deltaPhi(MuonPhi[0],pfmet.phi())))));
912  monomuon_MuonMulti->Fill(monomuon_countMuon_);
913  }
914 }
915 
917  const PFMETCollection *pfmetcol = pfMETCollection_.product();
918  const PFMET pfmet = pfmetcol->front();
919  if(ElectronPt[0]> monoelectron_Electron_pt_cut_ && pfmet.et() > monoelectron_Electron_met_cut_){
920  monoelectron_Electron_pt->Fill(ElectronPt[0]);
921  monoelectron_Electron_eta->Fill(ElectronEta[0]);
922  monoelectron_Electron_phi->Fill(ElectronPhi[0]);
923  monoelectron_Charge->Fill(ElectronCharge[0]);
924  monoelectron_PFMet->Fill(pfmet.et());
925  monoelectron_PFMet_phi->Fill(pfmet.phi());
926  monoelectron_ElectronPtOverPFMet->Fill(ElectronPt[0]/pfmet.et());
927  monoelectron_deltaPhiElectronPFMet->Fill(deltaPhi(ElectronPhi[0],pfmet.phi()));
928  monoelectron_TransverseMass->Fill(sqrt(2*ElectronPt[0]*pfmet.et()*(1-cos(deltaPhi(ElectronPhi[0],pfmet.phi())))));
929  monoelectron_ElectronMulti->Fill(monoelectron_countElectron_);
930  }
931 }
932 
934  const PFMETCollection *pfmetcol = pfMETCollection_.product();
935  const PFMET pfmet = pfmetcol->front();
936  if(PhotonPt[0]> monophoton_Photon_pt_cut_ && pfmet.et() > monophoton_Photon_met_cut_){
937  monophoton_Photon_energy->Fill(PhotonEnergy[0]);
938  monophoton_Photon_pt->Fill(PhotonPt[0]);
939  monophoton_Photon_et->Fill(PhotonEt[0]);
940  monophoton_Photon_eta->Fill(PhotonEta[0]);
941  monophoton_Photon_etasc->Fill(PhotonEtaSc[0]);
942  monophoton_Photon_phi->Fill(PhotonPhi[0]);
943  monophoton_Photon_hovere->Fill(PhotonHoverE[0]);
944  monophoton_Photon_sigmaietaieta->Fill(PhotonSigmaIetaIeta[0]);
945  monophoton_Photon_trksumptsolidconedr03->Fill(PhotonTrkSumPtSolidConeDR03[0]);
946  monophoton_Photon_e1x5e5x5->Fill(PhotonE1x5E5x5[0]);
947  monophoton_Photon_e2x5e5x5->Fill(PhotonE2x5E5x5[0]);
948  monophoton_PFMet->Fill(pfmet.et());
949  monophoton_PFMet_phi->Fill(pfmet.phi());
950  monophoton_PhotonPtOverPFMet->Fill(PhotonPt[0]/pfmet.et());
951  monophoton_deltaPhiPhotonPFMet->Fill(deltaPhi(PhotonPhi[0],pfmet.phi()));
952  monophoton_PhotonMulti->Fill(monophoton_countPhoton_);
953  }
954 }
virtual void analyzeMonoElectrons(edm::Event const &e)
Definition: ExoticaDQM.cc:916
virtual void analyzeDiJets(edm::Event const &e)
Definition: ExoticaDQM.cc:719
T getParameter(std::string const &) const
int pdgId() const final
PDG identifier.
const Candidate * daughter(size_type) const override
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) ...
T getUntrackedParameter(std::string const &, T const &) const
double eta() const final
momentum pseudorapidity
virtual void analyzeMonoMuons(edm::Event const &e)
Definition: ExoticaDQM.cc:899
ExoticaDQM(const edm::ParameterSet &ps)
Definition: ExoticaDQM.cc:13
void analyze(edm::Event const &e, edm::EventSetup const &eSetup) override
Definition: ExoticaDQM.cc:258
virtual void analyzeMonoJets(edm::Event const &e)
Definition: ExoticaDQM.cc:880
MonitorElement * bookProfile(Args &&...args)
Definition: DQMStore.h:113
double vy() const override
y coordinate of vertex position
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
double px() const final
x coordinate of momentum vector
size_t numberOfMothers() const override
number of mothers
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
virtual void analyzeDiMuons(edm::Event const &e)
Definition: ExoticaDQM.cc:794
double pt() const final
transverse momentum
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
void bookHistograms(DQMStore::IBooker &bei, edm::Run const &, edm::EventSetup const &) override
Definition: ExoticaDQM.cc:112
int charge() const final
electric charge
Definition: LeafCandidate.h:91
virtual void analyzeDisplacedJets(edm::Event const &e, const edm::EventSetup &s)
Definition: ExoticaDQM.cc:634
~ExoticaDQM() override
Definition: ExoticaDQM.cc:105
virtual GlobalVector getGenParticleTrajectoryAtBeamline(const edm::EventSetup &iSetup, const reco::GenParticle *gen)
Definition: ExoticaDQM.cc:695
int iEvent
Definition: GenABIO.cc:224
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
double et() const final
transverse energy
double pz() const final
z coordinate of momentum vector
T sqrt(T t)
Definition: SSEVec.h:18
virtual void analyzeDiPhotons(edm::Event const &e)
Definition: ExoticaDQM.cc:830
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
const Point & vertex() const override
vertex position (overwritten by PF...)
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:106
virtual void analyzeDisplacedLeptons(edm::Event const &e, const edm::EventSetup &s)
Definition: ExoticaDQM.cc:544
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
def gen(fragment, howMuch)
Production test section ####.
GlobalVector momentum() const
double vz() const override
z coordinate of vertex position
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:28
virtual void analyzeMonoPhotons(edm::Event const &e)
Definition: ExoticaDQM.cc:933
std::string const & triggerName(unsigned int index) const
Definition: TriggerNames.cc:22
double py() const final
y coordinate of momentum vector
fixed size matrix
HLT enums.
T get() const
Definition: EventSetup.h:71
virtual const Point & vertex() const =0
vertex position
virtual void analyzeDiElectrons(edm::Event const &e)
Definition: ExoticaDQM.cc:812
double phi() const final
momentum azimuthal angle
T const * product() const
Definition: ESHandle.h:86
std::vector< std::string > vstring
Definition: Schedule.cc:565
edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const override
Definition: Event.cc:256
const Candidate * mother(size_type=0) const override
return mother at a given position, i = 0, ... numberOfMothers() - 1 (read only mode) ...
double vx() const override
x coordinate of vertex position
Definition: Run.h:45
Global3DVector GlobalVector
Definition: GlobalVector.h:10
Collection of PF MET.
int icoll
Definition: AMPTWrapper.h:136