ATLAS Offline Software
Loading...
Searching...
No Matches
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
24
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];
70 Amg::Vector3D mx,my,mz;
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
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
This is an Identifier helper class for the Pixel subdetector.
This is an Identifier helper class for the SCT subdetector.
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
const ServiceHandle< StoreGateSvc > & detStore() const
virtual DetectorShape shape() const
Shape of element.
Class to hold geometrical description of a silicon detector element.
virtual const SiDetectorDesign & design() const override final
access to the local description (inline):
RIO_OnTrack base class for Silicon detector in the InnerDetector.
bool createDkfTrack(const Trk::Track &track, std::vector< Trk::TrkBaseNode * > &vpTrkNodes, double DChi2) const
const AtlasDetectorID * m_idHelper
TrigDkfTrackMakerTool(const std::string &, const std::string &, const IInterface *)
Bounds for a annulus-like, planar Surface.
double waferCentreR() const
This method returns the R-parameter from design of sensors, which is the radius that the original cen...
virtual const Trk::PrepRawData * prepRawData() const =0
returns the PrepRawData (also known as RIO) object to which this RIO_OnTrack is associated.
Abstract base class for surface bounds to be specified.
Abstract Base Class for tracking surfaces.
virtual const Amg::Vector3D & normal() const
Returns the normal vector of the Surface (i.e.
const Amg::Transform3D & transform() const
Returns HepGeom::Transform3D by reference.
virtual const SurfaceBounds & bounds() const =0
Surface Bounds method.
const Amg::Vector3D & center() const
Returns the center position of the Surface.
Bounds for a trapezoidal, planar Surface.
double halflengthY() const
This method returns the halflength in Y (second coordinate of local surface frame)
double minHalflengthX() const
This method returns the minimal halflength in X (first coordinate of local surface frame)
double maxHalflengthX() const
This method returns the maximal halflength in X (first coordinate of local surface frame)
struct color C
Eigen::Matrix< double, 3, 1 > Vector3D