ATLAS Offline Software
BremPositionNtupleHelper.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // BremPositionNtupleHelper.cxx
7 // Source file for class BremPositionNtupleHelper
9 // (c) ATLAS Detector software
11 // Sebastian.Fleischmann@cern.ch
13 
14 
15 //Gaudi
16 #include "GaudiKernel/SmartDataPtr.h"
17 #include "GaudiKernel/ITHistSvc.h"
18 
19 #include "GaudiKernel/ISvcLocator.h"
20 #include "TTree.h"
21 
22 // Trk
24 
25 // added SUE
27 #include "TrkSurfaces/Surface.h"
32 
33 // constructor
35  const std::string& t,
36  const std::string& n,
37  const IInterface* p )
38  :
39  AthAlgTool(t,n,p),
40  //m_trkParametersWarning(false),
41  m_bremX(nullptr),
42  m_bremY(nullptr),
43  m_bremZ(nullptr),
44  m_trkQoverP(nullptr),
45  m_thicknessInX0(nullptr),
46  m_dna(nullptr),
47  m_dnaDirection(nullptr),
48  m_trackStateIndices(nullptr)
49 
50  {
51  declareInterface<IValidationNtupleHelperTool>(this);
52  //declareProperty("IgnoreMissingTrackCovarianceForPulls", mjo_ignoreMissTrkCov = false);
53 }
54 
55 // destructor
57 
58 
63 
64  m_bremX = new std::vector<float>();
65  m_bremY = new std::vector<float>();
66  m_bremZ = new std::vector<float>();
67  m_trkQoverP = new std::vector<float>();
68  m_thicknessInX0 = new std::vector<float>();
69  m_dna = new std::vector<float>();
70  m_dnaDirection = new std::vector<int>();
71  m_trackStateIndices = new std::vector<int>();
72 
73  ATH_MSG_INFO ("initialize() successful in " << name());
74  return StatusCode::SUCCESS;
75 }
76 
81 
82  delete m_bremX;
83  delete m_bremY;
84  delete m_bremZ;
85  delete m_trkQoverP;
86  delete m_thicknessInX0;
87  delete m_dna;
88  delete m_dnaDirection;
89  delete m_trackStateIndices;
90 
91  ATH_MSG_INFO ("finalize() successful in " << name());
92  return StatusCode::SUCCESS;
93 }
94 
95 
100  TTree* tree,
101  const int& ) {
102 
103  // add items
104  tree->Branch("BremEffectsX", &m_bremX);
105  tree->Branch("BremEffectsY", &m_bremY);
106  tree->Branch("BremEffectsZ", &m_bremZ);
107  tree->Branch("BremCurrentQoverP", &m_trkQoverP);
108  tree->Branch("BremThicknessInX0", &m_thicknessInX0);
109  tree->Branch("BremDnaValue", &m_dna);
110  tree->Branch("BremDnaDirection",&m_dnaDirection);
111  tree->Branch("BremToTrackStateIndex",&m_trackStateIndices);
112 
113  ATH_MSG_VERBOSE ("added items to ntuple.");
114  return StatusCode::SUCCESS;
115 }
116 
121  const Trk::MeasurementBase*,
122  const Trk::TrackParameters* /*trkPar*/,
123  const int&,
124  const bool& /*isOutlier*/) {
125 
126  return StatusCode::SUCCESS;
127 }
128 
130  const int& ) {
131  m_bremX->clear();
132  m_bremY->clear();
133  m_bremZ->clear();
134  m_trkQoverP->clear();
135  m_thicknessInX0->clear();
136  m_dna->clear();
137  m_dnaDirection->clear();
138  m_trackStateIndices->clear();
139  return StatusCode::SUCCESS;
140 
141 }
142 
143 
145  const Trk::TrackStateOnSurface& tsos,
146  const int& bremToTrackIndex ) { // FIXME this abuses the interface even more
147 
148  // check if state has brem to analyse
149  const Trk::MaterialEffectsBase* mEffect = tsos.materialEffectsOnTrack();
150  const Trk::EstimatedBremOnTrack* ebrot = dynamic_cast<const Trk::EstimatedBremOnTrack*>(mEffect);
151  const Trk::TrackParameters* tParameter = (tsos).trackParameters();
152  if (ebrot == nullptr || tParameter == nullptr) {
153  ATH_MSG_DEBUG ("Insufficient data to analyse brem. &TP="
154  << tParameter << " and &EB=" << ebrot);
155  return StatusCode::SUCCESS;
156  }
157 
158  const Amg::Vector3D& gmom = tParameter->momentum();
159  const Amg::Vector3D& gpos = tParameter->position();
160  m_bremX->push_back( float(gpos.x()) );
161  m_bremY->push_back( float(gpos.y()) );
162  m_bremZ->push_back( float(gpos.z()) );
163  m_trkQoverP->push_back( (float) tParameter->parameters()[Trk::qOverP]);
164  m_thicknessInX0->push_back((float) mEffect->thicknessInX0());
165  float dna = gmom.mag() * sqrt(ebrot->sigmaQoverPsquared());
166  m_dna->push_back(dna);
167  m_dnaDirection->push_back(static_cast<int>(ebrot->searchDirection()));
168  m_trackStateIndices->push_back(bremToTrackIndex);
169 
170  return StatusCode::SUCCESS;
171 }
172 
173 
EstimatedBremOnTrack.h
TrackParameters.h
MeasurementBase.h
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
BremPositionNtupleHelper.h
Surface.h
Trk::ParametersBase::position
const Amg::Vector3D & position() const
Access method for the position.
Trk::BremPositionNtupleHelper::finalize
StatusCode finalize()
finalize
Definition: BremPositionNtupleHelper.cxx:80
tree
TChain * tree
Definition: tile_monitor.h:30
Trk::BremPositionNtupleHelper::BremPositionNtupleHelper
BremPositionNtupleHelper(const std::string &, const std::string &, const IInterface *)
Definition: BremPositionNtupleHelper.cxx:34
Trk::MaterialEffectsBase::thicknessInX0
double thicknessInX0() const
returns the actually traversed material .
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
Trk::MaterialEffectsBase
base class to integrate material effects on Trk::Track in a flexible way.
Definition: MaterialEffectsBase.h:35
MaterialEffectsBase.h
Trk::BremPositionNtupleHelper::resetVariables
virtual StatusCode resetVariables(const int &detectorType)
reset ntuple variables
Definition: BremPositionNtupleHelper.cxx:129
Trk::BremPositionNtupleHelper::~BremPositionNtupleHelper
~BremPositionNtupleHelper()
Trk::BremPositionNtupleHelper::addNtupleItems
virtual StatusCode addNtupleItems(TTree *tree, const int &detectorType)
add items to the ntuple and configure the helper tool: should be called once (per detector type) by t...
Definition: BremPositionNtupleHelper.cxx:99
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
Trk::TrackStateOnSurface::materialEffectsOnTrack
const MaterialEffectsBase * materialEffectsOnTrack() const
return material effects const overload
beamspotman.n
n
Definition: beamspotman.py:731
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
Trk::EstimatedBremOnTrack::searchDirection
SearchDirection searchDirection() const
returns if the brem was discovered with a particular search direction
Definition: EstimatedBremOnTrack.h:133
Trk::BremPositionNtupleHelper::initialize
StatusCode initialize()
initialize
Definition: BremPositionNtupleHelper.cxx:62
Trk::BremPositionNtupleHelper::fillMeasurementData
virtual StatusCode fillMeasurementData(const Trk::MeasurementBase *, const Trk::TrackParameters *, const int &detectorType, const bool &isOutlier)
fill hit position data
Definition: BremPositionNtupleHelper.cxx:120
Trk::ParametersBase
Definition: ParametersBase.h:55
Trk::MeasurementBase
Definition: MeasurementBase.h:58
Trk::TrackStateOnSurface
represents the track state (measurement, material, fit parameters and quality) at a surface.
Definition: TrackStateOnSurface.h:71
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
Trk::ParametersBase::momentum
const Amg::Vector3D & momentum() const
Access method for the momentum.
Trk::EstimatedBremOnTrack
class holding information about momentum reduction and an additional noise term due to significant en...
Definition: EstimatedBremOnTrack.h:30
Trk::qOverP
@ qOverP
perigee
Definition: ParamDefs.h:67
AthAlgTool
Definition: AthAlgTool.h:26
Trk::BremPositionNtupleHelper::fillHoleData
virtual StatusCode fillHoleData(const Trk::TrackStateOnSurface &, const int &)
fill special data about holes on track (here: do nothing)
Definition: BremPositionNtupleHelper.cxx:144
Trk::EstimatedBremOnTrack::sigmaQoverPsquared
double sigmaQoverPsquared() const
returns the additional noise term
Definition: EstimatedBremOnTrack.h:127
TrackStateOnSurface.h