ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/L1RpcTriggerAnalysis/src/BestMuonFinder.cc
(Generate patch)

Comparing UserCode/L1RpcTriggerAnalysis/src/BestMuonFinder.cc (file contents):
Revision 1.4 by konec, Mon Jan 23 23:47:03 2012 UTC vs.
Revision 1.7 by konec, Tue Dec 11 13:21:39 2012 UTC

# Line 13 | Line 13
13   #include "DataFormats/TrackReco/interface/Track.h"
14  
15   #include "UserCode/L1RpcTriggerAnalysis/interface/Utilities.h"
16 + #include "DataFormats/Math/interface/deltaR.h"
17 + #include "DataFormats/Math/interface/deltaPhi.h"
18   #include "TObjArray.h"
19   #include "TH1D.h"
20   #include "TH2D.h"
# Line 22 | Line 24
24   BestMuonFinder::BestMuonFinder(const edm::ParameterSet& cfg)
25    : lastEvent(0), lastRun(0), theConfig(cfg), theUnique(true), theMuon(0),
26      hMuChi2Tk(0), hMuChi2Gl(0), hMuNHitsTk(0),
27 <    hMuPtVsEta(0), hMuHitsRPCvsCSC(0), hMuHitsRPCvsDT(0)
27 >    hMuPtVsEta(0), hMuHitsRPCvsCSC(0), hMuHitsRPCvsDT(0),
28 >    hMuonPt_BMF(0),hMuonEta_BMF (0),hMuonPhi_BMF(0)
29   {}
30  
31   bool BestMuonFinder::run(const edm::Event &ev, const edm::EventSetup &es)
# Line 48 | Line 51 | bool BestMuonFinder::run(const edm::Even
51    for (reco::MuonCollection::const_iterator im = muons->begin(); im != muons->end(); ++im) {
52  
53      if (!im->isTrackerMuon() || !im->innerTrack().isNonnull()) continue;
54 +    if (hMuonPt_BMF)   hMuonPt_BMF->Fill( im->innerTrack()->pt());
55 +    if (hMuonEta_BMF) hMuonEta_BMF->Fill( im->innerTrack()->eta());
56 +    if (hMuonPhi_BMF) hMuonPhi_BMF->Fill( im->innerTrack()->phi());
57      if (hMuPtVsEta) hMuPtVsEta->Fill(im->innerTrack()->eta(), im->innerTrack()->pt());
58      if (im->innerTrack()->pt() < theConfig.getParameter<double>("minPt")) continue;
59      if (fabs(im->innerTrack()->eta()) >  theConfig.getParameter<double>("maxEta")) continue;
# Line 101 | Line 107 | bool BestMuonFinder::run(const edm::Even
107      if ( nRPCHits < theConfig.getParameter<int>("minNumberRpcHits")) continue;
108      if ( nDTHits + nCSCHits < theConfig.getParameter<int>("minNumberDtCscHits")  ) continue;
109  
104    if (theMuon) theUnique = false;
110      if (!theMuon || (im->track()->pt() > theMuon->track()->pt()) ) theMuon = &(*im);
111    }
112 +
113 +  //
114 +  // check if muon is unigue
115 +  //
116 +  if (theMuon) {
117 +    double muonEta = theMuon->innerTrack()->eta();
118 +    double muonPhi = theMuon->innerTrack()->phi();
119 +    for (reco::MuonCollection::const_iterator im = muons->begin(); im != muons->end(); ++im) {
120 +      if (!im->isTrackerMuon() || !im->innerTrack().isNonnull()) continue;
121 +      if (&(*im) == theMuon) continue;
122 +      if ( fabs(reco::deltaPhi(muonPhi, im->innerTrack()->phi())) > theConfig.getParameter<double>("deltaPhiUnique")) continue;
123 +      if ( fabs(muonEta-im->innerTrack()->eta()) > theConfig.getParameter<double>("deltaEtaUnique")) continue;
124 +      theUnique = false;
125 +    }
126 +  }
127    return true;
128   }
129  
# Line 116 | Line 136 | void BestMuonFinder::initHistos( TObjArr
136    hMuHitsRPCvsCSC = new TH2D("hMuHitsRPCvsCSC","hMuHitsRPCvsCSC", 40,0.,40., 6,0.,6.); histos.Add(hMuHitsRPCvsCSC);
137    hMuHitsRPCvsDT  = new TH2D("hMuHitsRPCvsDT","hMuHitsRPCvsDT", 30,0.,60., 6,0.,6.); histos.Add(hMuHitsRPCvsDT);
138   //  hMuHitsCSCvsEta = new TH2D("hMuHitsCSCvsEta","hMuHitsCSCvsEta",17, 0.8,2.5, 40,0.,40); histos.Add(hMuHitsCSCvsEta);
139 +  hMuonPt_BMF  = new TH1D("hMuonPt_BMF","All global muons Pt;Glb.muon p_{T} [GeV];Muons / bin",L1PtScale::nPtBins,L1PtScale::ptBins);  histos.Add(hMuonPt_BMF);
140 +  hMuonEta_BMF = new TH1D("hMuonEta_BMF","All global muons Eta;Glb.muon #eta;Muons / bin",84, -2.1, 2.1);  histos.Add(hMuonEta_BMF);
141 +  hMuonPhi_BMF = new TH1D("hMuonPhi_BMF","All global muons Phi;Glb.muon #phi [rad];Muons / bin",90,-M_PI,M_PI);  histos.Add(hMuonPhi_BMF);
142 +
143   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines