12 #include "TLorentzVector.h" 30 primaryVerticesToken_ = consumes<std::vector<reco::Vertex> >(
parameters.getUntrackedParameter<
edm::InputTag>(
"offlinePrimaryVertices")),
31 theMuonCollectionLabel_ = consumes<edm::View<reco::Muon> > (
parameters.getParameter<
edm::InputTag>(
"MuonCollection"));
32 thePATMuonCollectionLabel_ = consumes<edm::View<pat::Muon> > (
parameters.getParameter<
edm::InputTag>(
"patMuonCollection"));
35 triggerResultsToken_ = consumes<edm::TriggerResults>(
parameters.getUntrackedParameter<
edm::InputTag>(
"triggerResults"));
36 triggerObjects_ = consumes<std::vector<pat::TriggerObjectStandAlone>>(
parameters.getParameter<
edm::InputTag>(
"triggerObjects"));
38 triggerPathName1_ =
parameters.getParameter<
string>(
"triggerPathName1");
39 triggerHistName1_ =
parameters.getParameter<
string>(
"triggerHistName1");
40 triggerPtThresholdPath1_ =
parameters.getParameter<
double>(
"triggerPtThresholdPath1");
41 triggerPathName2_ =
parameters.getParameter<
string>(
"triggerPathName2");
42 triggerHistName2_ =
parameters.getParameter<
string>(
"triggerHistName2");
43 triggerPtThresholdPath2_ =
parameters.getParameter<
double>(
"triggerPtThresholdPath2");
44 theFolder =
parameters.getParameter<
string>(
"folder");
58 matchHists.push_back(ibooker.
book1D(
"DelR_HLT_"+triggerHistName1_+
"_v1",
"DeltaR_(offline,HLT)_triggerPass("+triggerHistName1_+
")", 500, 0.0, 0.5));
59 matchHists.push_back(ibooker.
book1D(
"DelR_HLT_"+triggerHistName1_+
"_v2",
"DeltaR_(offline,HLT)_triggerPass("+triggerHistName1_+
")", 100, 0.5, 1.5));
60 matchHists.push_back(ibooker.
book1D(
"PtRatio_HLT_"+triggerHistName1_,
"PtRatio_(HLTPt/OfflinePt)_"+triggerHistName1_, 200, -5., 5.0));
62 matchHists.push_back(ibooker.
book1D(
"DelR_L1_"+triggerHistName1_+
"_v1",
"DeltaR_(offline, L1)_triggerPass("+triggerHistName1_+
")", 500, 0.0, 1.0));
63 matchHists.push_back(ibooker.
book1D(
"DelR_L1_"+triggerHistName1_+
"_v2",
"DeltaR_(offline, L1)_triggerPass("+triggerHistName1_+
")", 500, 0.0, 2.0));
64 matchHists.push_back(ibooker.
book1D(
"PtRatio_L1_"+triggerHistName1_,
"PtRatio_(HLTPt/OfflinePt)_"+triggerHistName1_, 200, -5., 5.0));
66 matchHists.push_back(ibooker.
book1D(
"DelR_HLT_"+triggerHistName2_+
"_v1",
"DeltaR_(offline,HLT)_triggerPass("+triggerHistName2_+
")", 500, 0.0, 0.5));
67 matchHists.push_back(ibooker.
book1D(
"DelR_HLT_"+triggerHistName2_+
"_v2",
"DeltaR_(offline,HLT)_triggerPass("+triggerHistName2_+
")", 100, 0.5, 1.5));
68 matchHists.push_back(ibooker.
book1D(
"PtRatio_HLT_"+triggerHistName2_,
"PtRatio_(HLTPt/OfflinePt)_"+triggerHistName2_, 200, -5., 5.0));
70 matchHists.push_back(ibooker.
book1D(
"DelR_L1_"+triggerHistName2_+
"_v1",
"DeltaR_(offline, L1)_triggerPass("+triggerHistName2_+
")", 250, 0.0, 0.5));
71 matchHists.push_back(ibooker.
book1D(
"DelR_L1_"+triggerHistName2_+
"_v2",
"DeltaR_(offline, L1)_triggerPass("+triggerHistName2_+
")", 100, 0.5, 1.5));
72 matchHists.push_back(ibooker.
book1D(
"PtRatio_L1_"+triggerHistName2_,
"PtRatio_(HLTPt/OfflinePt)_"+triggerHistName2_, 200, -5., 5.0));
77 h_passHLTPath1_eta_Tight = ibooker.
book1D(
"passHLT"+triggerHistName1_+
"_eta_Tight",
" HLT("+triggerHistName1_+
") pass #eta", 8, -2.5, 2.5);
78 h_passHLTPath1_pt_Tight = ibooker.
book1D(
"passHLT"+triggerHistName1_+
"_pt_Tight",
" HLT("+triggerHistName1_+
") pass pt", 10, 20, 220);
79 h_passHLTPath1_phi_Tight = ibooker.
book1D(
"passHLT"+triggerHistName1_+
"_phi_Tight",
" HLT("+triggerHistName1_+
") pass phi", 8, -3.0, 3.0);
80 h_totalHLTPath1_eta_Tight = ibooker.
book1D(
"totalHLT"+triggerHistName1_+
"_eta_Tight",
" HLT("+triggerHistName1_+
") total #eta", 8, -2.5, 2.5);
81 h_totalHLTPath1_pt_Tight = ibooker.
book1D(
"totalHLT"+triggerHistName1_+
"_pt_Tight",
" HLT("+triggerHistName1_+
") total pt", 10, 20., 220);
82 h_totalHLTPath1_phi_Tight = ibooker.
book1D(
"totalHLT"+triggerHistName1_+
"_phi_Tight",
" HLT("+triggerHistName1_+
") total phi", 8, -3.0, 3.0);
84 h_passHLTPath2_eta_Tight = ibooker.
book1D(
"passHLT"+triggerHistName2_+
"_eta_Tight",
" HLT("+triggerHistName2_+
") pass #eta", 8, -2.5, 2.5);
85 h_passHLTPath2_pt_Tight = ibooker.
book1D(
"passHLT"+triggerHistName2_+
"_pt_Tight",
" HLT("+triggerHistName2_+
") pass pt", 10, 20., 220);
86 h_passHLTPath2_phi_Tight = ibooker.
book1D(
"passHLT"+triggerHistName2_+
"_phi_Tight",
" HLT("+triggerHistName2_+
") pass phi", 8, -3.0, 3.0);
87 h_totalHLTPath2_eta_Tight = ibooker.
book1D(
"totalHLT"+triggerHistName2_+
"_eta_Tight",
" HLT("+triggerHistName2_+
") total #eta", 8, -2.5, 2.5);
88 h_totalHLTPath2_pt_Tight = ibooker.
book1D(
"totalHLT"+triggerHistName2_+
"_pt_Tight",
" HLT("+triggerHistName2_+
") total pt", 10, 20, 220);
89 h_totalHLTPath2_phi_Tight = ibooker.
book1D(
"totalHLT"+triggerHistName2_+
"_phi_Tight",
" HLT("+triggerHistName2_+
") total phi", 8, -3.0, 3.0);
95 LogTrace(
metname)<<
"[TriggerMatchMonitor] Analyze the mu in different eta regions";
96 theService->update(iSetup);
99 iEvent.
getByToken(theMuonCollectionLabel_,muons);
102 iEvent.
getByToken(thePATMuonCollectionLabel_,PATmuons);
105 iEvent.
getByToken(triggerObjects_, triggerObjects);
108 iEvent.
getByToken(triggerResultsToken_, triggerResults);
113 iEvent.
getByToken(primaryVerticesToken_,recVtxs);
114 unsigned int theIndexOfThePrimaryVertex = 999.;
115 for (
unsigned int ind = 0; ind < recVtxs->size(); ++ind) {
116 if ( (*recVtxs)[ind].isValid() && !((*recVtxs)[ind].isFake()) ) {
117 theIndexOfThePrimaryVertex = ind;
121 if (theIndexOfThePrimaryVertex<100) {
122 posVtx = ((*recVtxs)[theIndexOfThePrimaryVertex]).
position();
123 errVtx = ((*recVtxs)[theIndexOfThePrimaryVertex]).
error();
126 LogInfo(
"RecoMuonValidator") <<
"reco::PrimaryVertex not found, use BeamSpot position instead\n";
128 iEvent.
getByToken(beamSpotToken_,recoBeamSpotHandle);
133 errVtx(2,2) = bs.
sigmaZ();
138 for(
const auto & patMuon : *PATmuons){
139 bool Isolated=patMuon.pfIsolationR04().sumChargedHadronPt +
TMath::Max(0., patMuon.pfIsolationR04().sumNeutralHadronEt + patMuon.pfIsolationR04().sumPhotonEt - 0.5*patMuon.pfIsolationR04().sumPUPt) / patMuon.pt() < 0.25;
141 if(patMuon.isGlobalMuon() && Isolated && patMuon.isTightMuon(thePrimaryVertex)){
143 TLorentzVector offlineMuon;
144 offlineMuon.SetPtEtaPhiM(patMuon.pt(), patMuon.eta(), patMuon.phi(),0.0);
146 const char *ptrmuPath1 = triggerPathName1_.c_str();
147 const char *ptrmuPath2 = triggerPathName2_.c_str();
148 if(patMuon.pt() > triggerPtThresholdPath1_){
149 h_totalHLTPath1_eta_Tight->Fill(patMuon.eta());
150 h_totalHLTPath1_pt_Tight->Fill(patMuon.pt());
151 h_totalHLTPath1_phi_Tight->Fill(patMuon.phi());
153 if(patMuon.pt() > triggerPtThresholdPath2_){
154 h_totalHLTPath2_eta_Tight->Fill(patMuon.eta());
155 h_totalHLTPath2_pt_Tight->Fill(patMuon.pt());
156 h_totalHLTPath2_phi_Tight->Fill(patMuon.phi());
158 if(patMuon.triggered(ptrmuPath1) && patMuon.hltObject() !=
nullptr){
159 TLorentzVector hltMuon;
160 hltMuon.SetPtEtaPhiM(patMuon.hltObject()->pt(),patMuon.hltObject()->eta(),patMuon.hltObject()->phi(),0.0);
161 double DelRrecoHLT=offlineMuon.DeltaR(hltMuon);
163 matchHists[0]->Fill(DelRrecoHLT);
164 matchHists[1]->Fill(DelRrecoHLT);
165 matchHists[2]->Fill(patMuon.hltObject()->pt()/patMuon.pt());
166 if(DelRrecoHLT<0.2 && patMuon.pt() > triggerPtThresholdPath1_){
167 h_passHLTPath1_eta_Tight->Fill(patMuon.eta());
168 h_passHLTPath1_pt_Tight->Fill(patMuon.pt());
169 h_passHLTPath1_phi_Tight->Fill(patMuon.phi());
171 if(patMuon.l1Object() !=
nullptr){
172 TLorentzVector L1Muon;
173 L1Muon.SetPtEtaPhiM(patMuon.l1Object()->pt(),patMuon.l1Object()->eta(),patMuon.l1Object()->phi(),0.0);
174 double DelRrecoL1=offlineMuon.DeltaR(L1Muon);
175 matchHists[3]->Fill(DelRrecoL1);
176 matchHists[4]->Fill(DelRrecoL1);
177 matchHists[5]->Fill(patMuon.l1Object()->pt()/patMuon.pt());
183 if(patMuon.triggered(ptrmuPath2)){
184 TLorentzVector hltMuon50;
185 hltMuon50.SetPtEtaPhiM(patMuon.hltObject()->pt(),patMuon.hltObject()->eta(),patMuon.hltObject()->phi(),0.0);
186 double DelRrecoHLT50=offlineMuon.DeltaR(hltMuon50);
188 matchHists[6]->Fill(DelRrecoHLT50);
189 matchHists[7]->Fill(DelRrecoHLT50);
190 matchHists[8]->Fill(patMuon.hltObject()->pt()/patMuon.pt());
191 if(DelRrecoHLT50<0.2 && patMuon.pt() > triggerPtThresholdPath2_ ){
192 h_passHLTPath2_eta_Tight->Fill(patMuon.eta());
193 h_passHLTPath2_pt_Tight->Fill(patMuon.pt());
194 h_passHLTPath2_phi_Tight->Fill(patMuon.phi());
198 if(patMuon.l1Object() !=
nullptr){
199 TLorentzVector L1Muon50;
200 L1Muon50.SetPtEtaPhiM(patMuon.l1Object()->pt(),patMuon.l1Object()->eta(),patMuon.l1Object()->phi(),0.0);
201 double DelRrecoL150=offlineMuon.DeltaR(L1Muon50);
202 matchHists[9]->Fill(DelRrecoL150);
203 matchHists[10]->Fill(DelRrecoL150);
204 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.