11 void ApplyFDCOffsets(TString rootFile =
"hd_root.root", TString pedeOutFile =
"millepede.res"){
13 TFile *file = TFile::Open(rootFile);
14 TProfile *hFDCConstants;
15 file->GetObject(
"AlignmentConstants/FDCAlignmentConstants",hFDCConstants);
18 pedeResult.open(pedeOutFile.Data());
20 map < int, double> resultMap;
22 bool firstLine =
true;
24 while (getline(pedeResult,line)){
29 int index;
double value;
30 istringstream iss(line);
31 iss >> index >> value;
33 resultMap[
index]=value;
39 outFile.open(
"cell_offsets.txt");
40 for (
unsigned int i = 1; i<=24; i++){
41 int histIndex = i*1000;
42 int pedeIndex = 100000 + i*1000;
43 outFile << resultMap[pedeIndex + 1] + hFDCConstants->GetBinContent(histIndex+1) <<
" " ;
44 outFile << resultMap[pedeIndex + 100] + hFDCConstants->GetBinContent(histIndex+100) << endl ;
50 outFile.open(
"cathode_alignment.txt");
51 for (
unsigned int i = 1; i<=24; i++){
52 int histIndex = i*1000;
53 int pedeIndex = 100000 + i*1000;
54 outFile << resultMap[pedeIndex + 103] + hFDCConstants->GetBinContent(histIndex+103) <<
" " ;
55 outFile << resultMap[pedeIndex + 101] + hFDCConstants->GetBinContent(histIndex+101) <<
" " ;
56 outFile << resultMap[pedeIndex + 104] + hFDCConstants->GetBinContent(histIndex+104) <<
" " ;
57 outFile << resultMap[pedeIndex + 102] + hFDCConstants->GetBinContent(histIndex+102) << endl ;
63 outFile.open(
"strip_pitches.txt");
64 for (
unsigned int i = 1; i<=24; i++){
65 int histIndex = i*1000;
66 int pedeIndex = 100000 + i*1000;
67 outFile << resultMap[pedeIndex + 200] + hFDCConstants->GetBinContent(histIndex+200) <<
" " ;
68 outFile << resultMap[pedeIndex + 201] + hFDCConstants->GetBinContent(histIndex+201) <<
" " ;
69 outFile << resultMap[pedeIndex + 202] + hFDCConstants->GetBinContent(histIndex+202) <<
" " ;
70 outFile << resultMap[pedeIndex + 203] + hFDCConstants->GetBinContent(histIndex+203) <<
" " ;
71 outFile << resultMap[pedeIndex + 204] + hFDCConstants->GetBinContent(histIndex+204) <<
" " ;
72 outFile << resultMap[pedeIndex + 205] + hFDCConstants->GetBinContent(histIndex+205) <<
" " ;
73 outFile << resultMap[pedeIndex + 206] + hFDCConstants->GetBinContent(histIndex+206) <<
" " ;
74 outFile << resultMap[pedeIndex + 207] + hFDCConstants->GetBinContent(histIndex+207) <<
" " ;
75 outFile << resultMap[pedeIndex + 208] + hFDCConstants->GetBinContent(histIndex+208) <<
" " ;
76 outFile << resultMap[pedeIndex + 209] + hFDCConstants->GetBinContent(histIndex+209) << endl;
82 outFile.open(
"wire_alignment.txt");
83 for (
unsigned int i = 1; i<=24; i++){
84 int histIndex = i*1000;
85 int pedeIndex = 100000 + i*1000;
86 outFile <<
"0.0 0.0 " << resultMap[pedeIndex + 5] + hFDCConstants->GetBinContent(histIndex+5) << endl;
90 outFile.open(
"cell_rotations.txt");
91 for (
unsigned int i = 1; i<=24; i++){
92 int histIndex = i*1000;
93 int pedeIndex = 100000 + i*1000;
94 outFile << resultMap[pedeIndex + 2] + hFDCConstants->GetBinContent(histIndex+2) <<
" " ;
95 outFile << resultMap[pedeIndex + 3] + hFDCConstants->GetBinContent(histIndex+3) <<
" " ;
96 outFile << resultMap[pedeIndex + 4] + hFDCConstants->GetBinContent(histIndex+4) << endl;
100 for (
unsigned int i = 1; i<=4; i++){
101 outFile.open(Form(
"t0_package%i.txt",i));
102 for (
unsigned int j=1; j<=6;j++){
103 for (
unsigned int k = 1; k<= 96; k++){
104 int histIndex = ((i-1)*4+j)*1000 + 900;
105 int pedeIndex = 100000 + histIndex;
106 outFile << hFDCConstants->GetBinContent(histIndex+k) - resultMap[pedeIndex + k]<<
" " ;
113 for (
unsigned int i = 1; i<=4; i++){
114 outFile.open(Form(
"gains_package%i.txt",i));
115 for (
unsigned int j=1; j<=6;j++){
116 for (
unsigned int k = 1; k<= 216; k++){
117 int histIndex = ((i-1)*4+j)*1000 + 300;
118 int pedeIndex = 100000 + histIndex;
119 outFile << resultMap[pedeIndex + k] + hFDCConstants->GetBinContent(histIndex+k) <<
" " ;
122 for (
unsigned int k = 1; k<= 216; k++){
123 int histIndex = ((i-1)*4+j)*1000 + 600;
124 int pedeIndex = 100000 + histIndex;
125 outFile << resultMap[pedeIndex + k] + hFDCConstants->GetBinContent(histIndex+k) <<
" " ;
static char index(char c)
void ApplyFDCOffsets(TString rootFile="hd_root.root", TString pedeOutFile="millepede.res")