ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Simulation
Tools
RDOAnalysis
src
TgcRDOAnalysis.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
6
#include "
TgcRDOAnalysis.h
"
7
#include "
StoreGate/ReadHandle.h
"
8
9
#include <format>
10
11
namespace
MuonVal
{
12
TgcRDOAnalysis::HistoSet::HistoSet
(
const
TgcIdHelper
& idHelper,
13
const
ServiceHandle<ITHistSvc>
&
histSvc
,
14
const
std::string& basePath,
15
const
int
stName
):
16
stationName
{
stName
}{
17
auto
createHisto = [&](
const
std::string& hName,
18
const
std::string& hTitle,
19
const
unsigned
nBins,
20
const
float
xLow,
21
const
float
xHigh) {
22
TH1*
h
=
new
TH1F(hName.c_str(), hTitle.c_str(), nBins, xLow, xHigh);
23
h
->Sumw2();
24
histSvc
->regHist(std::format(
"/{}/RDO/Station_{}/{}"
,
25
basePath,
26
stName
> 0 ? idHelper.
stationNameString
(
stName
) :
"Inclusive"
,
27
hName),
h
).ignore();
28
return
h
;
29
};
30
h_tgcID
= createHisto(
"tgcID"
,
"TGC ID"
, 100, 0, 25);
31
h_tgcSubDetID
= createHisto(
"tgcSubDetID"
,
"TGC sub-detector ID"
, 100, 0, 110);
32
h_tgcRodID
= createHisto(
"tgcRodID"
,
"TGC ROD ID"
, 100, 0, 15);
33
h_tgcTrigType
= createHisto(
"tgcTrigType"
,
"TGC trigger type"
, 100, 0, 2);
34
h_tgcBcID
= createHisto(
"tgcBcID"
,
"TGC BCID"
, 100, 0, 2);
35
h_tgcL1ID
= createHisto(
"tgcL1ID"
,
"TGC L1ID"
, 100, 0, 2);
36
h_bcTag
= createHisto(
"bcTag"
,
"BC Tag"
, 100, 0, 5);
37
h_subDetID
= createHisto(
"subDetID"
,
"Sub-detector ID"
, 100, 0, 110);
38
h_rodID
= createHisto(
"rodID"
,
"ROD ID"
, 100, 0, 15);
39
h_sswID
= createHisto(
"sswID"
,
"SSW ID"
, 100, 0, 10);
40
h_slbID
= createHisto(
"slbID"
,
"SLB ID"
, 100, 0, 30);
41
h_bcID
= createHisto(
"bcID"
,
"BCID"
, 100, 0, 10);
42
h_l1ID
= createHisto(
"l1ID"
,
"L1ID"
, 100, 0, 10);
43
h_type
= createHisto(
"type"
,
"type (hit or coinc)"
, 100, 0, 10);
44
h_slbType
= createHisto(
"slbType"
,
"SLB type"
, 100, 0, 10);
45
h_bitPos
= createHisto(
"bitPos"
,
"Bitmap position"
, 100, 0, 220);
46
h_track
= createHisto(
"track"
,
"tracklet"
, 100, 0, 10);
47
h_adj
= createHisto(
"adj"
,
"Adjacent"
, 100, 0, 2);
48
}
49
50
51
StatusCode
TgcRDOAnalysis::initialize
() {
52
ATH_CHECK
(
m_inputKey
.initialize());
53
ATH_CHECK
(
m_idHelperSvc
.retrieve());
54
55
std::set<int> stationNames{-1};
56
const
TgcIdHelper
& idHelper{
m_idHelperSvc
->tgcIdHelper()};
57
std::for_each(idHelper.
module_begin
(), idHelper.
module_end
(),
58
[&stationNames, &idHelper](
const
Identifier
&
id
) {
59
stationNames.insert(idHelper.stationName(id));
60
});
61
for
(
const
int
st : stationNames) {
62
m_histos
.emplace_back(idHelper,
histSvc
(),
m_path
, st);
63
}
64
65
return
StatusCode::SUCCESS;
66
}
67
68
StatusCode
TgcRDOAnalysis::execute
(
const
EventContext& ctx) {
69
const
TgcRdoContainer
* rdos{
nullptr
};
70
ATH_CHECK
(
SG::get
(rdos,
m_inputKey
, ctx));
71
for
(
const
TgcRdo
* rdo : *rdos) {
72
const
uint16_t tgcSubDetID = rdo->subDetectorId();
73
const
uint16_t tgcID = rdo->identify();
74
const
uint16_t tgcTrigType = rdo->triggerType();
75
const
uint16_t tgcRodID = rdo->rodId();
76
const
uint16_t tgcBcID = rdo->bcId();
77
const
uint16_t tgcL1ID = rdo->l1Id();
78
79
std::vector<unsigned> fillMe{};
81
for
(
unsigned
h
= 0 ;
h
<
m_histos
.size(); ++
h
) {
82
if
(
m_histos
[
h
].stationName == -1) {
83
fillMe.push_back(
h
);
84
}
85
}
86
87
for
(
int
h
: fillMe) {
88
m_histos
[
h
].h_tgcID->Fill(tgcID);
89
m_histos
[
h
].h_tgcSubDetID->Fill(tgcSubDetID);
90
m_histos
[
h
].h_tgcRodID->Fill(tgcRodID);
91
m_histos
[
h
].h_tgcTrigType->Fill(tgcTrigType);
92
m_histos
[
h
].h_tgcBcID->Fill(tgcBcID);
93
m_histos
[
h
].h_tgcL1ID->Fill(tgcL1ID);
94
}
95
96
for
(
const
TgcRawData
* channel: *rdo) {
97
const
uint16_t bctag = channel->bcTag();
98
const
uint16_t subDetID = channel->subDetectorId();
99
const
uint16_t rodID = channel->rodId();
100
const
uint16_t sswID = channel->sswId();
101
const
uint16_t slbID = channel->slbId();
102
const
uint16_t bcID = channel->bcId();
103
const
uint16_t l1ID = channel->l1Id();
104
TgcRawData::DataType
type_var = channel->type();
105
TgcRawData::SlbType
slbType_var = channel->slbType();
106
const
uint16_t bitPos = channel->bitpos();
107
const
uint16_t track = channel->tracklet();
108
const
bool
adj = channel->isAdjacent();
109
110
for
(
int
h
: fillMe) {
111
m_histos
[
h
].h_bcTag->Fill(bctag);
112
m_histos
[
h
].h_subDetID->Fill(subDetID);
113
m_histos
[
h
].h_rodID->Fill(rodID);
114
m_histos
[
h
].h_sswID->Fill(sswID);
115
m_histos
[
h
].h_slbID->Fill(slbID);
116
m_histos
[
h
].h_bcID->Fill(bcID);
117
m_histos
[
h
].h_l1ID->Fill(l1ID);
118
m_histos
[
h
].h_type->Fill(type_var);
119
m_histos
[
h
].h_slbType->Fill(slbType_var);
120
if
(type_var== 0) {
121
m_histos
[
h
].h_bitPos->Fill(bitPos);
122
m_histos
[
h
].h_track->Fill(track);
123
m_histos
[
h
].h_adj->Fill(adj);
124
}
125
}
126
}
127
}
128
return
StatusCode::SUCCESS;
129
}
130
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ReadHandle.h
Handle class for reading from StoreGate.
TgcRDOAnalysis.h
h
Header file for AthHistogramAlgorithm.
AthHistogramAlgorithm::histSvc
const ServiceHandle< ITHistSvc > & histSvc() const
The standard THistSvc (for writing histograms and TTrees and more to a root file) Returns (kind of) a...
Definition
AthHistogramAlgorithm.h:113
MuonIdHelper::module_end
const_id_iterator module_end() const
Definition
MuonIdHelper.cxx:763
MuonIdHelper::module_begin
const_id_iterator module_begin() const
Iterators over full set of ids.
Definition
MuonIdHelper.cxx:761
MuonIdHelper::stationNameString
const std::string & stationNameString(const Identifier &id) const
Definition
MuonIdHelper.cxx:839
MuonVal::TgcRDOAnalysis::m_path
Gaudi::Property< std::string > m_path
Definition
TgcRDOAnalysis.h:34
MuonVal::TgcRDOAnalysis::execute
virtual StatusCode execute(const EventContext &ctx) override final
Execute method.
Definition
TgcRDOAnalysis.cxx:68
MuonVal::TgcRDOAnalysis::initialize
virtual StatusCode initialize() override final
Definition
TgcRDOAnalysis.cxx:51
MuonVal::TgcRDOAnalysis::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Service handle of the IdHelperSvc.
Definition
TgcRDOAnalysis.h:31
MuonVal::TgcRDOAnalysis::m_inputKey
SG::ReadHandleKey< TgcRdoContainer > m_inputKey
Definition
TgcRDOAnalysis.h:28
MuonVal::TgcRDOAnalysis::m_histos
std::vector< HistoSet > m_histos
Definition
TgcRDOAnalysis.h:68
ServiceHandle
Definition
ClusterMakerTool.h:36
TgcIdHelper
Definition
TgcIdHelper.h:50
TgcRawData
An unit object of TGC ROD output.
Definition
TgcRawData.h:23
TgcRawData::SlbType
SlbType
Definition
TgcRawData.h:31
TgcRawData::DataType
DataType
Definition
TgcRawData.h:42
TgcRdoContainer
Definition
TgcRdoContainer.h:25
TgcRdo
Definition
TgcRdo.h:22
Identifier
Definition
IdentifierFieldParser.cxx:14
MuonVal
Class to store array like branches into the n-tuples.
Definition
HitValAlg.cxx:19
Muon::MuonStationIndex::stName
const std::string & stName(StIndex index)
convert StIndex into a string
Definition
MuonStationIndex.cxx:105
SG::get
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
Definition
ReadCondHandle.h:282
MuonVal::TgcRDOAnalysis::HistoSet::h_bcTag
TH1 * h_bcTag
Definition
TgcRDOAnalysis.h:55
MuonVal::TgcRDOAnalysis::HistoSet::h_tgcSubDetID
TH1 * h_tgcSubDetID
Definition
TgcRDOAnalysis.h:50
MuonVal::TgcRDOAnalysis::HistoSet::h_tgcBcID
TH1 * h_tgcBcID
Definition
TgcRDOAnalysis.h:53
MuonVal::TgcRDOAnalysis::HistoSet::h_tgcTrigType
TH1 * h_tgcTrigType
Definition
TgcRDOAnalysis.h:52
MuonVal::TgcRDOAnalysis::HistoSet::h_l1ID
TH1 * h_l1ID
Definition
TgcRDOAnalysis.h:61
MuonVal::TgcRDOAnalysis::HistoSet::h_tgcID
TH1 * h_tgcID
Definition
TgcRDOAnalysis.h:49
MuonVal::TgcRDOAnalysis::HistoSet::h_tgcL1ID
TH1 * h_tgcL1ID
Definition
TgcRDOAnalysis.h:54
MuonVal::TgcRDOAnalysis::HistoSet::h_sswID
TH1 * h_sswID
Definition
TgcRDOAnalysis.h:58
MuonVal::TgcRDOAnalysis::HistoSet::h_type
TH1 * h_type
Definition
TgcRDOAnalysis.h:62
MuonVal::TgcRDOAnalysis::HistoSet::h_rodID
TH1 * h_rodID
Definition
TgcRDOAnalysis.h:57
MuonVal::TgcRDOAnalysis::HistoSet::h_slbID
TH1 * h_slbID
Definition
TgcRDOAnalysis.h:59
MuonVal::TgcRDOAnalysis::HistoSet::h_track
TH1 * h_track
Definition
TgcRDOAnalysis.h:65
MuonVal::TgcRDOAnalysis::HistoSet::h_bcID
TH1 * h_bcID
Definition
TgcRDOAnalysis.h:60
MuonVal::TgcRDOAnalysis::HistoSet::h_subDetID
TH1 * h_subDetID
Definition
TgcRDOAnalysis.h:56
MuonVal::TgcRDOAnalysis::HistoSet::stationName
int stationName
Definition
TgcRDOAnalysis.h:48
MuonVal::TgcRDOAnalysis::HistoSet::h_adj
TH1 * h_adj
Definition
TgcRDOAnalysis.h:66
MuonVal::TgcRDOAnalysis::HistoSet::HistoSet
HistoSet(const TgcIdHelper &idHelper, const ServiceHandle< ITHistSvc > &histSvc, const std::string &basePath, const int stName)
Constructor instantiating the monitoring histograms.
Definition
TgcRDOAnalysis.cxx:12
MuonVal::TgcRDOAnalysis::HistoSet::h_bitPos
TH1 * h_bitPos
Definition
TgcRDOAnalysis.h:64
MuonVal::TgcRDOAnalysis::HistoSet::h_slbType
TH1 * h_slbType
Definition
TgcRDOAnalysis.h:63
MuonVal::TgcRDOAnalysis::HistoSet::h_tgcRodID
TH1 * h_tgcRodID
Definition
TgcRDOAnalysis.h:51
Generated on
for ATLAS Offline Software by
1.17.0