9#include "CLHEP/Vector/LorentzVector.h"
16 std::string detName =
"CaloEntry";
17 std::string ntupName =
"TrackRecordCaloEntry";
19 if (
m_readKey.key() ==
"CaloEntryLayer") {
21 ntupName=
"TrackRecordCaloEntry";
23 else if (
m_readKey.key( )==
"MuonEntryLayer") {
25 ntupName=
"TrackRecordMuonEntry";
27 else if (
m_readKey.key() ==
"MuonExitLayer") {
29 ntupName=
"TrackRecordMuonExit";
32 ATH_MSG_ERROR(
"TrackRecordAnalysis for "<< name() <<
"not supported !!! \n");
33 return StatusCode::FAILURE;
40 float eta_down = -5.8;
44 if (detName ==
"CaloEntry") {
55 m_h_hits_x =
new TH1D((detName+
"_x").c_str(),
"hits_x", 100,x_down, x_up);
59 m_h_hits_y =
new TH1D((detName+
"_y").c_str(),
"hits_y", 100,x_down,x_up);
63 m_h_hits_z =
new TH1D((detName+
"_z").c_str(),
"hits_z", 100,z_down,z_up);
67 m_h_hits_r =
new TH1D((detName+
"_r").c_str(),
"hits_r", 100,0,radius);
71 m_h_xy =
new TH2D((detName+
"_xy").c_str(),
"xy", 100,x_down,x_up,100, x_down, x_up);
75 m_h_zr =
new TH2D((detName+
"_zr").c_str(),
"zr", 100,z_down,z_up,100, 0., radius);
79 m_h_hits_eta =
new TH1D((detName+
"_eta").c_str(),
"hits_eta", 100,eta_down,eta_up);
83 m_h_hits_phi =
new TH1D((detName+
"_phi").c_str(),
"hits_phi", 100,-3.1416,3.1416);
87 m_h_hits_px =
new TH1D((detName+
"_px").c_str(),
"Px", 100, -1500, 1500);
91 m_h_hits_py =
new TH1D((detName+
"_py").c_str(),
"Py", 100,-1500,1500);
95 m_h_hits_pz =
new TH1D((detName+
"_pz").c_str(),
"Pz", 100,-1500,1500);
99 m_h_hits_pt =
new TH1D((detName+
"_pt").c_str(),
"hits_pt", 100,0,2500);
103 m_h_time =
new TH1D((detName+
"_time").c_str(),
"time", 100,0, 250);
107 m_h_edep =
new TH1D((detName+
"_edep").c_str(),
"energy", 100,0,7500);
111 m_h_pdg =
new TH1D((detName+
"_pdg").c_str(),
"pdg", 100,-1000,1000);
116 m_tree =
new TTree(ntupName.c_str(), ntupName.c_str());
134 return StatusCode::SUCCESS;
155 const EventContext& ctx{Gaudi::Hive::currentContext()};
163 CLHEP::Hep3Vector p =(*track).GetPosition();
168 m_h_xy->Fill(p.x(), p.y());
169 m_h_zr->Fill(p.z(),p.perp());
173 CLHEP::Hep3Vector mom = (*track).GetMomentum();
178 m_h_edep->Fill((*track).GetEnergy());
180 m_h_pdg->Fill((*track).GetPDGCode());
182 m_x->push_back(p.x());
183 m_y->push_back(p.y());
184 m_z->push_back(p.z());
185 m_r->push_back(p.perp());
186 m_eta->push_back(p.eta());
187 m_phi->push_back(p.phi());
188 m_px->push_back(mom.x());
189 m_py->push_back(mom.y());
190 m_pz->push_back(mom.z());
191 m_pt->push_back(mom.perp());
192 m_edep->push_back((*track).GetEnergy());
193 m_time->push_back((*track).GetTime());
194 m_pdg->push_back((*track).GetPDGCode());
199 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
Handle class for reading from StoreGate.
AtlasHitsVector< TrackRecord > TrackRecordCollection
const ServiceHandle< ITHistSvc > & histSvc() const
The standard THistSvc (for writing histograms and TTrees and more to a root file) Returns (kind of) a...
CONT::const_iterator const_iterator
const_iterator begin() const
const_iterator end() const
Gaudi::Property< std::string > m_path
std::vector< float > * m_pdg
std::vector< float > * m_edep
std::vector< float > * m_y
Gaudi::Property< std::string > m_ntupleFileName
std::vector< float > * m_x
std::vector< float > * m_pt
std::vector< float > * m_px
std::vector< float > * m_time
TH1 * m_h_hits_x
Some variables.
std::vector< float > * m_eta
std::vector< float > * m_r
SG::ReadHandleKey< TrackRecordCollection > m_readKey
virtual StatusCode execute() override
std::vector< float > * m_z
std::vector< float > * m_py
virtual StatusCode initialize() override
std::vector< float > * m_phi
std::vector< float > * m_pz
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.