ATLAS Offline Software
Public Member Functions | Protected Attributes | Private Attributes | List of all members
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. More...
 
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.

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),
18  m_energy(0),m_pos_x(0),m_pos_y(0),m_pos_z(0),m_pos_r(0),m_p_x(0),m_p_y(0),m_p_z(0),m_p_rho(0),m_p_phi(0),m_p_eta(0)
19 {
20  declareProperty("CollectionName", m_collection="CaloEntry");
21 }

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 }

◆ initialize()

StatusCode LayerTestTool::initialize ( )
virtual

Reimplemented from SimTestToolBase.

Definition at line 24 of file LayerTestTool.cxx.

25 {
26  m_path+="Layer/";
27  m_path+=m_collection+"/";
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 }

◆ 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){
84  m_n_energy_e->Fill(m_energy);
85  }
86 
87  if(e.GetPDGCode() == -11){
88  m_n_energy_ep->Fill(m_energy);
89  }
90 
91  if(e.GetPDGCode() == 22){
93  }
94 
95  if(e.GetPDGCode() == 2112){
97  }
98 
99  if(e.GetPDGCode() == 13){
100  m_n_energy_muon->Fill(m_energy);
101  }
102 
103  if(e.GetPDGCode() == -13){
104  m_n_energy_muonp->Fill(m_energy);
105  }
106 
107  m_pos_x = e.GetPosition().x();
108  m_pos_y = e.GetPosition().y();
109  m_pos_z = e.GetPosition().z();
110  m_pos_r= std::sqrt(m_pos_x*m_pos_x+m_pos_y*m_pos_y);
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 }

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.

◆ 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.

◆ 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:
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
LayerTestTool::m_n_eta
TH1 * m_n_eta
Definition: LayerTestTool.h:37
LayerTestTool::m_n_pz
TH1 * m_n_pz
Definition: LayerTestTool.h:34
AtlasHitsVector
Definition: AtlasHitsVector.h:33
LayerTestTool::m_n_phi
TH1 * m_n_phi
Definition: LayerTestTool.h:38
LayerTestTool::m_pos_y
double m_pos_y
Definition: LayerTestTool.h:42
_SET_TITLE
#define _SET_TITLE(var, title, xaxis, yaxis)
Definition: SimTestHisto.h:93
LayerTestTool::m_p_x
double m_p_x
Definition: LayerTestTool.h:45
LayerTestTool::m_n_energy_muonp
TH1 * m_n_energy_muonp
Definition: LayerTestTool.h:28
SimTestToolBase::SimTestToolBase
SimTestToolBase(const std::string &type, const std::string &name, const IInterface *parent)
Definition: SimTestToolBase.cxx:11
LayerTestTool::m_p_rho
double m_p_rho
Definition: LayerTestTool.h:48
_TH1D
#define _TH1D(var, name, nbin, xmin, xmax)
Definition: SimTestHisto.h:47
LayerTestTool::m_pos_z
double m_pos_z
Definition: LayerTestTool.h:43
LayerTestTool::m_n_energy_e
TH1 * m_n_energy_e
Definition: LayerTestTool.h:23
LayerTestTool::m_n_rho
TH1 * m_n_rho
Definition: LayerTestTool.h:36
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
LayerTestTool::m_n_py
TH1 * m_n_py
Definition: LayerTestTool.h:33
HepMC::is_simulation_particle
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...
Definition: MagicNumbers.h:355
LayerTestTool::m_p_phi
double m_p_phi
Definition: LayerTestTool.h:49
test_pyathena.parent
parent
Definition: test_pyathena.py:15
LayerTestTool::m_n_energy
TH1 * m_n_energy
Definition: LayerTestTool.h:22
LayerTestTool::m_p_z
double m_p_z
Definition: LayerTestTool.h:47
LayerTestTool::m_p_eta
double m_p_eta
Definition: LayerTestTool.h:50
_TH2D
#define _TH2D(var, name, nbinx, xmin, xmax, nbiny, ymin, ymax)
Definition: SimTestHisto.h:81
LayerTestTool::m_p_y
double m_p_y
Definition: LayerTestTool.h:46
McEventCollection
This defines the McEventCollection, which is really just an ObjectVector of McEvent objects.
Definition: McEventCollection.h:33
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
LayerTestTool::m_n_energy_muon
TH1 * m_n_energy_muon
Definition: LayerTestTool.h:27
LayerTestTool::m_pos_r
double m_pos_r
Definition: LayerTestTool.h:44
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
LayerTestTool::m_collection
std::string m_collection
Definition: LayerTestTool.h:20
LayerTestTool::m_n_px
TH1 * m_n_px
Definition: LayerTestTool.h:32
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
LayerTestTool::m_n_energy_gamma
TH1 * m_n_energy_gamma
Definition: LayerTestTool.h:25
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
LayerTestTool::m_energy
double m_energy
Definition: LayerTestTool.h:40
LayerTestTool::m_n_energy_neutron
TH1 * m_n_energy_neutron
Definition: LayerTestTool.h:26
SimTestHisto::m_path
std::string m_path
Definition: SimTestHisto.h:34
LayerTestTool::m_n_pos
TH2 * m_n_pos
Definition: LayerTestTool.h:30
SimTestToolBase::m_key
std::string m_key
The MC truth key.
Definition: SimTestToolBase.h:34
LayerTestTool::m_pos_x
double m_pos_x
Definition: LayerTestTool.h:41
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
LayerTestTool::m_n_energy_ep
TH1 * m_n_energy_ep
Definition: LayerTestTool.h:24