CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch12/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 
00309    RAL_met_cut_ = pset.getParameter<double> ("RAL_met_cut");
00310 }
00311 
00312 template<typename Mu, typename Ele, typename Jet, typename Met>
00313 SusyDQM<Mu, Ele, Jet, Met>::~SusyDQM() {
00314 
00315 }
00316 
00317 template<typename Mu, typename Ele, typename Jet, typename Met>
00318 void SusyDQM<Mu, Ele, Jet, Met>::initialize() {
00319 
00320 }
00321 
00322 template<typename Mu, typename Ele, typename Jet, typename Met>
00323 void SusyDQM<Mu, Ele, Jet, Met>::beginJob() {
00324 
00325    dbe_ = edm::Service<DQMStore>().operator->();
00326 
00327    dbe_->setCurrentFolder(moduleName_);
00328 
00329    hRA1_pt_jet1_nm1_ = dbe_->book1D("RA1_pt_jet1_nm1", "RA1_pt_jet1_nm1", 50, 0., 1000.);
00330    hRA1_eta_jet1_nm1_ = dbe_->book1D("RA1_eta_jet1_nm1", "RA1_eta_jet1_nm1", 50, -5., 5.);
00331    hRA1_pt_jet2_nm1_ = dbe_->book1D("RA1_pt_jet2_nm1", "RA1_pt_jet2_nm1", 50, 0., 1000.);
00332    hRA1_eta_jet2_nm1_ = dbe_->book1D("RA1_eta_jet2_nm1", "RA1_eta_jet2_nm1", 50, -5., 5.);
00333    hRA1_pt_jet3_nm1_ = dbe_->book1D("RA1_pt_jet3_nm1", "RA1_pt_jet3_nm1", 50, 0., 1000.);
00334    hRA1_deltaPhi_mht_jets_nm1_ = dbe_->book1D("RA1_deltaPhi_mht_jets_nm1", "RA1_deltaPhi_mht_jets_nm1", 50, 0., 2.);
00335    hRA1_deltaPhi_jets_nm1_ = dbe_->book1D("RA1_deltaPhi_jets_nm1", "RA1_deltaPhi_jets_nm1", 50, 0., 4.);
00336    hRA1_ht_nm1_ = dbe_->book1D("RA1_ht_nm1", "RA1_ht_nm1", 50, 0., 1000.);
00337    hRA1_mht_nm1_ = dbe_->book1D("RA1_mht_nm1", "RA1_mht_nm1", 50, 0., 1000.);
00338    hRA1_alphat_nm1_ = dbe_->book1D("RA1_alphat_nm1", "RA1_alphat_nm1", 50, 0., 2.);
00339    hRA1_pt_muons_nm1_ = dbe_->book1D("RA1_pt_muons_nm1", "RA1_pt_muons_nm1", 50, 0., 200.);
00340    hRA1_pt_elecs_nm1_ = dbe_->book1D("RA1_pt_elecs_nm1", "RA1_pt_elecs_nm1", 50, 0., 200.);
00341 
00342    hRA2_N_jets_nm1_ = dbe_->book1D("RA2_N_jets_nm1", "RA2_N_jets_nm1", 10, 0., 10.);
00343    hRA2_pt_jet1_nm1_ = dbe_->book1D("RA2_pt_jet1_nm1", "RA2_pt_jet1_nm1", 50, 0., 1000.);
00344    hRA2_eta_jet1_nm1_ = dbe_->book1D("RA2_eta_jet1_nm1", "RA2_eta_jet1_nm1", 50, -5., 5.);
00345    hRA2_pt_jet2_nm1_ = dbe_->book1D("RA2_pt_jet2_nm1", "RA2_pt_jet2_nm1", 50, 0., 1000.);
00346    hRA2_eta_jet2_nm1_ = dbe_->book1D("RA2_eta_jet2_nm1", "RA2_eta_jet2_nm1", 50, -5., 5.);
00347    hRA2_pt_jet3_nm1_ = dbe_->book1D("RA2_pt_jet3_nm1", "RA2_pt_jet3_nm1", 50, 0., 1000.);
00348    hRA2_eta_jet3_nm1_ = dbe_->book1D("RA2_eta_jet3_nm1", "RA2_eta_jet3_nm1", 50, -5., 5.);
00349    hRA2_deltaPhi_mht_jets_nm1_ = dbe_->book1D("RA2_deltaPhi_mht_jets_nm1", "RA2_deltaPhi_mht_jets_nm1", 50, 0., 2.);
00350    hRA2_ht_nm1_ = dbe_->book1D("RA2_ht_nm1", "RA2_ht_nm1", 50, 0., 2000.);
00351    hRA2_mht_nm1_ = dbe_->book1D("RA2_mht_nm1", "RA2_mht_nm1", 50, 0., 1000.);
00352    hRA2_pt_muons_nm1_ = dbe_->book1D("RA2_pt_muons_nm1", "RA2_pt_muons_nm1", 50, 0., 200.);
00353    hRA2_pt_elecs_nm1_ = dbe_->book1D("RA2_pt_elecs_nm1", "RA2_pt_elecs_nm1", 50, 0., 200.);
00354 
00355    hRA1_pt_jet1_ = dbe_->book1D("RA1_pt_jet1", "RA1_pt_jet1", 50, 0., 1000.);
00356    hRA1_eta_jet1_ = dbe_->book1D("RA1_eta_jet1", "RA1_eta_jet1", 50, -5., 5.);
00357    hRA1_pt_jet2_ = dbe_->book1D("RA1_pt_jet2", "RA1_pt_jet2", 50, 0., 1000.);
00358    hRA1_eta_jet2_ = dbe_->book1D("RA1_eta_jet2", "RA1_eta_jet2", 50, -5., 5.);
00359    hRA1_pt_jet3_ = dbe_->book1D("RA1_pt_jet3", "RA1_pt_jet3", 50, 0., 1000.);
00360    hRA1_deltaPhi_mht_jets_ = dbe_->book1D("RA1_deltaPhi_mht_jets", "RA1_deltaPhi_mht_jets", 50, 0., 2.);
00361    hRA1_deltaPhi_jets_ = dbe_->book1D("RA1_deltaPhi_jets", "RA1_deltaPhi_jets", 50, 0., 4.);
00362    hRA1_ht_ = dbe_->book1D("RA1_ht", "RA1_ht", 50, 0., 1000.);
00363    hRA1_mht_ = dbe_->book1D("RA1_mht", "RA1_mht", 50, 0., 1000.);
00364    hRA1_alphat_ = dbe_->book1D("RA1_alphat", "RA1_alphat", 50, 0., 2.);
00365    hRA1_pt_muons_ = dbe_->book1D("RA1_pt_muons", "RA1_pt_muons", 50, 0., 200.);
00366    hRA1_pt_elecs_ = dbe_->book1D("RA1_pt_elecs", "RA1_pt_elecs", 50, 0., 200.);
00367 
00368    hRA2_N_jets_ = dbe_->book1D("RA2_N_jets", "RA2_N_jets", 10, 0., 10.);
00369    hRA2_pt_jet1_ = dbe_->book1D("RA2_pt_jet1", "RA2_pt_jet1", 50, 0., 1000.);
00370    hRA2_eta_jet1_ = dbe_->book1D("RA2_eta_jet1", "RA2_eta_jet1", 50, -5., 5.);
00371    hRA2_pt_jet2_ = dbe_->book1D("RA2_pt_jet2", "RA2_pt_jet2", 50, 0., 1000.);
00372    hRA2_eta_jet2_ = dbe_->book1D("RA2_eta_jet2", "RA2_eta_jet2", 50, -5., 5.);
00373    hRA2_pt_jet3_ = dbe_->book1D("RA2_pt_jet3", "RA2_pt_jet3", 50, 0., 1000.);
00374    hRA2_eta_jet3_ = dbe_->book1D("RA2_eta_jet3", "RA2_eta_jet3", 50, -5., 5.);
00375    hRA2_deltaPhi_mht_jets_ = dbe_->book1D("RA2_deltaPhi_mht_jets", "RA2_deltaPhi_mht_jets", 50, 0., 2.);
00376    hRA2_ht_ = dbe_->book1D("RA2_ht", "RA2_ht", 50, 0., 2000.);
00377    hRA2_mht_ = dbe_->book1D("RA2_mht", "RA2_mht", 50, 0., 1000.);
00378    hRA2_pt_muons_ = dbe_->book1D("RA2_pt_muons", "RA2_pt_muons", 50, 0., 200.);
00379    hRA2_pt_elecs_ = dbe_->book1D("RA2_pt_elecs", "RA2_pt_elecs", 50, 0., 200.);
00380 
00381    hRAL_N_muons_ = dbe_->book1D("RAL_N_muons", "RAL_N_muons", 10, 0., 10.);
00382    hRAL_pt_muons_ = dbe_->book1D("RAL_pt_muons", "RAL_pt_muons", 50, 0., 300.);
00383    hRAL_eta_muons_ = dbe_->book1D("RAL_eta_muons", "RAL_eta_muons", 50, -2.5, 2.5);
00384    hRAL_phi_muons_ = dbe_->book1D("RAL_phi_muons", "RAL_phi_muons", 50, -4., 4.);
00385    hRAL_Iso_muons_ = dbe_->book1D("RAL_Iso_muons", "RAL_Iso_muons", 50, 0., 25.);
00386 
00387    hRAL_N_elecs_ = dbe_->book1D("RAL_N_elecs", "RAL_N_elecs", 10, 0., 10.);
00388    hRAL_pt_elecs_ = dbe_->book1D("RAL_pt_elecs", "RAL_pt_elecs", 50, 0., 300.);
00389    hRAL_eta_elecs_ = dbe_->book1D("RAL_eta_elecs", "RAL_eta_elecs", 50, -2.5, 2.5);
00390    hRAL_phi_elecs_ = dbe_->book1D("RAL_phi_elecs", "RAL_phi_elecs", 50, -4., 4.);
00391    hRAL_Iso_elecs_ = dbe_->book1D("RAL_Iso_elecs", "RAL_Iso_elecs", 50, 0., 25.);
00392 
00393    hRAL_Sum_pt_jets_ = dbe_->book1D("RAL_Sum_pt_jets", "RAL_Sum_pt_jets", 50, 0., 2000.);
00394    hRAL_Met_ = dbe_->book1D("RAL_Met", "RAL_Met", 50, 0., 1000.);
00395 
00396    hRAL_dR_emu_ = dbe_->book1D("RAL_deltaR_emu", "RAL_deltaR_emu", 50, 0., 10.);
00397 
00398    hRAL_mass_OS_mumu_ = dbe_->book1D("RAL_mass_OS_mumu", "RAL_mass_OS_mumu", 50, 0., 300.);
00399    hRAL_mass_OS_ee_ = dbe_->book1D("RAL_mass_OS_ee", "RAL_mass_OS_ee", 50, 0., 300.);
00400    hRAL_mass_OS_emu_ = dbe_->book1D("RAL_mass_OS_emu", "RAL_mass_OS_emu", 50, 0., 300.);
00401    hRAL_mass_SS_mumu_ = dbe_->book1D("RAL_mass_SS_mumu", "RAL_mass_SS_mumu", 50, 0., 300.);
00402    hRAL_mass_SS_ee_ = dbe_->book1D("RAL_mass_SS_ee", "RAL_mass_SS_ee", 50, 0., 300.);
00403    hRAL_mass_SS_emu_ = dbe_->book1D("RAL_mass_SS_emu", "RAL_mass_SS_emu", 50, 0., 300.);
00404 
00405    hRAL_Muon_monitor_ = dbe_->book2D("RAL_Single_Muon_Selection", "RAL_Single_Muon_Selection", 50, 0., 1000., 50, 0.,
00406          1000.);
00407    hRAL_Electron_monitor_ = dbe_->book2D("RAL_Single_Electron_Selection", "RAL_Single_Electron_Selection", 50, 0.,
00408          1000., 50, 0., 1000.);
00409    hRAL_OSee_monitor_ = dbe_->book2D("RAL_OS_Electron_Selection", "RAL_OS_Electron_Selection", 50, 0., 1000., 50, 0.,
00410          1000.);
00411    hRAL_OSemu_monitor_ = dbe_->book2D("RAL_OS_ElectronMuon_Selection", "RAL_OS_ElectronMuon_Selection", 50, 0., 1000.,
00412          50, 0., 1000.);
00413    hRAL_OSmumu_monitor_ = dbe_->book2D("RAL_OS_Muon_Selection", "RAL_OS_Muon_Selection", 50, 0., 1000., 50, 0., 1000.);
00414    hRAL_SSee_monitor_ = dbe_->book2D("RAL_SS_Electron_Selection", "RAL_SS_Electron_Selection", 50, 0., 1000., 50, 0.,
00415          1000.);
00416    hRAL_SSemu_monitor_ = dbe_->book2D("RAL_SS_ElectronMuon_Selection", "RAL_SS_ElectronMuon_Selection", 50, 0., 1000.,
00417          50, 0., 1000.);
00418    hRAL_SSmumu_monitor_ = dbe_->book2D("RAL_SS_Muon_Selection", "RAL_SS_Muon_Selection", 50, 0., 1000., 50, 0., 1000.);
00419    hRAL_TriMuon_monitor_ = dbe_->book2D("RAL_Tri_Muon_Selection", "RAL_Tri_Muon_Selection", 50, 0., 1000., 50, 0.,
00420          1000.);
00421 
00422 }
00423 
00424 template<typename Mu, typename Ele, typename Jet, typename Met>
00425 void SusyDQM<Mu, Ele, Jet, Met>::beginRun(const edm::Run& run) {
00426 
00427 }
00428 
00429 template<typename Mu, typename Ele, typename Jet, typename Met>
00430 bool SusyDQM<Mu, Ele, Jet, Met>::goodSusyElectron(const Ele* ele) {
00431    //   if (ele->pt() < elec_pt_cut_)
00432    //      return false;
00433    if (fabs(ele->eta()) > elec_eta_cut_)
00434       return false;
00435    //   if (ele->mva() < elec_mva_cut_)
00436    //      return false;
00437    if (fabs(ele->gsfTrack()->dxy(bs)) > elec_d0_cut_)
00438       return false;
00439    return true;
00440 }
00441 
00442 template<typename Mu, typename Ele, typename Jet, typename Met>
00443 bool SusyDQM<Mu, Ele, Jet, Met>::goodSusyMuon(const Mu* mu) {
00444    //   if (mu->pt() < muon_pt_cut_)
00445    //      return false;
00446    if (fabs(mu->eta()) > muon_eta_cut_)
00447       return false;
00448    if (!mu->isGlobalMuon())
00449       return false;
00450    if (mu->innerTrack()->numberOfValidHits() < muon_nHits_cut_)
00451       return false;
00452    if (mu->globalTrack()->normalizedChi2() > muon_nChi2_cut_)
00453       return false;
00454    if (fabs(mu->innerTrack()->dxy(bs)) > muon_d0_cut_)
00455       return false;
00456    return true;
00457 }
00458 
00459 template<typename Mu, typename Ele, typename Jet, typename Met>
00460 void SusyDQM<Mu, Ele, Jet, Met>::analyze(const edm::Event& evt, const edm::EventSetup& iSetup) {
00461 
00462    edm::Handle<std::vector<Mu> > muons;
00463    bool isFound = evt.getByLabel(muons_, muons);
00464    if (!isFound)
00465       return;
00466 
00467    edm::Handle<std::vector<Ele> > elecs;
00468    isFound = evt.getByLabel(electrons_, elecs);
00469    if (!isFound)
00470       return;
00471 
00472    //edm::Handle<std::vector<Jet> > jets;
00473    //evt.getByLabel(jets_, jets);
00474 
00476    edm::Handle<std::vector<Jet> > cJets;
00477    isFound = evt.getByLabel(jets_, cJets);
00478    if (!isFound)
00479       return;
00480    std::vector<Jet> jets = *cJets;
00481    std::sort(jets.begin(), jets.end(), PtGreater());
00482 
00483    edm::Handle<std::vector<Met> > mets;
00484    isFound = evt.getByLabel(met_, mets);
00485    if (!isFound)
00486       return;
00487 
00488    edm::Handle<reco::VertexCollection> vertices;
00489    isFound = evt.getByLabel(vertex_, vertices);
00490    if (!isFound)
00491       return;
00492 
00494    // Hadronic DQM histos
00496 
00497    float RA1_HT = 0.;
00498    math::PtEtaPhiMLorentzVector RA1_vMHT(0., 0., 0., 0.);
00499    int RA1_nJets = 0;
00500    float RA1_jet1_pt = 0;
00501    float RA1_jet1_eta = 0;
00502    float RA1_jet1_emf = 0;
00503    float RA1_jet2_pt = 0;
00504    float RA1_jet2_eta = 0;
00505    float RA1_jet2_emf = 0;
00506    float RA1_jet3_pt = 0;
00507    math::PtEtaPhiMLorentzVector RA1_leading(0., 0., 0., 0.);
00508    math::PtEtaPhiMLorentzVector RA1_second(0., 0., 0., 0.);
00509    int i_jet = 0;
00510    for (typename std::vector<Jet>::const_iterator jet_i = jets.begin(); jet_i != jets.end(); ++jet_i) {
00511       if (i_jet == 0) {
00512          RA1_leading = jet_i->p4();
00513          RA1_jet1_pt = jet_i->pt();
00514          RA1_jet1_eta = jet_i->eta();
00515          RA1_jet1_emf = jet_i->emEnergyFraction();
00516       }
00517       if (i_jet == 1) {
00518          RA1_second = jet_i->p4();
00519          RA1_jet2_pt = jet_i->pt();
00520          RA1_jet2_eta = jet_i->eta();
00521          RA1_jet2_emf = jet_i->emEnergyFraction();
00522       }
00523       if (i_jet == 2)
00524          RA1_jet3_pt = jet_i->pt();
00525       if (jet_i->pt() > RA1_jet_pt_cut_ && fabs(jet_i->eta()) < RA1_jet_eta_cut_) {
00526          ++RA1_nJets;
00527          RA1_HT += jet_i->pt();
00528          RA1_vMHT -= jet_i->p4();
00529       }
00530       ++i_jet;
00531    }
00532    float RA1_MHT = RA1_vMHT.pt();
00533 
00534    i_jet = 0;
00535    float RA1_minDeltaPhi = 9999.;
00536    for (typename std::vector<Jet>::const_iterator jet_i = jets.begin(); jet_i != jets.end(); ++jet_i) {
00537       if (i_jet <= 2) {
00538          double deltaPhi_tmp = fabs(deltaPhi(jet_i->phi(), RA1_vMHT.phi()));
00539          if (deltaPhi_tmp < RA1_minDeltaPhi)
00540             RA1_minDeltaPhi = deltaPhi_tmp;
00541       }
00542       ++i_jet;
00543    }
00544 
00545    float RA1_alphat = 0;
00546    float RA1_DeltaPhiJets = 9999.;
00547    if (RA1_nJets >= 2) {
00548       RA1_DeltaPhiJets = fabs(deltaPhi(RA1_leading.phi(), RA1_second.phi()));
00549       // wrong definition PDG (July 2008) Eq. 38.38
00550       //RA1_alphat = RA1_second.Et() / (RA1_leading + RA1_second).Mt();
00551       // right definition PDG (July 2008) Eq. 38.61
00552       RA1_alphat = RA1_second.Et() / sqrt(2* RA1_leading .Et() * RA1_second.Et() * (1 - cos(RA1_DeltaPhiJets)));
00553    }
00554 
00555    float RA2_HT = 0.;
00556    math::PtEtaPhiMLorentzVector RA2_vMHT(0., 0., 0., 0.);
00557    int RA2_nJets = 0;
00558    float RA2_jet1_pt = 0;
00559    float RA2_jet1_eta = 0;
00560    float RA2_jet1_emf = 0;
00561    float RA2_jet2_pt = 0;
00562    float RA2_jet2_eta = 0;
00563    float RA2_jet2_emf = 0;
00564    float RA2_jet3_pt = 0;
00565    float RA2_jet3_eta = 0;
00566    float RA2_jet3_emf = 0;
00567    i_jet = 0;
00568    for (typename std::vector<Jet>::const_iterator jet_i = jets.begin(); jet_i != jets.end(); ++jet_i) {
00569       if (i_jet == 0) {
00570          RA2_jet1_pt = jet_i->pt();
00571          RA2_jet1_eta = jet_i->eta();
00572          RA2_jet1_emf = jet_i->emEnergyFraction();
00573       }
00574       if (i_jet == 1) {
00575          RA2_jet2_pt = jet_i->pt();
00576          RA2_jet2_eta = jet_i->eta();
00577          RA2_jet2_emf = jet_i->emEnergyFraction();
00578       }
00579       if (i_jet == 2) {
00580          RA2_jet3_pt = jet_i->pt();
00581          RA2_jet3_eta = jet_i->eta();
00582          RA2_jet3_emf = jet_i->emEnergyFraction();
00583       }
00584       if (jet_i->pt() > RA2_jet_pt_cut_ && fabs(jet_i->eta()) < RA2_jet_eta_cut_) {
00585          ++RA2_nJets;
00586          RA2_HT += jet_i->pt();
00587          RA2_vMHT -= jet_i->p4();
00588       }
00589       ++i_jet;
00590    }
00591    float RA2_MHT = RA2_vMHT.pt();
00592 
00593    i_jet = 0;
00594    float RA2_minDeltaPhi = 9999.;
00595    for (typename std::vector<Jet>::const_iterator jet_i = jets.begin(); jet_i != jets.end(); ++jet_i) {
00596       if (jet_i->pt() < RA2_jet_pt_cut_)
00597          continue;
00598       if (i_jet <= 2) {
00599          double deltaPhi_tmp = fabs(deltaPhi(jet_i->phi(), RA1_vMHT.phi()));
00600          if (deltaPhi_tmp < RA2_minDeltaPhi)
00601             RA2_minDeltaPhi = deltaPhi_tmp;
00602       }
00603       ++i_jet;
00604    }
00605 
00606    for (reco::VertexCollection::const_iterator vertex = vertices->begin(); vertex != vertices->end(); ++vertex) {
00607       bs = vertex->position();
00608       break;
00609    }
00610 
00611    float leadingMuPt = 0;
00612    for (typename std::vector<Mu>::const_iterator mu_i = muons->begin(); mu_i != muons->end(); ++mu_i) {
00613       if (!goodSusyMuon(&(*mu_i)))
00614          continue;
00615 
00616       reco::MuonIsolation Iso_muon = mu_i->isolationR03();
00617       float muIso = (Iso_muon.emEt + Iso_muon.hadEt + Iso_muon.sumPt) / mu_i->pt();
00618 
00619       if (muIso < RA12_muon_iso_cut_) {
00620          if (mu_i->pt() > leadingMuPt)
00621             leadingMuPt = mu_i->pt();
00622       }
00623    }
00624 
00625    float leadingElecPt = 0;
00626    for (typename std::vector<Ele>::const_iterator ele_i = elecs->begin(); ele_i != elecs->end(); ++ele_i) {
00627       if (!goodSusyElectron(&(*ele_i)))
00628          continue;
00629 
00630       float elecIso = (ele_i->dr03TkSumPt() + ele_i->dr03EcalRecHitSumEt() + ele_i->dr03HcalTowerSumEt()) / ele_i->pt();
00631 
00632       if (elecIso < RA12_elec_iso_cut_) {
00633          if (ele_i->pt() > leadingElecPt)
00634             leadingElecPt = ele_i->pt();
00635       }
00636    }
00637 
00639    if (RA1_jet1_emf >= RA1_jet_min_emf_cut_ && RA1_jet1_emf <= RA1_jet_max_emf_cut_ && RA1_jet2_emf
00640          >= RA1_jet_min_emf_cut_ && RA1_jet2_emf <= RA1_jet_max_emf_cut_) {
00641       hRA1_pt_jet1_->Fill(RA1_jet1_pt);
00642       hRA1_eta_jet1_->Fill(RA1_jet1_eta);
00643       hRA1_pt_jet2_->Fill(RA1_jet2_pt);
00644       hRA1_eta_jet2_->Fill(RA1_jet2_eta);
00645       hRA1_pt_jet3_->Fill(RA1_jet3_pt);
00646       hRA1_deltaPhi_mht_jets_->Fill(RA1_minDeltaPhi);
00647       hRA1_deltaPhi_jets_->Fill(RA1_DeltaPhiJets);
00648       hRA1_ht_->Fill(RA1_HT);
00649       hRA1_mht_->Fill(RA1_MHT);
00650       hRA1_alphat_->Fill(RA1_alphat);
00651       hRA1_pt_muons_->Fill(leadingMuPt);
00652       hRA1_pt_elecs_->Fill(leadingElecPt);
00653       for (int i = 0; i < 12; ++i) {
00654          if (RA1_jet1_pt > RA1_jet1_pt_cut_ || i == 0) {
00655             if (fabs(RA1_jet1_eta) < RA1_jet1_eta_cut_ || i == 1) {
00656                if (RA1_jet2_pt > RA1_jet2_pt_cut_ || i == 2) {
00657                   if (fabs(RA1_jet2_eta) < RA1_jet2_eta_cut_ || i == 3) {
00658                      if (RA1_jet3_pt < RA1_jet3_pt_cut_ || i == 4) {
00659                         if (RA1_minDeltaPhi >= RA1_deltaPhi_cut_ || i == 5) {
00660                            if (RA1_DeltaPhiJets <= RA1_deltaPhiJets_cut_ || i == 6) {
00661                               if (RA1_HT >= RA1_ht_cut_ || i == 7) {
00662                                  if (RA1_MHT >= RA1_mht_cut_ || i == 8) {
00663                                     if (RA1_alphat >= RA1_alphat_cut_ || i == 9) {
00664                                        if (leadingMuPt <= RA12_muon_pt_cut_ || i == 10) {
00665                                           if (leadingElecPt <= RA12_elec_pt_cut_ || i == 11) {
00666                                              if (i == 0)
00667                                                 hRA1_pt_jet1_nm1_->Fill(RA1_jet1_pt);
00668                                              if (i == 1)
00669                                                 hRA1_eta_jet1_nm1_->Fill(RA1_jet1_eta);
00670                                              if (i == 2)
00671                                                 hRA1_pt_jet2_nm1_->Fill(RA1_jet2_pt);
00672                                              if (i == 3)
00673                                                 hRA1_eta_jet2_nm1_->Fill(RA1_jet2_eta);
00674                                              if (i == 4)
00675                                                 hRA1_pt_jet3_nm1_->Fill(RA1_jet3_pt);
00676                                              if (i == 5)
00677                                                 hRA1_deltaPhi_mht_jets_nm1_->Fill(RA1_minDeltaPhi);
00678                                              if (i == 6)
00679                                                 hRA1_deltaPhi_jets_nm1_->Fill(RA1_DeltaPhiJets);
00680                                              if (i == 7)
00681                                                 hRA1_ht_nm1_->Fill(RA1_HT);
00682                                              if (i == 8)
00683                                                 hRA1_mht_nm1_->Fill(RA1_MHT);
00684                                              if (i == 9)
00685                                                 hRA1_alphat_nm1_->Fill(RA1_alphat);
00686                                              if (i == 10)
00687                                                 hRA1_pt_muons_nm1_->Fill(leadingMuPt);
00688                                              if (i == 11)
00689                                                 hRA1_pt_elecs_nm1_->Fill(leadingElecPt);
00690                                           }
00691                                        }
00692                                     }
00693                                  }
00694                               }
00695                            }
00696                         }
00697                      }
00698                   }
00699                }
00700             }
00701          }
00702       }
00703    }
00704 
00706    if (RA2_jet1_emf >= RA2_jet_min_emf_cut_ && RA2_jet1_emf <= RA2_jet_max_emf_cut_ && RA2_jet2_emf
00707          >= RA2_jet_min_emf_cut_ && RA2_jet2_emf <= RA2_jet_max_emf_cut_ && RA2_jet3_emf >= RA2_jet_min_emf_cut_
00708          && RA2_jet3_emf <= RA2_jet_max_emf_cut_) {
00709       hRA2_N_jets_->Fill(RA2_nJets);
00710       hRA2_pt_jet1_->Fill(RA2_jet1_pt);
00711       hRA2_eta_jet1_->Fill(RA2_jet1_eta);
00712       hRA2_pt_jet2_->Fill(RA2_jet2_pt);
00713       hRA2_eta_jet2_->Fill(RA2_jet2_eta);
00714       hRA2_pt_jet3_->Fill(RA2_jet3_pt);
00715       hRA2_eta_jet3_->Fill(RA2_jet3_eta);
00716       hRA2_deltaPhi_mht_jets_->Fill(RA2_minDeltaPhi);
00717       hRA2_ht_->Fill(RA2_HT);
00718       hRA2_mht_->Fill(RA2_MHT);
00719       hRA2_pt_muons_->Fill(leadingMuPt);
00720       hRA2_pt_elecs_->Fill(leadingElecPt);
00721       for (int i = 0; i < 12; ++i) {
00722          if (RA2_nJets >= RA2_N_jets_cut_ || i == 0) {
00723             if (RA2_jet1_pt > RA2_jet1_pt_cut_ || i == 1) {
00724                if (fabs(RA2_jet1_eta) < RA2_jet1_eta_cut_ || i == 2) {
00725                   if (RA2_jet2_pt > RA2_jet2_pt_cut_ || i == 3) {
00726                      if (fabs(RA2_jet2_eta) < RA2_jet2_eta_cut_ || i == 4) {
00727                         if (RA2_jet3_pt > RA2_jet3_pt_cut_ || i == 5) {
00728                            if (fabs(RA2_jet3_eta) < RA2_jet3_eta_cut_ || i == 6) {
00729                               if (RA2_minDeltaPhi >= RA2_deltaPhi_cut_ || i == 7) {
00730                                  if (RA2_HT >= RA2_ht_cut_ || i == 8) {
00731                                     if (RA2_MHT >= RA2_mht_cut_ || i == 9) {
00732                                        if (leadingMuPt <= RA12_muon_pt_cut_ || i == 10) {
00733                                           if (leadingElecPt <= RA12_elec_pt_cut_ || i == 11) {
00734                                              if (i == 0)
00735                                                 hRA2_N_jets_nm1_->Fill(RA2_nJets);
00736                                              if (i == 1)
00737                                                 hRA2_pt_jet1_nm1_->Fill(RA2_jet1_pt);
00738                                              if (i == 2)
00739                                                 hRA2_eta_jet1_nm1_->Fill(RA2_jet1_eta);
00740                                              if (i == 3)
00741                                                 hRA2_pt_jet2_nm1_->Fill(RA2_jet2_pt);
00742                                              if (i == 4)
00743                                                 hRA2_eta_jet2_nm1_->Fill(RA2_jet2_eta);
00744                                              if (i == 5)
00745                                                 hRA2_pt_jet3_nm1_->Fill(RA2_jet3_pt);
00746                                              if (i == 6)
00747                                                 hRA2_eta_jet3_nm1_->Fill(RA2_jet3_eta);
00748                                              if (i == 7)
00749                                                 hRA2_deltaPhi_mht_jets_nm1_->Fill(RA2_minDeltaPhi);
00750                                              if (i == 8)
00751                                                 hRA2_ht_nm1_->Fill(RA2_HT);
00752                                              if (i == 9)
00753                                                 hRA2_mht_nm1_->Fill(RA2_MHT);
00754                                              if (i == 10)
00755                                                 hRA2_pt_muons_nm1_->Fill(leadingMuPt);
00756                                              if (i == 11)
00757                                                 hRA2_pt_elecs_nm1_->Fill(leadingElecPt);
00758                                           }
00759                                        }
00760                                     }
00761                                  }
00762                               }
00763                            }
00764                         }
00765                      }
00766                   }
00767                }
00768             }
00769          }
00770       }
00771    }
00772 
00774    // Leptonic DQM histos
00776 
00777    float sumPt = 0.;
00778    for (typename std::vector<Jet>::const_iterator jet_i = jets.begin(); jet_i != jets.end(); ++jet_i) {
00779       if (jet_i->pt() < RAL_jet_pt_cut_)
00780          continue;
00781       if (fabs(jet_i->eta()) > RAL_jet_eta_cut_)
00782          continue;
00783       if (fabs(jet_i->eta()) > RAL_jet_eta_cut_)
00784          continue;
00785       if (jet_i->emEnergyFraction() < RAL_jet_min_emf_cut_)
00786          continue;
00787       if (jet_i->emEnergyFraction() > RAL_jet_max_emf_cut_)
00788          continue;
00789       sumPt += jet_i->pt();
00790    }
00791 
00792    hRAL_Sum_pt_jets_->Fill(sumPt);
00793 
00794    float MET = 0.;
00795    for (typename std::vector<Met>::const_iterator met_i = mets->begin(); met_i != mets->end(); ++met_i) {
00796       MET = met_i->pt();
00797       break;
00798    }
00799 
00800    hRAL_Met_->Fill(MET);
00801 
00802    int nMuons = 0;
00803    int nSSmumu = 0;
00804    int nOSmumu = 0;
00805    int nSSemu = 0;
00806    int nOSemu = 0;
00807    float inv = 0.;
00808    float dR = 0.;
00809 
00810    for (typename std::vector<Mu>::const_iterator mu_i = muons->begin(); mu_i != muons->end(); ++mu_i) {
00811       if (!(goodSusyMuon(&(*mu_i)) && mu_i->pt() > RAL_muon_pt_cut_))
00812          continue;
00813       ++nMuons;
00814 
00815       hRAL_pt_muons_->Fill(mu_i->pt());
00816       hRAL_eta_muons_->Fill(mu_i->eta());
00817       hRAL_phi_muons_->Fill(mu_i->phi());
00818 
00819       reco::MuonIsolation muIso = mu_i->isolationR03();
00820       hRAL_Iso_muons_->Fill(muIso.emEt + muIso.hadEt + muIso.sumPt);
00821 
00822       //Muon muon pairs
00823       for (typename std::vector<Mu>::const_iterator mu_j = muons->begin(); mu_j != muons->end(); ++mu_j) {
00824          if (mu_i >= mu_j)
00825             continue;
00826          if (!(goodSusyMuon(&(*mu_j)) && mu_j->pt() > RAL_muon_pt_cut_))
00827             continue;
00828 
00829          inv = (mu_i->p4() + mu_j->p4()).M();
00830          if (mu_i->charge() * mu_j->charge() > 0) {
00831             ++nSSmumu;
00832             hRAL_mass_SS_mumu_->Fill(inv);
00833          }
00834          if (mu_i->charge() * mu_j->charge() < 0) {
00835             ++nOSmumu;
00836             hRAL_mass_OS_mumu_->Fill(inv);
00837          }
00838       }
00839 
00840       //Electron muon pairs
00841       for (typename std::vector<Ele>::const_iterator ele_j = elecs->begin(); ele_j != elecs->end(); ++ele_j) {
00842          if (!(goodSusyElectron(&(*ele_j)) && ele_j->pt() > RAL_elec_pt_cut_))
00843             continue;
00844          inv = (mu_i->p4() + ele_j->p4()).M();
00845          dR = deltaR(*mu_i, *ele_j);
00846          hRAL_dR_emu_->Fill(dR);
00847          if (mu_i->charge() * ele_j->charge() > 0) {
00848             ++nSSemu;
00849             hRAL_mass_SS_emu_->Fill(inv);
00850          }
00851          if (mu_i->charge() * ele_j->charge() < 0) {
00852             ++nOSemu;
00853             hRAL_mass_OS_emu_->Fill(inv);
00854          }
00855       }
00856    }
00857 
00858    hRAL_N_muons_->Fill(nMuons);
00859 
00860    int nElectrons = 0;
00861    int nSSee = 0;
00862    int nOSee = 0;
00863    for (typename std::vector<Ele>::const_iterator ele_i = elecs->begin(); ele_i != elecs->end(); ++ele_i) {
00864       if (!(goodSusyElectron(&(*ele_i)) && ele_i->pt() > RAL_elec_pt_cut_))
00865          continue;
00866       nElectrons++;
00867 
00868       hRAL_pt_elecs_->Fill(ele_i->pt());
00869       hRAL_eta_elecs_->Fill(ele_i->eta());
00870       hRAL_phi_elecs_->Fill(ele_i->phi());
00871 
00872       hRAL_Iso_elecs_->Fill(ele_i->dr03TkSumPt() + ele_i->dr03EcalRecHitSumEt() + ele_i->dr03HcalTowerSumEt());
00873 
00874       //Electron electron pairs
00875       for (typename std::vector<Ele>::const_iterator ele_j = elecs->begin(); ele_j != elecs->end(); ++ele_j) {
00876          if (ele_i >= ele_j)
00877             continue;
00878          if (!(goodSusyElectron(&(*ele_j)) && ele_j->pt() > RAL_elec_pt_cut_))
00879             continue;
00880 
00881          inv = (ele_i->p4() + ele_j->p4()).M();
00882          if (ele_i->charge() * ele_j->charge() > 0) {
00883             ++nSSee;
00884             hRAL_mass_SS_ee_->Fill(inv);
00885          }
00886          if (ele_i->charge() * ele_j->charge() < 0) {
00887             ++nOSee;
00888             hRAL_mass_OS_ee_->Fill(inv);
00889          }
00890       }
00891    }
00892 
00893    hRAL_N_elecs_->Fill(nElectrons);
00894 
00895    if (MET > RAL_met_cut_ && sumPt > RAL_jet_sum_pt_cut_) {
00896       if (nMuons >= 1) {
00897          hRAL_Muon_monitor_->Fill(sumPt, MET);
00898       }
00899       if (nElectrons >= 1) {
00900          hRAL_Electron_monitor_->Fill(sumPt, MET);
00901       }
00902       if (nOSee >= 1) {
00903          hRAL_OSee_monitor_->Fill(sumPt, MET);
00904       }
00905       if (nOSemu >= 1) {
00906          hRAL_OSemu_monitor_->Fill(sumPt, MET);
00907       }
00908       if (nOSmumu >= 1) {
00909          hRAL_OSmumu_monitor_->Fill(sumPt, MET);
00910       }
00911       if (nSSee >= 1) {
00912          hRAL_SSee_monitor_->Fill(sumPt, MET);
00913       }
00914       if (nSSemu >= 1) {
00915          hRAL_SSemu_monitor_->Fill(sumPt, MET);
00916       }
00917       if (nSSmumu >= 1) {
00918          hRAL_SSmumu_monitor_->Fill(sumPt, MET);
00919       }
00920    }
00921    if (nMuons >= 3) {
00922       hRAL_TriMuon_monitor_->Fill(sumPt, MET);
00923    }
00924 
00925 }
00926 
00927 template<typename Mu, typename Ele, typename Jet, typename Met>
00928 void SusyDQM<Mu, Ele, Jet, Met>::endRun(const edm::Run& run) {
00929 
00930 }
00931 
00932 template<typename Mu, typename Ele, typename Jet, typename Met>
00933 void SusyDQM<Mu, Ele, Jet, Met>::endJob() {
00934 
00935 }
00936 
00937 #endif
00938 
00939 typedef SusyDQM<reco::Muon, reco::GsfElectron, reco::CaloJet, reco::CaloMET> RecoSusyDQM;
00940 //typedef SusyDQM< pat::Muon, pat::Electron, pat::Jet, pat::MET > PatSusyDQM;