ATLAS Offline Software
Loading...
Searching...
No Matches
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
15LucidHitsTestTool::LucidHitsTestTool(const std::string& type, const std::string& name, const IInterface* parent)
16 : SimTestToolBase(type, name, parent)
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}
#define CHECK(...)
Evaluate an expression and check for errors.
AtlasHitsVector< LUCID_SimHit > LUCID_SimHitCollection
#define _TH2D_WEIGHTED(var, name, nbinx, xmin, xmax, nbiny, ymin, ymax)
#define _TH2D(var, name, nbinx, xmin, xmax, nbiny, ymin, ymax)
#define _TH1D(var, name, nbin, xmin, xmax)
#define _SET_TITLE(var, title, xaxis, yaxis)
virtual StatusCode initialize()
LucidHitsTestTool(const std::string &type, const std::string &name, const IInterface *parent)
std::string m_path
SimTestToolBase(const std::string &type, const std::string &name, const IInterface *parent)