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

18  m_collection("PixelHits"),
21  m_hits_xy(0), m_hits_zr(0),
22  m_hits_edep_zr(0),
27 {
28  declareProperty("CollectionName", m_collection="PixelHits");
29 }

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 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 }

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

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.

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


The documentation for this class was generated from the following files:
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
SiHitsTestTool::m_hits_log_step_length
TH1 * m_hits_log_step_length
Definition: SiHitsTestTool.h:32
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
SiHitsTestTool::m_hits_edep
TH1 * m_hits_edep
Definition: SiHitsTestTool.h:27
SiHitsTestTool::m_hits_xy
TH2 * m_hits_xy
Definition: SiHitsTestTool.h:28
SiHitsTestTool::m_hits_step_length
TH1 * m_hits_step_length
Definition: SiHitsTestTool.h:32
AtlasHitsVector
Definition: AtlasHitsVector.h:33
_SET_TITLE
#define _SET_TITLE(var, title, xaxis, yaxis)
Definition: SimTestHisto.h:93
SimTestToolBase::SimTestToolBase
SimTestToolBase(const std::string &type, const std::string &name, const IInterface *parent)
Definition: SimTestToolBase.cxx:11
Trk::u
@ u
Enums for curvilinear frames.
Definition: ParamDefs.h:77
_TH1D
#define _TH1D(var, name, nbin, xmin, xmax)
Definition: SimTestHisto.h:47
GeoSiHit
Definition: GeoSiHit.h:30
SiHit
Definition: SiHit.h:19
SiHitsTestTool::m_hits_edep_zr
TH2 * m_hits_edep_zr
Definition: SiHitsTestTool.h:29
SiHitsTestTool::m_hits_zr
TH2 * m_hits_zr
Definition: SiHitsTestTool.h:28
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.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:342
SiHitsTestTool::m_hits_time
TH1 * m_hits_time
Definition: SiHitsTestTool.h:27
HepMC::barcode
int barcode(const T *p)
Definition: Barcode.h:16
test_pyathena.parent
parent
Definition: test_pyathena.py:15
_TH2D
#define _TH2D(var, name, nbinx, xmin, xmax, nbiny, ymin, ymax)
Definition: SimTestHisto.h:81
_TH2D_WEIGHTED
#define _TH2D_WEIGHTED(var, name, nbinx, xmin, xmax, nbiny, ymin, ymax)
Definition: SimTestHisto.h:89
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:581
_TH1D_WEIGHTED
#define _TH1D_WEIGHTED(var, name, nbin, xmin, xmax)
Definition: SimTestHisto.h:67
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
SiHitsTestTool::m_hits_log_edep
TH1 * m_hits_log_edep
Definition: SiHitsTestTool.h:27
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
SiHitsTestTool::m_hits_log_barcode
TH1 * m_hits_log_barcode
Definition: SiHitsTestTool.h:31
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
SiHitsTestTool::m_indetBarrel
TH2 * m_indetBarrel
Definition: SiHitsTestTool.h:25
SiHitsTestTool::m_indetLongView
TH2 * m_indetLongView
Definition: SiHitsTestTool.h:25
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
SiHitsTestTool::m_hits_edep_r
TH1 * m_hits_edep_r
Definition: SiHitsTestTool.h:30
SiHitsTestTool::m_hits_edep_z
TH1 * m_hits_edep_z
Definition: SiHitsTestTool.h:30
SimTestHisto::m_path
std::string m_path
Definition: SimTestHisto.h:34
SimTestToolBase::m_key
std::string m_key
The MC truth key.
Definition: SimTestToolBase.h:34
python.LArCondContChannels.detName
detName
Definition: LArCondContChannels.py:665
mag
Scalar mag() const
mag method
Definition: AmgMatrixBasePlugin.h:26
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
SiHitsTestTool::m_collection
std::string m_collection
Definition: SiHitsTestTool.h:23