]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONVPainter.cxx
Separating run-dependent mapping data from data, which are not
[u/mrichter/AliRoot.git] / MUON / AliMUONVPainter.cxx
index ee24707cdc0894604afc9a53da27976142203d4e..cdfe4c0fde959493f0dce5cff5be90bc8c451986 100644 (file)
 
 #include "AliCodeTimer.h"
 #include "AliLog.h"
+#include "AliMUON2DMap.h"
+#include "AliMUONCalibParamND.h"
+#include "AliMUONPainterRegistry.h"
+#include "AliMpManuUID.h"
 #include "AliMUONObjectPair.h"
 #include "AliMUONPainterContour.h"
 #include "AliMUONPainterGroup.h"
 ClassImp(AliMUONVPainter)
 ///\endcond
 
+//_____________________________________________________________________________
+AliMUONVPainter::AliMUONVPainter(TRootIOCtor*) : TObject(), 
+TQObject(),
+fHistogram(0x0),
+fName(""),
+fPathName(""),
+fType(""),
+fMother(0x0),
+fGroup(0x0),
+fContour(0x0),
+fPainterGroups(0x0),
+fChildren(0x0),
+fResponderGroup(0x0),
+fPlotterGroup(0x0),
+fBorderFactor(1.1),
+fPad(0x0),
+fAttributes(),
+fLineColor(1),
+fLineWidth(1),
+fIsValid(kTRUE)
+{
+  /// streamer ctor
+}
+
 //_____________________________________________________________________________
 AliMUONVPainter::AliMUONVPainter(const char* type)
 : TObject(), 
   TQObject(),
+  fHistogram(0x0),
   fName(""),
   fPathName(""),
   fType(type),
@@ -111,8 +140,7 @@ AliMUONVPainter::AliMUONVPainter(const char* type)
   fAttributes(),
   fLineColor(1),
   fLineWidth(1),
-  fIsValid(kTRUE),
-  fHistogram(0x0)
+  fIsValid(kTRUE)
 {
     /// ctor
     SetID(-1,-1);
@@ -122,6 +150,7 @@ AliMUONVPainter::AliMUONVPainter(const char* type)
 AliMUONVPainter::AliMUONVPainter(const AliMUONVPainter& rhs)
 : TObject(rhs),
 TQObject(),
+fHistogram(0x0),
 fName(""),
 fPathName(""),
 fType(""),
@@ -137,8 +166,7 @@ fPad(0x0),
 fAttributes(),
 fLineColor(-1),
 fLineWidth(-1),
-fIsValid(kTRUE),
-fHistogram(0x0)
+fIsValid(kTRUE)
 {
   /// copy ctor
   rhs.Copy(*this);
@@ -719,6 +747,12 @@ AliMUONVPainter::Paint(Option_t*)
   {
     PaintOutline();
   }
+  
+  if ( IsExcluded() )
+  {
+    fContour->PaintArea(2);
+    fContour->PaintOutline(1,1);
+  }
 }
 
 //_____________________________________________________________________________
@@ -736,6 +770,7 @@ AliMUONVPainter::PaintArea(const AliMUONVTrackerData&, Int_t, Double_t, Double_t
 {
   /// Default implementation (must be overriden)
   AliError(Form("%s : implement me",GetName()));
+  return;
 }
 
 //_____________________________________________________________________________
@@ -857,6 +892,11 @@ AliMUONVPainter::SetData(const char* pattern, AliMUONVTrackerData* data,
     CreateGroups();
   }
   
+  if ( data ) 
+  {
+    data->Connect("Destroyed()",ClassName(),this,Form("SetData(=\"%s\",0x0,-1)",pattern));
+  }
+  
   TIter next(fPainterGroups);
   TObjString* str;
   
@@ -893,50 +933,94 @@ AliMUONVPainter::SetData(const char* pattern, AliMUONVTrackerData* data,
   {
     TList* l = p->IsA()->GetMenuList();
   
-    l->Clear();
+    l->Delete();
   
-    if ( group ) 
+    TClassMenuItem* n(0x0);
+    
+    l->Add(new TClassMenuItem(TClassMenuItem::kPopupUserFunction,p->IsA(),
+                              "Include","Include",p,"",-1,kTRUE));
+    l->Add(new TClassMenuItem(TClassMenuItem::kPopupUserFunction,p->IsA(),
+                              "Exclude","Exclude",p,"",-1,kTRUE));    
+    
+    if ( group )  
     {
-      Int_t dim = group->Data()->InternalToExternal(group->DataIndex());
-      if ( dim < group->Data()->ExternalDimension() )
-      {      
-        if ( data && data->IsHistogrammed(dim) ) 
-        {
-          // Add histo drawing to the popup menu
-          TClassMenuItem* n = new TClassMenuItem(TClassMenuItem::kPopupUserFunction,p->IsA(),
-                                                 "Draw histogram","DrawHistogram",p,"",-1,kTRUE);
-          l->AddFirst(n);
-          
-          n = new TClassMenuItem(TClassMenuItem::kPopupUserFunction,p->IsA(),
-                                 "Draw histogram clone","DrawHistogramClone",p,"",-1,kTRUE);
-          l->AddFirst(n);
-          
-          
-        }
+      if ( data && data->IsHistogrammed(0) ) 
+      {
+        // Add histo drawing to the popup menu
+        TString name("Draw histogram of ");
+        
+        name += data->ExternalDimensionName(0);
+        
+        n = new TClassMenuItem(TClassMenuItem::kPopupUserFunction,p->IsA(),
+                               name.Data(),"DrawHistogram0",p,"",-1,kTRUE);
+        l->Add(n);
+        
+        name += " clone";
+        
+        n = new TClassMenuItem(TClassMenuItem::kPopupUserFunction,p->IsA(),
+                               name.Data(),"DrawHistogramClone0",p,"",-1,kTRUE);
+        l->Add(n);
       }
+      
+      Int_t nd = data->IsSingleEvent() ? data->ExternalDimension() : data->ExternalDimension()*2;
+      
+      for ( Int_t i = 0; i < nd; ++i ) 
+      {
+        n = new TClassMenuItem(TClassMenuItem::kPopupUserFunction,p->IsA(),
+                               Form("Draw %s clone",data->DimensionName(i).Data()),
+                               Form("DrawInternalHistogramClone%d",i),p,"",-1,kTRUE);
+        l->Add(n);
+      } 
     }
   }
 }
 
 //_____________________________________________________________________________
 void
-AliMUONVPainter::DrawHistogram() const
+AliMUONVPainter::DrawInternalHistogram(Int_t dim) const
+{
+  /// Draw histogram (and delete the previous one)
+  
+  delete fHistogram;
+  fHistogram = 0x0;
+  
+  DrawInternalHistogramClone(dim);
+}
+
+//_____________________________________________________________________________
+void
+AliMUONVPainter::DrawInternalHistogramClone(Int_t dim) const
+{
+  /// Draw histogram 
+  
+  fHistogram = AliMUONTrackerDataHistogrammer::CreateHisto(*this,-1,dim);
+  
+  if (fHistogram) 
+  {
+    new TCanvas();
+    fHistogram->Draw();
+  }
+}
+
+//_____________________________________________________________________________
+void
+AliMUONVPainter::DrawHistogram(Double_t* values) const
 {
   /// Draw histogram (and delete the previous one)
 
   delete fHistogram;
   fHistogram = 0x0;
   
-  DrawHistogramClone();
+  DrawHistogramClone(values);
 }
 
 //_____________________________________________________________________________
 void
-AliMUONVPainter::DrawHistogramClone() const
+AliMUONVPainter::DrawHistogramClone(Double_t*) const
 {
   /// Draw histogram 
   
-  fHistogram = AliMUONTrackerDataHistogrammer::CreateHisto(*this);
+  fHistogram = AliMUONTrackerDataHistogrammer::CreateHisto(*this,0,-1);
   
   if (fHistogram) 
   {
@@ -1161,6 +1245,86 @@ AliMUONVPainter::UpdateGroupsFrom(const AliMUONVPainter& painter)
     
     SetLine(group->Depth(),group->GetLineColor(),group->GetLineWidth());
   }
+  
+}
+
+//_____________________________________________________________________________
+void
+AliMUONVPainter::Include()
+{
+  /// Include this painter
+  AliInfo(GetName());
+  
+  /// Update the global interactive read out configuration  
+  WriteIROC(1);
+}
+
+//_____________________________________________________________________________
+void
+AliMUONVPainter::GetIROCManuList(TObjArray& manuList)
+{
+  /// Get the list of manus spanned by this painter AND by its dual
+
+  FillManuList(manuList);
+  
+  // get our dual
+  AliMUONAttPainter att(Attributes());
+  
+  att.Invert();
+  
+  att.SetCathodeAndPlaneDisabled(kTRUE);
+  
+  AliMUONVPainter* p = AliMUONVPainter::CreatePainter(ClassName(),att,ID0(),ID1());
+  
+  if (p)
+  {
+    p->FillManuList(manuList);
+  }
+  
+  delete p;
+}
+
+//_____________________________________________________________________________
+void
+AliMUONVPainter::WriteIROC(Double_t value)
+{
+  /// Update the interactive readout configuration
+  
+  TObjArray manuList;
+  GetIROCManuList(manuList);
+  
+  AliMpManuUID* muid;
+  TIter nextm(&manuList);
+  AliMUON2DMap store(true);
+  
+  while ((muid=static_cast<AliMpManuUID*>(nextm())))
+  {
+    AliMUONVCalibParam* param = new AliMUONCalibParamND(1,64,
+                                                        muid->DetElemId(),
+                                                        muid->ManuId(),value);
+    store.Add(param);
+  }
+  
+  InteractiveReadOutConfig()->Replace(store);
+}
+
+//_____________________________________________________________________________
+void
+AliMUONVPainter::Exclude()
+{
+  /// Exclude this painter
+  AliInfo(GetName());
+  
+  /// Update the global interactive read out configuration
+  WriteIROC(0.0);
+}
+
+//_____________________________________________________________________________
+AliMUONVTrackerData*
+AliMUONVPainter::InteractiveReadOutConfig() const
+{
+  /// get the interactive readout config object
+  return AliMUONPainterRegistry::Instance()->InteractiveReadOutConfig();
 }
 
 //_____________________________________________________________________________