1 |
#include "UserCode/L1RpcTriggerAnalysis/interface/AnaSiMuDistribution.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 "UserCode/L1RpcTriggerAnalysis/interface/Utilities.h"
|
9 |
#include "UserCode/L1RpcTriggerAnalysis/interface/EventObj.h"
|
10 |
#include "UserCode/L1RpcTriggerAnalysis/interface/HitSpecObj.h"
|
11 |
#include "UserCode/L1RpcTriggerAnalysis/interface/TrackObj.h"
|
12 |
|
13 |
#include <cmath>
|
14 |
#include <algorithm>
|
15 |
|
16 |
namespace {
|
17 |
TH1D *hSiMuPt_DIS, *hSiMuEta_DIS, *hSiMuPhi_DIS;
|
18 |
TH1D *hSiMuPt_INP, *hSiMuEta_INP, *hSiMuPhi_INP;
|
19 |
}
|
20 |
|
21 |
AnaSiMuDistribution::AnaSiMuDistribution(const edm::ParameterSet& cfg)
|
22 |
: ptMin( cfg.getParameter<double>("ptMin") ),
|
23 |
ptMax( cfg.getParameter<double>("ptMax") ),
|
24 |
etaMinRef (cfg.getParameter<double>("absEtaMinRef") ),
|
25 |
etaMaxRef (cfg.getParameter<double>("absEtaMaxRef") ),
|
26 |
phiMinRef (cfg.getParameter<double>("phiMinRef") ),
|
27 |
phiMaxRef (cfg.getParameter<double>("phiMaxRef") ),
|
28 |
checkMatchedDets (cfg.exists("matchedDets")),
|
29 |
matchedDets(checkMatchedDets ? cfg.getParameter< std::vector<uint32_t> >("matchedDets") : std::vector<uint32_t>())
|
30 |
{ }
|
31 |
|
32 |
void AnaSiMuDistribution::init(TObjArray& histos)
|
33 |
{
|
34 |
hSiMuPt_DIS = new TH1D("hSiMuPt_DIS","All global SiMus Pt;Glb.SiMu p_{T} [GeV];SiMus / bin",L1PtScale::nPtBins,L1PtScale::ptBins); histos.Add(hSiMuPt_DIS);
|
35 |
hSiMuEta_DIS = new TH1D("hSiMuEta_DIS","All global SiMus Eta;Glb.SiMu #eta;SiMus / bin",96, -2.4, 2.4); histos.Add(hSiMuEta_DIS);
|
36 |
hSiMuPhi_DIS = new TH1D("hSiMuPhi_DIS","All global SiMus Phi;Glb.SiMu #phi [rad];SiMus / bin",90,-M_PI,M_PI); histos.Add(hSiMuPhi_DIS);
|
37 |
hSiMuPt_INP = new TH1D("hSiMuPt_INP","All global SiMus Pt;Glb.SiMu p_{T} [GeV];SiMus / bin",L1PtScale::nPtBins,L1PtScale::ptBins); histos.Add(hSiMuPt_INP);
|
38 |
hSiMuEta_INP = new TH1D("hSiMuEta_INP","All global SiMus Eta;Glb.SiMu #eta;SiMus / bin",96, -2.4, 2.4); histos.Add(hSiMuEta_INP);
|
39 |
hSiMuPhi_INP = new TH1D("hSiMuPhi_INP","All global SiMus Phi;Glb.SiMu #phi [rad];SiMus / bin",90,-M_PI,M_PI); histos.Add(hSiMuPhi_INP);
|
40 |
}
|
41 |
|
42 |
bool AnaSiMuDistribution::filter(const EventObj* ev, const TrackObj * simu, const HitSpecObj * hitSpec)
|
43 |
{
|
44 |
if (!hitSpec) return false;
|
45 |
if (!simu) return false;
|
46 |
uint32_t rawId = hitSpec->rawId();
|
47 |
|
48 |
hSiMuPt_INP->Fill(simu->pt());
|
49 |
hSiMuEta_INP->Fill(simu->eta());
|
50 |
hSiMuPhi_INP->Fill(simu->phi());
|
51 |
|
52 |
if (simu->pt() < ptMin) return false;
|
53 |
if (simu->pt() > ptMax) return false;
|
54 |
if ( fabs(hitSpec->position().eta()) < etaMinRef) return false;
|
55 |
if ( fabs(hitSpec->position().eta()) > etaMaxRef) return false;
|
56 |
if ( hitSpec->position().phi() < phiMinRef) return false;
|
57 |
if ( hitSpec->position().phi() > phiMaxRef) return false;
|
58 |
|
59 |
if (checkMatchedDets && matchedDets.end()==find(matchedDets.begin(),matchedDets.end(), rawId) ) return false;
|
60 |
|
61 |
hSiMuPt_DIS->Fill(simu->pt());
|
62 |
hSiMuEta_DIS->Fill(simu->eta());
|
63 |
hSiMuPhi_DIS->Fill(simu->phi());
|
64 |
|
65 |
return true;
|
66 |
}
|
67 |
|