CMS 3D CMS Logo

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 ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void analyze (const edm::Event &event, const edm::EventSetup &setup) override
 
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 &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 33 of file ZGlobalVsSAIsolationAnalyzer.cc.

Member Typedef Documentation

◆ Vector

Definition at line 35 of file ZGlobalVsSAIsolationAnalyzer.cc.

Constructor & Destructor Documentation

◆ ZGlobalVsSAIsolationAnalyzer()

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

Definition at line 55 of file ZGlobalVsSAIsolationAnalyzer.cc.

56  : srcToken_(consumes<CandidateView>(cfg.getParameter<InputTag>("src"))),
57  dRVeto(cfg.getParameter<double>("veto")),
58  dRTrk(cfg.getParameter<double>("deltaRTrk")),
59  dREcal(cfg.getParameter<double>("deltaREcal")),
60  dRHcal(cfg.getParameter<double>("deltaRHcal")),
61  ptThreshold(cfg.getParameter<double>("ptThreshold")),
62  etEcalThreshold(cfg.getParameter<double>("etEcalThreshold")),
63  etHcalThreshold(cfg.getParameter<double>("etHcalThreshold")),
64  alpha(cfg.getParameter<double>("alpha")),
65  beta(cfg.getParameter<double>("beta")),
66  isoCut_(cfg.getParameter<double>("isoCut")),
67  selGlobal_(0),
68  selSA_(0),
69  totGlobal_(0),
70  totSA_(0) {}

Member Function Documentation

◆ analyze()

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

Implements edm::EDAnalyzer.

Definition at line 115 of file ZGlobalVsSAIsolationAnalyzer.cc.

115  {
117  event.getByToken(srcToken_, dimuons);
118  for (unsigned int i = 0; i < dimuons->size(); ++i) {
119  const Candidate& zmm = (*dimuons)[i];
120  evaluate(zmm.daughter(0));
121  evaluate(zmm.daughter(1));
122  }
123 }

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

◆ endJob()

void ZGlobalVsSAIsolationAnalyzer::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 125 of file ZGlobalVsSAIsolationAnalyzer.cc.

125  {
126  cout << "Isolation efficiency report:" << endl;
127  double eff, err;
128  eff = double(selGlobal_) / double(totGlobal_);
129  err = sqrt(eff * (1. - eff) / double(totGlobal_));
130  cout << "Global: " << selGlobal_ << "/" << totGlobal_ << " = " << eff << "+/-" << err << endl;
131  eff = double(selSA_) / double(totSA_);
132  err = sqrt(eff * (1. - eff) / double(totSA_));
133  cout << "St.Al.: " << selSA_ << "/" << totSA_ << " = " << eff << "+/-" << err << endl;
134 }

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

◆ evaluate()

void ZGlobalVsSAIsolationAnalyzer::evaluate ( const reco::Candidate dau)
private

Definition at line 91 of file ZGlobalVsSAIsolationAnalyzer.cc.

91  {
92  const pat::Muon* mu = dynamic_cast<const pat::Muon*>(&*dau->masterClone());
93  if (mu == nullptr)
94  throw Exception(errors::InvalidReference) << "Daughter is not a muon!\n";
95  const pat::IsoDeposit* trkIsoDep = mu->isoDeposit(pat::TrackIso);
96  const pat::IsoDeposit* ecalIsoDep = mu->isoDeposit(pat::EcalIso);
97  const pat::IsoDeposit* hcalIsoDep = mu->isoDeposit(pat::HcalIso);
98  // global muon
99  {
100  Direction dir = Direction(mu->eta(), mu->phi());
101  if (isolated(dir, trkIsoDep, ecalIsoDep, hcalIsoDep))
102  selGlobal_++;
103  totGlobal_++;
104  }
105  // stand-alone
106  {
108  Direction dir = Direction(sa->eta(), sa->phi());
109  if (isolated(dir, trkIsoDep, ecalIsoDep, hcalIsoDep))
110  selSA_++;
111  totSA_++;
112  }
113 }

References DeadROC_duringRun::dir, pat::EcalIso, Exception, reco::Candidate::get(), pat::HcalIso, edm::errors::InvalidReference, isolated(), reco::Candidate::masterClone(), amptDefaultParameters_cff::mu, selGlobal_, selSA_, totGlobal_, totSA_, and pat::TrackIso.

Referenced by analyze().

◆ isolated()

bool ZGlobalVsSAIsolationAnalyzer::isolated ( const Direction dir,
const pat::IsoDeposit trkIsoDep,
const pat::IsoDeposit ecalIsoDep,
const pat::IsoDeposit hcalIsoDep 
)
private

Definition at line 72 of file ZGlobalVsSAIsolationAnalyzer.cc.

75  {
76  IsoDeposit::AbsVetos vetoTrk, vetoEcal, vetoHcal;
77  vetoTrk.push_back(new ConeVeto(dir, dRVeto));
78  vetoTrk.push_back(new ThresholdVeto(ptThreshold));
79  vetoEcal.push_back(new ConeVeto(dir, 0.));
80  vetoEcal.push_back(new ThresholdVeto(etEcalThreshold));
81  vetoHcal.push_back(new ConeVeto(dir, 0.));
82  vetoHcal.push_back(new ThresholdVeto(etHcalThreshold));
83 
84  double trkIso = trkIsoDep->sumWithin(dir, dRTrk, vetoTrk);
85  double ecalIso = ecalIsoDep->sumWithin(dir, dREcal, vetoEcal);
86  double hcalIso = hcalIsoDep->sumWithin(dir, dRHcal, vetoHcal);
87  double iso = alpha * ((0.5 * (1 + beta) * ecalIso) + (0.5 * (1 - beta) * hcalIso)) + (1 - alpha) * trkIso;
88  return iso < isoCut_;
89 }

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

Referenced by evaluate().

Member Data Documentation

◆ alpha

double ZGlobalVsSAIsolationAnalyzer::alpha
private

Definition at line 45 of file ZGlobalVsSAIsolationAnalyzer.cc.

Referenced by isolated().

◆ beta

double ZGlobalVsSAIsolationAnalyzer::beta
private

Definition at line 45 of file ZGlobalVsSAIsolationAnalyzer.cc.

Referenced by isolated().

◆ dREcal

double ZGlobalVsSAIsolationAnalyzer::dREcal
private

Definition at line 43 of file ZGlobalVsSAIsolationAnalyzer.cc.

Referenced by isolated().

◆ dRHcal

double ZGlobalVsSAIsolationAnalyzer::dRHcal
private

Definition at line 43 of file ZGlobalVsSAIsolationAnalyzer.cc.

Referenced by isolated().

◆ dRTrk

double ZGlobalVsSAIsolationAnalyzer::dRTrk
private

Definition at line 43 of file ZGlobalVsSAIsolationAnalyzer.cc.

Referenced by isolated().

◆ dRVeto

double ZGlobalVsSAIsolationAnalyzer::dRVeto
private

Definition at line 42 of file ZGlobalVsSAIsolationAnalyzer.cc.

Referenced by isolated().

◆ etEcalThreshold

double ZGlobalVsSAIsolationAnalyzer::etEcalThreshold
private

Definition at line 44 of file ZGlobalVsSAIsolationAnalyzer.cc.

Referenced by isolated().

◆ etHcalThreshold

double ZGlobalVsSAIsolationAnalyzer::etHcalThreshold
private

Definition at line 44 of file ZGlobalVsSAIsolationAnalyzer.cc.

Referenced by isolated().

◆ isoCut_

double ZGlobalVsSAIsolationAnalyzer::isoCut_
private

Definition at line 46 of file ZGlobalVsSAIsolationAnalyzer.cc.

Referenced by isolated().

◆ ptThreshold

double ZGlobalVsSAIsolationAnalyzer::ptThreshold
private

Definition at line 44 of file ZGlobalVsSAIsolationAnalyzer.cc.

Referenced by isolated().

◆ selGlobal_

unsigned long ZGlobalVsSAIsolationAnalyzer::selGlobal_
private

Definition at line 47 of file ZGlobalVsSAIsolationAnalyzer.cc.

Referenced by endJob(), and evaluate().

◆ selSA_

unsigned long ZGlobalVsSAIsolationAnalyzer::selSA_
private

Definition at line 47 of file ZGlobalVsSAIsolationAnalyzer.cc.

Referenced by endJob(), and evaluate().

◆ srcToken_

EDGetTokenT<CandidateView> ZGlobalVsSAIsolationAnalyzer::srcToken_
private

Definition at line 41 of file ZGlobalVsSAIsolationAnalyzer.cc.

Referenced by analyze().

◆ totGlobal_

unsigned long ZGlobalVsSAIsolationAnalyzer::totGlobal_
private

Definition at line 47 of file ZGlobalVsSAIsolationAnalyzer.cc.

Referenced by endJob(), and evaluate().

◆ totSA_

unsigned long ZGlobalVsSAIsolationAnalyzer::totSA_
private

Definition at line 47 of file ZGlobalVsSAIsolationAnalyzer.cc.

Referenced by endJob(), and evaluate().

reco::Candidate::daughter
virtual const Candidate * daughter(size_type i) const =0
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode)
mps_fire.i
i
Definition: mps_fire.py:428
pat::EcalIso
Definition: Isolation.h:11
ZGlobalVsSAIsolationAnalyzer::ptThreshold
double ptThreshold
Definition: ZGlobalVsSAIsolationAnalyzer.cc:44
edm::errors::InvalidReference
Definition: EDMException.h:39
amptDefaultParameters_cff.mu
mu
Definition: amptDefaultParameters_cff.py:16
ZGlobalVsSAIsolationAnalyzer::selGlobal_
unsigned long selGlobal_
Definition: ZGlobalVsSAIsolationAnalyzer.cc:47
ZMuMuCategoriesSequences_cff.trkIso
trkIso
Definition: ZMuMuCategoriesSequences_cff.py:140
gather_cfg.cout
cout
Definition: gather_cfg.py:144
ZGlobalVsSAIsolationAnalyzer::dRHcal
double dRHcal
Definition: ZGlobalVsSAIsolationAnalyzer.cc:43
reco::Candidate::get
T get() const
get a component
Definition: Candidate.h:221
pat::Muon
Analysis-level muon class.
Definition: Muon.h:51
edm::Handle
Definition: AssociativeIterator.h:50
ZGlobalVsSAIsolationAnalyzer::evaluate
void evaluate(const reco::Candidate *dau)
Definition: ZGlobalVsSAIsolationAnalyzer.cc:91
ZGlobalVsSAIsolationAnalyzer::srcToken_
EDGetTokenT< CandidateView > srcToken_
Definition: ZGlobalVsSAIsolationAnalyzer.cc:41
edm::Ref< TrackCollection >
WZMuSkim_cff.dimuons
dimuons
Definition: WZMuSkim_cff.py:26
reco::isodeposit::ConeVeto
Definition: IsoDepositVetos.h:9
reco::StandAloneMuonTag
stand alone muon component tag
Definition: RecoCandidate.h:77
ZGlobalVsSAIsolationAnalyzer::dRTrk
double dRTrk
Definition: ZGlobalVsSAIsolationAnalyzer.cc:43
ZGlobalVsSAIsolationAnalyzer::isoCut_
double isoCut_
Definition: ZGlobalVsSAIsolationAnalyzer.cc:46
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
reco::IsoDeposit::AbsVetos
isodeposit::AbsVetos AbsVetos
Definition: IsoDeposit.h:53
ZGlobalVsSAIsolationAnalyzer::dRVeto
double dRVeto
Definition: ZGlobalVsSAIsolationAnalyzer.cc:42
ZGlobalVsSAIsolationAnalyzer::dREcal
double dREcal
Definition: ZGlobalVsSAIsolationAnalyzer.cc:43
reco::TrackRef
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
Definition: TrackFwd.h:20
pat::TrackIso
Definition: Isolation.h:10
reco::IsoDeposit::sumWithin
double sumWithin(double coneSize, const AbsVetos &vetos=AbsVetos(), bool skipDepositVeto=false) const
Definition: IsoDeposit.cc:137
pat::HcalIso
Definition: Isolation.h:12
submitPVResolutionJobs.err
err
Definition: submitPVResolutionJobs.py:85
reco::isodeposit::ThresholdVeto
Definition: IsoDepositVetos.h:21
looper.cfg
cfg
Definition: looper.py:297
reco::Candidate
Definition: Candidate.h:27
ZGlobalVsSAIsolationAnalyzer::isolated
bool isolated(const Direction &dir, const pat::IsoDeposit *trkIsoDep, const pat::IsoDeposit *ecalIsoDep, const pat::IsoDeposit *hcalIsoDep)
Definition: ZGlobalVsSAIsolationAnalyzer.cc:72
ZGlobalVsSAIsolationAnalyzer::selSA_
unsigned long selSA_
Definition: ZGlobalVsSAIsolationAnalyzer.cc:47
ZGlobalVsSAIsolationAnalyzer::beta
double beta
Definition: ZGlobalVsSAIsolationAnalyzer.cc:45
reco::isodeposit::Direction
Definition: IsoDepositDirection.h:19
Exception
Definition: hltDiff.cc:246
reco::IsoDeposit
Definition: IsoDeposit.h:49
reco::Candidate::masterClone
virtual const CandidateBaseRef & masterClone() const =0
ZGlobalVsSAIsolationAnalyzer::totGlobal_
unsigned long totGlobal_
Definition: ZGlobalVsSAIsolationAnalyzer.cc:47
ZGlobalVsSAIsolationAnalyzer::etEcalThreshold
double etEcalThreshold
Definition: ZGlobalVsSAIsolationAnalyzer.cc:44
ZGlobalVsSAIsolationAnalyzer::totSA_
unsigned long totSA_
Definition: ZGlobalVsSAIsolationAnalyzer.cc:47
ZGlobalVsSAIsolationAnalyzer::etHcalThreshold
double etHcalThreshold
Definition: ZGlobalVsSAIsolationAnalyzer.cc:44
edm::InputTag
Definition: InputTag.h:15
ZGlobalVsSAIsolationAnalyzer::alpha
double alpha
Definition: ZGlobalVsSAIsolationAnalyzer.cc:45
DeadROC_duringRun.dir
dir
Definition: DeadROC_duringRun.py:23