Go to the documentation of this file.00001 #include "DataFormats/Common/interface/AssociationVector.h"
00002 #include "FWCore/Framework/interface/EDAnalyzer.h"
00003 #include "DataFormats/Candidate/interface/Candidate.h"
00004 #include "DataFormats/Candidate/interface/Particle.h"
00005 #include "DataFormats/Candidate/interface/CandidateFwd.h"
00006 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00007 #include "FWCore/Framework/interface/Event.h"
00008 #include "FWCore/Framework/interface/EventSetup.h"
00009 #include "FWCore/Utilities/interface/InputTag.h"
00010 #include "FWCore/ServiceRegistry/interface/Service.h"
00011 #include "CommonTools/UtilAlgos/interface/TFileService.h"
00012 #include "DataFormats/Math/interface/deltaR.h"
00013 #include "DataFormats/PatCandidates/interface/Muon.h"
00014 #include "DataFormats/TrackReco/interface/Track.h"
00015 #include "DataFormats/HepMCCandidate/interface/GenParticle.h"
00016 #include "DataFormats/RecoCandidate/interface/IsoDeposit.h"
00017 #include "DataFormats/RecoCandidate/interface/IsoDepositFwd.h"
00018 #include "DataFormats/PatCandidates/interface/Isolation.h"
00019 #include "DataFormats/Common/interface/ValueMap.h"
00020 #include "DataFormats/PatCandidates/interface/GenericParticle.h"
00021 #include "DataFormats/RecoCandidate/interface/IsoDepositVetos.h"
00022 #include "DataFormats/RecoCandidate/interface/IsoDepositDirection.h"
00023 #include "TH1.h"
00024 #include "TH2.h"
00025 #include <vector>
00026 #include <string>
00027 #include <iostream>
00028 #include <sstream>
00029
00030 using namespace edm;
00031 using namespace std;
00032 using namespace reco;
00033 using namespace isodeposit;
00034
00035
00036
00037 class ZMuMuSaMassHistogram : public edm::EDAnalyzer {
00038 public:
00039 typedef math::XYZVector Vector;
00040 ZMuMuSaMassHistogram(const edm::ParameterSet& pset);
00041 private:
00042 virtual void analyze(const edm::Event& event, const edm::EventSetup& setup);
00043 virtual void endJob();
00044 InputTag src_muons;
00045 int counter;
00046 double min, max;
00047 int Nbin;
00048 TH1F * ZMassSa;
00049 void histo(const TH1F* hist, char* cx, char* cy) const;
00050 };
00051
00052 void ZMuMuSaMassHistogram::histo(const TH1F* hist,char* cx, char*cy) const{
00053 hist->GetXaxis()->SetTitle(cx);
00054 hist->GetYaxis()->SetTitle(cy);
00055 hist->GetXaxis()->SetTitleOffset(1);
00056 hist->GetYaxis()->SetTitleOffset(1.2);
00057 hist->GetXaxis()->SetTitleSize(0.04);
00058 hist->GetYaxis()->SetTitleSize(0.04);
00059 hist->GetXaxis()->SetLabelSize(0.03);
00060 hist->GetYaxis()->SetLabelSize(0.03);
00061 }
00062
00063
00064 ZMuMuSaMassHistogram::ZMuMuSaMassHistogram(const ParameterSet& pset):
00065 src_muons(pset.getParameter<InputTag>("src_m")),
00066 counter(0),
00067 min(pset.getUntrackedParameter<double>("min")),
00068 max(pset.getUntrackedParameter<double>("max")),
00069 Nbin(pset.getUntrackedParameter<int>("nbin")) {
00070 edm::Service<TFileService> fs;
00071 ZMassSa = fs->make<TH1F>("zMass","ZMass OneStandAlone (GeV/c^{2})",Nbin,min,max);
00072
00073 }
00074
00075
00076 void ZMuMuSaMassHistogram::analyze(const edm::Event& event, const edm::EventSetup& setup) {
00077 Handle<CandidateView> dimuons;
00078 event.getByLabel(src_muons, dimuons);
00079 for(unsigned int i=0; i< dimuons->size(); ++ i ) {
00080 const Candidate & zmm = (* dimuons)[i];
00081 const Candidate * dau0 = zmm.daughter(0);
00082 const Candidate * dau1 = zmm.daughter(1);
00083 TrackRef stAloneTrack;
00084 Candidate::PolarLorentzVector p4_0;
00085 double mu_mass;
00086 if(counter % 2 == 0) {
00087 stAloneTrack = dau0->get<TrackRef,reco::StandAloneMuonTag>();
00088 p4_0 = dau1->polarP4();
00089 mu_mass = dau0->mass();
00090 }
00091 else{
00092 stAloneTrack = dau1->get<TrackRef,reco::StandAloneMuonTag>();
00093 p4_0= dau0->polarP4();
00094 mu_mass = dau1->mass();
00095 }
00096
00097 Vector momentum = stAloneTrack->momentum();
00098 Candidate::PolarLorentzVector p4_1(momentum.rho(), momentum.eta(),momentum.phi(), mu_mass);
00099 double mass = (p4_0+p4_1).mass();
00100 ZMassSa->Fill(mass);
00101 ++counter;
00102
00103 }
00104
00105
00106 }
00107
00108
00109 void ZMuMuSaMassHistogram::endJob() {
00110 }
00111
00112 #include "FWCore/Framework/interface/MakerMacros.h"
00113
00114 DEFINE_FWK_MODULE(ZMuMuSaMassHistogram);