20 #include "TLorentzVector.h" 44 theMuonCollectionLabel_ = consumes<edm::View<reco::Muon> > (
parameters.getParameter<
edm::InputTag>(
"MuonCollection"));
50 etaBBin =
parameters.getParameter<
int>(
"etaBBin");
51 etaEBin =
parameters.getParameter<
int>(
"etaEBin");
53 etaBMin =
parameters.getParameter<
double>(
"etaBMin");
54 etaBMax =
parameters.getParameter<
double>(
"etaBMax");
55 etaECMin =
parameters.getParameter<
double>(
"etaECMin");
56 etaECMax =
parameters.getParameter<
double>(
"etaECMax");
58 LowMassMin =
parameters.getParameter<
double>(
"LowMassMin");
59 LowMassMax =
parameters.getParameter<
double>(
"LowMassMax");
60 HighMassMin =
parameters.getParameter<
double>(
"HighMassMin");
61 HighMassMax =
parameters.getParameter<
double>(
"HighMassMax");
63 theFolder =
parameters.getParameter<
string>(
"folder");
75 int nBin[3] = {
etaBin,etaBBin,etaEBin};
76 EtaName[0] =
""; EtaName[1] =
"_Barrel"; EtaName[2] =
"_EndCap";
77 test = ibooker.
book1D(
"test",
"InvMass_{Tight,Tight}",100, 0., 200.);
78 for (
unsigned int iEtaRegion=0; iEtaRegion<3; iEtaRegion++){
80 GlbGlbMuon_LM.push_back(ibooker.
book1D(
"GlbGlbMuon_LM"+EtaName[iEtaRegion],
"InvMass_{GLB,GLB}"+EtaName[iEtaRegion],nBin[iEtaRegion], LowMassMin, LowMassMax));
81 TrkTrkMuon_LM.push_back(ibooker.
book1D(
"TrkTrkMuon_LM"+EtaName[iEtaRegion],
"InvMass_{TRK,TRK}"+EtaName[iEtaRegion],nBin[iEtaRegion], LowMassMin, LowMassMax));
82 StaTrkMuon_LM.push_back(ibooker.
book1D(
"StaTrkMuon_LM"+EtaName[iEtaRegion],
"InvMass_{STA,TRK}"+EtaName[iEtaRegion],nBin[iEtaRegion], LowMassMin, LowMassMax));
84 GlbGlbMuon_HM.push_back(ibooker.
book1D(
"GlbGlbMuon_HM"+EtaName[iEtaRegion],
"InvMass_{GLB,GLB}"+EtaName[iEtaRegion],nBin[iEtaRegion], HighMassMin, HighMassMax));
85 TrkTrkMuon_HM.push_back(ibooker.
book1D(
"TrkTrkMuon_HM"+EtaName[iEtaRegion],
"InvMass_{TRK,TRK}"+EtaName[iEtaRegion],nBin[iEtaRegion], HighMassMin, HighMassMax));
86 StaTrkMuon_HM.push_back(ibooker.
book1D(
"StaTrkMuon_HM"+EtaName[iEtaRegion],
"InvMass_{STA,TRK}"+EtaName[iEtaRegion],nBin[iEtaRegion], HighMassMin, HighMassMax));
89 TightTightMuon.push_back(ibooker.
book1D(
"TightTightMuon"+EtaName[iEtaRegion],
"InvMass_{Tight,Tight}"+EtaName[iEtaRegion], nBin[iEtaRegion], LowMassMin, LowMassMax));
90 MediumMediumMuon.push_back(ibooker.
book1D(
"MediumMediumMuon"+EtaName[iEtaRegion],
"InvMass_{Medium,Medium}"+EtaName[iEtaRegion],nBin[iEtaRegion], LowMassMin, LowMassMax));
91 LooseLooseMuon.push_back(ibooker.
book1D(
"LooseLooseMuon"+EtaName[iEtaRegion],
"InvMass_{Loose,Loose}"+EtaName[iEtaRegion], nBin[iEtaRegion], LowMassMin, LowMassMax));
93 TightTightMuonBadFrac.push_back(ibooker.
book1D(
"TightTightMuonBadFrac"+EtaName[iEtaRegion],
"BadFrac_{Tight,Tight}"+EtaName[iEtaRegion], 10, 0, 0.4));
94 MediumMediumMuonBadFrac.push_back(ibooker.
book1D(
"MediumMediumMuonBadFrac"+EtaName[iEtaRegion],
"BadFrac_{Medium,Medium}"+EtaName[iEtaRegion], 10, 0, 0.4));
95 LooseLooseMuonBadFrac.push_back(ibooker.
book1D(
"LooseLooseMuonBadFrac"+EtaName[iEtaRegion],
"BadFrac_{Loose,Loose}"+EtaName[iEtaRegion], 10, 0, 0.4));
98 SoftSoftMuon.push_back(ibooker.
book1D(
"SoftSoftMuon"+EtaName[iEtaRegion],
"InvMass_{Soft,Soft}"+EtaName[iEtaRegion],nBin[iEtaRegion], 0.0, 55.0));
99 SoftSoftMuonBadFrac.push_back(ibooker.
book1D(
"SoftSoftMuonBadFrac"+EtaName[iEtaRegion],
"BadFrac_{Soft,Soft}"+EtaName[iEtaRegion], 10, 0, 0.4));
106 LogTrace(
metname)<<
"[DiMuonHistograms] Analyze the mu in different eta regions";
108 iEvent.
getByToken(theMuonCollectionLabel_, muons);
114 unsigned int theIndexOfThePrimaryVertex = 999.;
119 for (
unsigned int ind=0; ind<vertex->size(); ++ind) {
120 if ( (*vertex)[ind].isValid() && !((*vertex)[ind].isFake()) ) {
121 theIndexOfThePrimaryVertex = ind;
127 if (theIndexOfThePrimaryVertex<100) {
128 posVtx = ((*vertex)[theIndexOfThePrimaryVertex]).
position();
129 errVtx = ((*vertex)[theIndexOfThePrimaryVertex]).
error();
132 LogInfo(
"RecoMuonValidator") <<
"reco::PrimaryVertex not found, use BeamSpot position instead\n";
135 iEvent.
getByToken(theBeamSpotLabel_,recoBeamSpotHandle);
141 errVtx(2,2) = bs.
sigmaZ();
149 TLorentzVector Mu1, Mu2;
151 float InvMass = -99.;
154 double EtaCutMin[] = {0, etaBMin, etaECMin};
155 double EtaCutMax[] = {2.4, etaBMax, etaECMax};
163 if (muon1==muon2)
continue;
166 if (muon1->isGlobalMuon() && muon2->isGlobalMuon()) {
170 Mu1.SetPxPyPzE(recoCombinedGlbTrack1->px(), recoCombinedGlbTrack1->py(),recoCombinedGlbTrack1->pz(), recoCombinedGlbTrack1->p());
171 Mu2.SetPxPyPzE(recoCombinedGlbTrack2->px(), recoCombinedGlbTrack2->py(),recoCombinedGlbTrack2->pz(), recoCombinedGlbTrack2->p());
173 charge = recoCombinedGlbTrack1->charge()*recoCombinedGlbTrack2->charge();
175 InvMass = (Mu1+Mu2).M();
176 for (
unsigned int iEtaRegion=0; iEtaRegion<3; iEtaRegion++){
177 if(fabs(recoCombinedGlbTrack1->eta())>EtaCutMin[iEtaRegion] && fabs(recoCombinedGlbTrack1->eta())<EtaCutMax[iEtaRegion] &&
178 fabs(recoCombinedGlbTrack2->eta())>EtaCutMin[iEtaRegion] && fabs(recoCombinedGlbTrack2->eta())<EtaCutMax[iEtaRegion]){
179 if (InvMass < LowMassMax) GlbGlbMuon_LM[iEtaRegion]->Fill(InvMass);
180 if (InvMass > HighMassMin) GlbGlbMuon_HM[iEtaRegion]->Fill(InvMass);
190 for (
unsigned int iEtaRegion=0; iEtaRegion<3; iEtaRegion++){
191 if(fabs(recoCombinedGlbTrack1->eta())>EtaCutMin[iEtaRegion] && fabs(recoCombinedGlbTrack1->eta())<EtaCutMax[iEtaRegion] &&
192 fabs(recoCombinedGlbTrack2->eta())>EtaCutMin[iEtaRegion] && fabs(recoCombinedGlbTrack2->eta())<EtaCutMax[iEtaRegion]){
193 if (InvMass > 55. && InvMass < 125.) {
194 TightTightMuon[iEtaRegion]->Fill(InvMass);
195 TightTightMuonBadFrac[iEtaRegion]->Fill(muon1->innerTrack()->lost()/muon1->innerTrack()->found());
207 for (
unsigned int iEtaRegion=0; iEtaRegion<3; iEtaRegion++){
208 if(fabs(recoCombinedGlbTrack1->eta())>EtaCutMin[iEtaRegion] && fabs(recoCombinedGlbTrack1->eta())<EtaCutMax[iEtaRegion] &&
209 fabs(recoCombinedGlbTrack2->eta())>EtaCutMin[iEtaRegion] && fabs(recoCombinedGlbTrack2->eta())<EtaCutMax[iEtaRegion]){
210 if (InvMass > 55. && InvMass < 125.) {
211 MediumMediumMuon[iEtaRegion]->Fill(InvMass);
212 MediumMediumMuonBadFrac[iEtaRegion]->Fill(muon1->innerTrack()->lost()/muon1->innerTrack()->found());
224 for (
unsigned int iEtaRegion=0; iEtaRegion<3; iEtaRegion++){
225 if(fabs(recoCombinedGlbTrack1->eta())>EtaCutMin[iEtaRegion] && fabs(recoCombinedGlbTrack1->eta())<EtaCutMax[iEtaRegion] &&
226 fabs(recoCombinedGlbTrack2->eta())>EtaCutMin[iEtaRegion] && fabs(recoCombinedGlbTrack2->eta())<EtaCutMax[iEtaRegion]){
227 if (InvMass > 55. && InvMass < 125.) {
228 LooseLooseMuon[iEtaRegion]->Fill(InvMass);
229 LooseLooseMuonBadFrac[iEtaRegion]->Fill(muon1->innerTrack()->lost()/muon1->innerTrack()->found());
238 if (muon2->isStandAloneMuon() && muon1->isTrackerMuon()) {
242 Mu2.SetPxPyPzE(recoStaTrack->px(), recoStaTrack->py(),recoStaTrack->pz(), recoStaTrack->p());
243 Mu1.SetPxPyPzE(recoTrack->px(), recoTrack->py(),recoTrack->pz(), recoTrack->p());
245 charge = recoStaTrack->charge()*recoTrack->charge();
247 InvMass = (Mu1+Mu2).M();
248 for (
unsigned int iEtaRegion=0; iEtaRegion<3; iEtaRegion++){
249 if(fabs(recoStaTrack->eta())>EtaCutMin[iEtaRegion] && fabs(recoStaTrack->eta())<EtaCutMax[iEtaRegion] &&
250 fabs(recoTrack->eta())>EtaCutMin[iEtaRegion] && fabs(recoTrack->eta())<EtaCutMax[iEtaRegion]){
251 if (InvMass < LowMassMax) StaTrkMuon_LM[iEtaRegion]->Fill(InvMass);
252 if (InvMass > HighMassMin) StaTrkMuon_HM[iEtaRegion]->Fill(InvMass);
257 if (muon1->isStandAloneMuon() && muon2->isTrackerMuon()) {
261 Mu1.SetPxPyPzE(recoStaTrack->px(), recoStaTrack->py(),recoStaTrack->pz(), recoStaTrack->p());
262 Mu2.SetPxPyPzE(recoTrack->px(), recoTrack->py(),recoTrack->pz(), recoTrack->p());
264 charge = recoStaTrack->charge()*recoTrack->charge();
266 InvMass = (Mu1+Mu2).M();
267 for (
unsigned int iEtaRegion=0; iEtaRegion<3; iEtaRegion++){
268 if(fabs(recoStaTrack->eta())>EtaCutMin[iEtaRegion] && fabs(recoStaTrack->eta())<EtaCutMax[iEtaRegion] &&
269 fabs(recoTrack->eta())>EtaCutMin[iEtaRegion] && fabs(recoTrack->eta())<EtaCutMax[iEtaRegion]){
270 if (InvMass < LowMassMax) StaTrkMuon_LM[iEtaRegion]->Fill(InvMass);
271 if (InvMass > HighMassMin) StaTrkMuon_HM[iEtaRegion]->Fill(InvMass);
278 if (muon1->isTrackerMuon() && muon2->isTrackerMuon()) {
282 Mu2.SetPxPyPzE(recoTrack2->px(), recoTrack2->py(),recoTrack2->pz(), recoTrack2->p());
283 Mu1.SetPxPyPzE(recoTrack1->px(), recoTrack1->py(),recoTrack1->pz(), recoTrack1->p());
285 charge = recoTrack1->charge()*recoTrack2->charge();
287 InvMass = (Mu1+Mu2).M();
288 for (
unsigned int iEtaRegion=0; iEtaRegion<3; iEtaRegion++){
289 if(fabs(recoTrack1->eta())>EtaCutMin[iEtaRegion] && fabs(recoTrack1->eta())<EtaCutMax[iEtaRegion] &&
290 fabs(recoTrack2->eta())>EtaCutMin[iEtaRegion] && fabs(recoTrack2->eta())<EtaCutMax[iEtaRegion]){
291 if (InvMass < LowMassMax) TrkTrkMuon_LM[iEtaRegion]->Fill(InvMass);
292 if (InvMass > HighMassMin) TrkTrkMuon_HM[iEtaRegion]->Fill(InvMass);
304 InvMass = (Mu1+Mu2).M();
305 for (
unsigned int iEtaRegion=0; iEtaRegion<3; iEtaRegion++){
307 if(fabs(recoTrack1->eta())>EtaCutMin[iEtaRegion] && fabs(recoTrack1->eta())<EtaCutMax[iEtaRegion] &&
308 fabs(recoTrack2->eta())>EtaCutMin[iEtaRegion] && fabs(recoTrack2->eta())<EtaCutMax[iEtaRegion]){
309 SoftSoftMuon[iEtaRegion]->Fill(InvMass);
310 SoftSoftMuonBadFrac[iEtaRegion]->Fill(muon1->innerTrack()->lost()/muon1->innerTrack()->found());
~DiMuonHistograms() override
void analyze(const edm::Event &, const edm::EventSetup &) override
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 &)
void setCurrentFolder(std::string const &fullpath)
MonitorElement * book1D(Args &&...args)
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)
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 &)