ATLAS Offline Software
LucidHitsTestTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "LucidHitsTestTool.h"
6 
9 
10 #include <cmath>
11 #include <string>
12 #include <TH2D.h>
13 #include <TH1D.h>
14 
15 LucidHitsTestTool::LucidHitsTestTool(const std::string& type, const std::string& name, const IInterface* parent)
17  , m_x_v_y_edep(0), m_x_v_y_hits(0), m_R_v_z_edep(0), m_R_v_z_hits(0)
18  , m_x_v_y_post(0), m_R_v_z_post(0), m_time_edep(0)
19  , m_pdgid(0), m_tubeid(0), m_gen_volume(0), m_wavelength(0), m_hit_edep(0), m_total_e(0)
20 {;}
21 
23 {
24  m_path+="Lucid/";
25  // ----------------------------------------
26  _TH2D_WEIGHTED(m_x_v_y_edep,"x_v_y_edep",100,-500.,500.,100,-500.,500.);
27  _SET_TITLE(m_x_v_y_edep, "Energy distribution [MeV]","x [mm]","y [mm]");
28  _TH2D(m_x_v_y_hits,"x_v_y_hits",100,-500.,500.,100,-500.,500.);
29  _SET_TITLE(m_x_v_y_hits, "Hit distribution","x [mm]","y [mm]");
30 
31  _TH2D_WEIGHTED(m_R_v_z_edep,"R_v_z_edep",100,0.,500.,100,5500.,8500.);
32  _SET_TITLE(m_R_v_z_edep, "Energy distribution [MeV]","R [mm]","z [mm]");
33  _TH2D(m_R_v_z_hits,"R_v_z_hits",100,0.,500.,100,5500.,8500.);
34  _SET_TITLE(m_R_v_z_hits, "Hit distribution","R [mm]","z [mm]");
35 
36  _TH2D(m_x_v_y_post,"x_v_y_post",100,-500.,500.,100,-500.,500.);
37  _SET_TITLE(m_x_v_y_post, "Post hit distribution","x [mm]","y [mm]");
38  _TH2D(m_R_v_z_post,"R_v_z_post",100,0.,500.,100,5500.,8500.);
39  _SET_TITLE(m_R_v_z_post, "Post hit distribution","R [mm]","z [mm]");
40 
41  _TH1D(m_pdgid,"pdg_id",1000,-3000,3000.);
42  _SET_TITLE(m_pdgid, "PDG ID","PDG ID","Hits");
43 
44  _TH2D_WEIGHTED(m_time_edep,"Time_edep",100,-10.,50.,100,-10.,50.);
45  _SET_TITLE(m_time_edep, "Energy distribution [MeV]","Time 1 [ns]","Time 2 [ns]");
46 
47  _TH1D(m_tubeid,"tube_id",1000,0,10000.);
48  _SET_TITLE(m_tubeid, "Tube ID","Tube ID","Hits");
49 
50  _TH1D(m_gen_volume,"gen_volume",1000,0,100000.);
51  _SET_TITLE(m_gen_volume, "Volume","Volume","Hits");
52 
53  _TH1D(m_wavelength,"wavelength",1000,0,3000.);
54  _SET_TITLE(m_wavelength, "Wavelength","Wavelength","Hits");
55 
56  _TH1D(m_hit_edep,"hit_edep",100,0,10000.);
57  _SET_TITLE(m_hit_edep, "Energy deposited per hit","Energy [MeV]","Hits");
58 
59  _TH1D(m_total_e,"total_e",1000,0,100000.);
60  _SET_TITLE(m_total_e, "Total energy deposited","Energy [MeV]","Events");
61 
62  return StatusCode::SUCCESS;
63 }
64 
66 
67  double etot = 0;
68  const LUCID_SimHitCollection* iter = nullptr;
69  CHECK(evtStore()->retrieve(iter));
70  for (const LUCID_SimHit& hit : *iter) {
71  m_x_v_y_edep->Fill( hit.GetX() , hit.GetY() , hit.GetEnergy() );
72  m_x_v_y_hits->Fill( hit.GetX() , hit.GetY() );
73  m_R_v_z_edep->Fill( std::sqrt( hit.GetX()*hit.GetX() + hit.GetY()*hit.GetY() ) , std::abs( hit.GetZ() ) , hit.GetEnergy() );
74  m_R_v_z_hits->Fill( std::sqrt( hit.GetX()*hit.GetX() + hit.GetY()*hit.GetY() ) , std::abs( hit.GetZ() ) );
75  m_x_v_y_post->Fill( hit.GetEPX() , hit.GetEPY() );
76  m_R_v_z_post->Fill( std::sqrt( hit.GetEPX()*hit.GetEPX() + hit.GetEPY()*hit.GetEPY() ) , std::abs( hit.GetEPZ() ) );
77 
78  m_pdgid->Fill( hit.GetPdgCode() );
79  m_time_edep->Fill( hit.GetPreStepTime() , hit.GetPostStepTime() , hit.GetEnergy() );
80  m_tubeid->Fill( hit.GetTubeID() );
81  m_gen_volume->Fill( hit.GetGenVolume() );
82  m_wavelength->Fill( hit.GetWavelength() );
83  m_hit_edep->Fill( hit.GetEnergy() );
84 
85  etot+=hit.GetEnergy();
86  }
87  m_total_e->Fill( etot );
88 
89  return StatusCode::SUCCESS;
90 }
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
LucidHitsTestTool::m_gen_volume
TH1 * m_gen_volume
Definition: LucidHitsTestTool.h:21
LucidHitsTestTool::processEvent
StatusCode processEvent()
Definition: LucidHitsTestTool.cxx:65
LucidHitsTestTool::m_hit_edep
TH1 * m_hit_edep
Definition: LucidHitsTestTool.h:21
LucidHitsTestTool::m_x_v_y_edep
TH2 * m_x_v_y_edep
Definition: LucidHitsTestTool.h:19
AtlasHitsVector
Definition: AtlasHitsVector.h:33
LucidHitsTestTool::m_tubeid
TH1 * m_tubeid
Definition: LucidHitsTestTool.h:21
LucidHitsTestTool::m_total_e
TH1 * m_total_e
Definition: LucidHitsTestTool.h:21
_SET_TITLE
#define _SET_TITLE(var, title, xaxis, yaxis)
Definition: SimTestHisto.h:93
LucidHitsTestTool::initialize
virtual StatusCode initialize()
Definition: LucidHitsTestTool.cxx:22
GenParticle.h
_TH1D
#define _TH1D(var, name, nbin, xmin, xmax)
Definition: SimTestHisto.h:47
LucidHitsTestTool::m_x_v_y_hits
TH2 * m_x_v_y_hits
Definition: LucidHitsTestTool.h:19
SimTestToolBase
Definition: SimTestToolBase.h:20
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
LucidHitsTestTool::m_R_v_z_post
TH2 * m_R_v_z_post
Definition: LucidHitsTestTool.h:20
LucidHitsTestTool::m_R_v_z_hits
TH2 * m_R_v_z_hits
Definition: LucidHitsTestTool.h:19
LUCID_SimHit
Definition: LUCID_SimHit.h:17
test_pyathena.parent
parent
Definition: test_pyathena.py:15
_TH2D
#define _TH2D(var, name, nbinx, xmin, xmax, nbiny, ymin, ymax)
Definition: SimTestHisto.h:81
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
_TH2D_WEIGHTED
#define _TH2D_WEIGHTED(var, name, nbinx, xmin, xmax, nbiny, ymin, ymax)
Definition: SimTestHisto.h:89
LUCID_SimHitCollection.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
LucidHitsTestTool::m_R_v_z_edep
TH2 * m_R_v_z_edep
Definition: LucidHitsTestTool.h:19
LucidHitsTestTool.h
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
LucidHitsTestTool::m_wavelength
TH1 * m_wavelength
Definition: LucidHitsTestTool.h:21
SimTestHisto::m_path
std::string m_path
Definition: SimTestHisto.h:34
LucidHitsTestTool::m_pdgid
TH1 * m_pdgid
Definition: LucidHitsTestTool.h:21
LucidHitsTestTool::LucidHitsTestTool
LucidHitsTestTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: LucidHitsTestTool.cxx:15
LucidHitsTestTool::m_x_v_y_post
TH2 * m_x_v_y_post
Definition: LucidHitsTestTool.h:20
LucidHitsTestTool::m_time_edep
TH2 * m_time_edep
Definition: LucidHitsTestTool.h:20