ATLAS Offline Software
Loading...
Searching...
No Matches
LayerTestTool Class Reference

#include <LayerTestTool.h>

Inheritance diagram for LayerTestTool:
Collaboration diagram for LayerTestTool:

Public Member Functions

 LayerTestTool (const std::string &type, const std::string &name, const IInterface *parent)
StatusCode initialize ()
StatusCode processEvent ()

Protected Attributes

std::string m_path {"/truth/"}
ServiceHandle< ITHistSvc > m_histSvc {"THistSvc", "SimTestHisto"}

Private Attributes

std::string m_collection
TH1 * m_n_energy
TH1 * m_n_energy_e
TH1 * m_n_energy_ep
TH1 * m_n_energy_gamma
TH1 * m_n_energy_neutron
TH1 * m_n_energy_muon
TH1 * m_n_energy_muonp
TH2 * m_n_pos
TH1 * m_n_px
TH1 * m_n_py
TH1 * m_n_pz
TH1 * m_n_rho
TH1 * m_n_eta
TH1 * m_n_phi
double m_energy
double m_pos_x
double m_pos_y
double m_pos_z
double m_pos_r
double m_p_x
double m_p_y
double m_p_z
double m_p_rho
double m_p_phi
double m_p_eta

structors and AlgTool implementation

std::string m_key
 The MC truth key.
HepMC::ConstGenParticlePtr getPrimary ()

Detailed Description

Definition at line 10 of file LayerTestTool.h.

Constructor & Destructor Documentation

◆ LayerTestTool()

LayerTestTool::LayerTestTool ( const std::string & type,
const std::string & name,
const IInterface * parent )

Definition at line 14 of file LayerTestTool.cxx.

15 : SimTestToolBase(type, name, parent), m_collection("CaloEntry"), m_n_energy(0),m_n_energy_e(0),m_n_energy_ep(0),
17 m_n_pos(0),m_n_px(0),m_n_py(0),m_n_pz(0),m_n_rho(0),m_n_eta(0),m_n_phi(0),
19{
20 declareProperty("CollectionName", m_collection="CaloEntry");
21}
TH1 * m_n_energy_gamma
TH1 * m_n_energy_muonp
TH1 * m_n_energy_neutron
TH1 * m_n_energy_muon
std::string m_collection
SimTestToolBase(const std::string &type, const std::string &name, const IInterface *parent)

Member Function Documentation

◆ getPrimary()

HepMC::ConstGenParticlePtr SimTestToolBase::getPrimary ( )
protectedinherited

Definition at line 20 of file SimTestToolBase.cxx.

21{
22 const McEventCollection* mcCollection;
23 if (evtStore()->retrieve(mcCollection,m_key).isSuccess()) {
25 for (e=mcCollection->begin();e!=mcCollection->end(); ++e) {
26 for (auto p : (**e)) {
28 return p;
29 }
30 }
31 }
32 }
33 return 0;
34}
DataModel_detail::const_iterator< DataVector > const_iterator
Standard const_iterator.
Definition DataVector.h:838
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
std::string m_key
The MC truth key.
bool is_simulation_particle(const T &p)
Method to establish if a particle (or barcode) was created during the simulation (TODO update to be s...
retrieve(aClass, aKey=None)
Definition PyKernel.py:110

◆ initialize()

StatusCode LayerTestTool::initialize ( )
virtual

Reimplemented from SimTestToolBase.

Definition at line 24 of file LayerTestTool.cxx.

25{
26 m_path+="Layer/";
28
29 _TH1D(m_n_energy,(m_collection+"_energy").c_str(),31,0.,2000000.);
30 _SET_TITLE(m_n_energy,"energy","E MeV","n");
31
32 _TH1D(m_n_energy_e,(m_collection+"_energy_e").c_str(),31,0.,20000.);
33 _SET_TITLE(m_n_energy_e,"energy","E MeV","n");
34
35 _TH1D(m_n_energy_ep,(m_collection+"_energy_ep").c_str(),31,0.,20000.);
36 _SET_TITLE(m_n_energy_ep,"energy","E MeV","n");
37
38 _TH1D(m_n_energy_gamma,(m_collection+"_energy_gamma").c_str(),31,0.,20000.);
39 _SET_TITLE(m_n_energy_gamma,"energy","E MeV","n");
40
41 _TH1D(m_n_energy_neutron,(m_collection+"_energy_neutron").c_str(),31,0.,20000.);
42 _SET_TITLE(m_n_energy_neutron,"energy","E MeV","n");
43
44 _TH1D(m_n_energy_muon,(m_collection+"_energy_muon").c_str(),31,0.,2000000.);
45 _SET_TITLE(m_n_energy_muon,"energy","E MeV","n");
46
47 _TH1D(m_n_energy_muonp,(m_collection+"_energy_muonp").c_str(),31,0.,2000000.);
48 _SET_TITLE(m_n_energy_muonp,"energy","E MeV","n");
49
50 _TH1D(m_n_px,(m_collection+"_px").c_str(),31,-500000.,500000.);
51 _SET_TITLE(m_n_px,"px distribution","px MeV","n");
52 _TH1D(m_n_py,(m_collection+"_py").c_str(),31,-500000.,500000.);
53 _SET_TITLE(m_n_py,"py distribution","py MeV","n");
54 _TH1D(m_n_pz,(m_collection+"_pz").c_str(),31,-500000.,500000.);
55 _SET_TITLE(m_n_pz,"pz distribution","pz MeV","n");
56
57 _TH1D(m_n_rho,(m_collection+"_rho").c_str(),31,0,50000.);
58 _SET_TITLE(m_n_rho,"rho distribution","rho","n");
59 _TH1D(m_n_eta,(m_collection+"_eta").c_str(),31,-5.,5.);
60 _SET_TITLE(m_n_eta,"eta distribution","eta","n");
61 _TH1D(m_n_phi,(m_collection+"_phi").c_str(),31,-5.,5.);
62 _SET_TITLE(m_n_phi,"phi distribution","phi","n");
63
64 _TH2D(m_n_pos,(m_collection+"_pos").c_str(),31,-7500.,7500.,31,0.,4500.);
65 _SET_TITLE(m_n_pos,"pos","z","r");
66 return StatusCode::SUCCESS;
67}
#define _TH2D(var, name, nbinx, xmin, xmax, nbiny, ymin, ymax)
#define _TH1D(var, name, nbin, xmin, xmax)
#define _SET_TITLE(var, title, xaxis, yaxis)
std::string m_path

◆ processEvent()

StatusCode LayerTestTool::processEvent ( )

Definition at line 70 of file LayerTestTool.cxx.

71{
72 //std::cout<<"LayerTestTool::processEvent()"<<std::endl;
73 const TrackRecordCollection * trCollection = 0;
74 m_key=m_collection+"Layer";
75
76 if (evtStore()->retrieve(trCollection,m_key).isSuccess()) {
77
78 for(const auto& e : *trCollection){
79
80 m_energy = e.GetEnergy();
81 m_n_energy->Fill(m_energy);
82
83 if(e.GetPDGCode() == 11){
85 }
86
87 if(e.GetPDGCode() == -11){
89 }
90
91 if(e.GetPDGCode() == 22){
93 }
94
95 if(e.GetPDGCode() == 2112){
97 }
98
99 if(e.GetPDGCode() == 13){
101 }
102
103 if(e.GetPDGCode() == -13){
105 }
106
107 m_pos_x = e.GetPosition().x();
108 m_pos_y = e.GetPosition().y();
109 m_pos_z = e.GetPosition().z();
111 m_n_pos->Fill(m_pos_z,m_pos_r);
112
113 m_p_x=e.GetMomentum().x();
114 m_p_y=e.GetMomentum().y();
115 m_p_z=e.GetMomentum().z();
116 // std::cout<<"px="<<m_p_x<<";py="<<m_p_y<<";pz="<<m_p_z<<std::endl;
117 m_n_px->Fill(m_p_x);
118 m_n_py->Fill(m_p_y);
119 m_n_pz->Fill(m_p_z);
120
121 m_p_rho=e.GetMomentum().rho();
122 m_p_phi=e.GetMomentum().phi();
123 m_p_eta=e.GetMomentum().eta();
124 // std::cout<<"rho="<<m_p_rho<<";phi="<<m_p_phi<<";eta="<<m_p_eta<<std::endl;
125 m_n_rho->Fill(m_p_rho);
126 m_n_eta->Fill(m_p_eta);
127 m_n_phi->Fill(m_p_phi);
128 }
129
130 }
131
132 return StatusCode::SUCCESS;
133}
AtlasHitsVector< TrackRecord > TrackRecordCollection

Member Data Documentation

◆ m_collection

std::string LayerTestTool::m_collection
private

Definition at line 20 of file LayerTestTool.h.

◆ m_energy

double LayerTestTool::m_energy
private

Definition at line 40 of file LayerTestTool.h.

◆ m_histSvc

ServiceHandle<ITHistSvc> SimTestHisto::m_histSvc {"THistSvc", "SimTestHisto"}
protectedinherited

Definition at line 35 of file SimTestHisto.h.

35{"THistSvc", "SimTestHisto"};

◆ m_key

std::string SimTestToolBase::m_key
protectedinherited

The MC truth key.

Definition at line 34 of file SimTestToolBase.h.

◆ m_n_energy

TH1* LayerTestTool::m_n_energy
private

Definition at line 22 of file LayerTestTool.h.

◆ m_n_energy_e

TH1* LayerTestTool::m_n_energy_e
private

Definition at line 23 of file LayerTestTool.h.

◆ m_n_energy_ep

TH1* LayerTestTool::m_n_energy_ep
private

Definition at line 24 of file LayerTestTool.h.

◆ m_n_energy_gamma

TH1* LayerTestTool::m_n_energy_gamma
private

Definition at line 25 of file LayerTestTool.h.

◆ m_n_energy_muon

TH1* LayerTestTool::m_n_energy_muon
private

Definition at line 27 of file LayerTestTool.h.

◆ m_n_energy_muonp

TH1* LayerTestTool::m_n_energy_muonp
private

Definition at line 28 of file LayerTestTool.h.

◆ m_n_energy_neutron

TH1* LayerTestTool::m_n_energy_neutron
private

Definition at line 26 of file LayerTestTool.h.

◆ m_n_eta

TH1* LayerTestTool::m_n_eta
private

Definition at line 37 of file LayerTestTool.h.

◆ m_n_phi

TH1* LayerTestTool::m_n_phi
private

Definition at line 38 of file LayerTestTool.h.

◆ m_n_pos

TH2* LayerTestTool::m_n_pos
private

Definition at line 30 of file LayerTestTool.h.

◆ m_n_px

TH1* LayerTestTool::m_n_px
private

Definition at line 32 of file LayerTestTool.h.

◆ m_n_py

TH1* LayerTestTool::m_n_py
private

Definition at line 33 of file LayerTestTool.h.

◆ m_n_pz

TH1* LayerTestTool::m_n_pz
private

Definition at line 34 of file LayerTestTool.h.

◆ m_n_rho

TH1* LayerTestTool::m_n_rho
private

Definition at line 36 of file LayerTestTool.h.

◆ m_p_eta

double LayerTestTool::m_p_eta
private

Definition at line 50 of file LayerTestTool.h.

◆ m_p_phi

double LayerTestTool::m_p_phi
private

Definition at line 49 of file LayerTestTool.h.

◆ m_p_rho

double LayerTestTool::m_p_rho
private

Definition at line 48 of file LayerTestTool.h.

◆ m_p_x

double LayerTestTool::m_p_x
private

Definition at line 45 of file LayerTestTool.h.

◆ m_p_y

double LayerTestTool::m_p_y
private

Definition at line 46 of file LayerTestTool.h.

◆ m_p_z

double LayerTestTool::m_p_z
private

Definition at line 47 of file LayerTestTool.h.

◆ m_path

std::string SimTestHisto::m_path {"/truth/"}
protectedinherited

Definition at line 34 of file SimTestHisto.h.

34{"/truth/"};

◆ m_pos_r

double LayerTestTool::m_pos_r
private

Definition at line 44 of file LayerTestTool.h.

◆ m_pos_x

double LayerTestTool::m_pos_x
private

Definition at line 41 of file LayerTestTool.h.

◆ m_pos_y

double LayerTestTool::m_pos_y
private

Definition at line 42 of file LayerTestTool.h.

◆ m_pos_z

double LayerTestTool::m_pos_z
private

Definition at line 43 of file LayerTestTool.h.


The documentation for this class was generated from the following files: