ATLAS Offline Software
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 
12 namespace 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 
PowhegControl_ttHplus_NLO.ss
ss
Definition: PowhegControl_ttHplus_NLO.py:83
TRT::Hit::side
@ side
Definition: HitInfo.h:83
getMagnetConfigFiles.h
FPTracker::beam1
@ beam1
Definition: FPTrackerConstants.h:12
getConfigFile.h
FPTracker::beam2
@ beam2
Definition: FPTrackerConstants.h:12
Side
Definition: WaferTree.h:36
beamspotman.dir
string dir
Definition: beamspotman.py:623
FPTracker::getMagnetConfigFiles
std::shared_ptr< std::ifstream > getMagnetConfigFiles(const std::string &dir, int IP, int magVer, const Side &side)
Definition: getMagnetConfigFiles.cxx:51
FPTracker::getConfigFile
std::shared_ptr< std::ifstream > getConfigFile(const std::string &dir, const std::string &fn)
Definition: getConfigFile.cxx:11
FPTracker
Definition: FPTracker/FPTracker/Beamline.h:12
FPTracker::determineMagnetConfigFileName
std::string determineMagnetConfigFileName(int IP, const Side &side, int magver)
Definition: getMagnetConfigFiles.cxx:15