ATLAS Offline Software
Public Member Functions | Protected Attributes | Private Attributes | List of all members
TrtHitsTestTool Class Reference

#include <TrtHitsTestTool.h>

Inheritance diagram for TrtHitsTestTool:
Collaboration diagram for TrtHitsTestTool:

Public Member Functions

 TrtHitsTestTool (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_photons
 
TH1 * m_hits_edep_photons
 
TH1 * m_hits_time_nonphotons
 
TH1 * m_hits_edep_nonphotons
 
TH2 * m_hits_xy
 
TH2 * m_hits_zr
 
TH2 * m_hits_edep_zr_photons
 
TH2 * m_hits_edep_zr_nonphotons
 
TH1 * m_hits_log_barcode
 

structors and AlgTool implementation

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

Detailed Description

Definition at line 11 of file TrtHitsTestTool.h.

Constructor & Destructor Documentation

◆ TrtHitsTestTool()

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

Definition at line 13 of file TrtHitsTestTool.cxx.

15  m_collection("TRTUncompressedHits"),
19  m_hits_xy(0), m_hits_zr(0),
22 {
23  declareProperty("CollectionName", m_collection="TRTUncompressedHits");
24 }

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 TrtHitsTestTool::initialize ( )
virtual

Reimplemented from SimTestToolBase.

Definition at line 26 of file TrtHitsTestTool.cxx.

27 {
28  // initialise general (if not done yet)
29  m_path+="InDet/";
30  _TH2D(m_indetBarrel,"idet_xy",100,-1200.,1200.,100,-1200.,1200.);
31  _SET_TITLE(m_indetBarrel, "indet hit distribution [All]","x [mm]","y [mm]");
32  _TH2D(m_indetLongView,"idet_zr",100,-3200.,3200.,100,0.,1200.);
33  _SET_TITLE(m_indetLongView, "indet hit distribution [All]","z [mm]","r [mm]");
34 
35  if (m_collection=="TRTUncompressedHits") m_path+="TRT/";
36  else if (m_collection=="PileupTRTUncompressedHits") m_path+="PileupTRT/";
37  else { std::cerr<<"unsupported CollectionName for "<< this->name()<<std::endl; }
38 
39  _TH2D(m_hits_xy,"trt_xy",100,-1200.,1200.,100,-1200.,1200.);
40  _SET_TITLE(m_hits_xy, "hit distribution [All]","x [mm]","y [mm]");
41  _TH2D(m_hits_zr,"trt_zr",100,-3200.,3200.,100,0.,1200.);
42  _SET_TITLE(m_hits_zr, "hit distribution [All]","z [mm]","r [mm]");
43  _TH1D(m_hits_time_photons,"trt_edep_time_photons",100,0,25);
44  _SET_TITLE(m_hits_time_photons, "energy weighted hit distribution [Photons]","t [ns]","dE/dt");
45  _TH1D(m_hits_edep_photons,"trt_edep_photons",100,0.,40.);
46  _SET_TITLE(m_hits_edep_photons, "TRT hit distribution [Photons]","edep [MeV]","dN/dE [1/MeV]");
47  _TH2D(m_hits_edep_zr_photons,"trt_edep_zr_photons",100,-3200.,3200.,100,0.,1200.);
48  _SET_TITLE(m_hits_edep_zr_photons, "TRT energy weighted indet hit distribution [Photons]","z [mm]","r [mm]");
49  _TH1D(m_hits_time_nonphotons,"trt_edep_time_nonphotons",100,0,25);
50  _SET_TITLE(m_hits_time_nonphotons, "energy weighted hit distribution [Non-Photons]","t [ns]","dE/dt");
51  _TH1D(m_hits_edep_nonphotons,"trt_edep_nonphotons",100,0.,5.);
52  _SET_TITLE(m_hits_edep_nonphotons, "TRT hit distribution [Non-Photons]","edep [MeV]","dN/dE [1/MeV]");
53  _TH2D(m_hits_edep_zr_nonphotons,"trt_edep_zr_nonphotons",100,-3200.,3200.,100,0.,1200.);
54  _SET_TITLE(m_hits_edep_zr_nonphotons, "TRT energy weighted indet hit distribution [Non-Photons]","z [mm]","r [mm]");
55 
56  _TH1D(m_hits_log_barcode,"trt_log_barcode",50,0.,16.);
57  _SET_TITLE(m_hits_log_barcode, "log(barcode)","log(barcode)","dN/dlog(barcode)");
58 
59  return StatusCode::SUCCESS;
60 }

◆ processEvent()

StatusCode TrtHitsTestTool::processEvent ( )

Definition at line 63 of file TrtHitsTestTool.cxx.

63  {
64 
65  const TRTUncompressedHitCollection* p_collection = nullptr;
66  if (evtStore()->retrieve(p_collection,m_collection).isSuccess()) {
67  for (const TRTUncompressedHit& hit : *p_collection) {
68  GeoTRTUncompressedHit ghit(hit);
69  HepGeom::Point3D<double> u = ghit.getGlobalPosition();
70  m_indetBarrel->Fill(u.x(),u.y());
71  m_indetLongView->Fill(u.z(),u.perp());
72  m_hits_xy->Fill(u.x(),u.y());
73  m_hits_zr->Fill(u.z(),u.perp());
74  int barcode = HepMC::barcode(hit.particleLink()); // FIXME barcode-based
75  m_hits_log_barcode->Fill( barcode > 0 ? log(barcode) : -1);
76  int particleId(hit.GetParticleEncoding());
77  if (particleId == 22 || static_cast<int>(abs(particleId)/100000) == 41 || static_cast<int>(abs(particleId)/10000000) == 1)
78  {
79  //criteria set to match TRT_HitCollectionCnv_p3.cxx
80  //only photon energy is persistified properly.
81  m_hits_time_photons->Fill(hit.GetGlobalTime(),hit.GetEnergyDeposit());
82  m_hits_edep_photons->Fill(hit.GetEnergyDeposit());
83  m_hits_edep_zr_photons->Fill(u.z(),u.perp(),hit.GetEnergyDeposit());
84  }
85  else
86  {
87  m_hits_time_nonphotons->Fill(hit.GetGlobalTime(),hit.GetEnergyDeposit());
88  m_hits_edep_nonphotons->Fill(hit.GetEnergyDeposit());
89  m_hits_edep_zr_nonphotons->Fill(u.z(),u.perp(),hit.GetEnergyDeposit());
90  }
91  }
92  }
93  else {
94  ATH_MSG_WARNING("TRT Hit collection not found!");
95  }
96 
97  return StatusCode::SUCCESS;
98 }

Member Data Documentation

◆ m_collection

std::string TrtHitsTestTool::m_collection
private

Definition at line 22 of file TrtHitsTestTool.h.

◆ m_histSvc

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

Definition at line 35 of file SimTestHisto.h.

◆ m_hits_edep_nonphotons

TH1 * TrtHitsTestTool::m_hits_edep_nonphotons
private

Definition at line 27 of file TrtHitsTestTool.h.

◆ m_hits_edep_photons

TH1 * TrtHitsTestTool::m_hits_edep_photons
private

Definition at line 26 of file TrtHitsTestTool.h.

◆ m_hits_edep_zr_nonphotons

TH2 * TrtHitsTestTool::m_hits_edep_zr_nonphotons
private

Definition at line 29 of file TrtHitsTestTool.h.

◆ m_hits_edep_zr_photons

TH2* TrtHitsTestTool::m_hits_edep_zr_photons
private

Definition at line 29 of file TrtHitsTestTool.h.

◆ m_hits_log_barcode

TH1* TrtHitsTestTool::m_hits_log_barcode
private

Definition at line 30 of file TrtHitsTestTool.h.

◆ m_hits_time_nonphotons

TH1* TrtHitsTestTool::m_hits_time_nonphotons
private

Definition at line 27 of file TrtHitsTestTool.h.

◆ m_hits_time_photons

TH1* TrtHitsTestTool::m_hits_time_photons
private

Definition at line 26 of file TrtHitsTestTool.h.

◆ m_hits_xy

TH2* TrtHitsTestTool::m_hits_xy
private

Definition at line 28 of file TrtHitsTestTool.h.

◆ m_hits_zr

TH2 * TrtHitsTestTool::m_hits_zr
private

Definition at line 28 of file TrtHitsTestTool.h.

◆ m_indetBarrel

TH2* TrtHitsTestTool::m_indetBarrel
private

Definition at line 24 of file TrtHitsTestTool.h.

◆ m_indetLongView

TH2 * TrtHitsTestTool::m_indetLongView
private

Definition at line 24 of file TrtHitsTestTool.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
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
TrtHitsTestTool::m_hits_edep_zr_photons
TH2 * m_hits_edep_zr_photons
Definition: TrtHitsTestTool.h:29
TrtHitsTestTool::m_collection
std::string m_collection
Definition: TrtHitsTestTool.h:22
AtlasHitsVector
Definition: AtlasHitsVector.h:33
TRTUncompressedHit
Definition: TRTUncompressedHit.h:11
TrtHitsTestTool::m_hits_edep_nonphotons
TH1 * m_hits_edep_nonphotons
Definition: TrtHitsTestTool.h:27
_SET_TITLE
#define _SET_TITLE(var, title, xaxis, yaxis)
Definition: SimTestHisto.h:93
TrtHitsTestTool::m_hits_time_photons
TH1 * m_hits_time_photons
Definition: TrtHitsTestTool.h:26
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
TrtHitsTestTool::m_indetBarrel
TH2 * m_indetBarrel
Definition: TrtHitsTestTool.h:24
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
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
TrtHitsTestTool::m_hits_edep_zr_nonphotons
TH2 * m_hits_edep_zr_nonphotons
Definition: TrtHitsTestTool.h:29
HepMC::barcode
int barcode(const T *p)
Definition: Barcode.h:16
test_pyathena.parent
parent
Definition: test_pyathena.py:15
TrtHitsTestTool::m_hits_edep_photons
TH1 * m_hits_edep_photons
Definition: TrtHitsTestTool.h:26
TrtHitsTestTool::m_hits_zr
TH2 * m_hits_zr
Definition: TrtHitsTestTool.h:28
_TH2D
#define _TH2D(var, name, nbinx, xmin, xmax, nbiny, ymin, ymax)
Definition: SimTestHisto.h:81
McEventCollection
This defines the McEventCollection, which is really just an ObjectVector of McEvent objects.
Definition: McEventCollection.h:33
TrtHitsTestTool::m_hits_log_barcode
TH1 * m_hits_log_barcode
Definition: TrtHitsTestTool.h:30
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
TrtHitsTestTool::m_hits_time_nonphotons
TH1 * m_hits_time_nonphotons
Definition: TrtHitsTestTool.h:27
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
TrtHitsTestTool::m_indetLongView
TH2 * m_indetLongView
Definition: TrtHitsTestTool.h:24
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
GeoTRTUncompressedHit
Definition: GeoTRTUncompressedHit.h:25
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
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
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
TrtHitsTestTool::m_hits_xy
TH2 * m_hits_xy
Definition: TrtHitsTestTool.h:28