ATLAS Offline Software
TileTrackFillerTool.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 /*
6  * File: TileTrackFillerTool.cxx
7  * Author: Marco van Woerden <mvanwoer@cern.ch>, Gang Qin <gang.qin@cern.ch>, Archil Durglishvili <archil.durglishvili@cern.ch>
8  * Date: Nov 2014
9  *
10  */
11 
12 // INCLUDE HEADER FILE
14 #include "TileTrackFillerTool.h"
15 
16 //xAOD tools
18 
19 // ADD TILETRACKFILLERTOOL TO D3PD NAMESPACE
20 namespace D3PD{
21 //=========================================================================
23  const std::string& name,
24  const IInterface* parent)
26 m_trackToVertexTool("Reco::TrackToVertex"){
27  //=========================================================================
28 
29  TileTrackFillerTool::book().ignore(); // AVOID COVERITY WARNINGS
30  declareProperty("LevelOfDetails", m_LevelOfDetails);
31  declareProperty("CellsName", m_calocellContainerName="SelectedCells" );
32  declareProperty("TrackTools", m_trackInCalo);
33  declareProperty("TrackToVertexTool", m_trackToVertexTool, "tool to map track to vertex");
34  declareProperty("TrackParType", m_trkParType = 1);
35 
36 } // TileTrackFillerTool::TileTrackFillerTool
37 
38 //===============================================
40  //===============================================
41  // RETRIEVES NECESSARY SERVICES AND TOOLS, INSTANTIATES GLOBAL VARIABLES
42 
43  ATH_MSG_DEBUG("TILETRACKERFILLERTOOL::INITIALIZE()");
44 
45  // CHECK WHETHER BLOCKFILLERTOOL HAS BEEN INITIALIZED
47 
48  CHECK(m_trackInCalo.retrieve());
49 
50  CHECK(m_trackToVertexTool.retrieve());
51 
52  return StatusCode::SUCCESS;
53 } // TileTrackFillerTool::initialize
54 
55 //=========================================
57  //=========================================
58  // ADDS VARIABLES TO THE D3PD TREE
59 
60  // OUTPUT MESSAGING SERVICE
61  ATH_MSG_DEBUG("TileTrackFillerTool::book()");
62 
63  if (m_LevelOfDetails > 0){
64 
65  CHECK( addVariable("pt", m_pt, "", m_defaultValue));
66  CHECK( addVariable("p", m_p, "", m_defaultValue));
67  if(m_trkParType)
68  {
69  CHECK( addVariable("eta_layer", m_eta ));
70  CHECK( addVariable("phi_layer", m_phi ));
71  } else
72  {
73  CHECK( addVariable("eta_sampling", m_eta ));
74  CHECK( addVariable("phi_sampling", m_phi ));
75  }
76 
77  CHECK( addVariable("numberOfPixelHits", m_numberOfPixelHits, "", m_defaultValue));
78  CHECK( addVariable("numberOfSCTHits", m_numberOfSCTHits, "", m_defaultValue));
79  CHECK( addVariable("numberOfTRTHits", m_numberOfTRTHits, "", m_defaultValue));
80 
81  CHECK( addVariable("d0", m_d0, "", m_defaultValue));
82  CHECK( addVariable("z0", m_z0, "", m_defaultValue));
83  } // IF
84 
85  if (m_LevelOfDetails > 1){
86 
87  if(m_trkParType)
88  {
89  CHECK( addVariable("x_layer", m_x ));
90  CHECK( addVariable("y_layer", m_y ));
91  CHECK( addVariable("z_layer", m_z ));
92  } else
93  {
94  CHECK( addVariable("x_sampling", m_x ));
95  CHECK( addVariable("y_sampling", m_y ));
96  CHECK( addVariable("z_sampling", m_z ));
97  }
98 
99  CHECK( addVariable("vtxX", m_vtxX, "", m_defaultValue));
100  CHECK( addVariable("vtxY", m_vtxY, "", m_defaultValue));
101  CHECK( addVariable("vtxZ", m_vtxZ, "", m_defaultValue));
102  CHECK( addVariable("phi0", m_phi0, "", m_defaultValue));
103  CHECK( addVariable("theta", m_theta, "", m_defaultValue));
104  CHECK( addVariable("qOverP", m_qOverP, "", m_defaultValue));
105  }
106 
107  if (m_LevelOfDetails > 2){
108  CHECK( addVariable("nucone05", m_nucone05, "", m_defaultValue));
109  CHECK( addVariable("nucone10", m_nucone10, "", m_defaultValue));
110  CHECK( addVariable("nucone20", m_nucone20, "", m_defaultValue));
111  CHECK( addVariable("nucone30", m_nucone30, "", m_defaultValue));
112  CHECK( addVariable("nucone40", m_nucone40, "", m_defaultValue));
113 
114  CHECK( addVariable("ptcone10", m_ptcone10, "", m_defaultValue));
115  CHECK( addVariable("ptcone20", m_ptcone20, "", m_defaultValue));
116  CHECK( addVariable("ptcone30", m_ptcone30, "", m_defaultValue));
117  CHECK( addVariable("ptcone40", m_ptcone40, "", m_defaultValue));
118  CHECK( addVariable("ptcone45", m_ptcone45, "", m_defaultValue));
119  }
120 
121  if (m_LevelOfDetails > 3){
122  CHECK( addVariable("numberOfInnermostPixelLayerHits", m_numberOfBLayerHits, "", m_defaultValue));
123  CHECK( addVariable("numberOfTRTHighThresholdHits", m_numberOfTRTHighThresholdHits, "", m_defaultValue));
124  CHECK( addVariable("numberOfInnermostPixelLayerSharedHits", m_numberOfBLayerSharedHits, "", m_defaultValue));
125  CHECK( addVariable("numberOfPixelSharedHits", m_numberOfPixelSharedHits, "", m_defaultValue));
126  CHECK( addVariable("numberOfPixelHoles", m_numberOfPixelHoles, "", m_defaultValue));
127  CHECK( addVariable("numberOfSCTSharedHits", m_numberOfSCTSharedHits, "", m_defaultValue));
128  CHECK( addVariable("numberOfSCTHoles", m_numberOfSCTHoles, "", m_defaultValue));
129  CHECK( addVariable("numberOfTRTOutliers", m_numberOfTRTOutliers, "", m_defaultValue));
130  CHECK( addVariable("numberOfTRTHighThresholdOutliers", m_numberOfTRTHighThresholdOutliers, "", m_defaultValue));
131 
132  CHECK( addVariable("numberOfGangedPixels", m_numberOfGangedPixels, "", m_defaultValue));
133  CHECK( addVariable("numberOfOutliersOnTrack", m_numberOfOutliersOnTrack, "", m_defaultValue));
134  CHECK( addVariable("numberOfTrackSummaryTypes", m_numberOfTrackSummaryTypes, "", m_defaultValue));
135  }
136 
137  return StatusCode::SUCCESS;
138 } // TileTrackFillerTool::book
139 
140 //================================================================
142  //================================================================
143  // OUTPUT MESSAGING SERVICE
144  ATH_MSG_DEBUG("TileTrackFillerTool::fill");
145 
146  // Get Track information
147  const xAOD::TrackParticle* trackPointer = &p;
148 
149  if(!trackPointer) { ATH_MSG_INFO("NULL POINTER"); return StatusCode::RECOVERABLE; }
150  auto perigee = m_trackToVertexTool->perigeeAtVertex(Gaudi::Hive::currentContext(), *trackPointer);
151 
152  // STORE TRACK PARAMETERS
153  if(m_LevelOfDetails > 0){
154  *m_pt = trackPointer->pt();
155  *m_p = trackPointer->p4().P();
156 
157  std::vector< std::vector<double> > positions = (m_trkParType) ? m_trackInCalo->getXYZEtaPhiPerLayer(trackPointer) :
158  m_trackInCalo->getXYZEtaPhiPerSampling(trackPointer);
159 
160  if( (m_trkParType) ? (positions.size() == 11) : (positions.size() == 21) ){
161  for(uint i=0;i<positions.size();++i){
162  if(m_LevelOfDetails > 1)
163  {
164  m_x->push_back( (positions[i].size()!=5) ? -9999. : positions[i][0] );
165  m_y->push_back( (positions[i].size()!=5) ? -9999. : positions[i][1] );
166  m_z->push_back( (positions[i].size()!=5) ? -9999. : positions[i][2] );
167  }
168  m_eta->push_back( (positions[i].size()!=5) ? -9999. : positions[i][3] );
169  m_phi->push_back( (positions[i].size()!=5) ? -9999. : positions[i][4] );
170  }
171  } // IF
172 
176 
177  *m_d0 = perigee->parameters()[Trk::d0];
178  *m_z0 = perigee->parameters()[Trk::d0];
179  }
180 
181  if(m_LevelOfDetails > 1){
182  *m_vtxX = perigee->parameters()[Trk::x];
183  *m_vtxY = perigee->parameters()[Trk::y];
184  *m_vtxZ = perigee->parameters()[Trk::z];
185  *m_phi0 = perigee->parameters()[Trk::phi0];
186  *m_theta = perigee->parameters()[Trk::theta];
187  *m_qOverP = perigee->parameters()[Trk::qOverP];
188  }
189 
190  if(m_LevelOfDetails > 2){
191 
192  std::vector<xAOD::Iso::IsolationType> ptcones = {xAOD::Iso::ptcone40,xAOD::Iso::ptcone30,
194  xAOD::TrackIsolation trackIsolation;
195  if( !m_trackInCalo->trackIsolation(trackIsolation, *trackPointer, ptcones) )
196  {
197  ATH_MSG_WARNING("Calculation of TrackIsolation failed");
198  }
199  else
200  {
201  *m_ptcone40 = trackIsolation.ptcones[0];
202  *m_ptcone30 = trackIsolation.ptcones[1];
203  *m_ptcone20 = trackIsolation.ptcones[2];
204  }
205 
206  /* THIS IS GOING TO BE USED
207  std::vector<xAOD::Iso::IsolationType> nucones = { xAOD::Iso::neflowisol10,xAOD::Iso::neflowisol15,xAOD::Iso::neflowisol20,
208  xAOD::Iso::neflowisol25,xAOD::Iso::neflowisol30,xAOD::Iso::neflowisol35,
209  xAOD::Iso::neflowisol40,xAOD::Iso::neflowisol45 };
210  xAOD::CaloIsolation caloIsolation;
211  if( !m_trackInCalo->neutralEflowIsolation(caloIsolation, *trackPointer, nucones, xAOD::ICaloIsolationTool::Ecore) )
212  {
213  ATH_MSG_WARNING("Calculation of CaloIsolation failed");
214  }
215  else
216  {
217  ;
218  }
219  */
220  } // IF
221 
222  if(m_LevelOfDetails > 3){
236  }
237 
238  return StatusCode::SUCCESS;
239 } // TileTrackFillerTool::fill
240 } // namespace D3PD
xAOD::TrackParticle_v1::pt
virtual double pt() const override final
The transverse momentum ( ) of the particle.
Definition: TrackParticle_v1.cxx:73
D3PD::TileTrackFillerTool::m_nucone30
int * m_nucone30
Definition: TileTrackFillerTool.h:61
xAOD::numberOfPixelHoles
@ numberOfPixelHoles
number of pixel layers on track with absence of hits [unit8_t].
Definition: TrackingPrimitives.h:261
Trk::y
@ y
Definition: ParamDefs.h:56
D3PD::TileTrackFillerTool::m_d0
float * m_d0
Definition: TileTrackFillerTool.h:94
D3PD::TileTrackFillerTool::m_p
float * m_p
Definition: TileTrackFillerTool.h:88
D3PD::TileTrackFillerTool::m_nucone40
int * m_nucone40
Definition: TileTrackFillerTool.h:62
D3PD::TileTrackFillerTool::m_vtxX
float * m_vtxX
Definition: TileTrackFillerTool.h:91
xAOD::numberOfSCTSharedHits
@ numberOfSCTSharedHits
number of SCT hits shared by several tracks [unit8_t].
Definition: TrackingPrimitives.h:272
Trk::z
@ z
global position (cartesian)
Definition: ParamDefs.h:57
D3PD::TileTrackFillerTool::m_defaultValue
float m_defaultValue
Definition: TileTrackFillerTool.h:50
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:557
D3PD::TileTrackFillerTool::m_trackInCalo
ToolHandle< ITrackTools > m_trackInCalo
Definition: TileTrackFillerTool.h:108
xAOD::numberOfGangedPixels
@ numberOfGangedPixels
number of pixels which have a ganged ambiguity [unit8_t].
Definition: TrackingPrimitives.h:264
IsolationType.h
D3PD::TileTrackFillerTool::fill
virtual StatusCode fill(const xAOD::TrackParticle &p)
Fill one block — type-safe version.
Definition: TileTrackFillerTool.cxx:141
D3PD::TileTrackFillerTool::m_eta
std::vector< float > * m_eta
Definition: TileTrackFillerTool.h:101
D3PD::TileTrackFillerTool::m_numberOfTrackSummaryTypes
int * m_numberOfTrackSummaryTypes
Definition: TileTrackFillerTool.h:78
xAOD::TrackParticle_v1::summaryValue
bool summaryValue(uint8_t &value, const SummaryType &information) const
Accessor for TrackSummary values.
Definition: TrackParticle_v1.cxx:736
D3PD::TileTrackFillerTool::m_numberOfGangedPixels
int * m_numberOfGangedPixels
Definition: TileTrackFillerTool.h:76
xAOD::Iso::ptcone30
@ ptcone30
Definition: IsolationType.h:41
xAOD::Iso::ptcone20
@ ptcone20
Track isolation.
Definition: IsolationType.h:40
D3PD::TileTrackFillerTool::m_ptcone40
float * m_ptcone40
Definition: TileTrackFillerTool.h:84
xAOD
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Definition: ICaloAffectedTool.h:24
xAOD::numberOfPixelHits
@ numberOfPixelHits
these are the pixel hits, including the b-layer [unit8_t].
Definition: TrackingPrimitives.h:259
xAOD::numberOfTRTHits
@ numberOfTRTHits
number of TRT hits [unit8_t].
Definition: TrackingPrimitives.h:275
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::TileTrackFillerTool::m_numberOfBLayerHits
int * m_numberOfBLayerHits
Definition: TileTrackFillerTool.h:64
D3PD::TileTrackFillerTool::m_ptcone30
float * m_ptcone30
Definition: TileTrackFillerTool.h:83
D3PD::TileTrackFillerTool::m_y
std::vector< float > * m_y
Definition: TileTrackFillerTool.h:104
D3PD::TileTrackFillerTool::m_nucone05
int * m_nucone05
Definition: TileTrackFillerTool.h:58
D3PD::TileTrackFillerTool::m_numberOfPixelSharedHits
int * m_numberOfPixelSharedHits
Definition: TileTrackFillerTool.h:70
D3PD::TileTrackFillerTool::m_phi
std::vector< float > * m_phi
Definition: TileTrackFillerTool.h:102
D3PD::TileTrackFillerTool::m_nucone10
int * m_nucone10
Definition: TileTrackFillerTool.h:59
xAOD::numberOfTRTHighThresholdHits
@ numberOfTRTHighThresholdHits
number of TRT hits which pass the high threshold (only xenon counted) [unit8_t].
Definition: TrackingPrimitives.h:278
D3PD::TileTrackFillerTool::TileTrackFillerTool
TileTrackFillerTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: TileTrackFillerTool.cxx:22
D3PD::TileTrackFillerTool::m_phi0
float * m_phi0
Definition: TileTrackFillerTool.h:96
xAOD::TrackParticle
TrackParticle_v1 TrackParticle
Reference the current persistent version:
Definition: Event/xAOD/xAODTracking/xAODTracking/TrackParticle.h:13
D3PD::TileTrackFillerTool::book
virtual StatusCode book()
Declare tuple variables.
Definition: TileTrackFillerTool.cxx:56
D3PD::TileTrackFillerTool::m_numberOfTRTHighThresholdOutliers
int * m_numberOfTRTHighThresholdOutliers
Definition: TileTrackFillerTool.h:75
D3PD::TileTrackFillerTool::m_LevelOfDetails
short m_LevelOfDetails
Definition: TileTrackFillerTool.h:55
D3PD::TileTrackFillerTool::m_theta
float * m_theta
Definition: TileTrackFillerTool.h:97
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
GeoPrimitives.h
xAOD::TrackParticle_v1::p4
virtual FourMom_t p4() const override final
The full 4-momentum of the particle.
Definition: TrackParticle_v1.cxx:129
D3PD::TileTrackFillerTool::m_x
std::vector< float > * m_x
Definition: TileTrackFillerTool.h:103
uint
unsigned int uint
Definition: LArOFPhaseFill.cxx:20
TileTrackFillerTool.h
xAOD::numberOfTRTHighThresholdOutliers
@ numberOfTRTHighThresholdOutliers
number of TRT high threshold outliers (only xenon counted) [unit8_t].
Definition: TrackingPrimitives.h:281
D3PD
Block filler tool for noisy FEB information.
Definition: CaloCellDetailsFillerTool.cxx:29
xAOD::numberOfPixelSharedHits
@ numberOfPixelSharedHits
number of Pixel all-layer hits shared by several tracks [unit8_t].
Definition: TrackingPrimitives.h:262
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
D3PD::TileTrackFillerTool::m_numberOfPixelHoles
int * m_numberOfPixelHoles
Definition: TileTrackFillerTool.h:71
D3PD::TileTrackFillerTool::m_numberOfSCTSharedHits
int * m_numberOfSCTSharedHits
Definition: TileTrackFillerTool.h:72
D3PD::TileTrackFillerTool::initialize
virtual StatusCode initialize()
Definition: TileTrackFillerTool.cxx:39
D3PD::TileTrackFillerTool::m_numberOfTRTHighThresholdHits
int * m_numberOfTRTHighThresholdHits
Definition: TileTrackFillerTool.h:68
lumiFormat.i
int i
Definition: lumiFormat.py:85
Trk::theta
@ theta
Definition: ParamDefs.h:66
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
D3PD::TileTrackFillerTool::m_numberOfPixelHits
int * m_numberOfPixelHits
Definition: TileTrackFillerTool.h:65
test_pyathena.parent
parent
Definition: test_pyathena.py:15
D3PD::TileTrackFillerTool::m_pt
float * m_pt
Definition: TileTrackFillerTool.h:87
D3PD::BlockFillerTool
Type-safe wrapper for block filler tools.
Definition: BlockFillerTool.h:68
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
D3PD::TileTrackFillerTool::m_z
std::vector< float > * m_z
Definition: TileTrackFillerTool.h:105
D3PD::TileTrackFillerTool::m_numberOfBLayerSharedHits
int * m_numberOfBLayerSharedHits
Definition: TileTrackFillerTool.h:69
xAOD::numberOfSCTHoles
@ numberOfSCTHoles
number of SCT holes [unit8_t].
Definition: TrackingPrimitives.h:270
D3PD::TileTrackFillerTool::m_calocellContainerName
std::string m_calocellContainerName
Definition: TileTrackFillerTool.h:110
D3PD::TileTrackFillerTool::m_vtxZ
float * m_vtxZ
Definition: TileTrackFillerTool.h:93
xAOD::TrackIsolation
Definition: IsolationCommon.h:33
D3PD::TileTrackFillerTool::m_ptcone10
float * m_ptcone10
Definition: TileTrackFillerTool.h:81
D3PD::TileTrackFillerTool::m_numberOfSCTHits
int * m_numberOfSCTHits
Definition: TileTrackFillerTool.h:66
D3PD::TileTrackFillerTool::m_numberOfTRTHits
int * m_numberOfTRTHits
Definition: TileTrackFillerTool.h:67
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
Trk::d0
@ d0
Definition: ParamDefs.h:63
D3PD::TileTrackFillerTool::m_numberOfOutliersOnTrack
int * m_numberOfOutliersOnTrack
Definition: TileTrackFillerTool.h:77
D3PD::TileTrackFillerTool::m_qOverP
float * m_qOverP
Definition: TileTrackFillerTool.h:98
xAOD::TrackIsolation::ptcones
std::vector< float > ptcones
Definition: IsolationCommon.h:36
xAOD::Iso::ptcone40
@ ptcone40
Definition: IsolationType.h:42
xAOD::numberOfTRTOutliers
@ numberOfTRTOutliers
number of TRT outliers [unit8_t].
Definition: TrackingPrimitives.h:276
xAOD::numberOfOutliersOnTrack
@ numberOfOutliersOnTrack
number of measurements flaged as outliers in TSOS [unit8_t].
Definition: TrackingPrimitives.h:297
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
D3PD::TileTrackFillerTool::m_numberOfSCTHoles
int * m_numberOfSCTHoles
Definition: TileTrackFillerTool.h:73
Trk::qOverP
@ qOverP
perigee
Definition: ParamDefs.h:67
xAOD::numberOfInnermostPixelLayerSharedHits
@ numberOfInnermostPixelLayerSharedHits
number of Pixel 0th layer barrel hits shared by several tracks.
Definition: TrackingPrimitives.h:239
D3PD::TileTrackFillerTool::m_vtxY
float * m_vtxY
Definition: TileTrackFillerTool.h:92
xAOD::numberOfSCTHits
@ numberOfSCTHits
number of hits in SCT [unit8_t].
Definition: TrackingPrimitives.h:268
D3PD::TileTrackFillerTool::m_trkParType
int m_trkParType
Definition: TileTrackFillerTool.h:51
D3PD::TileTrackFillerTool::m_ptcone45
float * m_ptcone45
Definition: TileTrackFillerTool.h:85
D3PD::TileTrackFillerTool::m_nucone20
int * m_nucone20
Definition: TileTrackFillerTool.h:60
xAOD::TrackParticle_v1
Class describing a TrackParticle.
Definition: TrackParticle_v1.h:43
Trk::x
@ x
Definition: ParamDefs.h:55
D3PD::TileTrackFillerTool::m_trackToVertexTool
ToolHandle< Reco::ITrackToVertex > m_trackToVertexTool
Definition: TileTrackFillerTool.h:109
D3PD::TileTrackFillerTool::m_z0
float * m_z0
Definition: TileTrackFillerTool.h:95
Trk::phi0
@ phi0
Definition: ParamDefs.h:65
D3PD::TileTrackFillerTool::m_numberOfTRTOutliers
int * m_numberOfTRTOutliers
Definition: TileTrackFillerTool.h:74
D3PD::TileTrackFillerTool::m_ptcone20
float * m_ptcone20
Definition: TileTrackFillerTool.h:82
xAOD::numberOfInnermostPixelLayerHits
@ numberOfInnermostPixelLayerHits
these are the hits in the 0th pixel barrel layer
Definition: TrackingPrimitives.h:237