3 gROOT->SetStyle(
"Plain");
4 gStyle->SetOptStat(00000);
6 const unsigned int barScin = 176;
7 const unsigned int endScin = 96;
8 const unsigned int barEnd = 2;
10 const unsigned int crateNum = 2;
11 const unsigned int crate[crateNum] = { 64, 65 };
12 const unsigned int boardNum = 14;
13 unsigned int board[boardNum];
14 for(
unsigned int i=0; i<boardNum; i++ ) {
17 const unsigned int channelNum = 16;
18 const unsigned int paramNum = 8;
19 double param[crateNum][boardNum][channelNum][paramNum];
21 unsigned int ifee[crateNum][boardNum][channelNum];
22 unsigned int icrate[crateNum][boardNum][channelNum];
23 unsigned int iboard[crateNum][boardNum][channelNum];
24 unsigned int ichannel[crateNum][boardNum][channelNum];
25 ifstream inData[crateNum][boardNum];
26 char inFile[crateNum][boardNum][1000];
31 ofstream outData1, outData2, outData3;
32 char outFile1[800], outFile2[800], outFile3[800];
33 sprintf( outFile1,
"ElecBarEast%s", kind );
34 sprintf( outFile2,
"ElecBarWest%s", kind );
35 sprintf( outFile3,
"ElecEndcap%s", kind );
38 for(
unsigned int i=0; i<crateNum; i++ ) {
39 for(
unsigned int j=0; j<boardNum; j++ ) {
41 sprintf( inFile[i][j],
"/ihepbatch/besd09/sunss/Electronics/09summer/Data/Crate%i/Board%i/Crate%i-Board%i%s", crate[i], board[j], crate[i], board[j],kind );
42 cout << inFile[i][j] << endl;
43 inData[i][j].open( inFile[i][j] );
44 for(
unsigned int k=0; k<channelNum; k++ ) {
45 inData[i][j] >> ifee[i][j][k] >> icrate[i][j][k] >> iboard[i][j][k] >> ichannel[i][j][k];
46 for(
unsigned int l=0; l<paramNum; l++ ) {
47 inData[i][j] >> param[i][j][k][l];
54 int be[crateNum][boardNum][channelNum];
55 int counter[crateNum][boardNum][channelNum];
56 int end[crateNum][boardNum][channelNum];
57 for(
unsigned int i=0; i<crateNum; i++ ) {
58 for(
unsigned int j=0; j<boardNum; j++ ) {
59 for(
unsigned int k=0; k<channelNum; k++ ) {
68 if( k<channelNum/2 ) {
69 counter[i][j][k] = k+channelNum;
72 counter[i][j][k] = k-channelNum/2+48;
76 counter[i][j][k] = k+channelNum/2+48;
81 counter[i][j][k] = k+channelNum+channelNum/2;
84 if( k<channelNum/2 ) {
85 counter[i][j][k] = k+channelNum*2+channelNum/2;
88 counter[i][j][k] = k+channelNum+48;
92 counter[i][j][k] = k+channelNum*2+48;
106 counter[i][j][k] = (j-3)*channelNum/4+k/4;
109 counter[i][j][k] = (j-3)*channelNum/4+k/4+88;
114 counter[i][j][k] = (boardNum-3+j-3)*channelNum/4+k/4;
117 counter[i][j][k] = (boardNum-3+j-3)*channelNum/4+k/4+88;
126 for(
unsigned int i=0; i<crateNum; i++ ) {
127 for(
unsigned int j=0; j<boardNum; j++ ) {
128 for(
unsigned int k=0; k<channelNum; k++ ) {
129 if( be[i][j][k] == 0 ) {
130 counter[i][j][k] = counter[i][j][k] - 12;
131 if( counter[i][j][k]<0 || ( counter[i][j][k]>=36 && counter[i][j][k]<48 ) ) {
132 counter[i][j][k] = counter[i][j][k] + 48;
136 counter[i][j][k] = counter[i][j][k] - 11;
137 if( counter[i][j][k]<0 || ( counter[i][j][k]>=77 && counter[i][j][k]<88 ) ) {
138 counter[i][j][k] = counter[i][j][k] + 88;
147 for(
unsigned int i=0; i<crateNum; i++ ) {
148 for(
unsigned int j=0; j<boardNum; j++ ) {
149 for(
unsigned int k=0; k<channelNum; k++ ) {
151 icrate[i][j][k] = 64;
154 icrate[i][j][k] = 65;
156 iboard[i][j][k] = j+1;
157 ichannel[i][j][k] = k+1;
162 unsigned int Fee[barScin][barEnd], ecFee[endScin];
163 unsigned int Crate[barScin][barEnd], ecCrate[endScin];
164 unsigned int Board[barScin][barEnd], ecBoard[endScin];
165 unsigned int Channel[barScin][barEnd], ecChannel[endScin];
166 double pbeast[barScin][paramNum], pbwest[barScin][paramNum];
167 double pendcap[endScin][paramNum],;
168 for(
unsigned int i=0; i<crateNum; i++ ) {
169 for(
unsigned int j=0; j<boardNum; j++ ) {
170 for(
unsigned int k=0; k<channelNum; k++ ) {
171 if( be[i][j][k]==1 ) {
172 if( end[i][j][k]==0 ) {
173 Fee[counter[i][j][k]][0] = ifee[i][j][k];
174 Crate[counter[i][j][k]][0] = icrate[i][j][k];
175 Board[counter[i][j][k]][0] = iboard[i][j][k];
176 Channel[counter[i][j][k]][0] = ichannel[i][j][k];
177 for(
unsigned int l=0; l<paramNum; l++ ) {
178 pbeast[counter[i][j][k]][l] = param[i][j][k][l];
182 Fee[counter[i][j][k]][1] = ifee[i][j][k];
183 Crate[counter[i][j][k]][1] = icrate[i][j][k];
184 Board[counter[i][j][k]][1] = iboard[i][j][k];
185 Channel[counter[i][j][k]][1] = ichannel[i][j][k];
186 for(
unsigned int l=0; l<paramNum; l++ ) {
187 pbwest[counter[i][j][k]][l] = param[i][j][k][l];
192 ecFee[counter[i][j][k]] = ifee[i][j][k];
193 ecCrate[counter[i][j][k]] = icrate[i][j][k];
194 ecBoard[counter[i][j][k]] = iboard[i][j][k];
195 ecChannel[counter[i][j][k]] = ichannel[i][j][k];
196 for(
unsigned int l=0; l<paramNum; l++ ) {
197 pendcap[counter[i][j][k]][l] = param[i][j][k][l];
204 double bRatio[2][barScin], eRatio[endScin];
205 ifstream inRatio1, inRatio2, inRatio3;
206 inRatio1.open(
"BEastRatio.txt" );
207 inRatio2.open(
"BWestRatio.txt" );
208 for(
unsigned int i=0; i<barScin; i++ ) {
209 inRatio1 >> bRatio[0][i];
210 inRatio2 >> bRatio[1][i];
214 inRatio3.open(
"EndRatio.txt" );
215 for(
unsigned int i=0; i<endScin; i++ ) {
216 inRatio3 >> eRatio[i];
220 outData1.open( outFile1 );
221 outData2.open( outFile2 );
222 for(
unsigned int i=0; i<barScin; i++ ) {
223 if( paramNum == 8 ) {
224 outData1 << Fee[i][0] <<
" " << Crate[i][0] <<
" " << Board[i][0] <<
" " << Channel[i][0] <<
" ";
225 outData2 << Fee[i][1] <<
" " << Crate[i][1] <<
" " << Board[i][1] <<
" " << Channel[i][1] <<
" ";
227 outData1 << bRatio[0][i];
228 outData2 << bRatio[1][i];
229 for(
unsigned int l=0; l<paramNum; l++ ) {
230 outData1 <<
" " << pbeast[i][l];
231 outData2 <<
" " << pbwest[i][l];
239 outData3.open( outFile3 );
240 for(
unsigned int i=0; i<endScin; i++ ) {
241 if( paramNum == 8 ) {
242 outData3 << ecFee[i] <<
" " << ecCrate[i] <<
" " << ecBoard[i] <<
" " << ecChannel[i] <<
" ";
244 outData3 << eRatio[i];
245 for(
unsigned int l=0; l<paramNum; l++ ) {
246 outData3 <<
" " << pendcap[i][l];