20 #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[0] =
""; EtaName[1] =
"_Barrel"; EtaName[2] =
"_EndCap";
75 test = ibooker.
book1D(
"test",
"InvMass_{Tight,Tight}",100, 0., 200.);
76 for (
unsigned int iEtaRegion=0; iEtaRegion<3; iEtaRegion++){
78 GlbGlbMuon_LM.push_back(ibooker.
book1D(
"GlbGlbMuon_LM"+EtaName[iEtaRegion],
"InvMass_{GLB,GLB}"+EtaName[iEtaRegion],nBin[iEtaRegion],
LowMassMin,
LowMassMax));
79 TrkTrkMuon_LM.push_back(ibooker.
book1D(
"TrkTrkMuon_LM"+EtaName[iEtaRegion],
"InvMass_{TRK,TRK}"+EtaName[iEtaRegion],nBin[iEtaRegion],
LowMassMin,
LowMassMax));
80 StaTrkMuon_LM.push_back(ibooker.
book1D(
"StaTrkMuon_LM"+EtaName[iEtaRegion],
"InvMass_{STA,TRK}"+EtaName[iEtaRegion],nBin[iEtaRegion],
LowMassMin,
LowMassMax));
82 GlbGlbMuon_HM.push_back(ibooker.
book1D(
"GlbGlbMuon_HM"+EtaName[iEtaRegion],
"InvMass_{GLB,GLB}"+EtaName[iEtaRegion],nBin[iEtaRegion],
HighMassMin,
HighMassMax));
83 TrkTrkMuon_HM.push_back(ibooker.
book1D(
"TrkTrkMuon_HM"+EtaName[iEtaRegion],
"InvMass_{TRK,TRK}"+EtaName[iEtaRegion],nBin[iEtaRegion],
HighMassMin,
HighMassMax));
84 StaTrkMuon_HM.push_back(ibooker.
book1D(
"StaTrkMuon_HM"+EtaName[iEtaRegion],
"InvMass_{STA,TRK}"+EtaName[iEtaRegion],nBin[iEtaRegion],
HighMassMin,
HighMassMax));
87 TightTightMuon.push_back(ibooker.
book1D(
"TightTightMuon"+EtaName[iEtaRegion],
"InvMass_{Tight,Tight}"+EtaName[iEtaRegion],nBin[iEtaRegion], 55.0, 125.0));
90 SoftSoftMuon.push_back(ibooker.
book1D(
"SoftSoftMuon"+EtaName[iEtaRegion],
"InvMass_{Soft,Soft}"+EtaName[iEtaRegion],nBin[iEtaRegion], 0.0, 55.0));
96 LogTrace(
metname)<<
"[DiMuonHistograms] Analyze the mu in different eta regions";
98 iEvent.
getByToken(theMuonCollectionLabel_, muons);
104 unsigned int theIndexOfThePrimaryVertex = 999.;
109 for (
unsigned int ind=0; ind<vertex->size(); ++ind) {
110 if ( (*vertex)[ind].isValid() && !((*vertex)[ind].isFake()) ) {
111 theIndexOfThePrimaryVertex = ind;
117 if (theIndexOfThePrimaryVertex<100) {
118 posVtx = ((*vertex)[theIndexOfThePrimaryVertex]).
position();
119 errVtx = ((*vertex)[theIndexOfThePrimaryVertex]).
error();
122 LogInfo(
"RecoMuonValidator") <<
"reco::PrimaryVertex not found, use BeamSpot position instead\n";
125 iEvent.
getByToken(theBeamSpotLabel_,recoBeamSpotHandle);
131 errVtx(2,2) = bs.
sigmaZ();
139 TLorentzVector Mu1, Mu2;
141 float InvMass = -99.;
150 if (muon1==muon2)
continue;
153 if (muon1->isGlobalMuon() && muon2->isGlobalMuon()) {
157 Mu1.SetPxPyPzE(recoCombinedGlbTrack1->px(), recoCombinedGlbTrack1->py(),recoCombinedGlbTrack1->pz(), recoCombinedGlbTrack1->p());
158 Mu2.SetPxPyPzE(recoCombinedGlbTrack2->px(), recoCombinedGlbTrack2->py(),recoCombinedGlbTrack2->pz(), recoCombinedGlbTrack2->p());
160 charge = recoCombinedGlbTrack1->charge()*recoCombinedGlbTrack2->charge();
162 InvMass = (Mu1+Mu2).M();
163 for (
unsigned int iEtaRegion=0; iEtaRegion<3; iEtaRegion++){
164 if (iEtaRegion==0) {EtaCutMin= 0.; EtaCutMax=2.4; }
165 if (iEtaRegion==1) {EtaCutMin= etaBMin; EtaCutMax=etaBMax; }
166 if (iEtaRegion==2) {EtaCutMin= etaECMin; EtaCutMax=etaECMax; }
168 if(fabs(recoCombinedGlbTrack1->eta())>EtaCutMin && fabs(recoCombinedGlbTrack1->eta())<EtaCutMax &&
169 fabs(recoCombinedGlbTrack2->eta())>EtaCutMin && fabs(recoCombinedGlbTrack2->eta())<EtaCutMax){
170 if (InvMass <
LowMassMax) GlbGlbMuon_LM[iEtaRegion]->Fill(InvMass);
171 if (InvMass >
HighMassMin) GlbGlbMuon_HM[iEtaRegion]->Fill(InvMass);
181 for (
unsigned int iEtaRegion=0; iEtaRegion<3; iEtaRegion++){
182 if (iEtaRegion==0) {EtaCutMin= 0.; EtaCutMax=2.4; }
183 if (iEtaRegion==1) {EtaCutMin= etaBMin; EtaCutMax=etaBMax; }
184 if (iEtaRegion==2) {EtaCutMin= etaECMin; EtaCutMax=etaECMax; }
186 if(fabs(recoCombinedGlbTrack1->eta())>EtaCutMin && fabs(recoCombinedGlbTrack1->eta())<EtaCutMax &&
187 fabs(recoCombinedGlbTrack2->eta())>EtaCutMin && fabs(recoCombinedGlbTrack2->eta())<EtaCutMax){
188 if (InvMass > 55. && InvMass < 125.) TightTightMuon[iEtaRegion]->Fill(InvMass);
196 if (muon2->isStandAloneMuon() && muon1->isTrackerMuon()) {
200 Mu2.SetPxPyPzE(recoStaTrack->px(), recoStaTrack->py(),recoStaTrack->pz(), recoStaTrack->p());
201 Mu1.SetPxPyPzE(recoTrack->px(), recoTrack->py(),recoTrack->pz(), recoTrack->p());
203 charge = recoStaTrack->charge()*recoTrack->charge();
205 InvMass = (Mu1+Mu2).M();
206 for (
unsigned int iEtaRegion=0; iEtaRegion<3; iEtaRegion++){
207 if (iEtaRegion==0) {EtaCutMin= 0.; EtaCutMax=2.4; }
208 if (iEtaRegion==1) {EtaCutMin= etaBMin; EtaCutMax=etaBMax; }
209 if (iEtaRegion==2) {EtaCutMin= etaECMin; EtaCutMax=etaECMax; }
211 if(fabs(recoStaTrack->eta())>EtaCutMin && fabs(recoStaTrack->eta())<EtaCutMax &&
212 fabs(recoTrack->eta())>EtaCutMin && fabs(recoTrack->eta())<EtaCutMax){
213 if (InvMass <
LowMassMax) StaTrkMuon_LM[iEtaRegion]->Fill(InvMass);
214 if (InvMass >
HighMassMin) StaTrkMuon_HM[iEtaRegion]->Fill(InvMass);
219 if (muon1->isStandAloneMuon() && muon2->isTrackerMuon()) {
223 Mu1.SetPxPyPzE(recoStaTrack->px(), recoStaTrack->py(),recoStaTrack->pz(), recoStaTrack->p());
224 Mu2.SetPxPyPzE(recoTrack->px(), recoTrack->py(),recoTrack->pz(), recoTrack->p());
226 charge = recoStaTrack->charge()*recoTrack->charge();
228 InvMass = (Mu1+Mu2).M();
229 for (
unsigned int iEtaRegion=0; iEtaRegion<3; iEtaRegion++){
230 if (iEtaRegion==0) {EtaCutMin= 0.; EtaCutMax=2.4; }
231 if (iEtaRegion==1) {EtaCutMin= etaBMin; EtaCutMax=etaBMax; }
232 if (iEtaRegion==2) {EtaCutMin= etaECMin; EtaCutMax=etaECMax; }
234 if(fabs(recoStaTrack->eta())>EtaCutMin && fabs(recoStaTrack->eta())<EtaCutMax &&
235 fabs(recoTrack->eta())>EtaCutMin && fabs(recoTrack->eta())<EtaCutMax){
236 if (InvMass <
LowMassMax) StaTrkMuon_LM[iEtaRegion]->Fill(InvMass);
237 if (InvMass >
HighMassMin) StaTrkMuon_HM[iEtaRegion]->Fill(InvMass);
244 if (muon1->isTrackerMuon() && muon2->isTrackerMuon()) {
248 Mu2.SetPxPyPzE(recoTrack2->px(), recoTrack2->py(),recoTrack2->pz(), recoTrack2->p());
249 Mu1.SetPxPyPzE(recoTrack1->px(), recoTrack1->py(),recoTrack1->pz(), recoTrack1->p());
251 charge = recoTrack1->charge()*recoTrack2->charge();
253 InvMass = (Mu1+Mu2).M();
254 for (
unsigned int iEtaRegion=0; iEtaRegion<3; iEtaRegion++){
255 if (iEtaRegion==0) {EtaCutMin= 0.; EtaCutMax=2.4; }
256 if (iEtaRegion==1) {EtaCutMin= etaBMin; EtaCutMax=etaBMax; }
257 if (iEtaRegion==2) {EtaCutMin= etaECMin; EtaCutMax=etaECMax; }
259 if(fabs(recoTrack1->eta())>EtaCutMin && fabs(recoTrack1->eta())<EtaCutMax &&
260 fabs(recoTrack2->eta())>EtaCutMin && fabs(recoTrack2->eta())<EtaCutMax){
261 if (InvMass <
LowMassMax) TrkTrkMuon_LM[iEtaRegion]->Fill(InvMass);
262 if (InvMass >
HighMassMin) TrkTrkMuon_HM[iEtaRegion]->Fill(InvMass);
274 InvMass = (Mu1+Mu2).M();
275 for (
unsigned int iEtaRegion=0; iEtaRegion<3; iEtaRegion++){
276 if (iEtaRegion==0) {EtaCutMin= 0.; EtaCutMax=2.4; }
277 if (iEtaRegion==1) {EtaCutMin= etaBMin; EtaCutMax=etaBMax; }
278 if (iEtaRegion==2) {EtaCutMin= etaECMin; EtaCutMax=etaECMax; }
280 if(fabs(recoTrack1->eta())>EtaCutMin && fabs(recoTrack1->eta())<EtaCutMax &&
281 fabs(recoTrack2->eta())>EtaCutMin && fabs(recoTrack2->eta())<EtaCutMax){
282 SoftSoftMuon[iEtaRegion]->Fill(InvMass);
void analyze(const edm::Event &, const edm::EventSetup &) override
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()
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 &)