ATLAS Offline Software
ALFA_BeamTrack.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "ALFA_BeamTrack.h"
6 
7 //Athena Stuff
8 #include "GaudiKernel/MsgStream.h"
10 
11 //FPTracker stuff
13 #include "FPTracker/Beamline.h"
14 #include "FPTracker/Particle.h"
18 #include "FPTracker/ConfigData.h"
20 #include "FPTracker/Point.h"
21 
22 
23 #include <memory>
24 #include <iostream>
25 #include <utility>
26 
27 //constructor
29 {
30 
31  //initialisation with standart values
32 
33  //declareProperty("ConfDir", m_ConfDir= "./config");
34  /*m_ConfDir= ...
35  m_AlfaTwiss = ...*/
36 
37  m_AlfaTwiss=true;
38  m_ip = 1;
39  m_Magver = 3;
41 
42 
43 }
44 
45 //destructor
47 {
48 }
49 
50 int ALFA_BeamTrack::initialize(const FPConfig &ConfigValues){
51 
52  m_ConfDir= ConfigValues.ConfDir;
53  m_AlfaTwiss = ConfigValues.UseALFA;
54 
55 
56  //initialisation of beampipes
57  if (m_AlfaTwiss) {std::cout<<"Will use alfa twiss files"<<std::endl;}
58 
59 
60  /*
61 
62  boost::shared_ptr< std::ifstream > p_confFile;
63  p_confFile = FPTracker::getConfigFile(m_ConfDir, "FPData.txt") ;
64  m_ConfigData = FPTracker::readConfigData(p_confFile);
65 
66  //SetPosition of RP in meter
67 
68  //m_ConfigData.setPlane(ConfigValues.RPDistance);
69 
70 
71  ConfigData configData;
72  if( !readConfigData(p_confFile, configData) )
73  {
74  std::cout<<"fatal error reading config data\n";
75  return 1;
76  }
77 
78 
79  */
80 
81  //Set Configuration parameters of FPTracker library
82  FPTracker::ConfigData ConfigData;
83 
84 
85  ConfigData.IP=ConfigValues.IP;
86  ConfigData.useaper=ConfigValues.useaper;
87  ConfigData.apermb=ConfigValues.apermb;
88  ConfigData.xcol1=ConfigValues.xcol1;
89  ConfigData.xcol2=ConfigValues.xcol2;
90  ConfigData.absZMagMax=ConfigValues.absZMagMax;
91  ConfigData.endMarker=ConfigValues.RPDistance;
92  ConfigData.setpbeam(ConfigValues.pbeam0);
93 
94  /*
95  std::cout<<ConfigData.IP<<std::endl;
96  std::cout<<ConfigData.useaper<<std::endl;
97  std::cout<<ConfigData.apermb<<std::endl;
98  std::cout<<ConfigData.xcol1<<std::endl;
99  std::cout<<ConfigData.xcol2<<std::endl;
100  std::cout<<ConfigData.absZMagMax<<std::endl;
101  std::cout<<ConfigData.endMarker<<std::endl;
102  std::cout<<ConfigData.pbeam0<<std::endl;
103  std::cout<<ConfigData.brho<<std::endl;*/
104 
105 
106 
107 
108 
109 
110 
111 
112 
113  m_ip = ConfigData.IP;
114  m_Magver = 3;
115 
121  std::cout<<" beamline_1 start "<<'\n';
122  std::cout<<m_Beamline_1;
123  std::cout<<" beamline_1 end "<<"\n\n";
124 
130 
131  std::cout<<" beamline_2 start "<<'\n';
132  std::cout<<m_Beamline_2;
133  std::cout<<" beamline_2 end "<<"\n\n";
134 
135  return true;
136 }
137 
138 //calculates Position and Momentum at RP
140 
142  FPTracker::Point lost_markerMom(-99,-99,-99);
143 
144 
145  std::cout<<"fpTracker: "<<Particle<<std::endl;
147  std::cout<<"fpTracker: "<<Particle<<std::endl;
148 
149  //m_PosParticleRP=Particle.position(); //old version vith 97mm shift
150  m_PosParticleRP=Particle.positionRelBeam();//version without shift
151 
152  FPTracker::Point momentum( Particle.direction().x()*Particle.momentum(),
153  Particle.direction().y()*Particle.momentum(),
154  Particle.direction().z()*Particle.momentum());
155 
157 
158 
159  if(Particle.isOutOfAperture())
160  {
161  //FPTracker::Point lost_markerPos(-99,-99,Particle.position().z());// old version with shift
162  FPTracker::Point lost_markerPos(-99,-99,Particle.positionRelBeam().z());
163  std::cout<<"Particle got lost"<<std::endl;
164  //m_PosParticleRP=lost_marker;
165  //write lost particle with -99 as maker in x and yposition z position ist the place where particle got lost
166  m_PosParticleRP=lost_markerPos;
167 
168  m_MomParticleRP=lost_markerMom;
169  }
170 
171 
172  return true;
173 }
174 
175 //returns particle position
177  return m_PosParticleRP;
178 }
179 
180 // returns momentum of particle
182  return m_MomParticleRP;
183 }
184 
185 
getAlfaMagnetConfigFiles.h
FPConfig::IP
int IP
Definition: ALFA_FPConfig.h:17
FPConfig::UseALFA
bool UseALFA
Definition: ALFA_FPConfig.h:12
Trk::ParticleSwitcher::particle
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
Definition: ParticleHypothesis.h:76
ALFA_BeamTrack.h
ALFA_BeamTrack::m_ip
int m_ip
Definition: ALFA_BeamTrack.h:52
FPTracker::ConfigData::useaper
bool useaper
Definition: FPTracker/FPTracker/ConfigData.h:14
FPConfig
Definition: ALFA_FPConfig.h:10
ALFA_BeamTrack::ALFA_BeamTrack
ALFA_BeamTrack()
Definition: ALFA_BeamTrack.cxx:28
FPConfig::ConfDir
std::string ConfDir
Definition: ALFA_FPConfig.h:13
ALFA_BeamTrack::m_ConfDir
std::string m_ConfDir
Definition: ALFA_BeamTrack.h:49
ConfigData.h
Point.h
ALFA_BeamTrack::m_Beamline_1
FPTracker::Beamline m_Beamline_1
Definition: ALFA_BeamTrack.h:62
ALFA_BeamTrack::m_PosParticleRP
FPTracker::Point m_PosParticleRP
Definition: ALFA_BeamTrack.h:59
ALFA_BeamTrack::m_MomParticleRP
FPTracker::Point m_MomParticleRP
Definition: ALFA_BeamTrack.h:60
FPTracker::setupBeamline
Beamline setupBeamline(const ConfigData &, const Side &, int magver, std::shared_ptr< std::ifstream >)
Definition: setupBeamline.cxx:27
xAOD::Particle
Particle_v1 Particle
Define the latest version of the particle class.
Definition: Event/xAOD/xAODParticleEvent/xAODParticleEvent/Particle.h:17
ALFA_BeamTrack::initialize
int initialize(const FPConfig &ConfigValues)
Definition: ALFA_BeamTrack.cxx:50
FPTracker::ConfigData::xcol1
double xcol1
Definition: FPTracker/FPTracker/ConfigData.h:16
getMagnetConfigFiles.h
FPTracker::beam1
@ beam1
Definition: FPTrackerConstants.h:12
AthAlgorithm.h
FPTracker::ConfigData::xcol2
double xcol2
Definition: FPTracker/FPTracker/ConfigData.h:17
FPConfig::xcol2
double xcol2
Definition: ALFA_FPConfig.h:22
getConfigFile.h
FPTracker::ConfigData::absZMagMax
float absZMagMax
Definition: FPTracker/FPTracker/ConfigData.h:23
ALFA_BeamTrack::m_AlfaTwiss
bool m_AlfaTwiss
Definition: ALFA_BeamTrack.h:51
FPConfig::apermb
double apermb
Definition: ALFA_FPConfig.h:20
ALFA_BeamTrack::MomRP
const FPTracker::Point & MomRP()
gives back Momentum
Definition: ALFA_BeamTrack.cxx:181
FPTrackerConstants.h
ParticleGun_EoverP_Config.momentum
momentum
Definition: ParticleGun_EoverP_Config.py:63
FPTracker::beam2
@ beam2
Definition: FPTrackerConstants.h:12
FPConfig::xcol1
double xcol1
Definition: ALFA_FPConfig.h:21
FPTracker::Beamline::track
void track(IParticle &) const
Definition: FPTracker/src/Beamline.cxx:94
ALFA_BeamTrack::m_Magfile
std::shared_ptr< std::ifstream > m_Magfile
Definition: ALFA_BeamTrack.h:56
FPConfig::absZMagMax
float absZMagMax
Definition: ALFA_FPConfig.h:28
FPTracker::Particle
Definition: ForwardDetectors/FPTracker/FPTracker/Particle.h:19
FPConfig::RPDistance
float RPDistance
Definition: ALFA_FPConfig.h:25
setupBeamline.h
ALFA_BeamTrack::m_Magver
int m_Magver
Definition: ALFA_BeamTrack.h:53
FPTracker::ConfigData::endMarker
float endMarker
Definition: FPTracker/FPTracker/ConfigData.h:21
ALFA_BeamTrack::PosRP
const FPTracker::Point & PosRP()
Gives Back Position.
Definition: ALFA_BeamTrack.cxx:176
FPTracker::Point
Definition: FPTracker/FPTracker/Point.h:14
ALFA_BeamTrack::CalculatePosRP
int CalculatePosRP(FPTracker::Particle particle)
calculates the particle position and momentum at RP run first CalculatePosRP() then posRP() and momRP...
Definition: ALFA_BeamTrack.cxx:139
FPTracker::getMagnetConfigFiles
std::shared_ptr< std::ifstream > getMagnetConfigFiles(const std::string &dir, int IP, int magVer, const Side &side)
Definition: getMagnetConfigFiles.cxx:51
Beamline.h
ALFA_BeamTrack::~ALFA_BeamTrack
~ALFA_BeamTrack()
Definition: ALFA_BeamTrack.cxx:46
FPTracker::ConfigData::setpbeam
void setpbeam(double)
Definition: FPTracker/src/ConfigData.cxx:37
FPTracker::getAlfaMagnetConfigFiles
std::shared_ptr< std::ifstream > getAlfaMagnetConfigFiles(const std::string &dir, const Side &side)
Definition: getAlfaMagnetConfigFiles.cxx:14
FPConfig::pbeam0
double pbeam0
Definition: ALFA_FPConfig.h:23
FPConfig::useaper
bool useaper
Definition: ALFA_FPConfig.h:19
ALFA_BeamTrack::m_Beamline_2
FPTracker::Beamline m_Beamline_2
Definition: ALFA_BeamTrack.h:63
ALFA_BeamTrack::m_Side
FPTracker::Side m_Side
Definition: ALFA_BeamTrack.h:55
FPTracker::ConfigData
Definition: FPTracker/FPTracker/ConfigData.h:9
Particle.h
FPTracker::ConfigData::apermb
double apermb
Definition: FPTracker/FPTracker/ConfigData.h:15
FPTracker::ConfigData::IP
int IP
Definition: FPTracker/FPTracker/ConfigData.h:12