ATLAS Offline Software
Functions
trackplotter.cxx File Reference
#include "trackplotter.h"
#include "TROOT.h"
#include "TApplication.h"
#include "TGTableLayout.h"
#include "TGFrame.h"
#include "TList.h"
#include "TGWindow.h"
#include "TRootEmbeddedCanvas.h"
#include "TEllipse.h"
#include "TBox.h"
#include "TArrow.h"
#include "TPolyLine.h"
#include "TGButton.h"
#include "TCanvas.h"
#include "TRandom.h"
#include "TGDoubleSlider.h"
#include "TGaxis.h"
#include "TColor.h"
#include "Riostream.h"
#include "TEnv.h"
#include "PlotValNtuple.h"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 569 of file trackplotter.cxx.

569  {
570 // TApplication theApp("App", &argc, argv);
571 
572  if (gROOT->IsBatch()) {
573  fprintf(stderr, "%s: cannot run in batch mode\n", argv[0]);
574  return 1;
575  }
576  // -----------------------------------
577  // Read the current TrackPlotter setup
578 
579  // get the TEnv object
580  TEnv* trackPlotterSetup = new TEnv("trackplotter.conf");
581  // get the ntuple filename
582  //char *filename = new char[80];
583  const char* filename = trackPlotterSetup->GetValue("TrackingNtupleFileName","TrkValidation.root");
584  // track ntuple directory and tree name
585  //char *trackNtupleDir = new char[80];
586  const char* trackNtupleDir = trackPlotterSetup->GetValue("TrackingNtupleDirectory","Validation");
587  //char *trackNtupleTree = new char[80];
588  const char* trackNtupleTree = trackPlotterSetup->GetValue("TrackingNtupleTree","Tracks");
589 
590  // use DAF data?
591  bool doDAFdata = false;
592  doDAFdata = trackPlotterSetup->GetValue("PlotDAFdata",0);
593 
594  // use RIO data?
595  bool doRIOdata = true;
596  doRIOdata = trackPlotterSetup->GetValue("PlotPrepRawData", 1);
597  //std::cout << "use RIO: -" << trackPlotterSetup->GetValue("PlotPrepRawData", "True") <<"-" << std::endl;
598  // rio ntuple directory and tree name
599  //char *rioNtupleDir = new char[80];
600  const char* rioNtupleDir = trackPlotterSetup->GetValue("PrepRawDataNtupleDirectory","Validation");
601  //char *trackNtupleTree = new char[80];
602  const char* rioNtupleTree = trackPlotterSetup->GetValue("PrepRawDataNtupleTree","TRT_RIOs");
603 
604 // trackPlotterSetup->SetValue("TrackingNtupleFileName", filename);
605 // trackPlotterSetup->SetValue("TrackingNtupleDirectory", trackNtupleDir);
606 // trackPlotterSetup->SetValue("TrackingNtupleTree", trackNtupleTree);
607 // trackPlotterSetup->SetValue("PlotDAFdata", doDAFdata);
608 // trackPlotterSetup->SetValue("PlotPrepRawData", doRIOdata);
609 // trackPlotterSetup->SetValue("PrepRawDataNtupleDirectory", rioNtupleDir);
610 // trackPlotterSetup->SetValue("PrepRawDataNtupleTree", rioNtupleTree);
611 // trackPlotterSetup->Save();
612  trackPlotterSetup->Print();
613 
614  TColor *color_301 = new TColor(301,0.7,0.0,0.0,"");
615  TColor *color_302 = new TColor(302,0.0,0.7,0.0,"");
616  TColor *color_303 = new TColor(303,0.0,0.0,0.7,"");
617  TColor *color_306 = new TColor(306,0.7,0.0,0.7,"");
618  TColor *color_310 = new TColor(310,0.8,0.8,0.8,"");
619  TColor *color_311 = new TColor(311,0.55,0.0,0.0,"");
620 
621 // int trackNumber = 0;
622  if ( argc >= 2 ){ // argc should be 2 for correct execution
623  //delete[] filename;
624  filename = argv[1];
625  }else {
626  // We print argv[0] assuming it is the program name
627  std::cout<<"usage: "<< argv[0] <<" <filename>"<< std::endl;
628  //filename = "TrkValidation.root";
629 // trackNumber = atoi(argv[2]);
630  }
631  //if ( argc >= 3 ){
632  // doDAFdata = bool(argv[2]);
633  //}
634  std::cout<<"Using file "<<filename << (doRIOdata ? " including PrepRawData" : "") << (doDAFdata ? " with DAF information" : "") << std::endl;
635 
636  TApplication theApp("App", &argc, argv);
637  TFile *f = new TFile(filename);
638  if (!f) {
639  std::cout << "ERROR: could not find " << filename << std::endl;
640  return 1;
641  }
642 
643  char rootFileName[100];
644  sprintf(rootFileName,"%s:/%s",filename, trackNtupleDir);
645  //std::cout<<"cd: "<<rootFileName << std::endl;
646  f->cd(rootFileName);
647 
648  TTree *tree = (TTree*)gDirectory->Get(trackNtupleTree);
649  if (!tree) {
650  std::cout << "ERROR: could not get the tree: " << filename << ":/" << trackNtupleDir << "/" << trackNtupleTree << std::endl;
651  return 1;
652  }
653  //delete filename;
654  // get the ntuple with the track data
655  TrackDataNtupleTree* trackNtuple = new TrackDataNtupleTree(tree, doDAFdata);
656 
657  //std::cout<<"got TrackDataNtupleTree"<< std::endl;
658  // get the RIOs
659 
660  sprintf(rootFileName,"%s:/%s",filename, rioNtupleDir);
661  //f->cd("TrkValidation.root:/FitterValidation");
662  //std::cout<<"cd: "<<rootFileName << std::endl;
663  f->cd(rootFileName);
664 
665  TTree *RIOtree = 0;
666  TrkValidationNtupleRIOs* rioNtuple = 0;
667  if (doRIOdata) {
668  RIOtree = (TTree*)gDirectory->Get(rioNtupleTree);
669  if (!RIOtree) {
670  std::cout << "ERROR: could not get the tree: " << filename << ":/" << rioNtupleDir << "/" << rioNtupleTree << std::endl;
671  return 1;
672  }
673  // get the ntuple with the rio data
674  rioNtuple = new TrkValidationNtupleRIOs(RIOtree);
675  }
676  //delete filename;
677 
678  PlotValNtuple theNtuplePlotter( *trackNtuple, rioNtuple);
679 
680  Viewer viewer(gClient->GetRoot(), &theNtuplePlotter);
681 
682  theApp.Run();
683 
684  delete color_301; delete color_302;
685  delete color_303; delete color_306;
686  delete color_310; delete color_311;
687  delete trackNtuple;
688  delete rioNtuple;
689  return 0;
690 }
Viewer
Definition: trackplotter.h:23
tree
TChain * tree
Definition: tile_monitor.h:30
TrkValidationNtupleRIOs
Definition: TrkValidationNtupleRIOs.h:26
get_generator_info.stderr
stderr
Definition: get_generator_info.py:40
PlotValNtuple
Definition: PlotValNtuple.h:28
ParseInputs.gDirectory
gDirectory
Definition: Final2012/ParseInputs.py:133
LArCellNtuple.argv
argv
Definition: LArCellNtuple.py:152
TrackDataNtupleTree
this class inherites from the automatically created TrkValidationNtupleOutputTrack to have independen...
Definition: TrackDataNtupleTree.h:16
hist_file_dump.f
f
Definition: hist_file_dump.py:135
DQHistogramMergeRegExp.argc
argc
Definition: DQHistogramMergeRegExp.py:20
CaloCellTimeCorrFiller.filename
filename
Definition: CaloCellTimeCorrFiller.py:24
python.AppMgr.theApp
theApp
Definition: AppMgr.py:771