void fdc_report(const char *fname) { gROOT->Reset(); // Coordinates of center of active area double x_center=56.0; double y_center=51.5; double r_active=48.5; // Get pointers to histos and tree from file TFile *f = new TFile(fname); TH2D *depth_mean = (TH2D*)gROOT->FindObject("depth_mean"); TH2D *depth_rms = (TH2D*)gROOT->FindObject("depth_rms"); TTree *scan = (TTree*)gROOT->FindObject("scan"); // Define variables double mean_min=10000.0, mean_max=0.0, mean_mean=0.0; double rms_min=10000.0, rms_max=0.0, rms_mean=0.0; double rms_min_x, rms_min_y, rms_max_x, rms_max_y; double mean_min_x, mean_min_y, mean_max_x, mean_max_y; int N_inside_active = 0; // Loop over bins in mean and rms histos that are in active area // of cathode and calculate mean, min, and max int i,j; for(i=1; i<=depth_mean->GetNbinsX(); i++){ double x = depth_mean->GetXaxis()->GetBinCenter(i); for(j=1; j<=depth_mean->GetNbinsY(); j++){ double y = depth_mean->GetYaxis()->GetBinCenter(j); double r2 = pow(x-x_center, 2.0) + pow(y-y_center, 2.0); double r = sqrt(r2); if(r < (r_active-2.54/2.0)){ double mean = depth_mean->GetBinContent(i,j); double rms = depth_rms->GetBinContent(i,j); if(mean==0.0)continue; // skip zeros mean_mean += mean; rms_mean += rms; N_inside_active++; if(rmsrms_max){ rms_max = rms; rms_max_x = x; rms_max_y = y; } if(meanmean_max){ mean_max = mean; mean_max_x = x; mean_max_y = y; } } } } mean_mean/=(double)N_inside_active; rms_mean/=(double)N_inside_active; cout<<"======================================================="<