ATLAS Offline Software
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 
5 #include "FPTracker/Collimator.h"
6 #include "FPTracker/IParticle.h"
10 #include <cmath>
11 #include <sstream>
12 #include <iostream>
13 #include <limits>
14 //#include <cassert>
15 
16 namespace FPTracker{
17 
18  const std::string Collimator::s_label="Collimator";
19 
20  Collimator::Collimator(double zpos, double xaperture, Side side):
21  m_position(
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() ),
29  m_side(side)
30  {
31  }
32 
34  IBeamElement::ConstPtr_t pbe(new Collimator(*this));
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 
59  bool Collimator::isOutOfAperture(const TransversePoint& point) const {
60  double xp = point.x();
61  return (xp>m_xouter or xp<m_xinner);
62  }
63 
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 }
Trk::ParticleSwitcher::particle
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
Definition: ParticleHypothesis.h:76
python.trigbs_prescaleL1.ost
ost
Definition: trigbs_prescaleL1.py:104
FPTracker::operator<<
std::ostream & operator<<(std::ostream &os, const Beamline &bl)
Definition: FPTracker/src/Beamline.cxx:163
FPTracker::Collimator::position
Point position() const
Definition: FPTracker/src/Collimator.cxx:42
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
FPTracker::Collimator::label
std::string label() const
Definition: FPTracker/src/Collimator.cxx:44
TransversePoint.h
FPTracker::Collimator::m_xaperture
double m_xaperture
Definition: FPTracker/FPTracker/Collimator.h:47
x
#define x
FPTracker::Collimator::Collimator
Collimator(double, double, Side)
Definition: FPTracker/src/Collimator.cxx:20
FPTracker::Collimator::m_side
Side m_side
Definition: FPTracker/FPTracker/Collimator.h:50
TRT::Hit::side
@ side
Definition: HitInfo.h:83
FPTracker::Collimator::isOutOfAperture
bool isOutOfAperture(const TransversePoint &) const
Definition: FPTracker/src/Collimator.cxx:59
IParticle.h
FPTracker::Collimator::isEndElement
bool isEndElement() const
Definition: FPTracker/src/Collimator.cxx:57
FPTracker::Collimator::track
void track(IParticle &) const
Definition: FPTracker/src/Collimator.cxx:64
FPTrackerConstants.h
FPTracker::Collimator::m_xouter
double m_xouter
Definition: FPTracker/FPTracker/Collimator.h:48
FPTracker::beamlineXPosition
TransversePoint beamlineXPosition(double z)
Definition: beamlineXPosition.cxx:11
FPTracker::Collimator::m_position
Point m_position
Definition: FPTracker/FPTracker/Collimator.h:46
FPTracker::IBeamElement::ConstPtr_t
std::shared_ptr< const IBeamElement > ConstPtr_t
Definition: FPTracker/FPTracker/IBeamElement.h:40
FPTracker::Collimator::m_xinner
double m_xinner
Definition: FPTracker/FPTracker/Collimator.h:49
Side
Definition: WaferTree.h:36
FPTracker::Collimator::rearFace
double rearFace() const
Definition: FPTracker/src/Collimator.cxx:39
FPTracker::Collimator::str
std::string str() const
Definition: FPTracker/src/Collimator.cxx:46
FPTracker::Collimator::s_label
static const std::string s_label
Definition: FPTracker/FPTracker/Collimator.h:45
xAOD::double
double
Definition: CompositeParticle_v1.cxx:159
FPTracker::Point::z
double z() const
Definition: FPTracker/src/Point.cxx:19
FPTracker::Collimator
Definition: FPTracker/FPTracker/Collimator.h:20
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
FPTracker::Collimator::zsignedpos
double zsignedpos() const
Definition: FPTracker/src/Collimator.cxx:41
FPTracker::Collimator::frontFace
double frontFace() const
Definition: FPTracker/src/Collimator.cxx:38
FPTracker::Point
Definition: FPTracker/FPTracker/Point.h:14
FPTracker::TransversePoint::x
double x() const
Definition: FPTracker/src/TransversePoint.cxx:16
FPTracker::Collimator::clone
IBeamElement::ConstPtr_t clone() const
Definition: FPTracker/src/Collimator.cxx:33
FPTracker::Collimator::side
Side side() const
Definition: FPTracker/src/Collimator.cxx:43
y
#define y
Collimator.h
beamlineXPosition.h
FPTracker::Collimator::zabspos
double zabspos() const
Definition: FPTracker/src/Collimator.cxx:40
FPTracker
Definition: FPTracker/FPTracker/Beamline.h:12
FPTracker::IParticle
Definition: ForwardDetectors/FPTracker/FPTracker/IParticle.h:17
FPTracker::TransversePoint
Definition: FPTracker/FPTracker/TransversePoint.h:12
FPTracker::Collimator::calibrate
void calibrate(IParticle &)
Definition: FPTracker/src/Collimator.cxx:78