CMS 3D CMS Logo

Public Types | Public Member Functions | Private Member Functions | Private Attributes

ZGlobalVsSAIsolationAnalyzer Class Reference

Inheritance diagram for ZGlobalVsSAIsolationAnalyzer:
edm::EDAnalyzer

List of all members.

Public Types

typedef math::XYZVector Vector

Public Member Functions

 ZGlobalVsSAIsolationAnalyzer (const edm::ParameterSet &cfg)

Private Member Functions

virtual void analyze (const edm::Event &event, const edm::EventSetup &setup)
virtual void endJob ()
void evaluate (const reco::Candidate *dau)
bool isolated (const Direction &dir, const pat::IsoDeposit *trkIsoDep, const pat::IsoDeposit *ecalIsoDep, const pat::IsoDeposit *hcalIsoDep)

Private Attributes

double alpha
double beta
double dREcal
double dRHcal
double dRTrk
double dRVeto
double etEcalThreshold
double etHcalThreshold
double isoCut_
double ptThreshold
unsigned long selGlobal_
unsigned long selSA_
InputTag src_
unsigned long totGlobal_
unsigned long totSA_

Detailed Description

Definition at line 33 of file ZGlobalVsSAIsolationAnalyzer.cc.


Member Typedef Documentation

Definition at line 35 of file ZGlobalVsSAIsolationAnalyzer.cc.


Constructor & Destructor Documentation

ZGlobalVsSAIsolationAnalyzer::ZGlobalVsSAIsolationAnalyzer ( const edm::ParameterSet cfg)

Definition at line 52 of file ZGlobalVsSAIsolationAnalyzer.cc.

                                                                                 :
  src_(cfg.getParameter<InputTag>("src")),
  dRVeto(cfg.getParameter<double>("veto")),
  dRTrk(cfg.getParameter<double>("deltaRTrk")),
  dREcal(cfg.getParameter<double>("deltaREcal")),
  dRHcal(cfg.getParameter<double>("deltaRHcal")),
  ptThreshold(cfg.getParameter<double>("ptThreshold")),
  etEcalThreshold(cfg.getParameter<double>("etEcalThreshold")),
  etHcalThreshold(cfg.getParameter<double>("etHcalThreshold")),
  alpha(cfg.getParameter<double>("alpha")),
  beta(cfg.getParameter<double>("beta")),
  isoCut_(cfg.getParameter<double>("isoCut")),
  selGlobal_(0), selSA_(0), totGlobal_(0), totSA_(0) {
}

Member Function Documentation

void ZGlobalVsSAIsolationAnalyzer::analyze ( const edm::Event event,
const edm::EventSetup setup 
) [private, virtual]

Implements edm::EDAnalyzer.

Definition at line 105 of file ZGlobalVsSAIsolationAnalyzer.cc.

References reco::Candidate::daughter(), WZMuSkim_cff::dimuons, evaluate(), i, and src_.

                                                                                            {
  Handle<CandidateView> dimuons;
  event.getByLabel(src_, dimuons);
  for(unsigned int i=0; i< dimuons->size(); ++ i) {
    const Candidate & zmm = (* dimuons)[i];
    evaluate(zmm.daughter(0));
    evaluate(zmm.daughter(1));
  }    
}
void ZGlobalVsSAIsolationAnalyzer::endJob ( void  ) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 115 of file ZGlobalVsSAIsolationAnalyzer.cc.

References gather_cfg::cout, selGlobal_, selSA_, mathSSE::sqrt(), totGlobal_, and totSA_.

                                          {
  cout << "Isolation efficiency report:" << endl;
  double eff, err;
  eff =  double(selGlobal_)/double(totGlobal_);
  err = sqrt(eff*(1.-eff)/double(totGlobal_));
  cout <<"Global: " << selGlobal_ << "/" << totGlobal_ << " = " <<eff <<"+/-" << err<< endl;
  eff = double(selSA_)/double(totSA_);
  err = sqrt(eff*(1.-eff)/double(totSA_));  
  cout <<"St.Al.: " << selSA_ << "/" << totSA_ << " = " << eff <<"+/-" << err << endl;
}
void ZGlobalVsSAIsolationAnalyzer::evaluate ( const reco::Candidate dau) [private]

Definition at line 84 of file ZGlobalVsSAIsolationAnalyzer.cc.

References dir, pat::EcalIso, reco::LeafCandidate::eta(), Exception, reco::Candidate::get(), pat::HcalIso, edm::errors::InvalidReference, pat::Lepton< LeptonType >::isoDeposit(), isolated(), reco::Candidate::masterClone(), RPCpg::mu, reco::LeafCandidate::phi(), selGlobal_, selSA_, totGlobal_, totSA_, and pat::TrackIso.

Referenced by analyze().

                                                                    {
  const pat::Muon * mu = dynamic_cast<const pat::Muon *>(&*dau->masterClone());
  if(mu == 0) throw Exception(errors::InvalidReference) << "Daughter is not a muon!\n";
  const pat::IsoDeposit * trkIsoDep = mu->isoDeposit(pat::TrackIso);
  const pat::IsoDeposit * ecalIsoDep = mu->isoDeposit(pat::EcalIso);
  const pat::IsoDeposit * hcalIsoDep = mu->isoDeposit(pat::HcalIso);
  // global muon
  {
    Direction dir = Direction(mu->eta(), mu->phi());
    if(isolated(dir, trkIsoDep, ecalIsoDep, hcalIsoDep)) selGlobal_++;
    totGlobal_++;
  }
  // stand-alone
  {
    TrackRef sa = dau->get<TrackRef,reco::StandAloneMuonTag>();
    Direction dir = Direction(sa->eta(), sa->phi());
    if(isolated(dir, trkIsoDep, ecalIsoDep, hcalIsoDep)) selSA_++;
    totSA_++;   
  }
}
bool ZGlobalVsSAIsolationAnalyzer::isolated ( const Direction dir,
const pat::IsoDeposit trkIsoDep,
const pat::IsoDeposit ecalIsoDep,
const pat::IsoDeposit hcalIsoDep 
) [private]

Definition at line 67 of file ZGlobalVsSAIsolationAnalyzer.cc.

References alpha, beta, dREcal, dRHcal, dRTrk, dRVeto, etEcalThreshold, etHcalThreshold, isoCut_, ptThreshold, and reco::IsoDeposit::sumWithin().

Referenced by evaluate().

                                                                                                                {
  IsoDeposit::AbsVetos vetoTrk, vetoEcal, vetoHcal;
  vetoTrk.push_back(new ConeVeto(dir, dRVeto));
  vetoTrk.push_back(new ThresholdVeto(ptThreshold));
  vetoEcal.push_back(new ConeVeto(dir, 0.));
  vetoEcal.push_back(new ThresholdVeto(etEcalThreshold));
  vetoHcal.push_back(new ConeVeto(dir, 0.));
  vetoHcal.push_back(new ThresholdVeto(etHcalThreshold));
  
  double trkIso = trkIsoDep->sumWithin(dir, dRTrk, vetoTrk);
  double ecalIso = ecalIsoDep->sumWithin(dir, dREcal, vetoEcal);
  double hcalIso = hcalIsoDep->sumWithin(dir, dRHcal, vetoHcal);
  double iso = alpha*((0.5*(1+beta)*ecalIso) + (0.5*(1-beta)*hcalIso)) + (1-alpha)*trkIso;
  return iso < isoCut_;      
}

Member Data Documentation

Definition at line 44 of file ZGlobalVsSAIsolationAnalyzer.cc.

Referenced by isolated().

Definition at line 44 of file ZGlobalVsSAIsolationAnalyzer.cc.

Referenced by isolated().

Definition at line 42 of file ZGlobalVsSAIsolationAnalyzer.cc.

Referenced by isolated().

Definition at line 42 of file ZGlobalVsSAIsolationAnalyzer.cc.

Referenced by isolated().

Definition at line 42 of file ZGlobalVsSAIsolationAnalyzer.cc.

Referenced by isolated().

Definition at line 41 of file ZGlobalVsSAIsolationAnalyzer.cc.

Referenced by isolated().

Definition at line 43 of file ZGlobalVsSAIsolationAnalyzer.cc.

Referenced by isolated().

Definition at line 43 of file ZGlobalVsSAIsolationAnalyzer.cc.

Referenced by isolated().

Definition at line 45 of file ZGlobalVsSAIsolationAnalyzer.cc.

Referenced by isolated().

Definition at line 43 of file ZGlobalVsSAIsolationAnalyzer.cc.

Referenced by isolated().

Definition at line 46 of file ZGlobalVsSAIsolationAnalyzer.cc.

Referenced by endJob(), and evaluate().

unsigned long ZGlobalVsSAIsolationAnalyzer::selSA_ [private]

Definition at line 46 of file ZGlobalVsSAIsolationAnalyzer.cc.

Referenced by endJob(), and evaluate().

Definition at line 40 of file ZGlobalVsSAIsolationAnalyzer.cc.

Referenced by analyze().

Definition at line 46 of file ZGlobalVsSAIsolationAnalyzer.cc.

Referenced by endJob(), and evaluate().

unsigned long ZGlobalVsSAIsolationAnalyzer::totSA_ [private]

Definition at line 46 of file ZGlobalVsSAIsolationAnalyzer.cc.

Referenced by endJob(), and evaluate().