CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
ZGlobalVsSAIsolationAnalyzer Class Reference
Inheritance diagram for ZGlobalVsSAIsolationAnalyzer:
edm::EDAnalyzer edm::EDConsumerBase

Public Types

typedef math::XYZVector Vector
 
- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

Public Member Functions

 ZGlobalVsSAIsolationAnalyzer (const edm::ParameterSet &cfg)
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

virtual void analyze (const edm::Event &event, const edm::EventSetup &setup) override
 
virtual void endJob () override
 
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_
 
EDGetTokenT< CandidateViewsrcToken_
 
unsigned long totGlobal_
 
unsigned long totSA_
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

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.

52  :
53  srcToken_(consumes<CandidateView>(cfg.getParameter<InputTag>("src"))),
54  dRVeto(cfg.getParameter<double>("veto")),
55  dRTrk(cfg.getParameter<double>("deltaRTrk")),
56  dREcal(cfg.getParameter<double>("deltaREcal")),
57  dRHcal(cfg.getParameter<double>("deltaRHcal")),
58  ptThreshold(cfg.getParameter<double>("ptThreshold")),
59  etEcalThreshold(cfg.getParameter<double>("etEcalThreshold")),
60  etHcalThreshold(cfg.getParameter<double>("etHcalThreshold")),
61  alpha(cfg.getParameter<double>("alpha")),
62  beta(cfg.getParameter<double>("beta")),
63  isoCut_(cfg.getParameter<double>("isoCut")),
64  selGlobal_(0), selSA_(0), totGlobal_(0), totSA_(0) {
65 }
T getParameter(std::string const &) const
EDGetTokenT< CandidateView > srcToken_

Member Function Documentation

void ZGlobalVsSAIsolationAnalyzer::analyze ( const edm::Event event,
const edm::EventSetup setup 
)
overrideprivatevirtual

Implements edm::EDAnalyzer.

Definition at line 105 of file ZGlobalVsSAIsolationAnalyzer.cc.

References reco::Candidate::daughter(), hotlineSkims_cff::dimuons, evaluate(), i, and srcToken_.

105  {
107  event.getByToken(srcToken_, dimuons);
108  for(unsigned int i=0; i< dimuons->size(); ++ i) {
109  const Candidate & zmm = (* dimuons)[i];
110  evaluate(zmm.daughter(0));
111  evaluate(zmm.daughter(1));
112  }
113 }
int i
Definition: DBlmapReader.cc:9
virtual const Candidate * daughter(size_type i) const =0
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) ...
EDGetTokenT< CandidateView > srcToken_
void evaluate(const reco::Candidate *dau)
void ZGlobalVsSAIsolationAnalyzer::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 115 of file ZGlobalVsSAIsolationAnalyzer.cc.

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

115  {
116  cout << "Isolation efficiency report:" << endl;
117  double eff, err;
118  eff = double(selGlobal_)/double(totGlobal_);
119  err = sqrt(eff*(1.-eff)/double(totGlobal_));
120  cout <<"Global: " << selGlobal_ << "/" << totGlobal_ << " = " <<eff <<"+/-" << err<< endl;
121  eff = double(selSA_)/double(totSA_);
122  err = sqrt(eff*(1.-eff)/double(totSA_));
123  cout <<"St.Al.: " << selSA_ << "/" << totSA_ << " = " << eff <<"+/-" << err << endl;
124 }
T sqrt(T t)
Definition: SSEVec.h:18
tuple cout
Definition: gather_cfg.py:145
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().

84  {
85  const pat::Muon * mu = dynamic_cast<const pat::Muon *>(&*dau->masterClone());
86  if(mu == 0) throw Exception(errors::InvalidReference) << "Daughter is not a muon!\n";
87  const pat::IsoDeposit * trkIsoDep = mu->isoDeposit(pat::TrackIso);
88  const pat::IsoDeposit * ecalIsoDep = mu->isoDeposit(pat::EcalIso);
89  const pat::IsoDeposit * hcalIsoDep = mu->isoDeposit(pat::HcalIso);
90  // global muon
91  {
92  Direction dir = Direction(mu->eta(), mu->phi());
93  if(isolated(dir, trkIsoDep, ecalIsoDep, hcalIsoDep)) selGlobal_++;
94  totGlobal_++;
95  }
96  // stand-alone
97  {
99  Direction dir = Direction(sa->eta(), sa->phi());
100  if(isolated(dir, trkIsoDep, ecalIsoDep, hcalIsoDep)) selSA_++;
101  totSA_++;
102  }
103 }
stand alone muon component tag
Definition: RecoCandidate.h:78
virtual double phi() const final
momentum azimuthal angle
const IsoDeposit * isoDeposit(IsolationKeys key) const
Returns the IsoDeposit associated with some key, or a null pointer if it is not available.
Definition: Lepton.h:165
const int mu
Definition: Constants.h:22
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
Definition: TrackFwd.h:20
T get() const
get a component
Definition: Candidate.h:217
bool isolated(const Direction &dir, const pat::IsoDeposit *trkIsoDep, const pat::IsoDeposit *ecalIsoDep, const pat::IsoDeposit *hcalIsoDep)
virtual double eta() const final
momentum pseudorapidity
dbl *** dir
Definition: mlp_gen.cc:35
Analysis-level muon class.
Definition: Muon.h:49
virtual const CandidateBaseRef & masterClone() const =0
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().

68  {
69  IsoDeposit::AbsVetos vetoTrk, vetoEcal, vetoHcal;
70  vetoTrk.push_back(new ConeVeto(dir, dRVeto));
71  vetoTrk.push_back(new ThresholdVeto(ptThreshold));
72  vetoEcal.push_back(new ConeVeto(dir, 0.));
73  vetoEcal.push_back(new ThresholdVeto(etEcalThreshold));
74  vetoHcal.push_back(new ConeVeto(dir, 0.));
75  vetoHcal.push_back(new ThresholdVeto(etHcalThreshold));
76 
77  double trkIso = trkIsoDep->sumWithin(dir, dRTrk, vetoTrk);
78  double ecalIso = ecalIsoDep->sumWithin(dir, dREcal, vetoEcal);
79  double hcalIso = hcalIsoDep->sumWithin(dir, dRHcal, vetoHcal);
80  double iso = alpha*((0.5*(1+beta)*ecalIso) + (0.5*(1-beta)*hcalIso)) + (1-alpha)*trkIso;
81  return iso < isoCut_;
82 }
double sumWithin(double coneSize, const AbsVetos &vetos=AbsVetos(), bool skipDepositVeto=false) const
Definition: IsoDeposit.cc:138
std::vector< AbsVeto * > AbsVetos
Definition: IsoDeposit.h:40

Member Data Documentation

double ZGlobalVsSAIsolationAnalyzer::alpha
private

Definition at line 44 of file ZGlobalVsSAIsolationAnalyzer.cc.

Referenced by isolated().

double ZGlobalVsSAIsolationAnalyzer::beta
private

Definition at line 44 of file ZGlobalVsSAIsolationAnalyzer.cc.

Referenced by isolated().

double ZGlobalVsSAIsolationAnalyzer::dREcal
private

Definition at line 42 of file ZGlobalVsSAIsolationAnalyzer.cc.

Referenced by isolated().

double ZGlobalVsSAIsolationAnalyzer::dRHcal
private

Definition at line 42 of file ZGlobalVsSAIsolationAnalyzer.cc.

Referenced by isolated().

double ZGlobalVsSAIsolationAnalyzer::dRTrk
private

Definition at line 42 of file ZGlobalVsSAIsolationAnalyzer.cc.

Referenced by isolated().

double ZGlobalVsSAIsolationAnalyzer::dRVeto
private

Definition at line 41 of file ZGlobalVsSAIsolationAnalyzer.cc.

Referenced by isolated().

double ZGlobalVsSAIsolationAnalyzer::etEcalThreshold
private

Definition at line 43 of file ZGlobalVsSAIsolationAnalyzer.cc.

Referenced by isolated().

double ZGlobalVsSAIsolationAnalyzer::etHcalThreshold
private

Definition at line 43 of file ZGlobalVsSAIsolationAnalyzer.cc.

Referenced by isolated().

double ZGlobalVsSAIsolationAnalyzer::isoCut_
private

Definition at line 45 of file ZGlobalVsSAIsolationAnalyzer.cc.

Referenced by isolated().

double ZGlobalVsSAIsolationAnalyzer::ptThreshold
private

Definition at line 43 of file ZGlobalVsSAIsolationAnalyzer.cc.

Referenced by isolated().

unsigned long ZGlobalVsSAIsolationAnalyzer::selGlobal_
private

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().

EDGetTokenT<CandidateView> ZGlobalVsSAIsolationAnalyzer::srcToken_
private

Definition at line 40 of file ZGlobalVsSAIsolationAnalyzer.cc.

Referenced by analyze().

unsigned long ZGlobalVsSAIsolationAnalyzer::totGlobal_
private

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().