3 #pragma GCC system_header
14 if(!gROOT->GetClass(
"wavegraph")) {
15 TString wat_path = gSystem->Getenv(
"HOME_WAT");
17 printf(
"Loading wavegraph : %s ...\n",wavegraph_path.Data());
18 if(gSystem->Load(wavegraph_path)) {
19 cout <<
"error loading wavegraph library" << endl;
25 TFile inputfile(
"wavegraph_demo_data.root");
26 if(!inputfile.IsOpen()) {
27 cout <<
"File .root not exist" << endl;
40 Int_t my_scales[nscales]={3,4,5,6,7,8};
42 std::vector<int> scales;
43 for (
int n=0;
n<nscales;
n++)
44 scales.push_back(my_scales[
n]);
46 std::vector< WSeries<double>* > data;
47 ostringstream convert_str;
48 for (
int n=0; n != nscales; ++
n) {
49 convert_str <<
"V1:" << my_scales[
n];
50 std::string
label=convert_str.str();
51 cout <<
"" << label <<
"\n";
53 cout <<
"pointer to data[" << n <<
"] is " << data[
n] << endl;
61 graph.
create(
"wavegraph_demo.txt");
64 std::cerr <<
"the graph is not topologically sorted\n";
69 std::vector<cluster> clusters = graph.
clustering(400.0,data,8.0);
70 std::cout <<
"found " << clusters.size() <<
" clusters\n";
86 double fhigh = (layers-1)*df;
88 cout <<
"start " << start <<
" stop " << stop <<
" flow " << flow <<
" fhigh " << fhigh << endl;
92 WTS.
hist2D->GetYaxis()->SetRangeUser(flow, fhigh);
95 int colors[8]={kWhite, kYellow, kOrange, kMagenta, kGreen, kBlue, kRed, kCyan};
96 std::vector<TPolyLine> clusters_lines (clusters.size());
97 std::vector<TPolyMarker> clusters_points (clusters.size());
99 for (
int n=0; n<clusters.size(); ++
n) {
101 int N = clusters[
n].size();
106 for (
int k = N;
k-- > 0;) {
108 (*f)[
k]=(clusters[
n])[
k].freq;
109 (*scale)[
n]=(clusters[
n])[
k].log2scale;
112 clusters_lines[
n].SetPolyLine(N,t->
data,f->
data);
114 clusters_lines[
n].SetLineColor(colors[n%8]);
115 clusters_lines[
n].SetLineStyle(2);
116 clusters_lines[
n].SetLineWidth(4);
117 clusters_lines[
n].Draw(
"same");
119 clusters_points[
n].SetPolyMarker(N,t->
data,f->
data);
120 clusters_points[
n].SetMarkerSize(8);
121 clusters_points[
n].SetMarkerStyle(kDot);
122 clusters_points[
n].SetMarkerColor(colors[n%8]);
123 clusters_points[
n].Draw(
"same");
133 sprintf(fname,
"wavegraph_demo_plots.root");
wavearray< double > t(hp.size())
void graph(TString ifile)
std::vector< cluster > clustering(const double threshold, const std::vector< WSeries< double > * > &data, const double strip_edges, const int path_halfwidth, const double penal_factor, const std::vector< double > &energy_thresholds)
printf("total live time: non-zero lags = %10.1f \n", liveTot)
cout<< "skymap size : "<< L<< endl;for(int l=0;l< L;l++) sm.set(l, l);sm > const_cast< char * >("skymap.dat")
virtual void start(double s)
void plot(wavearray< double > &, char *=NULL, int=1, double=0., double=0., bool=false, float=0., float=0., bool=false, float=0., bool=false)
bool is_topologically_sorted()
void create(const std::string &srcfile)
sprintf(tfres,"(1/%g)x(%g) (sec)x(Hz)", 2 *df, df)