40 virtual void endJob()
override;
80 std::map<std::string,TH1D*>
h1_;
81 std::map<std::string,TH2D*>
h2_;
103 using namespace reco;
107 plotHistograms_(cfg.getUntrackedParameter<bool> (
"plotHistograms",
true)),
112 jetToken_(consumes<
View<
Jet> >(cfg.getUntrackedParameter<edm::
InputTag> (
"JetTag", edm::
InputTag(
"sisCone5CaloJets")))),
118 muonTrig_(cfg.getUntrackedParameter<std::
string>(
"MuonTrig",
"HLT_Mu9")),
119 ptThrForZ1_(cfg.getUntrackedParameter<double>(
"PtThrForZ1", 20.)),
120 ptThrForZ2_(cfg.getUntrackedParameter<double>(
"PtThrForZ2", 10.)),
121 eJetMin_(cfg.getUntrackedParameter<double>(
"EJetMin", 999999.)),
122 nJetMax_(cfg.getUntrackedParameter<int>(
"NJetMax", 999999)),
126 ptCut_(cfg.getUntrackedParameter<double>(
"PtCut", 25.)),
127 etaCut_(cfg.getUntrackedParameter<double>(
"EtaCut", 2.1)),
128 isRelativeIso_(cfg.getUntrackedParameter<bool>(
"IsRelativeIso",
true)),
129 isCombinedIso_(cfg.getUntrackedParameter<bool>(
"IsCombinedIso",
false)),
130 isoCut03_(cfg.getUntrackedParameter<double>(
"IsoCut03", 0.1)),
131 mtMin_(cfg.getUntrackedParameter<double>(
"MtMin", 50.)),
132 mtMax_(cfg.getUntrackedParameter<double>(
"MtMax", 200.)),
133 metMin_(cfg.getUntrackedParameter<double>(
"MetMin", -999999.)),
134 metMax_(cfg.getUntrackedParameter<double>(
"MetMax", 999999.)),
135 acopCut_(cfg.getUntrackedParameter<double>(
"AcopCut", 2.)),
138 dxyCut_(cfg.getUntrackedParameter<double>(
"DxyCut", 0.2)),
139 normalizedChi2Cut_(cfg.getUntrackedParameter<double>(
"NormalizedChi2Cut", 10.)),
140 trackerHitsCut_(cfg.getUntrackedParameter<int>(
"TrackerHitsCut", 11)),
141 isAlsoTrackerMuon_(cfg.getUntrackedParameter<bool>(
"IsAlsoTrackerMuon",
true)),
144 selectByCharge_(cfg.getUntrackedParameter<int>(
"SelectByCharge", 0))
161 h1_[
"hNWCand_sel"] =fs->
make<TH1D>(
"NWCand_sel",
"Nb. of WCandidates passing pre-selection (ordered by pt)",10,0.,10.);
162 h1_[
"hPtMu_sel"] =fs->
make<TH1D>(
"ptMu_sel",
"Pt mu",100,0.,100.);
163 h1_[
"hEtaMu_sel"] =fs->
make<TH1D>(
"etaMu_sel",
"Eta mu",50,-2.5,2.5);
164 h1_[
"hd0_sel"] =fs->
make<TH1D>(
"d0_sel",
"Impact parameter",1000,-1.,1.);
165 h1_[
"hNHits_sel"] =fs->
make<TH1D>(
"NumberOfValidHits_sel",
"Number of Hits in Silicon",100,0.,100.);
166 h1_[
"hNormChi2_sel"] =fs->
make<TH1D>(
"NormChi2_sel",
"Chi2/ndof of global track",1000,0.,50.);
167 h1_[
"hTracker_sel"] =fs->
make<TH1D>(
"isTrackerMuon_sel",
"is Tracker Muon?",2,0.,2.);
168 h1_[
"hMET_sel"] =fs->
make<TH1D>(
"MET_sel",
"Missing Transverse Energy (GeV)", 300,0.,300.);
169 h1_[
"hTMass_sel"] =fs->
make<TH1D>(
"TMass_sel",
"Rec. Transverse Mass (GeV)",300,0.,300.);
170 h1_[
"hAcop_sel"] =fs->
make<TH1D>(
"Acop_sel",
"Mu-MET acoplanarity",50,0.,
M_PI);
171 h1_[
"hPtSum_sel"] =fs->
make<TH1D>(
"ptSum_sel",
"Track Isolation, Sum pT (GeV)",200,0.,100.);
172 h1_[
"hPtSumN_sel"] =fs->
make<TH1D>(
"ptSumN_sel",
"Track Isolation, Sum pT/pT",1000,0.,10.);
173 h1_[
"hCal_sel"] =fs->
make<TH1D>(
"Cal_sel",
"Calorimetric isolation, HCAL+ECAL (GeV)",200,0.,100.);
174 h1_[
"hIsoTotN_sel"] =fs->
make<TH1D>(
"isoTotN_sel",
"(Sum pT + Cal)/pT",1000,0.,10.);
175 h1_[
"hIsoTot_sel"] =fs->
make<TH1D>(
"isoTot_sel",
"(Sum pT + Cal)",200,0.,100.);
176 h2_[
"hTMass_PtSum_inclusive"] =fs->
make<TH2D>(
"TMass_PtSum_inclusive",
"Rec. Transverse Mass (GeV) vs Sum pT (GeV)",200,0.,100.,300,0.,300.);
177 h2_[
"hTMass_PtSumNorm_inclusive"] =fs->
make<TH2D>(
"TMass_PtSumNorm_inclusive",
"Rec. Transverse Mass (GeV) vs Sum Pt / Pt", 1000,0,10,300,0,300);
178 h2_[
"hTMass_TotIsoNorm_inclusive"]=fs->
make<TH2D>(
"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>(
"MET_PtSum_inclusive",
"Missing Transverse Energy (GeV) vs Sum Pt (GeV)",200,0.,100.,300,0.,300.);
180 h2_[
"hMET_PtSumNorm_inclusive"] =fs->
make<TH2D>(
"MET_PtSumNorm_inclusive",
"Missing Transverse Energy (GeV) vs Sum Pt/Pt",1000,0,10,300,0,300);
181 h2_[
"hMET_TotIsoNorm_inclusive"]=fs->
make<TH2D>(
"MET_TotIsoNorm_inclusive",
"Missing Transverse Energy (GeV) vs (SumPt + Cal)/Pt",10000,0,10,200,0,200);
196 LogVerbatim(
"") <<
"\n>>>>>> W SELECTION SUMMARY BEGIN >>>>>>>>>>>>>>>";
197 LogVerbatim(
"") <<
"Total number of events analyzed: " <<
nall <<
" [events]";
198 LogVerbatim(
"") <<
"Total number of events triggered: " <<
ntrig <<
" [events]";
200 LogVerbatim(
"") <<
"Total number of events after kinematic cuts: " <<
nkin <<
" [events]";
201 LogVerbatim(
"") <<
"Total number of events after Muon ID cuts: " <<
nid <<
" [events]";
202 LogVerbatim(
"") <<
"Total number of events after Acop cut: " <<
nacop <<
" [events]";
203 LogVerbatim(
"") <<
"Total number of events after iso cut: " <<
niso <<
" [events]";
204 LogVerbatim(
"") <<
"Total number of events selected: " <<
nsel <<
" [events]";
206 LogVerbatim(
"") <<
"Trigger Efficiency: " <<
"(" << setprecision(4) << etrig*100. <<
" +/- "<< setprecision(2) <<
sqrt(etrig*(1-etrig)/all)*100. <<
")%";
207 LogVerbatim(
"") <<
"Pre-Selection Efficiency: " <<
"(" << setprecision(4) << epresel*100. <<
" +/- "<< setprecision(2) <<
sqrt(epresel*(1-epresel)/all)*100. <<
")%";
208 LogVerbatim(
"") <<
"Pt, Eta Selection Efficiency: " <<
"(" << setprecision(4) << ekin*100. <<
" +/- "<< setprecision(2) <<
sqrt(ekin*(1-ekin)/all)*100. <<
")%";
209 LogVerbatim(
"") <<
"MuonID Efficiency: " <<
"(" << setprecision(4) << eid*100. <<
" +/- "<< setprecision(2) <<
sqrt(eid*(1-eid)/all)*100. <<
")%";
210 LogVerbatim(
"") <<
"Acop Efficiency: " <<
"(" << setprecision(4) << eacop*100. <<
" +/- "<< setprecision(2) <<
sqrt(eacop*(1-eacop)/all)*100. <<
")%";
211 LogVerbatim(
"") <<
"Iso Efficiency: " <<
"(" << setprecision(4) << eiso*100. <<
" +/- "<< setprecision(2) <<
sqrt(eiso*(1-eiso)/all)*100. <<
")%";
212 LogVerbatim(
"") <<
"Selection Efficiency: " <<
"(" << setprecision(4) << esel*100. <<
" +/- "<< setprecision(2) <<
sqrt(esel*(1-esel)/
nall)*100. <<
")%";
216 LogVerbatim(
"") <<
"\n>>>>>> W+(-) SELECTION >>>>>>>>>>>>>>>";
217 LogVerbatim(
"") <<
"Total number of W+(-) events pre-selected: " <<
ncharge <<
" [events]";
218 LogVerbatim(
"") <<
"Total number of events selected: " <<
nsel <<
" [events]";
219 LogVerbatim(
"") <<
"Selection Efficiency only W+(-): " <<
"(" << setprecision(4) << esel*100. <<
" +/- "<< setprecision(2) <<
sqrt(esel*(1-esel)/
ncharge)*100. <<
")%";
221 LogVerbatim(
"") <<
">>>>>> W SELECTION SUMMARY END >>>>>>>>>>>>>>>\n";
231 LogError(
"") <<
">>> Muon collection does not exist !!!";
234 unsigned int muonCollectionSize = muonCollection->size();
239 LogError(
"") <<
">>> TRIGGER collection does not exist !!!";
243 bool trigger_fired =
false;
245 if (triggerResults->accept(itrig1)) trigger_fired =
true;
246 LogTrace(
"") <<
">>> Trigger bit: " << trigger_fired <<
" (" <<
muonTrig_ <<
")";
249 unsigned int nmuonsForZ1 = 0;
250 unsigned int nmuonsForZ2 = 0;
251 for (
unsigned int i=0;
i<muonCollectionSize;
i++) {
252 const Muon&
mu = muonCollection->at(
i);
264 LogError(
"") <<
">>> JET collection does not exist !!!";
267 unsigned int jetCollectionSize = jetCollection->size();
269 for (
unsigned int i=0;
i<jetCollectionSize;
i++) {
270 const Jet&
jet = jetCollection->at(
i);
273 LogTrace(
"") <<
">>> Total number of jets: " << jetCollectionSize;
280 LogTrace(
"") <<
">>> No beam spot found !!!";
290 LogTrace(
"") <<
">>> WMuNu not found !!!";
294 if(WMuNuCollection->size() < 1) {
LogTrace(
"")<<
"No WMuNu Candidates in the Event!";
return 0;}
295 if(WMuNuCollection->size() > 1) {
LogTrace(
"")<<
"This event contains more than one W Candidate";}
299 LogTrace(
"") <<
"> WMuNu Candidate with: ";
307 h1_[
"hNWCand_sel"]->Fill(WMuNuCollection->size());
313 if (!trigger_fired) {
LogTrace(
"")<<
"Event did not fire the Trigger";
return 0;}
316 if (nmuonsForZ1>=1 && nmuonsForZ2>=2) {
LogTrace(
"")<<
"Z Candidate!!";
return 0;}
336 LogTrace(
"") <<
"\t... Muon pt, eta: " << pt <<
" [GeV], " <<
eta;
340 if (fabs(eta)>
etaCut_)
return 0;
346 double dxy = gm->dxy(beamSpotHandle->position());
348 double trackerHits = gm->hitPattern().numberOfValidTrackerHits();
349 LogTrace(
"") <<
"\t... Muon dxy, normalizedChi2, trackerHits, isTrackerMuon?: " << dxy <<
" [cm], "<<normalizedChi2 <<
", "<<trackerHits <<
", " << mu.
isTrackerMuon();
363 double acop = WMuNu.
acop();
364 LogTrace(
"") <<
"\t... acoplanarity: " << acop;
370 h1_[
"hPtSum_sel"]->Fill(SumPt);
371 h1_[
"hPtSumN_sel"]->Fill(SumPt/pt);
372 h1_[
"hCal_sel"]->Fill(Cal);
373 h1_[
"hIsoTot_sel"]->Fill( (SumPt+Cal));
374 h1_[
"hIsoTotN_sel"]->Fill( (SumPt+Cal) / pt );
379 LogTrace(
"") <<
"\t... isolation value" << isovar <<
", isolated? " <<iso ;
381 double met_et = met.
pt();
385 double massT = WMuNu.
massT();
386 double w_et = WMuNu.
eT();
388 LogTrace(
"") <<
"\t... W mass, W_et, W_px, W_py: " << massT <<
", " << w_et <<
", " << WMuNu.
px() <<
", " << WMuNu.
py() <<
" [GeV]";
393 h2_[
"hTMass_PtSum_inclusive"]->Fill(SumPt,massT);
394 h2_[
"hTMass_PtSumNorm_inclusive"]->Fill(SumPt/pt,massT);
395 h2_[
"hTMass_TotIsoNorm_inclusive"]->Fill((SumPt+Cal)/pt,massT);
396 h2_[
"hMET_PtSum_inclusive"]->Fill(SumPt,met_et);
397 h2_[
"hMET_PtSumNorm_inclusive"]->Fill(SumPt/pt,met_et);
398 h2_[
"hMET_TotIsoNorm_inclusive"]->Fill((SumPt+Cal)/pt,met_et);
411 h1_[
"hMET_sel"]->Fill(met_et);
412 h1_[
"hTMass_sel"]->Fill(massT);
416 if (massT<=mtMin_ || massT>=
mtMax_)
return 0;
417 if (met_et<=metMin_ || met_et>=
metMax_)
return 0;
419 LogTrace(
"") <<
">>>> Event ACCEPTED";
beamSpotToken_(consumes< reco::BeamSpot >(iConfig.getUntrackedParameter< edm::InputTag >("beamSpot")))
const std::string muonTrig_
virtual edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const
edm::EDGetTokenT< edm::View< reco::Muon > > muonToken_
float sumPt
sum-pt of tracks
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
edm::EDGetTokenT< edm::TriggerResults > trigToken_
bool isTrackerMuon() const
Base class for all types of Jets.
bool isGlobalMuon() const
T * make(const Args &...args) const
make new ROOT object
edm::EDGetTokenT< edm::View< reco::Jet > > jetToken_
edm::EDGetTokenT< reco::BeamSpot > beamSpotToken_
unsigned int triggerIndex(std::string const &name) const
virtual void beginJob() override
virtual int charge() const final
electric charge
virtual double py() const final
y coordinate of momentum vector
static std::string const triggerResults
virtual void endJob() override
std::map< std::string, TH1D * > h1_
bool isGoodMuon(const reco::Muon &muon, SelectionType type, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
main GoodMuon wrapper call
std::vector< reco::WMuNuCandidate > WMuNuCandidateCollection
WMuNuSelector(const edm::ParameterSet &)
edm::EDGetTokenT< reco::WMuNuCandidateCollection > WMuNuCollectionToken_
std::map< std::string, TH2D * > h2_
virtual double px() const final
x coordinate of momentum vector
virtual double et() const final
transverse energy
virtual double eta() const final
momentum pseudorapidity
volatile std::atomic< bool > shutdown_flag false
double normalizedChi2Cut_
virtual bool filter(edm::Event &, const edm::EventSetup &) override
const reco::Muon & getMuon() const
const reco::MET & getNeutrino() const
const MuonIsolation & isolationR03() const
edm::Service< TFileService > fs
virtual double pt() const final
transverse momentum
virtual TrackRef globalTrack() const
reference to Track reconstructed in both tracked and muon detector