CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
WMuNuSelector Class Reference
Inheritance diagram for WMuNuSelector:
edm::EDFilter edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

void beginJob () override
 
void endJob () override
 
bool filter (edm::Event &, const edm::EventSetup &) override
 
void init_histograms ()
 
 WMuNuSelector (const edm::ParameterSet &)
 
- Public Member Functions inherited from edm::EDFilter
 EDFilter ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDFilter () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () noexcept(false) 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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
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

double acopCut_
 
edm::EDGetTokenT< reco::BeamSpotbeamSpotToken_
 
double dxyCut_
 
double eJetMin_
 
double etaCut_
 
std::map< std::string, TH1D * > h1_
 
std::map< std::string, TH2D * > h2_
 
bool isAlsoTrackerMuon_
 
bool isCombinedIso_
 
double isoCut03_
 
bool isRelativeIso_
 
edm::EDGetTokenT< edm::View< reco::Jet > > jetToken_
 
double metMax_
 
double metMin_
 
double mtMax_
 
double mtMin_
 
edm::EDGetTokenT< edm::View< reco::Muon > > muonToken_
 
const std::string muonTrig_
 
double nacop
 
double nall
 
double ncharge
 
double nid
 
double niso
 
int nJetMax_
 
double nkin
 
double nmass
 
double normalizedChi2Cut_
 
double npresel
 
double nsel
 
double ntrig
 
bool plotHistograms_
 
double ptCut_
 
double ptThrForZ1_
 
double ptThrForZ2_
 
int selectByCharge_
 
int trackerHitsCut_
 
edm::EDGetTokenT< edm::TriggerResultstrigToken_
 
edm::EDGetTokenT< reco::WMuNuCandidateCollectionWMuNuCollectionToken_
 

Additional Inherited Members

- Public Types inherited from edm::EDFilter
typedef EDFilter ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDFilter
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::ProducerBase
ProducesCollector producesCollector ()
 
- 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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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 35 of file WMuNuSelector.cc.

Constructor & Destructor Documentation

WMuNuSelector::WMuNuSelector ( const edm::ParameterSet cfg)

Definition at line 102 of file WMuNuSelector.cc.

103  : // Fast selection (no histograms)
104  plotHistograms_(cfg.getUntrackedParameter<bool>("plotHistograms", true)),
105 
106  // Input collections
107  trigToken_(consumes<TriggerResults>(
108  cfg.getUntrackedParameter<edm::InputTag>("TrigTag", edm::InputTag("TriggerResults::HLT")))),
110  jetToken_(
111  consumes<View<Jet> >(cfg.getUntrackedParameter<edm::InputTag>("JetTag", edm::InputTag("sisCone5CaloJets")))),
112  beamSpotToken_(consumes<reco::BeamSpot>(edm::InputTag("offlineBeamSpot"))),
113  WMuNuCollectionToken_(consumes<reco::WMuNuCandidateCollection>(
114  cfg.getUntrackedParameter<edm::InputTag>("WMuNuCollectionTag", edm::InputTag("WMuNus")))),
115 
116  // Preselection cuts
117  muonTrig_(cfg.getUntrackedParameter<std::string>("MuonTrig", "HLT_Mu9")),
118  ptThrForZ1_(cfg.getUntrackedParameter<double>("PtThrForZ1", 20.)),
119  ptThrForZ2_(cfg.getUntrackedParameter<double>("PtThrForZ2", 10.)),
120  eJetMin_(cfg.getUntrackedParameter<double>("EJetMin", 999999.)),
121  nJetMax_(cfg.getUntrackedParameter<int>("NJetMax", 999999)),
122 
123  // Main cuts
124  ptCut_(cfg.getUntrackedParameter<double>("PtCut", 25.)),
125  etaCut_(cfg.getUntrackedParameter<double>("EtaCut", 2.1)),
126  isRelativeIso_(cfg.getUntrackedParameter<bool>("IsRelativeIso", true)),
127  isCombinedIso_(cfg.getUntrackedParameter<bool>("IsCombinedIso", false)),
128  isoCut03_(cfg.getUntrackedParameter<double>("IsoCut03", 0.1)),
129  mtMin_(cfg.getUntrackedParameter<double>("MtMin", 50.)),
130  mtMax_(cfg.getUntrackedParameter<double>("MtMax", 200.)),
131  metMin_(cfg.getUntrackedParameter<double>("MetMin", -999999.)),
132  metMax_(cfg.getUntrackedParameter<double>("MetMax", 999999.)),
133  acopCut_(cfg.getUntrackedParameter<double>("AcopCut", 2.)),
134 
135  // Muon quality cuts
136  dxyCut_(cfg.getUntrackedParameter<double>("DxyCut", 0.2)),
137  normalizedChi2Cut_(cfg.getUntrackedParameter<double>("NormalizedChi2Cut", 10.)),
138  trackerHitsCut_(cfg.getUntrackedParameter<int>("TrackerHitsCut", 11)),
139  isAlsoTrackerMuon_(cfg.getUntrackedParameter<bool>("IsAlsoTrackerMuon", true)),
140 
141  // W+/W- Selection
142  selectByCharge_(cfg.getUntrackedParameter<int>("SelectByCharge", 0)) {}
T getUntrackedParameter(std::string const &, T const &) const
const std::string muonTrig_
edm::EDGetTokenT< edm::View< reco::Muon > > muonToken_
edm::EDGetTokenT< edm::TriggerResults > trigToken_
bool isAlsoTrackerMuon_
double ptThrForZ1_
edm::EDGetTokenT< edm::View< reco::Jet > > jetToken_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< reco::BeamSpot > beamSpotToken_
edm::EDGetTokenT< reco::WMuNuCandidateCollection > WMuNuCollectionToken_
double ptThrForZ2_
double normalizedChi2Cut_

Member Function Documentation

void WMuNuSelector::beginJob ( void  )
overridevirtual

Reimplemented from edm::EDFilter.

Definition at line 144 of file WMuNuSelector.cc.

References h1_, h2_, M_PI, TFileService::make(), nacop, nall, ncharge, nid, niso, nkin, npresel, nsel, ntrig, and plotHistograms_.

144  {
145  nall = 0;
146  ntrig = 0;
147  npresel = 0;
148  ncharge = 0;
149  nkin = 0;
150  nid = 0;
151  nacop = 0;
152  niso = 0;
153  nsel = 0;
154 
155  if (plotHistograms_) {
157  h1_["hNWCand_sel"] =
158  fs->make<TH1D>("NWCand_sel", "Nb. of WCandidates passing pre-selection (ordered by pt)", 10, 0., 10.);
159  h1_["hPtMu_sel"] = fs->make<TH1D>("ptMu_sel", "Pt mu", 100, 0., 100.);
160  h1_["hEtaMu_sel"] = fs->make<TH1D>("etaMu_sel", "Eta mu", 50, -2.5, 2.5);
161  h1_["hd0_sel"] = fs->make<TH1D>("d0_sel", "Impact parameter", 1000, -1., 1.);
162  h1_["hNHits_sel"] = fs->make<TH1D>("NumberOfValidHits_sel", "Number of Hits in Silicon", 100, 0., 100.);
163  h1_["hNormChi2_sel"] = fs->make<TH1D>("NormChi2_sel", "Chi2/ndof of global track", 1000, 0., 50.);
164  h1_["hTracker_sel"] = fs->make<TH1D>("isTrackerMuon_sel", "is Tracker Muon?", 2, 0., 2.);
165  h1_["hMET_sel"] = fs->make<TH1D>("MET_sel", "Missing Transverse Energy (GeV)", 300, 0., 300.);
166  h1_["hTMass_sel"] = fs->make<TH1D>("TMass_sel", "Rec. Transverse Mass (GeV)", 300, 0., 300.);
167  h1_["hAcop_sel"] = fs->make<TH1D>("Acop_sel", "Mu-MET acoplanarity", 50, 0., M_PI);
168  h1_["hPtSum_sel"] = fs->make<TH1D>("ptSum_sel", "Track Isolation, Sum pT (GeV)", 200, 0., 100.);
169  h1_["hPtSumN_sel"] = fs->make<TH1D>("ptSumN_sel", "Track Isolation, Sum pT/pT", 1000, 0., 10.);
170  h1_["hCal_sel"] = fs->make<TH1D>("Cal_sel", "Calorimetric isolation, HCAL+ECAL (GeV)", 200, 0., 100.);
171  h1_["hIsoTotN_sel"] = fs->make<TH1D>("isoTotN_sel", "(Sum pT + Cal)/pT", 1000, 0., 10.);
172  h1_["hIsoTot_sel"] = fs->make<TH1D>("isoTot_sel", "(Sum pT + Cal)", 200, 0., 100.);
173  h2_["hTMass_PtSum_inclusive"] = fs->make<TH2D>(
174  "TMass_PtSum_inclusive", "Rec. Transverse Mass (GeV) vs Sum pT (GeV)", 200, 0., 100., 300, 0., 300.);
175  h2_["hTMass_PtSumNorm_inclusive"] = fs->make<TH2D>(
176  "TMass_PtSumNorm_inclusive", "Rec. Transverse Mass (GeV) vs Sum Pt / Pt", 1000, 0, 10, 300, 0, 300);
177  h2_["hTMass_TotIsoNorm_inclusive"] = fs->make<TH2D>(
178  "TMass_TotIsoNorm_inclusive", "Rec. Transverse Mass (GeV) vs (Sum Pt + Cal)/Pt", 10000, 0, 10, 200, 0, 200);
179  h2_["hMET_PtSum_inclusive"] = fs->make<TH2D>(
180  "MET_PtSum_inclusive", "Missing Transverse Energy (GeV) vs Sum Pt (GeV)", 200, 0., 100., 300, 0., 300.);
181  h2_["hMET_PtSumNorm_inclusive"] = fs->make<TH2D>(
182  "MET_PtSumNorm_inclusive", "Missing Transverse Energy (GeV) vs Sum Pt/Pt", 1000, 0, 10, 300, 0, 300);
183  h2_["hMET_TotIsoNorm_inclusive"] = fs->make<TH2D>(
184  "MET_TotIsoNorm_inclusive", "Missing Transverse Energy (GeV) vs (SumPt + Cal)/Pt", 10000, 0, 10, 200, 0, 200);
185  }
186 }
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
#define M_PI
std::map< std::string, TH2D * > h2_
std::map< std::string, TH1D * > h1_
void WMuNuSelector::endJob ( void  )
overridevirtual

Reimplemented from edm::EDFilter.

Definition at line 188 of file WMuNuSelector.cc.

References Vispa.Plugins.EdmBrowser.EdmDataAccessor::all(), runTauDisplay::eid, nacop, nall, ncharge, nid, niso, nkin, npresel, nsel, ntrig, selectByCharge_, and mathSSE::sqrt().

188  {
189  double all = nall;
190  double epresel = npresel / all;
191  double etrig = ntrig / all;
192  double ekin = nkin / all;
193  double eid = nid / all;
194  double eacop = nacop / all;
195  double eiso = niso / all;
196  double esel = nsel / all;
197 
198  LogVerbatim("") << "\n>>>>>> W SELECTION SUMMARY BEGIN >>>>>>>>>>>>>>>";
199  LogVerbatim("") << "Total number of events analyzed: " << nall << " [events]";
200  LogVerbatim("") << "Total number of events triggered: " << ntrig << " [events]";
201  LogVerbatim("") << "Total number of events pre-selected: " << npresel << " [events]";
202  LogVerbatim("") << "Total number of events after kinematic cuts: " << nkin << " [events]";
203  LogVerbatim("") << "Total number of events after Muon ID cuts: " << nid << " [events]";
204  LogVerbatim("") << "Total number of events after Acop cut: " << nacop << " [events]";
205  LogVerbatim("") << "Total number of events after iso cut: " << niso << " [events]";
206  LogVerbatim("") << "Total number of events selected: " << nsel << " [events]";
207  LogVerbatim("") << "Efficiencies:";
208  LogVerbatim("") << "Trigger Efficiency: "
209  << "(" << setprecision(4) << etrig * 100. << " +/- " << setprecision(2)
210  << sqrt(etrig * (1 - etrig) / all) * 100. << ")%";
211  LogVerbatim("") << "Pre-Selection Efficiency: "
212  << "(" << setprecision(4) << epresel * 100. << " +/- " << setprecision(2)
213  << sqrt(epresel * (1 - epresel) / all) * 100. << ")%";
214  LogVerbatim("") << "Pt, Eta Selection Efficiency: "
215  << "(" << setprecision(4) << ekin * 100. << " +/- " << setprecision(2)
216  << sqrt(ekin * (1 - ekin) / all) * 100. << ")%";
217  LogVerbatim("") << "MuonID Efficiency: "
218  << "(" << setprecision(4) << eid * 100. << " +/- " << setprecision(2)
219  << sqrt(eid * (1 - eid) / all) * 100. << ")%";
220  LogVerbatim("") << "Acop Efficiency: "
221  << "(" << setprecision(4) << eacop * 100. << " +/- " << setprecision(2)
222  << sqrt(eacop * (1 - eacop) / all) * 100. << ")%";
223  LogVerbatim("") << "Iso Efficiency: "
224  << "(" << setprecision(4) << eiso * 100. << " +/- " << setprecision(2)
225  << sqrt(eiso * (1 - eiso) / all) * 100. << ")%";
226  LogVerbatim("") << "Selection Efficiency: "
227  << "(" << setprecision(4) << esel * 100. << " +/- " << setprecision(2)
228  << sqrt(esel * (1 - esel) / nall) * 100. << ")%";
229 
230  if (fabs(selectByCharge_) == 1) {
231  esel = nsel / ncharge;
232  LogVerbatim("") << "\n>>>>>> W+(-) SELECTION >>>>>>>>>>>>>>>";
233  LogVerbatim("") << "Total number of W+(-) events pre-selected: " << ncharge << " [events]";
234  LogVerbatim("") << "Total number of events selected: " << nsel << " [events]";
235  LogVerbatim("") << "Selection Efficiency only W+(-): "
236  << "(" << setprecision(4) << esel * 100. << " +/- " << setprecision(2)
237  << sqrt(esel * (1 - esel) / ncharge) * 100. << ")%";
238  }
239  LogVerbatim("") << ">>>>>> W SELECTION SUMMARY END >>>>>>>>>>>>>>>\n";
240 }
T sqrt(T t)
Definition: SSEVec.h:19
bool WMuNuSelector::filter ( edm::Event ev,
const edm::EventSetup  
)
override

Definition at line 242 of file WMuNuSelector.cc.

References edm::HLTGlobalStatus::accept(), reco::WMuNuCandidate::acop(), acopCut_, beamSpotToken_, reco::LeafCandidate::charge(), DEFINE_FWK_MODULE, PVValHelper::dxy, eJetMin_, reco::MuonIsolation::emEt, reco::WMuNuCandidate::eT(), reco::LeafCandidate::et(), PVValHelper::eta, reco::LeafCandidate::eta(), etaCut_, edm::Event::getByToken(), reco::WMuNuCandidate::getMuon(), reco::WMuNuCandidate::getNeutrino(), muon::GlobalMuonPromptTight, reco::Muon::globalTrack(), h1_, h2_, reco::MuonIsolation::hadEt, mps_fire::i, isCombinedIso_, reco::Muon::isGlobalMuon(), muon::isGoodMuon(), isoCut03_, reco::Muon::isolationR03(), isRelativeIso_, reco::Muon::isTrackerMuon(), metsig::jet, jetfilter_cfi::jetCollection, jetToken_, LogTrace, reco::WMuNuCandidate::massT(), BTaggingMonitor_cfi::met, metMax_, mtMax_, amptDefaultParameters_cff::mu, pdwgLeptonRecoSkim_cfi::muonCollection, muonToken_, muonTrig_, nacop, nall, ncharge, nid, niso, nJetMax_, BTaggingMonitoring_cff::njets, nkin, TrackCollections2monitor_cff::normalizedChi2, normalizedChi2Cut_, npresel, nsel, ntrig, plotHistograms_, reco::BeamSpot::position(), DiDispStaMuonMonitor_cfi::pt, reco::LeafCandidate::pt(), ptCut_, ptThrForZ1_, ptThrForZ2_, reco::LeafCandidate::px(), reco::LeafCandidate::py(), selectByCharge_, reco::MuonIsolation::sumPt, trackerHitsCut_, edm::TriggerNames::triggerIndex(), L1TEGammaOffline_cfi::triggerNames, edm::Event::triggerNames(), triggerResults, trigToken_, and WMuNuCollectionToken_.

Referenced by Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::filter(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::find(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::setDataAccessor(), and Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::switchCenterView().

242  {
243  nall++;
244 
245  // Repeat Pre-Selection Cuts just in case...
246  // Muon collection
248  if (!ev.getByToken(muonToken_, muonCollection)) {
249  LogError("") << ">>> Muon collection does not exist !!!";
250  return false;
251  }
252  unsigned int muonCollectionSize = muonCollection->size();
253 
254  // Trigger
256  if (!ev.getByToken(trigToken_, triggerResults)) {
257  LogError("") << ">>> TRIGGER collection does not exist !!!";
258  return false;
259  }
260  const edm::TriggerNames& triggerNames = ev.triggerNames(*triggerResults);
261  bool trigger_fired = false;
262  int itrig1 = triggerNames.triggerIndex(muonTrig_);
263  if (triggerResults->accept(itrig1))
264  trigger_fired = true;
265  LogTrace("") << ">>> Trigger bit: " << trigger_fired << " (" << muonTrig_ << ")";
266 
267  // Loop to reject/control Z->mumu is done separately
268  unsigned int nmuonsForZ1 = 0;
269  unsigned int nmuonsForZ2 = 0;
270  for (unsigned int i = 0; i < muonCollectionSize; i++) {
271  const Muon& mu = muonCollection->at(i);
272  if (!mu.isGlobalMuon())
273  continue;
274  double pt = mu.pt();
275  if (pt > ptThrForZ1_)
276  nmuonsForZ1++;
277  if (pt > ptThrForZ2_)
278  nmuonsForZ2++;
279  }
280  LogTrace("") << "> Z rejection: muons above " << ptThrForZ1_ << " [GeV]: " << nmuonsForZ1;
281  LogTrace("") << "> Z rejection: muons above " << ptThrForZ2_ << " [GeV]: " << nmuonsForZ2;
282 
283  // Jet collection
285  if (!ev.getByToken(jetToken_, jetCollection)) {
286  LogError("") << ">>> JET collection does not exist !!!";
287  return false;
288  }
289  unsigned int jetCollectionSize = jetCollection->size();
290  int njets = 0;
291  for (unsigned int i = 0; i < jetCollectionSize; i++) {
292  const Jet& jet = jetCollection->at(i);
293  if (jet.et() > eJetMin_)
294  njets++;
295  }
296  LogTrace("") << ">>> Total number of jets: " << jetCollectionSize;
297  LogTrace("") << ">>> Number of jets above " << eJetMin_ << " [GeV]: " << njets;
298 
299  // Beam spot
300  Handle<reco::BeamSpot> beamSpotHandle;
301  if (!ev.getByToken(beamSpotToken_, beamSpotHandle)) {
302  LogTrace("") << ">>> No beam spot found !!!";
303  return false;
304  }
305 
306  // Get WMuNu candidates from file:
307 
309  if (!ev.getByToken(WMuNuCollectionToken_, WMuNuCollection)) {
310  LogTrace("") << ">>> WMuNu not found !!!";
311  return false;
312  }
313 
314  if (WMuNuCollection->empty()) {
315  LogTrace("") << "No WMuNu Candidates in the Event!";
316  return false;
317  }
318  if (WMuNuCollection->size() > 1) {
319  LogTrace("") << "This event contains more than one W Candidate";
320  }
321 
322  // W->mu nu selection criteria
323 
324  LogTrace("") << "> WMuNu Candidate with: ";
325  const WMuNuCandidate& WMuNu = WMuNuCollection->at(0);
326  // WMuNuCandidates are ordered by Pt!
327  // The Inclusive Selection WMuNu Candidate is the first one
328 
329  const reco::Muon& mu = WMuNu.getMuon();
330  const reco::MET& met = WMuNu.getNeutrino();
331  if (plotHistograms_) {
332  h1_["hNWCand_sel"]->Fill(WMuNuCollection->size());
333  }
334 
335  // Preselection cuts:
336 
337  if (!trigger_fired) {
338  LogTrace("") << "Event did not fire the Trigger";
339  return false;
340  }
341  ntrig++;
342 
343  if (nmuonsForZ1 >= 1 && nmuonsForZ2 >= 2) {
344  LogTrace("") << "Z Candidate!!";
345  return false;
346  }
347  if (njets > nJetMax_) {
348  LogTrace("") << "NJets > threshold";
349  return false;
350  }
351 
352  npresel++;
353 
354  // Select Ws by charge:
355 
356  if (selectByCharge_ * WMuNu.charge() == -1) {
357  ncharge++;
358  }
359 
360  // W->mu nu selection criteria
361 
362  if (!mu.isGlobalMuon())
363  return false;
364 
365  reco::TrackRef gm = mu.globalTrack();
366  //reco::TrackRef tk = mu.innerTrack();
367 
368  // Pt,eta cuts
369  double pt = mu.pt();
370  double eta = mu.eta();
371  LogTrace("") << "\t... Muon pt, eta: " << pt << " [GeV], " << eta;
372  if (plotHistograms_) {
373  h1_["hPtMu_sel"]->Fill(pt);
374  }
375  if (pt < ptCut_)
376  return false;
377  if (plotHistograms_) {
378  h1_["hEtaMu_sel"]->Fill(eta);
379  }
380  if (fabs(eta) > etaCut_)
381  return false;
382 
383  nkin++;
384 
385  // d0, chi2, nhits quality cuts
386  double dxy = gm->dxy(beamSpotHandle->position());
387  double normalizedChi2 = gm->normalizedChi2();
388  LogTrace("") << "Im here" << endl;
389  double trackerHits = gm->hitPattern().numberOfValidTrackerHits();
390  LogTrace("") << "\t... Muon dxy, normalizedChi2, trackerHits, isTrackerMuon?: " << dxy << " [cm], " << normalizedChi2
391  << ", " << trackerHits << ", " << mu.isTrackerMuon();
392 
393  if (plotHistograms_) {
394  h1_["hd0_sel"]->Fill(dxy);
395  }
397  return false;
398  if (plotHistograms_) {
399  h1_["hNormChi2_sel"]->Fill(normalizedChi2);
400  }
401  if (normalizedChi2 > normalizedChi2Cut_)
402  return false;
403  if (plotHistograms_) {
404  h1_["hNHits_sel"]->Fill(trackerHits);
405  }
406  if (trackerHits < trackerHitsCut_)
407  return false;
408  if (plotHistograms_) {
409  h1_["hTracker_sel"]->Fill(mu.isTrackerMuon());
410  }
411  if (!mu.isTrackerMuon())
412  return false;
413 
414  nid++;
415 
416  // Acoplanarity cuts
417  double acop = WMuNu.acop();
418  LogTrace("") << "\t... acoplanarity: " << acop;
419 
420  // Isolation cuts
421  double SumPt = mu.isolationR03().sumPt;
422  double isovar = SumPt;
423  double Cal = mu.isolationR03().emEt + mu.isolationR03().hadEt;
424  if (isCombinedIso_)
425  isovar += Cal;
426  if (plotHistograms_) {
427  h1_["hPtSum_sel"]->Fill(SumPt);
428  h1_["hPtSumN_sel"]->Fill(SumPt / pt);
429  h1_["hCal_sel"]->Fill(Cal);
430  h1_["hIsoTot_sel"]->Fill((SumPt + Cal));
431  h1_["hIsoTotN_sel"]->Fill((SumPt + Cal) / pt);
432  }
433 
434  if (isRelativeIso_)
435  isovar /= pt;
436  bool iso = (isovar <= isoCut03_);
437  LogTrace("") << "\t... isolation value" << isovar << ", isolated? " << iso;
438 
439  double met_et = met.pt();
440  LogTrace("") << "\t... Met pt: " << WMuNu.getNeutrino().pt() << "[GeV]";
441 
442  double massT = WMuNu.massT();
443  double w_et = WMuNu.eT();
444 
445  LogTrace("") << "\t... W mass, W_et, W_px, W_py: " << massT << ", " << w_et << ", " << WMuNu.px() << ", "
446  << WMuNu.py() << " [GeV]";
447 
448  // Plot 2D Histograms before final cuts
449  if (plotHistograms_ && acop < acopCut_) {
450  h2_["hTMass_PtSum_inclusive"]->Fill(SumPt, massT);
451  h2_["hTMass_PtSumNorm_inclusive"]->Fill(SumPt / pt, massT);
452  h2_["hTMass_TotIsoNorm_inclusive"]->Fill((SumPt + Cal) / pt, massT);
453  h2_["hMET_PtSum_inclusive"]->Fill(SumPt, met_et);
454  h2_["hMET_PtSumNorm_inclusive"]->Fill(SumPt / pt, met_et);
455  h2_["hMET_TotIsoNorm_inclusive"]->Fill((SumPt + Cal) / pt, met_et);
456  }
457 
458  if (!iso)
459  return false;
460 
461  niso++;
462 
463  if (plotHistograms_) {
464  h1_["hAcop_sel"]->Fill(acop);
465  }
466  if (acop >= acopCut_)
467  return false;
468 
469  nacop++;
470 
471  if (plotHistograms_) {
472  h1_["hMET_sel"]->Fill(met_et);
473  h1_["hTMass_sel"]->Fill(massT);
474  }
475 
476  if (massT <= mtMin_ || massT >= mtMax_)
477  return false;
478  if (met_et <= metMin_ || met_et >= metMax_)
479  return false;
480 
481  LogTrace("") << ">>>> Event ACCEPTED";
482  nsel++;
483 
484  // (To be continued ;-) )
485 
486  return true;
487 }
float hadEt
hcal sum-Et
Definition: MuonIsolation.h:8
const std::string muonTrig_
double eta() const final
momentum pseudorapidity
edm::EDGetTokenT< edm::View< reco::Muon > > muonToken_
float sumPt
sum-pt of tracks
Definition: MuonIsolation.h:6
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
edm::EDGetTokenT< edm::TriggerResults > trigToken_
double px() const final
x coordinate of momentum vector
bool accept() const
Has at least one path accepted the event?
double pt() const final
transverse momentum
int charge() const final
electric charge
double ptThrForZ1_
edm::EDGetTokenT< edm::View< reco::Jet > > jetToken_
bool isTrackerMuon() const override
Definition: Muon.h:299
edm::EDGetTokenT< reco::BeamSpot > beamSpotToken_
unsigned int triggerIndex(std::string const &name) const
Definition: TriggerNames.cc:24
Definition: Muon.py:1
Definition: Jet.py:1
double et() const final
transverse energy
bool isGlobalMuon() const override
Definition: Muon.h:298
Definition: MET.h:41
double eT() const
float emEt
ecal sum-Et
Definition: MuonIsolation.h:7
double acop() const
static std::string const triggerResults
Definition: EdmProvDump.cc:45
#define LogTrace(id)
bool isGoodMuon(const reco::Muon &muon, SelectionType type, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
main GoodMuon wrapper call
double py() const final
y coordinate of momentum vector
std::map< std::string, TH2D * > h2_
double massT() const
edm::EDGetTokenT< reco::WMuNuCandidateCollection > WMuNuCollectionToken_
double ptThrForZ2_
const Point & position() const
position
Definition: BeamSpot.h:59
std::map< std::string, TH1D * > h1_
double normalizedChi2Cut_
const reco::Muon & getMuon() const
const reco::MET & getNeutrino() const
edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const override
Definition: Event.cc:265
const MuonIsolation & isolationR03() const
Definition: Muon.h:166
virtual TrackRef globalTrack() const
reference to Track reconstructed in both tracked and muon detector
Definition: Muon.h:51
void WMuNuSelector::init_histograms ( )

Member Data Documentation

double WMuNuSelector::acopCut_
private

Definition at line 64 of file WMuNuSelector.cc.

Referenced by filter().

edm::EDGetTokenT<reco::BeamSpot> WMuNuSelector::beamSpotToken_
private

Definition at line 48 of file WMuNuSelector.cc.

Referenced by filter().

double WMuNuSelector::dxyCut_
private

Definition at line 66 of file WMuNuSelector.cc.

double WMuNuSelector::eJetMin_
private

Definition at line 53 of file WMuNuSelector.cc.

Referenced by filter().

double WMuNuSelector::etaCut_
private

Definition at line 56 of file WMuNuSelector.cc.

Referenced by filter().

std::map<std::string, TH1D*> WMuNuSelector::h1_
private

Definition at line 79 of file WMuNuSelector.cc.

Referenced by beginJob(), and filter().

std::map<std::string, TH2D*> WMuNuSelector::h2_
private

Definition at line 80 of file WMuNuSelector.cc.

Referenced by beginJob(), and filter().

bool WMuNuSelector::isAlsoTrackerMuon_
private

Definition at line 69 of file WMuNuSelector.cc.

bool WMuNuSelector::isCombinedIso_
private

Definition at line 58 of file WMuNuSelector.cc.

Referenced by filter().

double WMuNuSelector::isoCut03_
private

Definition at line 59 of file WMuNuSelector.cc.

Referenced by filter().

bool WMuNuSelector::isRelativeIso_
private

Definition at line 57 of file WMuNuSelector.cc.

Referenced by filter().

edm::EDGetTokenT<edm::View<reco::Jet> > WMuNuSelector::jetToken_
private

Definition at line 47 of file WMuNuSelector.cc.

Referenced by filter().

double WMuNuSelector::metMax_
private

Definition at line 63 of file WMuNuSelector.cc.

Referenced by filter().

double WMuNuSelector::metMin_
private

Definition at line 62 of file WMuNuSelector.cc.

double WMuNuSelector::mtMax_
private

Definition at line 61 of file WMuNuSelector.cc.

Referenced by filter().

double WMuNuSelector::mtMin_
private

Definition at line 60 of file WMuNuSelector.cc.

edm::EDGetTokenT<edm::View<reco::Muon> > WMuNuSelector::muonToken_
private

Definition at line 46 of file WMuNuSelector.cc.

Referenced by filter().

const std::string WMuNuSelector::muonTrig_
private

Definition at line 50 of file WMuNuSelector.cc.

Referenced by filter().

double WMuNuSelector::nacop
private

Definition at line 77 of file WMuNuSelector.cc.

Referenced by beginJob(), endJob(), and filter().

double WMuNuSelector::nall
private

Definition at line 73 of file WMuNuSelector.cc.

Referenced by beginJob(), endJob(), and filter().

double WMuNuSelector::ncharge
private

Definition at line 76 of file WMuNuSelector.cc.

Referenced by beginJob(), endJob(), and filter().

double WMuNuSelector::nid
private

Definition at line 77 of file WMuNuSelector.cc.

Referenced by beginJob(), endJob(), and filter().

double WMuNuSelector::niso
private

Definition at line 77 of file WMuNuSelector.cc.

Referenced by beginJob(), endJob(), and filter().

int WMuNuSelector::nJetMax_
private

Definition at line 54 of file WMuNuSelector.cc.

Referenced by filter().

double WMuNuSelector::nkin
private

Definition at line 77 of file WMuNuSelector.cc.

Referenced by beginJob(), endJob(), and filter().

double WMuNuSelector::nmass
private

Definition at line 77 of file WMuNuSelector.cc.

double WMuNuSelector::normalizedChi2Cut_
private

Definition at line 67 of file WMuNuSelector.cc.

Referenced by filter().

double WMuNuSelector::npresel
private

Definition at line 74 of file WMuNuSelector.cc.

Referenced by beginJob(), endJob(), and filter().

double WMuNuSelector::nsel
private

Definition at line 75 of file WMuNuSelector.cc.

Referenced by beginJob(), endJob(), and filter().

double WMuNuSelector::ntrig
private

Definition at line 74 of file WMuNuSelector.cc.

Referenced by beginJob(), endJob(), and filter().

bool WMuNuSelector::plotHistograms_
private

Definition at line 44 of file WMuNuSelector.cc.

Referenced by beginJob(), and filter().

double WMuNuSelector::ptCut_
private
double WMuNuSelector::ptThrForZ1_
private

Definition at line 51 of file WMuNuSelector.cc.

Referenced by filter().

double WMuNuSelector::ptThrForZ2_
private

Definition at line 52 of file WMuNuSelector.cc.

Referenced by filter().

int WMuNuSelector::selectByCharge_
private

Definition at line 71 of file WMuNuSelector.cc.

Referenced by endJob(), and filter().

int WMuNuSelector::trackerHitsCut_
private

Definition at line 68 of file WMuNuSelector.cc.

Referenced by filter().

edm::EDGetTokenT<edm::TriggerResults> WMuNuSelector::trigToken_
private

Definition at line 45 of file WMuNuSelector.cc.

Referenced by filter().

edm::EDGetTokenT<reco::WMuNuCandidateCollection> WMuNuSelector::WMuNuCollectionToken_
private

Definition at line 49 of file WMuNuSelector.cc.

Referenced by filter().