New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inclusion of muon timing plots in the DQMOffline/Muon package #18267
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
#ifndef MuonTiming_H | ||
#define MuonTiming_H | ||
|
||
/** \class MuRecoAnalyzer | ||
* | ||
* DQM monitoring source for muon reco track | ||
* | ||
* \author G. Mila - INFN Torino | ||
*/ | ||
|
||
#include <memory> | ||
#include <fstream> | ||
#include "FWCore/Framework/interface/Frameworkfwd.h" | ||
#include "FWCore/Utilities/interface/InputTag.h" | ||
#include "FWCore/ParameterSet/interface/ParameterSet.h" | ||
#include "FWCore/Framework/interface/Event.h" | ||
#include "FWCore/Framework/interface/MakerMacros.h" | ||
#include "FWCore/ServiceRegistry/interface/Service.h" | ||
|
||
#include "DQMServices/Core/interface/DQMStore.h" | ||
#include "DQMServices/Core/interface/MonitorElement.h" | ||
#include "DQMServices/Core/interface/DQMEDAnalyzer.h" | ||
|
||
#include "RecoMuon/TrackingTools/interface/MuonServiceProxy.h" | ||
|
||
#include "DataFormats/MuonReco/interface/Muon.h" | ||
#include "DataFormats/MuonReco/interface/MuonFwd.h" | ||
|
||
class MuonTiming : public DQMEDAnalyzer { | ||
public: | ||
|
||
/// Constructor | ||
MuonTiming(const edm::ParameterSet&); | ||
|
||
/// Destructor | ||
virtual ~MuonTiming(); | ||
|
||
/// Inizialize parameters for histo binning | ||
void analyze(const edm::Event&, const edm::EventSetup&) override; | ||
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override; | ||
|
||
private: | ||
// ----------member data --------------------------- | ||
MuonServiceProxy *theService; | ||
edm::ParameterSet parameters; | ||
|
||
edm::EDGetTokenT<edm::View<reco::Muon> > theMuonCollectionLabel_; | ||
// Switch for verbosity | ||
std::string metname; | ||
|
||
|
||
//histo binning parameters | ||
int tnbins; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please follow a naming convention for variables that make up a class. Eg, in CMS its often an '_' at the end of the variable. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have added a '_' at the end of all of them. |
||
int tnbinsrpc; | ||
int terrnbins; | ||
int terrnbinsrpc; | ||
int ndofnbins; | ||
int ptnbins; | ||
int etanbins; | ||
double tmax, tmin; | ||
double tmaxrpc, tminrpc; | ||
double terrmax, terrmin; | ||
double terrmaxrpc, terrminrpc; | ||
double ndofmax, ndofmin; | ||
double ptmax, ptmin; | ||
double etamax, etamin; | ||
double etaBarrelMin, etaBarrelMax, etaEndcapMin, etaEndcapMax, etaOverlapMin, etaOverlapMax; | ||
|
||
std::string theFolder; | ||
std::vector<std::string> EtaName, ObjectName; | ||
enum eta {overlap, barrel, endcap}; | ||
enum object {sta, glb}; | ||
//the histos | ||
std::vector<std::vector<MonitorElement*>> timeNDof; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. as the sizes of these are known (and hardwired), please use std::array<std::array<MonitorElement*,1>,3> to avoid both the extra memory of the vectors and the need to first declare a vector and then push_back There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi, yes. That's way smarter. Sorry for not having thought about it in the first place. It's now implemented. |
||
std::vector<std::vector<MonitorElement*>> timeAtIpInOut; | ||
std::vector<std::vector<MonitorElement*>> timeAtIpInOutRPC; | ||
std::vector<std::vector<MonitorElement*>> timeAtIpInOutErr; | ||
std::vector<std::vector<MonitorElement*>> timeAtIpInOutErrRPC; | ||
std::vector<MonitorElement*> etaptVeto; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. similarly here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, updated as well. |
||
std::vector<MonitorElement*> etaVeto; | ||
std::vector<MonitorElement*> ptVeto; | ||
std::vector<MonitorElement*> yields; | ||
|
||
}; | ||
#endif |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
import FWCore.ParameterSet.Config as cms | ||
|
||
from RecoMuon.TrackingTools.MuonServiceProxy_cff import * | ||
|
||
muonTiming = cms.EDAnalyzer("MuonTiming", | ||
MuonServiceProxy, | ||
MuonCollection = cms.InputTag("muons"), | ||
# histograms parameters | ||
tnbins = cms.int32(40), | ||
tnbinsrpc = cms.int32(20), | ||
terrnbins = cms.int32(20), | ||
terrnbinsrpc = cms.int32(20), | ||
ndofnbins = cms.int32(40), | ||
ptnbins = cms.int32(20), | ||
etanbins = cms.int32(20), | ||
tmax = cms.double(300), | ||
tmaxrpc = cms.double(30), | ||
terrmax = cms.double(10), | ||
terrmaxrpc = cms.double(10), | ||
ndofmax = cms.double(40), | ||
ptmax = cms.double(200), | ||
etamax = cms.double(2.4), | ||
tmin = cms.double(-300), | ||
tminrpc = cms.double(-30), | ||
terrmin = cms.double(0), | ||
terrminrpc = cms.double(0), | ||
ndofmin = cms.double(0), | ||
ptmin = cms.double(0), | ||
etamin = cms.double(-2.4), | ||
etaBarrelMin = cms.double(0), | ||
etaBarrelMax = cms.double(1.1), | ||
etaOverlapMin = cms.double(0.9), | ||
etaOverlapMax = cms.double(1.1), | ||
etaEndcapMin = cms.double(0.9), | ||
etaEndcapMax = cms.double(2.4), | ||
folder = cms.string("Muons/MuonTiming") | ||
) | ||
|
||
muonTiming_miniAOD = cms.EDAnalyzer("MuonTiming", | ||
MuonServiceProxy, | ||
MuonCollection = cms.InputTag("slimmedMuons"), | ||
# histograms parameters | ||
tnbins = cms.int32(40), | ||
tnbinsrpc = cms.int32(20), | ||
terrnbins = cms.int32(20), | ||
terrnbinsrpc = cms.int32(20), | ||
ndofnbins = cms.int32(40), | ||
ptnbins = cms.int32(20), | ||
etanbins = cms.int32(20), | ||
tmax = cms.double(300), | ||
tmaxrpc = cms.double(30), | ||
terrmax = cms.double(10), | ||
terrmaxrpc = cms.double(10), | ||
ndofmax = cms.double(40), | ||
ptmax = cms.double(200), | ||
etamax = cms.double(2.4), | ||
tmin = cms.double(-300), | ||
tminrpc = cms.double(-30), | ||
terrmin = cms.double(0), | ||
terrminrpc = cms.double(0), | ||
ndofmin = cms.double(0), | ||
ptmin = cms.double(0), | ||
etamin = cms.double(-2.4), | ||
etaBarrelMin = cms.double(0), | ||
etaBarrelMax = cms.double(1.1), | ||
etaOverlapMin = cms.double(0.9), | ||
etaOverlapMax = cms.double(1.1), | ||
etaEndcapMin = cms.double(0.9), | ||
etaEndcapMax = cms.double(2.4), | ||
folder = cms.string("Muons_miniAOD/MuonTiming") | ||
) | ||
|
||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,6 +36,8 @@ DiMuonHistograms::DiMuonHistograms(const edm::ParameterSet& pSet){ | |
|
||
// counter | ||
nTightTight = 0; | ||
nMediumMedium = 0; | ||
nLooseLoose = 0; | ||
nGlbGlb = 0; | ||
|
||
// declare consumes: | ||
|
@@ -47,7 +49,7 @@ DiMuonHistograms::DiMuonHistograms(const edm::ParameterSet& pSet){ | |
etaBin = parameters.getParameter<int>("etaBin"); | ||
etaBBin = parameters.getParameter<int>("etaBBin"); | ||
etaEBin = parameters.getParameter<int>("etaEBin"); | ||
|
||
etaBMin = parameters.getParameter<double>("etaBMin"); | ||
etaBMax = parameters.getParameter<double>("etaBMax"); | ||
etaECMin = parameters.getParameter<double>("etaECMin"); | ||
|
@@ -84,7 +86,9 @@ void DiMuonHistograms::bookHistograms(DQMStore::IBooker & ibooker, | |
StaTrkMuon_HM.push_back(ibooker.book1D("StaTrkMuon_HM"+EtaName[iEtaRegion],"InvMass_{STA,TRK}"+EtaName[iEtaRegion],nBin[iEtaRegion], HighMassMin, HighMassMax)); | ||
|
||
// arround the Z peak | ||
TightTightMuon.push_back(ibooker.book1D("TightTightMuon"+EtaName[iEtaRegion],"InvMass_{Tight,Tight}"+EtaName[iEtaRegion],nBin[iEtaRegion], 55.0, 125.0)); | ||
TightTightMuon.push_back(ibooker.book1D("TightTightMuon"+EtaName[iEtaRegion],"InvMass_{Tight,Tight}"+EtaName[iEtaRegion], nBin[iEtaRegion], LowMassMin, LowMassMax)); | ||
MediumMediumMuon.push_back(ibooker.book1D("MediumMediumMuon"+EtaName[iEtaRegion],"InvMass_{Medium,Medium}"+EtaName[iEtaRegion],nBin[iEtaRegion], LowMassMin, LowMassMax)); | ||
LooseLooseMuon.push_back(ibooker.book1D("LooseLooseMuon"+EtaName[iEtaRegion],"InvMass_{Loose,Loose}"+EtaName[iEtaRegion], nBin[iEtaRegion], LowMassMin, LowMassMax)); | ||
|
||
// low-mass resonances | ||
SoftSoftMuon.push_back(ibooker.book1D("SoftSoftMuon"+EtaName[iEtaRegion],"InvMass_{Soft,Soft}"+EtaName[iEtaRegion],nBin[iEtaRegion], 0.0, 55.0)); | ||
|
@@ -172,7 +176,7 @@ void DiMuonHistograms::analyze(const edm::Event & iEvent,const edm::EventSetup& | |
} | ||
} | ||
} | ||
// Also Tight-Tight Muon Selection | ||
// Also Tight-Tight Muon Selection | ||
if ( muon::isTightMuon(*muon1, vtx) && | ||
muon::isTightMuon(*muon2, vtx) ) { | ||
test->Fill(InvMass); | ||
|
@@ -190,6 +194,42 @@ void DiMuonHistograms::analyze(const edm::Event & iEvent,const edm::EventSetup& | |
} | ||
} | ||
} | ||
// Also Medium-Medium Muon Selection | ||
if ( muon::isMediumMuon(*muon1) && | ||
muon::isMediumMuon(*muon2) ) { | ||
test->Fill(InvMass); | ||
LogTrace(metname)<<"[DiMuonHistograms] Medium-Medium pair"<<endl; | ||
if (charge < 0){ | ||
for (unsigned int iEtaRegion=0; iEtaRegion<3; iEtaRegion++){ | ||
if (iEtaRegion==0) {EtaCutMin= 0.; EtaCutMax=2.4; } | ||
if (iEtaRegion==1) {EtaCutMin= etaBMin; EtaCutMax=etaBMax; } | ||
if (iEtaRegion==2) {EtaCutMin= etaECMin; EtaCutMax=etaECMax; } | ||
|
||
if(fabs(recoCombinedGlbTrack1->eta())>EtaCutMin && fabs(recoCombinedGlbTrack1->eta())<EtaCutMax && | ||
fabs(recoCombinedGlbTrack2->eta())>EtaCutMin && fabs(recoCombinedGlbTrack2->eta())<EtaCutMax){ | ||
if (InvMass > 55. && InvMass < 125.) MediumMediumMuon[iEtaRegion]->Fill(InvMass); | ||
} | ||
} | ||
} | ||
} | ||
// Also Loose-Loose Muon Selection | ||
if ( muon::isLooseMuon(*muon1) && | ||
muon::isLooseMuon(*muon2) ) { | ||
test->Fill(InvMass); | ||
LogTrace(metname)<<"[DiMuonHistograms] Loose-Loose pair"<<endl; | ||
if (charge < 0){ | ||
for (unsigned int iEtaRegion=0; iEtaRegion<3; iEtaRegion++){ | ||
if (iEtaRegion==0) {EtaCutMin= 0.; EtaCutMax=2.4; } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please declare the etacutMin/Max vales in const arrays to avoid the needless if statements There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the advice. It has been corrected in the new version. |
||
if (iEtaRegion==1) {EtaCutMin= etaBMin; EtaCutMax=etaBMax; } | ||
if (iEtaRegion==2) {EtaCutMin= etaECMin; EtaCutMax=etaECMax; } | ||
|
||
if(fabs(recoCombinedGlbTrack1->eta())>EtaCutMin && fabs(recoCombinedGlbTrack1->eta())<EtaCutMax && | ||
fabs(recoCombinedGlbTrack2->eta())>EtaCutMin && fabs(recoCombinedGlbTrack2->eta())<EtaCutMax){ | ||
if (InvMass > 55. && InvMass < 125.) LooseLooseMuon[iEtaRegion]->Fill(InvMass); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
// Now check for STA-TRK | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hi @parbol - sorry I missed this before - the include guard should have the package name to ensure no conflicts - eg
ifndef DQMOffline_Muon_MuonTiming_H
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, thanks again. This has been adapted.