Hall-D Software  alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DumpFDCOffsets.C
Go to the documentation of this file.
1 // Script to get current values of the offsets from the alignment root file and dump them to text files
2 #include <map>
3 #include <fstream>
4 #include <iostream>
5 #include <string>
6 #include "TProfile.h"
7 #include "TFile.h"
8 
9 using namespace std;
10 
11 void DumpFDCOffsets(TString rootFile = "hd_root.root"){
12 
13  TFile *file = TFile::Open(rootFile);
14  TProfile *hFDCConstants;
15  file->GetObject("AlignmentConstants/FDCAlignmentConstants",hFDCConstants);
16 
17  // Cell offsets
18  // Indices are 101001, 101100 etc...
19  ofstream outFile;
20  outFile.open("cell_offsets.txt");
21  for (unsigned int i = 1; i<=24; i++){
22  int histIndex = i*1000;
23  outFile << hFDCConstants->GetBinContent(histIndex+1) << " " ;
24  outFile << hFDCConstants->GetBinContent(histIndex+100) << endl ;
25  }
26  outFile.close();
27 
28  // Cathode Offsets
29  // Indices are 101, 102, 103, 104
30  outFile.open("cathode_alignment.txt");
31  for (unsigned int i = 1; i<=24; i++){
32  int histIndex = i*1000;
33  outFile << hFDCConstants->GetBinContent(histIndex+103) << " " ;//dPhiU
34  outFile << hFDCConstants->GetBinContent(histIndex+101) << " " ;//dU
35  outFile << hFDCConstants->GetBinContent(histIndex+104) << " " ;//dPhiV
36  outFile << hFDCConstants->GetBinContent(histIndex+102) << endl ;//dV
37  }
38  outFile.close();
39 
40  // Strip Pitches
41  // Indices are 200...209
42  outFile.open("strip_pitches.txt");
43  for (unsigned int i = 1; i<=24; i++){
44  int histIndex = i*1000;
45  outFile << hFDCConstants->GetBinContent(histIndex+200) << " " ;
46  outFile << hFDCConstants->GetBinContent(histIndex+201) << " " ;
47  outFile << hFDCConstants->GetBinContent(histIndex+202) << " " ;
48  outFile << hFDCConstants->GetBinContent(histIndex+203) << " " ;
49  outFile << hFDCConstants->GetBinContent(histIndex+204) << " " ;
50  outFile << hFDCConstants->GetBinContent(histIndex+205) << " " ;
51  outFile << hFDCConstants->GetBinContent(histIndex+206) << " " ;
52  outFile << hFDCConstants->GetBinContent(histIndex+207) << " " ;
53  outFile << hFDCConstants->GetBinContent(histIndex+208) << " " ;
54  outFile << hFDCConstants->GetBinContent(histIndex+209) << endl;
55  }
56  outFile.close();
57 
58  // Wire Alignment
59  // Indices are 2
60  outFile.open("wire_alignment.txt");
61  for (unsigned int i = 1; i<=24; i++){
62  int histIndex = i*1000;
63  outFile << hFDCConstants->GetBinContent(histIndex+2) << " 0.0 0.0" << endl;
64  }
65  outFile.close();
66 
67  for (unsigned int i = 1; i<=4; i++){
68  outFile.open(Form("t0_package%i.txt",i));
69  for (unsigned int j=1; j<=6;j++){
70  for (unsigned int k = 1; k<= 96; k++){
71  int histIndex = ((i-1)*4+j)*1000 + 900;
72  outFile << hFDCConstants->GetBinContent(histIndex+k)<< " " ;
73  }
74  outFile << endl;
75  }
76  outFile.close();
77  }
78  //gains
79  for (unsigned int i = 1; i<=4; i++){
80  outFile.open(Form("gains_package%i.txt",i));
81  for (unsigned int j=1; j<=6;j++){
82  for (unsigned int k = 1; k<= 216; k++){
83  int histIndex = ((i-1)*4+j)*1000 + 300;
84  outFile << hFDCConstants->GetBinContent(histIndex+k) << " " ;
85  }
86  outFile << endl;
87  for (unsigned int k = 1; k<= 216; k++){
88  int histIndex = ((i-1)*4+j)*1000 + 600;
89  outFile << hFDCConstants->GetBinContent(histIndex+k) << " " ;
90  }
91  outFile << endl;
92  }
93  outFile.close();
94  }
95 }
TFile * outFile
Definition: FitGains.C:15
void DumpFDCOffsets(TString rootFile="hd_root.root")