Skip to content
Snippets Groups Projects
Commit b51275f2 authored by clantz's avatar clantz
Browse files

Dissected the filename to make the output land next to the executable

parent 45b8d37d
No related branches found
No related tags found
No related merge requests found
......@@ -4,17 +4,22 @@
#include "TTree.h"
#include "TStyle.h"
#include <iostream>
#include <string>
using namespace std;
int main(int argc, char *argv[]){
if(argc == 0) return 0;
TFile *f = new TFile( Form("%s.root",argv[1]) );
TFile *f = new TFile( argv[1] );
if(f->IsZombie()){
cout << Form("%s.root does not exist... exiting",argv[1]) << endl;
return 0;
}
string name = argv[1];
if(name.find("/") != string::npos) name.erase( 0, name.find_last_of("/") + 1 );
if(name.find(".") != string::npos) name.erase( name.find_last_of(".") );
TTree *t = (TTree*)f->Get("lightGuide");
double x,y;
t->SetBranchAddress("X",&x);
......@@ -32,7 +37,7 @@ int main(int argc, char *argv[]){
gStyle->SetOptStat(0);
h->Scale(1.0/h->GetMaximum());
h->Draw("COLZ");
c->Print( Form("%s.png",argv[1]) );
c->Print( Form("%s.png",name.c_str()) );
delete f;
return 1;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment