ATLAS Offline Software
Loading...
Searching...
No Matches
getMagnetConfigFiles.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
7#include "../src/openFile.tpl"
8#include <sstream>
9#include <iostream>
10#include <stdexcept>
11
12namespace FPTracker{
13
14
15 std::string determineMagnetConfigFileName(int IP, const Side& side, int magver)
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 }
47
48
49
50
51 std::shared_ptr<std::ifstream> getMagnetConfigFiles(const std::string& dir, int IP, int magVer, const Side& side)
52 {
53 return getConfigFile( dir, determineMagnetConfigFileName(IP, side, magVer) );
54 }
55
56}
57
static Double_t ss
std::string determineMagnetConfigFileName(int IP, const Side &side, int magver)
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)