CMS 3D CMS Logo

Classes | Functions

/data/refman/pasoursint/CMSSW_5_3_0/src/ElectroWeakAnalysis/ZMuMu/plugins/ZToLLEdmNtupleDumper.cc File Reference

#include "FWCore/Framework/interface/EDProducer.h"
#include "FWCore/Utilities/interface/InputTag.h"
#include "DataFormats/Common/interface/Handle.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "DataFormats/HepMCCandidate/interface/GenParticle.h"
#include "DataFormats/Candidate/interface/CandMatchMap.h"
#include "DataFormats/Candidate/interface/Candidate.h"
#include "DataFormats/PatCandidates/interface/Muon.h"
#include "DataFormats/PatCandidates/interface/GenericParticle.h"
#include "FWCore/Utilities/interface/EDMException.h"
#include "DataFormats/PatCandidates/interface/TriggerObjectStandAlone.h"
#include "DataFormats/RecoCandidate/interface/IsoDeposit.h"
#include "DataFormats/RecoCandidate/interface/IsoDepositFwd.h"
#include "DataFormats/PatCandidates/interface/Isolation.h"
#include "DataFormats/Common/interface/ValueMap.h"
#include "DataFormats/RecoCandidate/interface/IsoDepositVetos.h"
#include "DataFormats/RecoCandidate/interface/IsoDepositDirection.h"
#include "DataFormats/BeamSpot/interface/BeamSpot.h"
#include <vector>
#include "FWCore/Framework/interface/MakerMacros.h"

Go to the source code of this file.

Classes

class  ZToLLEdmNtupleDumper

Functions

double candIsolation (const reco::Candidate *c, double ptThreshold, double etEcalThreshold, double etHcalThreshold, double dRVetoTrk, double dRTrk, double dREcal, double dRHcal, double alpha, double beta, bool relativeIsolation)
 DEFINE_FWK_MODULE (ZToLLEdmNtupleDumper)
template<typename T >
double isolation (const T *t, double ptThreshold, double etEcalThreshold, double etHcalThreshold, double dRVetoTrk, double dRTrk, double dREcal, double dRHcal, double alpha, double beta, bool relativeIsolation)

Function Documentation

double candIsolation ( const reco::Candidate c,
double  ptThreshold,
double  etEcalThreshold,
double  etHcalThreshold,
double  dRVetoTrk,
double  dRTrk,
double  dREcal,
double  dRHcal,
double  alpha,
double  beta,
bool  relativeIsolation 
)

Definition at line 93 of file ZToLLEdmNtupleDumper.cc.

References trackerHits::c, Exception, edm::errors::InvalidReference, and RPCpg::mu.

Referenced by ZToMuMuIsoDepositSelector< Isolator >::operator()(), and ZToLLEdmNtupleDumper::produce().

                                                                                                                                                                                                                                      {
    const pat::Muon * mu = dynamic_cast<const pat::Muon *>(c);
    if(mu != 0) return isolation(mu, ptThreshold, etEcalThreshold, etHcalThreshold ,dRVetoTrk, dRTrk, dREcal , dRHcal,  alpha, beta, relativeIsolation);
    const pat::GenericParticle * trk = dynamic_cast<const pat::GenericParticle*>(c);
    if(trk != 0) return isolation(trk,  ptThreshold, etEcalThreshold, etHcalThreshold ,dRVetoTrk, dRTrk, dREcal , dRHcal,  alpha, beta, relativeIsolation);
    throw edm::Exception(edm::errors::InvalidReference) 
      << "Candidate daughter #0 is neither pat::Muons nor pat::GenericParticle\n";      
    return -1;
  }
DEFINE_FWK_MODULE ( ZToLLEdmNtupleDumper  )
template<typename T >
double isolation ( const T t,
double  ptThreshold,
double  etEcalThreshold,
double  etHcalThreshold,
double  dRVetoTrk,
double  dRTrk,
double  dREcal,
double  dRHcal,
double  alpha,
double  beta,
bool  relativeIsolation 
)

Definition at line 57 of file ZToLLEdmNtupleDumper.cc.

References beta, dir, pat::EcalIso, pat::HcalIso, reco::IsoDeposit::sumWithin(), and pat::TrackIso.

                                                                                                                                                                                                                        {
   // on 34X: 
const pat::IsoDeposit * trkIso = t->isoDeposit(pat::TrackIso);
//  const pat::IsoDeposit * trkIso = t->trackerIsoDeposit();
   // on 34X 
const pat::IsoDeposit * ecalIso = t->isoDeposit(pat::EcalIso);
//  const pat::IsoDeposit * ecalIso = t->ecalIsoDeposit();
//    on 34X 
const pat::IsoDeposit * hcalIso = t->isoDeposit(pat::HcalIso);   
//    const pat::IsoDeposit * hcalIso = t->hcalIsoDeposit();

    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));
    

    double iso = alpha*( ((1+beta)/2*isovalueEcal) + ((1-beta)/2*isovalueHcal) ) + ((1-alpha)*isovalueTrk) ;
    if(relativeIsolation) iso /= t->pt();
    return iso;
  }