Skip to content

Commit

Permalink
Merge pull request #170 from folguera/MuonDQM-GED-62X
Browse files Browse the repository at this point in the history
Added MuonDQM GED plots and validation
  • Loading branch information
ktf committed Sep 23, 2013
2 parents 3d6b4a5 + d836fdf commit 657696c
Show file tree
Hide file tree
Showing 7 changed files with 760 additions and 1 deletion.
110 changes: 110 additions & 0 deletions DQMOffline/Muon/interface/MuonPFAnalyzer.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
#ifndef MuonPFAnalyzer_H
#define MuonPFAnalyzer_H

/** \class MuRecoAnalyzer
*
* DQM monitoring source for PF muons
*
* $Date: 2013/06/14 10:28:23 $
* $Revision: 1.1 $
* \author C. Battilana - CIEMAT
*/



//Base class
#include "FWCore/Framework/interface/EDAnalyzer.h"

#include "FWCore/Utilities/interface/InputTag.h"
#include "DQMServices/Core/interface/DQMStore.h"
#include "DQMServices/Core/interface/MonitorElement.h"
#include "FWCore/ServiceRegistry/interface/Service.h"


#include "DataFormats/MuonReco/interface/Muon.h"
#include "DataFormats/MuonReco/interface/MuonFwd.h"
#include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h"
#include "DataFormats/HepMCCandidate/interface/GenParticle.h"
#include "DataFormats/HepMCCandidate/interface/GenParticleFwd.h"
#include "DataFormats/VertexReco/interface/Vertex.h"
#include "DataFormats/VertexReco/interface/VertexFwd.h"
#include "DataFormats/BeamSpot/interface/BeamSpot.h"

#include <map>
#include <string>

class MuonPFAnalyzer : public edm::EDAnalyzer {

public:

typedef std::pair<const reco::Muon*, const reco::GenParticle*> RecoGenPair;
typedef std::vector<RecoGenPair> RecoGenCollection;

/// Constructor
explicit MuonPFAnalyzer(const edm::ParameterSet&);

/// Destructor
~MuonPFAnalyzer();

/// Initialize an book plots
virtual void beginRun(edm::Run const &, edm::EventSetup const &);

/// Perform the PF - TUNEP muon analysis
virtual void analyze(const edm::Event&, const edm::EventSetup&);

private:

// Book histos for a given group of plots (e.g. for Tight TUNEP muons)
void bookHistos(const std::string & group);

// Get a specific plot for a given group
MonitorElement* getPlot(const std::string & group, const std::string & type);

// Algorithm to identify muon pt track type
int muonTrackType(const reco::Muon * muon, bool usePF);

// Compute comb. rel. iso. (RECO based) for a given muon
inline float combRelIso(const reco::Muon * muon);

// Compute delta phi taking into account overflows
inline float fDeltaPhi(float phi1, float phi2);

// Set labels for code plots
void setCodeLabels(MonitorElement *plot, int nAxis);

// Fill plot within its range limits
void fillInRange(MonitorElement *plot, int nAxis, double x, double y = 0);

// Perform reco-gen geometrical matching on a best effort basis
// (if runOnMC == false or no matched gen particles are available gen is set to 0 in theRecoGen)
void recoToGenMatch( edm::Handle<reco::MuonCollection> & reco,
edm::Handle<reco::GenParticleCollection> & gen );

const reco::Vertex getPrimaryVertex( edm::Handle<reco::VertexCollection> &vertex,
edm::Handle<reco::BeamSpot> &beamSpot );


edm::InputTag theGenLabel;
edm::InputTag theRecoLabel;
edm::InputTag theVertexLabel;
edm::InputTag theBeamSpotLabel;

std::vector<std::string> theMuonKinds;

DQMStore *theDbe;

std::map<std::string,std::map<std::string,MonitorElement*> > thePlots;
RecoGenCollection theRecoGen;

double theHighPtTh;
double theRecoGenR;
double theIsoCut;

bool theRunOnMC;

std::string theFolder;

};
#endif


3 changes: 2 additions & 1 deletion DQMOffline/Muon/python/muonMonitors_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from DQMOffline.Muon.CSCMonitor_cfi import *
from DQMOffline.Muon.muonIdDQM_cff import *
from DQMOffline.Muon.muonIsolationDQM_cff import *
from DQMOffline.Muon.muonPFAnalyzer_cff import *

#dedicated clients for offline dqm
from DQMOffline.Muon.muonQualityTests_cff import *
Expand All @@ -20,7 +21,7 @@

muonTrackAnalyzers = cms.Sequence(MonitorTrackSTAMuons*MonitorTrackGLBMuons)

muonMonitors = cms.Sequence(muonTrackAnalyzers*dtSegmentsMonitor*cscMonitor*muonAnalyzer*muonIdDQM*dqmInfoMuons*muIsoDQM_seq)
muonMonitors = cms.Sequence(muonTrackAnalyzers*dtSegmentsMonitor*cscMonitor*muonAnalyzer*muonIdDQM*dqmInfoMuons*muIsoDQM_seq*muonPFsequence)

muonMonitorsAndQualityTests = cms.Sequence(muonMonitors*muonQualityTests)

Expand Down
3 changes: 3 additions & 0 deletions DQMOffline/Muon/python/muonPFAnalyzer_cff.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import FWCore.ParameterSet.Config as cms

from DQMOffline.Muon.muonPFAnalyzer_cfi import *
19 changes: 19 additions & 0 deletions DQMOffline/Muon/python/muonPFAnalyzer_cfi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import FWCore.ParameterSet.Config as cms


muonPFsequence = cms.EDAnalyzer("MuonPFAnalyzer",
inputTagMuonReco = cms.InputTag("muons"),
inputTagGenParticles = cms.InputTag("genParticles"),
inputTagVertex = cms.InputTag("offlinePrimaryVertices"),
inputTagBeamSpot = cms.InputTag("offlineBeamSpot"),

runOnMC = cms.bool(False),
folder = cms.string("Muons/MuonPFAnalyzer/"),

recoGenDeltaR = cms.double(0.1),
relCombIsoCut = cms.double(0.15),
highPtThreshold = cms.double(200.)
)



Loading

0 comments on commit 657696c

Please sign in to comment.