rootgINukeVal.C
Go to the documentation of this file.
1 /*
2 rootgINukeVal.C
3 genie Intranuke Data Analysis
4 Author Andrew Seel March 2011
5 updated Juan Manfredi July 2012
6 
7 This program simplifies the production of graphs of energy/angle v. cross section for both GENIE generated events and published cross section data. This ROOT script is an upgrade to gINukeVal (circa 2008) that changes the format file format in order to allow for the graphing of N data files.
8 
9 The script is called with the location of the format file, the directory of published data, the directory of GENIE data files, and the directory in which graphs should be saved. Do not put trailing slashes.
10 
11 For example (Assuming rootgINukeVal.C lives above the EX directory)
12 
13 root 'rootgINukeVal.C("EX/f-file","EX/PubData","EX/GenieFiles","EX/PngFiles")'
14 */
15 
16 
17 /*
18 The new format file is tag based. There are three tags.
19  [RECORD] <- starts a new graph
20  [GENIE] <- adds a new GENIE file to the graph
21  [EXPERIMENTAL] <- adds a new published data file to the graph
22 
23 The lines following each tag are fields which give instructions to the grapher on how to intepret the data, [RECORD] has 5, [GENIE] has 5, and [EXPERIMENTAL] only has 3 and one optional line.
24 
25 FORMAT OVERVIEW: (All white-space is ignored, each line is its own field, except for the xl,xu,yl,yu line, where each field is comma separated)
26 
27 [RECORD]
28  xl,xu,yl,yu
29  Graph Type <- Four valid values: Energy, Momentum, Angle, XS
30  Graph Title
31  Savename
32  binFactor <- Integer valued
33 [GENIE]
34  filename
35  cols
36  cut
37  dcth <- Ignored for Angle graphs
38  legend title
39 [EXPERIMENTAL]
40  filename
41  cols
42  legend title
43  cut <- Normally uneccessary. Needed for XS filetypes
44 [GEANT]
45 
46 */
47 
48 
49 #include <iostream>
50 #include <fstream>
51 #include <sstream>
52 #include <list>
53 #include <TMath.h>
54 #include <TCanvas.h>
55 #include <TError.h>
56 #include <TTree.h>
57 #include <string>
58 #include <TCollection.h>
59 #include <TNtuple.h>
60 #include <vector>
61 #include <typeinfo>
62 #include <genieStyle.C>
63 
64 //A small utility function that cuts off wrapping spaces
65 string trim(string in){
66  size_t f = in.find_first_not_of(' ',0);
67  size_t l = in.find_last_not_of(' ',0);
68  if(l-f-1 > f){
69  in = in.substr(f,l-f-1);
70  }
71  return in;
72 }
73 
74 //Holds data associated with each .ginuke or .txt file
75 // Is responsible for reading the file and generating the associated TTree
76 class DataFile
77 {
78 public:
79  string dir;
80  string filename;
81  string name;
82  string title;
83  string cols;
84  string gType;
85  string cut;
86  float dcth;
87  int color;
88  TFile* file;
89  bool isValid; //=false
90  bool GetData();
91  DataFile();
92  DataFile(string dname, string dtitle);
93  DataFile(string dtype,string dir, string ddname, string dtitle,string dcols,string dcut,double ddcth, int dcolor);
94  string getName(){return name;};
95  int GetID() {return this->ID;};
96  bool valid() {return isValid;};
97  int analyzeTextFile();
98  TTree* dataTree;
99  TNtuple* dataTuple;
100 };
101 
103 DataFile::DataFile(string dname, string dtitle){
104  name = dname;
105  title = dtitle;
106  isValid = GetData();
107 }
108 
109 DataFile::DataFile(string dtype,string ddir, string ddname, string dtitle, string dcols, string dcut, double ddcth, int dcolor){
110  dir = ddir;
111  filename = ddname;
112  gType = dtype;
113  name = ddir+ddname;
114  title = dtitle;
115  cols = dcols;
116  cut = dcut;
117  dcth = ddcth;
118  color = dcolor;
119  if (color>=5) {color++;}
120  isValid = GetData();
121 }
122 
124  stringstream convert;
125  int nameVal = 0;
126  convert.str(filename);
127  convert >> nameVal;
128  bool success = false;
129  //Find file type
130  string type = "";
131  size_t pos = filename.find_last_of('.');
132  if(gType.compare("XS")==0){
133  TNtuple newData ("newData","", cols.c_str() );
134  newData.ReadFile(name.c_str());
135  cout<<"TNtuple created"<<endl;
136  dataTuple = (TNtuple*) newData.Clone();
137  cout<<name.c_str()<<endl;
138  cout<<dataTuple<<endl;
139  success = true;
140  }
141  else{
142  if(pos != string::npos){
143  if(filename[pos+1] == 'r'){
144  if(filename[pos-1] == 'e'){
145  type.assign("ginuke");
146  }
147  else{
148  type.assign("gst");
149  }
150  }
151  else{
152  type.assign("txt");
153  }
154  }
155  else{
156  type.assign("chain");
157  }
158  if(type[0]!='t'){
159  if(type[0]=='g'){
160  //Normal .ginuke file, Easy
161  file = new TFile(name.c_str());
162  if(file->IsOpen()){
163  TTree* dummy = file->Get(type.c_str());
164  dataTree = (TTree*)dummy->Clone();
165  delete dummy;
166  success=true;
167  }
168  else{
169  cout<<name.c_str()<<" was not found. Skipping [GENIE] tag."<<endl;
170  success=false;
171  }
172  }
173  //Chaining together some files
174  else{
175  TChain chain("ginuke");
176  TChain* dummy = &chain;
177  //Need to have name separate from directory in order to properly construct this filename.
178  string n = dir+"/gntp.*"+filename+"*.ginuke.root";
179  cout<<"Making a chain called "<<n<<endl;
180  chain.Add(n.c_str());
181  cout<<"Chain created."<<endl;
182  dataTree = (TTree*)dummy->Clone();
183  cout<<"dummy cloned"<<endl;
184  success=true;
185  }
186  }
187  else{
188  //Grabbing simple data from the text file
189  dataTree = new TTree("textData",title.c_str());
190  int nCol = this->analyzeTextFile();
191  success = true;
192  if(gType.compare("Energy")==0){
193  if(nCol==3){dataTree->ReadFile(name.c_str(),"E/D:xsec:err1");}
194  else if(nCol==2){dataTree->ReadFile(name.c_str(),"E/D:xsec");}
195  else{cout<<"Published data file has an unrecognized format."<<endl;
196  success=false;}
197  }
198  if(gType.compare("Momentum")==0){
199  if(nCol==3){dataTree->ReadFile(name.c_str(),"ph/D:xsec:err1");}
200  else if(nCol==2){dataTree->ReadFile(name.c_str(),"ph/D:xsec");}
201  else{cout<<"Published data file has an unrecognized format."<<endl;
202  success=false;}
203  }
204  if(gType.compare("Angle")==0){
205  if(nCol==3){dataTree->ReadFile(name.c_str(),"cth/D:xsec:err1");}
206  else if(nCol==2){dataTree->ReadFile(name.c_str(),"cth/D:xsec");}
207  else{cout<<"Published data file has an unrecognized format."<<endl;
208  success=false;}
209  }
210  }
211  }
212 
213  return success;
214 }
215 
216 
218  //Determines the number of columns of numbers in the text file
219  // Assumes columns are separated by spaces
220  // Only actually determines if there are more than two columns, if so, it assumes there are 3
221  int size=0;
222  ifstream dataStream(name.c_str(),ios::in);
223  string line;
224  if(dataStream.is_open()){
225  getline(dataStream,line);
226  line = trim(line);
227  while(line[0]=='#'){
228  getline(dataStream,line);
229  }
230  size_t begin = line.find(" ",0);
231  size_t end = line.find_first_not_of(" ",begin);
232  size_t again = line.find(" ",end);
233  if(again!=string::npos){
234  size=3;
235  }
236  else{
237  size=2;
238  }
239  }
240  dataStream.close();
241  return size;
242 }
243 
244 //Here resides all of the information contained in the current record.
245 // It is responsible for parsing the format file for each record, and generating DataFile objects
246 // when asked nicely.
248 public:
249  string fFile;
250  string xl,xu,yl,yu;
251  vector<string> fileNames;
252  vector<string> cols;
253  vector<string> cuts;
254  vector<double> dcths;
255  vector<string> titles;
256  vector<string> dataSource;
257  string mtitle;
258  string savename;
259  string type;
260  bool logx = false;
261  bool logy = false;
262  int binFactor = 1;
263  FormatFile(string gtype);
264  bool process(size_t record);
265  int numFiles(){return fileNames.size();};
266  DataFile* makeDataFile(int which,string dir=".");
267  string fetchGTitle(){return mtitle;};
268  int numOfType(string type);
269 };
270 
272  fFile = fileName;
273 }
274 
276  int count = 0;
277  int i;
278  for(i=0;i<dataSource.size();i++){
279  if(dataSource[i].compare(type)==0){
280  count++;
281  }
282  }
283  return count;
284 }
285 
286 bool FormatFile::process(size_t record){
287  //Clearing variables to prevent contamination from previous process runs
288  fileNames.clear();
289  cols.clear();
290  cuts.clear();
291  dcths.clear();
292  titles.clear();
293  dataSource.clear();
294  logx=false;
295  logy=false;
296  binFactor = 1;
297  mtitle = "";
298  savename = "";
299 
300 
301  bool good = false;
302  ifstream formatStream(fFile.c_str(),ios::in);
303  string line;
304  vector<string> tokens;
305  string temp;
306  if(formatStream.is_open()){
307  //Get the recordth record tag
308  int depth = 0;
309  size_t i=0;
310  while(i<record && formatStream.eof()==false){
311  getline(formatStream,line);
312  line = trim(line);
313  //Searching the current line for the tag markers
314  size_t open = line.find_first_of('[',0);
315  if(open!=string::npos){
316  size_t close = line.find_first_of(']',0);
317  if(close <= open){
318  cout<<"Malformed Tag on following line"<<endl;
319  cout<<" "<<line<<endl;
320  i = record+2;
321  }
322  else{
323  //Pulling out tag contents
324  string curTag = line.substr(open+1,close-open-1);
325  if(curTag.compare("RECORD")==0){
326  i++;
327  }
328  }
329  }
330  }
331  //If there were enough records
332  if(i == record){
333  cout<<"Record "<<record<<" found, processing."<<endl;
334  curTag = "PROCESS";
335  good = true;
336  depth = 1;
337  }
338 
339  //If we hit another RECORD tag or the end of the file, we're done
340  while(good == true && curTag.compare("RECORD")!=0 && formatStream.eof()==false){
341  getline(formatStream,line);
342  if(line[0]!='#'){ //Ignore lines starting with a hash
343  line = trim(line);
344  //Check if line is the opening of a new section, then extract the tag
345  size_t open = line.find_first_of('[',0);
346  if(open!=string::npos){
347  size_t close = line.find_first_of(']',0);
348  curTag = line.substr(open+1,close-open-1);
349  depth = 0;
350  }
351  //Getting data out of the RECORD
352  if(curTag.compare("PROCESS")==0){
353  if(depth==1){
354  //Get the coordinates of the graph
355  size_t commaPos = line.find_first_of(',',0);
356  xl = line.substr(0,commaPos);
357  size_t nextPos = line.find_first_of(',',commaPos+1);
358  xu = line.substr(commaPos+1,nextPos-commaPos-1);
359  commaPos = nextPos;
360  nextPos = line.find_first_of(',',commaPos+1);
361  yl = line.substr(commaPos+1,nextPos-commaPos-1);
362  commaPos = nextPos;
363  nextPos = line.find_first_of(',',commaPos+1);
364  yu = line.substr(commaPos+1,nextPos-commaPos-1);
365  }
366  if(depth==2){type = line;}
367  if(depth==3){mtitle = line;}
368  if(depth==4){savename = line;}
369  if(depth==5){
370  stringstream iss;
371  iss.str(line); iss.clear();
372  iss >> binFactor;
373  }
374  }
375  else if(curTag.compare("GENIE")==0){
376  if(depth==0){dataSource.push_back(curTag);}
377  if(depth==1){fileNames.push_back(line);}
378  if(depth==2){cols.push_back(line);}
379  if(depth==3){cuts.push_back(line);}
380  if(depth==4){
381  stringstream iss;
382  iss.str(line); iss.clear();
383  double val;
384  iss >> val;
385  dcths.push_back(val);
386  }
387  if(depth==5){titles.push_back(line);}
388  }
389  else if(curTag.compare("EXPERIMENTAL")==0){
390  if(depth==0){dataSource.push_back(curTag);}
391  if(depth==1){fileNames.push_back(line);}
392  if(depth==2){
393  //Give some defaults to the stacks
394  dcths.push_back(1);
395  if(type.compare("XS")!=0){
396  cuts.push_back("");
397  }
398  //Push a valid datum onto another stack
399  cols.push_back(line);
400  }
401  if(depth==3){titles.push_back(line);}
402  if(depth==4){cuts.push_back(line);}
403  }
404  else if(curTag.compare("RECORD")!=0){
405  //Someone messed up the format file
406  cout<<"Bad Tag: " <<line<<endl;
407  good = false;
408  }
409  depth++;
410  }
411  }
412  if(type.compare("Angle")!=0){
413  cout<<"Nonangular distribution"<<endl;
414  if(yu[0] == '-'){logy = true; yu = yu.substr(1);}
415  if(yl[0] == '-'){logy = true; yl = yl.substr(1);}
416  if(xu[0] == '-'){logx = true; xu = xu.substr(1);}
417  if(xl[0] == '-'){logx = true; xl = xl.substr(1);}
418  }
419  //cout<<"("<<xl<<","<<yl<<"),("<<xu<<","<<yu<<")"<<endl;
420  }
421  return good;
422 }
423 
424 DataFile* FormatFile::makeDataFile(int which,string dir,string source){
425  int num=0;
426  int i=0;
427  //Find the position of the desired file in the vectors
428  while(num <= which && i < dataSource.size()){
429  if(dataSource[i].compare(source)==0){ num++; }
430  i++;
431  }
432  i--;
433  dir = dir+"/";
434  //Setting some default values
435  if(this->type.compare("Angle")==0){
436  DataFile* temp = new DataFile(type,dir,fileNames[i], titles[i],cols[i],cuts[i],1.0,i+1);
437  }
438  else if(this->type.compare("Momentum")==0||this->type.compare("XS")==0){
439  DataFile* temp = new DataFile(type,dir,fileNames[i], titles[i],cols[i],cuts[i],dcths[i],i+1);
440  }
441  else{
442  DataFile* temp = new DataFile(type,dir,fileNames[i], titles[i],cols[i],cuts[i],dcths[i],i+1);
443  }
444  return temp;
445 }
446 
447 
448 
449 
450 
451 
452 //**************
453 //MAIN METHOD
454 //**************
455 // Loops through the fFile, generating (and saving) a graph for each Record
456 // Will look for EXPERIMENTAL files in dataDir, GENIE files in ROOTDir, and will
457 // place all saved .png files into saveDir. The directories should not have trailing slashes
458 int rootgINukeVal(char* fFile, char* dataDir = ".", char* ROOTDir = ".",char* saveDir=".")
459 {
460  string tFile (fFile);
461  string dDir (dataDir);
462  int legendSize; //counting entries in legend
463  float TextSize, y1; //adjusted font size and lower bound on legend
464  FormatFile format (tFile);
465  TCanvas* cans;
466  set_root_env();
467  size_t curRecord=1;
468  bool doCurrent = false;
469  doCurrent = format.process(curRecord);
470  if(doCurrent == false){
471  //This if statement shouldn't be necessary, but if it
472  // isn't here, the while loop tries to execute anyways...
473  cout<<"Format File not found"<<endl;
474  return 0;
475  }
476  while(doCurrent == true){
477  cout<<format.numOfType("GENIE")<<" root files and "<<format.numOfType("EXPERIMENTAL")<<" published data files "<<endl;
478 
479  int legendSize = format.numOfType("GENIE") + format.numOfType("EXPERIMENTAL");
480  stringstream convert;
481  //gStyle->SetErrorX(0);
482  //gStyle->SetStyle(genieStyle);
483  set_root_env();
484  Double_t size = 0;
485  Int_t num = 0;
486  Int_t target = 0;
487  Int_t A = 0;
488  Double_t factor = 0;
489  TH1F* htemp = 0;
490  bool good = false;
491  //gROOT->SetStyle("T2K");
492 
493  //the FormatFile class holds the graph limits as strings, converting here
494  Double_t xl, yl, xu, yu;
495  convert.str(format.xl); convert.clear();
496  convert >> xl;
497  convert.str(format.yl); convert.clear();
498  convert >> yl;
499  convert.str(format.xu); convert.clear();
500  convert >> xu;
501  convert.str(format.yu); convert.clear();
502  convert >> yu;
503 
504  //Creating a new canvas and setting some parameters
505  string canName;
506  canName.assign(curRecord,'*');
507  cans= new TCanvas(canName.c_str(),format.fetchGTitle().c_str());
508  cans->cd();
509  TPad* curP = gPad;
510  if(format.logx==true){gPad->SetLogx(1);}
511  if(format.logy==true){gPad->SetLogy(1);}
512 
513  TextSize = .035;
514  y1 = 1.05-(.075*legendSize);//1, .075
515 
516  TLegend* leg1 = new TLegend(.52,y1,1,1,"");//.6
517  leg1->SetTextSize(TextSize);
518  //TLegend* leg1 = new TLegend(.6,.8,1,1,"");
519 
520  //Get the frame, set parameters, redraw frame
521  TH1F* hf1 = (TH1F*) cans->DrawFrame(xl,yl,xu,yu);
522  hf1->SetTitle(format.mtitle.c_str());
523  if(format.type.compare("Angle")==0){
524  hf1->GetXaxis()->SetTitle("cos(#theta)");
525  hf1->GetYaxis()->SetTitle("#frac{d#sigma}{d#Omega} [#frac{mb}{sr}]");
526  }
527  else if(format.type.compare("Momentum")==0){
528  hf1->GetXaxis()->SetTitle("Momentum [Mev]");
529  hf1->GetYaxis()->SetTitle("#frac{d#sigma}{dp} [#frac{mb}{MeV}]");
530  }
531  else if(format.type.compare("XS")==0){
532  hf1->GetXaxis()->SetTitle("Energy [MeV]");
533  hf1->GetYaxis()->SetTitle("#sigma (mb)");
534  }
535  else{
536  hf1->GetXaxis()->SetTitle("Energy [MeV]");
537  hf1->GetYaxis()->SetTitle("#frac{d#sigma}{d#OmegadE} [#frac{mb}{sr#upointMev}]");
538  }
539  //hf1->GetXaxis()->SetNdivisions(-50202);
540  hf1->GetYaxis()->CenterTitle();
541  hf1->Draw();
542 
543 
544  //Loop over each GINUKE file, scaling and drawing each
545  int numRoots = format.numOfType("GENIE");
546  int k;
547  int markerStyle=20;
548 
549 
550  for(k=0;k<numRoots;k++){
551  DataFile* simData = format.makeDataFile(k,ROOTDir,"GENIE");
552  if(format.type.compare("XS")==0){
553  cans->cd();
554  //Do things completely differently
555  int curCol = simData->color;
556  simData->dataTuple->SetMarkerColor(curCol);
557  simData->dataTuple->SetMarkerStyle(markerStyle);
558  markerStyle++;
559  simData->dataTuple->SetLineStyle(2);//2
560  simData->dataTuple->SetLineColor(curCol);
561  cout<<"About to draw tuple"<<endl;
562  //simData->dataTuple->Draw();
563  cout<<simData->cut.c_str()<<endl;
564  simData->dataTuple->Draw(simData->cut.c_str(),"","line psame L");
565  leg1->AddEntry(simData->dataTuple,simData->title.c_str(),"P");
566  cout<<"Tuple drawn"<<endl;
567  }
568  else{
569  TCanvas* tempVas = new TCanvas("tempName","No title");
570  tempVas->cd();
571  //TPad* curP = gPad;
572  string newCut = simData->cut;
573  newCut = newCut +"&&"+simData->cols+"<="+format.xu;
574  newCut = newCut + "&&"+simData->cols+">"+format.xl;
575  simData->dataTree->Draw(simData->cols.c_str(),newCut.c_str(), "L");
576  //tempVas is used in order to not clobber cans's htemp
577  if(simData->valid()){
578 
579  //Grab the associated histogram from tempVas, apply scaling factor
580  htemp = (TH1F*) gPad->GetPrimitive("htemp");
581  TH1F* hist1;
582  TH1F* hist1error;
583  good=false;
584  //Make sure that something actually existed in the cut
585  if (htemp != 0x0) {
586  good=true;
587  hist1 = (TH1F*) htemp->Clone("hist1");
588  size = hist1->GetBinWidth(1);
589  hist1->Sumw2();
590  hist1->Rebin(format.binFactor);
591  num = simData->dataTree->GetEntries();
592  simData->dataTree->SetBranchAddress("tgt",&target);
593  simData->dataTree->GetEntry(1);
594  A = (target/10) - (target/10000)*1000;
595  factor = TMath::Power(3*1.4*TMath::Power(A,(1.0/3.0)),2)*10.0/(2*num*simData->dcth);
596  hist1->Scale(factor,"width");
597  int curCol = simData->color;
598  hist1->SetMarkerColor(curCol);
599  hist1->SetMarkerStyle(markerStyle);
600  markerStyle++;
601  hist1->SetLineStyle(2);
602  hist1->SetLineColor(curCol);
603  }
604  else{
605  cout<<"Nothing was found in the cut of "<<simData->filename<<endl;
606  }
607  if(good){
608  //Draw a copy of histogram to cans on top of any other histograms already there
609  cans->cd();
610  //TPad* curP = gPad;
611  leg1->AddEntry(hist1,simData->title.c_str());
612  hist1->DrawCopy("e1 psame");//e1 psame
613  hist1->Draw("hist l same");
614 
615  //make and draw an extra histogram to have solid error bars
616  hist1error = (TH1F*) hist1->Clone("hist1error");
617  hist1error->SetLineStyle(1);
618  hist1error->DrawCopy("e1 same");
619  }
620  }
621  else{
622  cout<<"Something is wrong with data file "<<simData->filename<<endl;
623  cans->cd();
624  }
625  tempVas->Close();
626  }
627  }
628 
629  //Draw all of the Experimental files, I'm pretty sure that this will only handle
630  // the simple tree type generated from the .txt type data files.
631  cans->cd();
632  TPad* curP = gPad;
633  int numFiles = format.numOfType("EXPERIMENTAL");
634 
635  /*
636  int j = 0;
637 
638  for(j=0;j<3;j++){
639  DataFile* experimental = format.makeDataFile(0,dDir,"EXPERIMENTAL");
640  TGraphErrors* data1;
641  if(format.type.compare("XS")==0){
642  experimental->dataTuple->Draw(experimental->cut.c_str(),"","goff");
643  data1 = new TGraphErrors(experimental->dataTuple->GetSelectedRows(),experimental->dataTuple->GetV1(), experimental->dataTuple->GetV2(),experimental->dataTuple->GetV3(),experimental->dataTuple->GetV4());
644  }
645  else{
646  experimental->dataTree->Draw(experimental->cols.c_str(),"","goff");
647  data1 = new TGraphErrors(experimental->dataTree->GetSelectedRows(),experimental->dataTree->GetV2(), experimental->dataTree->GetV1(),0,experimental->dataTree->GetV3());
648  }
649  //data1->SetLineStyle(0);
650  data1->SetMarkerColor(experimental->color);
651  data1->SetMarkerStyle(markerStyle);
652  markerStyle++;
653  leg1->AddEntry(data1,experimental->title.c_str(),"P");
654  data1->Draw("p same");
655  }
656  */
657 
658  for(j=0;j<numFiles;j++){
659  DataFile* experimental = format.makeDataFile(j,dDir,"EXPERIMENTAL");
660  TGraphErrors* data1;
661  if(format.type.compare("XS")==0){
662  experimental->dataTuple->Draw(experimental->cut.c_str(),"","goff");
663  data1 = new TGraphErrors(experimental->dataTuple->GetSelectedRows(),experimental->dataTuple->GetV1(), experimental->dataTuple->GetV2(),experimental->dataTuple->GetV3(),experimental->dataTuple->GetV4());
664  }
665  else{
666  experimental->dataTree->Draw(experimental->cols.c_str(),"","goff");
667  data1 = new TGraphErrors(experimental->dataTree->GetSelectedRows(),experimental->dataTree->GetV2(), experimental->dataTree->GetV1(),0,experimental->dataTree->GetV3());
668  }
669  data1->SetLineStyle(3);
670  data1->SetMarkerColor(experimental->color);
671  data1->SetMarkerStyle(markerStyle);
672  markerStyle++;
673  leg1->AddEntry(data1,experimental->title.c_str(),"P");
674  data1->Draw("p same");
675  }
676 
677 
678  //Draw the legend
679 
680  //set_root_env();
681  leg1->SetLineWidth(2);
682  leg1->Draw();
683 
684  //add_plot_label("THIS IS A TEST #alpha #Alpha#gamma", .5, .5, .05);
685 
686  //Save the record
687  string saveName(saveDir);
688  saveName = saveName+"/"+format.savename+".png";
689  cans->SaveAs(saveName.c_str());
690 
691  //Try to find the next record
692  curRecord++;
693  cout<<"\nLooking for next record:"<<endl;
694  doCurrent = format.process(curRecord);
695  }
696  cout<<"No more records found, exiting"<<endl;
697  //delete [] entryArray;
698  return 0;
699 }
string dir
Definition: rootgINukeVal.C:79
bool valid()
Definition: rootgINukeVal.C:96
const XML_Char * name
Definition: expat.h:151
bool isValid
Definition: rootgINukeVal.C:89
fileName
Definition: plotROC.py:78
const XML_Char * target
Definition: expat.h:268
Float_t y1[n_points_granero]
Definition: compare.C:5
vector< string > titles
vector< string > cuts
FormatFile(string gtype)
string cols
Definition: rootgINukeVal.C:83
bool process(size_t record)
vector< string > dataSource
bool logy
string trim(string in)
Definition: rootgINukeVal.C:65
TLegend * leg1
Definition: plot_hist.C:105
int numFiles()
string cut
Definition: rootgINukeVal.C:85
void convert(std::string dir="cc_numu/C12")
Definition: convert.C:107
string fFile
float dcth
Definition: rootgINukeVal.C:86
string fetchGTitle()
TH1D * hist1
Definition: plotHisto.C:9
string title
Definition: rootgINukeVal.C:82
TNtuple * dataTuple
Definition: rootgINukeVal.C:99
chain
Check that an output directory exists.
const double j
Definition: BetheBloch.cxx:29
def success(message)
Definition: log.py:5
std::string format(const int32_t &value, const int &ndigits=8)
Definition: HexUtils.cpp:14
int numOfType(string type)
int GetID()
Definition: rootgINukeVal.C:95
int rootgINukeVal(char *fFile, char *dataDir=".", char *ROOTDir=".", char *saveDir=".")
list cans
Definition: canMan.py:12
TTree * dataTree
Definition: rootgINukeVal.C:98
const char * source
Definition: lz4.h:436
procfile open("FD_BRL_v0.txt")
OStream cout
Definition: OStream.cxx:6
DataFile * makeDataFile(int which, string dir=".")
static const double A
Definition: Units.h:82
ifstream in
Definition: comparison.C:7
TFile * file
Definition: rootgINukeVal.C:88
vector< double > dcths
int num
Definition: f2_nu.C:119
vector< string > cols
bool compare(const GFluxGenerator &g1, const GFluxGenerator &g2)
string savename
vector< string > fileNames
int analyzeTextFile()
string getName()
Definition: rootgINukeVal.C:94
string name
Definition: rootgINukeVal.C:81
bool logx
bool GetData()
string mtitle
procfile close()
string gType
Definition: rootgINukeVal.C:84
string filename
Definition: rootgINukeVal.C:80