1 |
buchmann |
1.1 |
#include <string>
|
2 |
|
|
#include <map>
|
3 |
|
|
#include <iostream>
|
4 |
|
|
#include <fstream>
|
5 |
|
|
|
6 |
buchmann |
1.2 |
#define CrossSectionReaderLoaded
|
7 |
|
|
|
8 |
buchmann |
1.1 |
using namespace std;
|
9 |
|
|
|
10 |
|
|
string inttoprocess(int id) {
|
11 |
|
|
if(id==1) return "ng";
|
12 |
|
|
if(id==2) return "ns";
|
13 |
|
|
if(id==3) return "nn";
|
14 |
|
|
if(id==4) return "ll";
|
15 |
|
|
if(id==5) return "sb";
|
16 |
|
|
if(id==6) return "ss";
|
17 |
|
|
if(id==7) return "tb";
|
18 |
|
|
if(id==8) return "bb";
|
19 |
|
|
if(id==9) return "gg";
|
20 |
|
|
if(id==10) return "sg";
|
21 |
|
|
return "ERROR_in_inttoprocess";
|
22 |
|
|
}
|
23 |
|
|
|
24 |
|
|
map < pair<float, float>, map<string, float> > getXsec(string xsecfile) {
|
25 |
|
|
|
26 |
|
|
map < pair<float, float>, map<string, float> > xsec;
|
27 |
|
|
std::ifstream inFile(xsecfile.c_str());
|
28 |
|
|
if(!inFile) {
|
29 |
|
|
write_error(__FUNCTION__,"SPECIFIED CROSS SECTION FILE WAS NOT FOUND!");
|
30 |
|
|
cout << "Attempted to read from " << xsecfile << endl;
|
31 |
|
|
return xsec;
|
32 |
|
|
}
|
33 |
|
|
std::string sLine;
|
34 |
|
|
while(std::getline(inFile, sLine))
|
35 |
|
|
{
|
36 |
|
|
int init_m0 = sLine.find("m0", 0);
|
37 |
|
|
if(init_m0 == string::npos) continue;
|
38 |
|
|
|
39 |
|
|
//file structure
|
40 |
|
|
//|(scale=1.0) m0=1000, m1/2=100, tanbeta=3, A0=0, sign(mu)=+ve| 0.224611 | 0.0101205 | 53.1719 | 3.5998e-06 | 0.00592 | 0.0386 | 0.024632 | 0.001203 | 66.1 | 2.3 |
|
41 |
|
|
//| Sub-processes | ng | ns | nn | ll | sb | ss | tb | bb | gg | sg |
|
42 |
|
|
|
43 |
|
|
int m0=-1, m12=-1, tanb=-1;
|
44 |
|
|
float ng=-1,ns=-1,nn=-1,ll=-1,sb=-1,ss=-1,tb=-1,bb=-1,gg=-1,sg=-1,tngb=-1,a0=-1;
|
45 |
|
|
sscanf(sLine.c_str(), " |(scale=1.0) m0=%*d, m1/2=%*d, tanbeta=%f, A0=%f, sign(mu)=+ve| %f | %e | %e | %e | %e | %e | %e | %e | %e | %e |",
|
46 |
|
|
&tngb,&a0,&ng,&ns,&nn,&ll,&sb,&ss,&tb,&bb,&gg,&sg);
|
47 |
|
|
sscanf(sLine.c_str(), " |(scale=1.0) m0=%d, m1/2=%d, %*s |",
|
48 |
|
|
&m0, &m12);
|
49 |
|
|
|
50 |
|
|
pair< float, float > susyPoint;
|
51 |
|
|
map< string, float > subXsec;
|
52 |
|
|
susyPoint.first = m0; susyPoint.second = m12;
|
53 |
|
|
subXsec["ng"] = ng;
|
54 |
|
|
subXsec["ns"] = ns;
|
55 |
|
|
subXsec["nn"] = nn;
|
56 |
|
|
subXsec["ll"] = ll;
|
57 |
|
|
subXsec["sb"] = sb;
|
58 |
|
|
subXsec["ss"] = ss;
|
59 |
|
|
subXsec["tb"] = tb;
|
60 |
|
|
subXsec["bb"] = bb;
|
61 |
|
|
subXsec["gg"] = gg;
|
62 |
|
|
subXsec["sg"] = sg;
|
63 |
|
|
xsec[ susyPoint ] = subXsec;
|
64 |
|
|
}
|
65 |
|
|
inFile.close();
|
66 |
|
|
return xsec;
|
67 |
|
|
}
|
68 |
|
|
|
69 |
|
|
float GetXSecForPointAndChannel(float m0, float m12, map < pair<float, float>, map<string, float> > &xsec, string channel) {
|
70 |
|
|
pair< float, float > susyPoint; susyPoint.first = m0; susyPoint.second = m12;
|
71 |
|
|
map< string, float > subXsec = xsec[susyPoint];
|
72 |
|
|
return subXsec[channel];
|
73 |
|
|
}
|
74 |
|
|
|
75 |
|
|
float GetXSecForPointAndChannel(float m0, float m12, map < pair<float, float>, map<string, float> > &xsec, int channel) {
|
76 |
|
|
return GetXSecForPointAndChannel(m0, m12, xsec, inttoprocess(channel));
|
77 |
|
|
}
|
78 |
|
|
|
79 |
|
|
|
80 |
|
|
|
81 |
|
|
/*
|
82 |
|
|
//This is how you use this implementation (a little example) :
|
83 |
|
|
|
84 |
|
|
int main() {
|
85 |
|
|
cout << "This is an illustration of how this thing works :-)" << endl;
|
86 |
|
|
map < pair<float, float>, map<string, float> > xsec = getXsec("/scratch/buchmann/C/scale_xsection_nlo1.0_m0_m12_10_0_1v1.txt_INVALID");
|
87 |
|
|
float tester = GetXSecForPointAndChannel(1920,500,xsec,"sg");
|
88 |
|
|
cout << tester << endl;
|
89 |
|
|
return 0;
|
90 |
|
|
}
|
91 |
|
|
|
92 |
|
|
*/
|