ATLAS Offline Software
Loading...
Searching...
No Matches
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
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
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
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
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();
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
118 m_pTgcIdHelper = m_pMuonMgr->tgcIdHelper();
119 return StatusCode::SUCCESS;
120}
#define M_PI
#define ATH_MSG_FATAL(x)
#define ATH_MSG_VERBOSE(x)
#define CHECK(...)
Evaluate an expression and check for errors.
int HitID
AtlasHitsVector< TGCSimHit > TGCSimHitCollection
Amg::Vector3D getGlobalPosition() const
A TgcReadoutElement corresponds to a single TGC chamber; therefore typically a TGC station contains s...
Amg::Vector3D channelPos(const Identifier &id) const
Returns the position of the active channel (wireGang or strip)
StatusCode executeFillHistos(const Amg::Vector3D &)
const MuonGM::MuonDetectorManager * m_pMuonMgr
virtual StatusCode initialize() override
const TgcIdHelper * m_pTgcIdHelper
Identifier getIdentifier(HitID)
StatusCode processEvent()
StatusCode checkIdentifier(Identifier)
StatusCode initialize()
int GetStationPhi(const int &hid) const
std::string GetStationName(const int &hid) const
int GetStationEta(const int &hid) const
int GetGasGap(const int &hid) const
static const TgcHitIdHelper * GetHelper()
Eigen::Matrix< double, 3, 1 > Vector3D