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
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

bool debug
 
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
 
edm::InputTag recTrackLabel
 
float softMinPt
 
float stiffMinPt
 
edm::InputTag theGLBMuonLabel
 
edm::InputTag thePixelGsfELabel
 

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 25 of file HiggsToZZ4LeptonsSkimEff.h.

Constructor & Destructor Documentation

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

Definition at line 41 of file HiggsToZZ4LeptonsSkimEff.cc.

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

41  {
42 
43  // Local Debug flag
44  debug = pset.getParameter<bool>("DebugHiggsToZZ4LeptonsSkim");
45 
46  // Reconstructed objects
47  recTrackLabel = pset.getParameter<edm::InputTag>("RecoTrackLabel");
48  theGLBMuonLabel = pset.getParameter<edm::InputTag>("GlobalMuonCollectionLabel");
49  thePixelGsfELabel = pset.getParameter<edm::InputTag>("ElectronCollectionLabel");
50 
51  // Minimum Pt for leptons for skimming
52  // Minimum Pt for leptons for skimming
53  stiffMinPt = pset.getParameter<double>("stiffMinimumPt");
54  softMinPt = pset.getParameter<double>("softMinimumPt");
55  nStiffLeptonMin = pset.getParameter<int>("nStiffLeptonMinimum");
56  nLeptonMin = pset.getParameter<int>("nLeptonMinimum");
57 
58  nEvents = 0;
60  nFourE = nFourM = nTwoETwoM = nFourL = nTau = 0;
61 
62 }
T getParameter(std::string const &) const
HiggsToZZ4LeptonsSkimEff::~HiggsToZZ4LeptonsSkimEff ( )

Definition at line 66 of file HiggsToZZ4LeptonsSkimEff.cc.

References gather_cfg::cout, and nEvents.

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

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

Member Data Documentation

bool HiggsToZZ4LeptonsSkimEff::debug
private

Definition at line 39 of file HiggsToZZ4LeptonsSkimEff.h.

int HiggsToZZ4LeptonsSkimEff::nEvents
private

Definition at line 45 of file HiggsToZZ4LeptonsSkimEff.h.

int HiggsToZZ4LeptonsSkimEff::nFourE
private

Definition at line 46 of file HiggsToZZ4LeptonsSkimEff.h.

int HiggsToZZ4LeptonsSkimEff::nFourL
private

Definition at line 46 of file HiggsToZZ4LeptonsSkimEff.h.

int HiggsToZZ4LeptonsSkimEff::nFourM
private

Definition at line 46 of file HiggsToZZ4LeptonsSkimEff.h.

int HiggsToZZ4LeptonsSkimEff::nLeptonMin
private

Definition at line 43 of file HiggsToZZ4LeptonsSkimEff.h.

int HiggsToZZ4LeptonsSkimEff::nSelFourE
private

Definition at line 45 of file HiggsToZZ4LeptonsSkimEff.h.

int HiggsToZZ4LeptonsSkimEff::nSelFourL
private

Definition at line 45 of file HiggsToZZ4LeptonsSkimEff.h.

int HiggsToZZ4LeptonsSkimEff::nSelFourM
private

Definition at line 45 of file HiggsToZZ4LeptonsSkimEff.h.

int HiggsToZZ4LeptonsSkimEff::nSelTau
private

Definition at line 45 of file HiggsToZZ4LeptonsSkimEff.h.

int HiggsToZZ4LeptonsSkimEff::nSelTwoETwoM
private

Definition at line 45 of file HiggsToZZ4LeptonsSkimEff.h.

int HiggsToZZ4LeptonsSkimEff::nStiffLeptonMin
private

Definition at line 42 of file HiggsToZZ4LeptonsSkimEff.h.

int HiggsToZZ4LeptonsSkimEff::nTau
private

Definition at line 46 of file HiggsToZZ4LeptonsSkimEff.h.

int HiggsToZZ4LeptonsSkimEff::nTwoETwoM
private

Definition at line 46 of file HiggsToZZ4LeptonsSkimEff.h.

edm::InputTag HiggsToZZ4LeptonsSkimEff::recTrackLabel
private

Definition at line 49 of file HiggsToZZ4LeptonsSkimEff.h.

float HiggsToZZ4LeptonsSkimEff::softMinPt
private

Definition at line 41 of file HiggsToZZ4LeptonsSkimEff.h.

float HiggsToZZ4LeptonsSkimEff::stiffMinPt
private

Definition at line 40 of file HiggsToZZ4LeptonsSkimEff.h.

edm::InputTag HiggsToZZ4LeptonsSkimEff::theGLBMuonLabel
private

Definition at line 50 of file HiggsToZZ4LeptonsSkimEff.h.

edm::InputTag HiggsToZZ4LeptonsSkimEff::thePixelGsfELabel
private

Definition at line 51 of file HiggsToZZ4LeptonsSkimEff.h.