makeTrackTuples.C 4.44 KB
Newer Older
Daniel Hynds's avatar
Daniel Hynds committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
// Global includes
#include <iostream>
#include <string>
#include <signal.h>

// ROOT includes
#include "TROOT.h"
#include "TApplication.h"
//#include "TPad.h"

// Local includes
#include "Parameters.h"
#include "Analysis.h"

// Algorithm list
#include "TestAlgorithm.h"
#include "Timepix3EventLoader.h"
#include "Timepix1EventLoader.h"
#include "Timepix3Clustering.h"
#include "Timepix1Clustering.h"
#include "Timepix3MaskCreator.h"
#include "BasicTracking.h"
#include "SpatialTracking.h"
#include "Alignment.h"
#include "EventDisplay.h"
#include "GUI.h"
#include "DUTAnalysis.h"
#include "FileWriter.h"
#include "FileReader.h"
#include "Timepix1Correlator.h"
#include "ClicpixAnalysis.h"

//-------------------------------------------------------------------------------
// The Steering is effectively the executable. It reads command line
// parameters and initialises all other parameters, then runs each algorithm
// added. Algorithms have 3 steps: initialise, run and finalise.
//-------------------------------------------------------------------------------

// The analysis object to be used
Analysis* analysis;

// Handle user interruption
// This allows you to ^C at any point in a controlled way
void userException(int sig){
  cout<<endl<<"User interrupted"<<endl;
  analysis->finaliseAll();
  exit(1);
}

int main(int argc, char *argv[]) {
 
  // Register escape behaviour
  signal(SIGINT, userException);

  // New parameters object
  Parameters* parameters = new Parameters();
  
  // Global debug flag
  bool debug = false;

  // Algorithm list
  Timepix3EventLoader*	tpix3EventLoader	= new Timepix3EventLoader(debug);
  Timepix1EventLoader*	tpix1EventLoader	= new Timepix1EventLoader(debug);
  Timepix3Clustering*		tpix3Clustering		= new Timepix3Clustering(debug);
  Timepix1Clustering*		tpix1Clustering		= new Timepix1Clustering(debug);
  TestAlgorithm* 				testAlgorithm			= new TestAlgorithm(debug);
  Timepix3MaskCreator*	tpix3MaskCreator	= new Timepix3MaskCreator(debug);
  BasicTracking* 				basicTracking			= new BasicTracking(debug);
  SpatialTracking* 			spatialTracking		= new SpatialTracking(debug);
  Alignment*	 					alignment					= new Alignment(debug);
  EventDisplay*	 				eventDisplay			= new EventDisplay(debug);
  GUI*	 								gui								= new GUI(debug);
  DUTAnalysis*	 				dutAnalysis				= new DUTAnalysis(debug);
  FileWriter*	 					fileWriter				= new FileWriter(debug);
  FileReader*	 					fileReader				= new FileReader(debug);
  Timepix1Correlator*	 	correlator				= new Timepix1Correlator(debug);
  ClicpixAnalysis*	 		clicpixAnalysis		= new ClicpixAnalysis(debug);

  // =========================================================================
  // Steering file begins
  // =========================================================================
  
  // General parameters
  parameters->reference = "Mim-osa02";
  parameters->DUT = "CLi-CPix";
  parameters->detectorToAlign = parameters->DUT;
  parameters->excludedFromTracking[parameters->DUT] = true;
  
  parameters->excludedFromTracking["W0005_E02"] = true;
  parameters->excludedFromTracking["W0005_F01"] = true;
  parameters->excludedFromTracking["W0019_C07"] = true;
  parameters->excludedFromTracking["W0019_G07"] = true;
  parameters->excludedFromTracking["W0019_F07"] = true;
  parameters->excludedFromTracking["W0019_L08"] = true;
  parameters->excludedFromTracking["W0005_H03"] = true;
  
  // =========================================================================
  // Steering file ends
  // =========================================================================
  
  // Overwrite steering file values from command line
  parameters->readCommandLineOptions(argc,argv);

  // Load alignment parameters
  if(!parameters->readConditions()) return 0;
  
  // Initialise the analysis object and add algorithms to run
  analysis = new Analysis(parameters);
//  analysis->add(tpix1EventLoader);
  analysis->add(fileReader);
  analysis->add(tpix1Clustering);
  analysis->add(spatialTracking);
  analysis->add(correlator);
//  analysis->add(tpix3EventLoader);
//  analysis->add(tpix3Clustering);
//  analysis->add(testAlgorithm);
//  analysis->add(basicTracking);
//  analysis->add(dutAnalysis);
  analysis->add(clicpixAnalysis);
  analysis->add(fileWriter);
  
  if(parameters->align) analysis->add(alignment);
  if(parameters->produceMask) analysis->add(tpix3MaskCreator);
  if(parameters->eventDisplay) analysis->add(eventDisplay);
  if(parameters->gui) analysis->add(gui);
  
  // Run the analysis
  analysis->run();

  return 0;

}