CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_2_9_HLT1_bphpatch4/src/DQM/Physics/src/SusyDQM.h

Go to the documentation of this file.
00001 #ifndef SusyDQM_H
00002 #define SusyDQM_H
00003 
00004 #include <string>
00005 #include <vector>
00006 
00007 #include "FWCore/Framework/interface/EDAnalyzer.h"
00008 #include "FWCore/Framework/interface/Event.h"
00009 #include "FWCore/Framework/interface/Frameworkfwd.h"
00010 #include "FWCore/Utilities/interface/InputTag.h"
00011 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00012 #include "FWCore/Framework/interface/MakerMacros.h"
00013 #include "FWCore/ServiceRegistry/interface/Service.h"
00014 #include "FWCore/Utilities/interface/EDMException.h"
00015 
00016 #include "DQMServices/Core/interface/DQMStore.h"
00017 #include "DQMServices/Core/interface/MonitorElement.h"
00018 
00019 #include "DataFormats/Common/interface/Handle.h"
00020 #include "DataFormats/TrackReco/interface/Track.h"
00021 #include "DataFormats/VertexReco/interface/Vertex.h"
00022 #include "DataFormats/VertexReco/interface/VertexFwd.h"
00023 #include "DataFormats/MuonReco/interface/Muon.h"
00024 #include "DataFormats/MuonReco/interface/MuonFwd.h"
00025 #include "DataFormats/MuonReco/interface/MuonEnergy.h"
00026 #include "DataFormats/MuonReco/interface/MuonIsolation.h"
00027 #include "DataFormats/GsfTrackReco/interface/GsfTrack.h"
00028 #include "DataFormats/EgammaCandidates/interface/Electron.h"
00029 #include "DataFormats/EgammaCandidates/interface/ElectronFwd.h"
00030 #include "DataFormats/EgammaCandidates/interface/GsfElectron.h"
00031 #include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h"
00032 #include "DataFormats/JetReco/interface/GenJetCollection.h"
00033 #include "DataFormats/JetReco/interface/CaloJetCollection.h"
00034 #include "DataFormats/METReco/interface/CaloMETCollection.h"
00035 #include "DataFormats/METReco/interface/CaloMET.h"
00036 #include "DataFormats/Math/interface/deltaR.h"
00037 #include "DataFormats/Math/interface/deltaPhi.h"
00038 #include "DataFormats/Math/interface/LorentzVector.h"
00039 
00040 //#include "DataFormats/PatCandidates/interface/Electron.h"
00041 //#include "DataFormats/PatCandidates/interface/Muon.h"
00042 //#include "DataFormats/PatCandidates/interface/Jet.h"
00043 //#include "DataFormats/PatCandidates/interface/MET.h"
00044 
00045 class TH1F;
00046 class TH2F;
00047 
00048 class PtGreater {
00049    public:
00050       template<typename T> bool operator ()(const T& i, const T& j) {
00051          return (i.pt() > j.pt());
00052       }
00053 };
00054 
00055 template<typename Mu, typename Ele, typename Jet, typename Met>
00056 class SusyDQM: public edm::EDAnalyzer {
00057 
00058    public:
00059 
00060       explicit SusyDQM(const edm::ParameterSet&);
00061       ~SusyDQM();
00062 
00063    protected:
00064 
00065       void beginRun(const edm::Run&);
00066       void endRun(const edm::Run&);
00067 
00068    private:
00069 
00070       void initialize();
00071       virtual void beginJob();
00072       virtual void analyze(const edm::Event&, const edm::EventSetup&);
00073       virtual bool goodSusyElectron(const Ele*);
00074       virtual bool goodSusyMuon(const Mu*);
00075       virtual void endJob();
00076 
00077       edm::ParameterSet parameters_;
00078       DQMStore * dbe_;
00079 
00080       std::string moduleName_;
00081 
00082       edm::InputTag muons_;
00083       edm::InputTag electrons_;
00084       edm::InputTag jets_;
00085       edm::InputTag met_;
00086       edm::InputTag vertex_;
00087 
00088       double elec_eta_cut_;
00089       double elec_mva_cut_;
00090       double elec_d0_cut_;
00091 
00092       double muon_eta_cut_;
00093       double muon_nHits_cut_;
00094       double muon_nChi2_cut_;
00095       double muon_d0_cut_;
00096 
00097       double RA12_muon_pt_cut_;
00098       double RA12_muon_iso_cut_;
00099 
00100       double RA12_elec_pt_cut_;
00101       double RA12_elec_iso_cut_;
00102 
00103       double RA1_jet_pt_cut_;
00104       double RA1_jet_eta_cut_;
00105       double RA1_jet_min_emf_cut_;
00106       double RA1_jet_max_emf_cut_;
00107       double RA1_jet1_pt_cut_;
00108       double RA1_jet1_eta_cut_;
00109       double RA1_jet2_pt_cut_;
00110       double RA1_jet2_eta_cut_;
00111       double RA1_jet3_pt_cut_;
00112 
00113       double RA1_alphat_cut_;
00114       double RA1_ht_cut_;
00115       double RA1_mht_cut_;
00116       double RA1_deltaPhi_cut_;
00117       double RA1_deltaPhiJets_cut_;
00118 
00119       double RA2_jet_pt_cut_;
00120       double RA2_jet_eta_cut_;
00121       double RA2_jet_min_emf_cut_;
00122       double RA2_jet_max_emf_cut_;
00123       double RA2_jet1_pt_cut_;
00124       double RA2_jet2_pt_cut_;
00125       double RA2_jet3_pt_cut_;
00126       double RA2_jet1_eta_cut_;
00127       double RA2_jet2_eta_cut_;
00128       double RA2_jet3_eta_cut_;
00129       int RA2_N_jets_cut_;
00130 
00131       double RA2_ht_cut_;
00132       double RA2_mht_cut_;
00133       double RA2_deltaPhi_cut_;
00134 
00135       double RAL_muon_pt_cut_;
00136       double RAL_muon_iso_cut_;
00137 
00138       double RAL_elec_pt_cut_;
00139       double RAL_elec_iso_cut_;
00140 
00141       double RAL_jet_pt_cut_;
00142       double RAL_jet_eta_cut_;
00143       double RAL_jet_min_emf_cut_;
00144       double RAL_jet_max_emf_cut_;
00145       double RAL_jet_sum_pt_cut_;
00146 
00147       double RAL_met_cut_;
00148 
00149       math::XYZPoint bs;
00150 
00151       MonitorElement * hRA1_pt_jet1_nm1_;
00152       MonitorElement * hRA1_eta_jet1_nm1_;
00153       MonitorElement * hRA1_pt_jet2_nm1_;
00154       MonitorElement * hRA1_eta_jet2_nm1_;
00155       MonitorElement * hRA1_pt_jet3_nm1_;
00156       MonitorElement * hRA1_deltaPhi_mht_jets_nm1_;
00157       MonitorElement * hRA1_deltaPhi_jets_nm1_;
00158       MonitorElement * hRA1_ht_nm1_;
00159       MonitorElement * hRA1_mht_nm1_;
00160       MonitorElement * hRA1_alphat_nm1_;
00161       MonitorElement * hRA1_pt_muons_nm1_;
00162       MonitorElement * hRA1_pt_elecs_nm1_;
00163 
00164       MonitorElement * hRA2_N_jets_nm1_;
00165       MonitorElement * hRA2_pt_jet1_nm1_;
00166       MonitorElement * hRA2_eta_jet1_nm1_;
00167       MonitorElement * hRA2_pt_jet2_nm1_;
00168       MonitorElement * hRA2_eta_jet2_nm1_;
00169       MonitorElement * hRA2_pt_jet3_nm1_;
00170       MonitorElement * hRA2_eta_jet3_nm1_;
00171       MonitorElement * hRA2_deltaPhi_mht_jets_nm1_;
00172       MonitorElement * hRA2_ht_nm1_;
00173       MonitorElement * hRA2_mht_nm1_;
00174       MonitorElement * hRA2_pt_muons_nm1_;
00175       MonitorElement * hRA2_pt_elecs_nm1_;
00176 
00177       MonitorElement * hRA1_pt_jet1_;
00178       MonitorElement * hRA1_eta_jet1_;
00179       MonitorElement * hRA1_pt_jet2_;
00180       MonitorElement * hRA1_eta_jet2_;
00181       MonitorElement * hRA1_pt_jet3_;
00182       MonitorElement * hRA1_deltaPhi_mht_jets_;
00183       MonitorElement * hRA1_deltaPhi_jets_;
00184       MonitorElement * hRA1_ht_;
00185       MonitorElement * hRA1_mht_;
00186       MonitorElement * hRA1_alphat_;
00187       MonitorElement * hRA1_pt_muons_;
00188       MonitorElement * hRA1_pt_elecs_;
00189 
00190       MonitorElement * hRA2_N_jets_;
00191       MonitorElement * hRA2_pt_jet1_;
00192       MonitorElement * hRA2_eta_jet1_;
00193       MonitorElement * hRA2_pt_jet2_;
00194       MonitorElement * hRA2_eta_jet2_;
00195       MonitorElement * hRA2_pt_jet3_;
00196       MonitorElement * hRA2_eta_jet3_;
00197       MonitorElement * hRA2_deltaPhi_mht_jets_;
00198       MonitorElement * hRA2_ht_;
00199       MonitorElement * hRA2_mht_;
00200       MonitorElement * hRA2_pt_muons_;
00201       MonitorElement * hRA2_pt_elecs_;
00202 
00203       MonitorElement * hRAL_N_muons_;
00204       MonitorElement * hRAL_pt_muons_;
00205       MonitorElement * hRAL_eta_muons_;
00206       MonitorElement * hRAL_phi_muons_;
00207       MonitorElement * hRAL_Iso_muons_;
00208 
00209       MonitorElement * hRAL_N_elecs_;
00210       MonitorElement * hRAL_pt_elecs_;
00211       MonitorElement * hRAL_eta_elecs_;
00212       MonitorElement * hRAL_phi_elecs_;
00213       MonitorElement * hRAL_Iso_elecs_;
00214 
00215       MonitorElement * hRAL_Sum_pt_jets_;
00216       MonitorElement * hRAL_Met_;
00217 
00218       MonitorElement * hRAL_dR_emu_;
00219 
00220       MonitorElement * hRAL_mass_OS_mumu_;
00221       MonitorElement * hRAL_mass_OS_ee_;
00222       MonitorElement * hRAL_mass_OS_emu_;
00223       MonitorElement * hRAL_mass_SS_mumu_;
00224       MonitorElement * hRAL_mass_SS_ee_;
00225       MonitorElement * hRAL_mass_SS_emu_;
00226 
00227       MonitorElement * hRAL_Muon_monitor_;
00228       MonitorElement * hRAL_Electron_monitor_;
00229       MonitorElement * hRAL_OSee_monitor_;
00230       MonitorElement * hRAL_OSemu_monitor_;
00231       MonitorElement * hRAL_OSmumu_monitor_;
00232       MonitorElement * hRAL_SSee_monitor_;
00233       MonitorElement * hRAL_SSemu_monitor_;
00234       MonitorElement * hRAL_SSmumu_monitor_;
00235       MonitorElement * hRAL_TriMuon_monitor_;
00236 
00237 };
00238 
00239 template<typename Mu, typename Ele, typename Jet, typename Met>
00240 SusyDQM<Mu, Ele, Jet, Met>::SusyDQM(const edm::ParameterSet& pset) {
00241 
00242    parameters_ = pset;
00243    initialize();
00244 
00245    moduleName_ = pset.getUntrackedParameter<std::string> ("moduleName");
00246 
00247    muons_ = pset.getParameter<edm::InputTag> ("muonCollection");
00248    electrons_ = pset.getParameter<edm::InputTag> ("electronCollection");
00249    jets_ = pset.getParameter<edm::InputTag> ("jetCollection");
00250    met_ = pset.getParameter<edm::InputTag> ("metCollection");
00251    vertex_ = pset.getParameter<edm::InputTag> ("vertexCollection");
00252 
00253    muon_eta_cut_ = pset.getParameter<double> ("muon_eta_cut");
00254    muon_nHits_cut_ = pset.getParameter<double> ("muon_nHits_cut");
00255    muon_nChi2_cut_ = pset.getParameter<double> ("muon_nChi2_cut");
00256    muon_d0_cut_ = pset.getParameter<double> ("muon_d0_cut");
00257 
00258    elec_eta_cut_ = pset.getParameter<double> ("elec_eta_cut");
00259    elec_mva_cut_ = pset.getParameter<double> ("elec_mva_cut");
00260    elec_d0_cut_ = pset.getParameter<double> ("elec_d0_cut");
00261 
00262    RA12_muon_pt_cut_ = pset.getParameter<double> ("RA12_muon_pt_cut");
00263    RA12_muon_iso_cut_ = pset.getParameter<double> ("RA12_muon_iso_cut");
00264 
00265    RA12_elec_pt_cut_ = pset.getParameter<double> ("RA12_elec_pt_cut");
00266    RA12_elec_iso_cut_ = pset.getParameter<double> ("RA12_elec_iso_cut");
00267 
00268    RA1_jet_pt_cut_ = pset.getParameter<double> ("RA1_jet_pt_cut");
00269    RA1_jet_eta_cut_ = pset.getParameter<double> ("RA1_jet_eta_cut");
00270    RA1_jet_min_emf_cut_ = pset.getParameter<double> ("RA1_jet_min_emf_cut");
00271    RA1_jet_max_emf_cut_ = pset.getParameter<double> ("RA1_jet_max_emf_cut");
00272    RA1_jet1_pt_cut_ = pset.getParameter<double> ("RA1_jet1_pt_cut");
00273    RA1_jet1_eta_cut_ = pset.getParameter<double> ("RA1_jet1_eta_cut");
00274    RA1_jet2_pt_cut_ = pset.getParameter<double> ("RA1_jet2_pt_cut");
00275    RA1_jet2_eta_cut_ = pset.getParameter<double> ("RA1_jet2_eta_cut");
00276    RA1_jet3_pt_cut_ = pset.getParameter<double> ("RA1_jet3_pt_cut");
00277 
00278    RA1_alphat_cut_ = pset.getParameter<double> ("RA1_alphat_cut");
00279    RA1_ht_cut_ = pset.getParameter<double> ("RA1_ht_cut");
00280    RA1_mht_cut_ = pset.getParameter<double> ("RA1_mht_cut");
00281    RA1_deltaPhi_cut_ = pset.getParameter<double> ("RA1_deltaPhi_cut");
00282    RA1_deltaPhiJets_cut_ = pset.getParameter<double> ("RA1_deltaPhiJets_cut");
00283 
00284    RA2_jet_pt_cut_ = pset.getParameter<double> ("RA2_jet_pt_cut");
00285    RA2_jet_eta_cut_ = pset.getParameter<double> ("RA2_jet_eta_cut");
00286    RA2_jet_min_emf_cut_ = pset.getParameter<double> ("RA2_jet_min_emf_cut");
00287    RA2_jet_max_emf_cut_ = pset.getParameter<double> ("RA2_jet_max_emf_cut");
00288    RA2_jet1_pt_cut_ = pset.getParameter<double> ("RA2_jet1_pt_cut");
00289    RA2_jet1_eta_cut_ = pset.getParameter<double> ("RA2_jet1_eta_cut");
00290    RA2_jet2_pt_cut_ = pset.getParameter<double> ("RA2_jet2_pt_cut");
00291    RA2_jet2_eta_cut_ = pset.getParameter<double> ("RA2_jet2_eta_cut");
00292    RA2_jet3_pt_cut_ = pset.getParameter<double> ("RA2_jet3_pt_cut");
00293    RA2_jet3_eta_cut_ = pset.getParameter<double> ("RA2_jet3_eta_cut");
00294    RA2_N_jets_cut_ = pset.getParameter<int> ("RA2_N_jets_cut");
00295 
00296    RA2_ht_cut_ = pset.getParameter<double> ("RA2_ht_cut");
00297    RA2_mht_cut_ = pset.getParameter<double> ("RA2_mht_cut");
00298    RA2_deltaPhi_cut_ = pset.getParameter<double> ("RA2_deltaPhi_cut");
00299 
00300    RAL_muon_pt_cut_ = pset.getParameter<double> ("RAL_muon_pt_cut");
00301    RAL_muon_iso_cut_ = pset.getParameter<double> ("RAL_muon_iso_cut");
00302 
00303    RAL_elec_pt_cut_ = pset.getParameter<double> ("RAL_elec_pt_cut");
00304    RAL_elec_iso_cut_ = pset.getParameter<double> ("RAL_elec_iso_cut");
00305 
00306    RAL_jet_pt_cut_ = pset.getParameter<double> ("RAL_jet_pt_cut");
00307    RAL_jet_sum_pt_cut_ = pset.getParameter<double> ("RAL_jet_sum_pt_cut");
00308    RAL_jet_eta_cut_ = pset.getParameter<double> ("RAL_jet_eta_cut");
00309    RAL_jet_min_emf_cut_ = pset.getParameter<double> ("RAL_jet_min_emf_cut");
00310    RAL_jet_max_emf_cut_ = pset.getParameter<double> ("RAL_jet_max_emf_cut");
00311 
00312    RAL_met_cut_ = pset.getParameter<double> ("RAL_met_cut");
00313 }
00314 
00315 template<typename Mu, typename Ele, typename Jet, typename Met>
00316 SusyDQM<Mu, Ele, Jet, Met>::~SusyDQM() {
00317 
00318 }
00319 
00320 template<typename Mu, typename Ele, typename Jet, typename Met>
00321 void SusyDQM<Mu, Ele, Jet, Met>::initialize() {
00322 
00323 }
00324 
00325 template<typename Mu, typename Ele, typename Jet, typename Met>
00326 void SusyDQM<Mu, Ele, Jet, Met>::beginJob() {
00327 
00328    dbe_ = edm::Service<DQMStore>().operator->();
00329 
00330    dbe_->setCurrentFolder(moduleName_);
00331 
00332    hRA1_pt_jet1_nm1_ = dbe_->book1D("RA1_pt_jet1_nm1", "RA1_pt_jet1_nm1", 50, 0., 1000.);
00333    hRA1_eta_jet1_nm1_ = dbe_->book1D("RA1_eta_jet1_nm1", "RA1_eta_jet1_nm1", 50, -5., 5.);
00334    hRA1_pt_jet2_nm1_ = dbe_->book1D("RA1_pt_jet2_nm1", "RA1_pt_jet2_nm1", 50, 0., 1000.);
00335    hRA1_eta_jet2_nm1_ = dbe_->book1D("RA1_eta_jet2_nm1", "RA1_eta_jet2_nm1", 50, -5., 5.);
00336    hRA1_pt_jet3_nm1_ = dbe_->book1D("RA1_pt_jet3_nm1", "RA1_pt_jet3_nm1", 50, 0., 1000.);
00337    hRA1_deltaPhi_mht_jets_nm1_ = dbe_->book1D("RA1_deltaPhi_mht_jets_nm1", "RA1_deltaPhi_mht_jets_nm1", 50, 0., 2.);
00338    hRA1_deltaPhi_jets_nm1_ = dbe_->book1D("RA1_deltaPhi_jets_nm1", "RA1_deltaPhi_jets_nm1", 50, 0., 4.);
00339    hRA1_ht_nm1_ = dbe_->book1D("RA1_ht_nm1", "RA1_ht_nm1", 50, 0., 1000.);
00340    hRA1_mht_nm1_ = dbe_->book1D("RA1_mht_nm1", "RA1_mht_nm1", 50, 0., 1000.);
00341    hRA1_alphat_nm1_ = dbe_->book1D("RA1_alphat_nm1", "RA1_alphat_nm1", 50, 0., 2.);
00342    hRA1_pt_muons_nm1_ = dbe_->book1D("RA1_pt_muons_nm1", "RA1_pt_muons_nm1", 50, 0., 200.);
00343    hRA1_pt_elecs_nm1_ = dbe_->book1D("RA1_pt_elecs_nm1", "RA1_pt_elecs_nm1", 50, 0., 200.);
00344 
00345    hRA2_N_jets_nm1_ = dbe_->book1D("RA2_N_jets_nm1", "RA2_N_jets_nm1", 10, 0., 10.);
00346    hRA2_pt_jet1_nm1_ = dbe_->book1D("RA2_pt_jet1_nm1", "RA2_pt_jet1_nm1", 50, 0., 1000.);
00347    hRA2_eta_jet1_nm1_ = dbe_->book1D("RA2_eta_jet1_nm1", "RA2_eta_jet1_nm1", 50, -5., 5.);
00348    hRA2_pt_jet2_nm1_ = dbe_->book1D("RA2_pt_jet2_nm1", "RA2_pt_jet2_nm1", 50, 0., 1000.);
00349    hRA2_eta_jet2_nm1_ = dbe_->book1D("RA2_eta_jet2_nm1", "RA2_eta_jet2_nm1", 50, -5., 5.);
00350    hRA2_pt_jet3_nm1_ = dbe_->book1D("RA2_pt_jet3_nm1", "RA2_pt_jet3_nm1", 50, 0., 1000.);
00351    hRA2_eta_jet3_nm1_ = dbe_->book1D("RA2_eta_jet3_nm1", "RA2_eta_jet3_nm1", 50, -5., 5.);
00352    hRA2_deltaPhi_mht_jets_nm1_ = dbe_->book1D("RA2_deltaPhi_mht_jets_nm1", "RA2_deltaPhi_mht_jets_nm1", 50, 0., 2.);
00353    hRA2_ht_nm1_ = dbe_->book1D("RA2_ht_nm1", "RA2_ht_nm1", 50, 0., 2000.);
00354    hRA2_mht_nm1_ = dbe_->book1D("RA2_mht_nm1", "RA2_mht_nm1", 50, 0., 1000.);
00355    hRA2_pt_muons_nm1_ = dbe_->book1D("RA2_pt_muons_nm1", "RA2_pt_muons_nm1", 50, 0., 200.);
00356    hRA2_pt_elecs_nm1_ = dbe_->book1D("RA2_pt_elecs_nm1", "RA2_pt_elecs_nm1", 50, 0., 200.);
00357 
00358    hRA1_pt_jet1_ = dbe_->book1D("RA1_pt_jet1", "RA1_pt_jet1", 50, 0., 1000.);
00359    hRA1_eta_jet1_ = dbe_->book1D("RA1_eta_jet1", "RA1_eta_jet1", 50, -5., 5.);
00360    hRA1_pt_jet2_ = dbe_->book1D("RA1_pt_jet2", "RA1_pt_jet2", 50, 0., 1000.);
00361    hRA1_eta_jet2_ = dbe_->book1D("RA1_eta_jet2", "RA1_eta_jet2", 50, -5., 5.);
00362    hRA1_pt_jet3_ = dbe_->book1D("RA1_pt_jet3", "RA1_pt_jet3", 50, 0., 1000.);
00363    hRA1_deltaPhi_mht_jets_ = dbe_->book1D("RA1_deltaPhi_mht_jets", "RA1_deltaPhi_mht_jets", 50, 0., 2.);
00364    hRA1_deltaPhi_jets_ = dbe_->book1D("RA1_deltaPhi_jets", "RA1_deltaPhi_jets", 50, 0., 4.);
00365    hRA1_ht_ = dbe_->book1D("RA1_ht", "RA1_ht", 50, 0., 1000.);
00366    hRA1_mht_ = dbe_->book1D("RA1_mht", "RA1_mht", 50, 0., 1000.);
00367    hRA1_alphat_ = dbe_->book1D("RA1_alphat", "RA1_alphat", 50, 0., 2.);
00368    hRA1_pt_muons_ = dbe_->book1D("RA1_pt_muons", "RA1_pt_muons", 50, 0., 200.);
00369    hRA1_pt_elecs_ = dbe_->book1D("RA1_pt_elecs", "RA1_pt_elecs", 50, 0., 200.);
00370 
00371    hRA2_N_jets_ = dbe_->book1D("RA2_N_jets", "RA2_N_jets", 10, 0., 10.);
00372    hRA2_pt_jet1_ = dbe_->book1D("RA2_pt_jet1", "RA2_pt_jet1", 50, 0., 1000.);
00373    hRA2_eta_jet1_ = dbe_->book1D("RA2_eta_jet1", "RA2_eta_jet1", 50, -5., 5.);
00374    hRA2_pt_jet2_ = dbe_->book1D("RA2_pt_jet2", "RA2_pt_jet2", 50, 0., 1000.);
00375    hRA2_eta_jet2_ = dbe_->book1D("RA2_eta_jet2", "RA2_eta_jet2", 50, -5., 5.);
00376    hRA2_pt_jet3_ = dbe_->book1D("RA2_pt_jet3", "RA2_pt_jet3", 50, 0., 1000.);
00377    hRA2_eta_jet3_ = dbe_->book1D("RA2_eta_jet3", "RA2_eta_jet3", 50, -5., 5.);
00378    hRA2_deltaPhi_mht_jets_ = dbe_->book1D("RA2_deltaPhi_mht_jets", "RA2_deltaPhi_mht_jets", 50, 0., 2.);
00379    hRA2_ht_ = dbe_->book1D("RA2_ht", "RA2_ht", 50, 0., 2000.);
00380    hRA2_mht_ = dbe_->book1D("RA2_mht", "RA2_mht", 50, 0., 1000.);
00381    hRA2_pt_muons_ = dbe_->book1D("RA2_pt_muons", "RA2_pt_muons", 50, 0., 200.);
00382    hRA2_pt_elecs_ = dbe_->book1D("RA2_pt_elecs", "RA2_pt_elecs", 50, 0., 200.);
00383 
00384    hRAL_N_muons_ = dbe_->book1D("RAL_N_muons", "RAL_N_muons", 10, 0., 10.);
00385    hRAL_pt_muons_ = dbe_->book1D("RAL_pt_muons", "RAL_pt_muons", 50, 0., 300.);
00386    hRAL_eta_muons_ = dbe_->book1D("RAL_eta_muons", "RAL_eta_muons", 50, -2.5, 2.5);
00387    hRAL_phi_muons_ = dbe_->book1D("RAL_phi_muons", "RAL_phi_muons", 50, -4., 4.);
00388    hRAL_Iso_muons_ = dbe_->book1D("RAL_Iso_muons", "RAL_Iso_muons", 50, 0., 25.);
00389 
00390    hRAL_N_elecs_ = dbe_->book1D("RAL_N_elecs", "RAL_N_elecs", 10, 0., 10.);
00391    hRAL_pt_elecs_ = dbe_->book1D("RAL_pt_elecs", "RAL_pt_elecs", 50, 0., 300.);
00392    hRAL_eta_elecs_ = dbe_->book1D("RAL_eta_elecs", "RAL_eta_elecs", 50, -2.5, 2.5);
00393    hRAL_phi_elecs_ = dbe_->book1D("RAL_phi_elecs", "RAL_phi_elecs", 50, -4., 4.);
00394    hRAL_Iso_elecs_ = dbe_->book1D("RAL_Iso_elecs", "RAL_Iso_elecs", 50, 0., 25.);
00395 
00396    hRAL_Sum_pt_jets_ = dbe_->book1D("RAL_Sum_pt_jets", "RAL_Sum_pt_jets", 50, 0., 2000.);
00397    hRAL_Met_ = dbe_->book1D("RAL_Met", "RAL_Met", 50, 0., 1000.);
00398 
00399    hRAL_dR_emu_ = dbe_->book1D("RAL_deltaR_emu", "RAL_deltaR_emu", 50, 0., 10.);
00400 
00401    hRAL_mass_OS_mumu_ = dbe_->book1D("RAL_mass_OS_mumu", "RAL_mass_OS_mumu", 50, 0., 300.);
00402    hRAL_mass_OS_ee_ = dbe_->book1D("RAL_mass_OS_ee", "RAL_mass_OS_ee", 50, 0., 300.);
00403    hRAL_mass_OS_emu_ = dbe_->book1D("RAL_mass_OS_emu", "RAL_mass_OS_emu", 50, 0., 300.);
00404    hRAL_mass_SS_mumu_ = dbe_->book1D("RAL_mass_SS_mumu", "RAL_mass_SS_mumu", 50, 0., 300.);
00405    hRAL_mass_SS_ee_ = dbe_->book1D("RAL_mass_SS_ee", "RAL_mass_SS_ee", 50, 0., 300.);
00406    hRAL_mass_SS_emu_ = dbe_->book1D("RAL_mass_SS_emu", "RAL_mass_SS_emu", 50, 0., 300.);
00407 
00408    hRAL_Muon_monitor_ = dbe_->book2D("RAL_Single_Muon_Selection", "RAL_Single_Muon_Selection", 50, 0., 1000., 50, 0.,
00409          1000.);
00410    hRAL_Electron_monitor_ = dbe_->book2D("RAL_Single_Electron_Selection", "RAL_Single_Electron_Selection", 50, 0.,
00411          1000., 50, 0., 1000.);
00412    hRAL_OSee_monitor_ = dbe_->book2D("RAL_OS_Electron_Selection", "RAL_OS_Electron_Selection", 50, 0., 1000., 50, 0.,
00413          1000.);
00414    hRAL_OSemu_monitor_ = dbe_->book2D("RAL_OS_ElectronMuon_Selection", "RAL_OS_ElectronMuon_Selection", 50, 0., 1000.,
00415          50, 0., 1000.);
00416    hRAL_OSmumu_monitor_ = dbe_->book2D("RAL_OS_Muon_Selection", "RAL_OS_Muon_Selection", 50, 0., 1000., 50, 0., 1000.);
00417    hRAL_SSee_monitor_ = dbe_->book2D("RAL_SS_Electron_Selection", "RAL_SS_Electron_Selection", 50, 0., 1000., 50, 0.,
00418          1000.);
00419    hRAL_SSemu_monitor_ = dbe_->book2D("RAL_SS_ElectronMuon_Selection", "RAL_SS_ElectronMuon_Selection", 50, 0., 1000.,
00420          50, 0., 1000.);
00421    hRAL_SSmumu_monitor_ = dbe_->book2D("RAL_SS_Muon_Selection", "RAL_SS_Muon_Selection", 50, 0., 1000., 50, 0., 1000.);
00422    hRAL_TriMuon_monitor_ = dbe_->book2D("RAL_Tri_Muon_Selection", "RAL_Tri_Muon_Selection", 50, 0., 1000., 50, 0.,
00423          1000.);
00424 
00425 }
00426 
00427 template<typename Mu, typename Ele, typename Jet, typename Met>
00428 void SusyDQM<Mu, Ele, Jet, Met>::beginRun(const edm::Run& run) {
00429 
00430 }
00431 
00432 template<typename Mu, typename Ele, typename Jet, typename Met>
00433 bool SusyDQM<Mu, Ele, Jet, Met>::goodSusyElectron(const Ele* ele) {
00434    //   if (ele->pt() < elec_pt_cut_)
00435    //      return false;
00436    if (fabs(ele->eta()) > elec_eta_cut_)
00437       return false;
00438    //   if (ele->mva() < elec_mva_cut_)
00439    //      return false;
00440    if (fabs(ele->gsfTrack()->dxy(bs)) > elec_d0_cut_)
00441       return false;
00442    return true;
00443 }
00444 
00445 template<typename Mu, typename Ele, typename Jet, typename Met>
00446 bool SusyDQM<Mu, Ele, Jet, Met>::goodSusyMuon(const Mu* mu) {
00447    //   if (mu->pt() < muon_pt_cut_)
00448    //      return false;
00449    if (fabs(mu->eta()) > muon_eta_cut_)
00450       return false;
00451    if (!mu->isGlobalMuon())
00452       return false;
00453    if (mu->innerTrack()->numberOfValidHits() < muon_nHits_cut_)
00454       return false;
00455    if (mu->globalTrack()->normalizedChi2() > muon_nChi2_cut_)
00456       return false;
00457    if (fabs(mu->innerTrack()->dxy(bs)) > muon_d0_cut_)
00458       return false;
00459    return true;
00460 }
00461 
00462 template<typename Mu, typename Ele, typename Jet, typename Met>
00463 void SusyDQM<Mu, Ele, Jet, Met>::analyze(const edm::Event& evt, const edm::EventSetup& iSetup) {
00464 
00465    edm::Handle<std::vector<Mu> > muons;
00466    bool isFound = evt.getByLabel(muons_, muons);
00467    if (!isFound)
00468       return;
00469 
00470    edm::Handle<std::vector<Ele> > elecs;
00471    isFound = evt.getByLabel(electrons_, elecs);
00472    if (!isFound)
00473       return;
00474 
00475    //edm::Handle<std::vector<Jet> > jets;
00476    //evt.getByLabel(jets_, jets);
00477 
00479    edm::Handle<std::vector<Jet> > cJets;
00480    isFound = evt.getByLabel(jets_, cJets);
00481    if (!isFound)
00482       return;
00483    std::vector<Jet> jets = *cJets;
00484    std::sort(jets.begin(), jets.end(), PtGreater());
00485 
00486    edm::Handle<std::vector<Met> > mets;
00487    isFound = evt.getByLabel(met_, mets);
00488    if (!isFound)
00489       return;
00490 
00491    edm::Handle<reco::VertexCollection> vertices;
00492    isFound = evt.getByLabel(vertex_, vertices);
00493    if (!isFound)
00494       return;
00495 
00497    // Hadronic DQM histos
00499 
00500    float RA1_HT = 0.;
00501    math::PtEtaPhiMLorentzVector RA1_vMHT(0., 0., 0., 0.);
00502    int RA1_nJets = 0;
00503    float RA1_jet1_pt = 0;
00504    float RA1_jet1_eta = 0;
00505    float RA1_jet1_emf = 0;
00506    float RA1_jet2_pt = 0;
00507    float RA1_jet2_eta = 0;
00508    float RA1_jet2_emf = 0;
00509    float RA1_jet3_pt = 0;
00510    math::PtEtaPhiMLorentzVector RA1_leading(0., 0., 0., 0.);
00511    math::PtEtaPhiMLorentzVector RA1_second(0., 0., 0., 0.);
00512    int i_jet = 0;
00513    for (typename std::vector<Jet>::const_iterator jet_i = jets.begin(); jet_i != jets.end(); ++jet_i) {
00514       if (i_jet == 0) {
00515          RA1_leading = jet_i->p4();
00516          RA1_jet1_pt = jet_i->pt();
00517          RA1_jet1_eta = jet_i->eta();
00518          RA1_jet1_emf = jet_i->emEnergyFraction();
00519       }
00520       if (i_jet == 1) {
00521          RA1_second = jet_i->p4();
00522          RA1_jet2_pt = jet_i->pt();
00523          RA1_jet2_eta = jet_i->eta();
00524          RA1_jet2_emf = jet_i->emEnergyFraction();
00525       }
00526       if (i_jet == 2)
00527          RA1_jet3_pt = jet_i->pt();
00528       if (jet_i->pt() > RA1_jet_pt_cut_ && fabs(jet_i->eta()) < RA1_jet_eta_cut_) {
00529          ++RA1_nJets;
00530          RA1_HT += jet_i->pt();
00531          RA1_vMHT -= jet_i->p4();
00532       }
00533       ++i_jet;
00534    }
00535    float RA1_MHT = RA1_vMHT.pt();
00536 
00537    i_jet = 0;
00538    float RA1_minDeltaPhi = 9999.;
00539    for (typename std::vector<Jet>::const_iterator jet_i = jets.begin(); jet_i != jets.end(); ++jet_i) {
00540       if (i_jet <= 2) {
00541          double deltaPhi_tmp = fabs(deltaPhi(jet_i->phi(), RA1_vMHT.phi()));
00542          if (deltaPhi_tmp < RA1_minDeltaPhi)
00543             RA1_minDeltaPhi = deltaPhi_tmp;
00544       }
00545       ++i_jet;
00546    }
00547 
00548    float RA1_alphat = 0;
00549    float RA1_DeltaPhiJets = 9999.;
00550    if (RA1_nJets >= 2) {
00551       RA1_DeltaPhiJets = fabs(deltaPhi(RA1_leading.phi(), RA1_second.phi()));
00552       // wrong definition PDG (July 2008) Eq. 38.38
00553       //RA1_alphat = RA1_second.Et() / (RA1_leading + RA1_second).Mt();
00554       // right definition PDG (July 2008) Eq. 38.61
00555       RA1_alphat = RA1_second.Et() / sqrt(2* RA1_leading .Et() * RA1_second.Et() * (1 - cos(RA1_DeltaPhiJets)));
00556    }
00557 
00558    float RA2_HT = 0.;
00559    math::PtEtaPhiMLorentzVector RA2_vMHT(0., 0., 0., 0.);
00560    int RA2_nJets = 0;
00561    float RA2_jet1_pt = 0;
00562    float RA2_jet1_eta = 0;
00563    float RA2_jet1_emf = 0;
00564    float RA2_jet2_pt = 0;
00565    float RA2_jet2_eta = 0;
00566    float RA2_jet2_emf = 0;
00567    float RA2_jet3_pt = 0;
00568    float RA2_jet3_eta = 0;
00569    float RA2_jet3_emf = 0;
00570    i_jet = 0;
00571    for (typename std::vector<Jet>::const_iterator jet_i = jets.begin(); jet_i != jets.end(); ++jet_i) {
00572       if (i_jet == 0) {
00573          RA2_jet1_pt = jet_i->pt();
00574          RA2_jet1_eta = jet_i->eta();
00575          RA2_jet1_emf = jet_i->emEnergyFraction();
00576       }
00577       if (i_jet == 1) {
00578          RA2_jet2_pt = jet_i->pt();
00579          RA2_jet2_eta = jet_i->eta();
00580          RA2_jet2_emf = jet_i->emEnergyFraction();
00581       }
00582       if (i_jet == 2) {
00583          RA2_jet3_pt = jet_i->pt();
00584          RA2_jet3_eta = jet_i->eta();
00585          RA2_jet3_emf = jet_i->emEnergyFraction();
00586       }
00587       if (jet_i->pt() > RA2_jet_pt_cut_ && fabs(jet_i->eta()) < RA2_jet_eta_cut_) {
00588          ++RA2_nJets;
00589          RA2_HT += jet_i->pt();
00590          RA2_vMHT -= jet_i->p4();
00591       }
00592       ++i_jet;
00593    }
00594    float RA2_MHT = RA2_vMHT.pt();
00595 
00596    i_jet = 0;
00597    float RA2_minDeltaPhi = 9999.;
00598    for (typename std::vector<Jet>::const_iterator jet_i = jets.begin(); jet_i != jets.end(); ++jet_i) {
00599       if (jet_i->pt() < RA2_jet_pt_cut_)
00600          continue;
00601       if (i_jet <= 2) {
00602          double deltaPhi_tmp = fabs(deltaPhi(jet_i->phi(), RA1_vMHT.phi()));
00603          if (deltaPhi_tmp < RA2_minDeltaPhi)
00604             RA2_minDeltaPhi = deltaPhi_tmp;
00605       }
00606       ++i_jet;
00607    }
00608 
00609    for (reco::VertexCollection::const_iterator vertex = vertices->begin(); vertex != vertices->end(); ++vertex) {
00610       bs = vertex->position();
00611       break;
00612    }
00613 
00614    float leadingMuPt = 0;
00615    for (typename std::vector<Mu>::const_iterator mu_i = muons->begin(); mu_i != muons->end(); ++mu_i) {
00616       if (!goodSusyMuon(&(*mu_i)))
00617          continue;
00618 
00619       reco::MuonIsolation Iso_muon = mu_i->isolationR03();
00620       float muIso = (Iso_muon.emEt + Iso_muon.hadEt + Iso_muon.sumPt) / mu_i->pt();
00621 
00622       if (muIso < RA12_muon_iso_cut_) {
00623          if (mu_i->pt() > leadingMuPt)
00624             leadingMuPt = mu_i->pt();
00625       }
00626    }
00627 
00628    float leadingElecPt = 0;
00629    for (typename std::vector<Ele>::const_iterator ele_i = elecs->begin(); ele_i != elecs->end(); ++ele_i) {
00630       if (!goodSusyElectron(&(*ele_i)))
00631          continue;
00632 
00633       float elecIso = (ele_i->dr03TkSumPt() + ele_i->dr03EcalRecHitSumEt() + ele_i->dr03HcalTowerSumEt()) / ele_i->pt();
00634 
00635       if (elecIso < RA12_elec_iso_cut_) {
00636          if (ele_i->pt() > leadingElecPt)
00637             leadingElecPt = ele_i->pt();
00638       }
00639    }
00640 
00642    if (RA1_jet1_emf >= RA1_jet_min_emf_cut_ && RA1_jet1_emf <= RA1_jet_max_emf_cut_ && RA1_jet2_emf
00643          >= RA1_jet_min_emf_cut_ && RA1_jet2_emf <= RA1_jet_max_emf_cut_) {
00644       hRA1_pt_jet1_->Fill(RA1_jet1_pt);
00645       hRA1_eta_jet1_->Fill(RA1_jet1_eta);
00646       hRA1_pt_jet2_->Fill(RA1_jet2_pt);
00647       hRA1_eta_jet2_->Fill(RA1_jet2_eta);
00648       hRA1_pt_jet3_->Fill(RA1_jet3_pt);
00649       hRA1_deltaPhi_mht_jets_->Fill(RA1_minDeltaPhi);
00650       hRA1_deltaPhi_jets_->Fill(RA1_DeltaPhiJets);
00651       hRA1_ht_->Fill(RA1_HT);
00652       hRA1_mht_->Fill(RA1_MHT);
00653       hRA1_alphat_->Fill(RA1_alphat);
00654       hRA1_pt_muons_->Fill(leadingMuPt);
00655       hRA1_pt_elecs_->Fill(leadingElecPt);
00656       for (int i = 0; i < 12; ++i) {
00657          if (RA1_jet1_pt > RA1_jet1_pt_cut_ || i == 0) {
00658             if (fabs(RA1_jet1_eta) < RA1_jet1_eta_cut_ || i == 1) {
00659                if (RA1_jet2_pt > RA1_jet2_pt_cut_ || i == 2) {
00660                   if (fabs(RA1_jet2_eta) < RA1_jet2_eta_cut_ || i == 3) {
00661                      if (RA1_jet3_pt < RA1_jet3_pt_cut_ || i == 4) {
00662                         if (RA1_minDeltaPhi >= RA1_deltaPhi_cut_ || i == 5) {
00663                            if (RA1_DeltaPhiJets <= RA1_deltaPhiJets_cut_ || i == 6) {
00664                               if (RA1_HT >= RA1_ht_cut_ || i == 7) {
00665                                  if (RA1_MHT >= RA1_mht_cut_ || i == 8) {
00666                                     if (RA1_alphat >= RA1_alphat_cut_ || i == 9) {
00667                                        if (leadingMuPt <= RA12_muon_pt_cut_ || i == 10) {
00668                                           if (leadingElecPt <= RA12_elec_pt_cut_ || i == 11) {
00669                                              if (i == 0)
00670                                                 hRA1_pt_jet1_nm1_->Fill(RA1_jet1_pt);
00671                                              if (i == 1)
00672                                                 hRA1_eta_jet1_nm1_->Fill(RA1_jet1_eta);
00673                                              if (i == 2)
00674                                                 hRA1_pt_jet2_nm1_->Fill(RA1_jet2_pt);
00675                                              if (i == 3)
00676                                                 hRA1_eta_jet2_nm1_->Fill(RA1_jet2_eta);
00677                                              if (i == 4)
00678                                                 hRA1_pt_jet3_nm1_->Fill(RA1_jet3_pt);
00679                                              if (i == 5)
00680                                                 hRA1_deltaPhi_mht_jets_nm1_->Fill(RA1_minDeltaPhi);
00681                                              if (i == 6)
00682                                                 hRA1_deltaPhi_jets_nm1_->Fill(RA1_DeltaPhiJets);
00683                                              if (i == 7)
00684                                                 hRA1_ht_nm1_->Fill(RA1_HT);
00685                                              if (i == 8)
00686                                                 hRA1_mht_nm1_->Fill(RA1_MHT);
00687                                              if (i == 9)
00688                                                 hRA1_alphat_nm1_->Fill(RA1_alphat);
00689                                              if (i == 10)
00690                                                 hRA1_pt_muons_nm1_->Fill(leadingMuPt);
00691                                              if (i == 11)
00692                                                 hRA1_pt_elecs_nm1_->Fill(leadingElecPt);
00693                                           }
00694                                        }
00695                                     }
00696                                  }
00697                               }
00698                            }
00699                         }
00700                      }
00701                   }
00702                }
00703             }
00704          }
00705       }
00706    }
00707 
00709    if (RA2_jet1_emf >= RA2_jet_min_emf_cut_ && RA2_jet1_emf <= RA2_jet_max_emf_cut_ && RA2_jet2_emf
00710          >= RA2_jet_min_emf_cut_ && RA2_jet2_emf <= RA2_jet_max_emf_cut_ && RA2_jet3_emf >= RA2_jet_min_emf_cut_
00711          && RA2_jet3_emf <= RA2_jet_max_emf_cut_) {
00712       hRA2_N_jets_->Fill(RA2_nJets);
00713       hRA2_pt_jet1_->Fill(RA2_jet1_pt);
00714       hRA2_eta_jet1_->Fill(RA2_jet1_eta);
00715       hRA2_pt_jet2_->Fill(RA2_jet2_pt);
00716       hRA2_eta_jet2_->Fill(RA2_jet2_eta);
00717       hRA2_pt_jet3_->Fill(RA2_jet3_pt);
00718       hRA2_eta_jet3_->Fill(RA2_jet3_eta);
00719       hRA2_deltaPhi_mht_jets_->Fill(RA2_minDeltaPhi);
00720       hRA2_ht_->Fill(RA2_HT);
00721       hRA2_mht_->Fill(RA2_MHT);
00722       hRA2_pt_muons_->Fill(leadingMuPt);
00723       hRA2_pt_elecs_->Fill(leadingElecPt);
00724       for (int i = 0; i < 12; ++i) {
00725          if (RA2_nJets >= RA2_N_jets_cut_ || i == 0) {
00726             if (RA2_jet1_pt > RA2_jet1_pt_cut_ || i == 1) {
00727                if (fabs(RA2_jet1_eta) < RA2_jet1_eta_cut_ || i == 2) {
00728                   if (RA2_jet2_pt > RA2_jet2_pt_cut_ || i == 3) {
00729                      if (fabs(RA2_jet2_eta) < RA2_jet2_eta_cut_ || i == 4) {
00730                         if (RA2_jet3_pt > RA2_jet3_pt_cut_ || i == 5) {
00731                            if (fabs(RA2_jet3_eta) < RA2_jet3_eta_cut_ || i == 6) {
00732                               if (RA2_minDeltaPhi >= RA2_deltaPhi_cut_ || i == 7) {
00733                                  if (RA2_HT >= RA2_ht_cut_ || i == 8) {
00734                                     if (RA2_MHT >= RA2_mht_cut_ || i == 9) {
00735                                        if (leadingMuPt <= RA12_muon_pt_cut_ || i == 10) {
00736                                           if (leadingElecPt <= RA12_elec_pt_cut_ || i == 11) {
00737                                              if (i == 0)
00738                                                 hRA2_N_jets_nm1_->Fill(RA2_nJets);
00739                                              if (i == 1)
00740                                                 hRA2_pt_jet1_nm1_->Fill(RA2_jet1_pt);
00741                                              if (i == 2)
00742                                                 hRA2_eta_jet1_nm1_->Fill(RA2_jet1_eta);
00743                                              if (i == 3)
00744                                                 hRA2_pt_jet2_nm1_->Fill(RA2_jet2_pt);
00745                                              if (i == 4)
00746                                                 hRA2_eta_jet2_nm1_->Fill(RA2_jet2_eta);
00747                                              if (i == 5)
00748                                                 hRA2_pt_jet3_nm1_->Fill(RA2_jet3_pt);
00749                                              if (i == 6)
00750                                                 hRA2_eta_jet3_nm1_->Fill(RA2_jet3_eta);
00751                                              if (i == 7)
00752                                                 hRA2_deltaPhi_mht_jets_nm1_->Fill(RA2_minDeltaPhi);
00753                                              if (i == 8)
00754                                                 hRA2_ht_nm1_->Fill(RA2_HT);
00755                                              if (i == 9)
00756                                                 hRA2_mht_nm1_->Fill(RA2_MHT);
00757                                              if (i == 10)
00758                                                 hRA2_pt_muons_nm1_->Fill(leadingMuPt);
00759                                              if (i == 11)
00760                                                 hRA2_pt_elecs_nm1_->Fill(leadingElecPt);
00761                                           }
00762                                        }
00763                                     }
00764                                  }
00765                               }
00766                            }
00767                         }
00768                      }
00769                   }
00770                }
00771             }
00772          }
00773       }
00774    }
00775 
00777    // Leptonic DQM histos
00779 
00780    float sumPt = 0.;
00781    for (typename std::vector<Jet>::const_iterator jet_i = jets.begin(); jet_i != jets.end(); ++jet_i) {
00782       if (jet_i->pt() < RAL_jet_pt_cut_)
00783          continue;
00784       if (fabs(jet_i->eta()) > RAL_jet_eta_cut_)
00785          continue;
00786       if (fabs(jet_i->eta()) > RAL_jet_eta_cut_)
00787          continue;
00788       if (jet_i->emEnergyFraction() < RAL_jet_min_emf_cut_)
00789          continue;
00790       if (jet_i->emEnergyFraction() > RAL_jet_max_emf_cut_)
00791          continue;
00792       sumPt += jet_i->pt();
00793    }
00794 
00795    hRAL_Sum_pt_jets_->Fill(sumPt);
00796 
00797    float MET = 0.;
00798    for (typename std::vector<Met>::const_iterator met_i = mets->begin(); met_i != mets->end(); ++met_i) {
00799       MET = met_i->pt();
00800       break;
00801    }
00802 
00803    hRAL_Met_->Fill(MET);
00804 
00805    int nMuons = 0;
00806    int nSSmumu = 0;
00807    int nOSmumu = 0;
00808    int nSSemu = 0;
00809    int nOSemu = 0;
00810    float inv = 0.;
00811    float dR = 0.;
00812 
00813    for (typename std::vector<Mu>::const_iterator mu_i = muons->begin(); mu_i != muons->end(); ++mu_i) {
00814       if (!(goodSusyMuon(&(*mu_i)) && mu_i->pt() > RAL_muon_pt_cut_))
00815          continue;
00816       ++nMuons;
00817 
00818       hRAL_pt_muons_->Fill(mu_i->pt());
00819       hRAL_eta_muons_->Fill(mu_i->eta());
00820       hRAL_phi_muons_->Fill(mu_i->phi());
00821 
00822       reco::MuonIsolation muIso = mu_i->isolationR03();
00823       hRAL_Iso_muons_->Fill(muIso.emEt + muIso.hadEt + muIso.sumPt);
00824 
00825       //Muon muon pairs
00826       for (typename std::vector<Mu>::const_iterator mu_j = muons->begin(); mu_j != muons->end(); ++mu_j) {
00827          if (mu_i >= mu_j)
00828             continue;
00829          if (!(goodSusyMuon(&(*mu_j)) && mu_j->pt() > RAL_muon_pt_cut_))
00830             continue;
00831 
00832          inv = (mu_i->p4() + mu_j->p4()).M();
00833          if (mu_i->charge() * mu_j->charge() > 0) {
00834             ++nSSmumu;
00835             hRAL_mass_SS_mumu_->Fill(inv);
00836          }
00837          if (mu_i->charge() * mu_j->charge() < 0) {
00838             ++nOSmumu;
00839             hRAL_mass_OS_mumu_->Fill(inv);
00840          }
00841       }
00842 
00843       //Electron muon pairs
00844       for (typename std::vector<Ele>::const_iterator ele_j = elecs->begin(); ele_j != elecs->end(); ++ele_j) {
00845          if (!(goodSusyElectron(&(*ele_j)) && ele_j->pt() > RAL_elec_pt_cut_))
00846             continue;
00847          inv = (mu_i->p4() + ele_j->p4()).M();
00848          dR = deltaR(*mu_i, *ele_j);
00849          hRAL_dR_emu_->Fill(dR);
00850          if (mu_i->charge() * ele_j->charge() > 0) {
00851             ++nSSemu;
00852             hRAL_mass_SS_emu_->Fill(inv);
00853          }
00854          if (mu_i->charge() * ele_j->charge() < 0) {
00855             ++nOSemu;
00856             hRAL_mass_OS_emu_->Fill(inv);
00857          }
00858       }
00859    }
00860 
00861    hRAL_N_muons_->Fill(nMuons);
00862 
00863    int nElectrons = 0;
00864    int nSSee = 0;
00865    int nOSee = 0;
00866    for (typename std::vector<Ele>::const_iterator ele_i = elecs->begin(); ele_i != elecs->end(); ++ele_i) {
00867       if (!(goodSusyElectron(&(*ele_i)) && ele_i->pt() > RAL_elec_pt_cut_))
00868          continue;
00869       nElectrons++;
00870 
00871       hRAL_pt_elecs_->Fill(ele_i->pt());
00872       hRAL_eta_elecs_->Fill(ele_i->eta());
00873       hRAL_phi_elecs_->Fill(ele_i->phi());
00874 
00875       hRAL_Iso_elecs_->Fill(ele_i->dr03TkSumPt() + ele_i->dr03EcalRecHitSumEt() + ele_i->dr03HcalTowerSumEt());
00876 
00877       //Electron electron pairs
00878       for (typename std::vector<Ele>::const_iterator ele_j = elecs->begin(); ele_j != elecs->end(); ++ele_j) {
00879          if (ele_i >= ele_j)
00880             continue;
00881          if (!(goodSusyElectron(&(*ele_j)) && ele_j->pt() > RAL_elec_pt_cut_))
00882             continue;
00883 
00884          inv = (ele_i->p4() + ele_j->p4()).M();
00885          if (ele_i->charge() * ele_j->charge() > 0) {
00886             ++nSSee;
00887             hRAL_mass_SS_ee_->Fill(inv);
00888          }
00889          if (ele_i->charge() * ele_j->charge() < 0) {
00890             ++nOSee;
00891             hRAL_mass_OS_ee_->Fill(inv);
00892          }
00893       }
00894    }
00895 
00896    hRAL_N_elecs_->Fill(nElectrons);
00897 
00898    if (MET > RAL_met_cut_ && sumPt > RAL_jet_sum_pt_cut_) {
00899       if (nMuons >= 1) {
00900          hRAL_Muon_monitor_->Fill(sumPt, MET);
00901       }
00902       if (nElectrons >= 1) {
00903          hRAL_Electron_monitor_->Fill(sumPt, MET);
00904       }
00905       if (nOSee >= 1) {
00906          hRAL_OSee_monitor_->Fill(sumPt, MET);
00907       }
00908       if (nOSemu >= 1) {
00909          hRAL_OSemu_monitor_->Fill(sumPt, MET);
00910       }
00911       if (nOSmumu >= 1) {
00912          hRAL_OSmumu_monitor_->Fill(sumPt, MET);
00913       }
00914       if (nSSee >= 1) {
00915          hRAL_SSee_monitor_->Fill(sumPt, MET);
00916       }
00917       if (nSSemu >= 1) {
00918          hRAL_SSemu_monitor_->Fill(sumPt, MET);
00919       }
00920       if (nSSmumu >= 1) {
00921          hRAL_SSmumu_monitor_->Fill(sumPt, MET);
00922       }
00923    }
00924    if (nMuons >= 3) {
00925       hRAL_TriMuon_monitor_->Fill(sumPt, MET);
00926    }
00927 
00928 }
00929 
00930 template<typename Mu, typename Ele, typename Jet, typename Met>
00931 void SusyDQM<Mu, Ele, Jet, Met>::endRun(const edm::Run& run) {
00932 
00933 }
00934 
00935 template<typename Mu, typename Ele, typename Jet, typename Met>
00936 void SusyDQM<Mu, Ele, Jet, Met>::endJob() {
00937 
00938 }
00939 
00940 #endif
00941 
00942 typedef SusyDQM<reco::Muon, reco::GsfElectron, reco::CaloJet, reco::CaloMET> RecoSusyDQM;
00943 //typedef SusyDQM< pat::Muon, pat::Electron, pat::Jet, pat::MET > PatSusyDQM;