12 #include "TLorentzVector.h" 31 primaryVerticesToken_ = consumes<std::vector<reco::Vertex> >(
parameters.getUntrackedParameter<
edm::InputTag>(
"offlinePrimaryVertices")),
32 theMuonCollectionLabel_ = consumes<edm::View<reco::Muon> > (
parameters.getParameter<
edm::InputTag>(
"MuonCollection"));
33 thePATMuonCollectionLabel_ = consumes<edm::View<pat::Muon> > (
parameters.getParameter<
edm::InputTag>(
"patMuonCollection"));
36 triggerResultsToken_ = consumes<edm::TriggerResults>(
parameters.getUntrackedParameter<
edm::InputTag>(
"triggerResults"));
37 triggerObjects_ = consumes<std::vector<pat::TriggerObjectStandAlone>>(
parameters.getParameter<
edm::InputTag>(
"triggerObjects"));
39 triggerPathName1_ =
parameters.getParameter<
string>(
"triggerPathName1");
40 triggerHistName1_ =
parameters.getParameter<
string>(
"triggerHistName1");
41 triggerPtThresholdPath1_ =
parameters.getParameter<
double>(
"triggerPtThresholdPath1");
42 triggerPathName2_ =
parameters.getParameter<
string>(
"triggerPathName2");
43 triggerHistName2_ =
parameters.getParameter<
string>(
"triggerHistName2");
44 triggerPtThresholdPath2_ =
parameters.getParameter<
double>(
"triggerPtThresholdPath2");
45 theFolder =
parameters.getParameter<
string>(
"folder");
59 matchHists.push_back(ibooker.
book1D(
"DelR_HLT_"+triggerHistName1_+
"_v1",
"DeltaR_(offline,HLT)_triggerPass("+triggerHistName1_+
")", 500, 0.0, 0.5));
60 matchHists.push_back(ibooker.
book1D(
"DelR_HLT_"+triggerHistName1_+
"_v2",
"DeltaR_(offline,HLT)_triggerPass("+triggerHistName1_+
")", 100, 0.5, 1.5));
61 matchHists.push_back(ibooker.
book1D(
"PtRatio_HLT_"+triggerHistName1_,
"PtRatio_(HLTPt/OfflinePt)_"+triggerHistName1_, 200, -5., 5.0));
63 matchHists.push_back(ibooker.
book1D(
"DelR_L1_"+triggerHistName1_+
"_v1",
"DeltaR_(offline, L1)_triggerPass("+triggerHistName1_+
")", 500, 0.0, 1.0));
64 matchHists.push_back(ibooker.
book1D(
"DelR_L1_"+triggerHistName1_+
"_v2",
"DeltaR_(offline, L1)_triggerPass("+triggerHistName1_+
")", 500, 0.0, 2.0));
65 matchHists.push_back(ibooker.
book1D(
"PtRatio_L1_"+triggerHistName1_,
"PtRatio_(HLTPt/OfflinePt)_"+triggerHistName1_, 200, -5., 5.0));
67 matchHists.push_back(ibooker.
book1D(
"DelR_HLT_"+triggerHistName2_+
"_v1",
"DeltaR_(offline,HLT)_triggerPass("+triggerHistName2_+
")", 500, 0.0, 0.5));
68 matchHists.push_back(ibooker.
book1D(
"DelR_HLT_"+triggerHistName2_+
"_v2",
"DeltaR_(offline,HLT)_triggerPass("+triggerHistName2_+
")", 100, 0.5, 1.5));
69 matchHists.push_back(ibooker.
book1D(
"PtRatio_HLT_"+triggerHistName2_,
"PtRatio_(HLTPt/OfflinePt)_"+triggerHistName2_, 200, -5., 5.0));
71 matchHists.push_back(ibooker.
book1D(
"DelR_L1_"+triggerHistName2_+
"_v1",
"DeltaR_(offline, L1)_triggerPass("+triggerHistName2_+
")", 250, 0.0, 0.5));
72 matchHists.push_back(ibooker.
book1D(
"DelR_L1_"+triggerHistName2_+
"_v2",
"DeltaR_(offline, L1)_triggerPass("+triggerHistName2_+
")", 100, 0.5, 1.5));
73 matchHists.push_back(ibooker.
book1D(
"PtRatio_L1_"+triggerHistName2_,
"PtRatio_(HLTPt/OfflinePt)_"+triggerHistName2_, 200, -5., 5.0));
78 h_passHLTPath1_eta_Tight = ibooker.
book1D(
"passHLT"+triggerHistName1_+
"_eta_Tight",
" HLT("+triggerHistName1_+
") pass #eta", 8, -2.5, 2.5);
79 h_passHLTPath1_pt_Tight = ibooker.
book1D(
"passHLT"+triggerHistName1_+
"_pt_Tight",
" HLT("+triggerHistName1_+
") pass pt", 10, 20, 220);
80 h_passHLTPath1_phi_Tight = ibooker.
book1D(
"passHLT"+triggerHistName1_+
"_phi_Tight",
" HLT("+triggerHistName1_+
") pass phi", 8, -3.0, 3.0);
81 h_totalHLTPath1_eta_Tight = ibooker.
book1D(
"totalHLT"+triggerHistName1_+
"_eta_Tight",
" HLT("+triggerHistName1_+
") total #eta", 8, -2.5, 2.5);
82 h_totalHLTPath1_pt_Tight = ibooker.
book1D(
"totalHLT"+triggerHistName1_+
"_pt_Tight",
" HLT("+triggerHistName1_+
") total pt", 10, 20., 220);
83 h_totalHLTPath1_phi_Tight = ibooker.
book1D(
"totalHLT"+triggerHistName1_+
"_phi_Tight",
" HLT("+triggerHistName1_+
") total phi", 8, -3.0, 3.0);
85 h_passHLTPath2_eta_Tight = ibooker.
book1D(
"passHLT"+triggerHistName2_+
"_eta_Tight",
" HLT("+triggerHistName2_+
") pass #eta", 8, -2.5, 2.5);
86 h_passHLTPath2_pt_Tight = ibooker.
book1D(
"passHLT"+triggerHistName2_+
"_pt_Tight",
" HLT("+triggerHistName2_+
") pass pt", 10, 20., 220);
87 h_passHLTPath2_phi_Tight = ibooker.
book1D(
"passHLT"+triggerHistName2_+
"_phi_Tight",
" HLT("+triggerHistName2_+
") pass phi", 8, -3.0, 3.0);
88 h_totalHLTPath2_eta_Tight = ibooker.
book1D(
"totalHLT"+triggerHistName2_+
"_eta_Tight",
" HLT("+triggerHistName2_+
") total #eta", 8, -2.5, 2.5);
89 h_totalHLTPath2_pt_Tight = ibooker.
book1D(
"totalHLT"+triggerHistName2_+
"_pt_Tight",
" HLT("+triggerHistName2_+
") total pt", 10, 20, 220);
90 h_totalHLTPath2_phi_Tight = ibooker.
book1D(
"totalHLT"+triggerHistName2_+
"_phi_Tight",
" HLT("+triggerHistName2_+
") total phi", 8, -3.0, 3.0);
96 LogTrace(
metname)<<
"[TriggerMatchMonitor] Analyze the mu in different eta regions";
97 theService->update(iSetup);
100 iEvent.
getByToken(theMuonCollectionLabel_,muons);
103 iEvent.
getByToken(thePATMuonCollectionLabel_,PATmuons);
106 iEvent.
getByToken(triggerObjects_, triggerObjects);
109 iEvent.
getByToken(triggerResultsToken_, triggerResults);
114 iEvent.
getByToken(primaryVerticesToken_,recVtxs);
115 unsigned int theIndexOfThePrimaryVertex = 999.;
116 for (
unsigned int ind = 0; ind < recVtxs->size(); ++ind) {
117 if ( (*recVtxs)[ind].isValid() && !((*recVtxs)[ind].isFake()) ) {
118 theIndexOfThePrimaryVertex = ind;
122 if (theIndexOfThePrimaryVertex<100) {
123 posVtx = ((*recVtxs)[theIndexOfThePrimaryVertex]).
position();
124 errVtx = ((*recVtxs)[theIndexOfThePrimaryVertex]).
error();
127 LogInfo(
"RecoMuonValidator") <<
"reco::PrimaryVertex not found, use BeamSpot position instead\n";
129 iEvent.
getByToken(beamSpotToken_,recoBeamSpotHandle);
134 errVtx(2,2) = bs.
sigmaZ();
139 for(
const auto & patMuon : *PATmuons){
140 bool Isolated=patMuon.pfIsolationR04().sumChargedHadronPt +
TMath::Max(0., patMuon.pfIsolationR04().sumNeutralHadronEt + patMuon.pfIsolationR04().sumPhotonEt - 0.5*patMuon.pfIsolationR04().sumPUPt) / patMuon.pt() < 0.25;
142 if(patMuon.isGlobalMuon() && Isolated && patMuon.isTightMuon(thePrimaryVertex)){
144 TLorentzVector offlineMuon;
145 offlineMuon.SetPtEtaPhiM(patMuon.pt(), patMuon.eta(), patMuon.phi(),0.0);
147 const char *ptrmuPath1 = triggerPathName1_.c_str();
148 const char *ptrmuPath2 = triggerPathName2_.c_str();
149 if(patMuon.pt() > triggerPtThresholdPath1_){
150 h_totalHLTPath1_eta_Tight->Fill(patMuon.eta());
151 h_totalHLTPath1_pt_Tight->Fill(patMuon.pt());
152 h_totalHLTPath1_phi_Tight->Fill(patMuon.phi());
154 if(patMuon.pt() > triggerPtThresholdPath2_){
155 h_totalHLTPath2_eta_Tight->Fill(patMuon.eta());
156 h_totalHLTPath2_pt_Tight->Fill(patMuon.pt());
157 h_totalHLTPath2_phi_Tight->Fill(patMuon.phi());
159 if(patMuon.triggered(ptrmuPath1) && patMuon.hltObject() !=
nullptr){
160 TLorentzVector hltMuon;
161 hltMuon.SetPtEtaPhiM(patMuon.hltObject()->pt(),patMuon.hltObject()->eta(),patMuon.hltObject()->phi(),0.0);
162 double DelRrecoHLT=offlineMuon.DeltaR(hltMuon);
164 matchHists[0]->Fill(DelRrecoHLT);
165 matchHists[1]->Fill(DelRrecoHLT);
166 matchHists[2]->Fill(patMuon.hltObject()->pt()/patMuon.pt());
167 if(DelRrecoHLT<0.2 && patMuon.pt() > triggerPtThresholdPath1_){
168 h_passHLTPath1_eta_Tight->Fill(patMuon.eta());
169 h_passHLTPath1_pt_Tight->Fill(patMuon.pt());
170 h_passHLTPath1_phi_Tight->Fill(patMuon.phi());
172 if(patMuon.l1Object() !=
nullptr){
173 TLorentzVector L1Muon;
174 L1Muon.SetPtEtaPhiM(patMuon.l1Object()->pt(),patMuon.l1Object()->eta(),patMuon.l1Object()->phi(),0.0);
175 double DelRrecoL1=offlineMuon.DeltaR(L1Muon);
176 matchHists[3]->Fill(DelRrecoL1);
177 matchHists[4]->Fill(DelRrecoL1);
178 matchHists[5]->Fill(patMuon.l1Object()->pt()/patMuon.pt());
184 if(patMuon.triggered(ptrmuPath2)){
185 TLorentzVector hltMuon50;
186 hltMuon50.SetPtEtaPhiM(patMuon.hltObject()->pt(),patMuon.hltObject()->eta(),patMuon.hltObject()->phi(),0.0);
187 double DelRrecoHLT50=offlineMuon.DeltaR(hltMuon50);
189 matchHists[6]->Fill(DelRrecoHLT50);
190 matchHists[7]->Fill(DelRrecoHLT50);
191 matchHists[8]->Fill(patMuon.hltObject()->pt()/patMuon.pt());
192 if(DelRrecoHLT50<0.2 && patMuon.pt() > triggerPtThresholdPath2_ ){
193 h_passHLTPath2_eta_Tight->Fill(patMuon.eta());
194 h_passHLTPath2_pt_Tight->Fill(patMuon.pt());
195 h_passHLTPath2_phi_Tight->Fill(patMuon.phi());
199 if(patMuon.l1Object() !=
nullptr){
200 TLorentzVector L1Muon50;
201 L1Muon50.SetPtEtaPhiM(patMuon.l1Object()->pt(),patMuon.l1Object()->eta(),patMuon.l1Object()->phi(),0.0);
202 double DelRrecoL150=offlineMuon.DeltaR(L1Muon50);
203 matchHists[9]->Fill(DelRrecoL150);
204 matchHists[10]->Fill(DelRrecoL150);
205 matchHists[11]->Fill(patMuon.l1Object()->pt()/patMuon.pt());
bool getByToken(EDGetToken token, Handle< PROD > &result) const
const std::string metname
math::Error< dimension >::type Error
covariance error matrix (3x3)
void setCurrentFolder(std::string const &fullpath)
~TriggerMatchMonitor() override
Destructor.
MonitorElement * book1D(Args &&...args)
math::XYZPoint Point
point in the space
double BeamWidthX() const
beam width X
static std::string const triggerResults
double sigmaZ() const
sigma z
double BeamWidthY() const
beam width Y
static int position[264][3]
void analyze(const edm::Event &, const edm::EventSetup &) override
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
const Point & position() const
position
TriggerMatchMonitor(const edm::ParameterSet &pSet)
Constructor.