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 etaBinLM =
parameters.getParameter<
int>(
"etaBinLM");
48 etaBBinLM =
parameters.getParameter<
int>(
"etaBBinLM");
49 etaEBinLM =
parameters.getParameter<
int>(
"etaEBinLM");
51 etaBMin =
parameters.getParameter<
double>(
"etaBMin");
52 etaBMax =
parameters.getParameter<
double>(
"etaBMax");
53 etaECMin =
parameters.getParameter<
double>(
"etaECMin");
54 etaECMax =
parameters.getParameter<
double>(
"etaECMax");
56 LowMassMin =
parameters.getParameter<
double>(
"LowMassMin");
57 LowMassMax =
parameters.getParameter<
double>(
"LowMassMax");
58 HighMassMin =
parameters.getParameter<
double>(
"HighMassMin");
59 HighMassMax =
parameters.getParameter<
double>(
"HighMassMax");
72 int nBin = 0, nBinLM = 0;
73 for (
unsigned int iEtaRegion=0; iEtaRegion<3; iEtaRegion++){
74 if (iEtaRegion==0) { EtaName =
""; nBin = etaBin;}
75 if (iEtaRegion==1) { EtaName =
"_Barrel"; nBin = etaBBin;}
76 if (iEtaRegion==2) { EtaName =
"_EndCap"; nBin = etaEBin;}
79 if (etaBinLM == 0) { nBinLM = nBin;}
81 if (iEtaRegion==0) { EtaName =
""; nBinLM = etaBinLM;}
82 if (iEtaRegion==1) { EtaName =
"_Barrel"; nBinLM = etaBBinLM;}
83 if (iEtaRegion==2) { EtaName =
"_EndCap"; nBinLM = etaEBinLM;}
86 GlbGlbMuon_LM.push_back(ibooker.
book1D(
"GlbGlbMuon_LM"+EtaName,
"InvMass_{GLB,GLB}"+EtaName,nBinLM, LowMassMin, LowMassMax));
87 TrkTrkMuon_LM.push_back(ibooker.
book1D(
"TrkTrkMuon_LM"+EtaName,
"InvMass_{TRK,TRK}"+EtaName,nBinLM, LowMassMin, LowMassMax));
88 StaTrkMuon_LM.push_back(ibooker.
book1D(
"StaTrkMuon_LM"+EtaName,
"InvMass_{STA,TRK}"+EtaName,nBinLM, LowMassMin, LowMassMax));
90 GlbGlbMuon_HM.push_back(ibooker.
book1D(
"GlbGlbMuon_HM"+EtaName,
"InvMass_{GLB,GLB}"+EtaName,nBin, HighMassMin, HighMassMax));
91 TrkTrkMuon_HM.push_back(ibooker.
book1D(
"TrkTrkMuon_HM"+EtaName,
"InvMass_{TRK,TRK}"+EtaName,nBin, HighMassMin, HighMassMax));
92 StaTrkMuon_HM.push_back(ibooker.
book1D(
"StaTrkMuon_HM"+EtaName,
"InvMass_{STA,TRK}"+EtaName,nBin, HighMassMin, HighMassMax));
95 TightTightMuon.push_back(ibooker.
book1D(
"TightTightMuon"+EtaName,
"InvMass_{Tight,Tight}"+EtaName,nBin, 55.0, 125.0));
98 SoftSoftMuon.push_back(ibooker.
book1D(
"SoftSoftMuon"+EtaName,
"InvMass_{Soft,Soft}"+EtaName,nBin, 5.0, 55.0));
104 LogTrace(
metname)<<
"[DiMuonHistograms] Analyze the mu in different eta regions";
106 iEvent.
getByToken(theMuonCollectionLabel_, muons);
112 unsigned int theIndexOfThePrimaryVertex = 999.;
117 for (
unsigned int ind=0; ind<vertex->size(); ++ind) {
118 if ( (*vertex)[ind].isValid() && !((*vertex)[ind].isFake()) ) {
119 theIndexOfThePrimaryVertex = ind;
125 if (theIndexOfThePrimaryVertex<100) {
126 posVtx = ((*vertex)[theIndexOfThePrimaryVertex]).
position();
127 errVtx = ((*vertex)[theIndexOfThePrimaryVertex]).
error();
130 LogInfo(
"RecoMuonValidator") <<
"reco::PrimaryVertex not found, use BeamSpot position instead\n";
133 iEvent.
getByToken(theBeamSpotLabel_,recoBeamSpotHandle);
139 errVtx(2,2) = bs.
sigmaZ();
147 TLorentzVector Mu1, Mu2;
149 float InvMass = -99.;
151 for (reco::MuonCollection::const_iterator recoMu1 = muons->begin(); recoMu1!=muons->end(); ++recoMu1) {
155 for (reco::MuonCollection::const_iterator recoMu2 = recoMu1; recoMu2!=muons->end(); ++recoMu2){
157 if (recoMu1==recoMu2)
continue;
160 if (recoMu1->isGlobalMuon() && recoMu2->isGlobalMuon()) {
164 Mu1.SetPxPyPzE(recoCombinedGlbTrack1->px(), recoCombinedGlbTrack1->py(),recoCombinedGlbTrack1->pz(), recoCombinedGlbTrack1->p());
165 Mu2.SetPxPyPzE(recoCombinedGlbTrack2->px(), recoCombinedGlbTrack2->py(),recoCombinedGlbTrack2->pz(), recoCombinedGlbTrack2->p());
167 charge = recoCombinedGlbTrack1->charge()*recoCombinedGlbTrack2->charge();
169 InvMass = (Mu1+Mu2).M();
170 for (
unsigned int iEtaRegion=0; iEtaRegion<3; iEtaRegion++){
171 if (iEtaRegion==0) {EtaCutMin= 0.; EtaCutMax=2.4; }
172 if (iEtaRegion==1) {EtaCutMin= etaBMin; EtaCutMax=etaBMax; }
173 if (iEtaRegion==2) {EtaCutMin= etaECMin; EtaCutMax=etaECMax; }
175 if(fabs(recoCombinedGlbTrack1->eta())>EtaCutMin && fabs(recoCombinedGlbTrack1->eta())<EtaCutMax &&
176 fabs(recoCombinedGlbTrack2->eta())>EtaCutMin && fabs(recoCombinedGlbTrack2->eta())<EtaCutMax){
177 if (InvMass < LowMassMax) GlbGlbMuon_LM[iEtaRegion]->Fill(InvMass);
178 if (InvMass > HighMassMin) GlbGlbMuon_HM[iEtaRegion]->Fill(InvMass);
188 for (
unsigned int iEtaRegion=0; iEtaRegion<3; iEtaRegion++){
189 if (iEtaRegion==0) {EtaCutMin= 0.; EtaCutMax=2.4; }
190 if (iEtaRegion==1) {EtaCutMin= etaBMin; EtaCutMax=etaBMax; }
191 if (iEtaRegion==2) {EtaCutMin= etaECMin; EtaCutMax=etaECMax; }
193 if(fabs(recoCombinedGlbTrack1->eta())>EtaCutMin && fabs(recoCombinedGlbTrack1->eta())<EtaCutMax &&
194 fabs(recoCombinedGlbTrack2->eta())>EtaCutMin && fabs(recoCombinedGlbTrack2->eta())<EtaCutMax){
195 if (InvMass > 55. && InvMass < 125.) TightTightMuon[iEtaRegion]->Fill(InvMass);
202 if (recoMu2->isStandAloneMuon() && recoMu1->isTrackerMuon()) {
206 Mu2.SetPxPyPzE(recoStaTrack->px(), recoStaTrack->py(),recoStaTrack->pz(), recoStaTrack->p());
207 Mu1.SetPxPyPzE(recoTrack->px(), recoTrack->py(),recoTrack->pz(), recoTrack->p());
209 charge = recoStaTrack->charge()*recoTrack->charge();
211 InvMass = (Mu1+Mu2).M();
212 for (
unsigned int iEtaRegion=0; iEtaRegion<3; iEtaRegion++){
213 if (iEtaRegion==0) {EtaCutMin= 0.; EtaCutMax=2.4; }
214 if (iEtaRegion==1) {EtaCutMin= etaBMin; EtaCutMax=etaBMax; }
215 if (iEtaRegion==2) {EtaCutMin= etaECMin; EtaCutMax=etaECMax; }
217 if(fabs(recoStaTrack->eta())>EtaCutMin && fabs(recoStaTrack->eta())<EtaCutMax &&
218 fabs(recoTrack->eta())>EtaCutMin && fabs(recoTrack->eta())<EtaCutMax){
219 if (InvMass < LowMassMax) StaTrkMuon_LM[iEtaRegion]->Fill(InvMass);
220 if (InvMass > HighMassMin) StaTrkMuon_HM[iEtaRegion]->Fill(InvMass);
225 if (recoMu1->isStandAloneMuon() && recoMu2->isTrackerMuon()) {
229 Mu1.SetPxPyPzE(recoStaTrack->px(), recoStaTrack->py(),recoStaTrack->pz(), recoStaTrack->p());
230 Mu2.SetPxPyPzE(recoTrack->px(), recoTrack->py(),recoTrack->pz(), recoTrack->p());
232 charge = recoStaTrack->charge()*recoTrack->charge();
234 InvMass = (Mu1+Mu2).M();
235 for (
unsigned int iEtaRegion=0; iEtaRegion<3; iEtaRegion++){
236 if (iEtaRegion==0) {EtaCutMin= 0.; EtaCutMax=2.4; }
237 if (iEtaRegion==1) {EtaCutMin= etaBMin; EtaCutMax=etaBMax; }
238 if (iEtaRegion==2) {EtaCutMin= etaECMin; EtaCutMax=etaECMax; }
240 if(fabs(recoStaTrack->eta())>EtaCutMin && fabs(recoStaTrack->eta())<EtaCutMax &&
241 fabs(recoTrack->eta())>EtaCutMin && fabs(recoTrack->eta())<EtaCutMax){
242 if (InvMass < LowMassMax) StaTrkMuon_LM[iEtaRegion]->Fill(InvMass);
243 if (InvMass > HighMassMin) StaTrkMuon_HM[iEtaRegion]->Fill(InvMass);
250 if (recoMu1->isTrackerMuon() && recoMu2->isTrackerMuon()) {
254 Mu2.SetPxPyPzE(recoTrack2->px(), recoTrack2->py(),recoTrack2->pz(), recoTrack2->p());
255 Mu1.SetPxPyPzE(recoTrack1->px(), recoTrack1->py(),recoTrack1->pz(), recoTrack1->p());
257 charge = recoTrack1->charge()*recoTrack2->charge();
259 InvMass = (Mu1+Mu2).M();
260 for (
unsigned int iEtaRegion=0; iEtaRegion<3; iEtaRegion++){
261 if (iEtaRegion==0) {EtaCutMin= 0.; EtaCutMax=2.4; }
262 if (iEtaRegion==1) {EtaCutMin= etaBMin; EtaCutMax=etaBMax; }
263 if (iEtaRegion==2) {EtaCutMin= etaECMin; EtaCutMax=etaECMax; }
265 if(fabs(recoTrack1->eta())>EtaCutMin && fabs(recoTrack1->eta())<EtaCutMax &&
266 fabs(recoTrack2->eta())>EtaCutMin && fabs(recoTrack2->eta())<EtaCutMax){
267 if (InvMass < LowMassMax) TrkTrkMuon_LM[iEtaRegion]->Fill(InvMass);
268 if (InvMass > HighMassMin) TrkTrkMuon_HM[iEtaRegion]->Fill(InvMass);
280 InvMass = (Mu1+Mu2).M();
281 for (
unsigned int iEtaRegion=0; iEtaRegion<3; iEtaRegion++){
282 if (iEtaRegion==0) {EtaCutMin= 0.; EtaCutMax=2.4; }
283 if (iEtaRegion==1) {EtaCutMin= etaBMin; EtaCutMax=etaBMax; }
284 if (iEtaRegion==2) {EtaCutMin= etaECMin; EtaCutMax=etaECMax; }
286 if(fabs(recoTrack1->eta())>EtaCutMin && fabs(recoTrack1->eta())<EtaCutMax &&
287 fabs(recoTrack2->eta())>EtaCutMin && fabs(recoTrack2->eta())<EtaCutMax){
288 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)
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()
static int position[264][3]
const Point & position() const
position
bool isTightMuon(const reco::Muon &, const reco::Vertex &)
void analyze(const edm::Event &, const edm::EventSetup &)