23 #include "TLorentzVector.h"
51 cout <<
"[EfficiencyAnalyzer] Parameters initialization" <<endl;
133 cout <<
"[EfficiencyAnalyzer] Parameters initialization DONE" <<endl;
139 LogTrace(
metname)<<
"[EfficiencyAnalyzer] Analyze the mu in different eta regions";
151 iEvent.
getByLabel(
"offlineBeamSpot", beamSpotHandle);
152 beamSpot = *beamSpotHandle;
162 bool bPrimaryVertex =
true;
164 bPrimaryVertex =
false;
167 LogTrace(
metname) <<
"[EfficiencyAnalyzer] Could not find vertex collection" << std::endl;
168 bPrimaryVertex =
false;
173 int vertex_number = vertexCollection.size();
175 reco::VertexCollection::const_iterator
v = vertexCollection.begin();
176 for ( ; v != vertexCollection.end(); ++
v) {
177 double vertex_chi2 = v->normalizedChi2();
178 double vertex_ndof = v->ndof();
179 bool fakeVtx = v->isFake();
180 double vertex_Z = v->z();
183 && vertex_number >= 1
186 && fabs(vertex_Z)< 24. ) {
187 bPrimaryVertex =
true;
202 unsigned int theIndexOfThePrimaryVertex = 999.;
207 for (
unsigned int ind=0; ind<vertex->size(); ++ind) {
209 if ( (*vertex)[ind].isValid() && !((*vertex)[ind].isFake()) ) {
211 theIndexOfThePrimaryVertex = ind;
217 if (theIndexOfThePrimaryVertex<100) {
218 posVtx = ((*vertex)[theIndexOfThePrimaryVertex]).
position();
219 errVtx = ((*vertex)[theIndexOfThePrimaryVertex]).
error();
222 LogInfo(
"EfficiencyAnalyzer") <<
"reco::PrimaryVertex not found, use BeamSpot position instead\n";
233 errVtx(2,2) = bs.
sigmaZ();
248 TLorentzVector Mu1, Mu2;
253 for (reco::MuonCollection::const_iterator recoMu1 = muons->begin(); recoMu1!=muons->end(); ++recoMu1) {
254 LogTrace(
metname)<<
"[EfficiencyAnalyzer] loop over first muons" << endl;
258 float combIso = (Iso_muon.
emEt + Iso_muon.
hadEt + Iso_muon.
sumPt);
261 if (!recoMu1->isGlobalMuon())
continue;
265 float muPt1 = recoCombinedGlbTrack1->pt();
266 Mu1.SetPxPyPzE(recoCombinedGlbTrack1->px(), recoCombinedGlbTrack1->py(),recoCombinedGlbTrack1->pz(), recoCombinedGlbTrack1->p());
275 if (muPt1 <= 15)
continue;
276 if (combIso/muPt1 > 0.1 )
continue;
278 for (reco::MuonCollection::const_iterator recoMu2 = muons->begin(); recoMu2!=muons->end(); ++recoMu2){
279 LogTrace(
metname)<<
"[EfficiencyAnalyzer] loop over second muon" <<endl;
280 if (recoMu2 == recoMu1)
continue;
282 if (recoMu2->eta() < 1.479 ) isMB =
true;
283 if (recoMu2->eta() >= 1.479 ) isME =
true;
286 Mu2.SetPxPyPzE(recoMu2->px(), recoMu2->py(), recoMu2->pz(), recoMu2->p());
288 float Minv = (Mu1+Mu2).M();
289 if (!recoMu2->isTrackerMuon())
continue;
290 if ( recoMu2->pt() < 5 )
continue;
291 if ( (recoMu1->charge())*(recoMu2->charge()) > 0 )
continue;
292 if ( Minv < 70 || Minv > 110 )
continue;
328 float tkIso = recoMu2->isolationR03().sumPt;
329 float emIso = recoMu2->isolationR03().emEt;
330 float hadIso = recoMu2->isolationR03().hadEt + recoMu2->isolationR03().hoEt;
331 float relDetIso = (tkIso + emIso + hadIso) / (recoMu2->pt());
333 if (relDetIso < 0.05 ) {
344 float chargedIso = recoMu2->pfIsolationR04().sumChargedHadronPt;
345 float neutralIso = recoMu2->pfIsolationR04().sumNeutralHadronEt;
346 float photonIso = recoMu2->pfIsolationR04().sumPhotonEt;
347 float relPFIso = (chargedIso + neutralIso + photonIso) / (recoMu2->pt());
349 float pu = recoMu2->pfIsolationR04().sumPUPt;
351 float neutralphotonPUCorrected =
std::max(0.0 , (neutralIso + photonIso - 0.5*pu ) );
353 float relPFIsoPUCorrected = (chargedIso + neutralphotonPUCorrected) / (recoMu2->pt());
357 if (relPFIso < 0.12 ) {
371 if ( relPFIsoPUCorrected < 0.12 ) {
T getParameter(std::string const &) const
MonitorElement * h_passProbes_pfIsoTightMu_nVtx
float sumPt
sum-pt of tracks
MonitorElement * h_passProbes_EB_pfIsoTightMu_pt
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
MonitorElement * h_passProbes_EB_pfIsodBTightMu_nVtx
MonitorElement * h_allProbes_eta
MonitorElement * h_allProbes_EE_TightMu_nVtx
edm::ParameterSet parameters
MonitorElement * h_passProbes_EB_detIsoTightMu_pt
math::Error< dimension >::type Error
covariance error matrix (3x3)
MonitorElement * h_passProbes_pfIsodBTightMu_nVtx
std::vector< Vertex > VertexCollection
collection of Vertex objects
MonitorElement * h_allProbes_EB_TightMu_pt
MonitorElement * h_passProbes_EE_pfIsoTightMu_nVtx
static int position[TOTALCHAMBERS][3]
MonitorElement * h_passProbes_EE_detIsoTightMu_pt
MonitorElement * h_allProbes_pt
MonitorElement * h_allProbes_EB_pt
MonitorElement * h_passProbes_TightMu_EB_pt
MonitorElement * h_passProbes_EE_pfIsoTightMu_pt
MonitorElement * h_passProbes_EB_pfIsoTightMu_nVtx
const T & max(const T &a, const T &b)
MonitorElement * h_passProbes_TightMu_hp_eta
MonitorElement * h_allProbes_EE_pt
MonitorElement * h_passProbes_TightMu_eta
MonitorElement * h_passProbes_EE_detIsoTightMu_nVtx
MonitorElement * h_passProbes_TightMu_phi
math::XYZPoint Point
point in the space
double BeamWidthX() const
beam width X
MonitorElement * h_passProbes_TightMu_pt
MonitorElement * h_allProbes_EB_TightMu_nVtx
edm::InputTag theMuonCollectionLabel
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
MonitorElement * h_passProbes_TightMu_EE_pt
void analyze(const edm::Event &event, const edm::EventSetup &eventSetup)
MonitorElement * h_passProbes_EB_detIsoTightMu_nVtx
MonitorElement * h_passProbes_EE_pfIsodBTightMu_nVtx
MonitorElement * h_passProbes_EE_pfIsodBTightMu_pt
MonitorElement * h_allProbes_TightMu_pt
void beginJob(DQMStore *dbe)
Inizialize parameters for histo binning.
double sigmaZ() const
sigma z
double BeamWidthY() const
beam width Y
T const * product() const
MonitorElement * test_TightMu_Minv
MonitorElement * h_passProbes_EB_pfIsodBTightMu_pt
edm::InputTag theTrackCollectionLabel
MonitorElement * h_passProbes_detIsoTightMu_nVtx
const Point & position() const
position
MonitorElement * h_allProbes_hp_eta
virtual ~EfficiencyAnalyzer()
MonitorElement * h_allProbes_EE_TightMu_pt
MonitorElement * h_allProbes_phi
bool isTightMuon(const reco::Muon &, const reco::Vertex &)
EfficiencyAnalyzer(const edm::ParameterSet &pset, MuonServiceProxy *theService)
MonitorElement * h_allProbes_TightMu_nVtx
void setCurrentFolder(const std::string &fullpath)
MonitorElement * h_passProbes_pfIsodBTightMu_pt
MonitorElement * h_passProbes_detIsoTightMu_pt
MonitorElement * h_passProbes_pfIsoTightMu_pt