CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
HiggsToZZ4LeptonsSkimEff Class Reference

#include <HiggsToZZ4LeptonsSkimEff.h>

Inheritance diagram for HiggsToZZ4LeptonsSkimEff:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 Get event properties to send to builder to fill seed collection. More...
 
 HiggsToZZ4LeptonsSkimEff (const edm::ParameterSet &)
 
 ~HiggsToZZ4LeptonsSkimEff () override
 
- 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 Attributes

bool debug
 
edm::EDGetTokenT< reco::GenParticleCollectiongenToken
 
int nEvents
 
int nFourE
 
int nFourL
 
int nFourM
 
int nLeptonMin
 
int nSelFourE
 
int nSelFourL
 
int nSelFourM
 
int nSelTau
 
int nSelTwoETwoM
 
int nStiffLeptonMin
 
int nTau
 
int nTwoETwoM
 
float softMinPt
 
float stiffMinPt
 
edm::EDGetTokenT< reco::TrackCollectiontheGLBMuonToken
 
edm::EDGetTokenT< reco::GsfElectronCollectiontheGsfEToken
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- 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 29 of file HiggsToZZ4LeptonsSkimEff.h.

Constructor & Destructor Documentation

◆ HiggsToZZ4LeptonsSkimEff()

HiggsToZZ4LeptonsSkimEff::HiggsToZZ4LeptonsSkimEff ( const edm::ParameterSet pset)
explicit

Definition at line 36 of file HiggsToZZ4LeptonsSkimEff.cc.

36  {
37  // Local Debug flag
38  debug = pset.getParameter<bool>("DebugHiggsToZZ4LeptonsSkim");
39 
40  // Reconstructed objects
41  theGLBMuonToken = consumes<reco::TrackCollection>(pset.getParameter<edm::InputTag>("GlobalMuonCollectionLabel"));
42  theGsfEToken = consumes<reco::GsfElectronCollection>(pset.getParameter<edm::InputTag>("ElectronCollectionLabel"));
43  genToken = consumes<GenParticleCollection>(edm::InputTag("genParticles"));
44 
45  // Minimum Pt for leptons for skimming
46  // Minimum Pt for leptons for skimming
47  stiffMinPt = pset.getParameter<double>("stiffMinimumPt");
48  softMinPt = pset.getParameter<double>("softMinimumPt");
49  nStiffLeptonMin = pset.getParameter<int>("nStiffLeptonMinimum");
50  nLeptonMin = pset.getParameter<int>("nLeptonMinimum");
51 
52  nEvents = 0;
54  nFourE = nFourM = nTwoETwoM = nFourL = nTau = 0;
55 }

References debug, nEvents, and muonDTDigis_cfi::pset.

◆ ~HiggsToZZ4LeptonsSkimEff()

HiggsToZZ4LeptonsSkimEff::~HiggsToZZ4LeptonsSkimEff ( )
override

Definition at line 58 of file HiggsToZZ4LeptonsSkimEff.cc.

58  {
59  std::cout << "Number of events read " << nEvents << std::endl;
60  std::cout << "*** Efficiency for the various subsamples *** " << endl;
61 
62  std::cout << "Four leptons: "
63  << " pres " << nFourL << " kept " << nSelFourL << " eff "
64  << ((double)nSelFourL) / ((double)nFourL + 0.0001) << std::endl;
65  std::cout << "Four muons: "
66  << " pres " << nFourM << " kept " << nSelFourM << " eff "
67  << ((double)nSelFourM) / ((double)nFourM + 0.0001) << std::endl;
68  std::cout << "Four elecs: "
69  << " pres " << nFourE << " kept " << nSelFourE << " eff "
70  << ((double)nSelFourE) / ((double)nFourE + 0.0001) << std::endl;
71  std::cout << "2 elec 2 mu: "
72  << " pres " << nTwoETwoM << " kept " << nSelTwoETwoM << " eff "
73  << ((double)nSelTwoETwoM) / ((double)nTwoETwoM + 0.0001) << std::endl;
74  std::cout << "with taus: "
75  << " pres " << nTau << " kept " << nSelTau << " eff " << ((double)nSelTau) / ((double)nTau + 0.0001)
76  << std::endl;
77 }

References gather_cfg::cout, and nEvents.

Member Function Documentation

◆ analyze()

void HiggsToZZ4LeptonsSkimEff::analyze ( const edm::Event event,
const edm::EventSetup setup 
)
overridevirtual

Get event properties to send to builder to fill seed collection.

Implements edm::EDAnalyzer.

Definition at line 80 of file HiggsToZZ4LeptonsSkimEff.cc.

80  {
81  nEvents++;
82 
84 
85  bool keepEvent = false;
86 
87  // First, pre-selection:
88  int nMuon = 0;
89  int nElec = 0;
90  int nTau = 0;
91 
92  bool isFourE = false;
93  bool isFourM = false;
94  bool isTwoETwoM = false;
95  bool isFourL = false;
96  bool isTau = false;
97 
98  // get gen particle candidates
100  event.getByToken(genToken, genCandidates);
101 
102  for (CandidateCollection::const_iterator mcIter = genCandidates->begin(); mcIter != genCandidates->end(); ++mcIter) {
103  // Muons:
104  if (mcIter->pdgId() == 13 || mcIter->pdgId() == -13) {
105  // Mother is a Z
106  if (mcIter->mother()->pdgId() == 23) {
107  // In fiducial volume:
108  if (mcIter->eta() > -2.4 && mcIter->eta() < 2.4)
109  nMuon++;
110  }
111  }
112  // Electrons:
113  if (mcIter->pdgId() == 11 || mcIter->pdgId() == -11) {
114  // Mother is a Z
115  if (mcIter->mother()->pdgId() == 23) {
116  // In fiducial volume:
117  if (mcIter->eta() > -2.5 && mcIter->eta() < 2.5)
118  nElec++;
119  }
120  }
121  // Taus:
122  if (mcIter->pdgId() == 15 || mcIter->pdgId() == -15) {
123  // Mother is a Z
124  if (mcIter->mother()->pdgId() == 23) {
125  // In fiducial volume:
126  if (mcIter->eta() > -2.5 && mcIter->eta() < 2.5)
127  nTau++;
128  }
129  }
130  }
131 
132  if (nElec > 3) {
133  isFourE = true;
134  nFourE++;
135  }
136  if (nMuon > 3) {
137  isFourM = true;
138  nFourM++;
139  }
140  if (nMuon > 1 && nElec > 1) {
141  isTwoETwoM = true;
142  nTwoETwoM++;
143  }
144  if (isFourE || isFourM || isTwoETwoM) {
145  isFourL = true;
146  nFourL++;
147  }
148  if (nTau > 1) {
149  isTau = true;
150  nTau++;
151  }
152 
153  if (isFourL) {
154  keepEvent = true;
155  } else {
156  return;
157  }
158 
159  int nStiffLeptons = 0;
160  int nLeptons = 0;
161 
162  // First look at muons:
163 
164  // Get the muon track collection from the event
166  event.getByToken(theGLBMuonToken, muTracks);
167 
168  if (muTracks.isValid()) {
169  reco::TrackCollection::const_iterator muons;
170 
171  // Loop over muon collections and count how many muons there are,
172  // and how many are above threshold
173  for (muons = muTracks->begin(); muons != muTracks->end(); ++muons) {
174  float pt_mu = muons->pt();
175  if (pt_mu > stiffMinPt)
176  nStiffLeptons++;
177  if (pt_mu > softMinPt)
178  nLeptons++;
179  }
180  }
181 
182  // Now look at electrons:
183 
184  // Get the electron track collection from the event
186  event.getByToken(theGsfEToken, pTracks);
187 
188  if (pTracks.isValid()) {
189  const reco::GsfElectronCollection* eTracks = pTracks.product();
190 
191  reco::GsfElectronCollection::const_iterator electrons;
192 
193  // Loop over electron collections and count how many muons there are,
194  // and how many are above threshold
195  for (electrons = eTracks->begin(); electrons != eTracks->end(); ++electrons) {
196  float pt_e = electrons->pt();
197  if (pt_e > stiffMinPt)
198  nStiffLeptons++;
199  if (pt_e > softMinPt)
200  nLeptons++;
201  }
202  }
203 
204  // Make decision:
205  if (nStiffLeptons >= nStiffLeptonMin && nLeptons >= nLeptonMin) {
206  keepEvent = true;
207  } else {
208  keepEvent = false;
209  }
210 
211  if (keepEvent) {
212  if (isFourE)
213  nSelFourE++;
214  if (isFourM)
215  nSelFourM++;
216  if (isTwoETwoM)
217  nSelTwoETwoM++;
218  if (isFourL)
219  nSelFourL++;
220  if (isTau)
221  nSelTau++;
222  }
223 }

References pwdgSkimBPark_cfi::electrons, genCandidates_cfi::genCandidates, reco::isTau(), edm::HandleBase::isValid(), PDWG_BPHSkim_cff::muons, nEvents, and edm::Handle< T >::product().

Member Data Documentation

◆ debug

bool HiggsToZZ4LeptonsSkimEff::debug
private

◆ genToken

edm::EDGetTokenT<reco::GenParticleCollection> HiggsToZZ4LeptonsSkimEff::genToken
private

Definition at line 53 of file HiggsToZZ4LeptonsSkimEff.h.

◆ nEvents

int HiggsToZZ4LeptonsSkimEff::nEvents
private

Definition at line 47 of file HiggsToZZ4LeptonsSkimEff.h.

Referenced by looper.Looper::loop().

◆ nFourE

int HiggsToZZ4LeptonsSkimEff::nFourE
private

Definition at line 48 of file HiggsToZZ4LeptonsSkimEff.h.

◆ nFourL

int HiggsToZZ4LeptonsSkimEff::nFourL
private

Definition at line 48 of file HiggsToZZ4LeptonsSkimEff.h.

◆ nFourM

int HiggsToZZ4LeptonsSkimEff::nFourM
private

Definition at line 48 of file HiggsToZZ4LeptonsSkimEff.h.

◆ nLeptonMin

int HiggsToZZ4LeptonsSkimEff::nLeptonMin
private

Definition at line 45 of file HiggsToZZ4LeptonsSkimEff.h.

◆ nSelFourE

int HiggsToZZ4LeptonsSkimEff::nSelFourE
private

Definition at line 47 of file HiggsToZZ4LeptonsSkimEff.h.

◆ nSelFourL

int HiggsToZZ4LeptonsSkimEff::nSelFourL
private

Definition at line 47 of file HiggsToZZ4LeptonsSkimEff.h.

◆ nSelFourM

int HiggsToZZ4LeptonsSkimEff::nSelFourM
private

Definition at line 47 of file HiggsToZZ4LeptonsSkimEff.h.

◆ nSelTau

int HiggsToZZ4LeptonsSkimEff::nSelTau
private

Definition at line 47 of file HiggsToZZ4LeptonsSkimEff.h.

◆ nSelTwoETwoM

int HiggsToZZ4LeptonsSkimEff::nSelTwoETwoM
private

Definition at line 47 of file HiggsToZZ4LeptonsSkimEff.h.

◆ nStiffLeptonMin

int HiggsToZZ4LeptonsSkimEff::nStiffLeptonMin
private

Definition at line 44 of file HiggsToZZ4LeptonsSkimEff.h.

◆ nTau

int HiggsToZZ4LeptonsSkimEff::nTau
private

Definition at line 48 of file HiggsToZZ4LeptonsSkimEff.h.

◆ nTwoETwoM

int HiggsToZZ4LeptonsSkimEff::nTwoETwoM
private

Definition at line 48 of file HiggsToZZ4LeptonsSkimEff.h.

◆ softMinPt

float HiggsToZZ4LeptonsSkimEff::softMinPt
private

Definition at line 43 of file HiggsToZZ4LeptonsSkimEff.h.

◆ stiffMinPt

float HiggsToZZ4LeptonsSkimEff::stiffMinPt
private

Definition at line 42 of file HiggsToZZ4LeptonsSkimEff.h.

◆ theGLBMuonToken

edm::EDGetTokenT<reco::TrackCollection> HiggsToZZ4LeptonsSkimEff::theGLBMuonToken
private

Definition at line 51 of file HiggsToZZ4LeptonsSkimEff.h.

◆ theGsfEToken

edm::EDGetTokenT<reco::GsfElectronCollection> HiggsToZZ4LeptonsSkimEff::theGsfEToken
private

Definition at line 52 of file HiggsToZZ4LeptonsSkimEff.h.

HiggsToZZ4LeptonsSkimEff::nFourL
int nFourL
Definition: HiggsToZZ4LeptonsSkimEff.h:48
PDWG_BPHSkim_cff.muons
muons
Definition: PDWG_BPHSkim_cff.py:47
HiggsToZZ4LeptonsSkimEff::nTwoETwoM
int nTwoETwoM
Definition: HiggsToZZ4LeptonsSkimEff.h:48
HiggsToZZ4LeptonsSkimEff::nTau
int nTau
Definition: HiggsToZZ4LeptonsSkimEff.h:48
edm::Handle::product
T const * product() const
Definition: Handle.h:70
HiggsToZZ4LeptonsSkimEff::nSelFourL
int nSelFourL
Definition: HiggsToZZ4LeptonsSkimEff.h:47
HiggsToZZ4LeptonsSkimEff::softMinPt
float softMinPt
Definition: HiggsToZZ4LeptonsSkimEff.h:43
HiggsToZZ4LeptonsSkimEff::nFourM
int nFourM
Definition: HiggsToZZ4LeptonsSkimEff.h:48
gather_cfg.cout
cout
Definition: gather_cfg.py:144
reco::GsfElectronCollection
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
Definition: GsfElectronFwd.h:14
edm::Handle
Definition: AssociativeIterator.h:50
HiggsToZZ4LeptonsSkimEff::genToken
edm::EDGetTokenT< reco::GenParticleCollection > genToken
Definition: HiggsToZZ4LeptonsSkimEff.h:53
HiggsToZZ4LeptonsSkimEff::nLeptonMin
int nLeptonMin
Definition: HiggsToZZ4LeptonsSkimEff.h:45
edm::OwnVector::const_iterator
Definition: OwnVector.h:41
genCandidates_cfi.genCandidates
genCandidates
Definition: genCandidates_cfi.py:3
HiggsToZZ4LeptonsSkimEff::nStiffLeptonMin
int nStiffLeptonMin
Definition: HiggsToZZ4LeptonsSkimEff.h:44
HiggsToZZ4LeptonsSkimEff::nSelTau
int nSelTau
Definition: HiggsToZZ4LeptonsSkimEff.h:47
HiggsToZZ4LeptonsSkimEff::nSelTwoETwoM
int nSelTwoETwoM
Definition: HiggsToZZ4LeptonsSkimEff.h:47
HiggsToZZ4LeptonsSkimEff::nSelFourE
int nSelFourE
Definition: HiggsToZZ4LeptonsSkimEff.h:47
HiggsToZZ4LeptonsSkimEff::theGsfEToken
edm::EDGetTokenT< reco::GsfElectronCollection > theGsfEToken
Definition: HiggsToZZ4LeptonsSkimEff.h:52
HiggsToZZ4LeptonsSkimEff::nEvents
int nEvents
Definition: HiggsToZZ4LeptonsSkimEff.h:47
HiggsToZZ4LeptonsSkimEff::debug
bool debug
Definition: HiggsToZZ4LeptonsSkimEff.h:41
pwdgSkimBPark_cfi.electrons
electrons
Definition: pwdgSkimBPark_cfi.py:6
HiggsToZZ4LeptonsSkimEff::nFourE
int nFourE
Definition: HiggsToZZ4LeptonsSkimEff.h:48
HiggsToZZ4LeptonsSkimEff::theGLBMuonToken
edm::EDGetTokenT< reco::TrackCollection > theGLBMuonToken
Definition: HiggsToZZ4LeptonsSkimEff.h:51
reco::isTau
bool isTau(const Candidate &part)
Definition: pdgIdUtils.h:11
HiggsToZZ4LeptonsSkimEff::nSelFourM
int nSelFourM
Definition: HiggsToZZ4LeptonsSkimEff.h:47
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
HiggsToZZ4LeptonsSkimEff::stiffMinPt
float stiffMinPt
Definition: HiggsToZZ4LeptonsSkimEff.h:42
edm::InputTag
Definition: InputTag.h:15
reco::TrackCollection
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27