CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 Get event properties to send to builder to fill seed collection. More...
 
 HiggsToZZ4LeptonsSkimEff (const edm::ParameterSet &)
 
 ~HiggsToZZ4LeptonsSkimEff ()
 
- 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
 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 (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

bool debug
 
edm::EDGetTokenT
< reco::GenParticleCollection
genToken
 
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::TrackCollection
theGLBMuonToken
 
edm::EDGetTokenT
< reco::GsfElectronCollection
theGsfEToken
 

Additional Inherited Members

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

Constructor & Destructor Documentation

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

Definition at line 39 of file HiggsToZZ4LeptonsSkimEff.cc.

References debug, edm::ParameterSet::getParameter(), and nEvents.

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

Definition at line 64 of file HiggsToZZ4LeptonsSkimEff.cc.

References gather_cfg::cout, and nEvents.

64  {
65 
66  std::cout << "Number of events read " << nEvents << std::endl;
67  std::cout << "*** Efficiency for the various subsamples *** " << endl;
68 
69  std::cout << "Four leptons: "
70  << " pres " << nFourL
71  << " kept " << nSelFourL
72  << " eff " << ((double)nSelFourL)/((double) nFourL + 0.0001) << std::endl;
73  std::cout << "Four muons: "
74  << " pres " << nFourM
75  << " kept " << nSelFourM
76  << " eff " << ((double)nSelFourM)/((double) nFourM + 0.0001) << std::endl;
77  std::cout << "Four elecs: "
78  << " pres " << nFourE
79  << " kept " << nSelFourE
80  << " eff " << ((double)nSelFourE)/((double) nFourE + 0.0001) << std::endl;
81  std::cout << "2 elec 2 mu: "
82  << " pres " << nTwoETwoM
83  << " kept " << nSelTwoETwoM
84  << " eff " << ((double)nSelTwoETwoM)/((double) nTwoETwoM + 0.0001) << std::endl;
85  std::cout << "with taus: "
86  << " pres " << nTau
87  << " kept " << nSelTau
88  << " eff " << ((double)nSelTau)/((double) nTau + 0.0001) << std::endl;
89 
90 }
tuple cout
Definition: gather_cfg.py:121

Member Function Documentation

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

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

Implements edm::EDAnalyzer.

Definition at line 95 of file HiggsToZZ4LeptonsSkimEff.cc.

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

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

Member Data Documentation

bool HiggsToZZ4LeptonsSkimEff::debug
private

Definition at line 43 of file HiggsToZZ4LeptonsSkimEff.h.

Referenced by rrapi.RRApi::dprint(), and rrapi.RRApi::get().

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

Definition at line 55 of file HiggsToZZ4LeptonsSkimEff.h.

int HiggsToZZ4LeptonsSkimEff::nEvents
private

Definition at line 49 of file HiggsToZZ4LeptonsSkimEff.h.

Referenced by looper.Looper::loop().

int HiggsToZZ4LeptonsSkimEff::nFourE
private

Definition at line 50 of file HiggsToZZ4LeptonsSkimEff.h.

int HiggsToZZ4LeptonsSkimEff::nFourL
private

Definition at line 50 of file HiggsToZZ4LeptonsSkimEff.h.

int HiggsToZZ4LeptonsSkimEff::nFourM
private

Definition at line 50 of file HiggsToZZ4LeptonsSkimEff.h.

int HiggsToZZ4LeptonsSkimEff::nLeptonMin
private

Definition at line 47 of file HiggsToZZ4LeptonsSkimEff.h.

int HiggsToZZ4LeptonsSkimEff::nSelFourE
private

Definition at line 49 of file HiggsToZZ4LeptonsSkimEff.h.

int HiggsToZZ4LeptonsSkimEff::nSelFourL
private

Definition at line 49 of file HiggsToZZ4LeptonsSkimEff.h.

int HiggsToZZ4LeptonsSkimEff::nSelFourM
private

Definition at line 49 of file HiggsToZZ4LeptonsSkimEff.h.

int HiggsToZZ4LeptonsSkimEff::nSelTau
private

Definition at line 49 of file HiggsToZZ4LeptonsSkimEff.h.

int HiggsToZZ4LeptonsSkimEff::nSelTwoETwoM
private

Definition at line 49 of file HiggsToZZ4LeptonsSkimEff.h.

int HiggsToZZ4LeptonsSkimEff::nStiffLeptonMin
private

Definition at line 46 of file HiggsToZZ4LeptonsSkimEff.h.

int HiggsToZZ4LeptonsSkimEff::nTau
private

Definition at line 50 of file HiggsToZZ4LeptonsSkimEff.h.

int HiggsToZZ4LeptonsSkimEff::nTwoETwoM
private

Definition at line 50 of file HiggsToZZ4LeptonsSkimEff.h.

float HiggsToZZ4LeptonsSkimEff::softMinPt
private

Definition at line 45 of file HiggsToZZ4LeptonsSkimEff.h.

float HiggsToZZ4LeptonsSkimEff::stiffMinPt
private

Definition at line 44 of file HiggsToZZ4LeptonsSkimEff.h.

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

Definition at line 53 of file HiggsToZZ4LeptonsSkimEff.h.

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

Definition at line 54 of file HiggsToZZ4LeptonsSkimEff.h.