ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Simulation
Tools
RDOAnalysis
src
MdtRDOAnalysis.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 "
MdtRDOAnalysis.h
"
7
#include "
StoreGate/ReadHandle.h
"
8
9
#include <algorithm>
10
#include <math.h>
11
#include <functional>
12
#include <iostream>
13
#include <format>
14
15
namespace
MuonVal
{
16
using namespace
Muon::MuonStationIndex;
17
18
MdtRDOAnalysis::HistoSet::HistoSet
(
const
ServiceHandle<ITHistSvc>
&
histSvc
,
19
const
std::string& basePath,
20
const
StIdx_t
stIndex):
21
stIdx
{stIndex} {
22
23
auto
createHisto = [stIndex, &
histSvc
, &basePath](
const
std::string& hName,
24
const
std::string& hTitle,
25
const
unsigned
nBins,
26
const
float
xLow,
27
const
float
xHigh){
28
TH1*
h
=
new
TH1F(hName.c_str(), hTitle.c_str(), nBins, xLow, xHigh);
29
histSvc
->regHist(std::format(
"/{}/RDO/Station_{}/{}"
,
30
basePath,
31
stIndex != StIdx_t::StUnknown ?
stName
(stIndex) :
"Inclusive"
,
32
hName),
h
).ignore();
33
return
h
;
34
};
35
36
h_subID
= createHisto(
"subDetId"
,
"Subdetector ID"
, 100, 0 , 150);
37
h_mrodID
= createHisto(
"mrodID"
,
"MROD ID"
, 100, 0, 150);
38
h_csmID
= createHisto(
"csmID"
,
"CSM ID"
, 100, 0, 10);
39
h_tdcID
= createHisto(
"tdcID"
,
"TDC ID"
, 100, 0, 50);
40
h_chanID
= createHisto(
"channelID"
,
"Channel ID"
, 100, 0, 50);
41
h_coarse
= createHisto(
"coarseTime"
,
"Drift time (coarse)"
, 100, 0, 100);
42
h_fine
= createHisto(
"fineTime"
,
"Drift time (fine)"
, 100, 0, 50);
43
h_width
= createHisto(
"width"
,
"Width"
, 100, 0, 500);
44
}
45
46
StatusCode
MdtRDOAnalysis::initialize
() {
47
ATH_MSG_DEBUG
(
"Initializing MdtRDOAnalysis"
);
48
49
// This will check that the properties were initialized
50
// properly by job configuration.
51
ATH_CHECK
(
m_inputKey
.initialize());
52
ATH_CHECK
(
m_idHelperSvc
.retrieve());
53
54
for
(
int
s =
static_cast<
int
>
(StIdx_t::StUnknown); s < static_cast<int>(StIdx_t::StIndexMax); ++s) {
55
auto
stIdx =
static_cast<
StIdx_t
>
(s);
56
m_histos
.emplace_back(
histSvc
(),
m_path
, stIdx);
57
}
58
59
return
StatusCode::SUCCESS;
60
}
61
62
StatusCode
MdtRDOAnalysis::execute
(
const
EventContext& ctx) {
63
const
MdtCsmContainer
* csmCont{
nullptr
};
64
ATH_CHECK
(
SG::get
(csmCont,
m_inputKey
, ctx));
65
66
for
(
const
MdtCsm
* csm : *csmCont) {
67
std::vector<unsigned> fillMe{};
68
const
StIdx_t
stIdx =
m_idHelperSvc
->stationIndex(csm->identify());
69
for
(
unsigned
h
=0 ;
h
<
m_histos
.size() ; ++
h
) {
70
if
(
m_histos
[
h
].stIdx == StIdx_t::StUnknown ||
71
m_histos
[
h
].stIdx == stIdx) {
72
fillMe.push_back(
h
);
73
}
74
const
uint16_t subID = csm->SubDetId();
75
const
uint16_t mrodID = csm->MrodId();
76
const
uint16_t csmID = csm->CsmId();
77
for
(
unsigned
h
: fillMe) {
78
m_histos
[
h
].h_subID->Fill(subID);
79
m_histos
[
h
].h_mrodID->Fill(mrodID);
80
m_histos
[
h
].h_csmID->Fill(csmID);
81
}
82
for
(
const
MdtAmtHit
*
hit
: *csm) {
83
const
uint16_t tdcID =
hit
->tdcId();
84
const
uint16_t chanID =
hit
->channelId();
85
const
uint16_t coarseTime =
hit
->coarse();
86
const
uint16_t fineTime =
hit
->fine();
87
const
uint16_t widthComb =
hit
->width();
88
for
(
auto
h
: fillMe) {
89
m_histos
[
h
].h_tdcID->Fill(tdcID);
90
m_histos
[
h
].h_chanID->Fill(chanID);
91
m_histos
[
h
].h_coarse->Fill(coarseTime);
92
m_histos
[
h
].h_fine->Fill(fineTime);
93
m_histos
[
h
].h_width->Fill(widthComb);
94
}
95
}
96
}
97
}
98
return
StatusCode::SUCCESS;
99
}
100
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
hit
bool hit(const Container &ids, int pdgId)
Definition
JetIRCSafeLabelTool.cxx:64
MdtRDOAnalysis.h
ReadHandle.h
Handle class for reading from StoreGate.
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
MdtAmtHit
MDT RDO's : data from a single channel of an AMT Atlas Muon TDC.
Definition
MdtAmtHit.h:20
MdtCsmContainer
This container provides acces to the MDT RDOs.
Definition
MdtCsmContainer.h:22
MdtCsm
MDT RDOs : Chamber Service Module, container of AmtHits of a single Mdt chamber.
Definition
MdtCsm.h:22
MuonVal::MdtRDOAnalysis::m_histos
std::vector< HistoSet > m_histos
Definition
MdtRDOAnalysis.h:57
MuonVal::MdtRDOAnalysis::execute
virtual StatusCode execute(const EventContext &ctx) override final
Execute method.
Definition
MdtRDOAnalysis.cxx:62
MuonVal::MdtRDOAnalysis::m_path
Gaudi::Property< std::string > m_path
Definition
MdtRDOAnalysis.h:31
MuonVal::MdtRDOAnalysis::m_inputKey
SG::ReadHandleKey< MdtCsmContainer > m_inputKey
Input read handle key.
Definition
MdtRDOAnalysis.h:27
MuonVal::MdtRDOAnalysis::initialize
virtual StatusCode initialize() override final
Definition
MdtRDOAnalysis.cxx:46
MuonVal::MdtRDOAnalysis::StIdx_t
Muon::MuonStationIndex::StIndex StIdx_t
Definition
MdtRDOAnalysis.h:34
MuonVal::MdtRDOAnalysis::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Service handle of the IdHelperSvc.
Definition
MdtRDOAnalysis.h:29
ServiceHandle
Definition
ClusterMakerTool.h:36
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::MdtRDOAnalysis::HistoSet::h_mrodID
TH1 * h_mrodID
Definition
MdtRDOAnalysis.h:49
MuonVal::MdtRDOAnalysis::HistoSet::h_csmID
TH1 * h_csmID
Definition
MdtRDOAnalysis.h:50
MuonVal::MdtRDOAnalysis::HistoSet::h_chanID
TH1 * h_chanID
Definition
MdtRDOAnalysis.h:52
MuonVal::MdtRDOAnalysis::HistoSet::h_tdcID
TH1 * h_tdcID
Definition
MdtRDOAnalysis.h:51
MuonVal::MdtRDOAnalysis::HistoSet::h_subID
TH1 * h_subID
Definition
MdtRDOAnalysis.h:48
MuonVal::MdtRDOAnalysis::HistoSet::HistoSet
HistoSet()=default
Default constructor.
MuonVal::MdtRDOAnalysis::HistoSet::h_fine
TH1 * h_fine
Definition
MdtRDOAnalysis.h:54
MuonVal::MdtRDOAnalysis::HistoSet::h_width
TH1 * h_width
Definition
MdtRDOAnalysis.h:55
MuonVal::MdtRDOAnalysis::HistoSet::h_coarse
TH1 * h_coarse
Definition
MdtRDOAnalysis.h:53
MuonVal::MdtRDOAnalysis::HistoSet::stIdx
StIdx_t stIdx
Definition
MdtRDOAnalysis.h:47
Generated on
for ATLAS Offline Software by
1.17.0