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"
|
7 |
#include "TH1D.h"
|
8 |
#include "TGraphErrors.h"
|
9 |
#include "TF1.h"
|
10 |
#include "UserCode/L1RpcTriggerAnalysis/interface/MuonObj.h"
|
11 |
#include "UserCode/L1RpcTriggerAnalysis/interface/Utilities.h"
|
12 |
|
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 |
etaMax (cfg.getParameter<double>("etaMax") ),
|
23 |
minNumberOfMatchedStations( cfg.getParameter<unsigned int>("minNumberOfMatchedStations") ),
|
24 |
minNumberRpcHits( cfg.getParameter<uint>("minNumberRpcHits") ),
|
25 |
minNumberDtCscHits( cfg.getParameter<unsigned int>("minNumberDtCscHits") ),
|
26 |
requireAnyMuon(cfg.getParameter<bool>("requireAnyMuon")),
|
27 |
requireUnique(cfg.getParameter<bool>("requireUnique")),
|
28 |
requireOnlyOne(cfg.getParameter<bool>("requireOnlyOne")),
|
29 |
requireGlobal(cfg.getParameter<bool>("requireGlobal")),
|
30 |
requireInner(cfg.getParameter<bool>("requireInner")),
|
31 |
requireOuter(cfg.getParameter<bool>("requireOuter"))
|
32 |
{ }
|
33 |
|
34 |
void AnaMuonDistribution::init(TObjArray& histos)
|
35 |
{
|
36 |
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);
|
37 |
hMuonEta_DIS = new TH1D("hMuonEta_DIS","All global muons Eta;Glb.muon #eta;Muons / bin",96, -2.4, 2.4); histos.Add(hMuonEta_DIS);
|
38 |
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);
|
39 |
|
40 |
hMuonPtVsEta_Tk = new TH2D("hMuonPtVsEta_Tk","hMuonPtVsEta_Tk", L1RpcEtaScale::nEtaBins, L1RpcEtaScale::etaBins, L1PtScale::nPtBins, L1PtScale::ptBins); histos.Add(hMuonPtVsEta_Tk);
|
41 |
hMuonPtVsEta_Ma = new TH2D("hMuonPtVsEta_Ma","hMuonPtVsEta_Ma", L1RpcEtaScale::nEtaBins, L1RpcEtaScale::etaBins, L1PtScale::nPtBins, L1PtScale::ptBins); histos.Add(hMuonPtVsEta_Ma);
|
42 |
hMuonPtVsEta_Gl = new TH2D("hMuonPtVsEta_Gl","hMuonPtVsEta_Gl", L1RpcEtaScale::nEtaBins, L1RpcEtaScale::etaBins, L1PtScale::nPtBins, L1PtScale::ptBins); histos.Add(hMuonPtVsEta_Gl);
|
43 |
|
44 |
}
|
45 |
|
46 |
bool AnaMuonDistribution::filter(const MuonObj *muon)
|
47 |
{
|
48 |
// std::cout << *muon << std::endl;
|
49 |
if (requireAnyMuon && (muon->nAllMuons==0)) return false;
|
50 |
if (requireOnlyOne && (!muon->nAllMuons==1)) return false;
|
51 |
if (requireUnique && !muon->isUnique) return false;
|
52 |
if (requireGlobal && !muon->isGlobal()) return false;
|
53 |
if (requireInner && !muon->isTracker()) return false;
|
54 |
if (requireOuter && !muon->isOuter()) return false;
|
55 |
if (muon->pt() < ptMin) return false;
|
56 |
if (fabs(muon->eta()) > etaMax) return false;
|
57 |
if (muon->nMatchedStations < minNumberOfMatchedStations) return false;
|
58 |
if (muon->nRPCHits < minNumberRpcHits) return false;
|
59 |
if (muon->nDTHits + muon->nCSCHits < minNumberDtCscHits) return false;
|
60 |
|
61 |
hMuonPt_DIS->Fill(muon->pt());
|
62 |
hMuonEta_DIS->Fill(muon->eta());
|
63 |
hMuonPhi_DIS->Fill(muon->phi());
|
64 |
|
65 |
hMuonPtVsEta_Tk->Fill(muon->eta(), muon->pt());
|
66 |
if (muon->isMatched() ) hMuonPtVsEta_Ma->Fill(muon->eta(), muon->pt());
|
67 |
if (muon->isGlobal()) hMuonPtVsEta_Gl->Fill(muon->eta(), muon->pt());
|
68 |
return true;
|
69 |
}
|