ATLAS Offline Software
Loading...
Searching...
No Matches
FPTracker/src/Collimator.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
10#include <cmath>
11#include <sstream>
12#include <iostream>
13#include <limits>
14//#include <cassert>
15
16namespace FPTracker{
17
18 const std::string Collimator::s_label="Collimator";
19
20 Collimator::Collimator(double zpos, double xaperture, Side side):
22 beamlineXPosition(zpos).x(),
23 beamlineXPosition(zpos).y(),
24 zpos
25 ),
26 m_xaperture(xaperture),
27 m_xouter( std::numeric_limits<double>::max() ),
28 m_xinner( -1*std::numeric_limits<double>::max() ),
30 {
31 }
32
35 return pbe;
36 }
37
38 double Collimator::frontFace() const{ return m_position.z(); }
39 double Collimator::rearFace() const{ return m_position.z(); }
40 double Collimator::zabspos() const{ return std::fabs(m_position.z()); }
41 double Collimator::zsignedpos() const{ return m_position.z(); }
43 Side Collimator::side() const{ return m_side; }
44 std::string Collimator::label() const{ return s_label; }
45
46 std::string Collimator::str() const {
47 std::stringstream ost;
48 ost <<"-- Collimator --"<<'\n'
49 <<"postion " <<m_position<<'\n'
50 <<"xouter " <<m_xouter<<'\n'
51 <<"xinner " <<m_xinner<<'\n'
52 <<"xaperture " <<m_xaperture<<'\n'
53 <<"side " <<m_side<<'\n';
54 return ost.str();
55 }
56
57 bool Collimator::isEndElement() const{ return false; }
58
60 double xp = point.x();
61 return (xp>m_xouter or xp<m_xinner);
62 }
63
64 void Collimator::track(IParticle& particle) const
65 {
66
67 particle.setBeamCoordinateShift(this);
68
69 if (particle.isOutOfAperture()){return;}
70
71 if ( isOutOfAperture( particle.transversePosition() ) )
72 {
73 particle.setOutOfAperture(true);
74 }
75
76 }
77
79 {
80 // the collimator jaws start wide open.
81 this->track(particle);
82 double partX =particle.position().x();
83 m_xouter = partX+m_xaperture;
84 m_xinner = partX-m_xaperture;
85
86 }
87
88 std::ostream& operator<<(std::ostream& os, const Collimator& coll){
89 os<<coll.str();
90 return os;
91 }
92
93
94}
#define y
#define x
#define max(a, b)
Definition cfImp.cxx:41
bool isOutOfAperture(const TransversePoint &) const
IBeamElement::ConstPtr_t clone() const
void track(IParticle &) const
Collimator(double, double, Side)
std::shared_ptr< const IBeamElement > ConstPtr_t
std::ostream & operator<<(std::ostream &os, const Beamline &bl)
TransversePoint beamlineXPosition(double z)
STL namespace.