ATLAS Offline Software
Loading...
Searching...
No Matches
RPCHitAnalysis.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5#include "RPCHitAnalysis.h"
6
7// Section of includes for the RPC of the Muon Spectrometer tests
9
11#include "CLHEP/Vector/LorentzVector.h"
12
13
14
15
17 ATH_MSG_DEBUG( "Initializing RPCHitAnalysis" );
18
19 // Grab the Ntuple and histogramming service for the tree
20 ATH_CHECK(m_readKey.initialize());
22 m_h_hits_x = new TH1D("h_hits_rpc_x","hits_x", 100,-11000, 11000);
23 m_h_hits_x->StatOverflows();
24 ATH_CHECK(histSvc()->regHist(m_path + m_h_hits_x->GetName(), m_h_hits_x));
25
26 m_h_hits_y = new TH1D("h_hits_rpc_y", "hits_y", 100,-11000,11000);
27 m_h_hits_y->StatOverflows();
28 ATH_CHECK(histSvc()->regHist(m_path + m_h_hits_y->GetName(), m_h_hits_y));
29
30 m_h_hits_z = new TH1D("h_hits_rpc_z", "hits_z", 100,-12500, 12500);
31 m_h_hits_z->StatOverflows();
32 ATH_CHECK(histSvc()->regHist(m_path + m_h_hits_z->GetName(), m_h_hits_z));
33
34 m_h_hits_r = new TH1D("h_hits_rpc_r", "hits_r", 100,6000,14000);
35 m_h_hits_r->StatOverflows();
36 ATH_CHECK(histSvc()->regHist(m_path + m_h_hits_r->GetName(), m_h_hits_r));
37
38 m_h_xy = new TH2D("h_rpc_xy", "xy", 100,-11000.,11000.,100, -11000., 11000.);
39 m_h_xy->StatOverflows();
40 ATH_CHECK(histSvc()->regHist( m_path+m_h_xy->GetName(), m_h_xy));
41
42 m_h_zr = new TH2D("m_rpc_zr", "zr", 100,-12500.,12500.,100, 6000., 14000.);
43 m_h_zr->StatOverflows();
44 ATH_CHECK(histSvc()->regHist( m_path+m_h_zr->GetName(), m_h_zr));
45
46 m_h_hits_eta = new TH1D("h_hits_rpc_eta", "hits_eta", 100,-1.5,1.5);
47 m_h_hits_eta->StatOverflows();
48 ATH_CHECK(histSvc()->regHist(m_path + m_h_hits_eta->GetName(), m_h_hits_eta));
49
50 m_h_hits_phi = new TH1D("h_hits_rpc_phi", "hits_phi", 100,-3.2,3.2);
51 m_h_hits_phi->StatOverflows();
52 ATH_CHECK(histSvc()->regHist(m_path + m_h_hits_phi->GetName(), m_h_hits_phi));
53
54 m_h_hits_lx = new TH1D("h_hits_rpc_lx","hits_lx", 100,-10, 10);
55 m_h_hits_lx->StatOverflows();
56 ATH_CHECK(histSvc()->regHist(m_path + m_h_hits_lx->GetName(), m_h_hits_lx));
57
58 m_h_hits_ly = new TH1D("h_hits_rpc_ly", "hits_ly", 100,-1500,1500);
59 m_h_hits_ly->StatOverflows();
60 ATH_CHECK(histSvc()->regHist(m_path + m_h_hits_ly->GetName(), m_h_hits_ly));
61
62 m_h_hits_lz = new TH1D("h_hits_rpc_lz", "hits_lz", 100,-600,600);
63 m_h_hits_lz->StatOverflows();
64 ATH_CHECK(histSvc()->regHist(m_path + m_h_hits_lz->GetName(), m_h_hits_lz));
65
66 m_h_hits_time = new TH1D("h_hits_rpc_time","hits_time", 100,0, 120);
67 m_h_hits_time->StatOverflows();
68 ATH_CHECK(histSvc()->regHist(m_path + m_h_hits_time->GetName(), m_h_hits_time));
69
70 m_h_hits_edep = new TH1D("h_hits_rpc_edep", "hits_edep", 100,0,0.15);
71 m_h_hits_edep->StatOverflows();
72 ATH_CHECK(histSvc()->regHist(m_path + m_h_hits_edep->GetName(), m_h_hits_edep));
73
74 m_h_hits_kine = new TH1D("h_hits_rpc_kine", "hits_kine", 100,0,500);
75 m_h_hits_kine->StatOverflows();
76 ATH_CHECK(histSvc()->regHist(m_path + m_h_hits_kine->GetName(), m_h_hits_kine));
77
78 m_h_hits_step = new TH1D("h_hits_rpc_step", "hits_step", 100,0,25);
79 m_h_hits_step->StatOverflows();
80 ATH_CHECK(histSvc()->regHist(m_path + m_h_hits_step->GetName(), m_h_hits_step));
81
82 return StatusCode::SUCCESS;
83}
84
85
87 ATH_MSG_DEBUG( "In RPCHitAnalysis::execute()" );
88
89 const EventContext& ctx{Gaudi::Hive::currentContext()};
90 const RPCSimHitCollection* rpc_container{nullptr};
91 ATH_CHECK(SG::get(rpc_container, m_readKey, ctx));
92 for (RPCSimHitCollection::const_iterator i_hit = rpc_container->begin(); i_hit != rpc_container->end(); ++i_hit) {
93 //RPCSimHitCollection::const_iterator i_hit;
94 //for(auto i_hit : *rpc_container){
95 GeoRPCHit ghit(*i_hit);
96 if (!ghit) continue;
97
99 m_h_hits_x->Fill(p.x());
100 m_h_hits_y->Fill(p.y());
101 m_h_hits_z->Fill(p.z());
102 m_h_hits_r->Fill(p.perp());
103 m_h_xy->Fill(p.x(), p.y());
104 m_h_zr->Fill(p.z(),p.perp());
105 m_h_hits_eta->Fill(p.eta());
106 m_h_hits_phi->Fill(p.phi());
107 m_h_hits_lx->Fill((*i_hit).localPosition().x());
108 m_h_hits_ly->Fill((*i_hit).localPosition().y());
109 m_h_hits_lz->Fill((*i_hit).localPosition().z());
110 m_h_hits_edep->Fill((*i_hit).energyDeposit());
111 m_h_hits_time->Fill((*i_hit).globalTime());
112 m_h_hits_step->Fill((*i_hit).stepLength());
113 m_h_hits_kine->Fill((*i_hit).kineticEnergy());
114 }
115
116 return StatusCode::SUCCESS;
117}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x)
AtlasHitsVector< RPCSimHit > RPCSimHitCollection
const ServiceHandle< ITHistSvc > & histSvc() const
The standard THistSvc (for writing histograms and TTrees and more to a root file) Returns (kind of) a...
CONT::const_iterator const_iterator
const_iterator begin() const
const_iterator end() const
Amg::Vector3D getGlobalPosition() const
TH1 * m_h_hits_x
Some variables.
virtual StatusCode initialize() override final
Gaudi::Property< std::string > m_path
SG::ReadHandleKey< RPCSimHitCollection > m_readKey
virtual StatusCode execute() override final
Eigen::Matrix< double, 3, 1 > Vector3D
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.