ATLAS Offline Software
Loading...
Searching...
No Matches
FPTracker/src/Particle.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4
8#include <sstream>
9#include <cmath>
10#include <iomanip>
11#include <iostream>
12namespace FPTracker{
14 m_position(0., 0., 0.),
15 m_momentum(0),
16 m_direction( Point(0., 0., 0.) ),
17 m_outOfAperture(false)
18 {
19 }
20
21 Particle::Particle(double x, double y, double z, double px, double py, double pz):
22 m_position(x, y, z),
23 m_momentum(std::sqrt(px*px+py*py+pz*pz)),
25 m_outOfAperture(m_position.perp2()>FPTrackerConstants::beamPipeRadius2 ? true:false){
26 }
27
28 const Point& Particle::position() const { return m_position; }
31
35
37 m_position[0] = disp[0] - m_beamCoordinateShift[0]; // when the disp from mag center = beam axis, part. position = 0 in global coor
38 m_position[1] = disp[1] - m_beamCoordinateShift[1];
39 }
40
44
46 m_beamCoordinateShift = -1.*(be->position()).transverse();
47 }
48
50 return m_position.transverse();
51 }
52 const Point& Particle::direction() const {return m_direction;}
54 double Particle::z() const {return m_position.z();}
55 double& Particle::z() {return m_position[2];}
56 double Particle::momentum() const {return m_momentum;}
58
59 void Particle::setOutOfAperture(bool out){if(out){m_outOfAperture = true;}} //once out, always out
60 void Particle::addMsg( const std::string& msg){ m_msg += msg; }
61 std::string Particle::str() const{
62 std::ostringstream ost;
63 ost<<"Part: pos:"<<std::setprecision(4)<<std::fixed<<std::boolalpha//<<std::right
64 <<" x "<<std::setw(9)<<std::setprecision(6)<<m_position.x()
65 <<" y "<<std::setw(9)<<m_position.y()
66 <<" z "<<std::setw(7)<<std::setprecision(2)<<m_position.z()
67 <<" dir "<<std::setprecision(6)
68 <<" xp "<<std::setw(9)<<m_direction.x()
69 <<" yp "<<std::setw(9)<<m_direction.y()
70 <<" zp "<<std::setw(9)<<m_direction.z()
71 << " mom: "<<std::setprecision(0)<<m_momentum
72 <<" lost "<<m_outOfAperture
73 <<" offx "<<std::setprecision(6)<<std::setw(9)<<m_beamCoordinateShift.x()
74 <<" offy "<<std::setprecision(6)<<std::setw(9)<<m_beamCoordinateShift.y()
75 <<'\n'
76 <<" xrb "<<std::setw(9)<<std::setprecision(6)<<this->positionRelBeam().x()
77 <<" yrb "<<std::setw(9)<<this->positionRelBeam().y()
78 <<" zrb "<<std::setw(7)<<std::setprecision(2)<<this->positionRelBeam().z();
79 if( not m_msg.empty() )
80 {
81 ost<<"\n msg " <<m_msg;
82 }
83 return ost.str();
84 }
85}
Scalar perp2() const
perp2 method - perpendicular length squared
#define y
#define x
void updatePositionFromDisplacement(const TransversePoint &)
TransversePoint transversePosition() const
TransversePoint displacement() const
const Point & position() const
void setBeamCoordinateShift(const TransversePoint &)
const Point & direction() const
void addMsg(const std::string &)
STL namespace.
MsgStream & msg
Definition testRead.cxx:32