Steering.C 5.04 KB
Newer Older
1
2
3
4
5
6
7
8
// Global includes
#include <iostream>
#include <string>
#include <signal.h>

// ROOT includes
#include "TROOT.h"
#include "TApplication.h"
9
//#include "TPad.h"
10
11
12
13
14
15
16
17
18

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

// Algorithm list
#include "TestAlgorithm.h"
#include "Timepix3EventLoader.h"
#include "Timepix3Clustering.h"
19
#include "Timepix1EventLoader.h"
20
#include "Timepix1Clustering.h"
21
22
#include "Timepix3MaskCreator.h"
#include "BasicTracking.h"
23
#include "SpatialTracking.h"
24
25
#include "Alignment.h"
#include "EventDisplay.h"
26
#include "GUI.h"
27
#include "DUTAnalysis.h"
28
29
30
#include "FileWriter.h"
#include "FileReader.h"
#include "Timepix1Correlator.h"
31
#include "ClicpixAnalysis.h"
32
#include "DataDump.h"
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

//-------------------------------------------------------------------------------
// 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();
  
Daniel Hynds's avatar
Daniel Hynds committed
59
60
61
  // Global debug flag
  bool debug = false;

Daniel Hynds's avatar
Daniel Hynds committed
62
63
64
  // Algorithm list
  Timepix3EventLoader*	tpix3EventLoader	= new Timepix3EventLoader(debug);
  Timepix3Clustering*		tpix3Clustering		= new Timepix3Clustering(debug);
65
  Timepix1EventLoader*	tpix1EventLoader	= new Timepix1EventLoader(debug);
66
  Timepix1Clustering*		tpix1Clustering		= new Timepix1Clustering(debug);
Daniel Hynds's avatar
Daniel Hynds committed
67
68
69
  TestAlgorithm* 				testAlgorithm			= new TestAlgorithm(debug);
  Timepix3MaskCreator*	tpix3MaskCreator	= new Timepix3MaskCreator(debug);
  BasicTracking* 				basicTracking			= new BasicTracking(debug);
70
  SpatialTracking* 			spatialTracking		= new SpatialTracking(debug);
Daniel Hynds's avatar
Daniel Hynds committed
71
72
73
74
  Alignment*	 					alignment					= new Alignment(debug);
  EventDisplay*	 				eventDisplay			= new EventDisplay(debug);
  GUI*	 								gui								= new GUI(debug);
  DUTAnalysis*	 				dutAnalysis				= new DUTAnalysis(debug);
75
76
77
  FileWriter*	 					fileWriter				= new FileWriter(debug);
  FileReader*	 					fileReader				= new FileReader(debug);
  Timepix1Correlator*	 	correlator				= new Timepix1Correlator(debug);
78
  ClicpixAnalysis*	 		clicpixAnalysis		= new ClicpixAnalysis(debug);
79
  DataDump*	 						dataDump					= new DataDump(debug);
Daniel Hynds's avatar
Daniel Hynds committed
80

81
82
83
84
85
  // =========================================================================
  // Steering file begins
  // =========================================================================
  
  // General parameters
86
//  parameters->reference = "W0013_G03";
87
88
//  parameters->DUT = "W0005_E02";
//  parameters->DUT = "W0002_J05";
Daniel Hynds's avatar
Daniel Hynds committed
89
//  parameters->reference = "W0013_G03";
Daniel Hynds's avatar
Daniel Hynds committed
90
//  parameters->DUT = "W0019_L08";
91
92
93
94
95
//  parameters->DUT = "W0019_F07";

  // Clicpix parameters
  parameters->reference = "Mim-osa02";
  parameters->DUT = "CLi-CPix";
Daniel Hynds's avatar
Daniel Hynds committed
96

97
  parameters->detectorToAlign = parameters->DUT;
98
99
  parameters->excludedFromTracking[parameters->DUT] = true;
  
CLICdp Telescope's avatar
CLICdp Telescope committed
100
101
  parameters->excludedFromTracking["W0005_E02"] = true;
  parameters->excludedFromTracking["W0005_F01"] = true;
102
103
  parameters->excludedFromTracking["W0019_C07"] = true;
  parameters->excludedFromTracking["W0019_G07"] = true;
104
105
106
  parameters->excludedFromTracking["W0019_F07"] = true;
  parameters->excludedFromTracking["W0019_L08"] = true;
  parameters->excludedFromTracking["W0005_H03"] = true;
CLICdp user's avatar
CLICdp user committed
107
  parameters->excludedFromTracking["W0013_F09"] = true;
108
109
  
  spatialTracking->debug = true;
110
  //testAlgorithm->makeCorrelations = true;
111
112
  //dataDump->m_detector = parameters->DUT;
  
113
114
115
116
117
118
119
120
121
122
  // =========================================================================
  // Steering file ends
  // =========================================================================
  
  // Overwrite steering file values from command line
  parameters->readCommandLineOptions(argc,argv);

  // Load alignment parameters
  if(!parameters->readConditions()) return 0;
  
Daniel Hynds's avatar
Daniel Hynds committed
123
124
125
  // Load mask file for the dut (if specified)
  parameters->readDutMask();
  
126
127
  // Initialise the analysis object and add algorithms to run
  analysis = new Analysis(parameters);
Daniel Hynds's avatar
Daniel Hynds committed
128
//  analysis->add(tpix1EventLoader);
129
130
131
  analysis->add(fileReader);
  analysis->add(tpix1Clustering);
  analysis->add(spatialTracking);
132
//  analysis->add(correlator);
133
134
135
136
137
//  analysis->add(tpix3EventLoader);
//  analysis->add(tpix3Clustering);
//  analysis->add(testAlgorithm);
//  analysis->add(basicTracking);
//  analysis->add(dutAnalysis);
138
//  analysis->add(clicpixAnalysis);
Daniel Hynds's avatar
Daniel Hynds committed
139
//  analysis->add(fileWriter);
140
141
//  analysis->add(dataDump);

142
143
  if(parameters->align) analysis->add(alignment);
  if(parameters->produceMask) analysis->add(tpix3MaskCreator);
144
145
146
  if(parameters->eventDisplay) analysis->add(eventDisplay);
  if(parameters->gui) analysis->add(gui);
  
147
148
  // Run the analysis
  analysis->run();
149
150
151
152

  return 0;

}