CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Attributes
EfficiencyAnalyzer Class Reference

#include <EfficiencyAnalyzer.h>

Inheritance diagram for EfficiencyAnalyzer:
MuonAnalyzerBase

Public Member Functions

void analyze (const edm::Event &event, const edm::EventSetup &eventSetup)
 
void beginJob (DQMStore *dbe)
 Inizialize parameters for histo binning. More...
 
 EfficiencyAnalyzer (const edm::ParameterSet &pset, MuonServiceProxy *theService)
 
virtual ~EfficiencyAnalyzer ()
 
- Public Member Functions inherited from MuonAnalyzerBase
void analyze (const edm::Event &, const edm::EventSetup &, reco::Muon &recoMuon)
 Get the analysis of the muon properties. More...
 
void analyze (const edm::Event &, const edm::EventSetup &, reco::Track &recoTrack)
 Get the analysis of the muon track properties. More...
 
 MuonAnalyzerBase (MuonServiceProxy *theServ)
 Constructor. More...
 
MuonServiceProxyservice ()
 
virtual ~MuonAnalyzerBase ()
 Destructor. More...
 

Protected Attributes

int etaBin_
 
double etaMax_
 
double etaMin_
 
MonitorElementh_allProbes_barrel_pt
 
MonitorElementh_allProbes_endcap_pt
 
MonitorElementh_allProbes_eta
 
MonitorElementh_allProbes_hp_eta
 
MonitorElementh_allProbes_phi
 
MonitorElementh_allProbes_pt
 
MonitorElementh_failProbes_TightMu_eta
 
MonitorElementh_failProbes_TightMu_phi
 
MonitorElementh_failProbes_TightMu_pt
 
MonitorElementh_passProbes_TightMu_barrel_pt
 
MonitorElementh_passProbes_TightMu_endcap_pt
 
MonitorElementh_passProbes_TightMu_eta
 
MonitorElementh_passProbes_TightMu_hp_eta
 
MonitorElementh_passProbes_TightMu_phi
 
MonitorElementh_passProbes_TightMu_pt
 
std::string metname
 
edm::ParameterSet parameters
 
int phiBin_
 
double phiMax_
 
double phiMin_
 
int ptBin_
 
double ptMax_
 
double ptMin_
 
MonitorElementtest_TightMu_Minv
 
edm::InputTag theMuonCollectionLabel
 
edm::InputTag theSTACollectionLabel
 
edm::InputTag theTrackCollectionLabel
 

Detailed Description

Class EfficiencyAnalyzer

DQM monitoring for dimuon mass

Author: S.Folgueras, A. Calderon

Definition at line 26 of file EfficiencyAnalyzer.h.

Constructor & Destructor Documentation

EfficiencyAnalyzer::EfficiencyAnalyzer ( const edm::ParameterSet pset,
MuonServiceProxy theService 
)

Definition at line 38 of file EfficiencyAnalyzer.cc.

References parameters.

39  parameters = pSet;
40 }
MuonServiceProxy * theService
edm::ParameterSet parameters
MuonAnalyzerBase(MuonServiceProxy *theServ)
Constructor.
EfficiencyAnalyzer::~EfficiencyAnalyzer ( )
virtual

Definition at line 42 of file EfficiencyAnalyzer.cc.

42 { }

Member Function Documentation

void EfficiencyAnalyzer::analyze ( const edm::Event event,
const edm::EventSetup eventSetup 
)

to be read from output as "generalTracks"

Definition at line 98 of file EfficiencyAnalyzer.cc.

References SiPixelRawToDigiRegional_cfi::beamSpot, reco::MuonIsolation::emEt, MonitorElement::Fill(), edm::Event::getByLabel(), h_allProbes_barrel_pt, h_allProbes_endcap_pt, h_allProbes_eta, h_allProbes_hp_eta, h_allProbes_phi, h_allProbes_pt, h_passProbes_TightMu_barrel_pt, h_passProbes_TightMu_endcap_pt, h_passProbes_TightMu_eta, h_passProbes_TightMu_hp_eta, h_passProbes_TightMu_phi, h_passProbes_TightMu_pt, reco::MuonIsolation::hadEt, edm::HandleBase::isValid(), LogTrace, metname, patZpeak::muons, reco::BeamSpot::position(), reco::MuonIsolation::sumPt, test_TightMu_Minv, theMuonCollectionLabel, theTrackCollectionLabel, and testEve_cfg::tracks.

98  {
99 
100  LogTrace(metname)<<"[EfficiencyAnalyzer] Analyze the mu in different eta regions";
101 
103  iEvent.getByLabel(theMuonCollectionLabel, muons);
104 
105 
107  iEvent.getByLabel(theTrackCollectionLabel,tracks);
108 
109 
111  Handle<reco::BeamSpot> beamSpotHandle;
112  iEvent.getByLabel("offlineBeamSpot", beamSpotHandle);
113  beamSpot = *beamSpotHandle;
114 
115  if(!muons.isValid()) return;
116 
117 
118  // Loop on muon collection
119  TLorentzVector Mu1, Mu2;
120 
121  bool isMB = false;
122  bool isME = false;
123 
124  for (reco::MuonCollection::const_iterator recoMu1 = muons->begin(); recoMu1!=muons->end(); ++recoMu1) {
125 
126  LogTrace(metname)<<"[EfficiencyAnalyzer] loop over first muons" << endl;
127 
128  //--- Define combined isolation
129  reco::MuonIsolation Iso_muon = recoMu1->isolationR03();
130  float combIso = (Iso_muon.emEt + Iso_muon.hadEt + Iso_muon.sumPt);
131 
132  //--- Is Global Muon
133  if (!recoMu1->isGlobalMuon()) continue;
134 
135  // get the track combinig the information from both the Tracker and the Spectrometer
136  reco::TrackRef recoCombinedGlbTrack1 = recoMu1->combinedMuon();
137  float muPt1 = recoCombinedGlbTrack1->pt();
138  Mu1.SetPxPyPzE(recoCombinedGlbTrack1->px(), recoCombinedGlbTrack1->py(),recoCombinedGlbTrack1->pz(), recoCombinedGlbTrack1->p());
139 
140 
141  //--- Define if it is a tight muon
142  if (recoMu1->isGlobalMuon() && recoMu1->isTrackerMuon() && recoMu1->combinedMuon()->normalizedChi2()<10.
143  && recoMu1->combinedMuon()->hitPattern().numberOfValidMuonHits()>0 && fabs(recoMu1->combinedMuon()->dxy(beamSpot.position()))<0.2 && recoMu1->combinedMuon()->hitPattern().numberOfValidPixelHits()>0 && recoMu1->numberOfMatches() > 1) {
144 
145  //-- is isolated muon
146  if (muPt1 > 15 && (combIso/muPt1) < 0.1 ) {
147 
148 
149  for (reco::MuonCollection::const_iterator recoMu2 = muons->begin(); recoMu2!=muons->end(); ++recoMu2){
150 
151  LogTrace(metname)<<"[EfficiencyAnalyzer] loop over second muon" <<endl;
152 
153  if (recoMu2 == recoMu1) continue;
154 
155 
156  if (recoMu2->eta() < 1.479 ) isMB = true;
157  if (recoMu2->eta() >= 1.479 ) isME = true;
158 
159 
160  //--> should we apply track quality cuts???
161  Mu2.SetPxPyPzE(recoMu2->px(), recoMu2->py(), recoMu2->pz(), recoMu2->p());
162 
163  if (!recoMu2->isTrackerMuon()) continue;
164 
165  if ( recoMu2->pt() < 5 ) continue;
166 
167  if ( (recoMu1->charge())*(recoMu2->charge()) > 0 ) continue;
168 
169  float Minv = (Mu1+Mu2).M();
170 
171  if ( Minv < 70 || Minv > 110 ) continue;
172 
173  h_allProbes_pt->Fill(recoMu2->pt());
174  h_allProbes_eta->Fill(recoMu2->eta());
175  h_allProbes_phi->Fill(recoMu2->phi());
176 
177 
178  if (isMB) h_allProbes_barrel_pt->Fill(recoMu2->pt());
179  if (isME) h_allProbes_endcap_pt->Fill(recoMu2->pt());
180  if(recoMu2->pt() > 20 ) h_allProbes_hp_eta->Fill(recoMu2->eta());
181 
182 
183  test_TightMu_Minv->Fill(Minv);
184 
185 
186  // Probes passing the tight muon criteria
187 
188  if (recoMu2->isGlobalMuon() && recoMu2->isTrackerMuon() && recoMu2->combinedMuon()->normalizedChi2()<10. && recoMu2->combinedMuon()->hitPattern().numberOfValidMuonHits()>0 && fabs(recoMu2->combinedMuon()->dxy(beamSpot.position()))<0.2 && recoMu2->combinedMuon()->hitPattern().numberOfValidPixelHits()>0 && recoMu2->numberOfMatches() > 1) {
189 
190  h_passProbes_TightMu_pt->Fill(recoMu2->pt());
191  h_passProbes_TightMu_eta->Fill(recoMu2->eta());
192  h_passProbes_TightMu_phi->Fill(recoMu2->phi());
193 
194  if (isMB) h_passProbes_TightMu_barrel_pt->Fill(recoMu2->pt());
195  if (isME) h_passProbes_TightMu_endcap_pt->Fill(recoMu2->pt());
196  if( recoMu2->pt() > 20 ) h_passProbes_TightMu_hp_eta->Fill(recoMu2->eta());
197 
198  }
199  }
200 
201  }
202  }
203  }
204 }
float hadEt
hcal sum-Et
Definition: MuonIsolation.h:9
float sumPt
sum-pt of tracks
Definition: MuonIsolation.h:7
MonitorElement * h_allProbes_eta
void Fill(long long x)
MonitorElement * h_allProbes_pt
int iEvent
Definition: GenABIO.cc:243
MonitorElement * h_passProbes_TightMu_hp_eta
MonitorElement * h_passProbes_TightMu_eta
float emEt
ecal sum-Et
Definition: MuonIsolation.h:8
MonitorElement * h_passProbes_TightMu_phi
MonitorElement * h_passProbes_TightMu_pt
MonitorElement * h_passProbes_TightMu_barrel_pt
bool isValid() const
Definition: HandleBase.h:76
edm::InputTag theMuonCollectionLabel
#define LogTrace(id)
MonitorElement * h_passProbes_TightMu_endcap_pt
tuple tracks
Definition: testEve_cfg.py:39
MonitorElement * test_TightMu_Minv
edm::InputTag theTrackCollectionLabel
tuple muons
Definition: patZpeak.py:38
const Point & position() const
position
Definition: BeamSpot.h:63
MonitorElement * h_allProbes_hp_eta
MonitorElement * h_allProbes_phi
MonitorElement * h_allProbes_endcap_pt
MonitorElement * h_allProbes_barrel_pt
void EfficiencyAnalyzer::beginJob ( DQMStore dbe)
virtual

Inizialize parameters for histo binning.

Implements MuonAnalyzerBase.

Definition at line 44 of file EfficiencyAnalyzer.cc.

References DQMStore::book1D(), gather_cfg::cout, etaBin_, etaMax_, etaMin_, edm::ParameterSet::getParameter(), h_allProbes_barrel_pt, h_allProbes_endcap_pt, h_allProbes_eta, h_allProbes_hp_eta, h_allProbes_phi, h_allProbes_pt, h_passProbes_TightMu_barrel_pt, h_passProbes_TightMu_endcap_pt, h_passProbes_TightMu_eta, h_passProbes_TightMu_hp_eta, h_passProbes_TightMu_phi, h_passProbes_TightMu_pt, LogTrace, metname, parameters, phiBin_, phiMax_, phiMin_, ptBin_, ptMax_, ptMin_, DQMStore::setCurrentFolder(), test_TightMu_Minv, theMuonCollectionLabel, and theTrackCollectionLabel.

44  {
45 #ifdef DEBUG
46  cout << "[EfficiencyAnalyzer] Parameters initialization" <<endl;
47 #endif
48  metname = "EfficiencyAnalyzer";
49  LogTrace(metname)<<"[EfficiencyAnalyzer] Parameters initialization";
50  dbe->setCurrentFolder("Muons/EfficiencyAnalyzer");
51 
54 
55 
56  ptBin_ = parameters.getParameter<int>("ptBin");
57  ptMin_ = parameters.getParameter<double>("ptMin");
58  ptMax_ = parameters.getParameter<double>("ptMax");
59 
60  etaBin_ = parameters.getParameter<int>("etaBin");
61  etaMin_ = parameters.getParameter<double>("etaMin");
62  etaMax_ = parameters.getParameter<double>("etaMax");
63 
64  phiBin_ = parameters.getParameter<int>("phiBin");
65  phiMin_ = parameters.getParameter<double>("phiMin");
66  phiMax_ = parameters.getParameter<double>("phiMax");
67 
68 
69 
70  test_TightMu_Minv = dbe->book1D("test_TightMu_Minv" ,"Minv",50,70,110);
71 
72  h_allProbes_pt = dbe->book1D("allProbes_pt","All Probes Pt", ptBin_, ptMin_, ptMax_);
73  h_allProbes_barrel_pt = dbe->book1D("allProbes_barrel_pt","Barrel: all Probes Pt", ptBin_, ptMin_, ptMax_);
74  h_allProbes_endcap_pt = dbe->book1D("allProbes_endcap_pt","Endcap: all Probes Pt", ptBin_, ptMin_, ptMax_);
75  h_allProbes_eta = dbe->book1D("allProbes_eta","All Probes Eta", etaBin_, etaMin_, etaMax_);
76  h_allProbes_hp_eta = dbe->book1D("allProbes_hp_eta","High Pt all Probes Eta", etaBin_, etaMin_, etaMax_);
77  h_allProbes_phi = dbe->book1D("allProbes_phi","All Probes Phi", phiBin_, phiMin_, phiMax_);
78 
79  h_passProbes_TightMu_pt = dbe->book1D("passProbes_TightMu_pt","TightMu Passing Probes Pt", ptBin_ , ptMin_ , ptMax_ );
80  h_passProbes_TightMu_barrel_pt = dbe->book1D("passProbes_TightMu_barrel_pt","Barrel: TightMu Passing Probes Pt", ptBin_ , ptMin_ , ptMax_ );
81  h_passProbes_TightMu_endcap_pt = dbe->book1D("passProbes_TightMu_endcap_pt","Endcap: TightMu Passing Probes Pt", ptBin_ , ptMin_ , ptMax_ );
82  h_passProbes_TightMu_eta = dbe->book1D("passProbes_TightMu_eta","TightMu Passing Probes #eta", etaBin_, etaMin_, etaMax_);
83  h_passProbes_TightMu_hp_eta = dbe->book1D("passProbes_TightMu_hp_eta","High Pt TightMu Passing Probes #eta", etaBin_, etaMin_, etaMax_);
84  h_passProbes_TightMu_phi = dbe->book1D("passProbes_TightMu_phi","TightMu Passing Probes #phi", phiBin_, phiMin_, phiMax_);
85 
86 
87 
88  /*h_failProbes_TightMu_pt = dbe->book1D("failProbes_TightMu_pt","TightMu Failling Probes Pt", ptBin_ , ptMin_ , ptMax_ );
89  h_failProbes_TightMu_eta = dbe->book1D("failProbes_TightMu_eta","TightMu Failling Probes #eta", etaBin_, etaMin_, etaMax_);
90  h_failProbes_TightMu_phi = dbe->book1D("failProbes_TightMu_phi","TightMu Failling Probes #phi", phiBin_, phiMin_, phiMax_);
91  */
92 
93 #ifdef DEBUG
94  cout << "[EfficiencyAnalyzer] Parameters initialization DONE" <<endl;
95 #endif
96 }
T getParameter(std::string const &) const
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:717
MonitorElement * h_allProbes_eta
edm::ParameterSet parameters
MonitorElement * h_allProbes_pt
MonitorElement * h_passProbes_TightMu_hp_eta
MonitorElement * h_passProbes_TightMu_eta
MonitorElement * h_passProbes_TightMu_phi
MonitorElement * h_passProbes_TightMu_pt
MonitorElement * h_passProbes_TightMu_barrel_pt
edm::InputTag theMuonCollectionLabel
#define LogTrace(id)
MonitorElement * h_passProbes_TightMu_endcap_pt
MonitorElement * test_TightMu_Minv
edm::InputTag theTrackCollectionLabel
tuple cout
Definition: gather_cfg.py:121
MonitorElement * h_allProbes_hp_eta
MonitorElement * h_allProbes_phi
MonitorElement * h_allProbes_endcap_pt
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:429
MonitorElement * h_allProbes_barrel_pt

Member Data Documentation

int EfficiencyAnalyzer::etaBin_
protected

Definition at line 53 of file EfficiencyAnalyzer.h.

Referenced by beginJob().

double EfficiencyAnalyzer::etaMax_
protected

Definition at line 61 of file EfficiencyAnalyzer.h.

Referenced by beginJob().

double EfficiencyAnalyzer::etaMin_
protected

Definition at line 60 of file EfficiencyAnalyzer.h.

Referenced by beginJob().

MonitorElement* EfficiencyAnalyzer::h_allProbes_barrel_pt
protected

Definition at line 78 of file EfficiencyAnalyzer.h.

Referenced by analyze(), and beginJob().

MonitorElement* EfficiencyAnalyzer::h_allProbes_endcap_pt
protected

Definition at line 79 of file EfficiencyAnalyzer.h.

Referenced by analyze(), and beginJob().

MonitorElement* EfficiencyAnalyzer::h_allProbes_eta
protected

Definition at line 80 of file EfficiencyAnalyzer.h.

Referenced by analyze(), and beginJob().

MonitorElement* EfficiencyAnalyzer::h_allProbes_hp_eta
protected

Definition at line 81 of file EfficiencyAnalyzer.h.

Referenced by analyze(), and beginJob().

MonitorElement* EfficiencyAnalyzer::h_allProbes_phi
protected

Definition at line 82 of file EfficiencyAnalyzer.h.

Referenced by analyze(), and beginJob().

MonitorElement* EfficiencyAnalyzer::h_allProbes_pt
protected

Definition at line 77 of file EfficiencyAnalyzer.h.

Referenced by analyze(), and beginJob().

MonitorElement* EfficiencyAnalyzer::h_failProbes_TightMu_eta
protected

Definition at line 74 of file EfficiencyAnalyzer.h.

MonitorElement* EfficiencyAnalyzer::h_failProbes_TightMu_phi
protected

Definition at line 75 of file EfficiencyAnalyzer.h.

MonitorElement* EfficiencyAnalyzer::h_failProbes_TightMu_pt
protected

Definition at line 73 of file EfficiencyAnalyzer.h.

MonitorElement* EfficiencyAnalyzer::h_passProbes_TightMu_barrel_pt
protected

Definition at line 67 of file EfficiencyAnalyzer.h.

Referenced by analyze(), and beginJob().

MonitorElement* EfficiencyAnalyzer::h_passProbes_TightMu_endcap_pt
protected

Definition at line 68 of file EfficiencyAnalyzer.h.

Referenced by analyze(), and beginJob().

MonitorElement* EfficiencyAnalyzer::h_passProbes_TightMu_eta
protected

Definition at line 69 of file EfficiencyAnalyzer.h.

Referenced by analyze(), and beginJob().

MonitorElement* EfficiencyAnalyzer::h_passProbes_TightMu_hp_eta
protected

Definition at line 70 of file EfficiencyAnalyzer.h.

Referenced by analyze(), and beginJob().

MonitorElement* EfficiencyAnalyzer::h_passProbes_TightMu_phi
protected

Definition at line 71 of file EfficiencyAnalyzer.h.

Referenced by analyze(), and beginJob().

MonitorElement* EfficiencyAnalyzer::h_passProbes_TightMu_pt
protected

Definition at line 66 of file EfficiencyAnalyzer.h.

Referenced by analyze(), and beginJob().

std::string EfficiencyAnalyzer::metname
protected

Definition at line 44 of file EfficiencyAnalyzer.h.

Referenced by analyze(), and beginJob().

edm::ParameterSet EfficiencyAnalyzer::parameters
protected
int EfficiencyAnalyzer::phiBin_
protected

Definition at line 54 of file EfficiencyAnalyzer.h.

Referenced by beginJob().

double EfficiencyAnalyzer::phiMax_
protected

Definition at line 64 of file EfficiencyAnalyzer.h.

Referenced by beginJob().

double EfficiencyAnalyzer::phiMin_
protected

Definition at line 63 of file EfficiencyAnalyzer.h.

Referenced by beginJob().

int EfficiencyAnalyzer::ptBin_
protected

Definition at line 55 of file EfficiencyAnalyzer.h.

Referenced by beginJob().

double EfficiencyAnalyzer::ptMax_
protected

Definition at line 58 of file EfficiencyAnalyzer.h.

Referenced by beginJob().

double EfficiencyAnalyzer::ptMin_
protected

Definition at line 57 of file EfficiencyAnalyzer.h.

Referenced by beginJob().

MonitorElement* EfficiencyAnalyzer::test_TightMu_Minv
protected

Definition at line 85 of file EfficiencyAnalyzer.h.

Referenced by analyze(), and beginJob().

edm::InputTag EfficiencyAnalyzer::theMuonCollectionLabel
protected

Definition at line 48 of file EfficiencyAnalyzer.h.

Referenced by analyze(), and beginJob().

edm::InputTag EfficiencyAnalyzer::theSTACollectionLabel
protected

Definition at line 47 of file EfficiencyAnalyzer.h.

edm::InputTag EfficiencyAnalyzer::theTrackCollectionLabel
protected

Definition at line 49 of file EfficiencyAnalyzer.h.

Referenced by analyze(), and beginJob().