ATLAS Offline Software
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):
10 #include "TrackRecordFillerTool.h"
11 
12 
13 using CLHEP::GeV;
14 
15 
16 namespace D3PD {
17 
19  const std::string& name,
20  const IInterface* parent )
22  m_OnlyMuon(false),
23  m_EnergyThreshold(1.*GeV)
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 
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 
D3PD::TrackRecordFillerTool::m_posy
float * m_posy
Definition: TrackRecordFillerTool.h:45
GeV
#define GeV
Definition: PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx:17
TrackRecordFillerTool.h
D3PD::AddVariable::addVariable
virtual StatusCode addVariable(const std::string &name, const std::type_info &ti, void *&ptr, const std::string &docstring="", const void *defval=0)
Add a variable to the tuple.
Definition: AddVariable.cxx:85
D3PD::TrackRecordFillerTool::m_phi
float * m_phi
Definition: TrackRecordFillerTool.h:43
D3PD::TrackRecordFillerTool::m_barcode
int * m_barcode
Definition: TrackRecordFillerTool.h:38
D3PD::TrackRecordFillerTool::m_eta
float * m_eta
Definition: TrackRecordFillerTool.h:42
D3PD::TrackRecordFillerTool::m_posz
float * m_posz
Definition: TrackRecordFillerTool.h:46
D3PD
Block filler tool for noisy FEB information.
Definition: CaloCellDetailsFillerTool.cxx:29
D3PD::TrackRecordFillerTool::fill
virtual StatusCode fill(const TrackRecord &obj)
Function filling the ntuple variables for a single object.
Definition: TrackRecordFillerTool.cxx:43
D3PD::TrackRecordFillerTool::m_time
float * m_time
Definition: TrackRecordFillerTool.h:47
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
D3PD::TrackRecordFillerTool::m_EnergyThreshold
float m_EnergyThreshold
Definition: TrackRecordFillerTool.h:52
test_pyathena.parent
parent
Definition: test_pyathena.py:15
D3PD::BlockFillerTool
Type-safe wrapper for block filler tools.
Definition: BlockFillerTool.h:65
D3PD::TrackRecordFillerTool::m_OnlyMuon
bool m_OnlyMuon
Definition: TrackRecordFillerTool.h:50
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
D3PD::TrackRecordFillerTool::m_pt
float * m_pt
Definition: TrackRecordFillerTool.h:41
D3PD::TrackRecordFillerTool::book
virtual StatusCode book()
Function booking the ntuple variables.
Definition: TrackRecordFillerTool.cxx:28
D3PD::TrackRecordFillerTool::m_energy
float * m_energy
Definition: TrackRecordFillerTool.h:40
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
errorcheck.h
Helpers for checking error return status codes and reporting errors.
D3PD::TrackRecordFillerTool::m_pdgid
int * m_pdgid
Definition: TrackRecordFillerTool.h:39
TrackRecord
Definition: TrackRecord.h:12
D3PD::TrackRecordFillerTool::m_posx
float * m_posx
Definition: TrackRecordFillerTool.h:44
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
python.PyAthena.obj
obj
Definition: PyAthena.py:132
D3PD::TrackRecordFillerTool::TrackRecordFillerTool
TrackRecordFillerTool(const std::string &type, const std::string &name, const IInterface *parent)
Regular Gaudi AlgTool constructor.
Definition: TrackRecordFillerTool.cxx:18