ATLAS Offline Software
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 
8 
11 
13 #include "MuonSimEvent/TGCSimHit.h"
14 
17 
19 #include "CLHEP/Vector/LorentzVector.h"
20 
21 #include <TH2D.h>
22 
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 
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 
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 
68 
69  //MuonSpectrometer
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();
99  CHECK(checkIdentifier(offid));
100 
101  //Check Hits
105  GeoTGCHit ghit(hit);
106  if (!ghit) continue;
109  }
110  }
111  }
112 
113  return StatusCode::SUCCESS;
114 }
115 
119  return StatusCode::SUCCESS;
120 }
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
TGCHitsTestTool::m_DoTGCTest
bool m_DoTGCTest
Definition: TGCHitsTestTool.h:38
TGCHitsTestTool.h
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
GeoTGCHit::getGlobalPosition
Amg::Vector3D getGlobalPosition() const
MuonHitTestToolBase::executeCheckEventInfo
StatusCode executeCheckEventInfo()
Definition: MuonHitTestToolBase.cxx:35
TgcHitIdHelper::GetGasGap
int GetGasGap(const int &hid) const
Definition: TgcHitIdHelper.cxx:71
TGCHitsTestTool::getIdentifier
Identifier getIdentifier(HitID)
Definition: TGCHitsTestTool.cxx:23
AtlasHitsVector
Definition: AtlasHitsVector.h:33
M_PI
#define M_PI
Definition: ActiveFraction.h:11
GeoMuonHits.h
TGCHitsTestTool::m_pTgcIdHelper
const TgcIdHelper * m_pTgcIdHelper
Definition: TGCHitsTestTool.h:40
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
Trk::u
@ u
Enums for curvilinear frames.
Definition: ParamDefs.h:83
TgcHitIdHelper
Definition: TgcHitIdHelper.h:13
MuonGM::TgcReadoutElement::channelPos
Amg::Vector3D channelPos(const Identifier &id) const
Returns the position of the active channel (wireGang or strip)
MuonGM::MuonDetectorManager::getTgcReadoutElement
const TgcReadoutElement * getTgcReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
Definition: MuonDetDescr/MuonReadoutGeometry/src/MuonDetectorManager.cxx:247
McEventCollection.h
GeoTGCHit
Definition: GeoMuonHits.h:106
TGCHitsTestTool::processEvent
StatusCode processEvent()
Definition: TGCHitsTestTool.cxx:66
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
TgcHitIdHelper::GetStationName
std::string GetStationName(const int &hid) const
Definition: TgcHitIdHelper.cxx:52
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
MuonGM::TgcReadoutElement
A TgcReadoutElement corresponds to a single TGC chamber; therefore typically a TGC station contains s...
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/TgcReadoutElement.h:42
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
TGCHitsTestTool::initialize
StatusCode initialize()
Definition: TGCHitsTestTool.cxx:116
TgcHitIdHelper::GetHelper
static const TgcHitIdHelper * GetHelper()
Definition: TgcHitIdHelper.cxx:23
TgcHitIdHelper::GetStationPhi
int GetStationPhi(const int &hid) const
Definition: TgcHitIdHelper.cxx:61
MuonGM::MuonDetectorManager::tgcIdHelper
const TgcIdHelper * tgcIdHelper() const
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonDetectorManager.h:230
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
MuonHitTestToolBase::executeFillHistos
StatusCode executeFillHistos(const Amg::Vector3D &)
Definition: MuonHitTestToolBase.cxx:70
MuonDetectorManager.h
TGCSimHit
Definition: TGCSimHit.h:19
TGCSimHitCollection.h
MuonHitTestToolBase::initialize
virtual StatusCode initialize() override
Definition: MuonHitTestToolBase.cxx:111
AtlasDetectorID::show_to_string
std::string show_to_string(Identifier id, const IdContext *context=0, char sep='.') const
or provide the printout in string form
Definition: AtlasDetectorID.cxx:574
MuonHitTestToolBase::m_pMuonMgr
const MuonGM::MuonDetectorManager * m_pMuonMgr
Definition: MuonHitTestToolBase.h:38
TGCSimHit.h
TgcHitIdHelper::GetStationEta
int GetStationEta(const int &hid) const
Definition: TgcHitIdHelper.cxx:66
TgcIdHelper::channelID
Identifier channelID(int stationName, int stationEta, int stationPhi, int gasGap, int isStrip, int channel) const
Definition: TgcIdHelper.cxx:583
TgcReadoutElement.h
TgcIdHelper.h
HitID
int HitID
Definition: GenericMuonSimHit.h:13
TGCHitsTestTool::checkIdentifier
StatusCode checkIdentifier(Identifier)
Definition: TGCHitsTestTool.cxx:45
tgchit
Definition: MuonFeatureDetails_p2.h:37
TgcHitIdHelper.h