ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Simulation
Tools
HitAnalysis
src
MDTHitAnalysis.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 "
MDTHitAnalysis.h
"
6
7
// Section of includes for MDT of the Muon Spectrometer tests
8
#include "
GeoAdaptors/GeoMuonHits.h
"
9
10
#include "
MuonSimEvent/MDTSimHitCollection.h
"
11
#include "
MuonSimEvent/MDTSimHit.h
"
12
#include "CLHEP/Vector/LorentzVector.h"
13
14
#include "TH1.h"
15
16
#include <algorithm>
17
#include <math.h>
18
#include <functional>
19
#include <iostream>
20
#include <stdio.h>
21
22
23
StatusCode
MDTHitAnalysis::initialize
() {
24
ATH_MSG_DEBUG
(
"Initializing MDTHitAnalysis"
);
25
ATH_CHECK
(
m_readKey
.initialize());
26
27
29
m_h_hits_x
=
new
TH1D(
"h_hits_mdt_x"
,
"hits_x"
, 100,-25000, 25000);
30
m_h_hits_x
->StatOverflows();
31
ATH_CHECK
(
histSvc
()->regHist(
m_path
+
m_h_hits_x
->GetName(),
m_h_hits_x
));
32
33
m_h_hits_y
=
new
TH1D(
"h_hits_mdt_y"
,
"hits_y"
, 100,-25000,25000);
34
m_h_hits_y
->StatOverflows();
35
ATH_CHECK
(
histSvc
()->regHist(
m_path
+
m_h_hits_y
->GetName(),
m_h_hits_y
));
36
37
m_h_hits_z
=
new
TH1D(
"h_hits_mdt_z"
,
"hits_z"
, 100,-45000,45000);
38
m_h_hits_z
->StatOverflows();
39
ATH_CHECK
(
histSvc
()->regHist(
m_path
+
m_h_hits_z
->GetName(),
m_h_hits_z
));
40
41
m_h_hits_r
=
new
TH1D(
"h_hits_mdt_r"
,
"hits_r"
, 100,4000,26000);
42
m_h_hits_r
->StatOverflows();
43
ATH_CHECK
(
histSvc
()->regHist(
m_path
+
m_h_hits_r
->GetName(),
m_h_hits_r
));
44
45
m_h_xy
=
new
TH2D(
"h_mdt_xy"
,
"xy"
, 100,-25000.,25000.,100, -25000., 25000.);
46
m_h_xy
->StatOverflows();
47
ATH_CHECK
(
histSvc
()->regHist(
m_path
+
m_h_xy
->GetName(),
m_h_xy
));
48
49
m_h_zr
=
new
TH2D(
"h_mdt_zr"
,
"zr"
, 100,-45000.,45000.,100, 4000., 26000.);
50
m_h_zr
->StatOverflows();
51
ATH_CHECK
(
histSvc
()->regHist(
m_path
+
m_h_zr
->GetName(),
m_h_zr
));
52
53
m_h_hits_eta
=
new
TH1D(
"h_hits_mdt_eta"
,
"hits_eta"
, 100,-3.0,3.0);
54
m_h_hits_eta
->StatOverflows();
55
ATH_CHECK
(
histSvc
()->regHist(
m_path
+
m_h_hits_eta
->GetName(),
m_h_hits_eta
));
56
57
m_h_hits_phi
=
new
TH1D(
"h_hits_mdt_phi"
,
"hits_phi"
, 100,-3.2,3.2);
58
m_h_hits_phi
->StatOverflows();
59
ATH_CHECK
(
histSvc
()->regHist(
m_path
+
m_h_hits_phi
->GetName(),
m_h_hits_phi
));
60
61
m_h_hits_lx
=
new
TH1D(
"h_hits_mdt_lx"
,
"hits_lx"
, 100,-20, 20);
62
m_h_hits_lx
->StatOverflows();
63
ATH_CHECK
(
histSvc
()->regHist(
m_path
+
m_h_hits_lx
->GetName(),
m_h_hits_lx
));
64
65
m_h_hits_ly
=
new
TH1D(
"h_hits_mdt_ly"
,
"hits_ly"
, 100,-20,20);
66
m_h_hits_ly
->StatOverflows();
67
ATH_CHECK
(
histSvc
()->regHist(
m_path
+
m_h_hits_ly
->GetName(),
m_h_hits_ly
));
68
69
m_h_hits_lz
=
new
TH1D(
"h_hits_mdt_lz"
,
"hits_lz"
, 100,-2000,2000);
70
m_h_hits_lz
->StatOverflows();
71
ATH_CHECK
(
histSvc
()->regHist(
m_path
+
m_h_hits_lz
->GetName(),
m_h_hits_lz
));
72
73
m_h_hits_driftR
=
new
TH1D(
"h_hits_mdt_driftR"
,
"hits_driftR"
, 100,0,15);
74
m_h_hits_driftR
->StatOverflows();
75
ATH_CHECK
(
histSvc
()->regHist(
m_path
+
m_h_hits_driftR
->GetName(),
m_h_hits_driftR
));
76
77
m_h_hits_time
=
new
TH1D(
"h_hits_mdt_time"
,
"hits_time"
, 100,0, 150);
78
m_h_hits_time
->StatOverflows();
79
ATH_CHECK
(
histSvc
()->regHist(
m_path
+
m_h_hits_time
->GetName(),
m_h_hits_time
));
80
81
m_h_hits_edep
=
new
TH1D(
"h_hits_mdt_edep"
,
"hits_edep"
, 100,0,0.2);
82
m_h_hits_edep
->StatOverflows();
83
ATH_CHECK
(
histSvc
()->regHist(
m_path
+
m_h_hits_edep
->GetName(),
m_h_hits_edep
));
84
85
m_h_hits_kine
=
new
TH1D(
"h_hits_mdt_kine"
,
"hits_kine"
, 100,0,20000);
86
m_h_hits_kine
->StatOverflows();
87
ATH_CHECK
(
histSvc
()->regHist(
m_path
+
m_h_hits_kine
->GetName(),
m_h_hits_kine
));
88
89
m_h_hits_step
=
new
TH1D(
"h_hits_mdt_step"
,
"hits_step"
, 100,0,100);
90
m_h_hits_step
->StatOverflows();
91
ATH_CHECK
(
histSvc
()->regHist(
m_path
+
m_h_hits_step
->GetName(),
m_h_hits_step
));
92
93
94
return
StatusCode::SUCCESS;
95
}
96
97
98
StatusCode
MDTHitAnalysis::execute
(
const
EventContext& ctx) {
99
ATH_MSG_DEBUG
(
"In MDTHitAnalysis::execute()"
);
100
101
const
MDTSimHitCollection
* mdt_container{
nullptr
};
102
ATH_CHECK
(
SG::get
(mdt_container,
m_readKey
, ctx));
103
for
(
MDTSimHitCollection::const_iterator
i_hit = mdt_container->
begin
(); i_hit != mdt_container->
end
(); ++i_hit) {
104
//MDTSimHitCollection::const_iterator i_hit;
105
//for(auto i_hit : *mdt_container){
106
GeoMDTHit
ghit(*i_hit);
107
if
(!ghit)
continue
;
108
109
Amg::Vector3D
p = ghit.
getGlobalPosition
();
110
m_h_hits_x
->Fill(p.x());
111
m_h_hits_y
->Fill(p.y());
112
m_h_hits_z
->Fill(p.z());
113
m_h_hits_r
->Fill(p.perp());
114
m_h_xy
->Fill(p.x(), p.y());
115
m_h_zr
->Fill(p.z(),p.perp());
116
m_h_hits_eta
->Fill(p.eta());
117
m_h_hits_phi
->Fill(p.phi());
118
m_h_hits_driftR
->Fill((*i_hit).driftRadius());
119
m_h_hits_lx
->Fill( (*i_hit).localPosition().x());
120
m_h_hits_ly
->Fill( (*i_hit).localPosition().y());
121
m_h_hits_lz
->Fill( (*i_hit).localPosition().z());
122
m_h_hits_edep
->Fill((*i_hit).energyDeposit());
123
m_h_hits_time
->Fill((*i_hit).globalTime());
124
m_h_hits_step
->Fill((*i_hit).stepLength());
125
m_h_hits_kine
->Fill((*i_hit).kineticEnergy());
126
127
}
128
129
return
StatusCode::SUCCESS;
130
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
GeoMuonHits.h
MDTHitAnalysis.h
MDTSimHitCollection.h
MDTSimHitCollection
AtlasHitsVector< MDTSimHit > MDTSimHitCollection
Definition
MDTSimHitCollection.h:14
MDTSimHit.h
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
AtlasHitsVector< MDTSimHit >::const_iterator
CONT::const_iterator const_iterator
Definition
AtlasHitsVector.h:42
AtlasHitsVector::begin
const_iterator begin() const
Definition
AtlasHitsVector.h:130
AtlasHitsVector::end
const_iterator end() const
Definition
AtlasHitsVector.h:133
GeoMDTHit
Definition
GeoMuonHits.h:64
GeoMDTHit::getGlobalPosition
Amg::Vector3D getGlobalPosition() const
MDTHitAnalysis::m_h_hits_edep
TH1 * m_h_hits_edep
Definition
MDTHitAnalysis.h:40
MDTHitAnalysis::execute
virtual StatusCode execute(const EventContext &ctx) override final
Execute method.
Definition
MDTHitAnalysis.cxx:98
MDTHitAnalysis::m_path
Gaudi::Property< std::string > m_path
Definition
MDTHitAnalysis.h:45
MDTHitAnalysis::m_h_hits_step
TH1 * m_h_hits_step
Definition
MDTHitAnalysis.h:42
MDTHitAnalysis::m_h_hits_kine
TH1 * m_h_hits_kine
Definition
MDTHitAnalysis.h:41
MDTHitAnalysis::m_h_hits_phi
TH1 * m_h_hits_phi
Definition
MDTHitAnalysis.h:34
MDTHitAnalysis::m_h_hits_lx
TH1 * m_h_hits_lx
Definition
MDTHitAnalysis.h:35
MDTHitAnalysis::m_h_zr
TH2 * m_h_zr
Definition
MDTHitAnalysis.h:32
MDTHitAnalysis::m_h_hits_time
TH1 * m_h_hits_time
Definition
MDTHitAnalysis.h:39
MDTHitAnalysis::m_h_hits_eta
TH1 * m_h_hits_eta
Definition
MDTHitAnalysis.h:33
MDTHitAnalysis::m_h_hits_driftR
TH1 * m_h_hits_driftR
Definition
MDTHitAnalysis.h:38
MDTHitAnalysis::initialize
virtual StatusCode initialize() override final
Definition
MDTHitAnalysis.cxx:23
MDTHitAnalysis::m_h_hits_z
TH1 * m_h_hits_z
Definition
MDTHitAnalysis.h:29
MDTHitAnalysis::m_h_hits_r
TH1 * m_h_hits_r
Definition
MDTHitAnalysis.h:30
MDTHitAnalysis::m_h_hits_y
TH1 * m_h_hits_y
Definition
MDTHitAnalysis.h:28
MDTHitAnalysis::m_h_xy
TH2 * m_h_xy
Definition
MDTHitAnalysis.h:31
MDTHitAnalysis::m_h_hits_x
TH1 * m_h_hits_x
Some variables.
Definition
MDTHitAnalysis.h:27
MDTHitAnalysis::m_h_hits_ly
TH1 * m_h_hits_ly
Definition
MDTHitAnalysis.h:36
MDTHitAnalysis::m_readKey
SG::ReadHandleKey< MDTSimHitCollection > m_readKey
Definition
MDTHitAnalysis.h:44
MDTHitAnalysis::m_h_hits_lz
TH1 * m_h_hits_lz
Definition
MDTHitAnalysis.h:37
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition
GeoPrimitives.h:47
SG::get
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
Definition
ReadCondHandle.h:282
Generated on
for ATLAS Offline Software by
1.17.0