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