ATLAS Offline Software
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 
10 #include "MuonSimEvent/RPCSimHit.h"
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 }
AthHistogramAlgorithm::histSvc
const ServiceHandle< ITHistSvc > & histSvc() const
The standard THistSvc (for writing histograms and TTrees and more to a root file) Returns (kind of) a...
Definition: AthHistogramAlgorithm.h:113
RPCHitAnalysis::m_h_hits_r
TH1 * m_h_hits_r
Definition: RPCHitAnalysis.h:29
RPCHitAnalysis.h
RPCHitAnalysis::m_path
Gaudi::Property< std::string > m_path
Definition: RPCHitAnalysis.h:43
GeoRPCHit::getGlobalPosition
Amg::Vector3D getGlobalPosition() const
AtlasHitsVector
Definition: AtlasHitsVector.h:32
RPCHitAnalysis::initialize
virtual StatusCode initialize() override final
Definition: RPCHitAnalysis.cxx:16
GeoMuonHits.h
RPCHitAnalysis::m_h_hits_z
TH1 * m_h_hits_z
Definition: RPCHitAnalysis.h:28
AtlasHitsVector::const_iterator
CONT::const_iterator const_iterator
Definition: AtlasHitsVector.h:42
RPCHitAnalysis::m_h_hits_step
TH1 * m_h_hits_step
Definition: RPCHitAnalysis.h:40
RPCHitAnalysis::m_h_hits_lz
TH1 * m_h_hits_lz
Definition: RPCHitAnalysis.h:36
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:209
SG::get
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
Definition: ReadCondHandle.h:287
RPCHitAnalysis::m_h_hits_phi
TH1 * m_h_hits_phi
Definition: RPCHitAnalysis.h:33
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
RPCHitAnalysis::m_h_zr
TH2 * m_h_zr
Definition: RPCHitAnalysis.h:31
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
RPCHitAnalysis::m_h_hits_edep
TH1 * m_h_hits_edep
Definition: RPCHitAnalysis.h:38
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
RPCHitAnalysis::m_h_xy
TH2 * m_h_xy
Definition: RPCHitAnalysis.h:30
RPCHitAnalysis::m_h_hits_x
TH1 * m_h_hits_x
Some variables.
Definition: RPCHitAnalysis.h:26
RPCHitAnalysis::m_h_hits_lx
TH1 * m_h_hits_lx
Definition: RPCHitAnalysis.h:34
RPCHitAnalysis::m_h_hits_y
TH1 * m_h_hits_y
Definition: RPCHitAnalysis.h:27
RPCSimHit.h
RPCHitAnalysis::m_h_hits_eta
TH1 * m_h_hits_eta
Definition: RPCHitAnalysis.h:32
RPCHitAnalysis::m_h_hits_time
TH1 * m_h_hits_time
Definition: RPCHitAnalysis.h:37
RPCHitAnalysis::execute
virtual StatusCode execute() override final
Definition: RPCHitAnalysis.cxx:86
GeoRPCHit
Definition: GeoMuonHits.h:85
RPCHitAnalysis::m_readKey
SG::ReadHandleKey< RPCSimHitCollection > m_readKey
Definition: RPCHitAnalysis.h:42
RPCHitAnalysis::m_h_hits_ly
TH1 * m_h_hits_ly
Definition: RPCHitAnalysis.h:35
RPCHitAnalysis::m_h_hits_kine
TH1 * m_h_hits_kine
Definition: RPCHitAnalysis.h:39