4 bool constrainPackageZ =
false;
5 bool constrainPackageZTogether =
false;
6 bool constrainWireCathodeAlignment =
false;
7 bool constraint0 =
false;
10 outfile.open(
"FDCConstraints.txt");
12 if(constrainPackageZ){
13 for (
unsigned int i=1; i<=4; i++){
14 outfile <<
"Constraint 0.0" << endl;
15 for (
unsigned int j=1;j<=6;j++){
16 int indexOffset = 100000 + ((i-1)*6+j)*1000;
17 outfile << indexOffset+5 <<
" 1.0" << endl;
22 if(constrainPackageZTogether){
23 for (
unsigned int i=1; i<=4; i++){
24 for (
unsigned int j=2;j<=6;j++){
25 outfile <<
"Constraint 0.0" << endl;
26 int indexOffset = 100000 + ((i-1)*6+j)*1000;
27 outfile << 100000 + ((i-1)*6+1)*1000 + 5<<
" 1.0 " << endl;
28 outfile << indexOffset+5 <<
" -1.0" << endl;
35 outfile <<
"Constraint 0.0" << endl;
36 for (
unsigned int i=1; i<=24; i++){
37 int indexOffset = 100000 + i*1000;
38 for(
unsigned int j=901; j<=996;j++){
39 outfile << indexOffset + j <<
" 1.0 " << endl;
44 for (
unsigned int i=1; i<=24; i++){
45 int indexOffset = 100000 + i*1000;
46 int histIndex = i*1000;
48 double angleOffset = ((i-1)%6)*TMath::Pi()/3.;
49 outfile <<
"Measurement 0.0 0.02" << endl;
50 outfile << indexOffset+1 <<
" " <<
sin(angleOffset) << endl;
51 outfile << indexOffset+100 <<
" " <<
sin(angleOffset+TMath::Pi()/2.) << endl;
52 outfile <<
"Measurement 0.0 0.02" << endl;
53 outfile << indexOffset+1 <<
" " << cos(angleOffset) << endl;
54 outfile << indexOffset+100 <<
" " << cos(angleOffset+TMath::Pi()/2.) << endl;
57 if(constrainWireCathodeAlignment){
59 TFile *file = TFile::Open(rootFile);
60 TProfile *hFDCConstants;
61 file->GetObject(
"AlignmentConstants/FDCAlignmentConstants",hFDCConstants);
63 for (
unsigned int i=1; i<=24; i++){
67 bool averagePitch =
true;
69 int indexOffset = 100000 + i*1000;
70 int histIndex = i*1000;
71 double phiu = TMath::DegToRad()*75.0;
72 double phiv = TMath::Pi()-phiu;
74 phiu+=hFDCConstants->GetBinContent(histIndex+103);
75 phiv+=hFDCConstants->GetBinContent(histIndex+104);
77 double pu1 = hFDCConstants->GetBinContent(histIndex+200);
78 double pu2 = hFDCConstants->GetBinContent(histIndex+202);
79 double pu3 = hFDCConstants->GetBinContent(histIndex+204);
81 double pv1 = hFDCConstants->GetBinContent(histIndex+205);
82 double pv2 = hFDCConstants->GetBinContent(histIndex+207);
83 double pv3 = hFDCConstants->GetBinContent(histIndex+209);
85 double pu = (48.*(pu1+pu3)+96.*pu2)/192.;
86 double pv = (48.*(pv1+pv3)+96.*pv2)/192.;
88 double sinphiu =
sin(phiu);
89 double sinphiv =
sin(phiv);
90 double sinphiumphiv =
sin(phiu-phiv);
91 double cosphiumphiv = cos(phiu-phiv);
95 outfile <<
"Constraint 0.0" << endl;
96 outfile << indexOffset + 200 <<
" 48.0 " << endl;
97 outfile << indexOffset + 202 <<
" 96.0 " << endl;
98 outfile << indexOffset + 204 <<
" 48.0 " << endl;
99 outfile <<
"Constraint 0.0" << endl;
100 outfile << indexOffset + 205 <<
" 48.0 " << endl;
101 outfile << indexOffset + 207 <<
" 96.0 " << endl;
102 outfile << indexOffset + 209 <<
" 48.0 " << endl;
106 outfile <<
"Constraint 0.0" << endl;
107 outfile << indexOffset + 200 <<
" 1.0 " << endl;
108 outfile << indexOffset + 202 <<
" -1.0 " << endl;
109 outfile <<
"Constraint 0.0" << endl;
110 outfile << indexOffset + 200 <<
" 1.0 " << endl;
111 outfile << indexOffset + 204 <<
" -1.0 " << endl;
112 outfile <<
"Constraint 0.0" << endl;
113 outfile << indexOffset + 205 <<
" 1.0 " << endl;
114 outfile << indexOffset + 207 <<
" -1.0 " << endl;
115 outfile <<
"Constraint 0.0" << endl;
116 outfile << indexOffset + 205 <<
" 1.0 " << endl;
117 outfile << indexOffset + 209 <<
" -1.0 " << endl;
120 outfile <<
"Constraint 0.0" << endl;
122 outfile << indexOffset + 200 <<
" " << sinphiv << endl;
123 outfile << indexOffset + 205 <<
" " << sinphiu <<endl;
124 outfile << indexOffset + 103 <<
" " << -1*(pv+pu*cosphiumphiv)*sinphiv/sinphiumphiv << endl;
125 outfile << indexOffset + 104 <<
" " << (pu+pv*cosphiumphiv)*sinphiu/sinphiumphiv << endl;
126 outfile <<
"Constraint 0.0" << endl;
128 outfile << indexOffset + 200 <<
" " << sinphiv << endl;
129 outfile << indexOffset + 205 <<
" " << -sinphiu <<endl;
130 outfile << indexOffset + 103 <<
" " << (pv-pu*cosphiumphiv)*sinphiv/sinphiumphiv << endl;
131 outfile << indexOffset + 104 <<
" " << (pu-pv*cosphiumphiv)*sinphiu/sinphiumphiv << endl;
void MakeFDCConstraintsFile(TString rootFile="hd_root.root")