]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/mchview.cxx
Small bug fix (which should have no influence online)
[u/mrichter/AliRoot.git] / MUON / mchview.cxx
index 47b4c3920b2edad8a6be3ac4dfcdf501a83bef71..f39a511870c6dfa45e6f348900c5e2cd0912ac5a 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>
+
+#include "AliMpDataProcessor.h"
+#include "AliMpDataMap.h"
+#include "AliMpDataStreams.h"
+#include "AliMpDDLStore.h"
+
 
 //______________________________________________________________________________
 Int_t Usage()
@@ -40,6 +47,9 @@ Int_t Usage()
   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;
+  cout << "  --asciimapping : load mapping from ASCII files instead of OCDB (for debug and experts only...)" << endl;
   return -1;
 }
 
@@ -57,6 +67,10 @@ int main(int argc, char** argv)
   Int_t nok(0);
   
   TObjArray filesToOpen;
+  Bool_t isGeometryFixed(kFALSE);
+  Int_t gix, giy;
+  Int_t gox,goy;
+  Bool_t ASCIImapping(kFALSE);
   
   for ( Int_t i = 0; i <= args.GetLast(); ++i ) 
   {
@@ -73,6 +87,19 @@ int main(int argc, char** argv)
       ++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 if ( a == "--asciimapping" )
+    {
+      ASCIImapping = kTRUE;
+    }
+    
     else
     {
       return Usage();
@@ -84,11 +111,19 @@ 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()->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
   AliCDBManager::Instance()->SetRun(0);
  
+  if ( ASCIImapping ) 
+  {
+    AliMpDataProcessor mp;
+    AliMpDataMap* map = mp.CreateDataMap("data");
+    AliMpDataStreams dataStreams(map);
+    AliMpDDLStore::ReadData(dataStreams);
+  }
+  
   gROOT->SetStyle("Plain");  
   gStyle->SetPalette(1);
   Int_t n = gStyle->GetNumberOfColors();
@@ -101,8 +136,21 @@ 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;
+  }
   
-  AliMUONMchViewApplication* theApp = new AliMUONMchViewApplication("mchview", &argc, argv, 0.7, 0.9);
+  AliMUONMchViewApplication* theApp = new AliMUONMchViewApplication("mchview", &argc, argv, w,h,gox,goy);
    
   AliCodeTimer::Instance()->Print();
 
@@ -116,5 +164,5 @@ int main(int argc, char** argv)
   // --- Start the event loop ---
   theApp->Run(kTRUE);
 
-  AliMUONPainterHelper::Instance()->Save();
+  delete AliMUONPainterHelper::Instance(); // important to trigger the saving of the env. file
 }