inputValues getInputValues(TString fileName, double pw, string cutString) { TFile * file = new TFile(fileName, "READ"); TTree * tree = (TTree*)file->Get("Channel_1"); tree->Draw("(-1)*Min>>hist(300, 0, 30)"); TH1D * hist = (TH1D*)gDirectory->Get("hist"); inputValues inVal; inVal.pw = pw; inVal.n = hist->GetEntries(); inVal.v = pow(hist->GetStdDev(), 2); inVal.e = hist->GetMean(); inVal.a = tree->Draw("Min", (TString)cutString); inVal.h = hist; return inVal; }
inputValues getInputValues(TString fileName, double pw, bool cm, string cutString) { TFile * file = new TFile(fileName, "READ"); TTree * tree = (TTree*)file->Get("Channel_8"); tree->Draw("Charge>>hist"); TH1D * hist = (TH1D*)gDirectory->Get("hist"); inputValues inVal; inVal.pw = pw; inVal.cm = cm; inVal.n = hist->GetEntries(); inVal.v = pow(hist->GetStdDev(), 2); inVal.e = -hist->GetMean(); // Flip sign inVal.a = tree->Draw("Charge", (TString)cutString); inVal.h = hist; // Debugging cout << inVal.pw << " " << inVal.e << " " << (float)inVal.a/inVal.n << " " << inVal.cm << endl; return inVal; }