19 #include "TLorentzVector.h"
42 theMuonCollectionLabel_ = consumes<edm::View<reco::Muon> >(
parameters.getParameter<
edm::InputTag>(
"MuonCollection"));
51 etaBMin =
parameters.getParameter<
double>(
"etaBMin");
52 etaBMax =
parameters.getParameter<
double>(
"etaBMax");
53 etaECMin =
parameters.getParameter<
double>(
"etaECMin");
54 etaECMax =
parameters.getParameter<
double>(
"etaECMax");
61 theFolder =
parameters.getParameter<
string>(
"folder");
74 EtaName[1] =
"_Barrel";
75 EtaName[2] =
"_EndCap";
76 test = ibooker.
book1D(
"test",
"InvMass_{Tight,Tight}", 100, 0., 200.);
77 for (
unsigned int iEtaRegion = 0; iEtaRegion < 3; iEtaRegion++) {
78 GlbGlbMuon_LM.push_back(ibooker.
book1D(
"GlbGlbMuon_LM" + EtaName[iEtaRegion],
79 "InvMass_{GLB,GLB}" + EtaName[iEtaRegion],
83 TrkTrkMuon_LM.push_back(ibooker.
book1D(
"TrkTrkMuon_LM" + EtaName[iEtaRegion],
84 "InvMass_{TRK,TRK}" + EtaName[iEtaRegion],
88 StaTrkMuon_LM.push_back(ibooker.
book1D(
"StaTrkMuon_LM" + EtaName[iEtaRegion],
89 "InvMass_{STA,TRK}" + EtaName[iEtaRegion],
94 GlbGlbMuon_HM.push_back(ibooker.
book1D(
"GlbGlbMuon_HM" + EtaName[iEtaRegion],
95 "InvMass_{GLB,GLB}" + EtaName[iEtaRegion],
99 TrkTrkMuon_HM.push_back(ibooker.
book1D(
"TrkTrkMuon_HM" + EtaName[iEtaRegion],
100 "InvMass_{TRK,TRK}" + EtaName[iEtaRegion],
104 StaTrkMuon_HM.push_back(ibooker.
book1D(
"StaTrkMuon_HM" + EtaName[iEtaRegion],
105 "InvMass_{STA,TRK}" + EtaName[iEtaRegion],
111 TightTightMuon.push_back(ibooker.
book1D(
"TightTightMuon" + EtaName[iEtaRegion],
112 "InvMass_{Tight,Tight}" + EtaName[iEtaRegion],
116 MediumMediumMuon.push_back(ibooker.
book1D(
"MediumMediumMuon" + EtaName[iEtaRegion],
117 "InvMass_{Medium,Medium}" + EtaName[iEtaRegion],
121 LooseLooseMuon.push_back(ibooker.
book1D(
"LooseLooseMuon" + EtaName[iEtaRegion],
122 "InvMass_{Loose,Loose}" + EtaName[iEtaRegion],
127 TightTightMuonBadFrac.push_back(ibooker.
book1D(
128 "TightTightMuonBadFrac" + EtaName[iEtaRegion],
"BadFrac_{Tight,Tight}" + EtaName[iEtaRegion], 10, 0, 0.4));
129 MediumMediumMuonBadFrac.push_back(ibooker.
book1D(
130 "MediumMediumMuonBadFrac" + EtaName[iEtaRegion],
"BadFrac_{Medium,Medium}" + EtaName[iEtaRegion], 10, 0, 0.4));
131 LooseLooseMuonBadFrac.push_back(ibooker.
book1D(
132 "LooseLooseMuonBadFrac" + EtaName[iEtaRegion],
"BadFrac_{Loose,Loose}" + EtaName[iEtaRegion], 10, 0, 0.4));
135 SoftSoftMuon.push_back(ibooker.
book1D(
136 "SoftSoftMuon" + EtaName[iEtaRegion],
"InvMass_{Soft,Soft}" + EtaName[iEtaRegion], nBin[iEtaRegion], 0.0, 55.0));
137 SoftSoftMuonBadFrac.push_back(ibooker.
book1D(
138 "SoftSoftMuonBadFrac" + EtaName[iEtaRegion],
"BadFrac_{Soft,Soft}" + EtaName[iEtaRegion], 10, 0, 0.4));
143 LogTrace(
metname) <<
"[DiMuonHistograms] Analyze the mu in different eta regions";
145 iEvent.
getByToken(theMuonCollectionLabel_, muons);
151 unsigned int theIndexOfThePrimaryVertex = 999.;
156 for (
unsigned int ind = 0; ind < vertex->size(); ++ind) {
157 if ((*vertex)[ind].isValid() && !((*vertex)[ind].isFake())) {
158 theIndexOfThePrimaryVertex = ind;
164 if (theIndexOfThePrimaryVertex < 100) {
165 posVtx = ((*vertex)[theIndexOfThePrimaryVertex]).
position();
166 errVtx = ((*vertex)[theIndexOfThePrimaryVertex]).
error();
168 LogInfo(
"RecoMuonValidator") <<
"reco::PrimaryVertex not found, use BeamSpot position instead\n";
171 iEvent.
getByToken(theBeamSpotLabel_, recoBeamSpotHandle);
177 errVtx(2, 2) = bs.
sigmaZ();
186 TLorentzVector Mu1, Mu2;
188 float InvMass = -99.;
191 double EtaCutMin[] = {0, etaBMin, etaECMin};
192 double EtaCutMax[] = {2.4, etaBMax, etaECMax};
204 if (muon1->isGlobalMuon() && muon2->isGlobalMuon()) {
208 Mu1.SetPxPyPzE(recoCombinedGlbTrack1->px(),
209 recoCombinedGlbTrack1->py(),
210 recoCombinedGlbTrack1->pz(),
211 recoCombinedGlbTrack1->p());
212 Mu2.SetPxPyPzE(recoCombinedGlbTrack2->px(),
213 recoCombinedGlbTrack2->py(),
214 recoCombinedGlbTrack2->pz(),
215 recoCombinedGlbTrack2->p());
217 charge = recoCombinedGlbTrack1->charge() * recoCombinedGlbTrack2->charge();
219 InvMass = (Mu1 + Mu2).M();
220 for (
unsigned int iEtaRegion = 0; iEtaRegion < 3; iEtaRegion++) {
221 if (fabs(recoCombinedGlbTrack1->eta()) > EtaCutMin[iEtaRegion] &&
222 fabs(recoCombinedGlbTrack1->eta()) < EtaCutMax[iEtaRegion] &&
223 fabs(recoCombinedGlbTrack2->eta()) > EtaCutMin[iEtaRegion] &&
224 fabs(recoCombinedGlbTrack2->eta()) < EtaCutMax[iEtaRegion]) {
226 GlbGlbMuon_LM[iEtaRegion]->Fill(InvMass);
228 GlbGlbMuon_HM[iEtaRegion]->Fill(InvMass);
237 for (
unsigned int iEtaRegion = 0; iEtaRegion < 3; iEtaRegion++) {
238 if (fabs(recoCombinedGlbTrack1->eta()) > EtaCutMin[iEtaRegion] &&
239 fabs(recoCombinedGlbTrack1->eta()) < EtaCutMax[iEtaRegion] &&
240 fabs(recoCombinedGlbTrack2->eta()) > EtaCutMin[iEtaRegion] &&
241 fabs(recoCombinedGlbTrack2->eta()) < EtaCutMax[iEtaRegion]) {
242 if (InvMass > 55. && InvMass < 125.) {
243 TightTightMuon[iEtaRegion]->Fill(InvMass);
244 TightTightMuonBadFrac[iEtaRegion]->Fill(muon1->innerTrack()->lost() / muon1->innerTrack()->found());
255 for (
unsigned int iEtaRegion = 0; iEtaRegion < 3; iEtaRegion++) {
256 if (fabs(recoCombinedGlbTrack1->eta()) > EtaCutMin[iEtaRegion] &&
257 fabs(recoCombinedGlbTrack1->eta()) < EtaCutMax[iEtaRegion] &&
258 fabs(recoCombinedGlbTrack2->eta()) > EtaCutMin[iEtaRegion] &&
259 fabs(recoCombinedGlbTrack2->eta()) < EtaCutMax[iEtaRegion]) {
260 if (InvMass > 55. && InvMass < 125.) {
261 MediumMediumMuon[iEtaRegion]->Fill(InvMass);
262 MediumMediumMuonBadFrac[iEtaRegion]->Fill(muon1->innerTrack()->lost() / muon1->innerTrack()->found());
273 for (
unsigned int iEtaRegion = 0; iEtaRegion < 3; iEtaRegion++) {
274 if (fabs(recoCombinedGlbTrack1->eta()) > EtaCutMin[iEtaRegion] &&
275 fabs(recoCombinedGlbTrack1->eta()) < EtaCutMax[iEtaRegion] &&
276 fabs(recoCombinedGlbTrack2->eta()) > EtaCutMin[iEtaRegion] &&
277 fabs(recoCombinedGlbTrack2->eta()) < EtaCutMax[iEtaRegion]) {
278 if (InvMass > 55. && InvMass < 125.) {
279 LooseLooseMuon[iEtaRegion]->Fill(InvMass);
280 LooseLooseMuonBadFrac[iEtaRegion]->Fill(muon1->innerTrack()->lost() / muon1->innerTrack()->found());
289 if (muon2->isStandAloneMuon() && muon1->isTrackerMuon()) {
293 Mu2.SetPxPyPzE(recoStaTrack->px(), recoStaTrack->py(), recoStaTrack->pz(), recoStaTrack->p());
294 Mu1.SetPxPyPzE(recoTrack->px(), recoTrack->py(), recoTrack->pz(), recoTrack->p());
296 charge = recoStaTrack->charge() * recoTrack->charge();
298 InvMass = (Mu1 + Mu2).M();
299 for (
unsigned int iEtaRegion = 0; iEtaRegion < 3; iEtaRegion++) {
300 if (fabs(recoStaTrack->eta()) > EtaCutMin[iEtaRegion] &&
301 fabs(recoStaTrack->eta()) < EtaCutMax[iEtaRegion] && fabs(recoTrack->eta()) > EtaCutMin[iEtaRegion] &&
302 fabs(recoTrack->eta()) < EtaCutMax[iEtaRegion]) {
304 StaTrkMuon_LM[iEtaRegion]->Fill(InvMass);
306 StaTrkMuon_HM[iEtaRegion]->Fill(InvMass);
311 if (muon1->isStandAloneMuon() && muon2->isTrackerMuon()) {
315 Mu1.SetPxPyPzE(recoStaTrack->px(), recoStaTrack->py(), recoStaTrack->pz(), recoStaTrack->p());
316 Mu2.SetPxPyPzE(recoTrack->px(), recoTrack->py(), recoTrack->pz(), recoTrack->p());
318 charge = recoStaTrack->charge() * recoTrack->charge();
320 InvMass = (Mu1 + Mu2).M();
321 for (
unsigned int iEtaRegion = 0; iEtaRegion < 3; iEtaRegion++) {
322 if (fabs(recoStaTrack->eta()) > EtaCutMin[iEtaRegion] &&
323 fabs(recoStaTrack->eta()) < EtaCutMax[iEtaRegion] && fabs(recoTrack->eta()) > EtaCutMin[iEtaRegion] &&
324 fabs(recoTrack->eta()) < EtaCutMax[iEtaRegion]) {
326 StaTrkMuon_LM[iEtaRegion]->Fill(InvMass);
328 StaTrkMuon_HM[iEtaRegion]->Fill(InvMass);
335 if (muon1->isTrackerMuon() && muon2->isTrackerMuon()) {
339 Mu2.SetPxPyPzE(recoTrack2->px(), recoTrack2->py(), recoTrack2->pz(), recoTrack2->p());
340 Mu1.SetPxPyPzE(recoTrack1->px(), recoTrack1->py(), recoTrack1->pz(), recoTrack1->p());
342 charge = recoTrack1->charge() * recoTrack2->charge();
344 InvMass = (Mu1 + Mu2).M();
345 for (
unsigned int iEtaRegion = 0; iEtaRegion < 3; iEtaRegion++) {
346 if (fabs(recoTrack1->eta()) > EtaCutMin[iEtaRegion] && fabs(recoTrack1->eta()) < EtaCutMax[iEtaRegion] &&
347 fabs(recoTrack2->eta()) > EtaCutMin[iEtaRegion] && fabs(recoTrack2->eta()) < EtaCutMax[iEtaRegion]) {
349 TrkTrkMuon_LM[iEtaRegion]->Fill(InvMass);
351 TrkTrkMuon_HM[iEtaRegion]->Fill(InvMass);
360 InvMass = (Mu1 + Mu2).M();
361 for (
unsigned int iEtaRegion = 0; iEtaRegion < 3; iEtaRegion++) {
362 if (fabs(recoTrack1->eta()) > EtaCutMin[iEtaRegion] && fabs(recoTrack1->eta()) < EtaCutMax[iEtaRegion] &&
363 fabs(recoTrack2->eta()) > EtaCutMin[iEtaRegion] && fabs(recoTrack2->eta()) < EtaCutMax[iEtaRegion]) {
364 SoftSoftMuon[iEtaRegion]->Fill(InvMass);
365 SoftSoftMuonBadFrac[iEtaRegion]->Fill(muon1->innerTrack()->lost() / muon1->innerTrack()->found());
~DiMuonHistograms() override
void analyze(const edm::Event &, const edm::EventSetup &) override
virtual void setCurrentFolder(std::string const &fullpath)
bool isMediumMuon(const reco::Muon &, bool run2016_hip_mitigation=false)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
const std::string metname
math::Error< dimension >::type Error
covariance error matrix (3x3)
bool isLooseMuon(const reco::Muon &)
math::XYZPoint Point
point in the space
double BeamWidthX() const
beam width X
DiMuonHistograms(const edm::ParameterSet &pset)
bool isSoftMuon(const reco::Muon &, const reco::Vertex &, bool run2016_hip_mitigation=false)
Log< level::Info, false > LogInfo
double sigmaZ() const
sigma z
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
double BeamWidthY() const
beam width Y
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
static int position[264][3]
const Point & position() const
position
bool isTightMuon(const reco::Muon &, const reco::Vertex &)
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
int etaBin(const l1t::HGCalMulticluster *cl)