-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrot_z_alignment.cc
75 lines (58 loc) · 1.52 KB
/
rot_z_alignment.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#include "config.h"
#include "alignment_classes.h"
#include "TFile.h"
#include "TGraph.h"
#include <vector>
#include <string>
using namespace std;
//----------------------------------------------------------------------------------------------------
int main()
{
// load config
if (cfg.LoadFrom("config.py") != 0)
{
printf("ERROR: cannot load config.\n");
return 1;
}
printf("-------------------- config ----------------------\n");
cfg.Print(false);
printf("--------------------------------------------------\n");
// list of RPs and their settings
struct RPData
{
string name;
unsigned int id;
string sectorName;
};
vector<RPData> rpData = {
{ "L_1_F", 3, "sector 45" },
{ "L_1_N", 2, "sector 45" },
{ "R_1_N", 102, "sector 56" },
{ "R_1_F", 103, "sector 56" }
};
// prepare input
TFile *f_in = TFile::Open("../../../../global_alignment/tilt_fit.root");
// prepare results
AlignmentResultsCollection results;
// processing
for (const auto &rpd : rpData)
{
printf("* %s\n", rpd.name.c_str());
TGraph *g_tilt_vs_fill_smooth = (TGraph *) f_in->Get((rpd.name + "/g_tilt_vs_fill_smooth").c_str());
double tilt = 0.;
double tilt_unc = 0.;
if (rpd.id == 2)
{
tilt = g_tilt_vs_fill_smooth->Eval(cfg.fill) + 0.03;
tilt_unc = 0.005;
}
results["rot_z_alignment"][rpd.id] = AlignmentResult(0., 0., 0., 0., tilt, tilt_unc);
}
// write results
FILE *f_results = fopen("rot_z_alignment.out", "w");
results.Write(f_results);
fclose(f_results);
// clean up
delete f_in;
return 0;
}