ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Simulation
G4Atlas
G4AtlasTests
src
TGCHitsTestTool.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 "
TGCHitsTestTool.h
"
6
7
#include "
GeoAdaptors/GeoMuonHits.h
"
8
9
#include "
MuonReadoutGeometry/MuonDetectorManager.h
"
10
#include "
MuonReadoutGeometry/TgcReadoutElement.h
"
11
12
#include "
MuonSimEvent/TGCSimHitCollection.h
"
13
#include "
MuonSimEvent/TGCSimHit.h
"
14
15
#include "
MuonSimEvent/TgcHitIdHelper.h
"
16
#include "
MuonIdHelpers/TgcIdHelper.h
"
17
18
#include "
GeneratorObjects/McEventCollection.h
"
19
#include "CLHEP/Vector/LorentzVector.h"
20
21
#include <TH2D.h>
22
23
Identifier
TGCHitsTestTool::getIdentifier
(
HitID
tgchit
) {
24
const
TgcHitIdHelper
* tgchelper =
TgcHitIdHelper::GetHelper
();
25
std::string tgc_stname = tgchelper->
GetStationName
(
tgchit
);
26
int
tgc_steta = tgchelper->
GetStationEta
(
tgchit
);
27
int
tgc_stphi = tgchelper->
GetStationPhi
(
tgchit
);
28
int
tgc_gg = tgchelper->
GetGasGap
(
tgchit
);
29
int
tgc_strip = 1;
//tgchelper->GetIsStrip(tgchit);
30
int
tgc_channel = 1;
//tgchelper->GetChannel(tgchit);
31
35
36
Identifier
offid =
m_pTgcIdHelper
->channelID(tgc_stname, tgc_steta, tgc_stphi, tgc_gg, tgc_strip, tgc_channel);
37
if
(offid == 0) {
38
ATH_MSG_FATAL
(
"TGC: Cannot build a valid Identifier; skip "
);
39
}
40
ATH_MSG_VERBOSE
(
" TGC: Offline Id "
<<
m_pTgcIdHelper
->show_to_string(offid));
41
42
return
offid;
43
}
44
45
StatusCode
TGCHitsTestTool::checkIdentifier
(
Identifier
offid) {
46
const
MuonGM::TgcReadoutElement
* descriptor =
m_pMuonMgr
->getTgcReadoutElement(offid);
47
if
(!descriptor) {
48
ATH_MSG_FATAL
(
"TGC readout element not found for Id = "
<<
m_pTgcIdHelper
->show_to_string(offid));
49
return
StatusCode::FAILURE;
50
}
51
52
// -------- Testing Sim to Offline ID conversion ---------
53
Amg::Vector3D
tgc_gPos = descriptor->
channelPos
(offid);
54
double
tgc_strip_phi = tgc_gPos.phi();
55
if
(tgc_strip_phi < 0.) tgc_strip_phi += 2.*
M_PI
;
56
/*
57
double tgc_strip_perp = tgc_gPos.perp();
58
double tgc_strip_z = tgc_gPos.z();
59
double tgc_strip_cot = 1./tan(tgc_gPos.theta());
60
*/
61
62
return
StatusCode::SUCCESS;
63
}
64
65
66
StatusCode
TGCHitsTestTool::processEvent
() {
67
CHECK
(
executeCheckEventInfo
());
68
69
//MuonSpectrometer
78
79
// TGC
80
// Get the TGC histograms
81
// Short description:
82
// MuonSpectrometer TGC cross section
83
// MuonSpectrometer TGC longitudinal
84
// Eta, Theta, Phi, z residual (...), phi residual (...) of hits in TGCs
85
86
// Enter the main algorithm loop
87
if
(
m_DoTGCTest
) {
88
89
const
TGCSimHitCollection
* p_collection =
nullptr
;
90
if
(evtStore()->retrieve(p_collection,
"TGC_Hits"
) == StatusCode::SUCCESS) {
91
for
(
const
TGCSimHit
&
hit
: *p_collection) {
97
HitID
tgchit
=
hit
.TGCid();
98
Identifier
offid=
getIdentifier
(
tgchit
);
99
CHECK
(
checkIdentifier
(offid));
100
101
//Check Hits
105
GeoTGCHit
ghit(
hit
);
106
if
(!ghit)
continue
;
107
Amg::Vector3D
u = ghit.
getGlobalPosition
();
108
CHECK
(
executeFillHistos
(u));
109
}
110
}
111
}
112
113
return
StatusCode::SUCCESS;
114
}
115
116
StatusCode
TGCHitsTestTool::initialize
() {
117
CHECK
(
MuonHitTestToolBase::initialize
());
118
m_pTgcIdHelper
=
m_pMuonMgr
->tgcIdHelper();
119
return
StatusCode::SUCCESS;
120
}
M_PI
#define M_PI
Definition
ActiveFraction.h:14
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition
AthMsgStreamMacros.h:34
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition
AthMsgStreamMacros.h:28
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
TgcReadoutElement.h
TGCHitsTestTool.h
TGCSimHitCollection.h
TGCSimHitCollection
AtlasHitsVector< TGCSimHit > TGCSimHitCollection
Definition
TGCSimHitCollection.h:15
TGCSimHit.h
TgcHitIdHelper.h
TgcIdHelper.h
GeoTGCHit
Definition
GeoMuonHits.h:108
GeoTGCHit::getGlobalPosition
Amg::Vector3D getGlobalPosition() const
MuonGM::TgcReadoutElement
A TgcReadoutElement corresponds to a single TGC chamber; therefore typically a TGC station contains s...
Definition
MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/TgcReadoutElement.h:42
MuonGM::TgcReadoutElement::channelPos
Amg::Vector3D channelPos(const Identifier &id) const
Returns the position of the active channel (wireGang or strip).
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
TGCHitsTestTool::m_pTgcIdHelper
const TgcIdHelper * m_pTgcIdHelper
Definition
TGCHitsTestTool.h:40
TGCHitsTestTool::getIdentifier
Identifier getIdentifier(HitID)
Definition
TGCHitsTestTool.cxx:23
TGCHitsTestTool::m_DoTGCTest
bool m_DoTGCTest
Definition
TGCHitsTestTool.h:38
TGCHitsTestTool::processEvent
StatusCode processEvent()
Definition
TGCHitsTestTool.cxx:66
TGCHitsTestTool::checkIdentifier
StatusCode checkIdentifier(Identifier)
Definition
TGCHitsTestTool.cxx:45
TGCHitsTestTool::initialize
StatusCode initialize()
Definition
TGCHitsTestTool.cxx:116
TGCSimHit
Definition
TGCSimHit.h:19
TgcHitIdHelper
Definition
TgcHitIdHelper.h:13
TgcHitIdHelper::GetStationPhi
int GetStationPhi(const int &hid) const
Definition
TgcHitIdHelper.cxx:61
TgcHitIdHelper::GetStationName
std::string GetStationName(const int &hid) const
Definition
TgcHitIdHelper.cxx:52
TgcHitIdHelper::GetStationEta
int GetStationEta(const int &hid) const
Definition
TgcHitIdHelper.cxx:66
TgcHitIdHelper::GetGasGap
int GetGasGap(const int &hid) const
Definition
TgcHitIdHelper.cxx:71
TgcHitIdHelper::GetHelper
static const TgcHitIdHelper * GetHelper()
Definition
TgcHitIdHelper.cxx:23
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition
GeoPrimitives.h:47
Identifier
Definition
IdentifierFieldParser.cxx:14
tgchit
Definition
MuonFeatureDetails_p2.h:37
Generated on
for ATLAS Offline Software by
1.17.0