ATLAS Offline Software
Loading...
Searching...
No Matches
RecoLumiPlots.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3*/
4
5#include <utility>
6
8
9RecoLumiPlots::RecoLumiPlots(PlotBase* pParent, const std::string& sDir, std::string recObj):PlotBase(pParent, sDir),
10
11 m_hNSegment_LB_1D(nullptr),
12 m_hNMuonTrack_LB_1D(nullptr),
13 m_hNMuon_LB_1D(nullptr),
14 m_hNResonance_LB_1D(nullptr),
15
16 m_hNSegment_LB(nullptr),
17 m_hNMuonTrack_LB(nullptr),
18 m_hNMuon_LB(nullptr),
19 m_hNResonance_LB(nullptr),
20
21 type(std::move(recObj)),
22 name("other")
23{}
24
26{
27
28 //Specify the names for different resonances
29 std::string Zsig("Z");
30 std::string Jsig("Jpsi");
31 std::string CBMuons("CBMuons");
32 std::string OtherMuons("NonCBMuons");
33
34 if (!type.compare(Zsig)) {name = "Z"; }
35 else if (!type.compare(Jsig)) {name = "J/#psi"; }
36 else if (!type.compare(CBMuons)) {name = "CBMuons"; }
37 else if (!type.compare(OtherMuons)) {name = "NonCBMuons";}
38 else {name = "other"; }
39
40 n_lbs = 2500;
41
42 //Make sure the 1D hists has the same dimension as the 2D!
43 if (name == "other"){
44 m_hNSegment_LB = Book2D("nSegment_LB_2D", "Number of Muon Segments Per LumiBlock;LumiBlock;Number of Segments", n_lbs, -0.5, (float)(n_lbs)-0.5, 100, 0.5, 101.5);
45 m_hNMuonTrack_LB = Book2D("nMuonTrack_LB_2D", "Number of Muon MS Tracks Per LumiBlock;LumiBlock;Number of Tracks", n_lbs, -0.5, (float)(n_lbs)-0.5, 21, 0.5, 21.5);
46 m_hNSegment_LB_1D = Book1D("nSegment_LB", "Number of Muon Segments Per LumiBlock;LumiBlock;Number of Segments", n_lbs, -0.5, (float)(n_lbs)-0.5);
47 m_hNMuonTrack_LB_1D = Book1D("nMuonTrack_LB", "Number of Muon MS Tracks Per LumiBlock;LumiBlock;Number of Tracks", n_lbs, -0.5, (float)(n_lbs)-0.5);
48 }
49 else if (name == "CBMuons"){
50 m_hNMuon_LB = Book2D("nMuon_LB_2D", "Number of Muons Per LumiBlock;LumiBlock;Nmuons", n_lbs, -0.5, (float)(n_lbs)-0.5, 21, 0.5, 21.5);
51 m_hNMuon_LB_1D = Book1D("nMuon_LB", "Number of Muons Per LumiBlock;LumiBlock;Nmuons", n_lbs, -0.5, (float)(n_lbs)-0.5);
52 }
53 else if (name == "NonCBMuons"){
54 m_hNMuon_LB = Book2D("nMuon_LB_2D", "Number of non-CB Muons Per LumiBlock;LumiBlock;Nmuons", n_lbs, -0.5, (float)(n_lbs)-0.5, 21, 0.5, 21.5);
55 m_hNMuon_LB_1D = Book1D("nMuon_LB", "Number of non-CB Muons Per LumiBlock;LumiBlock;Nmuons", n_lbs, -0.5, (float)(n_lbs)-0.5);
56 }
57 else if (name == "Z" || name == "J/#psi"){
58 m_hNResonance_LB = Book2D("n" + type + "_LB_2D", "Number of " + name + " Per LumiBlock;LumiBlock;Number of " + name, n_lbs, -0.5, (float)(n_lbs)-0.5, 5, 0.5, 5.5);
59 m_hNResonance_LB_1D = Book1D("n" + type + "_LB", "Number of " + name + " Per LumiBlock;LumiBlock;Number of " + name, n_lbs, -0.5, (float)(n_lbs)-0.5);
60 }
61
62}
63
64//fill Segment related lb plots
65void RecoLumiPlots::fill(const xAOD::MuonSegmentContainer* MuonSegments, int current_lb, float inst_lumi_bcid, float inst_lumi_lb) {
66
67 m_hNSegment_LB->Fill(current_lb, MuonSegments->size() + inst_lumi_bcid - inst_lumi_bcid + inst_lumi_lb - inst_lumi_lb);
68
69}
70
71//fill Track related plots
72void RecoLumiPlots::fill(const xAOD::TrackParticleContainer* MSTracks, int current_lb, float inst_lumi_bcid, float inst_lumi_lb){
73
74 m_hNMuonTrack_LB->Fill(current_lb, MSTracks->size() + inst_lumi_bcid - inst_lumi_bcid + inst_lumi_lb - inst_lumi_lb);
75
76}
77
78//fill CB muon related plots
79void RecoLumiPlots::fill_CB(const xAOD::MuonContainer* Muons, int current_lb, float inst_lumi_bcid, float inst_lumi_lb){
80
81 int NMuIDco = 0;
82
83 for(const auto mu : *Muons) {
84
85 //do a muon quality cut: 0 tight, 1 medium, 2 loss
86 if(mu->muonType() == xAOD::Muon::Combined){NMuIDco++;}
87
88 }
89
90 //only do this for combined muons
91 m_hNMuon_LB->Fill(current_lb, NMuIDco + inst_lumi_bcid - inst_lumi_bcid + inst_lumi_lb - inst_lumi_lb);
92
93}
94
95//fill other muon related plots
96void RecoLumiPlots::fill_Other(const xAOD::MuonContainer* Muons, int current_lb, float inst_lumi_bcid, float inst_lumi_lb){
97
98 int NMuIDco = 0;
99
100 for(const auto mu : *Muons) {
101
102 //do a muon quality cut: 0 tight, 1 medium, 2 loss
103 if(mu->muonType() != xAOD::Muon::Combined){NMuIDco++;}
104
105 }
106
107 //only do this for combined muons
108 m_hNMuon_LB->Fill(current_lb, NMuIDco + inst_lumi_bcid - inst_lumi_bcid + inst_lumi_lb - inst_lumi_lb);
109
110}
111
112//fill muon related plots
113void RecoLumiPlots::fill(const std::vector<std::pair<const xAOD::Muon*, const xAOD::Muon*> >& resonances, int current_lb, float inst_lumi_bcid, float inst_lumi_lb){
114
115 int Nresonance = resonances.size();
116
117 //only do this for combined muons
118 m_hNResonance_LB->Fill(current_lb, Nresonance + inst_lumi_bcid - inst_lumi_bcid + inst_lumi_lb - inst_lumi_lb);//playing really dumb here
119
120}
121
size_type size() const noexcept
Returns the number of elements in the collection.
TH1D * Book1D(const std::string &name, const std::string &labels, int nBins, float start, float end, bool prependDir=true)
Book a TH1D histogram.
Definition PlotBase.cxx:94
PlotBase(PlotBase *parent, const std::string &sDir)
Definition PlotBase.cxx:29
TH2F * Book2D(const std::string &name, const std::string &labels, int nBinsX, float startX, float endX, int nBinsY, float startY, float endY, bool prependDir=true)
Book a TH2F histogram.
Definition PlotBase.cxx:123
RecoLumiPlots(PlotBase *pParent, const std::string &sDir, std::string recObj)
std::string name
TH2 * m_hNMuonTrack_LB
void fill_CB(const xAOD::MuonContainer *Muons, int current_lb, float inst_lumi_bcid, float inst_lumi_lb)
void fill_Other(const xAOD::MuonContainer *Muons, int current_lb, float inst_lumi_bcid, float inst_lumi_lb)
TH2 * m_hNResonance_LB
std::string type
TH1 * m_hNResonance_LB_1D
TH1 * m_hNSegment_LB_1D
void fill(const xAOD::MuonSegmentContainer *MuonSegments, int current_lb, float inst_lumi_bcid, float inst_lumi_lb)
TH1 * m_hNMuonTrack_LB_1D
Definition Muons.py:1
STL namespace.
MuonSegmentContainer_v1 MuonSegmentContainer
Definition of the current "MuonSegment container version".
TrackParticleContainer_v1 TrackParticleContainer
Definition of the current "TrackParticle container version".
MuonContainer_v1 MuonContainer
Definition of the current "Muon container version".