ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Simulation
G4Atlas
G4AtlasTests
src
RPCHitsTestTool.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
RPCHitsTestTool.h
"
6
7
#include "Identifier/Identifier.h"
8
#include "
GeoAdaptors/GeoMuonHits.h
"
9
10
#include "
MuonReadoutGeometry/MuonDetectorManager.h
"
11
#include "
MuonReadoutGeometry/RpcReadoutElement.h
"
12
13
#include "
MuonSimEvent/RPCSimHitCollection.h
"
14
#include "
MuonSimEvent/RPCSimHit.h
"
15
16
#include "
MuonSimEvent/RpcHitIdHelper.h
"
17
#include "
MuonIdHelpers/RpcIdHelper.h
"
18
19
#include "
GeneratorObjects/McEventCollection.h
"
20
#include "CLHEP/Vector/LorentzVector.h"
21
22
#include <TH2D.h>
23
#include "TTree.h"
24
25
Identifier
RPCHitsTestTool::getIdentifier
(
HitID
rpchit) {
26
const
RpcHitIdHelper
* rpchelper =
RpcHitIdHelper::GetHelper
(
m_pRpcIdHelper
->gasGapMax());
27
std::string rpc_stname = rpchelper->
GetStationName
(rpchit);
28
int
rpc_steta = rpchelper->
GetZSector
(rpchit);
29
int
rpc_stphi = rpchelper->
GetPhiSector
(rpchit);
30
int
rpc_dbr = rpchelper->
GetDoubletR
(rpchit);
31
int
rpc_dbz = rpchelper->
GetDoubletZ
(rpchit);
32
int
rpc_dbp = rpchelper->
GetDoubletPhi
(rpchit);
33
int
rpc_gg = rpchelper->
GetGasGapLayer
(rpchit);
34
int
rpc_mfi = rpchelper->
GetMeasuresPhi
(rpchit);
35
int
rpc_strip = 1;
//rpchelper->GetStrip(rpchit);
36
37
// Create the offline identifiers, fill them with hit info. Ready to be
38
// accessed and retrieve info. Currently not used in this code except for
39
// some checks.
40
Identifier
offid =
m_pRpcIdHelper
->channelID(rpc_stname, rpc_steta, rpc_stphi, rpc_dbr, rpc_dbz, rpc_dbp, rpc_gg, rpc_mfi, rpc_strip);
41
if
(offid == 0) {
42
ATH_MSG_FATAL
(
"RPC : Cannot build a valid Identifier; skip "
);
43
}
44
45
return
offid;
46
}
47
48
StatusCode
RPCHitsTestTool::checkIdentifier
(
Identifier
offid) {
49
50
const
MuonGM::RpcReadoutElement
* descriptor =
m_pMuonMgr
->getRpcReadoutElement(offid);
51
if
(!descriptor) {
52
ATH_MSG_FATAL
(
"RPC readout element not found for Id = "
<<
m_pRpcIdHelper
->show_to_string(offid));
53
return
StatusCode::FAILURE;
54
}
55
56
// Testing Sim to Offline ID conversion
57
Amg::Vector3D
rpc_gPos = descriptor->
stripPos
(offid);
58
double
rpc_strip_phi = rpc_gPos.phi();
59
if
(rpc_strip_phi < 0.) rpc_strip_phi += 2.*
M_PI
;
60
61
return
StatusCode::SUCCESS;
62
}
63
64
65
StatusCode
RPCHitsTestTool::processEvent
() {
66
CHECK
(
executeCheckEventInfo
());
67
68
// MuonSpectrometer
69
// Get the generic MuonSpectrometer (MDT,RPC,CSC,TGC) histograms
70
// Short description:
71
// MuonSpectrometer cross section
72
// MuonSpectrometer longitudinal
73
// Number of events processed from truth
74
// Event specific run number
75
// Eta, Theta, Phi, z residual (...), phi residual (...) of hits in MuonSpectrometer
76
77
if
(
m_DoRPCTest
) {
78
79
const
RPCSimHitCollection
* p_collection =
nullptr
;
80
if
(evtStore()->retrieve(p_collection,
"RPC_Hits"
) == StatusCode::SUCCESS) {
81
for
(
const
RPCSimHit
&
hit
: *p_collection) {
82
// Check the Hits identifiers, access the functions that give:
83
// Station name, station eta, station phi, doublet Z, doublet phi, doublet R, GasGap, Measures Phi.
84
HitID
rpchit= (
hit
).RPCid();
85
Identifier
offid=
getIdentifier
(rpchit);
86
CHECK
(
checkIdentifier
(offid));
87
88
// Check Hits
89
// For every hit within the event, get the global position Amg::Vector3D u and then retrieve all releveant info
90
// either from the Amg::Vector3D or from the MC vector (direction)
91
GeoRPCHit
ghit(
hit
);
92
93
if
(!ghit)
continue
;
94
Amg::Vector3D
u = ghit.
getGlobalPosition
();
95
CHECK
(
executeFillHistos
(u));
96
}
97
}
98
}
99
100
return
StatusCode::SUCCESS;
101
}
102
103
104
StatusCode
RPCHitsTestTool::initialize
() {
105
CHECK
(
MuonHitTestToolBase::initialize
());
106
m_pRpcIdHelper
=
m_pMuonMgr
->rpcIdHelper();
107
return
StatusCode::SUCCESS;
108
}
M_PI
#define M_PI
Definition
ActiveFraction.h:14
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition
AthMsgStreamMacros.h:34
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition
Control/AthenaKernel/AthenaKernel/errorcheck.h:422
HitID
int HitID
Definition
GenericMuonSimHit.h:13
GeoMuonHits.h
hit
bool hit(const Container &ids, int pdgId)
Definition
JetIRCSafeLabelTool.cxx:64
McEventCollection.h
MuonDetectorManager.h
RpcReadoutElement.h
RPCHitsTestTool.h
RPCSimHitCollection.h
RPCSimHitCollection
AtlasHitsVector< RPCSimHit > RPCSimHitCollection
Definition
RPCSimHitCollection.h:15
RPCSimHit.h
RpcHitIdHelper.h
RpcIdHelper.h
GeoRPCHit
Definition
GeoMuonHits.h:85
GeoRPCHit::getGlobalPosition
Amg::Vector3D getGlobalPosition() const
MuonGM::RpcReadoutElement
An RpcReadoutElement corresponds to a single RPC module; therefore typicaly a barrel muon station con...
Definition
MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/RpcReadoutElement.h:55
MuonGM::RpcReadoutElement::stripPos
Amg::Vector3D stripPos(const Identifier &id) const
Definition
MuonDetDescr/MuonReadoutGeometry/src/RpcReadoutElement.cxx:177
MuonHitTestToolBase::executeFillHistos
StatusCode executeFillHistos(const Amg::Vector3D &)
Definition
MuonHitTestToolBase.cxx:70
MuonHitTestToolBase::m_pMuonMgr
const MuonGM::MuonDetectorManager * m_pMuonMgr
Definition
MuonHitTestToolBase.h:38
MuonHitTestToolBase::executeCheckEventInfo
StatusCode executeCheckEventInfo()
Definition
MuonHitTestToolBase.cxx:35
MuonHitTestToolBase::initialize
virtual StatusCode initialize() override
Definition
MuonHitTestToolBase.cxx:111
RPCHitsTestTool::initialize
StatusCode initialize()
Definition
RPCHitsTestTool.cxx:104
RPCHitsTestTool::m_pRpcIdHelper
const RpcIdHelper * m_pRpcIdHelper
Definition
RPCHitsTestTool.h:38
RPCHitsTestTool::getIdentifier
Identifier getIdentifier(HitID rpchit)
Definition
RPCHitsTestTool.cxx:25
RPCHitsTestTool::m_DoRPCTest
bool m_DoRPCTest
Definition
RPCHitsTestTool.h:36
RPCHitsTestTool::processEvent
StatusCode processEvent()
Definition
RPCHitsTestTool.cxx:65
RPCHitsTestTool::checkIdentifier
StatusCode checkIdentifier(Identifier offid)
Definition
RPCHitsTestTool.cxx:48
RPCSimHit
Definition
RPCSimHit.h:19
RpcHitIdHelper
Definition
RpcHitIdHelper.h:13
RpcHitIdHelper::GetDoubletPhi
int GetDoubletPhi(const int &hid) const
Definition
RpcHitIdHelper.cxx:88
RpcHitIdHelper::GetHelper
static const RpcHitIdHelper * GetHelper(unsigned int nGasGaps=2)
Definition
RpcHitIdHelper.cxx:23
RpcHitIdHelper::GetPhiSector
int GetPhiSector(const int &hid) const
Definition
RpcHitIdHelper.cxx:69
RpcHitIdHelper::GetDoubletR
int GetDoubletR(const int &hid) const
Definition
RpcHitIdHelper.cxx:80
RpcHitIdHelper::GetGasGapLayer
int GetGasGapLayer(const int &hid) const
Definition
RpcHitIdHelper.cxx:84
RpcHitIdHelper::GetMeasuresPhi
int GetMeasuresPhi(const int &hid) const
Definition
RpcHitIdHelper.cxx:96
RpcHitIdHelper::GetStationName
std::string GetStationName(const int &hid) const
Definition
RpcHitIdHelper.cxx:58
RpcHitIdHelper::GetDoubletZ
int GetDoubletZ(const int &hid) const
Definition
RpcHitIdHelper.cxx:92
RpcHitIdHelper::GetZSector
int GetZSector(const int &hid) const
Definition
RpcHitIdHelper.cxx:74
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition
GeoPrimitives.h:47
Identifier
Definition
IdentifierFieldParser.cxx:14
Generated on
for ATLAS Offline Software by
1.17.0