32(
const std::string& t,
const std::string& n,
const IInterface* p)
35 declareInterface<ITRT_TrackExtensionTool>(
this);
51 StatusCode
sc = AlgTool::initialize();
57 return StatusCode::FAILURE;
65 return StatusCode::FAILURE;
92 StatusCode
sc = AlgTool::finalize();
141MsgStream& InDet::operator <<
151std::ostream& InDet::operator <<
161std::unique_ptr<InDet::ITRT_TrackExtensionTool::IEventData>
168 std::stringstream
msg;
169 msg <<
"Missing TRT_DriftCircleContainer " <<
m_trtname.key();
170 throw std::runtime_error(
msg.str() );
173 std::unique_ptr<EventData> event_data(
new EventData(trtcontainer.
cptr()));
183 return std::unique_ptr<InDet::ITRT_TrackExtensionTool::IEventData>(event_data.release());
191std::vector<const Trk::MeasurementBase*>&
210 parb = (*(tsos->
begin()))->trackParameters();
213 if(parb && par!=parb) {
217 if((g2.x()*g2.x()+g2.y()*g2.y()) > (g1.x()*g1.x()+g1.y()*g1.y())) par=parb;
233 msg(MSG::DEBUG)<<
"Number of tpars: "<<tpars->size()<<
endmsg;
236 std::vector< const Trk::TrackParameters* >::const_iterator parameterIter = tpars->begin();
237 for ( ; parameterIter != tpars->end(); ++parameterIter) {
238 msg(MSG::DEBUG)<<
"par pos: " << (**parameterIter).position() <<
endmsg;
240 if ( (*parameterIter)->associatedSurface().associatedDetectorElementIdentifier()==0 ) {
241 msg(MSG::DEBUG)<<
"No DE identifier!!!"<<
endmsg;
245 const Identifier& DCId = (*parameterIter)->associatedSurface().associatedDetectorElementIdentifier();
246 if (
m_trtid->is_trt( DCId ) ) {
249 detElements[1]=(*parameterIter)->associatedSurface().associatedDetectorElement()->identifyHash();
252 int bec=
m_trtid->barrel_ec(DCId);
253 int phi_mod=
m_trtid->phi_module(DCId);
254 int layer_or_wheel=
m_trtid->layer_or_wheel(DCId);
255 int slay=
m_trtid->straw_layer(DCId);
258 if(phi_mod<0) phi_mod=31;
261 detElements[0]=
m_trtid->straw_layer_hash(temp);
264 if(phi_mod>31) phi_mod=0;
265 temp=
m_trtid->straw_id(bec,phi_mod,layer_or_wheel,slay,0);
266 detElements[2]=
m_trtid->straw_layer_hash(temp);
271 for(
int i=-1;i<2;i++) {
279 msg(MSG::DEBUG)<<
"for the current detectorElement no DriftCircleContainer seems to exist: "<<
m_trtid->show_to_string(
m_trtid->layer_id(detElements[i+1]))<<
endmsg;
283 msg(MSG::DEBUG)<<
"There are " <<
container->size() <<
" entries in the TRT_DriftCircleCollection "<<
m_trtid->show_to_string(
m_trtid->layer_id(detElements[i+1])) <<
endmsg;
286 InDet::TRT_DriftCircleCollection::const_iterator driftCircleIterator =
container->begin();
287 for (; driftCircleIterator !=
container->end(); ++driftCircleIterator) {
290 const Trk::Surface &dc_surface=(*driftCircleIterator)->detectorElement()->surface((*driftCircleIterator)->identify());
293 std::optional<Amg::Vector2D> lpos=dc_surface.
globalToLocal((*parameterIter)->position());
297 distance = std::abs(lpos->x());
298 msg(MSG::DEBUG)<<
"Hit "<<
m_trtid->show_to_string((*driftCircleIterator)->identify())<<
" has a distance of "<<distance<<
endmsg;
300 double dist_locz=std::abs(lpos->y());
303 msg(MSG::DEBUG)<<
"Hit not inside surface bounds! "<<distance<<
" , "<<dist_locz<<
endmsg;
304 msg(MSG::DEBUG)<<
"\trejecting hit"<<
endmsg;
311 if(distance<maxdist){
313 circ=(*driftCircleIterator);
318 msg(MSG::DEBUG)<<
"Maximal distance: "<<maxdist<<
endmsg;
321 if (lastz<-9999) lastz=(**parameterIter).position().z();
322 if (std::abs(lastz-(**parameterIter).position().z())>500.)
return;
323 lastz=(**parameterIter).position().z();
351std::vector<const Trk::MeasurementBase*>&
362 std::vector<Identifier> vecID;
363 std::vector<const Trk::TrackParameters*> vecTP;
367 std::vector<const Trk::TrackParameters* >* tpars_down=
nullptr;
368 std::vector<const Trk::TrackParameters* >* tpars_up=
nullptr;
371 msg(MSG::FATAL)<<
"Track perigee not found!"<<
endmsg;
379 InDet::TRT_DriftCircleContainer::const_iterator
382 if ((**w).empty())
continue;
383 const Trk::Surface &surf=(**(**w).begin()).detectorElement()->surface();
387 if (pos.perp()<500. || !surf.
insideBounds(locpos,50.,50.))
continue;
396 vecTP.push_back(newpar);
398 tpars_down=
new std::vector<const Trk::TrackParameters* >;
399 tpars_up=
new std::vector<const Trk::TrackParameters* >;
401 if(!tpars_down || !tpars_up)
return event_data.
m_measurement;
404 std::sort(vecTP.begin(),vecTP.end(),sorter);
405 for (
const auto *tmppar : vecTP){
407 else tpars_down->push_back(tmppar);
410 if (!tpars_up->empty())
std::reverse(tpars_up->begin(),tpars_up->end());
422 std::vector< const Trk::TrackParameters* >::const_iterator parameterIter= tpars_up->begin();
423 for ( ; parameterIter != tpars_up->end(); ++parameterIter) {
424 delete *parameterIter;
430 std::vector< const Trk::TrackParameters* >::const_iterator parameterIter = tpars_down->begin();
431 for ( ; parameterIter != tpars_down->end(); ++parameterIter) {
432 delete *parameterIter;
462 const EventContext& ctx = Gaudi::Hive::currentContext();
494 double sinTheta = std::sin(per->parameters()[3]);
495 double r= (std::abs(per->parameters()[
Trk::qOverP]) > 1e-10) ? -sinTheta/(per->parameters()[
Trk::qOverP]*0.6) : 1e6;
496 double xc=per->
position().x()-
r*std::sin(per->parameters()[2]);
497 double yc=per->
position().y()+
r*std::cos(per->parameters()[2]);
502 if (std::abs(surf->
normal().z())>0.5){
504 double delta_phi=delta_s*std::sin(
theta)/
r;
505 double x=xc+std::abs(
r)*std::cos(phi0+delta_phi);
506 double y=yc+std::abs(
r)*std::sin(phi0+delta_phi);
513 double x1=surf->
center().x();
514 double y1=surf->
center().y();
517 double a=(x2-x1)*(x2-x1)+(y2-y1)*(y2-y1);
518 double b=2*( (x2 - x1)*(x1 - xc) + (y2 - y1)*(y1 - yc));
519 double c=xc*xc + yc*yc + x1*x1 + y1*y1 - 2*(xc*x1 + yc*y1) -
r*
r;
520 double discr=b*b-4*
a*c;
522 double u1=(-b-std::sqrt(discr))/(2*
a);
523 double u2=(-b+std::sqrt(discr))/(2*
a);
524 double u=(std::abs(u1)<std::abs(u2)) ? u1 : u2;
525 double x=x1+u*(x2-x1);
526 double y=y1+u*(y2-y1);
527 double phi=std::atan2(
y-yc,
x-xc);
528 double delta_phi=
phi-phi0;
529 if (std::abs(std::abs(delta_phi)-2*
M_PI)<std::abs(delta_phi)){
530 if (delta_phi<0) delta_phi+=2*
M_PI;
531 else delta_phi-=2*
M_PI;
534 double delta_z=
r*delta_phi/std::tan(
theta);
Scalar phi() const
phi method
Scalar theta() const
theta method
#define ATH_CHECK
Evaluate an expression and check for errors.
This is an Identifier helper class for the TRT subdetector.
const ServiceHandle< StoreGateSvc > & detStore() const
const_reverse_iterator rbegin() const noexcept
Return a const_reverse_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
This is a "hash" representation of an Identifier.
std::array< std::vector< std::vector< Used_t > >, 3 > TRT_DetElemUsedMap
virtual const InDetDD::TRT_BaseElement * detectorElement() const override final
return the detector element corresponding to this PRD
tp_sort_cosmics(double theta)
bool operator()(const Trk::TrackParameters *par1, const Trk::TrackParameters *par2) const
virtual bool isValid() override final
Can the handle be successfully dereferenced?
const_pointer_type cptr()
Dereference the pointer.
Class for a CylinderSurface in the ATLAS detector.
Class for a DiscSurface in the ATLAS detector.
static EventData & getPrivateEventData(InDet::ITRT_TrackExtensionTool::IEventData &virt_event_data)
This class is the pure abstract base class for all fittable tracking measurements.
const Amg::Vector3D & position() const
Access method for the position.
Class for a planaer rectangular or trapezoidal surface in the ATLAS detector.
Identifier identify() const
return the identifier
Class for a StraightLineSurface in the ATLAS detector to describe dirft tube and straw like detectors...
Abstract Base Class for tracking surfaces.
virtual bool globalToLocal(const Amg::Vector3D &glob, const Amg::Vector3D &mom, Amg::Vector2D &loc) const =0
Specified by each surface type: GlobalToLocal method without dynamic memory allocation - boolean chec...
virtual bool insideBounds(const Amg::Vector2D &locpos, double tol1=0., double tol2=0.) const =0
virtual methods to be overwritten by the inherited 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.
const Amg::Vector3D & center() const
Returns the center position of the Surface.
Class for a generic track segment that holdes polymorphic Trk::MeasurementBase objects,...
const Trk::TrackStates * trackStateOnSurfaces() const
return a pointer to a const DataVector of const TrackStateOnSurfaces.
const Perigee * perigeeParameters() const
return Perigee.
holding In fact this class is here in order to allow STL container for all features This class is sho...
Eigen::Matrix< double, 3, 3 > RotationMatrix3D
Eigen::Affine3d Transform3D
Eigen::Matrix< double, 2, 1 > Vector2D
Eigen::Matrix< double, 3, 1 > Vector3D
Eigen::Translation< double, 3 > Translation3D
ParametersT< TrackParametersDim, Charged, DiscSurface > AtaDisc
PropDirection
PropDirection, enum for direction of the propagation.
DataVector< const Trk::TrackStateOnSurface > TrackStates
ParametersT< TrackParametersDim, Charged, PerigeeSurface > Perigee
ParametersT< TrackParametersDim, Charged, StraightLineSurface > AtaStraightLine
ParametersBase< TrackParametersDim, Charged > TrackParameters
ParametersT< TrackParametersDim, Charged, PlaneSurface > AtaPlane
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
void reverse(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of reverse for DataVector/List.