19 int ReadConfig(
TString ifconfig, vector<TString> &gwname, vector<TString> &wpath, vector<TString> &rdir);
23 cout<<
"MergeDataPE.C init ..."<<endl;
27 gSystem->Exec(
"date");
29 vector<TString> gwname;
30 vector<TString> wpath;
32 int gwsize =
ReadConfig(ifconfig, gwname, wpath, rdir);
34 vector<TString> rpath(gwsize);
39 for(
int i=0;
i<gwsize;
i++) {
40 rpath[
i] = wpath[
i]+
"/report/dump/"+rdir[
i]+
"/"+side+
"/distributions";
45 sprintf(cmd1,
"cat %s/*_ResidualEnergy.txt > %s/ResidualEnergy.txt",rpath[
i].Data(),odir.Data());
46 sprintf(cmd2,
"cat %s/*_FittingFactor.txt > %s/FittingFactor.txt",rpath[
i].Data(),odir.Data());
47 sprintf(cmd3,
"cat %s/*_OverlapFactor.txt > %s/OverlapFactor.txt",rpath[
i].Data(),odir.Data());
49 sprintf(cmd1,
"cat %s/*_ResidualEnergy.txt >> %s/ResidualEnergy.txt",rpath[
i].Data(),odir.Data());
50 sprintf(cmd2,
"cat %s/*_FittingFactor.txt >> %s/FittingFactor.txt",rpath[
i].Data(),odir.Data());
51 sprintf(cmd3,
"cat %s/*_OverlapFactor.txt >> %s/OverlapFactor.txt",rpath[
i].Data(),odir.Data());
61 for(
int i=0;
i<gwsize;
i++) {
62 rpath[
i] = wpath[
i]+
"/report/dump/"+rdir[
i]+
"/"+side+
"/distributions";
67 sprintf(cmd1,
"cat %s/*_ResidualEnergy_sensitivity.txt > %s/ResidualEnergy_sensitivity.txt",rpath[
i].Data(),odir.Data());
68 sprintf(cmd2,
"cat %s/*_FittingFactor_sensitivity.txt > %s/FittingFactor_sensitivity.txt",rpath[
i].Data(),odir.Data());
69 sprintf(cmd3,
"cat %s/*_OverlapFactor_sensitivity.txt > %s/OverlapFactor_sensitivity.txt",rpath[
i].Data(),odir.Data());
71 sprintf(cmd1,
"cat %s/*_ResidualEnergy_sensitivity.txt >> %s/ResidualEnergy_sensitivity.txt",rpath[
i].Data(),odir.Data());
72 sprintf(cmd2,
"cat %s/*_FittingFactor_sensitivity.txt >> %s/FittingFactor_sensitivity.txt",rpath[
i].Data(),odir.Data());
73 sprintf(cmd3,
"cat %s/*_OverlapFactor_sensitivity.txt >> %s/OverlapFactor_sensitivity.txt",rpath[
i].Data(),odir.Data());
83 for(
int i=0;
i<gwsize;
i++) {
84 rpath[
i] = wpath[
i]+
"/report/dump/"+rdir[
i]+
"/"+side+
"/distributions";
89 sprintf(cmd1,
"cat %s/*_ResidualEnergy_onsource_prob.txt > %s/ResidualEnergy_onsource_prob.txt",rpath[
i].Data(),odir.Data());
90 sprintf(cmd2,
"cat %s/*_FittingFactor_onsource_prob.txt > %s/FittingFactor_onsource_prob.txt",rpath[
i].Data(),odir.Data());
91 sprintf(cmd3,
"cat %s/*_OverlapFactor_onsource_prob.txt > %s/OverlapFactor_onsource_prob.txt",rpath[
i].Data(),odir.Data());
93 sprintf(cmd1,
"cat %s/*_ResidualEnergy_onsource_prob.txt >> %s/ResidualEnergy_onsource_prob.txt",rpath[
i].Data(),odir.Data());
94 sprintf(cmd2,
"cat %s/*_FittingFactor_onsource_prob.txt >> %s/FittingFactor_onsource_prob.txt",rpath[
i].Data(),odir.Data());
95 sprintf(cmd3,
"cat %s/*_OverlapFactor_onsource_prob.txt >> %s/OverlapFactor_onsource_prob.txt",rpath[
i].Data(),odir.Data());
101 cout << cmd3 << endl;
108 int ReadConfig(
TString ifconfig, vector<TString> &gwname, vector<TString> &wpath, vector<TString> &rdir) {
111 in.open(ifconfig.Data(),
ios::in);
112 if (!in.good()) {cout <<
"MergeDataPE::ReadConfig Error Opening File : " << ifconfig.Data() << endl;
exit(1);}
117 in.getline(log,1024);
118 if (!in.good())
break;
119 if(log[0]==
'#')
continue;
121 if(line.Contains(
"ifeq") && line.Contains(
"$(GW_NAME)")) {
123 TString gw =
line(line.Index(
',')+1, line.Last(
')')-line.Index(
',')-1);
124 gwname.push_back(gw);
127 if(line.Contains(
"endif") && start==
true) start=
false;
129 if(line.Contains(
"PE_OFFPATH")) {
131 wpath.push_back(path);
134 if(line.Contains(
"PE_RDIR")) {
135 TString dir =
line(line.Index(
'=')+1, line.Sizeof()-line.Index(
',')-2);
136 dir.ReplaceAll(
" ",
"");
145 if((wpath.size() != gwname.size())) {
146 cout <<
"MergeDataPE::ReadConfig - missing PE_OFFPATH config declarations: MISSED = " 147 << gwname.size()-wpath.size() <<
" in file " << ifconfig << endl;
exit(1);
149 if((rdir.size() != gwname.size())) {
150 cout <<
"MergeDataPE::ReadConfig - missing PE_RDIR config declarations: MISSED = " 151 << gwname.size()-rdir.size() <<
" in file " << ifconfig << endl;
exit(1);
154 for(
int i=0;
i<gwname.size();
i++) cout <<
i <<
"\t" << gwname[
i] << endl;
155 for(
int i=0;
i<gwname.size();
i++) cout <<
i <<
"\t" << wpath[
i] << endl;
156 for(
int i=0;
i<gwname.size();
i++) cout <<
i <<
"\t" << rdir[
i] << endl;
158 return gwname.size();
void MergeDataPE(TString side, TString odir, TString ifconfig)
int ReadConfig(TString ifconfig, vector< TString > &gwname, vector< TString > &wpath, vector< TString > &rdir)
sprintf(tfres,"(1/%g)x(%g) (sec)x(Hz)", 2 *df, df)