12 using namespace trigger;
23 hltPaths_L1_ = ps.
getParameter<vector<string> >(
"hltPaths_L1");
24 hltPaths_L3_ = ps.
getParameter<vector<string> >(
"hltPaths_L3");
25 hltPaths_sig_ = ps.
getParameter<vector<string> >(
"hltPaths_sig");
26 hltPaths_trig_ = ps.
getParameter<vector<string> >(
"hltPaths_trig");
38 MassWindow_up_ = ps.
getParameter<
double>(
"MassWindow_up");
39 MassWindow_down_ = ps.
getParameter<
double>(
"MassWindow_down");
57 Trigs =
dbe_->
book1D(
"Trigs",
"Fired triggers", 15, 0., 15.);
59 TriggerEfficiencies =
dbe_->
book1D(
"TriggerEfficiencies",
"HL Trigger Efficiencies", 10, 0., 10.);
61 TriggerEfficiencies->
setTitle(
"HL Trigger Efficiencies #epsilon_{signal} = #frac{[signal] && [control]}{[control]}");
63 TriggerEfficiencies_sig =
dbe_->
book1D(
"TriggerEfficiencies_sig",
"HL Trigger Signal && Control Counts", 10, 0., 10.);
64 TriggerEfficiencies_trig =
dbe_->
book1D(
"TriggerEfficiencies_trig",
"HL Trigger Control Counts", 10, 0., 10.);
66 const int nbins_Pt = 5;
68 float bins_Pt[nbins_Pt+1] = { 0., 5., 10., 20., 50., 100. };
70 MuonEfficiency_pT =
dbe_->
book1D(
"MuonEfficiency_pT",
"Muon Efficiency P_{T}", nbins_Pt, &bins_Pt[0]);
71 MuonEfficiency_pT_sig =
dbe_->
book1D(
"MuonEfficiency_pT_sig",
"P^{#mu}_{T} (signal triggered)", nbins_Pt, &bins_Pt[0]);
72 MuonEfficiency_pT_trig =
dbe_->
book1D(
"MuonEfficiency_pT_trig",
"P^{#mu}_{T} (control triggered)", nbins_Pt, &bins_Pt[0]);
74 const int nbins_eta = 7;
76 float bins_eta[nbins_eta+1] = { -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5 };
78 MuonEfficiency_eta =
dbe_->
book1D(
"MuonEfficiency_eta",
"Muon Efficiency #eta", nbins_eta, &bins_eta[0]);
79 MuonEfficiency_eta_sig =
dbe_->
book1D(
"MuonEfficiency_eta_sig",
"#eta_{muon} (signal triggered)", nbins_eta, &bins_eta[0]);
80 MuonEfficiency_eta_trig =
dbe_->
book1D(
"MuonEfficiency_eta_trig",
"#eta_{muon} (control triggered)", nbins_eta, &bins_eta[0]);
82 const int nbins_phi = 9;
84 float bins_phi[nbins_phi+1] = { -3.5, -3.2, -2.6, -1.56, -0.52, 0.52, 1.56, 2.6, 3.2, 3.5 };
86 MuonEfficiency_phi =
dbe_->
book1D(
"MuonEfficiency_phi",
"Muon Efficiency #phi", nbins_phi, &bins_phi[0]);
87 MuonEfficiency_phi_sig =
dbe_->
book1D(
"MuonEfficiency_phi_sig",
"#phi_{muon} (signal triggered)", nbins_phi, &bins_phi[0]);
88 MuonEfficiency_phi_trig =
dbe_->
book1D(
"MuonEfficiency_phi_trig",
"#phi_{muon} (control triggered)", nbins_phi, &bins_phi[0]);
90 const int N_TriggerPaths = hltPaths_L3_.size();
91 const int N_SignalPaths = hltPaths_sig_.size();
93 for(
int i = 0;
i < N_TriggerPaths;
i++ ) {
95 const string &
label = hltPaths_L3_[
i];
96 Trigs->setBinLabel(
i+1,label.c_str() );
100 for(
int j = 0;
j < N_SignalPaths; ++
j ) {
102 const string &label_eff =
"#frac{["+hltPaths_sig_[
j]+
"]}{vs. ["+hltPaths_trig_[
j]+
"]}";
103 const string &label_sig = hltPaths_sig_[
j]+
"\n && "+hltPaths_trig_[
j];
104 TriggerEfficiencies->setBinLabel(
j+1, label_eff.c_str() );
105 TriggerEfficiencies_sig->setBinLabel(
j+1, label_sig.c_str() );
109 NMuons =
dbe_->
book1D(
"Nmuons",
"Number of muons", 20, 0., 10.);
110 NMuons_iso =
dbe_->
book1D(
"Nmuons_Iso",
"Number of isolated muons", 20, 0., 10.);
111 NMuons_charge =
dbe_->
book1D(
"Nmuons_Charge",
"N_{muons} * Q(#mu)", 19, -10., 10.);
112 NTracks =
dbe_->
book1D(
"Ntracks",
"Number of tracks", 50, 0., 50.);
113 VxVy_muons =
dbe_->
book2D(
"VxVy_muons",
"Vertex x-y-positon (global)", 40, -1., 1., 40 , -1., 1.);
114 Vz_muons =
dbe_->
book1D(
"Vz_muons",
"Vertex z-positon (global)", 40, -20., 20.);
115 PtMuons =
dbe_->
book1D(
"PtMuon",
"P^{#mu}_{T}", 50, 0., 100.);
116 EtaMuons =
dbe_->
book1D(
"EtaMuon",
"#eta_{muon}", 50, -5., 5.);
117 PhiMuons =
dbe_->
book1D(
"PhiMuon",
"#phi_{muon}", 40, -4., 4.);
119 DeltaEtaMuonsRC =
dbe_->
book1D(
"DeltaEtaMuonsRC",
"#Delta #eta of muon pair (RC)", 50, -5., 5.);
120 DeltaPhiMuonsRC =
dbe_->
book1D(
"DeltaPhiMuonsRC",
"#Delta #phi of muon pair (RC)", 50, -5., 5.);
121 DeltaEtaMuonsWC =
dbe_->
book1D(
"DeltaEtaMuonsWC",
"#Delta #eta of muon pair (WC)", 50, -5., 5.);
122 DeltaPhiMuonsWC =
dbe_->
book1D(
"DeltaPhiMuonsWC",
"#Delta #phi of muon pair (WC)", 50, -5., 5.);
123 CombRelIso03 =
dbe_->
book1D(
"MuIso_CombRelIso03",
"Muon CombRelIso dR=03", 50, 0., 1.);
124 PixelHits_muons =
dbe_->
book1D(
"NPixelHits_muons",
"Number of pixel hits", 50, 0., 50.);
125 TrackerHits_muons =
dbe_->
book1D(
"NTrackerHits_muons",
"Number of hits in the tracker", 50, 0., 50.);
127 DeltaR_Trig =
dbe_->
book1D(
"DeltaRTrigger",
"#Delta R of trigger muon pair", 50, 0., 5.);
128 DeltaR_Reco =
dbe_->
book1D(
"DeltaRReco",
"#Delta R of RECO muon pair", 50, 0., 5.);
129 DeltaR_Match =
dbe_->
book1D(
"DeltaRMatch",
"#Delta R of matched muon pair", 50, 0., 5.);
130 Trigger_Match =
dbe_->
book1D(
"TriggerMatch",
"Number of Trigger-RECO assignements", 6, 0., 6.);
132 const int nbins_Pt_Log = 15;
137 float bins_Pt_Log[nbins_Pt_Log+1];
139 for (
int i = 0;
i <= nbins_Pt_Log;
i++) {
140 double log = logmin + (logmax-logmin)*
i/nbins_Pt_Log;
144 PtMuons_LOGX =
dbe_->
book1D(
"Pt_muon_LOGX",
"P^{#mu}_{T}", nbins_Pt_Log, &bins_Pt_Log[0]);
146 MuonEfficiency_pT_LOGX =
dbe_->
book1D(
"MuonEfficiency_pT_LOGX",
"Muon Efficiency P_{T}", nbins_Pt_Log, &bins_Pt_Log[0]);
147 MuonEfficiency_pT_LOGX_sig =
dbe_->
book1D(
"MuonEfficiency_pT_LOGX_sig",
"P^{#mu}_{T} (signal triggered)", nbins_Pt_Log, &bins_Pt_Log[0]);
148 MuonEfficiency_pT_LOGX_trig =
dbe_->
book1D(
"MuonEfficiency_pT_LOGX_trig",
"P^{#mu}_{T} (control triggered)", nbins_Pt_Log, &bins_Pt_Log[0]);
150 const int nbins_mass = 200;
152 float bins_mass[nbins_mass+1];
154 for (
int i = 0;
i <= nbins_mass;
i++) {
155 double log = logmin + (logmax-logmin)*
i/nbins_mass;
159 DiMuonMassRC =
dbe_->
book1D(
"DiMuonMassRC",
"Invariant Dimuon Mass (Right Charge)", 50, 0., 200.);
160 DiMuonMassWC =
dbe_->
book1D(
"DiMuonMassWC",
"Invariant Dimuon Mass (Wrong Charge)", 50, 0., 200.);
162 DiMuonMassRC_LOGX =
dbe_->
book1D(
"DiMuonMassRC_LOGX",
"Invariant Dimuon Mass (Right Charge)", nbins_mass, &bins_mass[0]);
163 DiMuonMassWC_LOGX =
dbe_->
book1D(
"DiMuonMassWC_LOGX",
"Invariant Dimuon Mass (Wrong Charge)", nbins_mass, &bins_mass[0]);
186 vector<string>
hltPaths = hltPaths_L3_;
188 vector<reco::Particle> Triggered_muons;
192 const int N_TriggerPaths = hltPaths.size();
193 const int N_SignalPaths = hltPaths_sig_.size();
194 const int N_ControlPaths = hltPaths_trig_.size();
196 bool Fired_Signal_Trigger[ 10] = {
false};
197 bool Fired_Control_Trigger[10] = {
false};
199 double DilepMass = 0.;
201 double deltaR_Trig = 1000.;
202 double deltaR_Reco = 0.;
203 double deltaR_Match = 0.;
207 double vertex_X = 100.;
208 double vertex_Y = 100.;
209 double vertex_Z = 100.;
216 iEvent.
getByLabel(triggerResults_, trigResults);
230 for(
unsigned int i_Trig = 0; i_Trig < trigResults->size(); ++i_Trig ) {
232 if(trigResults->accept(i_Trig)) {
236 for(
int i = 0;
i < N_TriggerPaths;
i++ ) {
238 if( trigName.
triggerName(i_Trig) == hltPaths[
i] ) Trigs->Fill(
i);
244 for(
int j = 0;
j < N_SignalPaths; ++
j ) {
246 if( trigName.
triggerName(i_Trig) == hltPaths_sig_[
j] ) Fired_Signal_Trigger[
j] =
true;
250 for(
int k = 0;
k < N_ControlPaths; ++
k ) {
252 if( trigName.
triggerName(i_Trig) == hltPaths_trig_[
k] ) Fired_Control_Trigger[
k] =
true;
267 iEvent.
getByLabel(triggerEvent_, triggerEvent);
279 size_t filterIndex = triggerEvent->filterIndex( triggerFilter_ );
282 if( filterIndex >= triggerEvent->sizeFilters() ) {
290 if( filterIndex < triggerEvent->sizeFilters() ) {
292 const Keys &
keys = triggerEvent->filterKeys( filterIndex );
296 for(
size_t j = 0;
j < keys.size();
j++ ) {
300 if( foundObject.
pt() < muon_pT_cut_ )
continue;
301 if(
abs( foundObject.
eta()) > muon_eta_cut_ )
continue;
305 Triggered_muons.push_back( foundObject.
particle() );
309 if( Triggered_muons.size() == 2 ) {
315 DeltaR_Trig->Fill(deltaR_Trig);
342 int numberTracks = primaryVertex.
tracksSize();
344 bool fake = primaryVertex.
isFake();
346 NTracks->Fill(numberTracks);
348 if( !fake && numberTracks > 3 ) {
350 vertex_X = primaryVertex.
x();
351 vertex_Y = primaryVertex.
y();
352 vertex_Z = primaryVertex.
z();
365 reco::MuonCollection::const_iterator
muon;
377 NMuons->Fill( muons->size() );
381 for(muon = muons->begin(); muon!= muons->end(); ++
muon) {
383 float N_muons = muons->size();
384 float Q_muon = muon->charge();
386 NMuons_charge->Fill(N_muons*Q_muon);
388 double track_X = 100.;
389 double track_Y = 100.;
390 double track_Z = 100.;
392 double N_PixelHits = 0.;
393 double N_TrackerHits = 0.;
395 if( muon->isGlobalMuon() && muon->isTrackerMuon() ) {
399 track_X = track->vx();
400 track_Y = track->vy();
401 track_Z = track->vz();
402 N_PixelHits = track->hitPattern().numberOfValidPixelHits();
403 N_TrackerHits = track->hitPattern().numberOfValidTrackerHits();
405 VxVy_muons->Fill(track_X, track_Y);
406 Vz_muons->Fill(track_Z);
407 PixelHits_muons->Fill(N_PixelHits);
408 TrackerHits_muons->Fill(N_TrackerHits);
414 if( track_X > vertex_X_cut_ )
continue;
415 if( track_Y > vertex_Y_cut_ )
continue;
416 if( track_Z > vertex_Z_cut_ )
continue;
417 if( N_PixelHits < 1. )
continue;
418 if( N_TrackerHits < 11. )
continue;
419 if( muon->pt() < muon_pT_cut_ )
continue;
420 if(
abs(muon->eta()) > muon_eta_cut_ )
continue;
424 double muonCombRelIso = 1.;
426 if ( muon->pt() != 0. )
427 muonCombRelIso = ( muIso03.
emEt + muIso03.
hadEt + muIso03.
hoEt + muIso03.
sumPt ) / muon->pt();
429 CombRelIso03->Fill( muonCombRelIso );
431 if( muonCombRelIso < muon_iso_cut_ ) {
434 Isolated_muons.push_back(*muon);
440 NMuons_iso->Fill(N_iso_mu);
443 if( Isolated_muons.size() > 1 ) {
447 if( vertex_X < vertex_X_cut_ && vertex_Y < vertex_Y_cut_ && vertex_Z < vertex_Z_cut_ ) {
449 for(
int i = 0; i < (static_cast<int>(Isolated_muons.size()) - 1); ++
i ) {
451 for(
int j =
i+1; j < static_cast<int>(Isolated_muons.size()); ++
j ) {
453 reco::MuonCollection::const_reference mu1 = Isolated_muons.at(
i);
454 reco::MuonCollection::const_reference mu2 = Isolated_muons.at(
j);
456 DilepMass =
sqrt( (mu1.energy()+mu2.energy())*(mu1.energy()+mu2.energy())
457 - (mu1.px()+mu2.px())*(mu1.px()+mu2.px())
458 - (mu1.py()+mu2.py())*(mu1.py()+mu2.py())
459 - (mu1.pz()+mu2.pz())*(mu1.pz()+mu2.pz())
462 if( DilepMass < 1. ) {
466 Isolated_muons.erase(Isolated_muons.begin()+
i);
477 if( mu1.charge()*mu2.charge() < 0. ) {
479 DiMuonMassRC->Fill( DilepMass );
480 DiMuonMassRC_LOGX->Fill( DilepMass );
482 if( DilepMass > MassWindow_down_ && DilepMass < MassWindow_up_ ) {
484 PtMuons->Fill( mu1.pt() );
485 PtMuons->Fill( mu2.pt() );
486 PtMuons_LOGX->Fill( mu1.pt() );
487 PtMuons_LOGX->Fill( mu2.pt() );
488 EtaMuons->Fill( mu1.eta() );
489 EtaMuons->Fill( mu2.eta() );
490 PhiMuons->Fill( mu1.phi() );
491 PhiMuons->Fill( mu2.phi() );
493 DeltaEtaMuonsRC->Fill(mu1.eta()-mu2.eta());
494 DeltaPhiMuonsRC->Fill(
deltaPhi(mu1.phi(),mu2.phi()) );
498 for(
int k = 0;
k < N_SignalPaths; ++
k ) {
500 if( Fired_Signal_Trigger[
k] && Fired_Control_Trigger[
k] ) TriggerEfficiencies_sig->Fill(k);
502 if( Fired_Control_Trigger[k] ) TriggerEfficiencies_trig->Fill(k);
511 if( Isolated_muons.size() == 2 && Triggered_muons.size() > 0 ) {
513 deltaR_Reco =
deltaR( mu1.eta(), mu1.phi(), mu2.eta(), mu2.phi() );
514 DeltaR_Reco->Fill(deltaR_Reco);
516 if( deltaR_Reco > 2.*DR && deltaR_Trig > 2.*DR ) {
518 for(
int i = 0; i < static_cast<int>(Isolated_muons.size()); ++
i ) {
520 for(
int j = 0; j < static_cast<int>(Triggered_muons.size()); ++
j ) {
525 deltaR_Match =
deltaR( Trigger_mu.
eta(), Trigger_mu.
phi(), Reco_mu.
eta(), Reco_mu.
phi() );
526 DeltaR_Match->Fill(deltaR_Match);
528 if( deltaR_Match < DR) {
531 Matched_muons.push_back(Reco_mu);
539 Trigger_Match->Fill(N_Match);
548 if( Matched_muons.size() == 1 ) {
550 reco::MuonCollection::const_reference matched_mu1 = Matched_muons.at(0);
552 MuonEfficiency_pT_trig->Fill( matched_mu1.pt() );
553 MuonEfficiency_pT_LOGX_trig->Fill( matched_mu1.pt() );
554 MuonEfficiency_eta_trig->Fill(matched_mu1.eta());
555 MuonEfficiency_phi_trig->Fill(matched_mu1.phi());
559 if( Matched_muons.size() == 2 ) {
561 reco::MuonCollection::const_reference matched_mu1 = Matched_muons.at(0);
562 reco::MuonCollection::const_reference matched_mu2 = Matched_muons.at(1);
564 MuonEfficiency_pT_trig->Fill( matched_mu1.pt() );
565 MuonEfficiency_pT_trig->Fill( matched_mu2.pt() );
566 MuonEfficiency_pT_LOGX_trig->Fill( matched_mu1.pt() );
567 MuonEfficiency_pT_LOGX_trig->Fill( matched_mu2.pt() );
568 MuonEfficiency_eta_trig->Fill(matched_mu1.eta());
569 MuonEfficiency_eta_trig->Fill(matched_mu2.eta());
570 MuonEfficiency_phi_trig->Fill(matched_mu1.phi());
571 MuonEfficiency_phi_trig->Fill(matched_mu2.phi());
573 MuonEfficiency_pT_sig->Fill( matched_mu1.pt() );
574 MuonEfficiency_pT_sig->Fill( matched_mu2.pt() );
575 MuonEfficiency_pT_LOGX_sig->Fill( matched_mu1.pt() );
576 MuonEfficiency_pT_LOGX_sig->Fill( matched_mu2.pt() );
577 MuonEfficiency_eta_sig->Fill(matched_mu1.eta());
578 MuonEfficiency_eta_sig->Fill(matched_mu2.eta());
579 MuonEfficiency_phi_sig->Fill(matched_mu1.phi());
580 MuonEfficiency_phi_sig->Fill(matched_mu2.phi());
590 if( mu1.charge()*mu2.charge() > 0. ) {
592 DiMuonMassWC->Fill( DilepMass );
593 DiMuonMassWC_LOGX->Fill( DilepMass );
595 if( DilepMass > MassWindow_down_ && DilepMass < MassWindow_up_ ) {
597 DeltaEtaMuonsWC->Fill( mu1.eta()-mu2.eta() );
598 DeltaPhiMuonsWC->Fill(
deltaPhi(mu1.phi(),mu2.phi()) );
T getParameter(std::string const &) const
TopHLTDiMuonDQM(const edm::ParameterSet &)
virtual edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const
float sumPt
sum-pt of tracks
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
double y() const
y coordinate
reco::Particle particle(reco::Particle::Charge q=0, const reco::Particle::Point &vertex=reco::Particle::Point(0, 0, 0), int status=0, bool integerCharge=true) const
void beginLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &)
virtual double eta() const
momentum pseudorapidity
int pdgId() const
PDG identifier.
std::vector< Muon > MuonCollection
collection of Muon objects
Single trigger physics object (e.g., an isolated muon)
void analyze(const edm::Event &, const edm::EventSetup &)
double phi() const
momentum azimuthal angle
double z() const
y coordinate
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
void setTitle(const std::string &title)
set (ie. change) histogram/profile title
double deltaR(double eta1, double eta2, double phi1, double phi2)
std::vector< TriggerObject > TriggerObjectCollection
collection of trigger physics objects (e.g., all isolated muons)
double x() const
x coordinate
void endLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &)
void endRun(const edm::Run &, const edm::EventSetup &)
std::string const & triggerName(unsigned int index) const
std::vector< size_type > Keys
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
double eta() const
momentum pseudorapidity
virtual double phi() const
momentum azimuthal angle
void beginRun(const edm::Run &, const edm::EventSetup &)
Power< A, B >::type pow(const A &a, const B &b)
void setCurrentFolder(const std::string &fullpath)
size_t tracksSize() const
number of tracks