ATLAS Offline Software
Loading...
Searching...
No Matches
TrackRecordFillerTool.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
5// Gaudi/Athena include(s):
7#include "CLHEP/Units/SystemOfUnits.h"
8
9// Local include(s):
11
12
13using CLHEP::GeV;
14
15
16namespace D3PD {
17
19 const std::string& name,
20 const IInterface* parent )
21 : BlockFillerTool< TrackRecord >( type, name, parent ),
22 m_OnlyMuon(false),
24 {
25 TrackRecordFillerTool::book().ignore(); // Avoid coverity warnings.
26 }
27
29
30 CHECK( addVariable( "barcode", m_barcode, "particle bar code" ) );
31 CHECK( addVariable( "pdgId", m_pdgid, "particle PDG id" ) );
32 CHECK( addVariable( "E", m_energy, "particle energy" ) );
33 CHECK( addVariable( "pt", m_pt, "particle transverse momentum" ) );
34 CHECK( addVariable( "eta", m_eta, "particle pseudorapidity" ) );
35 CHECK( addVariable( "phi", m_phi, "particle azimuthal angle" ) );
36 CHECK( addVariable( "pos_x", m_posx, "particle position x coordinate" ) );
37 CHECK( addVariable( "pos_y", m_posy, "particle position y coordinate" ) );
38 CHECK( addVariable( "pos_z", m_posz, "particle position z coordinate" ) );
39 CHECK( addVariable( "time", m_time, "particle time" ) );
40 return StatusCode::SUCCESS;
41 }
42
43 StatusCode TrackRecordFillerTool::fill( const TrackRecord& obj ) {
44
45 bool pass(true);
46 if ( m_OnlyMuon && abs( obj.GetPDGCode() ) != 13 ) pass = false;
47 if ( obj.GetEnergy() < m_EnergyThreshold ) pass = false;
48 if ( pass ){
49 *m_barcode = obj.barcode(); // FIXME barcode-based
50 *m_pdgid = obj.GetPDGCode();
51 *m_energy = obj.GetEnergy();
52 *m_pt = obj.GetMomentum().rho();
53 *m_eta = obj.GetMomentum().eta();
54 *m_phi = obj.GetMomentum().phi();
55 *m_posx = obj.GetPosition().x();
56 *m_posy = obj.GetPosition().y();
57 *m_posz = obj.GetPosition().z();
58 *m_time = obj.GetTime();
59 }
60 return StatusCode::SUCCESS;
61 }
62
63
64} // namespace D3PD
65
Helpers for checking error return status codes and reporting errors.
#define CHECK(...)
Evaluate an expression and check for errors.
virtual StatusCode addVariable(const std::string &name, const std::type_info &ti, void *&ptr, const std::string &docstring="", const void *defval=0)
Type-safe wrapper for block filler tools.
virtual StatusCode fill(const TrackRecord &obj)
Function filling the ntuple variables for a single object.
virtual StatusCode book()
Function booking the ntuple variables.
TrackRecordFillerTool(const std::string &type, const std::string &name, const IInterface *parent)
Regular Gaudi AlgTool constructor.
Block filler tool for noisy FEB information.