ATLAS Offline Software
Loading...
Searching...
No Matches
CSCHitsTestTool.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 "CSCHitsTestTool.h"
6
8#include "CLHEP/Vector/LorentzVector.h"
9
17
18#include <TH1D.h>
19#include <TH2D.h>
20
21
23 const CscHitIdHelper* cschelper = CscHitIdHelper::GetHelper();
24
25 const std::string & csc_stname = cschelper->GetStationName(cschit);
26 int csc_steta = cschelper->GetZSector(cschit);
27 int csc_stphi = cschelper->GetPhiSector(cschit);
28 int csc_cl = cschelper->GetChamberLayer(cschit);
29 int csc_wl = cschelper->GetWireLayer(cschit);
30 int csc_measphi = 1;
31 int csc_strip = 1;
32
33 // Create the offline identifiers, fill them with hit info. Ready to be
34 // accessed and retrieve info. Currently not used in this code except for
35 // some checks.
36 // ======================================================================
37 Identifier offid = m_pCscIdHelper->channelID(csc_stname, csc_steta,
38 csc_stphi, csc_cl, csc_wl,
39 csc_measphi, csc_strip);
40 if (offid == 0) {
41 ATH_MSG_FATAL("CSC: Cannot build a valid Identifier; skip ");
42 }
43 // *AS* really info level? perhaps debug or verbose?
44 ATH_MSG_VERBOSE(" CSC: Offline Id "<<m_pCscIdHelper->show_to_string(offid));
45 return offid;
46}
47
49 const MuonGM::CscReadoutElement* descriptor = m_pMuonMgr->getCscReadoutElement(offid);
50 if (!descriptor) {
51 ATH_MSG_FATAL("CSC readout element not found for Id = " << m_pCscIdHelper->show_to_string(offid));
52 return StatusCode::FAILURE;
53 }
54
55 // Testing Sim to Offline ID conversion
56 Amg::Vector3D csc_gPos = descriptor->stripPos(offid);
57 double csc_strip_phi = csc_gPos.phi();
58 if (csc_strip_phi < 0.) csc_strip_phi += 2.*M_PI;
59 double csc_strip_perp __attribute ((unused)) = csc_gPos.perp();
60 double csc_strip_z __attribute ((unused)) = csc_gPos.z();
61 double csc_strip_cot __attribute ((unused)) = 1./tan(csc_gPos.theta());
62
63 return StatusCode::SUCCESS;
64}
65
68
69 // *AS* which direction is selected in the end?
70 // should match with truth particle using barcode (particleID)
71
72 // MuonSpectrometer
73 // Get the generic MuonSpectrometer (MDT,RPC,CSC,TGC) histograms
74 // Short description:
75 // MuonSpectrometer cross section
76 // MuonSpectrometer longitudinal
77 // Number of events processed from truth
78 // Event specific run number
79 // Eta, Theta, Phi, z residual (...), phi residual (...) of hits in MuonSpectrometer
80
81 // CSC
82 // Get the CSC histograms
83 // Short description:
84 // MuonSpectrometer RPC cross section
85 // MuonSpectrometer RPC longitudinal
86 // Eta, Theta, Phi, z residual (...), phi residual (...) of hits in CSCs
87
88 if (m_DoCSCTest) {
89 // -- loop over CSC hit collection --
90 const CSCSimHitCollection* p_collection = nullptr;
91 if (evtStore()->retrieve(p_collection,"CSC_Hits") == StatusCode::SUCCESS) {
92 for (const CSCSimHit& hit : *p_collection) {
93
94 // Check the Hits identifiers, access the functions that give:
95 // Station name, station eta, station phi, chamber layer, wire layer.
96 HitID cschit= hit.CSCid();
97 Identifier offid= getIdentifier(cschit);
98 CHECK(checkIdentifier(offid));
99
100 // Check Hits. For every hit within the event, get the global position
101 // Amg::Vector3D u and then retrieve all releveant info either from the
102 // Amg::Vector3D or from the MC vector (direction)
103 GeoCSCHit ghit(hit);
104 if (!ghit) continue;
107 }
108 }
109 }
110
111 return StatusCode::SUCCESS;
112}
113
115 // initialise general histograms
117
118 m_pCscIdHelper = m_pMuonMgr->cscIdHelper();
119
120 return StatusCode::SUCCESS;
121}
#define M_PI
#define ATH_MSG_FATAL(x)
#define ATH_MSG_VERBOSE(x)
AtlasHitsVector< CSCSimHit > CSCSimHitCollection
#define CHECK(...)
Evaluate an expression and check for errors.
int HitID
void unused(Args &&...)
StatusCode initialize()
StatusCode processEvent()
const CscIdHelper * m_pCscIdHelper
Identifier getIdentifier(HitID)
StatusCode checkIdentifier(Identifier)
int GetWireLayer(const int &hid) const
int GetZSector(const int &hid) const
int GetPhiSector(const int &hid) const
std::string GetStationName(const int &hid) const
int GetChamberLayer(const int &hid) const
static const CscHitIdHelper * GetHelper()
Amg::Vector3D getGlobalPosition() const
Amg::Vector3D stripPos(const Identifier &id) const
takes into account internal alignment parameters, hence gives accurate answer
StatusCode executeFillHistos(const Amg::Vector3D &)
const MuonGM::MuonDetectorManager * m_pMuonMgr
virtual StatusCode initialize() override
Eigen::Matrix< double, 3, 1 > Vector3D