38 int colors[] = {kRed, kBlue, kGreen};
44 int main(
int narg,
char *argv[])
52 cout<<
"Can't open file \""<<
filename<<
"\" !"<<endl;
55 cout<<
"Opened ROOT file \""<<f.GetName()<<
"\""<<endl;
58 for(
unsigned int i=0; i<
histnames.size(); i++){
64 cmd<<
"(echo \"Auto-generated from "<<
filename<<
":\"; ";
65 cmd<<
"echo \" \"; echo \" \"; ";
66 for(
unsigned int i=0;i<
plots.size();i++){
67 cmd<<
"echo \""<<
plots[i].message<<
"\"; ";
68 cmd<<
"uuencode "<<
plots[i].gif_file<<
" "<<
plots[i].gif_file<<
"; ";
70 if(
plots.size()==0)cmd<<
"echo \"No histograms specified!!\"; ";
71 cmd<<
") | mail -s \"ROOT plots\" ";
77 cout<<my_cmd.str()<<endl;
78 int res = system(my_cmd.str().c_str());
79 if(res!=0) cerr <<
"Error executing \""<<my_cmd.str()<<
"\"" << endl;
95 TH1F *
hist=(TH1F*)gROOT->FindObject(histname.c_str());
98 mess<<
"Unable to read in histogram '"<<histname<<
"' !";
107 TCanvas
c1(
"c1",histname.c_str(),200,10,700,500);
115 int res = system(
"echo quit | gs -sDEVICE=ppm -r72x72 -g565x405 -sOutputFile=tmp.ppm -dNOPAUSE tmp.eps > /dev/null");
116 if(res!=0) cerr <<
"Error running \"gs\" command." << endl;
120 outfile<<
"plot"<<
plots.size()<<
".gif";
125 cmd<<
"ppmtogif tmp.ppm > "<<outfile.str();
126 res = system(cmd.str().c_str());
127 if(res!=0) cerr <<
"Error running \""<<cmd.str()<<
"\"" << endl;
133 res = system(
"rm -f tmp.ppm tmp.eps");
134 if(res!=0) cerr <<
"Error running \"rm\" command." << endl;
140 plots.push_back(plot);
152 for(
int i=1; i<narg; i++){
153 if(
string(argv[i]) ==
"-cf"){
154 }
else if(
string(argv[i]) ==
"-r"){
159 }
else if(
string(argv[i]) ==
"-H"){
164 }
else if(
string(argv[i]) ==
"-if"){
169 }
else if(
string(argv[i]) ==
"-h"){
178 cout<<
"You MUST provide at least one e-mail address!!"<<endl<<endl;
189 cout<<
"Usage:"<<endl;
190 cout<<
" root2email [options]"<<endl;
192 cout<<
" -r email-address recipient e-mail address"<<endl;
193 cout<<
" (can be given multiple times)"<<endl;
194 cout<<
" -H histogram name of histogram. If histogram"<<endl;
195 cout<<
" is in a TDirectory, include the"<<endl;
196 cout<<
" path. (can be given multiple times)"<<endl;
197 cout<<
" -if rootfile name of ROOT file to use"<<endl;
198 cout<<
" -h print this help message."<<endl;
vector< string > email_address
void ParseCommandLineArguments(int &narg, char *argv[])
void AddPlot(TFile &f, string what)
vector< string > histnames
void Usage(JApplication &app)
int main(int argc, char *argv[])