]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/mchview.cxx
Small correction for shifts in SSD (M. Van Leeuwen)
[u/mrichter/AliRoot.git] / MUON / mchview.cxx
index 528790d2403c18d1a793d3707c431b0bcf5b87b9..405786df4f0218018b68333f53803da15c0643f4 100644 (file)
 
 
 #include "AliMUONMchViewApplication.h"
-#include "AliMUONPainterHelper.h"
+
 #include "AliCDBManager.h"
 #include "AliCodeTimer.h"
 #include "AliLog.h"
-#include <TROOT.h>
-#include <TStyle.h>
+#include "AliMUONPainterHelper.h"
+#include <Riostream.h>
 #include <TObjArray.h>
 #include <TObjString.h>
-#include <Riostream.h>
+#include <TROOT.h>
+#include <TStyle.h>
 
 //______________________________________________________________________________
 Int_t Usage()
@@ -39,6 +40,9 @@ Int_t Usage()
   /// Printout available options of the program
   cout << "mchview " << endl;
   cout << "  --version : shows the current version of the program" << endl;
+  cout << "  --use filename.root : reuse a previously saved (from this program) root file. Several --use can be used ;-)" << endl;
+  cout << "  --geometry #x#+#+# : manually specify the geometry of the window, ala X11..., e.g. --geometry 1280x900+1600+0 will" << endl;
+  cout << "    get a window of size 1280x900, located at (1600,0) from the top-left of the (multihead) display " << endl;
   return -1;
 }
 
@@ -55,6 +59,11 @@ int main(int argc, char** argv)
   
   Int_t nok(0);
   
+  TObjArray filesToOpen;
+  Bool_t isGeometryFixed(kFALSE);
+  Int_t gix, giy;
+  Int_t gox,goy;
+
   for ( Int_t i = 0; i <= args.GetLast(); ++i ) 
   {
     TString a(static_cast<TObjString*>(args.At(i))->String());
@@ -64,6 +73,25 @@ int main(int argc, char** argv)
       ++nok;
       return 0;
     }
+    if ( a == "--use" && i < args.GetLast() )
+    {
+      filesToOpen.Add(args.At(i+1));
+      ++i;
+      nok += 2;
+    }
+    else if ( a == "--geometry" )
+    {
+      isGeometryFixed = kTRUE;
+      TString g(static_cast<TObjString*>(args.At(i+1))->String());
+      sscanf(g.Data(),"%dx%d+%d+%d",&gix,&giy,&gox,&goy);
+      nok += 2;
+      ++i;
+    }
+    
+    else
+    {
+      return Usage();
+    }
   }
   
   if ( nok < args.GetLast() )
@@ -71,7 +99,7 @@ int main(int argc, char** argv)
     return Usage();
   }
   
-  AliWarningGeneral("main","Remove default storage and run number from here...");
+  AliWarningGeneral("main","FIXME ? Remove default storage and run number from here...");
   
   AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
   AliCDBManager::Instance()->SetRun(0);
@@ -88,11 +116,31 @@ int main(int argc, char** argv)
   colors[n+1] = 1;
   gStyle->SetPalette(n+2,colors);
   delete[] colors;
+
+  UInt_t w(0);
+  UInt_t h(0);
+  UInt_t ox(0);
+  UInt_t oy(0);
+
+  if ( isGeometryFixed )
+  {
+    w = gix;
+    h = giy;
+    ox = gox;
+    oy = goy;
+  }
   
-  TRint* theApp = new AliMUONMchViewApplication("mchview", &argc, argv, 0.7, 0.9);
+  AliMUONMchViewApplication* theApp = new AliMUONMchViewApplication("mchview", &argc, argv, w,h,gox,goy);
    
   AliCodeTimer::Instance()->Print();
 
+  TIter next(&filesToOpen);
+  TObjString* s;
+  while ( ( s = static_cast<TObjString*>(next()) ) )
+  {
+    theApp->Open(s->String().Data());
+  }
+  
   // --- Start the event loop ---
   theApp->Run(kTRUE);