ATLAS Offline Software
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 
9 RecoLumiPlots::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
65 void 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
72 void 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
79 void 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
96 void 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
113 void 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 
RecoLumiPlots.h
RecoLumiPlots::m_hNSegment_LB
TH2 * m_hNSegment_LB
Definition: RecoLumiPlots.h:32
PlotBase
Definition: PlotBase.h:34
RecoLumiPlots::RecoLumiPlots
RecoLumiPlots(PlotBase *pParent, const std::string &sDir, std::string recObj)
Definition: RecoLumiPlots.cxx:9
RecoLumiPlots::m_hNMuon_LB
TH2 * m_hNMuon_LB
Definition: RecoLumiPlots.h:34
RecoLumiPlots::m_hNMuon_LB_1D
TH1 * m_hNMuon_LB_1D
Definition: RecoLumiPlots.h:29
python.copyTCTOutput.sDir
sDir
Definition: copyTCTOutput.py:60
RecoLumiPlots::m_hNResonance_LB_1D
TH1 * m_hNResonance_LB_1D
Definition: RecoLumiPlots.h:30
PlotBase::Book2D
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::name
std::string name
Definition: RecoLumiPlots.h:41
PlotBase::Book1D
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
RecoLumiPlots::m_hNMuonTrack_LB
TH2 * m_hNMuonTrack_LB
Definition: RecoLumiPlots.h:33
RecoLumiPlots::initializePlots
void initializePlots()
Definition: RecoLumiPlots.cxx:25
RecoLumiPlots::type
std::string type
Definition: RecoLumiPlots.h:40
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
Trk::Combined
@ Combined
Definition: TrackSummaryTool.h:32
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
RecoLumiPlots::m_hNSegment_LB_1D
TH1 * m_hNSegment_LB_1D
Definition: RecoLumiPlots.h:27
RecoLumiPlots::m_hNMuonTrack_LB_1D
TH1 * m_hNMuonTrack_LB_1D
Definition: RecoLumiPlots.h:28
RecoLumiPlots::n_lbs
int n_lbs
Definition: RecoLumiPlots.h:37
RecoLumiPlots::fill_Other
void fill_Other(const xAOD::MuonContainer *Muons, int current_lb, float inst_lumi_bcid, float inst_lumi_lb)
Definition: RecoLumiPlots.cxx:96
Muons
Definition: Muons.py:1
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
RecoLumiPlots::fill_CB
void fill_CB(const xAOD::MuonContainer *Muons, int current_lb, float inst_lumi_bcid, float inst_lumi_lb)
Definition: RecoLumiPlots.cxx:79
RecoLumiPlots::m_hNResonance_LB
TH2 * m_hNResonance_LB
Definition: RecoLumiPlots.h:35
RecoLumiPlots::fill
void fill(const xAOD::MuonSegmentContainer *MuonSegments, int current_lb, float inst_lumi_bcid, float inst_lumi_lb)
Definition: RecoLumiPlots.cxx:65
CaloNoise_fillDB.mu
mu
Definition: CaloNoise_fillDB.py:53
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.