11 double xraycount(
int runlow,
int runhigh,
bool draw =
false) {
16 double tVals[] = { -500., 500. };
17 double aVals[] = { 2820., 2860. };
22 for (
int r = runlow; r <= runhigh; ++r) {
23 sprintf(fname,
"/net/abner/data/RunPSI2013/hist/his%05d.root", r);
24 TFile fGe(fname,
"READ");
25 TH2F* hGeTDiffAmp = (TH2F*)fGe.Get(
"hMuSC_Ge-S_AmplitudeVsTdiff_PP");
26 TH1D* hMuSCCount = (TH1D*)fGe.Get(
"muSC_count_raw");
27 nMuons += hMuSCCount->GetBinContent(2);
28 static int tBinLow = hGeTDiffAmp->GetXaxis()->FindBin(tVals[0]);
29 static int tBinHigh = hGeTDiffAmp->GetXaxis()->FindBin(tVals[1]);
30 if (pyGeAmp == NULL) {
31 pyGeAmp = (TH1D*)hGeTDiffAmp->ProjectionY(
"_py",tBinLow,tBinHigh)->Clone(
"hGeHeights");
32 pyGeAmp->SetDirectory(0);
34 TH1D* tmp = hGeTDiffAmp->ProjectionY(
"_py",tBinLow,tBinHigh);
41 TH1* bgGe = s.Background(pyGeAmp);
43 int aBinLow = pyGeAmp->GetXaxis()->FindBin(aVals[0]);
44 int aBinHigh = pyGeAmp->GetXaxis()->FindBin(aVals[1]);
45 double nStops = pyGeAmp->Integral(aBinLow, aBinHigh);
46 double rate = nStops/(double)nMuons;
47 double bg = bgGe->Integral(aBinLow, aBinHigh);
48 double bgsrate = (nStops - bg)/(
double)nMuons;
49 printf(
"Saw %d stops seen in Ge (with %d background) and %d muons in muSc\n", (
int)nStops, (
int)bg, nMuons);
50 printf(
"Rate: %g xrays/muons (%g background subtracted)\n", rate, bgsrate);
53 double geMax = pyGeAmp->GetMaximum();
54 TLine l1(aVals[0], 0., aVals[0], geMax);
55 TLine l2(aVals[1], 0., aVals[1], geMax);
56 TBox b(aVals[0], 0., aVals[1], geMax);
58 pyGeAmp->GetYaxis()->SetRangeUser(0.,geMax);
62 b.SetFillColor(kBlue);
65 bgGe->DrawClone(
"SAME");