ATLAS Offline Software
TrigDkfTrackMakerTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // TrigDkfTrackMakerTool tool
7 // -------------------------------
8 // ATLAS Collaboration
9 //
10 // 17.03.2009 Package created
11 //
12 // Author: Dmitry Emeliyanov, RAL
13 // e-mail: D.Emeliyanov@rl.ac.uk
14 //
16 
19 #include "InDetIdentifier/SCT_ID.h"
24 
26 #include "TrigDkfTrackMakerTool.h"
27 #include "TrkSurfaces/Surface.h"
31 
33 
36 
37 #include <cmath>
38 #include <iostream>
39 
41  const std::string& n,
42  const IInterface* p ): AthAlgTool(t,n,p)
43 {
44  declareInterface< ITrigDkfTrackMakerTool >( this );
45  m_idHelper=nullptr;
46 }
47 
49 {
50  ATH_CHECK(detStore()->retrieve(m_idHelper, "AtlasID"));
51  return StatusCode::SUCCESS;
52 }
53 
55  std::vector<Trk::TrkBaseNode*>& vpTrkNodes,
56  double DChi2) const {
57 
58  if(track.measurementsOnTrack()->size()==0)
59  {
60  ATH_MSG_ERROR("Cannot create a DKF track -- Trk::Track has no hits");
61  return false;
62  }
63  vpTrkNodes.clear();
64  vpTrkNodes.reserve(track.measurementsOnTrack()->size());
65  for (auto tMOT = track.measurementsOnTrack()->begin(); tMOT != track.measurementsOnTrack()->end(); ++tMOT) {
66  const Trk::Surface& rSurf=(*tMOT)->associatedSurface();
67  constexpr double radLength=0.022;
68  double C[3],N[3],M[3][3];
70  N[0]=rSurf.normal().x();
71  N[1]=rSurf.normal().y();
72  N[2]=rSurf.normal().z();
73  C[0]=rSurf.center().x();
74  C[1]=rSurf.center().y();
75  C[2]=rSurf.center().z();
76  mx=rSurf.transform().rotation().block(0,0,3,1);
77  my=rSurf.transform().rotation().block(0,1,3,1);
78  mz=rSurf.transform().rotation().block(0,2,3,1);
79  for(int i=0;i<3;i++) {
80  M[i][0]=mx[i];M[i][1]=my[i];M[i][2]=mz[i];
81  }
82  Trk::TrkPlanarSurface* pS = new Trk::TrkPlanarSurface(C,N,M,radLength, &(rSurf));
83 
84 
85 
86  const InDet::SiClusterOnTrack* siCLOT = dynamic_cast<const InDet::SiClusterOnTrack*>(*tMOT);
87  if (siCLOT==nullptr) {
88  ATH_MSG_VERBOSE("siCLOT is null");
89  continue;
90  }
91  const InDet::SiCluster* siCL = dynamic_cast<const InDet::SiCluster*>(siCLOT->prepRawData());
92  if (siCL==nullptr) {
93  ATH_MSG_VERBOSE("siCL is null");
94  continue;
95  }
96  Identifier id = (*tMOT)->associatedSurface().associatedDetectorElement()->identify();
97  ATH_MSG_DEBUG("Identifier: " << m_idHelper->print_to_string(id));
98  if(m_idHelper->is_sct(id)) {
99  const InDetDD::SiDetectorElement* sctElement = dynamic_cast<const InDetDD::SiDetectorElement*>
100  ((*tMOT)->associatedSurface().associatedDetectorElement());
101  if (sctElement) {
102  if(sctElement->design().shape()==InDetDD::Trapezoid) //SCT Endcap
103  {
104  ATH_MSG_DEBUG("SCT endcap node");
105  const Trk::SurfaceBounds& rBounds=rSurf.bounds();
106  const Trk::TrapezoidBounds& ecBounds= dynamic_cast<const Trk::TrapezoidBounds&>(rBounds);
107  double R=(ecBounds.maxHalflengthX()+ecBounds.minHalflengthX())*
108  ecBounds.halflengthY()/(ecBounds.maxHalflengthX()-ecBounds.minHalflengthX());
109  vpTrkNodes.push_back(new Trk::TrkEndCapClusterNode(pS,DChi2,siCL,R));
110  }
111  else {//SCT Barrel
112  ATH_MSG_DEBUG("SCT barrel node");
113  vpTrkNodes.push_back(new Trk::TrkClusterNode(pS,DChi2,siCL));
114  }
115  }
116  else {
117  ATH_MSG_WARNING("Identifier is SCT but does not match endcap or barrel shape");
118  }
119  }
120  else if (m_idHelper->is_pixel(id)) {//Pixel
121  ATH_MSG_DEBUG("Pixel node");
122  vpTrkNodes.push_back(new Trk::TrkPixelNode(pS,DChi2,siCL));
123  }
124  else {
125  ATH_MSG_WARNING("Identifier is neither SCT nor pixel");
126  }
127  }
128  ATH_MSG_DEBUG(vpTrkNodes.size()<<" filtering nodes created");
129 
130  return true;
131 }
132 
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
TrigDkfTrackMakerTool::TrigDkfTrackMakerTool
TrigDkfTrackMakerTool(const std::string &, const std::string &, const IInterface *)
Definition: TrigDkfTrackMakerTool.cxx:40
PixelID.h
This is an Identifier helper class for the Pixel subdetector. This class is a factory for creating co...
AtlasDetectorID::is_pixel
bool is_pixel(Identifier id) const
Definition: AtlasDetectorID.h:760
Trk::TrkEndCapClusterNode
Definition: Tracking/TrkFitter/TrkDistributedKalmanFilter/TrkDistributedKalmanFilter/TrkFilteringNodes.h:82
TrapezoidBounds.h
Trk::TrapezoidBounds::maxHalflengthX
double maxHalflengthX() const
This method returns the maximal halflength in X (first coordinate of local surface frame)
SCT_ClusterOnTrack.h
SCT_ID.h
This is an Identifier helper class for the SCT subdetector. This class is a factory for creating comp...
Trk::TrkClusterNode
Definition: Tracking/TrkFitter/TrkDistributedKalmanFilter/TrkDistributedKalmanFilter/TrkFilteringNodes.h:68
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
fitman.my
my
Definition: fitman.py:523
AthCheckMacros.h
IDTPM::R
float R(const U &p)
Definition: TrackParametersHelper.h:101
AthMsgStreamMacros.h
Surface.h
Trk::Track
The ATLAS Track class.
Definition: Tracking/TrkEvent/TrkTrack/TrkTrack/Track.h:73
AtlasDetectorID::is_sct
bool is_sct(Identifier id) const
Definition: AtlasDetectorID.h:770
PixelCluster.h
Trk::SurfaceBounds
Definition: SurfaceBounds.h:47
InDetDD::DetectorDesign::shape
virtual DetectorShape shape() const
Shape of element.
Definition: DetectorDesign.cxx:96
DMTest::C
C_v1 C
Definition: C.h:26
Trk::TrapezoidBounds::halflengthY
double halflengthY() const
This method returns the halflength in Y (second coordinate of local surface frame)
Trk::TrkPlanarSurface
Definition: Tracking/TrkFitter/TrkDistributedKalmanFilter/TrkDistributedKalmanFilter/TrkPlanarSurface.h:25
fitman.mx
mx
Definition: fitman.py:520
JetTiledMap::N
@ N
Definition: TiledEtaPhiMap.h:44
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
Trk::TrapezoidBounds::minHalflengthX
double minHalflengthX() const
This method returns the minimal halflength in X (first coordinate of local surface frame)
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
Trk::Surface::center
const Amg::Vector3D & center() const
Returns the center position of the Surface.
SCT_Cluster.h
ReadCondHandle.h
AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:95
AtlasDetectorID.h
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
TrkTrackState.h
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
lumiFormat.i
int i
Definition: lumiFormat.py:92
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
beamspotman.n
n
Definition: beamspotman.py:731
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ITrigDkfTrackMakerTool.h
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
fitman.mz
mz
Definition: fitman.py:526
Trk::Surface::normal
virtual const Amg::Vector3D & normal() const
Returns the normal vector of the Surface (i.e.
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
Trk::TrkPixelNode
Definition: Tracking/TrkFitter/TrkDistributedKalmanFilter/TrkDistributedKalmanFilter/TrkFilteringNodes.h:99
AtlasDetectorID::print_to_string
std::string print_to_string(Identifier id, const IdContext *context=0) const
or provide the printout in string form
Definition: AtlasDetectorID.cxx:655
Trk::Surface::bounds
virtual const SurfaceBounds & bounds() const =0
Surface Bounds method.
InDetDD::SiDetectorElement
Definition: SiDetectorElement.h:109
TrkFilteringNodes.h
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
Trk::RIO_OnTrack::prepRawData
virtual const Trk::PrepRawData * prepRawData() const =0
returns the PrepRawData (also known as RIO) object to which this RIO_OnTrack is associated.
TrigDkfTrackMakerTool::createDkfTrack
bool createDkfTrack(const Trk::Track &track, std::vector< Trk::TrkBaseNode * > &vpTrkNodes, double DChi2) const
Definition: TrigDkfTrackMakerTool.cxx:54
Trk::TrapezoidBounds
Definition: TrapezoidBounds.h:43
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
TrigDkfTrackMakerTool::m_idHelper
const AtlasDetectorID * m_idHelper
Definition: TrigDkfTrackMakerTool.h:35
TrigDkfTrackMakerTool.h
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
AthAlgTool
Definition: AthAlgTool.h:26
PixelClusterOnTrack.h
InDetDD::SiDetectorElement::design
virtual const SiDetectorDesign & design() const override final
access to the local description (inline):
Trk::Surface
Definition: Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/Surface.h:75
Trk::Surface::transform
const Amg::Transform3D & transform() const
Returns HepGeom::Transform3D by reference.
TrigDkfTrackMakerTool::initialize
StatusCode initialize()
Definition: TrigDkfTrackMakerTool.cxx:48
InDet::SiCluster
Definition: InnerDetector/InDetRecEvent/InDetPrepRawData/InDetPrepRawData/SiCluster.h:40
InDetDD::Trapezoid
@ Trapezoid
Definition: DetectorDesign.h:42
InDet::SiClusterOnTrack
Definition: SiClusterOnTrack.h:39