Hall-D Software  alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DumpCDCOffsets.C
Go to the documentation of this file.
1 // Script to get current values of the offsets from the alignment root file, and shift them according to the MILLEPEDE result.
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 DumpCDCOffsets(TString rootFile = "hd_root.root"){
12 
13  TFile *file = TFile::Open(rootFile);
14  TProfile *hCDCConstants;
15  file->GetObject("AlignmentConstants/CDCAlignmentConstants",hCDCConstants);
16 
17  // Global CDC offsets
18  ofstream outFile;
19  outFile.open("cdc_global.txt");
20  for (unsigned int i = 1; i<=6; i++){
21  int histIndex = i;
22  outFile << hCDCConstants->GetBinContent(histIndex) << " " ;
23  }
24  outFile.close();
25 
26  // Wire alignment
27  outFile.open("cdc_wire_alignment.txt");
28  for (unsigned int i = 1001; i<=15088; i++){
29  int histIndex = i;
30  outFile << hCDCConstants->GetBinContent(histIndex) << " " ;
31  if (i%4 == 0) outFile << endl;
32  }
33  outFile.close();
34 
35  // t0 alignment
36  outFile.open("cdc_t0_alignment.txt");
37  for (unsigned int i = 16001; i<=19522; i++){
38  int histIndex = i;
39  outFile << hCDCConstants->GetBinContent(histIndex) << endl;
40  }
41  outFile.close();
42 
43 }
TFile * outFile
Definition: FitGains.C:15
void DumpCDCOffsets(TString rootFile="hd_root.root")