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

#include <SiHitsTestTool.h>

Inheritance diagram for SiHitsTestTool:
Collaboration diagram for SiHitsTestTool:

Public Member Functions

 SiHitsTestTool (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
TH2 * m_indetBarrel
TH2 * m_indetLongView
TH1 * m_hits_time
TH1 * m_hits_edep
TH1 * m_hits_log_edep
TH2 * m_hits_xy
TH2 * m_hits_zr
TH2 * m_hits_edep_zr
TH1 * m_hits_edep_z
TH1 * m_hits_edep_r
TH1 * m_hits_log_barcode
TH1 * m_hits_step_length
TH1 * m_hits_log_step_length

structors and AlgTool implementation

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

Detailed Description

Definition at line 11 of file SiHitsTestTool.h.

Constructor & Destructor Documentation

◆ SiHitsTestTool()

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

Definition at line 16 of file SiHitsTestTool.cxx.

17 : SimTestToolBase(type, name, parent),
18 m_collection("PixelHits"),
21 m_hits_xy(0), m_hits_zr(0),
27{
28 declareProperty("CollectionName", m_collection="PixelHits");
29}
std::string m_collection
TH1 * m_hits_log_step_length
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 SiHitsTestTool::initialize ( )
virtual

Reimplemented from SimTestToolBase.

Definition at line 31 of file SiHitsTestTool.cxx.

32{
33 // initialise general (if not done yet)
34 m_path+="InDet/";
35 _TH2D(m_indetBarrel,"idet_xy",100,-1200.,1200.,100,-1200.,1200.);
36 _SET_TITLE(m_indetBarrel, "indet hit distribution","x [mm]","y [mm]");
37 // perhaps better make r-phi?
38 _TH2D(m_indetLongView,"idet_zr",100,-3200.,3200.,100,0.,1200.);
39 _SET_TITLE(m_indetLongView, "indet hit distribution","z [mm]","r [mm]");
40
41 std::string detName("Pixel"); std::string detpathName("Pixel");
42 // initialise pixel or SCT variables:
43 if (m_collection=="PixelHits") {
44 detName = "Pixel"; detpathName = "Pixel";
45 }
46 else if (m_collection=="PileupPixelHits") {
47 detName = "PileupPixel"; detpathName = "Pixel";
48 }
49 else if (m_collection=="SCT_Hits") {
50 detName = "SCT"; detpathName = "SCT";
51 }
52 else if (m_collection=="PileupSCT_Hits") {
53 detName = "PileupSCT"; detpathName = "SCT";
54 }
55 else {
56 ATH_MSG_ERROR("collection: "<<m_collection<<", SiHitsTestTool for "<<name()<<" not supported !!!\n");
57 return StatusCode::FAILURE;
58 }
59 m_path+=detpathName+"/";
60 _TH2D(m_hits_xy,(detName+"_xy").c_str(),100,-1200.,1200.,100,-1200.,1200.);
61 _SET_TITLE(m_hits_xy, "hit distribution","x [mm]","y [mm]");
62 _TH2D(m_hits_zr,(detName+"_zr").c_str(),100,-3200.,3200.,100,0.,1200.);
63 _SET_TITLE(m_hits_zr, "hit distribution","z [mm]","r [mm]");
64 _TH1D_WEIGHTED(m_hits_time,(detName+"_edep_time").c_str(),100,0, 25);
65 _SET_TITLE(m_hits_time, "energy weighted hit distribution","t [ns]","dE/dt");
66 _TH1D(m_hits_edep,(detName+"_edep").c_str(),100,0.,1.);
67 _SET_TITLE(m_hits_edep, "hit distribution","edep [MeV]","dN/dE [1/MeV]");
68 _TH1D(m_hits_log_edep,(detName+"_log_edep").c_str(),100,-15.,2.);
69 _SET_TITLE(m_hits_log_edep, "log hit distribution","log(edep [MeV])","dN/dlog(E) [1/log(MeV)]");
70
71 _TH2D_WEIGHTED(m_hits_edep_zr,(detName+"_edep_zr").c_str(),100,-3200.,3200.,100,0.,1200.);
72 _SET_TITLE(m_hits_edep_zr, "energy weighted indet hit distribution","z [mm]","r [mm]");
73
74 _TH1D_WEIGHTED(m_hits_edep_z,(detName+"_edep_z").c_str(),100,-3200.,3200.);
75 _SET_TITLE(m_hits_edep_z, "energy weighted indet hit distribution (barrel only)","z [mm]","dE/dz [MeV/mm]");
76 _TH1D_WEIGHTED(m_hits_edep_r,(detName+"_edep_r").c_str(),100,0.,1200.);
77 _SET_TITLE(m_hits_edep_r, "energy weighted indet hit distribution (endcap only)","r [mm]","dE/dr [MeV/mm]");
78
79 _TH1D(m_hits_log_barcode,(detName+"_log_barcode").c_str(),50,0.,16.);
80 _SET_TITLE(m_hits_log_barcode, "log(barcode)","log(barcode)","dN/dlog(barcode)");
81
82 _TH1D(m_hits_step_length,(detName+"_step_length").c_str(),100,0.,2.);
83 _SET_TITLE(m_hits_step_length, "Step Length","Step Length l","dN/dl");
84 _TH1D(m_hits_log_step_length,(detName+"_log_step_length").c_str(), 100, -13, 2.);
85 _SET_TITLE(m_hits_log_step_length, "Logarithm of Step Length","log(l [mm])","dN/dlog(l)");
86
87 return StatusCode::SUCCESS;
88}
#define ATH_MSG_ERROR(x)
#define _TH2D_WEIGHTED(var, name, nbinx, xmin, xmax, nbiny, ymin, ymax)
#define _TH1D_WEIGHTED(var, name, nbin, xmin, xmax)
#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 SiHitsTestTool::processEvent ( )

Definition at line 90 of file SiHitsTestTool.cxx.

90 {
91
92 const SiHitCollection* p_collection = nullptr;
93 if (evtStore()->retrieve(p_collection,m_collection).isSuccess()) {
94 for (const SiHit& hit : *p_collection) {
95 GeoSiHit ghit(hit);
96 HepGeom::Point3D<double> u = ghit.getGlobalPosition();
97 if (m_hits_xy) {
98 m_hits_xy->Fill(u.x(),u.y());
99 m_hits_zr->Fill(u.z(),u.perp());
100 }
101 m_indetBarrel->Fill(u.x(),u.y());
102 m_indetLongView->Fill(u.z(),u.perp());
103
104 m_hits_time->Fill(hit.meanTime(),hit.energyLoss());
105 m_hits_edep->Fill(hit.energyLoss());
106 m_hits_log_edep->Fill( log(hit.energyLoss()) );
107 m_hits_edep_zr->Fill(u.z(),u.perp(),hit.energyLoss());
108 int barcode = HepMC::barcode(hit.particleLink()); // FIXME barcode-based
109 m_hits_log_barcode->Fill( barcode > 0 ? log(barcode) : -1 );
110 double step_length = ( hit.localStartPosition()-hit.localEndPosition() ).mag();
111 m_hits_step_length->Fill(step_length);
112 m_hits_log_step_length->Fill( log(step_length));
113
114 if (hit.getBarrelEndcap()==0) {
115 // barrel
116 m_hits_edep_z->Fill(u.z(),hit.energyLoss());
117 }
118 else {
119 // discs
120 m_hits_edep_r->Fill(u.perp(),hit.energyLoss());
121 }
122
123 // debuging only:
124 //hit.print();
125 /*
126 *** SCT Hit
127 Barrel/ EndCap Number -2
128 Layer/Disk Number 5
129 Eta Number 0
130 Phi Number 43
131 Side Number 1
132 */
133
134 }
135 }
136
137 return StatusCode::SUCCESS;
138}
AtlasHitsVector< SiHit > SiHitCollection
int barcode(const T *p)
Definition Barcode.h:16
@ u
Enums for curvilinear frames.
Definition ParamDefs.h:77

Member Data Documentation

◆ m_collection

std::string SiHitsTestTool::m_collection
private

Definition at line 23 of file SiHitsTestTool.h.

◆ m_histSvc

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

Definition at line 35 of file SimTestHisto.h.

35{"THistSvc", "SimTestHisto"};

◆ m_hits_edep

TH1 * SiHitsTestTool::m_hits_edep
private

Definition at line 27 of file SiHitsTestTool.h.

◆ m_hits_edep_r

TH1 * SiHitsTestTool::m_hits_edep_r
private

Definition at line 30 of file SiHitsTestTool.h.

◆ m_hits_edep_z

TH1* SiHitsTestTool::m_hits_edep_z
private

Definition at line 30 of file SiHitsTestTool.h.

◆ m_hits_edep_zr

TH2* SiHitsTestTool::m_hits_edep_zr
private

Definition at line 29 of file SiHitsTestTool.h.

◆ m_hits_log_barcode

TH1* SiHitsTestTool::m_hits_log_barcode
private

Definition at line 31 of file SiHitsTestTool.h.

◆ m_hits_log_edep

TH1 * SiHitsTestTool::m_hits_log_edep
private

Definition at line 27 of file SiHitsTestTool.h.

◆ m_hits_log_step_length

TH1 * SiHitsTestTool::m_hits_log_step_length
private

Definition at line 32 of file SiHitsTestTool.h.

◆ m_hits_step_length

TH1* SiHitsTestTool::m_hits_step_length
private

Definition at line 32 of file SiHitsTestTool.h.

◆ m_hits_time

TH1* SiHitsTestTool::m_hits_time
private

Definition at line 27 of file SiHitsTestTool.h.

◆ m_hits_xy

TH2* SiHitsTestTool::m_hits_xy
private

Definition at line 28 of file SiHitsTestTool.h.

◆ m_hits_zr

TH2 * SiHitsTestTool::m_hits_zr
private

Definition at line 28 of file SiHitsTestTool.h.

◆ m_indetBarrel

TH2* SiHitsTestTool::m_indetBarrel
private

Definition at line 25 of file SiHitsTestTool.h.

◆ m_indetLongView

TH2 * SiHitsTestTool::m_indetLongView
private

Definition at line 25 of file SiHitsTestTool.h.

◆ m_key

std::string SimTestToolBase::m_key
protectedinherited

The MC truth key.

Definition at line 34 of file SimTestToolBase.h.

◆ m_path

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

Definition at line 34 of file SimTestHisto.h.

34{"/truth/"};

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