ATLAS Offline Software
Loading...
Searching...
No Matches
FPTracker Namespace Reference

Classes

class  Beamline
class  Collimator
class  CollimatorData
class  ConfigData
class  DipoleBender
class  EmptySpaceElement
class  FPTrackerConstants
class  IBeamElement
class  IBender
class  IJunkElement
class  IParticle
class  IQuadFocuser
class  LineFormater
class  Magnet
struct  MagnetData
class  NullBender
class  Particle
class  ParticleTracker
class  Plane
class  Point
class  QuadFocuserHorizontal
class  QuadFocuserNull
class  QuadFocuserVertical
class  QuadrupoleBender
class  SelectBySide
class  SolenoidElement
class  Stringer
class  TransversePoint
class  ValueSetter
class  zPosNextElement

Enumerations

enum  Bendplane { hBendplane =0 , vBendplane =1 }
enum  Side { beam1 = 1 , beam2 = 0 }

Functions

std::ostream & operator<< (std::ostream &os, const Beamline &bl)
TransversePoint beamlineXPosition (double z)
std::ostream & operator<< (std::ostream &, const Collimator &)
std::ostream & operator<< (std::ostream &, const CollimatorData &)
Collimator::Container_t collSet (const CollimatorData &, Side)
std::ostream & operator<< (std::ostream &, const ConfigData &)
template<class Array1D>
std::string array1DToString (const Array1D &arr)
template<class Array2D>
std::string array2DToString (const Array2D &arr)
template<class Array3D>
std::string array3DToString (const Array3D &arr)
std::ostream & operator<< (std::ostream &, const Side &side)
std::shared_ptr< std::ifstream > getAlfaMagnetConfigFiles (const std::string &dir, const Side &side)
std::shared_ptr< std::ifstream > getConfigFile (const std::string &dir, const std::string &fn)
std::shared_ptr< std::ifstream > getMagnetConfigFiles (const std::string &dir, int IP, int magVer, const Side &side)
std::ostream & operator<< (std::ostream &, const IBeamElement &)
std::ostream & operator<< (std::ostream &, const IParticle &)
void junkCaller (int sideSelector)
std::ostream & operator<< (std::ostream &, const Magnet &)
std::ostream & operator<< (std::ostream &, const MagnetData &)
Magnet::Ptr_t magnetFactory (double x, double y, double center, double strength, double length, int apertype, double A1, double A2, double A3, double A4, double X, double pbeam0, Side side, Magnet::Type type)
Magnet::Container_t magnetSet (const ConfigData &, const Side &side, int magversion, std::shared_ptr< std::ifstream > magfile)
double magnetStrength (int type, double length, double strength, double Brho)
std::ostream & operator<< (std::ostream &, const Plane &)
Point operator+ (const Point &lhs, const Point &rhs)
Point operator- (const Point &lhs, const Point &rhs)
Point operator+ (const Point &lhs, const TransversePoint &rhs)
Point operator- (const Point &lhs, const TransversePoint &rhs)
Point operator* (double, const Point &lhs)
std::ostream & operator<< (std::ostream &, const Point &)
template<class Container>
void printCont (const Container &arr, int perline, int nele)
bool readConfigData (std::shared_ptr< std::ifstream > confDir, ConfigData &)
Beamline setupBeamline (const ConfigData &, const Side &, int magver, std::shared_ptr< std::ifstream >)
template<class PtrType>
bool absZGreater (const PtrType rhs, const PtrType lhs)
TransversePoint operator+ (const TransversePoint &lhs, const TransversePoint &rhs)
TransversePoint operator- (const TransversePoint &lhs, const TransversePoint &rhs)
TransversePoint operator* (double, const TransversePoint &lhs)
std::ostream & operator<< (std::ostream &, const TransversePoint &)
bool isEndMarker (const IBeamElement::ConstPtr_t &p)
IBeamElement::Iter_t findBeamLineEnd (IBeamElement::Container_t &container)
std::string fixLabel (const std::string &label)
std::string determineMagnetConfigFileName (int IP, const Side &side, int magver)
std::string typeToString (Magnet::Type type)
IQuadFocuser::Ptr_t quadFocuserFactory (Magnet::Type type)
IBender::ConstPtr_t benderFactory (Magnet::Type type, double length, double strength, double pbeam0, int side)
double findIPCentre (int magver, Side side, int ip)

Enumeration Type Documentation

◆ Bendplane

Enumerator
hBendplane 
vBendplane 

Definition at line 11 of file FPTrackerConstants.h.

◆ Side

Enumerator
beam1 
beam2 

Definition at line 12 of file FPTrackerConstants.h.

Function Documentation

◆ absZGreater()

template<class PtrType>
bool FPTracker::absZGreater ( const PtrType rhs,
const PtrType lhs )

Definition at line 22 of file FPTracker/FPTracker/STLHelpers.h.

23 {
24 return lhs->zabspos() > rhs->zabspos();
25 }

◆ array1DToString()

template<class Array1D>
std::string FPTracker::array1DToString ( const Array1D & arr)

Definition at line 32 of file DataDumperHelpers.h.

32 {
33
34 std::ostringstream dump;
35 LineFormater lf = std::for_each(arr.begin(), arr.end(), LineFormater(10));
36 dump<<lf.toString()+'\n';
37 return dump.str();
38 }
-event-from-file

◆ array2DToString()

template<class Array2D>
std::string FPTracker::array2DToString ( const Array2D & arr)

Definition at line 43 of file DataDumperHelpers.h.

43 {
44
45 std::ostringstream dump;
46 for(std::size_t is=0; is<arr.size(); ++is){
47 dump << "side "<<is<<'\n';
48
49 LineFormater lf = std::for_each(arr[is].begin(), arr[is].end(), LineFormater(10));
50 dump<<lf.toString()+'\n';
51 }
52 return dump.str();
53 }

◆ array3DToString()

template<class Array3D>
std::string FPTracker::array3DToString ( const Array3D & arr)

Definition at line 56 of file DataDumperHelpers.h.

56 {
57
58 std::ostringstream dump;
59 for(std::size_t is=0; is<arr.size(); ++is){
60 dump << "side "<<is<<'\n';
61 for (std::size_t ig=0; ig<arr[is].size(); ++ig){
62
63 dump << "geom "<<ig<<'\n';
64 LineFormater lf = std::for_each(arr[is][ig].begin(), arr[is][ig].end(), LineFormater(10));
65 dump<<lf.toString()+'\n';
66
67 }
68 }
69 return dump.str();
70 }
std::ostream & dump(std::ostream &out, const I4MomIter iBeg, const I4MomIter iEnd)
Helper to stream out a range of I4Momentum objects.
Definition P4Dumper.h:24

◆ beamlineXPosition()

TransversePoint FPTracker::beamlineXPosition ( double z)

Definition at line 11 of file beamlineXPosition.cxx.

12 {
14 {
16 return tp;
17 }
18 TransversePoint tp( 0., 0. );
19 return tp;
20 }
#define z
static const double zOfBeamSeparation

◆ benderFactory()

IBender::ConstPtr_t FPTracker::benderFactory ( Magnet::Type type,
double length,
double strength,
double pbeam0,
int side )

Definition at line 39 of file magnetFactory.cxx.

45 {
46 if( type == Magnet::hbDipole )
47 {
49 length,
50 strength,
51 pbeam0,
52 side)
53 );
54 }
55
56 if ( type == Magnet::vbDipole )
57 {
58 return IBender::ConstPtr_t(new DipoleBender(vBendplane,
59 length,
60 strength,
61 pbeam0,
62 side)
63 );
64 }
65
66 if ( type == Magnet::hfQuadrupole )
67 {
69 length,
70 strength,
71 side)
72 );
73 }
74
75 if ( type == Magnet::vfQuadrupole )
76 {
78 length,
79 strength,
80 side)
81 );
82 }
83
84 throw std::logic_error("unknown magnet type");
85 }
double length(const pvec &v)
std::shared_ptr< IBender > ConstPtr_t
IQuadFocuser::Ptr_t quadFocuserFactory(Magnet::Type type)

◆ collSet()

Collimator::Container_t FPTracker::collSet ( const CollimatorData & cData,
Side side )

Definition at line 12 of file collSet.cxx.

12 {
13
14 Collimator::Container_t collimators;
15 int ncoll = CollimatorData::ncoll;
16 double zsign = side == beam2 ? -1.:1.;
17 for(int i =0; i<ncoll; ++i){
18
19 double zpos = zsign*cData.coll_z[side][i];
20 Collimator::Ptr_t col(new Collimator(zpos, cData.coll_xap[side][i], side));
21 collimators.push_back(std::move(col));
22
23 }
24
25 std::sort(collimators.begin(), collimators.end(), absZGreater<Collimator::ConstPtr_t>);
26 return collimators;
27 }
std::vector< std::vector< double > > coll_z
std::vector< std::vector< double > > coll_xap
std::shared_ptr< Collimator > Ptr_t
bool absZGreater(const PtrType rhs, const PtrType lhs)
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.

◆ determineMagnetConfigFileName()

std::string FPTracker::determineMagnetConfigFileName ( int IP,
const Side & side,
int magver )

Definition at line 15 of file getMagnetConfigFiles.cxx.

16 {
17 // Find twiss magnet configuration files used by P Bussey up until 12/08
18
19 bool argsOK = (IP == 1 || IP == 5) && (side == beam1 || side == beam2);
20 if (!argsOK)
21 {
22 std::stringstream ss;
23 ss<<"Legal side arg values = beam1 or beam2, is "<<side<<" Legal IP arg values = 1 or 5, is "<<IP<<'\n';
24
25 throw std::runtime_error(ss.str().c_str());
26 }
27
28
29 if(magver == 1)
30 {
31 if (side == beam2){return "twiss_65_b2_old.txt";}
32 return "twiss_65_b1_old.txt";
33 }
34 else
35 if ( IP==1 )
36 {
37 if( side==beam2 ) { return "LHCB2IR1_6500";}
38 return "LHCB1IR1_6500";
39 }
40 else
41 {
42 if( side==beam2 ) { return "LHCB2IR5_6500";}
43 return "LHCB1IR5_6500";
44 }
45
46 }
static Double_t ss

◆ findBeamLineEnd()

IBeamElement::Iter_t FPTracker::findBeamLineEnd ( IBeamElement::Container_t & container)

Definition at line 22 of file FPTracker/src/Beamline.cxx.

22 {
23 IBeamElement::Iter_t ei = find_if(container.begin(),
24 container.end(),
26 );
27
28 if (ei != container.end()) ++ei;
29 else {
30 std::string s("Could not find the end of the beamline.");
31 throw std::runtime_error(s);
32 }
33 return ei;
34 }
bool isEndMarker(const IBeamElement::ConstPtr_t &p)

◆ findIPCentre()

double FPTracker::findIPCentre ( int magver,
Side side,
int ip )

Definition at line 20 of file magnetSet.cxx.

21 {
22 if ( magver == 1 )
23 {
24 if ( (side == beam2) && (ip == 1) ) { return 26658.88320;}
25 if ( (side == beam2) && (ip == 5) ) { return 13329.593967;}
26 if ( (side == beam1) && (ip == 1) ) { return 0.;}
27 if ( (side == beam1) && (ip == 5) ) { return 13329.289233;}
28 assert(false);
29 }
30
31
32
33 if ( magver == 2 )
34 {
35 if ( (side == beam2) && (ip == 1) ) { return 13329.28923;}
36 if ( (side == beam2) && (ip == 5) ) { return 13329.59397;}
37 if ( (side == beam1) && (ip == 1) ) { return 13329.59397;}
38 if ( (side == beam1) && (ip == 5) ) { return 13329.28923;}
39 assert(false);
40 }
41
42 if ( magver == 3 ) //ALFA, from D Pelikan
43 {
44 if ( (side == beam2) && (ip == 1) ) { return 0.;}
45 if ( (side == beam2) && (ip == 5) ) { return 13329.593967;}
46 if ( (side == beam1) && (ip == 1) ) { return 0.;}
47 if ( (side == beam1) && (ip == 5) ) { return 13329.289233;}
48 assert(false);
49 }
50 // check that the argument values are in have expected values
51 assert(false);
52
53 return 0;
54 }

◆ fixLabel()

std::string FPTracker::fixLabel ( const std::string & label)

Definition at line 139 of file FPTracker/src/Beamline.cxx.

139 {
140 std::string s = label;
141 std::size_t tsize = 30 - label.size();
142 if (tsize>0){ s += std::string(tsize, ' ');}
143 return s;
144 }
std::string label(const std::string &format, int i)
Definition label.h:19

◆ getAlfaMagnetConfigFiles()

std::shared_ptr< std::ifstream > FPTracker::getAlfaMagnetConfigFiles ( const std::string & dir,
const Side & side )

Definition at line 14 of file getAlfaMagnetConfigFiles.cxx.

15 {
16 std::string fn = (side == beam1) ? "alfaTwiss1.txt":"alfaTwiss2.txt";
17 return getConfigFile( dir, fn );
18 }
std::shared_ptr< std::ifstream > getConfigFile(const std::string &dir, const std::string &fn)

◆ getConfigFile()

std::shared_ptr< std::ifstream > FPTracker::getConfigFile ( const std::string & dir,
const std::string & fn )

Definition at line 11 of file getConfigFile.cxx.

12 {
13 std::ifstream infile;
14 std::shared_ptr<std::ifstream> pfile(new std::ifstream);
15 FPTracker::openFile(dir, fn, pfile);
16 return pfile;
17 }

◆ getMagnetConfigFiles()

std::shared_ptr< std::ifstream > FPTracker::getMagnetConfigFiles ( const std::string & dir,
int IP,
int magVer,
const Side & side )

Definition at line 51 of file getMagnetConfigFiles.cxx.

52 {
53 return getConfigFile( dir, determineMagnetConfigFileName(IP, side, magVer) );
54 }
std::string determineMagnetConfigFileName(int IP, const Side &side, int magver)

◆ isEndMarker()

bool FPTracker::isEndMarker ( const IBeamElement::ConstPtr_t & p)

Definition at line 20 of file FPTracker/src/Beamline.cxx.

20{return p->isEndElement();}

◆ junkCaller()

void FPTracker::junkCaller ( int sideSelector)

◆ magnetFactory()

Magnet::Ptr_t FPTracker::magnetFactory ( double x,
double y,
double center,
double strength,
double length,
int apertype,
double A1,
double A2,
double A3,
double A4,
double X,
double pbeam0,
Side side,
Magnet::Type type )

Definition at line 87 of file magnetFactory.cxx.

101 {
102
103 IBender::ConstPtr_t bender( benderFactory(type, length, strength, pbeam0, side) );
104 std::string label( typeToString(type) );
105
106 return Magnet::Ptr_t(new Magnet( x,
107 y,
108 center,
109 strength,
110 length,
111 apertype,
112 A1,
113 A2,
114 A3,
115 A4,
116 X,
117 side,
118 bender.get(),
119 label
120 )
121 );
122
123 }
#define y
#define x
std::shared_ptr< Magnet > Ptr_t
std::string typeToString(Magnet::Type type)
IBender::ConstPtr_t benderFactory(Magnet::Type type, double length, double strength, double pbeam0, int side)

◆ magnetSet()

Magnet::Container_t FPTracker::magnetSet ( const ConfigData & cData,
const Side & side,
int magversion,
std::shared_ptr< std::ifstream > magfile )

Definition at line 56 of file magnetSet.cxx.

57 {
58 // Coordinate system: take z = forwards, x= to left , y = up.
59 // For quadrupoles, input the quantity K1L. type = 1,2 if K1L is +,-ve.
60 // Input type = 3 here to let the program decide.
61 // HKICK and VKICK are read and treated as bending magnets.
62
63
64
65 //-------- Arrange to read the magnet data from CERN files.
66 // twiss_b1.txt and twiss_b2.txt for beam 1 and beam 2
67 // beam 2 is on side=0 here and beam 1 is on side=1
68 // Read through the files to pick up the requested magnets.
69
70
71 const int& IP = cData.IP;
72 const double& apermb = cData.apermb;
73 const double& brho = cData.brho;
74 const float& absZMagMax = cData.absZMagMax;
75
76 Magnet::Container_t magnets;
77
78 double centreIP = findIPCentre(magver, side, IP);
79
80 std::ifstream& myMags = *magfile;
81
82
83 //std::cout<<"Open magnets file for beam "<<ifile<<std::endl;
84 //--- Skip introductory material, indicated by the 1st character of a record.
85 while (myMags.peek() =='@' || myMags.peek() =='*' || myMags.peek() =='$')
86 {
87 myMags.ignore(1000,'\n');
88 }
89
90 // side 1 == direction to +ve s of IP == beam 1.
91 // NB "dist" is -Delta(s) but magcen, i.e. z, is then -dist.
92
93 while(true)
94 {
95
96 double endpos=0, maglength=0, K0L=0, K1L=0, K2L=0, K3L=0, HKICK=0, VKICK=0;
97 float BETX=0,ALFX=0,MUX=0,DX=0,DPX=0,X=0,PX=0,BETY=0,ALFY=0,MUY=0,DY=0,DPY=0,Y=0,PY=0,A1=0,A2=0,A3=0,A4=0;
98
99 std::string magname,magsort, basicmag ;
100
101 std::string aperture;
102
103 if( magver==1 )
104 {
105 myMags>>magname>>magsort>>endpos>>maglength>>K0L>>K1L>>K2L>>K3L>>HKICK>>VKICK
106 >>BETX>>ALFX>>MUX>>DX>>DPX>>X>>PX>>BETY>>ALFY>>MUY>>DY>>DPY>>Y>>PY
107 >>aperture>>A1>>A2>>A3>>A4;
108 }
109 else if( magver==2 or magver==3 )
110 {
111 myMags>>magname>>magsort>>basicmag>>endpos>>maglength>>HKICK>>VKICK>>K0L
112 >>K1L>>K2L>>K3L>>X>>Y>>PX>>PY>>BETX>>BETY>>ALFX>>ALFY
113 >>MUX>>MUY>>DX>>DY>>DPX>>DPY>>aperture>>A1>>A2>>A3>>A4;
114 }
115 else
116 {
117 assert(false);
118 }
119
120 if(magver==1)
121 { // Some more fudges to give more precision
122 if(std::fabs(K0L)==0.000188) K0L=K0L*188.175/188.0 ;
123 if(std::fabs(K0L)==0.001129) K0L=K0L*1129.049/1129. ;
124 if(std::fabs(K1L)==0.055577) K0L=K0L*55576.561/55577. ;
125 if(std::fabs(K1L)==0.047986) K0L=K0L*47986.041/47986. ;
126 if(std::fabs(VKICK)==0.00020) VKICK=VKICK*20.171/20. ;
127 if(std::fabs(VKICK)==0.00019) VKICK=VKICK*19.17/19. ;
128 }
129
130 double dist = centreIP - endpos + 0.5*maglength ;
131
132 float adist=std::fabs(dist) ;
133
134 // decide how to progress down the magnet files
135 // the file formats are not constant. first
136 // consider the magver=1 or 2 (these are two formats used by AFP.
137 if ( magver == 1 or magver == 2 )
138 {
139 if (side == beam1)
140 {
141 if( dist > 0. ) {continue;}
142 if( adist > absZMagMax ) {break;}
143 }
144 else
145 {
146 if( adist > absZMagMax ) {continue;}
147 if ( dist <= 0. ) {break;}
148 }
149 }
150 else if( magver == 3 ) //ALFA. from D. Pelikan
151 {
152 if( dist > 0. ) {continue;}
153 if( adist > absZMagMax ) {break;}
154 }
155
157 double magstrength = 0;
158 if (K0L != 0.)
159 {
160 mmagtype = Magnet::hbDipole; //type = 0
161 magstrength = K0L;
162 if(side == beam2)
163 {
164 magstrength = -magstrength;
165 }
166
167 }
168 else if(K1L != 0.)
169 {
170 magstrength = K1L;
171 mmagtype = magstrength >= 0 ? Magnet::hfQuadrupole:Magnet::vfQuadrupole; // type = 3 ->1,2
172 assert(maglength > 0.);
173 magstrength = std::fabs(brho*magstrength/maglength);
174 }
175 else if(HKICK != 0.)
176 {
177 mmagtype = Magnet::hbDipole; // type = 0
178 magstrength = -HKICK;
179 }
180 else if(VKICK != 0.)
181 {
182 mmagtype = Magnet::vbDipole; // type = 4
183 magstrength = VKICK;
184 }
185
186 if(mmagtype == Magnet::notAMagnet) {continue;} // --(not a magnet)
187
188
189 double mmagcen = -dist;
190
191
192 // more differences between AFP and ALFA files (from D. Pelikan)
193 if (magver == 3)
194 {
195 if (side == beam2 ){ mmagcen = dist; }
196
197 }
198
199
200 int mmagapertype = 0;
201 // CLassify apertures.
202 if(aperture == "\"NONE\"")
203 {
204 mmagapertype = 0;
205 }
206 else if(aperture == "\"CIRCLE\"" && A1 == 0.)
207 {
208 mmagapertype =0;
209 }
210 else if(aperture == "\"CIRCLE\"" && A1 > 0.)
211 {
212 mmagapertype =1;
213 }
214 else if(aperture == "\"RECTELLIPSE\"")
215 {
216 mmagapertype =2;
217 }
218 else if(aperture == "\"OCTAGON\"")
219 {
220 mmagapertype =3;
221 }
222 else
223 {
224 throw std::runtime_error(" Unknown magnet aperture type "+aperture+"\n");
225 }
226
227
228 if(apermb > 0)
229 { // -------alter the MB apertures
230 int pos = magname.find("MB.");
231 if(pos==1)
232 {
233 A3=apermb; A4=apermb;
234 }
235 }
236
237 // note the sign convention for xdis. This shift of the magnet
238 // x location accounts for the splitting of the beams somewhere
239 // around 155. m. The x coordinate is wrt to beamline position,
240 // and not the magnet center.
241 double mmagnet_x = beamlineXPosition(mmagcen)[0];
242 double mmagnet_y = beamlineXPosition(mmagcen)[1];
243
244 Magnet::Ptr_t mptr = magnetFactory(mmagnet_x,
245 mmagnet_y,
246 mmagcen,
247 magstrength,
248 maglength,
249 mmagapertype,
250 A1,
251 A2,
252 A3,
253 A4,
254 X,
255 cData.pbeam0,
256 side,
257 mmagtype);
258 magnets.push_back(std::move(mptr));
259 }
260 std::sort(magnets.begin(), magnets.end(), absZGreater< Magnet::ConstPtr_t >);
261 return magnets;
262 }
static const int K0L
Definition AtlasPID.h:112
std::vector< Ptr_t > Container_t
double findIPCentre(int magver, Side side, int ip)
Definition magnetSet.cxx:20
TransversePoint beamlineXPosition(double z)
Magnet::Ptr_t magnetFactory(double x, double y, double center, double strength, double length, int apertype, double A1, double A2, double A3, double A4, double X, double pbeam0, Side side, Magnet::Type type)

◆ magnetStrength()

double FPTracker::magnetStrength ( int type,
double length,
double strength,
double Brho )

Definition at line 8 of file magnetStrength.cxx.

8 {
9 // calculate qpole gradient from formula g = K1L brho /L
10 // K1L from CERN database
11 // brho = 23349. = 3.345*7000 - now pbeam0/speedOflight (12//11/09)
12 // L = mag length
13
14 assert(type>=0 and type<5);
15
16 if(type==0 || type==4) return strength;
17 strength = brho*strength/length;
18
19 if (type == 1){ return strength;}
20 if (type == 2){ return -strength;}
21 //itype == 3 only remains....
22 return strength >=0. ? strength:-strength;
23
24 // strength = bend angle for dipoles, -> gradient for quadrupoles
25 // type = 0 for dipole,
26 // 1 for hor focussing qpoles,
27 // 2 for vert focussing qpoles.
28 }

◆ operator*() [1/2]

Point FPTracker::operator* ( double scalar,
const Point & lhs )

Definition at line 123 of file FPTracker/src/Point.cxx.

123 {
124 Point p = point;
125 return p*=scalar;
126 }

◆ operator*() [2/2]

TransversePoint FPTracker::operator* ( double scalar,
const TransversePoint & lhs )

Definition at line 85 of file FPTracker/src/TransversePoint.cxx.

85 {
86 TransversePoint p = point;
87 return p*=scalar;
88 }

◆ operator+() [1/3]

Point FPTracker::operator+ ( const Point & lhs,
const Point & rhs )

Definition at line 98 of file FPTracker/src/Point.cxx.

98 {
99 Point point(lhs);
100 return point += rhs;
101 }

◆ operator+() [2/3]

Point FPTracker::operator+ ( const Point & lhs,
const TransversePoint & rhs )

Definition at line 108 of file FPTracker/src/Point.cxx.

108 {
109 Point point(lhs);
110 return point += rhs;
111 }

◆ operator+() [3/3]

TransversePoint FPTracker::operator+ ( const TransversePoint & lhs,
const TransversePoint & rhs )

Definition at line 71 of file FPTracker/src/TransversePoint.cxx.

71 {
72 TransversePoint point(lhs);
73 return point += rhs;
74 }

◆ operator-() [1/3]

Point FPTracker::operator- ( const Point & lhs,
const Point & rhs )

Definition at line 103 of file FPTracker/src/Point.cxx.

103 {
104 Point point(lhs);
105 return point -= rhs;
106 }

◆ operator-() [2/3]

Point FPTracker::operator- ( const Point & lhs,
const TransversePoint & rhs )

Definition at line 113 of file FPTracker/src/Point.cxx.

113 {
114 Point point(lhs);
115 return point -= rhs;
116 }

◆ operator-() [3/3]

TransversePoint FPTracker::operator- ( const TransversePoint & lhs,
const TransversePoint & rhs )

Definition at line 76 of file FPTracker/src/TransversePoint.cxx.

76 {
77 TransversePoint point(lhs);
78 return point -= rhs;
79 }

◆ operator<<() [1/12]

std::ostream & FPTracker::operator<< ( std::ostream & os,
const Collimator & coll )

Definition at line 88 of file FPTracker/src/Collimator.cxx.

88 {
89 os<<coll.str();
90 return os;
91 }

◆ operator<<() [2/12]

std::ostream & FPTracker::operator<< ( std::ostream & os,
const CollimatorData & cData )

Definition at line 38 of file FPTracker/src/CollimatorData.cxx.

38 {
39 os<<cData.toString();
40 return os;
41 }

◆ operator<<() [3/12]

std::ostream & FPTracker::operator<< ( std::ostream & os,
const ConfigData & cd )

Definition at line 58 of file FPTracker/src/ConfigData.cxx.

58 {
59 os<<cd.toString();
60 return os;
61 }

◆ operator<<() [4/12]

std::ostream & FPTracker::operator<< ( std::ostream & os,
const IBeamElement & ibe )

Definition at line 10 of file FPTracker/src/IBeamElement.cxx.

11 {
12 os<<ibe.str();
13 return os;
14 }
virtual std::string str() const =0

◆ operator<<() [5/12]

std::ostream & FPTracker::operator<< ( std::ostream & os,
const IParticle & p )

Definition at line 10 of file ForwardDetectors/FPTracker/src/IParticle.cxx.

11 {
12 os<<p.str();
13 return os;
14 }

◆ operator<<() [6/12]

std::ostream & FPTracker::operator<< ( std::ostream & os,
const Magnet & mag )

Definition at line 229 of file FPTracker/src/Magnet.cxx.

229 {
230 os << mag.str();
231 return os;
232 }
Scalar mag() const
mag method

◆ operator<<() [7/12]

std::ostream & FPTracker::operator<< ( std::ostream & os,
const MagnetData & md )

Definition at line 75 of file MagnetData.cxx.

75 {
76 os<<md.toString();
77 return os;
78 }
std::string toString() const

◆ operator<<() [8/12]

std::ostream & FPTracker::operator<< ( std::ostream & os,
const Plane & p )

Definition at line 66 of file FPTracker/src/Plane.cxx.

66 {
67 os<<p.str();
68 return os;
69 }

◆ operator<<() [9/12]

std::ostream & FPTracker::operator<< ( std::ostream & os,
const Point & p )

Definition at line 118 of file FPTracker/src/Point.cxx.

118 {
119 os<<p.str();
120 return os;
121 }

◆ operator<<() [10/12]

std::ostream & FPTracker::operator<< ( std::ostream & os,
const Side & side )

Definition at line 16 of file FPTrackerConstants.cxx.

16 {
17 std::string label = side == beam1 ? " beam1 ":" beam2 ";
18 os << label;
19 return os;
20 }

◆ operator<<() [11/12]

std::ostream & FPTracker::operator<< ( std::ostream & os,
const TransversePoint & p )

Definition at line 80 of file FPTracker/src/TransversePoint.cxx.

80 {
81 os<<p.str();
82 return os;
83 }

◆ operator<<() [12/12]

std::ostream & FPTracker::operator<< ( std::ostream & os,
const Beamline & bl )

Definition at line 163 of file FPTracker/src/Beamline.cxx.

163 {
164 os<<bl.str()<<std::endl;
165 return os;
166 }

◆ printCont()

template<class Container>
void FPTracker::printCont ( const Container & arr,
int perline,
int nele )

Definition at line 10 of file printCont.h.

10 {
11 int linecount = 0;
12 for(int i = 0; i<nele; ++i){
13 std::cout<<" "<<arr[i];
14 if(++linecount == perline){
15 linecount = 0;
16 std::cout<<'\n';
17 }
18 }
19 std::cout<<'\n';
20 }

◆ quadFocuserFactory()

IQuadFocuser::Ptr_t FPTracker::quadFocuserFactory ( Magnet::Type type)

Definition at line 29 of file magnetFactory.cxx.

30 {
31
33 if ( type == Magnet::vfQuadrupole ){return IQuadFocuser::Ptr_t(new QuadFocuserVertical);}
34
35 throw std::logic_error("bad magnet type for QuadFocuser");
36 }
std::shared_ptr< IQuadFocuser > Ptr_t

◆ readConfigData()

bool FPTracker::readConfigData ( std::shared_ptr< std::ifstream > confDir,
ConfigData & configData )

Definition at line 59 of file readConfigData.cxx.

59 {
60 // ConfigData readConfigData(std::string& dir){
61 // Read data cards from Data.txt file
62
63
64 std::ifstream& in = *p_mydata;
65 std::string line;
66 ValueSetter vs;
67
68 boost::char_separator<char> sep(" \f\t\v");
69 typedef boost::tokenizer<boost::char_separator<char> > Tokenizer;
70
71
72 std::ostringstream ost;
73 while( std::getline(in, line) )
74 {
75 Tokenizer tok(line, sep);
76 std::vector< std::string > tokens(tok.begin(), tok.end());
77
78 if ( tokens.size() > 1 )
79 {
80 ost<<tokens[0]<<" "<<tokens[1]<<'\n';
81 std::string& dataname = tokens[0];
82 std::string& svalue = tokens[1];
83 if(dataname == "IP" ) vs.setValue(configData.IP, svalue);
84 if(dataname == "APER") vs.setValue(configData.useaper, svalue);
85 if(dataname == "MBAP") vs.setValue(configData.apermb, svalue);
86 if(dataname == "COL1") vs.setValue(configData.xcol1, svalue);
87 if(dataname == "COL2") vs.setValue(configData.xcol2, svalue);
88 if(dataname == "ZMAX") vs.setValue(configData.absZMagMax, svalue);
89 if(dataname == "ENDM") vs.setValue(configData.endMarker, svalue);
90
91 if(dataname == "PBEA") {
92 float pbeam;
93 if ( vs.setValue(pbeam, svalue) ){configData.setpbeam(pbeam);}
94 }
95
96
97 }
98
99 }
100
101 return !vs.errors();
102 }
bool setValue(T &val, const std::string &s)

◆ setupBeamline()

Beamline FPTracker::setupBeamline ( const ConfigData & configData,
const Side & side,
int magver,
std::shared_ptr< std::ifstream > magfile )

Definition at line 25 of file setupBeamline.cxx.

31 {
32
33 Magnet::Container_t magnets = magnetSet(configData, side, magver, std::move(magfile));
34 Plane::Ptr_t endPlane( new Plane(configData.endMarker, side) );
35 CollimatorData collimatorData(configData);
36 Collimator::Container_t collimators = collSet(collimatorData, side);
37
38 IBeamElement::List_t elements;
39 //elements.reserve( 2*(magnets.size()+collimators.size()+planes.size()) );
40 elements.assign(magnets.begin(), magnets.end());
41 elements.push_back(std::move(endPlane));
42 elements.insert(elements.end(), collimators.begin(), collimators.end());
44
45
46 IBeamElement::ListIter_t current = elements.begin();
47 IBeamElement::ListIter_t last = elements.end();
48
49 elements.push_front
50 (
53 0.,
54 (*current)->frontFace(),
56 (*current)->side()
57 )
58 )
59 );
60 ++current;
61
62 for(; current != last; ++current){
63 IBeamElement::ListIter_t previous = current;
64 --previous;
65 elements.insert(current,
68 *previous,
69 *current
70 )
71 )
72 );
73 }
74
75 Beamline beamline(elements.begin(), elements.end());
76
77 double pbeam = configData.pbeam0;
78 std::shared_ptr<IParticle> ip = (side == beam1) ?
79 std::shared_ptr<IParticle>(new Particle(0., 0., 0., 0., 0., pbeam) ):
80 std::shared_ptr<IParticle>(new Particle(0., 0., 0., 0., 0., -1.*pbeam) );
81 beamline.calibrate( *ip );
82
83
84 return beamline;
85 }
std::shared_ptr< IBeamElement > Ptr_t
Collimator::Container_t collSet(const CollimatorData &, Side)
Definition collSet.cxx:12
Magnet::Container_t magnetSet(const ConfigData &, const Side &side, int magversion, std::shared_ptr< std::ifstream > magfile)
Definition magnetSet.cxx:56

◆ typeToString()

std::string FPTracker::typeToString ( Magnet::Type type)

Definition at line 20 of file magnetFactory.cxx.

21 {
22 if ( type == Magnet::hbDipole ) { return "hbDipole"; }
23 if ( type == Magnet::vbDipole ) { return "vbDipole"; }
24 if ( type == Magnet::hfQuadrupole ){ return "hfQuad"; }
25 if ( type == Magnet::vfQuadrupole) { return "vfQuad"; }
26 throw std::logic_error("unknown magnet type");
27 }