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));
94 SoftSoftMuon.push_back(ibooker.
book1D(
"SoftSoftMuon"+EtaName[iEtaRegion],
"InvMass_{Soft,Soft}"+EtaName[iEtaRegion],nBin[iEtaRegion], 0.0, 55.0));
100 LogTrace(
metname)<<
"[DiMuonHistograms] Analyze the mu in different eta regions";
102 iEvent.
getByToken(theMuonCollectionLabel_, muons);
108 unsigned int theIndexOfThePrimaryVertex = 999.;
113 for (
unsigned int ind=0; ind<vertex->size(); ++ind) {
114 if ( (*vertex)[ind].isValid() && !((*vertex)[ind].isFake()) ) {
115 theIndexOfThePrimaryVertex = ind;
121 if (theIndexOfThePrimaryVertex<100) {
122 posVtx = ((*vertex)[theIndexOfThePrimaryVertex]).
position();
123 errVtx = ((*vertex)[theIndexOfThePrimaryVertex]).
error();
126 LogInfo(
"RecoMuonValidator") <<
"reco::PrimaryVertex not found, use BeamSpot position instead\n";
129 iEvent.
getByToken(theBeamSpotLabel_,recoBeamSpotHandle);
135 errVtx(2,2) = bs.
sigmaZ();
143 TLorentzVector Mu1, Mu2;
145 float InvMass = -99.;
148 double EtaCutMin[] = {0, etaBMin, etaECMin};
149 double EtaCutMax[] = {2.4, etaBMax, etaECMax};
157 if (muon1==muon2)
continue;
160 if (muon1->isGlobalMuon() && muon2->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(fabs(recoCombinedGlbTrack1->eta())>EtaCutMin[iEtaRegion] && fabs(recoCombinedGlbTrack1->eta())<EtaCutMax[iEtaRegion] &&
172 fabs(recoCombinedGlbTrack2->eta())>EtaCutMin[iEtaRegion] && fabs(recoCombinedGlbTrack2->eta())<EtaCutMax[iEtaRegion]){
173 if (InvMass < LowMassMax) GlbGlbMuon_LM[iEtaRegion]->Fill(InvMass);
174 if (InvMass > HighMassMin) GlbGlbMuon_HM[iEtaRegion]->Fill(InvMass);
184 for (
unsigned int iEtaRegion=0; iEtaRegion<3; iEtaRegion++){
185 if(fabs(recoCombinedGlbTrack1->eta())>EtaCutMin[iEtaRegion] && fabs(recoCombinedGlbTrack1->eta())<EtaCutMax[iEtaRegion] &&
186 fabs(recoCombinedGlbTrack2->eta())>EtaCutMin[iEtaRegion] && fabs(recoCombinedGlbTrack2->eta())<EtaCutMax[iEtaRegion]){
187 if (InvMass > 55. && InvMass < 125.) TightTightMuon[iEtaRegion]->Fill(InvMass);
198 for (
unsigned int iEtaRegion=0; iEtaRegion<3; iEtaRegion++){
199 if(fabs(recoCombinedGlbTrack1->eta())>EtaCutMin[iEtaRegion] && fabs(recoCombinedGlbTrack1->eta())<EtaCutMax[iEtaRegion] &&
200 fabs(recoCombinedGlbTrack2->eta())>EtaCutMin[iEtaRegion] && fabs(recoCombinedGlbTrack2->eta())<EtaCutMax[iEtaRegion]){
201 if (InvMass > 55. && InvMass < 125.) MediumMediumMuon[iEtaRegion]->Fill(InvMass);
212 for (
unsigned int iEtaRegion=0; iEtaRegion<3; iEtaRegion++){
213 if(fabs(recoCombinedGlbTrack1->eta())>EtaCutMin[iEtaRegion] && fabs(recoCombinedGlbTrack1->eta())<EtaCutMax[iEtaRegion] &&
214 fabs(recoCombinedGlbTrack2->eta())>EtaCutMin[iEtaRegion] && fabs(recoCombinedGlbTrack2->eta())<EtaCutMax[iEtaRegion]){
215 if (InvMass > 55. && InvMass < 125.) LooseLooseMuon[iEtaRegion]->Fill(InvMass);
223 if (muon2->isStandAloneMuon() && muon1->isTrackerMuon()) {
227 Mu2.SetPxPyPzE(recoStaTrack->px(), recoStaTrack->py(),recoStaTrack->pz(), recoStaTrack->p());
228 Mu1.SetPxPyPzE(recoTrack->px(), recoTrack->py(),recoTrack->pz(), recoTrack->p());
230 charge = recoStaTrack->charge()*recoTrack->charge();
232 InvMass = (Mu1+Mu2).M();
233 for (
unsigned int iEtaRegion=0; iEtaRegion<3; iEtaRegion++){
234 if(fabs(recoStaTrack->eta())>EtaCutMin[iEtaRegion] && fabs(recoStaTrack->eta())<EtaCutMax[iEtaRegion] &&
235 fabs(recoTrack->eta())>EtaCutMin[iEtaRegion] && fabs(recoTrack->eta())<EtaCutMax[iEtaRegion]){
236 if (InvMass < LowMassMax) StaTrkMuon_LM[iEtaRegion]->Fill(InvMass);
237 if (InvMass > HighMassMin) StaTrkMuon_HM[iEtaRegion]->Fill(InvMass);
242 if (muon1->isStandAloneMuon() && muon2->isTrackerMuon()) {
246 Mu1.SetPxPyPzE(recoStaTrack->px(), recoStaTrack->py(),recoStaTrack->pz(), recoStaTrack->p());
247 Mu2.SetPxPyPzE(recoTrack->px(), recoTrack->py(),recoTrack->pz(), recoTrack->p());
249 charge = recoStaTrack->charge()*recoTrack->charge();
251 InvMass = (Mu1+Mu2).M();
252 for (
unsigned int iEtaRegion=0; iEtaRegion<3; iEtaRegion++){
253 if(fabs(recoStaTrack->eta())>EtaCutMin[iEtaRegion] && fabs(recoStaTrack->eta())<EtaCutMax[iEtaRegion] &&
254 fabs(recoTrack->eta())>EtaCutMin[iEtaRegion] && fabs(recoTrack->eta())<EtaCutMax[iEtaRegion]){
255 if (InvMass < LowMassMax) StaTrkMuon_LM[iEtaRegion]->Fill(InvMass);
256 if (InvMass > HighMassMin) StaTrkMuon_HM[iEtaRegion]->Fill(InvMass);
263 if (muon1->isTrackerMuon() && muon2->isTrackerMuon()) {
267 Mu2.SetPxPyPzE(recoTrack2->px(), recoTrack2->py(),recoTrack2->pz(), recoTrack2->p());
268 Mu1.SetPxPyPzE(recoTrack1->px(), recoTrack1->py(),recoTrack1->pz(), recoTrack1->p());
270 charge = recoTrack1->charge()*recoTrack2->charge();
272 InvMass = (Mu1+Mu2).M();
273 for (
unsigned int iEtaRegion=0; iEtaRegion<3; iEtaRegion++){
274 if(fabs(recoTrack1->eta())>EtaCutMin[iEtaRegion] && fabs(recoTrack1->eta())<EtaCutMax[iEtaRegion] &&
275 fabs(recoTrack2->eta())>EtaCutMin[iEtaRegion] && fabs(recoTrack2->eta())<EtaCutMax[iEtaRegion]){
276 if (InvMass < LowMassMax) TrkTrkMuon_LM[iEtaRegion]->Fill(InvMass);
277 if (InvMass > HighMassMin) TrkTrkMuon_HM[iEtaRegion]->Fill(InvMass);
289 InvMass = (Mu1+Mu2).M();
290 for (
unsigned int iEtaRegion=0; iEtaRegion<3; iEtaRegion++){
292 if(fabs(recoTrack1->eta())>EtaCutMin[iEtaRegion] && fabs(recoTrack1->eta())<EtaCutMax[iEtaRegion] &&
293 fabs(recoTrack2->eta())>EtaCutMin[iEtaRegion] && fabs(recoTrack2->eta())<EtaCutMax[iEtaRegion]){
294 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 isMediumMuon(const reco::Muon &)
bool isLooseMuon(const reco::Muon &)
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 &)