Public Types | |
typedef math::XYZVector | Vector |
Public Member Functions | |
ZMuMuUserData (const edm::ParameterSet &) | |
Private Member Functions | |
void | produce (edm::Event &, const edm::EventSetup &) |
Private Attributes | |
double | alpha_ |
InputTag | beamSpot_ |
double | beta_ |
int | counter |
string | hltPath_ |
InputTag | primaryVertices_ |
InputTag | src_ |
InputTag | zGenParticlesMatch_ |
Definition at line 29 of file ZMuMuUserData.cc.
typedef math::XYZVector ZMuMuUserData::Vector |
Definition at line 32 of file ZMuMuUserData.cc.
ZMuMuUserData::ZMuMuUserData | ( | const edm::ParameterSet & | cfg | ) |
Definition at line 46 of file ZMuMuUserData.cc.
: src_( cfg.getParameter<InputTag>( "src" ) ), beamSpot_(cfg.getParameter<InputTag>( "beamSpot" ) ), primaryVertices_(cfg.getParameter<InputTag>( "primaryVertices" ) ), zGenParticlesMatch_(cfg.getParameter<InputTag>( "zGenParticlesMatch" ) ), alpha_(cfg.getParameter<double>("alpha") ), beta_(cfg.getParameter<double>("beta") ), hltPath_(cfg.getParameter<std::string >("hltPath") ){ produces<vector<pat::CompositeCandidate> >(); }
void ZMuMuUserData::produce | ( | edm::Event & | evt, |
const edm::EventSetup & | |||
) | [private, virtual] |
I fill the dau1 with positive and dau2 with negatove values for the pt, in order to flag the muons used for building zMassSa
I fill the dau1 with negatove and dau2 with positive values for the pt
Implements edm::EDProducer.
Definition at line 57 of file ZMuMuUserData.cc.
References pat::PATObject< ObjectType >::addUserFloat(), beamSpot_, counter, reco::CompositeCandidate::daughter(), WZMuSkim_cff::dimuons, reco::Candidate::eta(), reco::Candidate::get(), edm::Event::getByLabel(), i, reco::Muon::isGlobalMuon(), edm::Ref< C, T, F >::isNonnull(), reco::Candidate::mass(), reco::Candidate::masterClone(), reco::Candidate::phi(), reco::Candidate::polarP4(), primaryVertices_, reco::Candidate::pt(), edm::Event::put(), reco::Candidate::rapidity(), src_, z, and zGenParticlesMatch_.
{ Handle<std::vector<reco::CompositeCandidate> > dimuons; evt.getByLabel(src_,dimuons); Handle<BeamSpot> beamSpotHandle; evt.getByLabel(beamSpot_, beamSpotHandle); Handle<VertexCollection> primaryVertices; // Collection of primary Vertices evt.getByLabel(primaryVertices_, primaryVertices); bool isMCMatchTrue=false; Handle<GenParticleMatch> zGenParticlesMatch; if(evt.getByLabel( zGenParticlesMatch_, zGenParticlesMatch )){ isMCMatchTrue=true; } //cout<<"isMCMatchTrue"<<isMCMatchTrue <<endl; auto_ptr<vector<pat::CompositeCandidate> > dimuonColl( new vector<pat::CompositeCandidate> () ); for (unsigned int i = 0; i< dimuons->size();++i){ const CompositeCandidate & z = (*dimuons)[i]; //CandidateBaseRef zRef = dimuons ->refAt(i); edm::Ref<std::vector<reco::CompositeCandidate> > zRef(dimuons, i); pat::CompositeCandidate dimuon(z); float trueMass,truePt,trueEta,truePhi,trueY; if (isMCMatchTrue){ GenParticleRef trueZRef = (*zGenParticlesMatch)[zRef]; //CandidateRef trueZRef = trueZIter->val; if( trueZRef.isNonnull() ) { const Candidate & z = * trueZRef; trueMass = z.mass(); truePt = z.pt(); trueEta = z.eta(); truePhi = z.phi(); trueY = z.rapidity(); } else { trueMass = -100; truePt = -100; trueEta = -100; truePhi = -100; trueY = -100; } dimuon.addUserFloat("TrueMass",trueMass); dimuon.addUserFloat("TruePt",truePt); dimuon.addUserFloat("TrueEta",trueEta); dimuon.addUserFloat("TruePhi",truePhi); dimuon.addUserFloat("TrueY",trueY); } const Candidate * dau1 = z.daughter(0); const Candidate * dau2 = z.daughter(1); const pat::Muon & mu1 = dynamic_cast<const pat::Muon&>(*dau1->masterClone()); const pat::Muon & mu2 = dynamic_cast<const pat::Muon&>(*dau2->masterClone()); /*cout<<"mu1 is null? "<<mu1.isMuon()<<endl; cout<<"mu2 is null? "<<mu2.isMuon()<<endl; cout<<"mu1 is global?"<<mu1.isGlobalMuon()<<endl; cout<<"mu2 is global?"<<mu2.isGlobalMuon()<<endl; */ if(mu1.isGlobalMuon()==true && mu2.isGlobalMuon()==true){ TrackRef stAloneTrack1; TrackRef stAloneTrack2; Vector momentum; Candidate::PolarLorentzVector p4_1; double mu_mass; stAloneTrack1 = dau1->get<TrackRef,reco::StandAloneMuonTag>(); stAloneTrack2 = dau2->get<TrackRef,reco::StandAloneMuonTag>(); float zDau1SaEta = stAloneTrack1->eta(); float zDau2SaEta = stAloneTrack2->eta(); float zDau1SaPhi = stAloneTrack1->phi(); float zDau2SaPhi = stAloneTrack2->phi(); float zDau1SaPt,zDau2SaPt; if(counter % 2 == 0) { momentum = stAloneTrack1->momentum(); p4_1 = dau2->polarP4(); mu_mass = dau1->mass(); zDau1SaPt = stAloneTrack1->pt(); zDau2SaPt = - stAloneTrack2->pt(); }else{ momentum = stAloneTrack2->momentum(); p4_1= dau1->polarP4(); mu_mass = dau2->mass(); zDau1SaPt = - stAloneTrack1->pt(); zDau2SaPt = stAloneTrack2->pt(); } Candidate::PolarLorentzVector p4_2(momentum.rho(), momentum.eta(),momentum.phi(), mu_mass); double mass = (p4_1+p4_2).mass(); float zMassSa = mass; //cout<<"zMassSa "<<zMassSa; dimuon.addUserFloat("MassSa",zMassSa); dimuon.addUserFloat("Dau1SaPt",zDau1SaPt); dimuon.addUserFloat("Dau2SaPt",zDau2SaPt); dimuon.addUserFloat("Dau1SaPhi",zDau1SaPhi); dimuon.addUserFloat("Dau2SaPhi",zDau2SaPhi); dimuon.addUserFloat("Dau1SaEta",zDau1SaEta); dimuon.addUserFloat("Dau2SaEta",zDau2SaEta); ++counter; } dimuonColl->push_back(dimuon); } evt.put( dimuonColl); }
double ZMuMuUserData::alpha_ [private] |
Definition at line 37 of file ZMuMuUserData.cc.
InputTag ZMuMuUserData::beamSpot_ [private] |
Definition at line 36 of file ZMuMuUserData.cc.
Referenced by produce().
double ZMuMuUserData::beta_ [private] |
Definition at line 37 of file ZMuMuUserData.cc.
int ZMuMuUserData::counter [private] |
Definition at line 39 of file ZMuMuUserData.cc.
Referenced by produce().
string ZMuMuUserData::hltPath_ [private] |
Definition at line 38 of file ZMuMuUserData.cc.
InputTag ZMuMuUserData::primaryVertices_ [private] |
Definition at line 36 of file ZMuMuUserData.cc.
Referenced by produce().
InputTag ZMuMuUserData::src_ [private] |
Definition at line 36 of file ZMuMuUserData.cc.
Referenced by produce().
InputTag ZMuMuUserData::zGenParticlesMatch_ [private] |
Definition at line 36 of file ZMuMuUserData.cc.
Referenced by produce().