20 #include "TLorentzVector.h"
39 theMuonCollectionLabel_ = consumes<reco::MuonCollection> (
parameters.getParameter<
edm::InputTag>(
"MuonCollection"));
43 etaBin =
parameters.getParameter<
int>(
"etaBin");
44 etaBBin =
parameters.getParameter<
int>(
"etaBBin");
45 etaEBin =
parameters.getParameter<
int>(
"etaEBin");
47 etaBMin =
parameters.getParameter<
double>(
"etaBMin");
48 etaBMax =
parameters.getParameter<
double>(
"etaBMax");
49 etaECMin =
parameters.getParameter<
double>(
"etaECMin");
50 etaECMax =
parameters.getParameter<
double>(
"etaECMax");
52 LowMassMin =
parameters.getParameter<
double>(
"LowMassMin");
53 LowMassMax =
parameters.getParameter<
double>(
"LowMassMax");
54 HighMassMin =
parameters.getParameter<
double>(
"HighMassMin");
55 HighMassMax =
parameters.getParameter<
double>(
"HighMassMax");
69 for (
unsigned int iEtaRegion=0; iEtaRegion<3; iEtaRegion++){
70 if (iEtaRegion==0) { EtaName =
""; nBin = etaBin;}
71 if (iEtaRegion==1) { EtaName =
"_Barrel"; nBin = etaBBin;}
72 if (iEtaRegion==2) { EtaName =
"_EndCap"; nBin = etaEBin;}
74 GlbGlbMuon_LM.push_back(ibooker.
book1D(
"GlbGlbMuon_LM"+EtaName,
"InvMass_{GLB,GLB}"+EtaName,nBin, LowMassMin, LowMassMax));
75 TrkTrkMuon_LM.push_back(ibooker.
book1D(
"TrkTrkMuon_LM"+EtaName,
"InvMass_{TRK,TRK}"+EtaName,nBin, LowMassMin, LowMassMax));
76 StaTrkMuon_LM.push_back(ibooker.
book1D(
"StaTrkMuon_LM"+EtaName,
"InvMass_{STA,TRK}"+EtaName,nBin, LowMassMin, LowMassMax));
78 GlbGlbMuon_HM.push_back(ibooker.
book1D(
"GlbGlbMuon_HM"+EtaName,
"InvMass_{GLB,GLB}"+EtaName,nBin, HighMassMin, HighMassMax));
79 TrkTrkMuon_HM.push_back(ibooker.
book1D(
"TrkTrkMuon_HM"+EtaName,
"InvMass_{TRK,TRK}"+EtaName,nBin, HighMassMin, HighMassMax));
80 StaTrkMuon_HM.push_back(ibooker.
book1D(
"StaTrkMuon_HM"+EtaName,
"InvMass_{STA,TRK}"+EtaName,nBin, HighMassMin, HighMassMax));
83 TightTightMuon.push_back(ibooker.
book1D(
"TightTightMuon"+EtaName,
"InvMass_{Tight,Tight}"+EtaName,nBin, 55.0, 125.0));
86 SoftSoftMuon.push_back(ibooker.
book1D(
"SoftSoftMuon"+EtaName,
"InvMass_{Soft,Soft}"+EtaName,nBin, 5.0, 55.0));
92 LogTrace(
metname)<<
"[DiMuonHistograms] Analyze the mu in different eta regions";
94 iEvent.
getByToken(theMuonCollectionLabel_, muons);
100 unsigned int theIndexOfThePrimaryVertex = 999.;
105 for (
unsigned int ind=0; ind<vertex->size(); ++ind) {
106 if ( (*vertex)[ind].isValid() && !((*vertex)[ind].isFake()) ) {
107 theIndexOfThePrimaryVertex = ind;
113 if (theIndexOfThePrimaryVertex<100) {
114 posVtx = ((*vertex)[theIndexOfThePrimaryVertex]).
position();
115 errVtx = ((*vertex)[theIndexOfThePrimaryVertex]).
error();
118 LogInfo(
"RecoMuonValidator") <<
"reco::PrimaryVertex not found, use BeamSpot position instead\n";
121 iEvent.
getByToken(theBeamSpotLabel_,recoBeamSpotHandle);
127 errVtx(2,2) = bs.
sigmaZ();
135 TLorentzVector Mu1, Mu2;
137 float InvMass = -99.;
139 for (reco::MuonCollection::const_iterator recoMu1 = muons->begin(); recoMu1!=muons->end(); ++recoMu1) {
143 for (reco::MuonCollection::const_iterator recoMu2 = recoMu1; recoMu2!=muons->end(); ++recoMu2){
145 if (recoMu1==recoMu2)
continue;
148 if (recoMu1->isGlobalMuon() && recoMu2->isGlobalMuon()) {
152 Mu1.SetPxPyPzE(recoCombinedGlbTrack1->px(), recoCombinedGlbTrack1->py(),recoCombinedGlbTrack1->pz(), recoCombinedGlbTrack1->p());
153 Mu2.SetPxPyPzE(recoCombinedGlbTrack2->px(), recoCombinedGlbTrack2->py(),recoCombinedGlbTrack2->pz(), recoCombinedGlbTrack2->p());
155 charge = recoCombinedGlbTrack1->charge()*recoCombinedGlbTrack2->charge();
157 InvMass = (Mu1+Mu2).M();
158 for (
unsigned int iEtaRegion=0; iEtaRegion<3; iEtaRegion++){
159 if (iEtaRegion==0) {EtaCutMin= 0.; EtaCutMax=2.4; }
160 if (iEtaRegion==1) {EtaCutMin= etaBMin; EtaCutMax=etaBMax; }
161 if (iEtaRegion==2) {EtaCutMin= etaECMin; EtaCutMax=etaECMax; }
163 if(fabs(recoCombinedGlbTrack1->eta())>EtaCutMin && fabs(recoCombinedGlbTrack1->eta())<EtaCutMax &&
164 fabs(recoCombinedGlbTrack2->eta())>EtaCutMin && fabs(recoCombinedGlbTrack2->eta())<EtaCutMax){
165 if (InvMass < LowMassMax) GlbGlbMuon_LM[iEtaRegion]->Fill(InvMass);
166 if (InvMass > HighMassMin) GlbGlbMuon_HM[iEtaRegion]->Fill(InvMass);
176 for (
unsigned int iEtaRegion=0; iEtaRegion<3; iEtaRegion++){
177 if (iEtaRegion==0) {EtaCutMin= 0.; EtaCutMax=2.4; }
178 if (iEtaRegion==1) {EtaCutMin= etaBMin; EtaCutMax=etaBMax; }
179 if (iEtaRegion==2) {EtaCutMin= etaECMin; EtaCutMax=etaECMax; }
181 if(fabs(recoCombinedGlbTrack1->eta())>EtaCutMin && fabs(recoCombinedGlbTrack1->eta())<EtaCutMax &&
182 fabs(recoCombinedGlbTrack2->eta())>EtaCutMin && fabs(recoCombinedGlbTrack2->eta())<EtaCutMax){
183 if (InvMass > 55. && InvMass < 125.) TightTightMuon[iEtaRegion]->Fill(InvMass);
190 if (recoMu2->isStandAloneMuon() && recoMu1->isTrackerMuon()) {
194 Mu2.SetPxPyPzE(recoStaTrack->px(), recoStaTrack->py(),recoStaTrack->pz(), recoStaTrack->p());
195 Mu1.SetPxPyPzE(recoTrack->px(), recoTrack->py(),recoTrack->pz(), recoTrack->p());
197 charge = recoStaTrack->charge()*recoTrack->charge();
199 InvMass = (Mu1+Mu2).M();
200 for (
unsigned int iEtaRegion=0; iEtaRegion<3; iEtaRegion++){
201 if (iEtaRegion==0) {EtaCutMin= 0.; EtaCutMax=2.4; }
202 if (iEtaRegion==1) {EtaCutMin= etaBMin; EtaCutMax=etaBMax; }
203 if (iEtaRegion==2) {EtaCutMin= etaECMin; EtaCutMax=etaECMax; }
205 if(fabs(recoStaTrack->eta())>EtaCutMin && fabs(recoStaTrack->eta())<EtaCutMax &&
206 fabs(recoTrack->eta())>EtaCutMin && fabs(recoTrack->eta())<EtaCutMax){
207 if (InvMass < LowMassMax) StaTrkMuon_LM[iEtaRegion]->Fill(InvMass);
208 if (InvMass > HighMassMin) StaTrkMuon_HM[iEtaRegion]->Fill(InvMass);
213 if (recoMu1->isStandAloneMuon() && recoMu2->isTrackerMuon()) {
217 Mu1.SetPxPyPzE(recoStaTrack->px(), recoStaTrack->py(),recoStaTrack->pz(), recoStaTrack->p());
218 Mu2.SetPxPyPzE(recoTrack->px(), recoTrack->py(),recoTrack->pz(), recoTrack->p());
220 charge = recoStaTrack->charge()*recoTrack->charge();
222 InvMass = (Mu1+Mu2).M();
223 for (
unsigned int iEtaRegion=0; iEtaRegion<3; iEtaRegion++){
224 if (iEtaRegion==0) {EtaCutMin= 0.; EtaCutMax=2.4; }
225 if (iEtaRegion==1) {EtaCutMin= etaBMin; EtaCutMax=etaBMax; }
226 if (iEtaRegion==2) {EtaCutMin= etaECMin; EtaCutMax=etaECMax; }
228 if(fabs(recoStaTrack->eta())>EtaCutMin && fabs(recoStaTrack->eta())<EtaCutMax &&
229 fabs(recoTrack->eta())>EtaCutMin && fabs(recoTrack->eta())<EtaCutMax){
230 if (InvMass < LowMassMax) StaTrkMuon_LM[iEtaRegion]->Fill(InvMass);
231 if (InvMass > HighMassMin) StaTrkMuon_HM[iEtaRegion]->Fill(InvMass);
238 if (recoMu1->isTrackerMuon() && recoMu2->isTrackerMuon()) {
242 Mu2.SetPxPyPzE(recoTrack2->px(), recoTrack2->py(),recoTrack2->pz(), recoTrack2->p());
243 Mu1.SetPxPyPzE(recoTrack1->px(), recoTrack1->py(),recoTrack1->pz(), recoTrack1->p());
245 charge = recoTrack1->charge()*recoTrack2->charge();
247 InvMass = (Mu1+Mu2).M();
248 for (
unsigned int iEtaRegion=0; iEtaRegion<3; iEtaRegion++){
249 if (iEtaRegion==0) {EtaCutMin= 0.; EtaCutMax=2.4; }
250 if (iEtaRegion==1) {EtaCutMin= etaBMin; EtaCutMax=etaBMax; }
251 if (iEtaRegion==2) {EtaCutMin= etaECMin; EtaCutMax=etaECMax; }
253 if(fabs(recoTrack1->eta())>EtaCutMin && fabs(recoTrack1->eta())<EtaCutMax &&
254 fabs(recoTrack2->eta())>EtaCutMin && fabs(recoTrack2->eta())<EtaCutMax){
255 if (InvMass < LowMassMax) TrkTrkMuon_LM[iEtaRegion]->Fill(InvMass);
256 if (InvMass > HighMassMin) TrkTrkMuon_HM[iEtaRegion]->Fill(InvMass);
268 InvMass = (Mu1+Mu2).M();
269 for (
unsigned int iEtaRegion=0; iEtaRegion<3; iEtaRegion++){
270 if (iEtaRegion==0) {EtaCutMin= 0.; EtaCutMax=2.4; }
271 if (iEtaRegion==1) {EtaCutMin= etaBMin; EtaCutMax=etaBMax; }
272 if (iEtaRegion==2) {EtaCutMin= etaECMin; EtaCutMax=etaECMax; }
274 if(fabs(recoTrack1->eta())>EtaCutMin && fabs(recoTrack1->eta())<EtaCutMax &&
275 fabs(recoTrack2->eta())>EtaCutMin && fabs(recoTrack2->eta())<EtaCutMax){
276 SoftSoftMuon[iEtaRegion]->Fill(InvMass);
bool getByToken(EDGetToken token, Handle< PROD > &result) const
const std::string metname
math::Error< dimension >::type Error
covariance error matrix (3x3)
static int position[TOTALCHAMBERS][3]
bool isSoftMuon(const reco::Muon &, const reco::Vertex &)
MonitorElement * book1D(Args &&...args)
math::XYZPoint Point
point in the space
double BeamWidthX() const
beam width X
DiMuonHistograms(const edm::ParameterSet &pset)
void setCurrentFolder(const std::string &fullpath)
double sigmaZ() const
sigma z
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
double BeamWidthY() const
beam width Y
virtual ~DiMuonHistograms()
const Point & position() const
position
bool isTightMuon(const reco::Muon &, const reco::Vertex &)
void analyze(const edm::Event &, const edm::EventSetup &)