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

Comparing UserCode/L1RpcTriggerAnalysis/src/AnaMuonDistribution.cc (file contents):
Revision 1.2 by konec, Mon Oct 1 19:20:38 2012 UTC vs.
Revision 1.4 by konec, Tue Nov 6 12:56:51 2012 UTC

# Line 1 | Line 1
1   #include "UserCode/L1RpcTriggerAnalysis/interface/AnaMuonDistribution.h"
2  
3 + #include "FWCore/ParameterSet/interface/ParameterSet.h"
4   #include "TProfile.h"
5   #include "TObjArray.h"
6   #include "TH2D.h"
# Line 8 | Line 9
9   #include "TF1.h"
10   #include "UserCode/L1RpcTriggerAnalysis/interface/MuonObj.h"
11   #include "UserCode/L1RpcTriggerAnalysis/interface/Utilities.h"
11 #include <math.h>
12  
13 < using namespace std;
14 <  TH1D *hMuonPt, *hMuonEta, *hMuonPhi;
13 > #include <cmath>
14 >
15 > namespace {
16 >  TH1D *hMuonPt_DIS, *hMuonEta_DIS, *hMuonPhi_DIS;
17    TH2D *hMuonPtVsEta_Tk, *hMuonPtVsEta_Ma, *hMuonPtVsEta_Gl;
18 + }
19 +
20 + AnaMuonDistribution::AnaMuonDistribution(const edm::ParameterSet& cfg)
21 +  : ptMin( cfg.getParameter<double>("ptMin") ),
22 +    minNumberOfMatchedStations( cfg.getParameter<unsigned int>("minNumberOfMatchedStations") ),
23 +    minNumberRpcHits( cfg.getParameter<uint>("minNumberRpcHits") ),
24 +    minNumberDtCscHits( cfg.getParameter<unsigned int>("minNumberDtCscHits") )
25 + { }
26  
27   void AnaMuonDistribution::init(TObjArray& histos)
28   {
29 <  hMuonPt  = new TH1D("hMuonPt","All global muons Pt;Glb.muon p_{T} [GeV];Muons / bin",L1PtScale::nPtBins,L1PtScale::ptBins);  histos.Add(hMuonPt);
30 <  hMuonEta = new TH1D("hMuonEta","All global muons Eta;Glb.muon #eta;Muons / bin",64, -1.6, 1.6);  histos.Add(hMuonEta);
31 <  hMuonPhi = new TH1D("hMuonPhi","All global muons Phi;Glb.muon #phi [rad];Muons / bin",90,-M_PI,M_PI);  histos.Add(hMuonPhi);
29 >  hMuonPt_DIS  = new TH1D("hMuonPt_DIS","All global muons Pt;Glb.muon p_{T} [GeV];Muons / bin",L1PtScale::nPtBins,L1PtScale::ptBins);  histos.Add(hMuonPt_DIS);
30 >  hMuonEta_DIS = new TH1D("hMuonEta_DIS","All global muons Eta;Glb.muon #eta;Muons / bin",96, -2.4, 2.4);  histos.Add(hMuonEta_DIS);
31 >  hMuonPhi_DIS = new TH1D("hMuonPhi_DIS","All global muons Phi;Glb.muon #phi [rad];Muons / bin",90,-M_PI,M_PI);  histos.Add(hMuonPhi_DIS);
32  
33    hMuonPtVsEta_Tk = new TH2D("hMuonPtVsEta_Tk","hMuonPtVsEta_Tk", L1RpcEtaScale::nEtaBins, L1RpcEtaScale::etaBins, L1PtScale::nPtBins, L1PtScale::ptBins); histos.Add(hMuonPtVsEta_Tk);
34    hMuonPtVsEta_Ma = new TH2D("hMuonPtVsEta_Ma","hMuonPtVsEta_Ma", L1RpcEtaScale::nEtaBins, L1RpcEtaScale::etaBins, L1PtScale::nPtBins, L1PtScale::ptBins); histos.Add(hMuonPtVsEta_Ma);
# Line 26 | Line 36 | void AnaMuonDistribution::init(TObjArray
36  
37   }
38  
39 < void AnaMuonDistribution::run(const MuonObj *muon)
39 > bool AnaMuonDistribution::filter(const MuonObj *muon)
40   {
41 <  hMuonPt->Fill(muon->pt());
42 <  hMuonEta->Fill(muon->eta());
43 <  hMuonPhi->Fill(muon->phi());
41 >  if (muon->pt() < ptMin) return false;
42 >  if (muon->nMatchedStations < minNumberOfMatchedStations) return false;
43 >  if (muon->nRPCHits < minNumberRpcHits) return false;
44 >  if (muon->nDTHits + muon->nCSCHits < minNumberDtCscHits) return false;
45 >
46 >  hMuonPt_DIS->Fill(muon->pt());
47 >  hMuonEta_DIS->Fill(muon->eta());
48 >  hMuonPhi_DIS->Fill(muon->phi());
49 >
50    hMuonPtVsEta_Tk->Fill(muon->eta(), muon->pt());
51    if (muon->isMatched() ) hMuonPtVsEta_Ma->Fill(muon->eta(), muon->pt());
52    if (muon->isGlobal()) hMuonPtVsEta_Gl->Fill(muon->eta(), muon->pt());
53 +  return true;
54   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines