79 lines
1.6 KiB
C
79 lines
1.6 KiB
C
|
#include "hitutils.h"
|
||
|
#include <string>
|
||
|
#include <stdio.h>
|
||
|
#include <iostream>
|
||
|
#include <vector>
|
||
|
#include <utility>
|
||
|
#include <TH2.h>
|
||
|
#include <TF1.h>
|
||
|
#include <TStyle.h>
|
||
|
#include <TCanvas.h>
|
||
|
#include <TFile.h>
|
||
|
#include <TTree.h>
|
||
|
#include <TSystemDirectory.h>
|
||
|
#include <gsl/gsl_statistics.h>
|
||
|
#include <math.h>
|
||
|
#include <gsl/gsl_errno.h>
|
||
|
#include <gsl/gsl_fft_complex.h>
|
||
|
#include <TF1.h>
|
||
|
#include <TGraphErrors.h>
|
||
|
#include <gsl/gsl_sort.h>
|
||
|
#include <TVector.h>
|
||
|
#include "TStopwatch.h"
|
||
|
#include "Math/MinimizerOptions.h"
|
||
|
#include "TVirtualFitter.h"
|
||
|
#include "TMatrixD.h"
|
||
|
|
||
|
//function declarations
|
||
|
int analyse(int argc, char **argv);
|
||
|
int opendatafiles(int argc, char ** argv);
|
||
|
void histograms(int argc, char ** argv);
|
||
|
void set_background_v1(int frames);
|
||
|
int closedatafiles();
|
||
|
|
||
|
|
||
|
//////global variables
|
||
|
|
||
|
//opendatafiles
|
||
|
long int fileframesize;
|
||
|
BufferData* dataptr;
|
||
|
char * filename;
|
||
|
ifstream file;
|
||
|
TFile *rootFile; //output root file
|
||
|
TTree *rootTree;
|
||
|
char * rootfilename;
|
||
|
char * ethercatfile;
|
||
|
TTree *tree2; //ethercat root tree
|
||
|
char * timestampfilename;
|
||
|
ifstream timestampfile;
|
||
|
char * offsetfilename;
|
||
|
ifstream offsetfile;
|
||
|
bool ethercat;
|
||
|
|
||
|
struct bpm_frame_v1 {
|
||
|
double channel_amp[128];
|
||
|
double avg_position;
|
||
|
double avg_width;
|
||
|
double integratedsignalamp;
|
||
|
int maxchannel;
|
||
|
double maxchannel_amp;
|
||
|
};
|
||
|
|
||
|
bpm_frame_v1 board_b[4];
|
||
|
bpm_frame_v1 board_b_bkg[4];
|
||
|
|
||
|
bpm_frame_v1 readboard(int frame, int boardnumber);
|
||
|
int framestart = 0;
|
||
|
|
||
|
struct beamRecon {
|
||
|
double Position;
|
||
|
double Focus;
|
||
|
double Peak;
|
||
|
double Rsqr;
|
||
|
double Skew;
|
||
|
double Kurtosis;
|
||
|
};
|
||
|
|
||
|
beamRecon beamreconstruction(bpm_frame_v1 frametoanalyse, double threshold);
|
||
|
beamRecon BPMbeamrecon[4];
|