ATLAS Offline Software
Loading...
Searching...
No Matches
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"
9
12
15
18
20#include "CLHEP/Vector/LorentzVector.h"
21
22#include <TH2D.h>
23#include "TTree.h"
24
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
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
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;
96 }
97 }
98 }
99
100 return StatusCode::SUCCESS;
101}
102
103
106 m_pRpcIdHelper = m_pMuonMgr->rpcIdHelper();
107 return StatusCode::SUCCESS;
108}
#define M_PI
#define ATH_MSG_FATAL(x)
#define CHECK(...)
Evaluate an expression and check for errors.
int HitID
AtlasHitsVector< RPCSimHit > RPCSimHitCollection
Amg::Vector3D getGlobalPosition() const
An RpcReadoutElement corresponds to a single RPC module; therefore typicaly a barrel muon station con...
StatusCode executeFillHistos(const Amg::Vector3D &)
const MuonGM::MuonDetectorManager * m_pMuonMgr
virtual StatusCode initialize() override
StatusCode initialize()
const RpcIdHelper * m_pRpcIdHelper
Identifier getIdentifier(HitID rpchit)
StatusCode processEvent()
StatusCode checkIdentifier(Identifier offid)
int GetDoubletPhi(const int &hid) const
static const RpcHitIdHelper * GetHelper(unsigned int nGasGaps=2)
int GetPhiSector(const int &hid) const
int GetDoubletR(const int &hid) const
int GetGasGapLayer(const int &hid) const
int GetMeasuresPhi(const int &hid) const
std::string GetStationName(const int &hid) const
int GetDoubletZ(const int &hid) const
int GetZSector(const int &hid) const
Eigen::Matrix< double, 3, 1 > Vector3D