Steering.C 5.66 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"
Daniel Hynds's avatar
Daniel Hynds committed
33
#include "OnlineMonitor.h"
34
35
36
37
38
39
40
41
42
43
44

//-------------------------------------------------------------------------------
// 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
Daniel Hynds's avatar
Daniel Hynds committed
45
// This allows you to ^\ to exit at any point in a controlled way
46
47
48
49
50
51
52
53
void userException(int sig){
  cout<<endl<<"User interrupted"<<endl;
  analysis->finaliseAll();
  exit(1);
}

int main(int argc, char *argv[]) {
 
Daniel Hynds's avatar
Daniel Hynds committed
54
55
  // Register escape behaviour (^\)
  signal(SIGQUIT, userException);
56
57
58
59

  // New parameters object
  Parameters* parameters = new Parameters();
  
Daniel Hynds's avatar
Daniel Hynds committed
60
61
62
  // Global debug flag
  bool debug = false;

Daniel Hynds's avatar
Daniel Hynds committed
63
64
65
  // Algorithm list
  Timepix3EventLoader*	tpix3EventLoader	= new Timepix3EventLoader(debug);
  Timepix3Clustering*		tpix3Clustering		= new Timepix3Clustering(debug);
66
  Timepix1EventLoader*	tpix1EventLoader	= new Timepix1EventLoader(debug);
67
  Timepix1Clustering*		tpix1Clustering		= new Timepix1Clustering(debug);
Daniel Hynds's avatar
Daniel Hynds committed
68
69
70
  TestAlgorithm* 				testAlgorithm			= new TestAlgorithm(debug);
  Timepix3MaskCreator*	tpix3MaskCreator	= new Timepix3MaskCreator(debug);
  BasicTracking* 				basicTracking			= new BasicTracking(debug);
71
  SpatialTracking* 			spatialTracking		= new SpatialTracking(debug);
Daniel Hynds's avatar
Daniel Hynds committed
72
73
74
75
  Alignment*	 					alignment					= new Alignment(debug);
  EventDisplay*	 				eventDisplay			= new EventDisplay(debug);
  GUI*	 								gui								= new GUI(debug);
  DUTAnalysis*	 				dutAnalysis				= new DUTAnalysis(debug);
76
77
78
  FileWriter*	 					fileWriter				= new FileWriter(debug);
  FileReader*	 					fileReader				= new FileReader(debug);
  Timepix1Correlator*	 	correlator				= new Timepix1Correlator(debug);
79
  ClicpixAnalysis*	 		clicpixAnalysis		= new ClicpixAnalysis(debug);
80
  DataDump*	 						dataDump					= new DataDump(debug);
Daniel Hynds's avatar
Daniel Hynds committed
81
  OnlineMonitor*			onlineMonitor = new OnlineMonitor(debug);
82
83
84
85
86
  // =========================================================================
  // Steering file begins
  // =========================================================================
  
  // General parameters
CLICdp user's avatar
CLICdp user committed
87
88
  parameters->reference = "W0013_G03";
  parameters->DUT = "W0039_C08";
89
90
//  parameters->DUT = "W0005_E02";
//  parameters->DUT = "W0002_J05";
Daniel Hynds's avatar
Daniel Hynds committed
91
  parameters->reference = "W0013_G03";
Daniel Hynds's avatar
Daniel Hynds committed
92
//  parameters->DUT = "W0019_L08";
Daniel Hynds's avatar
Daniel Hynds committed
93
  parameters->DUT = "W0019_F07";
94
95

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

CLICdp user's avatar
CLICdp user committed
99
100
101
102
  //parameters->reference = "Mim-osa02";
  //parameters->DUT = "CLi-CPix";
 
//  parameters->DUT = "W0013_J05";
103
  parameters->detectorToAlign = parameters->DUT;
104
  parameters->excludedFromTracking[parameters->DUT] = true;
CLICdp user's avatar
CLICdp user committed
105
106
 
 
CLICdp Telescope's avatar
CLICdp Telescope committed
107
108
  parameters->excludedFromTracking["W0005_E02"] = true;
  parameters->excludedFromTracking["W0005_F01"] = true;
109
110
  parameters->excludedFromTracking["W0019_C07"] = true;
  parameters->excludedFromTracking["W0019_G07"] = true;
111
112
113
  parameters->excludedFromTracking["W0019_F07"] = true;
  parameters->excludedFromTracking["W0019_L08"] = true;
  parameters->excludedFromTracking["W0005_H03"] = true;
114
  
Daniel Hynds's avatar
Daniel Hynds committed
115
  clicpixAnalysis->timepix3Telescope = true;
116
//  spatialTracking->debug = true;
CLICdp user's avatar
CLICdp user committed
117
118
119
120
121
122
123
124
125
126
127
128
129
  parameters->masked["W0039_C08"] = true;
 
//  parameters->masked["W0013_D04"] = true;
//  parameters->masked["W0013_E03"] = true;
//  parameters->masked["W0013_G02"] = true;

//  parameters->masked["W0013_J05"] = true;
//  parameters->masked["W0013_L09"] = true;
//  parameters->masked["W0013_F09"] = true;


  //tpix3EventLoader->debug = true;
  basicTracking->minHitsOnTrack = 7;
130
  //testAlgorithm->makeCorrelations = true;
131
132
  //dataDump->m_detector = parameters->DUT;
  
133
134
135
136
137
138
139
140
141
142
  // =========================================================================
  // 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
143
144
145
  // Load mask file for the dut (if specified)
  parameters->readDutMask();
  
146
147
  // Initialise the analysis object and add algorithms to run
  analysis = new Analysis(parameters);
Daniel Hynds's avatar
Daniel Hynds committed
148
//  analysis->add(tpix1EventLoader);
Daniel Hynds's avatar
Daniel Hynds committed
149
150
151
//  analysis->add(fileReader);
//  analysis->add(tpix1Clustering);
//  analysis->add(spatialTracking);
152
//  analysis->add(correlator);
Daniel Hynds's avatar
Daniel Hynds committed
153
154
155
156
157
158
  analysis->add(tpix3EventLoader);
  analysis->add(tpix3Clustering);
  analysis->add(testAlgorithm);
  analysis->add(basicTracking);
  analysis->add(dutAnalysis);
//  analysis->add(clicpixAnalysis);
Daniel Hynds's avatar
Daniel Hynds committed
159
//  analysis->add(fileWriter);
160
161
//  analysis->add(dataDump);

162
163
  if(parameters->align) analysis->add(alignment);
  if(parameters->produceMask) analysis->add(tpix3MaskCreator);
164
  if(parameters->eventDisplay) analysis->add(eventDisplay);
CLICdp user's avatar
CLICdp user committed
165
  if(parameters->gui) analysis->add(onlineMonitor);
166
  
167
168
  // Run the analysis
  analysis->run();
169
170
171
172

  return 0;

}