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"
32 
34 
37 
38 #include <cmath>
39 #include <iostream>
40 
42  const std::string& n,
43  const IInterface* p ): AthAlgTool(t,n,p)
44 {
45  declareInterface< ITrigDkfTrackMakerTool >( this );
46  m_idHelper=nullptr;
47 }
48 
50 {
51  ATH_CHECK(detStore()->retrieve(m_idHelper, "AtlasID"));
52  return StatusCode::SUCCESS;
53 }
54 
56  std::vector<Trk::TrkBaseNode*>& vpTrkNodes,
57  double DChi2) const {
58 
59  if(track.measurementsOnTrack()->size()==0)
60  {
61  ATH_MSG_ERROR("Cannot create a DKF track -- Trk::Track has no hits");
62  return false;
63  }
64  vpTrkNodes.clear();
65  vpTrkNodes.reserve(track.measurementsOnTrack()->size());
66  for (auto tMOT = track.measurementsOnTrack()->begin(); tMOT != track.measurementsOnTrack()->end(); ++tMOT) {
67  const Trk::Surface& rSurf=(*tMOT)->associatedSurface();
68  constexpr double radLength=0.022;
69  double C[3],N[3],M[3][3];
71  N[0]=rSurf.normal().x();
72  N[1]=rSurf.normal().y();
73  N[2]=rSurf.normal().z();
74  C[0]=rSurf.center().x();
75  C[1]=rSurf.center().y();
76  C[2]=rSurf.center().z();
77  mx=rSurf.transform().rotation().block(0,0,3,1);
78  my=rSurf.transform().rotation().block(0,1,3,1);
79  mz=rSurf.transform().rotation().block(0,2,3,1);
80  for(int i=0;i<3;i++) {
81  M[i][0]=mx[i];M[i][1]=my[i];M[i][2]=mz[i];
82  }
83  Trk::TrkPlanarSurface* pS = new Trk::TrkPlanarSurface(C,N,M,radLength, &(rSurf));
84 
85  const InDet::SiClusterOnTrack* siCLOT = dynamic_cast<const InDet::SiClusterOnTrack*>(*tMOT);
86  if (siCLOT==nullptr) {
87  ATH_MSG_VERBOSE("siCLOT is null");
88  continue;
89  }
90  const InDet::SiCluster* siCL = dynamic_cast<const InDet::SiCluster*>(siCLOT->prepRawData());
91  if (siCL==nullptr) {
92  ATH_MSG_VERBOSE("siCL is null");
93  continue;
94  }
95  Identifier id = (*tMOT)->associatedSurface().associatedDetectorElement()->identify();
96  ATH_MSG_DEBUG("Identifier: " << m_idHelper->print_to_string(id));
97  if(m_idHelper->is_sct(id)) {
98  const InDetDD::SiDetectorElement* sctElement = dynamic_cast<const InDetDD::SiDetectorElement*>
99  ((*tMOT)->associatedSurface().associatedDetectorElement());
100  if (sctElement) {
101  if(sctElement->design().shape()==InDetDD::Trapezoid) //SCT Endcap
102  {
103  ATH_MSG_DEBUG("SCT endcap node");
104  const Trk::SurfaceBounds& rBounds=rSurf.bounds();
105  const Trk::TrapezoidBounds& ecBounds= dynamic_cast<const Trk::TrapezoidBounds&>(rBounds);
106  double R=(ecBounds.maxHalflengthX()+ecBounds.minHalflengthX())*
107  ecBounds.halflengthY()/(ecBounds.maxHalflengthX()-ecBounds.minHalflengthX());
108  vpTrkNodes.push_back(new Trk::TrkEndCapClusterNode(pS,DChi2,siCL,R));
109  }
110  else if(sctElement->design().shape()==InDetDD::Box) {//SCT Barrel
111  ATH_MSG_DEBUG("SCT barrel node");
112  vpTrkNodes.push_back(new Trk::TrkClusterNode(pS,DChi2,siCL));
113  }
114  else if(sctElement->design().shape()==InDetDD::Annulus) { //Strip Endcap
115  ATH_MSG_DEBUG("Strip endcap node");
116  const Trk::SurfaceBounds& rBounds=rSurf.bounds();
117  const Trk::AnnulusBounds& ecBounds= dynamic_cast<const Trk::AnnulusBounds&>(rBounds);
118  double R=ecBounds.waferCentreR();
119  vpTrkNodes.push_back(new Trk::TrkEndCapClusterNode(pS,DChi2,siCL,R));
120  }
121  }
122  else {
123  ATH_MSG_WARNING("Identifier is SCT but does not match endcap or barrel shape");
124  }
125  }
126  else if (m_idHelper->is_pixel(id)) {//Pixel
127  ATH_MSG_DEBUG("Pixel node");
128  vpTrkNodes.push_back(new Trk::TrkPixelNode(pS,DChi2,siCL));
129  }
130  else {
131  ATH_MSG_WARNING("Identifier is neither SCT nor pixel");
132  }
133  }
134  ATH_MSG_DEBUG(vpTrkNodes.size()<<" filtering nodes created");
135 
136  return true;
137 }
138 
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:41
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::AnnulusBounds::waferCentreR
double waferCentreR() const
This method returns the R-parameter from design of sensors, which is the radius that the original cen...
Trk::TrkClusterNode
Definition: Tracking/TrkFitter/TrkDistributedKalmanFilter/TrkDistributedKalmanFilter/TrkFilteringNodes.h:68
fitman.my
my
Definition: fitman.py:523
AthCheckMacros.h
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
Trk::AnnulusBounds
Definition: AnnulusBounds.h:45
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...
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
TrkTrackState.h
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
AnnulusBounds.h
lumiFormat.i
int i
Definition: lumiFormat.py:85
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
InDetDD::Annulus
@ Annulus
Definition: DetectorDesign.h:42
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
AnalysisUtils::Delta::R
double R(const INavigable4Momentum *p1, const double v_eta, const double v_phi)
Definition: AnalysisMisc.h:49
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:55
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
InDetDD::Box
@ Box
Definition: DetectorDesign.h:42
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:49
InDet::SiCluster
Definition: InnerDetector/InDetRecEvent/InDetPrepRawData/InDetPrepRawData/SiCluster.h:40
InDetDD::Trapezoid
@ Trapezoid
Definition: DetectorDesign.h:42
InDet::SiClusterOnTrack
Definition: SiClusterOnTrack.h:39
Identifier
Definition: IdentifierFieldParser.cxx:14