10 using namespace trigger;
21 hltPaths_L1_ = ps.
getParameter<vector<string> >(
"hltPaths_L1");
22 hltPaths_L3_ = ps.
getParameter<vector<string> >(
"hltPaths_L3");
23 hltPaths_sig_ = ps.
getParameter<vector<string> >(
"hltPaths_sig");
24 hltPaths_trig_ = ps.
getParameter<vector<string> >(
"hltPaths_trig");
36 MassWindow_up_ = ps.
getParameter<
double>(
"MassWindow_up");
37 MassWindow_down_ = ps.
getParameter<
double>(
"MassWindow_down");
55 Trigs =
dbe_->
book1D(
"Trigs",
"Fired triggers", 15, 0., 15.);
57 TriggerEfficiencies =
dbe_->
book1D(
"TriggerEfficiencies",
"HL Trigger Efficiencies", 10, 0., 10.);
59 TriggerEfficiencies->
setTitle(
"HL Trigger Efficiencies #epsilon_{signal} = #frac{[signal] && [control]}{[control]}");
61 TriggerEfficiencies_sig =
dbe_->
book1D(
"TriggerEfficiencies_sig",
"HL Trigger Signal && Control Counts", 10, 0., 10.);
62 TriggerEfficiencies_trig =
dbe_->
book1D(
"TriggerEfficiencies_trig",
"HL Trigger Control Counts", 10, 0., 10.);
64 const int nbins_Pt = 5;
66 float bins_Pt[nbins_Pt+1] = { 0., 5., 10., 20., 50., 100. };
68 MuonEfficiency_pT =
dbe_->
book1D(
"MuonEfficiency_pT",
"Muon Efficiency P_{T}", nbins_Pt, &bins_Pt[0]);
69 MuonEfficiency_pT_sig =
dbe_->
book1D(
"MuonEfficiency_pT_sig",
"P^{#mu}_{T} (signal triggered)", nbins_Pt, &bins_Pt[0]);
70 MuonEfficiency_pT_trig =
dbe_->
book1D(
"MuonEfficiency_pT_trig",
"P^{#mu}_{T} (control triggered)", nbins_Pt, &bins_Pt[0]);
72 const int nbins_eta = 7;
74 float bins_eta[nbins_eta+1] = { -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5 };
76 MuonEfficiency_eta =
dbe_->
book1D(
"MuonEfficiency_eta",
"Muon Efficiency #eta", nbins_eta, &bins_eta[0]);
77 MuonEfficiency_eta_sig =
dbe_->
book1D(
"MuonEfficiency_eta_sig",
"#eta_{muon} (signal triggered)", nbins_eta, &bins_eta[0]);
78 MuonEfficiency_eta_trig =
dbe_->
book1D(
"MuonEfficiency_eta_trig",
"#eta_{muon} (control triggered)", nbins_eta, &bins_eta[0]);
80 const int nbins_phi = 9;
82 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 };
84 MuonEfficiency_phi =
dbe_->
book1D(
"MuonEfficiency_phi",
"Muon Efficiency #phi", nbins_phi, &bins_phi[0]);
85 MuonEfficiency_phi_sig =
dbe_->
book1D(
"MuonEfficiency_phi_sig",
"#phi_{muon} (signal triggered)", nbins_phi, &bins_phi[0]);
86 MuonEfficiency_phi_trig =
dbe_->
book1D(
"MuonEfficiency_phi_trig",
"#phi_{muon} (control triggered)", nbins_phi, &bins_phi[0]);
88 const int N_TriggerPaths = hltPaths_L3_.size();
89 const int N_SignalPaths = hltPaths_sig_.size();
91 for(
int i = 0;
i < N_TriggerPaths;
i++ ) {
93 const string &
label = hltPaths_L3_[
i];
94 Trigs->setBinLabel(
i+1,label.c_str() );
98 for(
int j = 0;
j < N_SignalPaths; ++
j ) {
100 const string &label_eff =
"#frac{["+hltPaths_sig_[
j]+
"]}{vs. ["+hltPaths_trig_[
j]+
"]}";
101 const string &label_sig = hltPaths_sig_[
j]+
"\n && "+hltPaths_trig_[
j];
102 TriggerEfficiencies->setBinLabel(
j+1, label_eff.c_str() );
103 TriggerEfficiencies_sig->setBinLabel(
j+1, label_sig.c_str() );
107 NMuons =
dbe_->
book1D(
"Nmuons",
"Number of muons", 20, 0., 10.);
108 NMuons_iso =
dbe_->
book1D(
"Nmuons_Iso",
"Number of isolated muons", 20, 0., 10.);
109 NMuons_charge =
dbe_->
book1D(
"Nmuons_Charge",
"N_{muons} * Q(#mu)", 19, -10., 10.);
111 VxVy_muons =
dbe_->
book2D(
"VxVy_muons",
"Vertex x-y-positon (global)", 40, -1., 1., 40 , -1., 1.);
112 Vz_muons =
dbe_->
book1D(
"Vz_muons",
"Vertex z-positon (global)", 40, -20., 20.);
113 PtMuons =
dbe_->
book1D(
"PtMuon",
"P^{#mu}_{T}", 50, 0., 100.);
114 EtaMuons =
dbe_->
book1D(
"EtaMuon",
"#eta_{muon}", 50, -5., 5.);
115 PhiMuons =
dbe_->
book1D(
"PhiMuon",
"#phi_{muon}", 40, -4., 4.);
117 DeltaEtaMuonsRC =
dbe_->
book1D(
"DeltaEtaMuonsRC",
"#Delta #eta of muon pair (RC)", 50, -5., 5.);
118 DeltaPhiMuonsRC =
dbe_->
book1D(
"DeltaPhiMuonsRC",
"#Delta #phi of muon pair (RC)", 50, -5., 5.);
119 DeltaEtaMuonsWC =
dbe_->
book1D(
"DeltaEtaMuonsWC",
"#Delta #eta of muon pair (WC)", 50, -5., 5.);
120 DeltaPhiMuonsWC =
dbe_->
book1D(
"DeltaPhiMuonsWC",
"#Delta #phi of muon pair (WC)", 50, -5., 5.);
121 CombRelIso03 =
dbe_->
book1D(
"MuIso_CombRelIso03",
"Muon CombRelIso dR=03", 50, 0., 1.);
122 PixelHits_muons =
dbe_->
book1D(
"NPixelHits_muons",
"Number of pixel hits", 50, 0., 50.);
123 TrackerHits_muons =
dbe_->
book1D(
"NTrackerHits_muons",
"Number of hits in the tracker", 50, 0., 50.);
125 DeltaR_Trig =
dbe_->
book1D(
"DeltaRTrigger",
"#Delta R of trigger muon pair", 50, 0., 5.);
126 DeltaR_Reco =
dbe_->
book1D(
"DeltaRReco",
"#Delta R of RECO muon pair", 50, 0., 5.);
127 DeltaR_Match =
dbe_->
book1D(
"DeltaRMatch",
"#Delta R of matched muon pair", 50, 0., 5.);
128 Trigger_Match =
dbe_->
book1D(
"TriggerMatch",
"Number of Trigger-RECO assignements", 6, 0., 6.);
130 const int nbins_Pt_Log = 15;
135 float bins_Pt_Log[nbins_Pt_Log+1];
137 for (
int i = 0;
i <= nbins_Pt_Log;
i++) {
138 double log = logmin + (logmax-logmin)*
i/nbins_Pt_Log;
142 PtMuons_LOGX =
dbe_->
book1D(
"Pt_muon_LOGX",
"P^{#mu}_{T}", nbins_Pt_Log, &bins_Pt_Log[0]);
144 MuonEfficiency_pT_LOGX =
dbe_->
book1D(
"MuonEfficiency_pT_LOGX",
"Muon Efficiency P_{T}", nbins_Pt_Log, &bins_Pt_Log[0]);
145 MuonEfficiency_pT_LOGX_sig =
dbe_->
book1D(
"MuonEfficiency_pT_LOGX_sig",
"P^{#mu}_{T} (signal triggered)", nbins_Pt_Log, &bins_Pt_Log[0]);
146 MuonEfficiency_pT_LOGX_trig =
dbe_->
book1D(
"MuonEfficiency_pT_LOGX_trig",
"P^{#mu}_{T} (control triggered)", nbins_Pt_Log, &bins_Pt_Log[0]);
148 const int nbins_mass = 200;
150 float bins_mass[nbins_mass+1];
152 for (
int i = 0;
i <= nbins_mass;
i++) {
153 double log = logmin + (logmax-logmin)*
i/nbins_mass;
157 DiMuonMassRC =
dbe_->
book1D(
"DiMuonMassRC",
"Invariant Dimuon Mass (Right Charge)", 50, 0., 200.);
158 DiMuonMassWC =
dbe_->
book1D(
"DiMuonMassWC",
"Invariant Dimuon Mass (Wrong Charge)", 50, 0., 200.);
160 DiMuonMassRC_LOGX =
dbe_->
book1D(
"DiMuonMassRC_LOGX",
"Invariant Dimuon Mass (Right Charge)", nbins_mass, &bins_mass[0]);
161 DiMuonMassWC_LOGX =
dbe_->
book1D(
"DiMuonMassWC_LOGX",
"Invariant Dimuon Mass (Wrong Charge)", nbins_mass, &bins_mass[0]);
184 vector<string>
hltPaths = hltPaths_L3_;
186 vector<reco::Particle> Triggered_muons;
190 const int N_TriggerPaths = hltPaths.size();
191 const int N_SignalPaths = hltPaths_sig_.size();
192 const int N_ControlPaths = hltPaths_trig_.size();
194 bool Fired_Signal_Trigger[ 10] = {
false};
195 bool Fired_Control_Trigger[10] = {
false};
197 double DilepMass = 0.;
199 double deltaR_Trig = 1000.;
200 double deltaR_Reco = 0.;
201 double deltaR_Match = 0.;
205 double vertex_X = 100.;
206 double vertex_Y = 100.;
207 double vertex_Z = 100.;
214 iEvent.
getByLabel(triggerResults_, trigResults);
228 for(
unsigned int i_Trig = 0; i_Trig < trigResults->size(); ++i_Trig ) {
230 if(trigResults->accept(i_Trig)) {
234 for(
int i = 0;
i < N_TriggerPaths;
i++ ) {
236 if( trigName.
triggerName(i_Trig) == hltPaths[
i] ) Trigs->Fill(
i);
242 for(
int j = 0;
j < N_SignalPaths; ++
j ) {
244 if( trigName.
triggerName(i_Trig) == hltPaths_sig_[
j] ) Fired_Signal_Trigger[
j] =
true;
248 for(
int k = 0;
k < N_ControlPaths; ++
k ) {
250 if( trigName.
triggerName(i_Trig) == hltPaths_trig_[
k] ) Fired_Control_Trigger[
k] =
true;
265 iEvent.
getByLabel(triggerEvent_, triggerEvent);
277 size_t filterIndex = triggerEvent->filterIndex( triggerFilter_ );
280 if( filterIndex >= triggerEvent->sizeFilters() ) {
288 if( filterIndex < triggerEvent->sizeFilters() ) {
290 const Keys &
keys = triggerEvent->filterKeys( filterIndex );
294 for(
size_t j = 0;
j < keys.size();
j++ ) {
298 if( foundObject.
pt() < muon_pT_cut_ )
continue;
299 if(
abs( foundObject.
eta()) > muon_eta_cut_ )
continue;
303 Triggered_muons.push_back( foundObject.
particle() );
307 if( Triggered_muons.size() == 2 ) {
313 DeltaR_Trig->Fill(deltaR_Trig);
340 int numberTracks = primaryVertex.
tracksSize();
342 bool fake = primaryVertex.
isFake();
346 if( !fake && numberTracks > 3 ) {
348 vertex_X = primaryVertex.
x();
349 vertex_Y = primaryVertex.
y();
350 vertex_Z = primaryVertex.
z();
363 reco::MuonCollection::const_iterator
muon;
375 NMuons->Fill( muons->size() );
379 for(muon = muons->begin(); muon!= muons->end(); ++
muon) {
381 float N_muons = muons->size();
382 float Q_muon = muon->charge();
384 NMuons_charge->Fill(N_muons*Q_muon);
386 double track_X = 100.;
387 double track_Y = 100.;
388 double track_Z = 100.;
390 double N_PixelHits = 0.;
391 double N_TrackerHits = 0.;
393 if( muon->isGlobalMuon() && muon->isTrackerMuon() ) {
397 track_X = track->vx();
398 track_Y = track->vy();
399 track_Z = track->vz();
400 N_PixelHits = track->hitPattern().numberOfValidPixelHits();
401 N_TrackerHits = track->hitPattern().numberOfValidTrackerHits();
403 VxVy_muons->Fill(track_X, track_Y);
404 Vz_muons->Fill(track_Z);
405 PixelHits_muons->Fill(N_PixelHits);
406 TrackerHits_muons->Fill(N_TrackerHits);
412 if( track_X > vertex_X_cut_ )
continue;
413 if( track_Y > vertex_Y_cut_ )
continue;
414 if( track_Z > vertex_Z_cut_ )
continue;
415 if( N_PixelHits < 1. )
continue;
416 if( N_TrackerHits < 11. )
continue;
417 if( muon->pt() < muon_pT_cut_ )
continue;
418 if(
abs(muon->eta()) > muon_eta_cut_ )
continue;
422 double muonCombRelIso = 1.;
424 if ( muon->pt() != 0. )
425 muonCombRelIso = ( muIso03.
emEt + muIso03.
hadEt + muIso03.
hoEt + muIso03.
sumPt ) / muon->pt();
427 CombRelIso03->Fill( muonCombRelIso );
429 if( muonCombRelIso < muon_iso_cut_ ) {
432 Isolated_muons.push_back(*muon);
438 NMuons_iso->Fill(N_iso_mu);
441 if( Isolated_muons.size() > 1 ) {
445 if( vertex_X < vertex_X_cut_ && vertex_Y < vertex_Y_cut_ && vertex_Z < vertex_Z_cut_ ) {
447 for(
int i = 0; i < (static_cast<int>(Isolated_muons.size()) - 1); ++
i ) {
449 for(
int j =
i+1; j < static_cast<int>(Isolated_muons.size()); ++
j ) {
451 reco::MuonCollection::const_reference mu1 = Isolated_muons.at(
i);
452 reco::MuonCollection::const_reference mu2 = Isolated_muons.at(
j);
454 DilepMass =
sqrt( (mu1.energy()+mu2.energy())*(mu1.energy()+mu2.energy())
455 - (mu1.px()+mu2.px())*(mu1.px()+mu2.px())
456 - (mu1.py()+mu2.py())*(mu1.py()+mu2.py())
457 - (mu1.pz()+mu2.pz())*(mu1.pz()+mu2.pz())
460 if( DilepMass < 1. ) {
464 Isolated_muons.erase(Isolated_muons.begin()+
i);
475 if( mu1.charge()*mu2.charge() < 0. ) {
477 DiMuonMassRC->Fill( DilepMass );
478 DiMuonMassRC_LOGX->Fill( DilepMass );
480 if( DilepMass > MassWindow_down_ && DilepMass < MassWindow_up_ ) {
482 PtMuons->Fill( mu1.pt() );
483 PtMuons->Fill( mu2.pt() );
484 PtMuons_LOGX->Fill( mu1.pt() );
485 PtMuons_LOGX->Fill( mu2.pt() );
486 EtaMuons->Fill( mu1.eta() );
487 EtaMuons->Fill( mu2.eta() );
488 PhiMuons->Fill( mu1.phi() );
489 PhiMuons->Fill( mu2.phi() );
491 DeltaEtaMuonsRC->Fill(mu1.eta()-mu2.eta());
492 DeltaPhiMuonsRC->Fill(
deltaPhi(mu1.phi(),mu2.phi()) );
496 for(
int k = 0;
k < N_SignalPaths; ++
k ) {
498 if( Fired_Signal_Trigger[
k] && Fired_Control_Trigger[
k] ) TriggerEfficiencies_sig->Fill(k);
500 if( Fired_Control_Trigger[k] ) TriggerEfficiencies_trig->Fill(k);
509 if( Isolated_muons.size() == 2 && Triggered_muons.size() > 0 ) {
511 deltaR_Reco =
deltaR( mu1.eta(), mu1.phi(), mu2.eta(), mu2.phi() );
512 DeltaR_Reco->Fill(deltaR_Reco);
514 if( deltaR_Reco > 2.*DR && deltaR_Trig > 2.*DR ) {
516 for(
int i = 0; i < static_cast<int>(Isolated_muons.size()); ++
i ) {
518 for(
int j = 0; j < static_cast<int>(Triggered_muons.size()); ++
j ) {
523 deltaR_Match =
deltaR( Trigger_mu.
eta(), Trigger_mu.
phi(), Reco_mu.
eta(), Reco_mu.
phi() );
524 DeltaR_Match->Fill(deltaR_Match);
526 if( deltaR_Match < DR) {
529 Matched_muons.push_back(Reco_mu);
537 Trigger_Match->Fill(N_Match);
546 if( Matched_muons.size() == 1 ) {
548 reco::MuonCollection::const_reference matched_mu1 = Matched_muons.at(0);
550 MuonEfficiency_pT_trig->Fill( matched_mu1.pt() );
551 MuonEfficiency_pT_LOGX_trig->Fill( matched_mu1.pt() );
552 MuonEfficiency_eta_trig->Fill(matched_mu1.eta());
553 MuonEfficiency_phi_trig->Fill(matched_mu1.phi());
557 if( Matched_muons.size() == 2 ) {
559 reco::MuonCollection::const_reference matched_mu1 = Matched_muons.at(0);
560 reco::MuonCollection::const_reference matched_mu2 = Matched_muons.at(1);
562 MuonEfficiency_pT_trig->Fill( matched_mu1.pt() );
563 MuonEfficiency_pT_trig->Fill( matched_mu2.pt() );
564 MuonEfficiency_pT_LOGX_trig->Fill( matched_mu1.pt() );
565 MuonEfficiency_pT_LOGX_trig->Fill( matched_mu2.pt() );
566 MuonEfficiency_eta_trig->Fill(matched_mu1.eta());
567 MuonEfficiency_eta_trig->Fill(matched_mu2.eta());
568 MuonEfficiency_phi_trig->Fill(matched_mu1.phi());
569 MuonEfficiency_phi_trig->Fill(matched_mu2.phi());
571 MuonEfficiency_pT_sig->Fill( matched_mu1.pt() );
572 MuonEfficiency_pT_sig->Fill( matched_mu2.pt() );
573 MuonEfficiency_pT_LOGX_sig->Fill( matched_mu1.pt() );
574 MuonEfficiency_pT_LOGX_sig->Fill( matched_mu2.pt() );
575 MuonEfficiency_eta_sig->Fill(matched_mu1.eta());
576 MuonEfficiency_eta_sig->Fill(matched_mu2.eta());
577 MuonEfficiency_phi_sig->Fill(matched_mu1.phi());
578 MuonEfficiency_phi_sig->Fill(matched_mu2.phi());
588 if( mu1.charge()*mu2.charge() > 0. ) {
590 DiMuonMassWC->Fill( DilepMass );
591 DiMuonMassWC_LOGX->Fill( DilepMass );
593 if( DilepMass > MassWindow_down_ && DilepMass < MassWindow_up_ ) {
595 DeltaEtaMuonsWC->Fill( mu1.eta()-mu2.eta() );
596 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 &)
double eta() const
momentum pseudorapidity
std::vector< Muon > MuonCollection
collection of Muon objects
Single trigger physics object (e.g., an isolated muon)
double phi() const
momentum azimuthal angle
virtual float phi() const GCC11_FINAL
momentum azimuthal angle
void analyze(const edm::Event &, const edm::EventSetup &)
Abs< T >::type abs(const T &t)
double z() const
y coordinate
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
virtual float eta() const GCC11_FINAL
momentum pseudorapidity
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
int pdgId() const
PDG identifier.
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
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