]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONMchViewApplication.cxx
macro to fill Centrality OADB
[u/mrichter/AliRoot.git] / MUON / AliMUONMchViewApplication.cxx
index 9476c89f7e870fd0430eb5429ea2834f4267f5f3..b5ffc608cf114c7e3c6d0496d07b0a3a4cd74438 100644 (file)
@@ -26,7 +26,9 @@
 #include "AliMUONPainterDataSourceFrame.h"
 #include "AliMUONPainterEnv.h"
 #include "AliMUONPainterHelper.h"
+#include "AliMUONPainterGroup.h"
 #include "AliMUONPainterMasterFrame.h"
+#include "AliMUONPainterMatrix.h"
 #include "AliMUONPainterRegistry.h"
 #include "AliMUONTrackerDataCompareDialog.h"
 #include "AliMUONTrackerDataWrapper.h"
@@ -77,14 +79,15 @@ AliMUONMchViewApplication::AliMUONMchViewApplication(const char* name,
                                                      UInt_t ox, UInt_t oy) 
 : TRint(name,argc,argv),
   fMainFrame(0x0),
-  fPainterMasterFrame(0x0)
+  fPainterMasterFrameList(new TList),
+  fTabs(0x0)
 {
 
   /// ctor
   /// (w,h) is the size in pixel (if 0,0 it will be computed as 70%,90% of display size)
   /// (ox,oy) is the offset from the top-left of the display
 
-  if (!w | !h)
+  if (!w || !h)
   {
     w = (UInt_t)(gClient->GetDisplayWidth()*0.7);
     h = (UInt_t)(gClient->GetDisplayHeight()*0.9); 
@@ -92,46 +95,50 @@ AliMUONMchViewApplication::AliMUONMchViewApplication(const char* name,
 
   fMainFrame = new TGMainFrame(gClient->GetRoot(),w,h);
 
-  AliMUONPainterHelper::Instance()->GenerateDefaultMatrices();
-
   CreateMenuBar(w);
 
   const Int_t kbs = 2;
   
 //  h -= 60; // menubar
   
-  TGTab* tabs = new TGTab(fMainFrame,w,h);
+  fTabs = new TGTab(fMainFrame,w,h);
+  
+  TGCompositeFrame* t = fTabs->AddTab("Painter Master Frame");
+
+  fPainterMasterFrameList->SetOwner(kTRUE);
+  
   
-  TGCompositeFrame* t = tabs->AddTab("Painter Master Frame");
+  AliMUONPainterMasterFrame* pmf = new AliMUONPainterMasterFrame(t,t->GetWidth()-kbs*2,t->GetHeight()-kbs*2,
+                                                                 GenerateStartupMatrix());
 
-  fPainterMasterFrame =
-    new AliMUONPainterMasterFrame(t,t->GetWidth()-kbs*2,t->GetHeight()-kbs*2);
+  fPainterMasterFrameList->Add(pmf);
   
-  t->AddFrame(fPainterMasterFrame, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY,kbs,kbs,kbs,kbs));
+  t->AddFrame(pmf, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY,kbs,kbs,kbs,kbs));
 
-  t = tabs->AddTab("Data Sources");
+  t = fTabs->AddTab("Data Sources");
   
   AliMUONPainterDataSourceFrame* dsf = 
     new AliMUONPainterDataSourceFrame(t,t->GetWidth()-kbs*2,t->GetHeight()-kbs*2);
   
   t->AddFrame(dsf,new TGLayoutHints(kLHintsExpandX | kLHintsExpandY,kbs,kbs,kbs,kbs));
   
-  fMainFrame->AddFrame(tabs,new TGLayoutHints(kLHintsExpandX | kLHintsExpandY,0,0,0,0));
+  fMainFrame->AddFrame(fTabs,new TGLayoutHints(kLHintsExpandX | kLHintsExpandY,0,0,0,0));
 
   fMainFrame->SetWindowName("mchview - Visualization of MUON Tracker detector");
 
   fMainFrame->MapSubwindows();
   fMainFrame->Resize();
   
-  fPainterMasterFrame->Update();
+  pmf->Update();
   
   fMainFrame->MapWindow();
   
   fMainFrame->Connect("CloseWindow()","AliMUONMchViewApplication",this,"Terminate()");
 
-  fMainFrame->MoveResize(ox,oy, w, h); 
+//  fMainFrame->MoveResize(ox,oy, w, h); 
   fMainFrame->SetWMPosition(ox, oy);
-  fMainFrame->SetWMSizeHints(w,h,w,h,0,0);
+//  fMainFrame->SetWMSizeHints(w,h,w,h,0,0);
+//  fMainFrame->SetWMSizeHints(w,h,w,h,10,10);
   
   cout << "***************************************************" << endl;
   cout << "   Welcome to mchview" << endl;
@@ -190,9 +197,9 @@ AliMUONMchViewApplication::AliMUONMchViewApplication(const char* name,
   
   if ( painter ) 
   {
-    fPainterMasterFrame->ShiftClicked(painter,0x0);
+    pmf->ShiftClicked(painter,0x0);
     
-    fPainterMasterFrame->Update();
+    pmf->Update();
   }
       
 }
@@ -201,6 +208,44 @@ AliMUONMchViewApplication::AliMUONMchViewApplication(const char* name,
 AliMUONMchViewApplication::~AliMUONMchViewApplication()
 {
   /// dtor
+  delete fPainterMasterFrameList;
+}
+
+//_____________________________________________________________________________
+AliMUONPainterMatrix*
+AliMUONMchViewApplication::GenerateStartupMatrix()
+{
+  /// Kind of bootstrap method to trigger the generation of all contours
+  
+  AliCodeTimerAuto("",0);
+  
+  AliMUONAttPainter att;
+  
+  att.SetViewPoint(kTRUE,kFALSE);
+  att.SetCathode(kFALSE,kFALSE);
+  att.SetPlane(kTRUE,kFALSE);
+
+  AliMUONPainterMatrix* matrix = new AliMUONPainterMatrix("Tracker",5,2);
+    
+  for ( Int_t i = 0; i < 10; ++i )
+  {
+    AliMUONVPainter* painter = new AliMUONChamberPainter(att,i);
+    
+    painter->SetResponder("Chamber");
+    
+    painter->SetOutlined("*",kFALSE);
+    
+    painter->SetOutlined("MANU",kTRUE);
+    
+    for ( Int_t j = 0; j < 3; ++j ) 
+    {
+      painter->SetLine(j,1,4-j);
+    }
+    
+    matrix->Adopt(painter);    
+  }
+  AliMUONPainterRegistry::Instance()->Register(matrix);
+  return matrix;
 }
 
 //______________________________________________________________________________
@@ -222,8 +267,7 @@ AliMUONMchViewApplication::CompareData()
   t->SetWindowName("mchview compare data tool");
   t->SetIconName("mchview compare data tool");
   
-  t->MapRaised();
-  
+  t->MapRaised();  
 }
 
 //______________________________________________________________________________
@@ -398,7 +442,16 @@ AliMUONMchViewApplication::PrintAs()
   new TGFileDialog(gClient->GetRoot(),gClient->GetRoot(),
                    kFDSave,&fileInfo);
   
-  fPainterMasterFrame->SaveAs(gSystem->ExpandPathName(Form("%s",fileInfo.fFilename)));
+  TIter next(fPainterMasterFrameList);
+  AliMUONPainterMasterFrame* pmf;
+  Bool_t first(kTRUE);
+  
+  while ( ( pmf = static_cast<AliMUONPainterMasterFrame*>(next()) ) )
+  {
+    pmf->SaveAs(gSystem->ExpandPathName(Form("%s",fileInfo.fFilename)),
+                first ? "RECREATE" : "UPDATE");
+    first = kFALSE;
+  }
 }
 
 //______________________________________________________________________________
@@ -414,6 +467,46 @@ AliMUONMchViewApplication::ReleaseNotes()
   
   TGTextView* rn = new TGTextView(t);
 
+  rn->AddLine("1.10");
+  rn->AddLine("");
+  rn->AddLine("Make the raw OCDB more obvious in the data source tab");
+  rn->AddLine("");
+  
+  rn->AddLine("1.08");
+  rn->AddLine("");
+  rn->AddLine("Changed the default OCDB to 2011 version");
+  rn->AddLine("");
+  
+  rn->AddLine("1.07");
+  rn->AddLine("");
+  rn->AddLine("Added the RejectList as a possible OCDB data source");
+  rn->AddLine("");
+  
+  rn->AddLine("1.06");
+  rn->AddLine("");
+  rn->AddLine("Changed a bit the HV display. Now a trip is indicated with a value of -1");
+  rn->AddLine("");
+  
+  rn->AddLine("1.05");
+  rn->AddLine("");
+  rn->AddLine("Added the possibility to select an event range when reading raw data");
+  rn->AddLine("Usefull e.g. to look at a single suspect event...");
+  rn->AddLine("");
+  
+  rn->AddLine("1.04");
+  rn->AddLine("");
+  rn->AddLine("Changed the default OCDB to 2010 version");
+  rn->AddLine("");
+  
+  rn->AddLine("1.03");
+  rn->AddLine("");
+  rn->AddLine("Add Print buttons");
+  rn->AddLine("Add the automatic creation of often used canvases when using pedestal source");
+  // Internal reorganization to allow several independent tabs to be created to 
+  // show different master frames (not used yet). Important for the moment
+  // is the ability to create a PainterMatrix and pass it to the PainterMasterFrame
+  rn->AddLine("");
+  
   rn->AddLine("1.02");
   rn->AddLine("");
   rn->AddLine("Internal change (merging of AliMUONTrackerACFDataMaker and AliMUONTrackerOCDBDataMaker into AliMUONTrackerConditionDataMaker)");