30 #include <TApplication.h>
33 const int CANVAS_X_DIMENSION = 800;
34 const int CANVAS_Y_DIMENSION = 800;
35 const int NUMBER_HISTO_CHANNELS = 500;
38 TApplication APPLICATION(
"application",0,0);
39 TStyle* MPILib::RootCanvas::_p_style =
new TStyle;
41 std::unique_ptr<TCanvas> MPILib::RootCanvas::_p_canvas(
nullptr);
42 std::vector<MPILib::NodeId> MPILib::RootCanvas::_vec_id(0);
44 std::vector<int> MPILib::RootCanvas::_vec_scratch(0);
45 bool MPILib::RootCanvas::_b_rendering_started =
false;
46 TH2F* MPILib::RootCanvas::_p_hist_state = 0;
47 TH2F* MPILib::RootCanvas::_p_hist_rate = 0;
49 TPad* MPILib::RootCanvas::_p_pad_state = 0;
50 TPad* MPILib::RootCanvas::_p_pad_rate = 0;
55 _par_canvas(par_canvas)
64 int RootCanvas::PadId(
NodeId id)
const
66 std::vector<NodeId>::iterator iter = find(_vec_id.begin(), _vec_id.end(), id);
67 return (iter != _vec_id.end()) ? iter - _vec_id.begin() + 1 : -1;
72 if (! _b_rendering_started){
74 _b_rendering_started =
true;
77 int index = PadId(
id);
80 _p_pad_state->cd(index);
81 _p_hist_state->Draw();
86 _p_pad_rate->cd(index);
92 if (IsCycleComplete() )
96 void RootCanvas::AddToCycle(
NodeId id)
99 std::vector<NodeId>::iterator iter = std::find(_vec_id.begin(),_vec_id.end(),id);
100 if (iter == _vec_id.end())
103 int i = iter - _vec_id.begin();
107 bool RootCanvas::IsCycleComplete(){
108 std::vector<int>::iterator iter;
109 iter = std::find(_vec_scratch.begin(),_vec_scratch.end(),0);
110 if (iter == _vec_scratch.end()){
111 for (iter = _vec_scratch.begin(); iter != _vec_scratch.end(); iter++)
119 void RootCanvas::addNode(
NodeId id)
121 if (find(_vec_id.begin(),_vec_id.end(),id) == _vec_id.end())
122 _vec_id.push_back(
id);
128 void RootCanvas::initializeCanvas(){
130 _p_canvas = std::unique_ptr<TCanvas>(
new TCanvas(
"MIIND_CANVAS",
"MIIND",CANVAS_X_DIMENSION,CANVAS_Y_DIMENSION));
132 gStyle->SetOptStat(0);
134 _p_pad_rate =
new TPad(
"rate",
"", 0.05,0.05, 0.45, 0.95);
135 _p_pad_state =
new TPad(
"state",
"", 0.55,0.05, 0.95, 0.95);
137 _p_hist_state =
new TH2F(
"state_histo",
"", NUMBER_HISTO_CHANNELS ,_par_canvas._state_min,_par_canvas._state_max, NUMBER_HISTO_CHANNELS,_par_canvas._dense_min,_par_canvas._dense_max);
138 _p_hist_rate =
new TH2F(
"rate_histo",
"", NUMBER_HISTO_CHANNELS, _par_canvas._t_min,_par_canvas._t_max,NUMBER_HISTO_CHANNELS,_par_canvas._f_min,_par_canvas._f_max);
140 this->SetMaximumDensity();
141 this->SetMaximumRate();
143 Number number_of_drawable_populations = _vec_id.size();
144 _vec_scratch = std::vector<int>(number_of_drawable_populations,0.);
146 _p_pad_state->Draw();
148 _p_pad_rate->Divide(1,number_of_drawable_populations, 1e-5, 1e-5);
152 _p_pad_state->Divide(1,number_of_drawable_populations, 1e-5, 1e-5);
159 void RootCanvas::SetMaximumDensity()
const
161 if ( _par_canvas._dense_max > 0 ){
162 int n_x = _p_hist_state->GetXaxis()->GetNbins();
163 int n_y = _p_hist_state->GetYaxis()->GetNbins();
164 double y_min = _p_hist_state->GetYaxis()->GetXmin();
166 _p_hist_state->SetBins
169 _par_canvas._state_min,
170 _par_canvas._state_max,
173 _par_canvas._dense_max
179 void RootCanvas::SetMaximumRate()
const
181 if ( _par_canvas._f_max > 0 )
183 int n_x = _p_hist_rate->GetXaxis()->GetNbins();
184 int n_y = _p_hist_rate->GetYaxis()->GetNbins();
185 double y_min = _p_hist_rate->GetYaxis()->GetXmin();
187 _p_hist_rate->SetBins
200 #endif // don't bother if you don't want ROOT
Auxiliary class, stores the boundaries of the histograms shown in the running canvas.
The objective is find a numerical solution for this equation This requires a numerical representation of the density We will work in the state space of a two dimensional and define a mesh there We first give two examples and then define the general procedure and given in Table for given fixed Delta g see Fig and we will denote coordinates in this dimension by a small letter $v The second dimension can be used to represent parameters as varied as and will represented by $w A strip is constructed by choosing two neighbouring points in state e g and integrating the vector field for a time $T that is assumed to be an integer multiple of a period of time Delta which we assume to be a defining characteristic of the grid Let then the set of points the set of points which is quadrilateral in shape The quadrilateral should be but not necessarily as long as they are but it is convenient to number them in order of creation In the we will assume that strip numbers created by the integration procedure start and are so that the numbers i in each identify a unique strip Strip no is reserved for stationary points There may or more cells in strip The number of cells in strip $i denoted by with $i the strip number and $j the cell as the i