Hall-D Software
alpha
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
find_dead_straws.C
Go to the documentation of this file.
1
2
3
void
find_dead_straws
(
void
) {
4
5
// run this on CDC_amp output root file containing histo attn
6
7
// scans 2d histogram of tracked hits from the target attn
8
// identifies straws with very few hits
9
// writes text file straw_eff.txt containing 1 for live straws, 0 for dead straws
10
11
12
TDirectory *fmain = (TDirectory*)gDirectory->FindObjectAny(
"CDC_amp"
);
13
if
(!fmain)
printf
(
"Cannot find directory CDC_amp\n"
);
14
if
(!fmain)
return
;
15
fmain->cd();
16
17
TH2I *anhisto = (TH2I*)fmain->Get(
"attn"
);
18
if
(!anhisto)
printf
(
"Cannot find histo attn\n"
);
19
if
(!anhisto)
return
;
20
21
22
FILE *
outfile
= fopen(
"straw_eff.txt"
,
"w"
);
23
24
25
int
Nstraws[28] = {42, 42, 54, 54, 66, 66, 80, 80, 93, 93, 106, 106, 123, 123, 135, 135, 146, 146, 158, 158, 170, 170, 182, 182, 197, 197, 209, 209};
26
27
// int Ntotal[28] = {42,84,138,192,258,324,404,484,577,670,776,882,1005,1128,1263,1398,1544,1690,1848,2006,2176,2346,2528,2710,2907,3104,3313,3522};
28
29
30
TH1D *ahisto;
31
32
int
Nfirst = 0;
33
34
35
for
(
int
i=0; i<28; i++) {
36
37
ahisto = anhisto->ProjectionY(Form(
"a[%i]"
,i),Nfirst+2,Nfirst+Nstraws[i]+1);
//straw 1 is in bin 2
38
// cout << "ring " << i+1 << " straws " << Nfirst+1 << " to " << Nfirst+Nstraws[i] << endl;
39
40
int
nring = ahisto->GetEntries();
41
42
int
mean_n = (int)(nring/(
float
)Nstraws[i]);
43
44
// cout << "Ring " << i << " total counts " << nring << " mean per straw " << mean_n << endl;
45
46
for
(
int
j=Nfirst; j<Nfirst+Nstraws[i]; j++) {
47
// if (j==Nfirst) cout << "Start with straw " << j+1 << "End with straw " << Nfirst+Nstraws[i] << endl;
48
49
ahisto = anhisto->ProjectionY(Form(
"a[%i]"
,i), j+2, j+2);
//straw 1 is in bin 2
50
51
double
a_n = ahisto->GetEntries();
52
53
int
eff = 1;
54
55
if
(a_n < 0.25 * mean_n) eff = 0;
56
57
if
(!eff)
printf
(
"n=%i counts %.0f mean for ring is %i\n"
,j+1,a_n,mean_n);
58
59
fprintf(outfile,
"%i\n"
,eff);
60
61
}
62
63
Nfirst += Nstraws[i];
64
65
}
66
67
fclose(outfile);
68
69
}
find_dead_straws
void find_dead_straws(void)
Definition:
find_dead_straws.C:3
outfile
TFile * outfile
Definition:
tw_corr.C:46
printf
printf("string=%s", string)
plugins
Calibration
CDC_amp
find_dead_straws.C
Generated on Fri Jul 26 2019 14:01:50 for Hall-D Software by
1.8.5