2 TString path=
"/star/institutions/iucf/balewski/2008-L2-tmp/day333/";
4 int runL[]={113,115,116,117,118,120,121,122,123,124,125};
5 TString jay[]={
"01",
"02",
"03",
"04",
"05",
"06",
"07",
"08",
"09",
"10",
"11",
"12"};
6 TString kay[]={
"a",
"b",
"c",
"d",
"e",
"f",
"g",
"h",
"i",
"j"};
7 TString ell[]={
"01",
"02",
"03",
"04",
"05",
"06",
"07",
"08",
"09",
"10",
"11",
"12",
"13",
"14",
"15",
"16",
"17",
"18",
"19",
"20",
"21",
"22",
"23",
"24",
"25",
"26",
"27",
"28",
"29",
"30",
"31",
"32",
"33",
"34",
"35",
"36",
"37",
"38",
"39",
"40"};
8 TString craten[]={
"01",
"02",
"03",
"04",
"05",
"06",
"07",
"08",
"09",
"10",
"11",
"12",
"13",
"14",
"15",
"a",
"b",
"c",
"d",
"e",
"10",
"11",
"12",
"13",
"14",
"15",
"16",
"17",
"18",
"19",
"1a",
"1b",
"1c",
"1d",
"1e"};
9 TString crate1[]={
"0",
"0",
"0",
"0",
"0",
"0",
"0",
"0",
"0",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"3"};
10 TString crate2[]={
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
"0",
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
"0",
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
"0"};
18 Float_t es[11],ese[11];
19 Float_t ws[11],wse[11];
27 e1=
new TF1(
"e1",
"expo",60,200);
28 w1=
new TF1(
"w1",
"expo",60,200);
30 TString htitle,title,crate,icrate;
31 int i,j,k,l,ic,icc,iccc;
33 cout<<
" i = "<<i<<endl;
34 TString fname=path+
"run8333";
36 fname+=
".l2ped.hist.root";
37 fd1=
new TFile(fname); assert(fd1->IsOpen());
39 if(i==0) east0 =
new TH1D(
"east0",
"east0",500,0,500);
40 if(i==1) east1 =
new TH1D(
"east1",
"east1",500,0,500);
41 if(i==2) east2 =
new TH1D(
"east2",
"east2",500,0,500);
42 if(i==3) east3 =
new TH1D(
"east3",
"east3",500,0,500);
43 if(i==4) east4 =
new TH1D(
"east4",
"east4",500,0,500);
44 if(i==5) east5 =
new TH1D(
"east5",
"east5",500,0,500);
45 if(i==6) east6 =
new TH1D(
"east6",
"east6",500,0,500);
46 if(i==7) east7 =
new TH1D(
"east7",
"east7",500,0,500);
47 if(i==8) east8 =
new TH1D(
"east8",
"east8",500,0,500);
48 if(i==9) east9 =
new TH1D(
"east9",
"east9",500,0,500);
49 if(i==10) east10 =
new TH1D(
"east10",
"east10",500,0,500);
52 if(i==0) west0 =
new TH1D(
"west0",
"west0",500,0,500);
53 if(i==1) west1 =
new TH1D(
"west1",
"west1",500,0,500);
54 if(i==2) west2 =
new TH1D(
"west2",
"west2",500,0,500);
55 if(i==3) west3 =
new TH1D(
"west3",
"west3",500,0,500);
56 if(i==4) west4 =
new TH1D(
"west4",
"west4",500,0,500);
57 if(i==5) west5 =
new TH1D(
"west5",
"west5",500,0,500);
58 if(i==6) west6 =
new TH1D(
"west6",
"west6",500,0,500);
59 if(i==7) west7 =
new TH1D(
"west7",
"west7",500,0,500);
60 if(i==8) west8 =
new TH1D(
"west8",
"west8",500,0,500);
61 if(i==9) west9 =
new TH1D(
"west9",
"west9",500,0,500);
62 if(i==10) west10 =
new TH1D(
"west10",
"west10",500,0,500);
69 htitle=
"a"+jay[j]+
"t"+kay[k]+ell[l];
70 h1=(TH1F*)fd1->Get(htitle); assert(h1);
71 title= h1->GetTitle();
72 crate =title[19]+title[20];
73 for(icc=0;icc<30;icc++){
75 if(crate1[icc] == title[19] && crate2[icc] == title[20]){
78 h1->SetAxisRange(10.,1000.);
85 if(icc>14&&j==8)
continue;
87 h1->SetAxisRange(mean+50.,mean+100.);
88 sum=2400.*(h1->Integral())/sum;
89 if(sum>1.5)cout<<
"crate = "<<icc<<
"j k l"<<j<<
" "<<k<<
" "<<l<<endl;
92 h1->SetAxisRange(mean+60.,mean+300.);
98 for(jc=0;jc<300;jc++){
99 gg =h1->GetBinContent(mean+jc+1);
100 east0->Fill(20+jc,gg);
104 for(jc=0;jc<300;jc++){
105 gg =h1->GetBinContent(mean+jc+1);
106 east1->Fill(20+jc,gg);
110 for(jc=0;jc<300;jc++){
111 gg =h1->GetBinContent(mean+jc+1);
112 east2->Fill(20+jc,gg);
116 for(jc=0;jc<300;jc++){
117 gg =h1->GetBinContent(mean+jc+1);
118 east3->Fill(20+jc,gg);
122 for(jc=0;jc<300;jc++){
123 gg =h1->GetBinContent(mean+jc+1);
124 east4->Fill(20+jc,gg);
129 for(jc=0;jc<300;jc++){
130 gg =h1->GetBinContent(mean+jc+1);
131 east5->Fill(20+jc,gg);
135 for(jc=0;jc<300;jc++){
136 gg =h1->GetBinContent(mean+jc+1);
137 east6->Fill(20+jc,gg);
141 for(jc=0;jc<300;jc++){
142 gg =h1->GetBinContent(mean+jc+1);
143 east7->Fill(20+jc,gg);
147 for(jc=0;jc<300;jc++){
148 gg =h1->GetBinContent(mean+jc+1);
149 east8->Fill(20+jc,gg);
153 for(jc=0;jc<300;jc++){
154 gg =h1->GetBinContent(mean+jc+1);
155 east9->Fill(20+jc,gg);
159 if(iccc<15 && i==10){
160 for(jc=0;jc<300;jc++){
161 gg =h1->GetBinContent(mean+jc+1);
162 east10->Fill(20+jc,gg);
167 for(jc=0;jc<300;jc++){
168 gg =h1->GetBinContent(mean+jc+1);
169 west0->Fill(20+jc,gg);
173 for(jc=0;jc<300;jc++){
174 gg =h1->GetBinContent(mean+jc+1);
175 west1->Fill(20+jc,gg);
179 for(jc=0;jc<300;jc++){
180 gg =h1->GetBinContent(mean+jc+1);
181 west2->Fill(20+jc,gg);
185 for(jc=0;jc<300;jc++){
186 gg =h1->GetBinContent(mean+jc+1);
187 west3->Fill(20+jc,gg);
191 for(jc=0;jc<300;jc++){
192 gg =h1->GetBinContent(mean+jc+1);
193 west4->Fill(20+jc,gg);
197 for(jc=0;jc<300;jc++){
198 gg =h1->GetBinContent(mean+jc+1);
199 west5->Fill(20+jc,gg);
204 for(jc=0;jc<300;jc++){
205 gg =h1->GetBinContent(mean+jc+1);
206 west6->Fill(20+jc,gg);
210 for(jc=0;jc<300;jc++){
211 gg =h1->GetBinContent(mean+jc+1);
212 west7->Fill(20+jc,gg);
216 for(jc=0;jc<300;jc++){
217 gg =h1->GetBinContent(mean+jc+1);
218 west8->Fill(20+jc,gg);
222 for(jc=0;jc<300;jc++){
223 gg =h1->GetBinContent(mean+jc+1);
224 west9->Fill(20+jc,gg);
228 if(iccc>14 && i==10){
229 for(jc=0;jc<300;jc++){
230 gg =h1->GetBinContent(mean+jc+1);
231 west10->Fill(20+jc,gg);
245 if(i==0)east0->Fit(
"e1",
"RO");
246 if(i==1)east1->Fit(
"e1",
"RO");
247 if(i==2)east2->Fit(
"e1",
"RO");
248 if(i==3)east3->Fit(
"e1",
"RO");
249 if(i==4)east4->Fit(
"e1",
"RO");
250 if(i==5)east5->Fit(
"e1",
"RO");
251 if(i==6)east6->Fit(
"e1",
"RO");
252 if(i==7)east7->Fit(
"e1",
"RO");
253 if(i==8)east8->Fit(
"e1",
"RO");
254 if(i==9)east9->Fit(
"e1",
"RO");
255 if(i==10)east10->Fit(
"e1",
"RO");
257 if(i==0)west0->Fit(
"w1",
"RO");
258 if(i==1)west1->Fit(
"w1",
"RO");
259 if(i==2)west2->Fit(
"w1",
"RO");
260 if(i==3)west3->Fit(
"w1",
"RO");
261 if(i==4)west4->Fit(
"w1",
"RO");
262 if(i==5)west5->Fit(
"w1",
"RO");
263 if(i==6)west6->Fit(
"w1",
"RO");
264 if(i==7)west7->Fit(
"w1",
"RO");
265 if(i==8)west8->Fit(
"w1",
"RO");
266 if(i==9)west9->Fit(
"w1",
"RO");
267 if(i==10)west10->Fit(
"w1",
"RO");
274 es[i]=e1->GetParameter(1);
277 ese[i]=es[i]**2*(e1->GetParError(1));
281 ws[i]=w1->GetParameter(1);
284 wse[i]=ws[i]**2*(w1->GetParError(1));
287 cout<<es[i]<<
" "<<ws[i]<<endl;
294 Float_t wp[7],ep[7],xp[7];
296 gStyle->SetOptStat(0);
298 c2 =
new TCanvas(
"c2",
"Gain vs Delay", 200, 10, 700, 500);
304 graph1 =
new TGraphErrors(11,td,es,0,ese);
306 graph1->SetTitle(
"East Crates: Gain vs TCD Phase");
307 graph1->GetXaxis()->SetTitle(
"TCD Phase (ns)");
308 graph1->GetYaxis()->SetTitle(
"Average Gain");
310 graph1->SetMarkerStyle(21);
311 graph1->SetMarkerSize(1.0);
312 graph1->SetMarkerColor(1);
321 graph1a =
new TGraphErrors(6,xp,wp,0,ep);
322 graph1a->SetMarkerStyle(21);
323 graph1a->SetMarkerSize(1.0);
324 graph1a->SetMarkerColor(2);
327 graph1a->Fit(
"gaus");
329 gStyle->SetOptStat(0);
332 c3 =
new TCanvas(
"c3",
"Gain vs Delay", 200, 10, 700, 500);
335 graph2 =
new TGraphErrors(11,td,ws,0,wse);
337 graph2->SetTitle(
"West Crates: Gain vs TCD Phase");
338 graph2->GetXaxis()->SetTitle(
"TCD Phase (ns)");
339 graph2->GetYaxis()->SetTitle(
"Average Gain");
341 graph2->SetMarkerStyle(21);
342 graph2->SetMarkerSize(1.0);
343 graph2->SetMarkerColor(1);
352 graph2a =
new TGraphErrors(6,xp,wp,0,ep);
353 graph2a->SetMarkerStyle(21);
354 graph2a->SetMarkerSize(1.0);
355 graph2a->SetMarkerColor(2);
358 graph2a->Fit(
"gaus");
361 out.open(
"timing.tex");
364 for(is=0;is<11;is++){
365 for(icc=0;icc<30;icc++){
367 out<<is<<
" "<<iz<<
" "<<csum[icc][is]<<endl;
372 out1.open(
"timing0.tex");
376 out1<<i<<
" "<<es[i]<<
" "<<ese[i]<<
" "<<ws[i]<<
" "<<wse[i]<<endl;
379 cout<<
"finished writing output"<<endl;