Public Member Functions | |
ZMuMuMuonUserData (const edm::ParameterSet &) | |
Private Member Functions | |
template<typename T > | |
vector< double > | isolation (const T &t, double ptThreshold, double etEcalThreshold, double etHcalThreshold, double dRVetoTrk, double dRTrk, double dREcal, double dRHcal, double alpha, double beta) |
void | produce (edm::Event &, const edm::EventSetup &) |
Private Attributes | |
double | alpha_ |
InputTag | beamSpot_ |
double | beta_ |
double | dREcal_ |
double | dRHcal_ |
double | dRTrk_ |
double | dRVetoTrk_ |
double | etEcalThreshold_ |
double | etHcalThreshold_ |
string | hltPath_ |
InputTag | primaryVertices_ |
double | ptThreshold_ |
InputTag | src_ |
Definition at line 28 of file ZMuMuMuonUserData.cc.
ZMuMuMuonUserData::ZMuMuMuonUserData | ( | const edm::ParameterSet & | cfg | ) |
Definition at line 89 of file ZMuMuMuonUserData.cc.
: src_( cfg.getParameter<InputTag>( "src" ) ), beamSpot_(cfg.getParameter<InputTag>( "beamSpot" ) ), primaryVertices_(cfg.getParameter<InputTag>( "primaryVertices" ) ), alpha_(cfg.getParameter<double>("alpha") ), beta_(cfg.getParameter<double>("beta") ), ptThreshold_(cfg.getParameter<double >("ptThreshold") ), etEcalThreshold_(cfg.getParameter<double >("etEcalThreshold") ), etHcalThreshold_(cfg.getParameter<double >("etHcalThreshold") ), dRVetoTrk_(cfg.getParameter<double >("dRVetoTrk") ), dRTrk_(cfg.getParameter<double >("dRTrk") ), dREcal_(cfg.getParameter<double >("dREcal") ), dRHcal_(cfg.getParameter<double >("dRHcal") ), hltPath_(cfg.getParameter<std::string >("hltPath") ){ produces<std::vector<pat::Muon> >(); }
vector< double > ZMuMuMuonUserData::isolation | ( | const T & | t, |
double | ptThreshold, | ||
double | etEcalThreshold, | ||
double | etHcalThreshold, | ||
double | dRVetoTrk, | ||
double | dRTrk, | ||
double | dREcal, | ||
double | dRHcal, | ||
double | alpha, | ||
double | beta | ||
) | [private] |
Definition at line 43 of file ZMuMuMuonUserData.cc.
References beta, dir, pat::EcalIso, pat::HcalIso, reco::IsoDeposit::sumWithin(), and pat::TrackIso.
Referenced by produce().
{ vector<double> iso; const pat::IsoDeposit * trkIso = t.isoDeposit(pat::TrackIso); const pat::IsoDeposit * ecalIso = t.isoDeposit(pat::EcalIso); const pat::IsoDeposit * hcalIso = t.isoDeposit(pat::HcalIso); Direction dir = Direction(t.eta(), t.phi()); pat::IsoDeposit::AbsVetos vetosTrk; vetosTrk.push_back(new ConeVeto( dir, dRVetoTrk )); vetosTrk.push_back(new ThresholdVeto( ptThreshold )); pat::IsoDeposit::AbsVetos vetosEcal; vetosEcal.push_back(new ConeVeto( dir, 0.)); vetosEcal.push_back(new ThresholdVeto( etEcalThreshold )); pat::IsoDeposit::AbsVetos vetosHcal; vetosHcal.push_back(new ConeVeto( dir, 0. )); vetosHcal.push_back(new ThresholdVeto( etHcalThreshold )); double isovalueTrk = (trkIso->sumWithin(dRTrk,vetosTrk)); double isovalueEcal = (ecalIso->sumWithin(dREcal,vetosEcal)); double isovalueHcal = (hcalIso->sumWithin(dRHcal,vetosHcal)); iso.push_back(isovalueTrk); //cout<<"isoTrk"<<isovalueTrk<<" "<<t.trackIso()<<endl; iso.push_back(isovalueEcal); //cout<<"isoEcal"<<isovalueEcal<<" "<<t.ecalIso()<<endl; iso.push_back(isovalueHcal); //cout<<"isoHcal"<<isovalueHcal<<" "<<t.hcalIso()<<endl; //double isovalueTrk = t.trackIso(); //double isovalueEcal = t.ecalIso(); //double isovalueHcal = t.hcalIso(); //double iso = isovalueTrk + isovalueEcal + isovalueHcal; double combIso = alpha*( ((1+beta)/2*isovalueEcal) + ((1-beta)/2*isovalueHcal) ) + ((1-alpha)*isovalueTrk); iso.push_back(combIso); //cout<<"combIso"<<iso[3]<<endl; double relIso = combIso /= t.pt(); iso.push_back(relIso); //cout<<"relIso"<<iso[4]<<endl; return iso; }
void ZMuMuMuonUserData::produce | ( | edm::Event & | evt, |
const edm::EventSetup & | |||
) | [private, virtual] |
Implements edm::EDProducer.
Definition at line 106 of file ZMuMuMuonUserData.cc.
References pat::PATObject< ObjectType >::addUserFloat(), alpha_, beamSpot_, beta_, reco::Muon::calEnergy(), dREcal_, dRHcal_, dRTrk_, dRVetoTrk_, reco::MuonEnergy::em, etEcalThreshold_, etHcalThreshold_, edm::Event::getByLabel(), pat::Muon::globalTrack(), reco::MuonEnergy::had, hltPath_, i, pat::Muon::innerTrack(), reco::Muon::isGlobalMuon(), edm::Ref< C, T, F >::isNonnull(), isolation(), reco::Muon::isStandAloneMuon(), reco::Muon::isTrackerMuon(), m, patZpeak::muons, reco::Muon::numberOfChambers(), reco::Muon::numberOfMatches(), pat::Muon::outerTrack(), primaryVertices_, ptThreshold_, edm::Event::put(), pat::Lepton< LeptonType >::setIsolation(), src_, pat::PATObject< ObjectType >::triggerObjectMatchesByPath(), pat::User1Iso, pat::User2Iso, pat::User3Iso, pat::User4Iso, and pat::User5Iso.
{ Handle<vector<pat::Muon> > muons; evt.getByLabel(src_,muons); Handle<BeamSpot> beamSpotHandle; evt.getByLabel(beamSpot_, beamSpotHandle); Handle<VertexCollection> primaryVertices; // Collection of primary Vertices evt.getByLabel(primaryVertices_, primaryVertices); auto_ptr<vector<pat::Muon> > muonColl( new vector<pat::Muon> (*muons) ); for (unsigned int i = 0; i< muonColl->size();++i){ pat::Muon & m = (*muonColl)[i]; //pat::Muon *mu = new pat::Muon(m); vector<double> iso = isolation(m,ptThreshold_, etEcalThreshold_, etHcalThreshold_ ,dRVetoTrk_, dRTrk_, dREcal_ , dRHcal_, alpha_, beta_); m.setIsolation(pat::User1Iso, iso[0]); //cout<<"muon User1Iso "<<iso[0]<<endl; m.setIsolation(pat::User2Iso, iso[1]); //cout<<"iso2 "<<iso[1]<<endl; m.setIsolation(pat::User3Iso, iso[2]); //cout<<"iso3 "<<iso[2]<<endl; m.setIsolation(pat::User4Iso, iso[3]); //cout<<"iso4 "<<iso[3]<<endl; m.setIsolation(pat::User5Iso, iso[4]); //cout<<"iso5 "<<iso[4]<<endl; float zDauMuEnergyEm = m.calEnergy().em; float zDauMuEnergyHad = m.calEnergy().had; TrackRef muGlbRef = m.globalTrack(); TrackRef muTrkRef = m.innerTrack(); TrackRef muSaRef = m.outerTrack(); float zDaudxyFromBS = -1; float zDaudzFromBS = -1; float zDaudxyFromPV = -1; float zDaudzFromPV = -1; int zDauNofMuChambers = m.numberOfChambers(); int zDauNofMuMatches = m.numberOfMatches(); // for the following variables looking at global/trk and sta at the same time float zDauChi2 = -1; float zDauTrkChi2 = -1; float zDauSaChi2 = -1; float zDauNofMuonHits = -1; float zDauSaNofMuonHits = -1; float zDauNofStripHits = -1; float zDauTrkNofStripHits = -1; float zDauNofPixelHits = -1; float zDauTrkNofPixelHits = -1; if (muGlbRef.isNonnull() && m.isGlobalMuon() == true){ zDaudxyFromBS = muGlbRef->dxy(beamSpotHandle->position()); zDaudzFromBS = muGlbRef->dz(beamSpotHandle->position()); zDaudxyFromPV = muGlbRef->dxy(primaryVertices->begin()->position() ); zDaudzFromPV = muGlbRef->dz(primaryVertices->begin()->position() ); zDauChi2 = muGlbRef->normalizedChi2(); zDauTrkChi2 = muTrkRef->normalizedChi2(); zDauSaChi2 = muSaRef->normalizedChi2(); zDauNofMuonHits = muGlbRef->hitPattern().numberOfValidMuonHits(); zDauSaNofMuonHits = muSaRef->hitPattern().numberOfValidMuonHits(); zDauNofStripHits = muGlbRef->hitPattern().numberOfValidStripHits(); zDauTrkNofStripHits = muTrkRef->hitPattern().numberOfValidStripHits(); zDauNofPixelHits = muGlbRef->hitPattern().numberOfValidPixelHits(); zDauTrkNofPixelHits = muTrkRef->hitPattern().numberOfValidPixelHits(); } else if (muSaRef.isNonnull() && m.isStandAloneMuon() == true){ zDaudxyFromBS = muSaRef->dxy(beamSpotHandle->position()); zDaudzFromBS = muSaRef->dz(beamSpotHandle->position()); zDaudxyFromPV = muSaRef->dxy(primaryVertices->begin()->position() ); zDaudzFromPV = muSaRef->dz(primaryVertices->begin()->position() ); zDauSaChi2 = muSaRef->normalizedChi2(); zDauSaNofMuonHits = muSaRef->hitPattern().numberOfValidMuonHits(); } else if (muTrkRef.isNonnull() && m.isTrackerMuon() == true){ zDaudxyFromBS = muTrkRef->dxy(beamSpotHandle->position()); zDaudzFromBS = muTrkRef->dz(beamSpotHandle->position()); zDaudxyFromPV = muTrkRef->dxy(primaryVertices->begin()->position() ); zDaudzFromPV = muTrkRef->dz(primaryVertices->begin()->position() ); zDauTrkChi2 = muTrkRef->normalizedChi2(); zDauTrkNofStripHits = muTrkRef->hitPattern().numberOfValidStripHits(); zDauTrkNofPixelHits = muTrkRef->hitPattern().numberOfValidPixelHits(); } const pat::TriggerObjectStandAloneCollection muHLTMatches = m.triggerObjectMatchesByPath( hltPath_); float muHLTBit; int dimTrig = muHLTMatches.size(); if(dimTrig !=0 ){ muHLTBit = 1; } else { muHLTBit = 0; } m.addUserFloat("zDau_dxyFromBS", zDaudxyFromBS); m.addUserFloat("zDau_dzFromBS", zDaudzFromBS); m.addUserFloat("zDau_dxyFromPV", zDaudxyFromPV); m.addUserFloat("zDau_dzFromPV", zDaudzFromPV); m.addUserFloat("zDau_HLTBit",muHLTBit); m.addUserFloat("zDau_dzFromPV", zDaudzFromPV); m.addUserFloat("zDau_Chi2", zDauChi2); m.addUserFloat("zDau_TrkChi2", zDauTrkChi2); m.addUserFloat("zDau_SaChi2", zDauSaChi2); m.addUserFloat("zDau_NofMuonHits" , zDauNofMuonHits ); m.addUserFloat("zDau_SaNofMuonHits" , zDauSaNofMuonHits ); m.addUserFloat("zDau_NofStripHits" , zDauNofStripHits ); m.addUserFloat("zDau_TrkNofStripHits" , zDauTrkNofStripHits ); m.addUserFloat("zDau_NofPixelHits" , zDauNofPixelHits ); m.addUserFloat("zDau_TrkNofPixelHits" , zDauTrkNofPixelHits ); m.addUserFloat("zDau_NofMuChambers" , zDauNofMuChambers ); m.addUserFloat("zDau_NofMuMatches" , zDauNofMuMatches ); m.addUserFloat("zDau_MuEnergyEm", zDauMuEnergyEm ); m.addUserFloat("zDau_MuEnergyHad", zDauMuEnergyHad ); } evt.put( muonColl); }
double ZMuMuMuonUserData::alpha_ [private] |
Definition at line 35 of file ZMuMuMuonUserData.cc.
Referenced by produce().
InputTag ZMuMuMuonUserData::beamSpot_ [private] |
Definition at line 34 of file ZMuMuMuonUserData.cc.
Referenced by produce().
double ZMuMuMuonUserData::beta_ [private] |
Definition at line 35 of file ZMuMuMuonUserData.cc.
Referenced by produce().
double ZMuMuMuonUserData::dREcal_ [private] |
Definition at line 36 of file ZMuMuMuonUserData.cc.
Referenced by produce().
double ZMuMuMuonUserData::dRHcal_ [private] |
Definition at line 36 of file ZMuMuMuonUserData.cc.
Referenced by produce().
double ZMuMuMuonUserData::dRTrk_ [private] |
Definition at line 36 of file ZMuMuMuonUserData.cc.
Referenced by produce().
double ZMuMuMuonUserData::dRVetoTrk_ [private] |
Definition at line 36 of file ZMuMuMuonUserData.cc.
Referenced by produce().
double ZMuMuMuonUserData::etEcalThreshold_ [private] |
Definition at line 36 of file ZMuMuMuonUserData.cc.
Referenced by produce().
double ZMuMuMuonUserData::etHcalThreshold_ [private] |
Definition at line 36 of file ZMuMuMuonUserData.cc.
Referenced by produce().
string ZMuMuMuonUserData::hltPath_ [private] |
Definition at line 37 of file ZMuMuMuonUserData.cc.
Referenced by produce().
InputTag ZMuMuMuonUserData::primaryVertices_ [private] |
Definition at line 34 of file ZMuMuMuonUserData.cc.
Referenced by produce().
double ZMuMuMuonUserData::ptThreshold_ [private] |
Definition at line 36 of file ZMuMuMuonUserData.cc.
Referenced by produce().
InputTag ZMuMuMuonUserData::src_ [private] |
Definition at line 34 of file ZMuMuMuonUserData.cc.
Referenced by produce().