20 #include "TLorentzVector.h"
40 theMuonCollectionLabel_ = consumes<reco::MuonCollection> (
parameters.getParameter<
edm::InputTag>(
"MuonCollection"));
57 theDbe->setCurrentFolder(
"Muons/DiMuonHistograms");
59 etaBin =
parameters.getParameter<
int>(
"etaBin");
60 etaBBin =
parameters.getParameter<
int>(
"etaBBin");
61 etaEBin =
parameters.getParameter<
int>(
"etaEBin");
63 etaBMin =
parameters.getParameter<
double>(
"etaBMin");
64 etaBMax =
parameters.getParameter<
double>(
"etaBMax");
65 etaECMin =
parameters.getParameter<
double>(
"etaECMin");
66 etaECMax =
parameters.getParameter<
double>(
"etaECMax");
68 LowMassMin =
parameters.getParameter<
double>(
"LowMassMin");
69 LowMassMax =
parameters.getParameter<
double>(
"LowMassMax");
70 HighMassMin =
parameters.getParameter<
double>(
"HighMassMin");
71 HighMassMax =
parameters.getParameter<
double>(
"HighMassMax");
74 for (
unsigned int iEtaRegion=0; iEtaRegion<3; iEtaRegion++){
75 if (iEtaRegion==0) { EtaName =
""; nBin = etaBin;}
76 if (iEtaRegion==1) { EtaName =
"_Barrel"; nBin = etaBBin;}
77 if (iEtaRegion==2) { EtaName =
"_EndCap"; nBin = etaEBin;}
79 GlbGlbMuon_LM.push_back(theDbe->book1D(
"GlbGlbMuon_LM"+EtaName,
"InvMass_{GLB,GLB}"+EtaName,nBin, LowMassMin, LowMassMax));
80 TrkTrkMuon_LM.push_back(theDbe->book1D(
"TrkTrkMuon_LM"+EtaName,
"InvMass_{TRK,TRK}"+EtaName,nBin, LowMassMin, LowMassMax));
81 StaTrkMuon_LM.push_back(theDbe->book1D(
"StaTrkMuon_LM"+EtaName,
"InvMass_{STA,TRK}"+EtaName,nBin, LowMassMin, LowMassMax));
83 GlbGlbMuon_HM.push_back(theDbe->book1D(
"GlbGlbMuon_HM"+EtaName,
"InvMass_{GLB,GLB}"+EtaName,nBin, HighMassMin, HighMassMax));
84 TrkTrkMuon_HM.push_back(theDbe->book1D(
"TrkTrkMuon_HM"+EtaName,
"InvMass_{TRK,TRK}"+EtaName,nBin, HighMassMin, HighMassMax));
85 StaTrkMuon_HM.push_back(theDbe->book1D(
"StaTrkMuon_HM"+EtaName,
"InvMass_{STA,TRK}"+EtaName,nBin, HighMassMin, HighMassMax));
88 TightTightMuon.push_back(theDbe->book1D(
"TightTightMuon"+EtaName,
"InvMass_{Tight,Tight}"+EtaName,nBin, 55.0, 125.0));
91 SoftSoftMuon.push_back(theDbe->book1D(
"SoftSoftMuon"+EtaName,
"InvMass_{Soft,Soft}"+EtaName,nBin, 5.0, 55.0));
97 LogTrace(
metname)<<
"[DiMuonHistograms] Analyze the mu in different eta regions";
99 iEvent.
getByToken(theMuonCollectionLabel_, muons);
105 unsigned int theIndexOfThePrimaryVertex = 999.;
110 for (
unsigned int ind=0; ind<vertex->size(); ++ind) {
111 if ( (*vertex)[ind].isValid() && !((*vertex)[ind].isFake()) ) {
112 theIndexOfThePrimaryVertex = ind;
118 if (theIndexOfThePrimaryVertex<100) {
119 posVtx = ((*vertex)[theIndexOfThePrimaryVertex]).
position();
120 errVtx = ((*vertex)[theIndexOfThePrimaryVertex]).
error();
123 LogInfo(
"RecoMuonValidator") <<
"reco::PrimaryVertex not found, use BeamSpot position instead\n";
126 iEvent.
getByToken(theBeamSpotLabel_,recoBeamSpotHandle);
132 errVtx(2,2) = bs.
sigmaZ();
140 TLorentzVector Mu1, Mu2;
142 float InvMass = -99.;
144 for (reco::MuonCollection::const_iterator recoMu1 = muons->begin(); recoMu1!=muons->end(); ++recoMu1) {
148 for (reco::MuonCollection::const_iterator recoMu2 = recoMu1; recoMu2!=muons->end(); ++recoMu2){
150 if (recoMu1==recoMu2)
continue;
153 if (recoMu1->isGlobalMuon() && recoMu2->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);
195 if (recoMu2->isStandAloneMuon() && recoMu1->isTrackerMuon()) {
199 Mu2.SetPxPyPzE(recoStaTrack->px(), recoStaTrack->py(),recoStaTrack->pz(), recoStaTrack->p());
200 Mu1.SetPxPyPzE(recoTrack->px(), recoTrack->py(),recoTrack->pz(), recoTrack->p());
202 charge = recoStaTrack->charge()*recoTrack->charge();
204 InvMass = (Mu1+Mu2).M();
205 for (
unsigned int iEtaRegion=0; iEtaRegion<3; iEtaRegion++){
206 if (iEtaRegion==0) {EtaCutMin= 0.; EtaCutMax=2.4; }
207 if (iEtaRegion==1) {EtaCutMin= etaBMin; EtaCutMax=etaBMax; }
208 if (iEtaRegion==2) {EtaCutMin= etaECMin; EtaCutMax=etaECMax; }
210 if(fabs(recoStaTrack->eta())>EtaCutMin && fabs(recoStaTrack->eta())<EtaCutMax &&
211 fabs(recoTrack->eta())>EtaCutMin && fabs(recoTrack->eta())<EtaCutMax){
212 if (InvMass < LowMassMax) StaTrkMuon_LM[iEtaRegion]->Fill(InvMass);
213 if (InvMass > HighMassMin) StaTrkMuon_HM[iEtaRegion]->Fill(InvMass);
218 if (recoMu1->isStandAloneMuon() && recoMu2->isTrackerMuon()) {
222 Mu1.SetPxPyPzE(recoStaTrack->px(), recoStaTrack->py(),recoStaTrack->pz(), recoStaTrack->p());
223 Mu2.SetPxPyPzE(recoTrack->px(), recoTrack->py(),recoTrack->pz(), recoTrack->p());
225 charge = recoStaTrack->charge()*recoTrack->charge();
227 InvMass = (Mu1+Mu2).M();
228 for (
unsigned int iEtaRegion=0; iEtaRegion<3; iEtaRegion++){
229 if (iEtaRegion==0) {EtaCutMin= 0.; EtaCutMax=2.4; }
230 if (iEtaRegion==1) {EtaCutMin= etaBMin; EtaCutMax=etaBMax; }
231 if (iEtaRegion==2) {EtaCutMin= etaECMin; EtaCutMax=etaECMax; }
233 if(fabs(recoStaTrack->eta())>EtaCutMin && fabs(recoStaTrack->eta())<EtaCutMax &&
234 fabs(recoTrack->eta())>EtaCutMin && fabs(recoTrack->eta())<EtaCutMax){
235 if (InvMass < LowMassMax) StaTrkMuon_LM[iEtaRegion]->Fill(InvMass);
236 if (InvMass > HighMassMin) StaTrkMuon_HM[iEtaRegion]->Fill(InvMass);
243 if (recoMu1->isTrackerMuon() && recoMu2->isTrackerMuon()) {
247 Mu2.SetPxPyPzE(recoTrack2->px(), recoTrack2->py(),recoTrack2->pz(), recoTrack2->p());
248 Mu1.SetPxPyPzE(recoTrack1->px(), recoTrack1->py(),recoTrack1->pz(), recoTrack1->p());
250 charge = recoTrack1->charge()*recoTrack2->charge();
252 InvMass = (Mu1+Mu2).M();
253 for (
unsigned int iEtaRegion=0; iEtaRegion<3; iEtaRegion++){
254 if (iEtaRegion==0) {EtaCutMin= 0.; EtaCutMax=2.4; }
255 if (iEtaRegion==1) {EtaCutMin= etaBMin; EtaCutMax=etaBMax; }
256 if (iEtaRegion==2) {EtaCutMin= etaECMin; EtaCutMax=etaECMax; }
258 if(fabs(recoTrack1->eta())>EtaCutMin && fabs(recoTrack1->eta())<EtaCutMax &&
259 fabs(recoTrack2->eta())>EtaCutMin && fabs(recoTrack2->eta())<EtaCutMax){
260 if (InvMass < LowMassMax) TrkTrkMuon_LM[iEtaRegion]->Fill(InvMass);
261 if (InvMass > HighMassMin) TrkTrkMuon_HM[iEtaRegion]->Fill(InvMass);
273 InvMass = (Mu1+Mu2).M();
274 for (
unsigned int iEtaRegion=0; iEtaRegion<3; iEtaRegion++){
275 if (iEtaRegion==0) {EtaCutMin= 0.; EtaCutMax=2.4; }
276 if (iEtaRegion==1) {EtaCutMin= etaBMin; EtaCutMax=etaBMax; }
277 if (iEtaRegion==2) {EtaCutMin= etaECMin; EtaCutMax=etaECMax; }
279 if(fabs(recoTrack1->eta())>EtaCutMin && fabs(recoTrack1->eta())<EtaCutMax &&
280 fabs(recoTrack2->eta())>EtaCutMin && fabs(recoTrack2->eta())<EtaCutMax){
281 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 &)
void beginRun(const edm::Run &iRun, const edm::EventSetup &iSetup)
math::XYZPoint Point
point in the space
double BeamWidthX() const
beam width X
DiMuonHistograms(const edm::ParameterSet &pset)
double sigmaZ() const
sigma z
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 &)