data analysis scripts
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

78 lines
1.6 KiB

  1. #include "hitutils.h"
  2. #include <string>
  3. #include <stdio.h>
  4. #include <iostream>
  5. #include <vector>
  6. #include <utility>
  7. #include <TH2.h>
  8. #include <TF1.h>
  9. #include <TStyle.h>
  10. #include <TCanvas.h>
  11. #include <TFile.h>
  12. #include <TTree.h>
  13. #include <TSystemDirectory.h>
  14. #include <gsl/gsl_statistics.h>
  15. #include <math.h>
  16. #include <gsl/gsl_errno.h>
  17. #include <gsl/gsl_fft_complex.h>
  18. #include <TF1.h>
  19. #include <TGraphErrors.h>
  20. #include <gsl/gsl_sort.h>
  21. #include <TVector.h>
  22. #include "TStopwatch.h"
  23. #include "Math/MinimizerOptions.h"
  24. #include "TVirtualFitter.h"
  25. #include "TMatrixD.h"
  26. //function declarations
  27. int analyse(int argc, char **argv);
  28. int opendatafiles(int argc, char ** argv);
  29. void histograms(int argc, char ** argv);
  30. void set_background_v1(int frames);
  31. int closedatafiles();
  32. //////global variables
  33. //opendatafiles
  34. long int fileframesize;
  35. BufferData* dataptr;
  36. char * filename;
  37. ifstream file;
  38. TFile *rootFile; //output root file
  39. TTree *rootTree;
  40. char * rootfilename;
  41. char * ethercatfile;
  42. TTree *tree2; //ethercat root tree
  43. char * timestampfilename;
  44. ifstream timestampfile;
  45. char * offsetfilename;
  46. ifstream offsetfile;
  47. bool ethercat;
  48. struct bpm_frame_v1 {
  49. double channel_amp[128];
  50. double avg_position;
  51. double avg_width;
  52. double integratedsignalamp;
  53. int maxchannel;
  54. double maxchannel_amp;
  55. };
  56. bpm_frame_v1 board_b[4];
  57. bpm_frame_v1 board_b_bkg[4];
  58. bpm_frame_v1 readboard(int frame, int boardnumber);
  59. int framestart = 0;
  60. struct beamRecon {
  61. double Position;
  62. double Focus;
  63. double Peak;
  64. double Rsqr;
  65. double Skew;
  66. double Kurtosis;
  67. };
  68. beamRecon beamreconstruction(bpm_frame_v1 frametoanalyse, double threshold);
  69. beamRecon BPMbeamrecon[4];