]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/mapping/AliMpDEVisu.cxx
Replacement of AliMpIntPair object with algoritmic
[u/mrichter/AliRoot.git] / MUON / mapping / AliMpDEVisu.cxx
index d8dbf6b3e9b9b1c506b2d6286eabbdbb193e6a8c..bf8da4fe5aeedd3c11b2d1a34e5c0f3ee7bb41ad 100644 (file)
 #include "AliMpSegmentation.h"
 #include "AliMpPad.h"
 #include "AliMpDDLStore.h"
+#include "AliMpManuStore.h"
 #include "AliMpVPadIterator.h"
+#include "AliMpCDB.h"
+#include "AliMpDataStreams.h"
 
 #include "AliLog.h"
 
@@ -89,12 +92,25 @@ AliMpDEVisu::AliMpDEVisu(UInt_t w, UInt_t h)
   fCurrentPlane(AliMp::kBendingPlane),
   fCurrentDetElem(100),
   fCurrentDEName(),
-  fSegmentation(),
-  fDDLStore(AliMpDDLStore::Instance()),
+  fkSegmentation(),
+  fDDLStore(0x0),
+  fManuStore(0x0),
   fZoomMode(false)
 {
 /// Standard constructor
 
+  // Load mapping
+  if ( ! AliMpCDB::LoadDDLStore() ) {
+    AliFatal("Could not access mapping from OCDB !");
+  }
+
+  if ( ! AliMpCDB::LoadManuStore() ) {
+    AliFatal("Could not access run-dependent mapping from OCDB !");
+  }
+
+  fDDLStore = AliMpDDLStore::Instance();
+  fManuStore = AliMpManuStore::Instance();
+
   fTrashList.SetOwner(kFALSE);
   
   // Create canvas widget
@@ -254,7 +270,7 @@ AliMpDEVisu::AliMpDEVisu(UInt_t w, UInt_t h)
   fMain->MapWindow();
   
   // instance segmentation
-  fSegmentation = AliMpSegmentation::Instance()->GetMpSegmentation(fCurrentDetElem, detElem->GetCathodType(fCurrentPlane));
+  fkSegmentation = AliMpSegmentation::Instance()->GetMpSegmentation(fCurrentDetElem, detElem->GetCathodType(fCurrentPlane));
   fLogMessage->AddLine("Segmentation loaded");
   fLogMessage->ShowBottom();
 }
@@ -333,7 +349,7 @@ void AliMpDEVisu::HandleMovement(Int_t eventType, Int_t eventX, Int_t eventY, TO
       EventToReal(eventX,eventY,x,y);
       
       // get manu
-      AliMpPad pad = fSegmentation->PadByPosition(TVector2(x,y), false);
+      AliMpPad pad = fkSegmentation->PadByPosition(TVector2(x,y), false);
       
       if (!pad.IsValid()) {
        
@@ -343,7 +359,7 @@ void AliMpDEVisu::HandleMovement(Int_t eventType, Int_t eventX, Int_t eventY, TO
         return;
       }
       
-      Int_t manu = pad.GetLocation().GetFirst();
+      Int_t manu = pad.GetManuId();
       
       fNumberEntry->SetNumber(manu);
       
@@ -425,9 +441,12 @@ void AliMpDEVisu::DrawSlat(Option_t* option, Bool_t popup)
   
   AliMpDetElement* detElem = AliMpDEManager::GetDetElement(fCurrentDetElem);
   TString nameType =  detElem->GetSegType();
-  
+
+  AliMpDataStreams dataStreams;
+
   AliMpSlatMotifMap mm;
-  AliMpSt345Reader reader(mm);  
+  
+  AliMpSt345Reader reader(dataStreams,&mm);  
   AliMpSlat* slatCurrent = reader.ReadSlat(nameType.Data(), fCurrentPlane);
   AliMpSlat* slatOther   = reader.ReadSlat(nameType.Data(), AliMp::OtherPlaneType(fCurrentPlane));
   
@@ -457,12 +476,14 @@ void AliMpDEVisu::DrawQuadrant(Option_t* option, Bool_t popup)
   canvas->Clear();
   
   AliMpDetElement* detElem = AliMpDEManager::GetDetElement(fCurrentDetElem);
-  AliMp::StationType  station = detElem->GetStationType();
+  AliMq::Station12Type  station = detElem->GetStation12Type();
 
-  AliMpSectorReader readerCurrent(station, fCurrentPlane);
+  AliMpDataStreams dataStreams;
+  
+  AliMpSectorReader readerCurrent(dataStreams, station, fCurrentPlane);
   AliMpSector* sectorCurrent = readerCurrent.BuildSector();
     
-  AliMpSectorReader readerOther(station, AliMp::OtherPlaneType(fCurrentPlane));
+  AliMpSectorReader readerOther(dataStreams, station, AliMp::OtherPlaneType(fCurrentPlane));
   AliMpSector* sectorOther = readerOther.BuildSector();
   
   AliMpVPainter *painter = AliMpVPainter::CreatePainter(sectorCurrent);
@@ -494,7 +515,7 @@ AliMpDEVisu::EventToReal(Int_t eventX, Int_t eventY, Double_t& x, Double_t& y) c
   static TVector2 padDim = br - ul;
   
   // get DE dimension (half size)
-  TVector2 deDim(fSegmentation->Dimensions()*2.0);
+  TVector2 deDim(fkSegmentation->Dimensions()*2.0);
   
   TVector2 padReal;
   
@@ -575,8 +596,7 @@ void AliMpDEVisu::InfoDE()
   Int_t firstBus     = TMath::MinElement(detElem->GetNofBusPatches(), vec);
   Int_t lastBus      = TMath::MaxElement(detElem->GetNofBusPatches(), vec);
   
-  detElem = AliMpDEManager::GetDetElement(fCurrentDetElem);
-  Int_t numberOfSerialManu = detElem->GetNofManus(); // number of manu with an identified serial number
+  Int_t numberOfSerialManu = fManuStore->NofManus(detElem->GetId()); // number of manu with an identified serial number
   
   fLogMessage->AddLine(Form("DrawDE: detection element: %d, name: %s", 
                       fCurrentDetElem, fCurrentDEName.Data()));
@@ -638,7 +658,7 @@ Bool_t AliMpDEVisu::ProcessMessage(Long_t msg, Long_t parm1, Long_t /*parm2*/)
                   fNumberEntry->SetNumber(fNumberEntry->GetIntNumber() - 1024);
               }
               DrawDE();
-              fSegmentation = AliMpSegmentation::Instance()
+              fkSegmentation = AliMpSegmentation::Instance()
                 ->GetMpSegmentation(fCurrentDetElem, detElem->GetCathodType(fCurrentPlane));
               break;
 
@@ -692,7 +712,7 @@ void AliMpDEVisu::UpdateComboCH()
 
     fCurrentDetElem = fDEComboIdx[fDECombo->GetSelected()];
 
-    fSegmentation = AliMpSegmentation::Instance()
+    fkSegmentation = AliMpSegmentation::Instance()
        ->GetMpSegmentation(fCurrentDetElem, detElem->GetCathodType(fCurrentPlane));
 }
 
@@ -743,7 +763,7 @@ void AliMpDEVisu::UpdateNameView(Bool_t firstTime)
   }
 
   fNameDECombo->Select(fDEOccurrence[fCurrentDetElem]);
-  fSegmentation = AliMpSegmentation::Instance()
+  fkSegmentation = AliMpSegmentation::Instance()
     ->GetMpSegmentation(fCurrentDetElem, detElem->GetCathodType(fCurrentPlane));
 }
 
@@ -780,11 +800,11 @@ void AliMpDEVisu::PopUpManuMotif(AliMpSlat* slat)
   AliMpMotifPosition* motifPos = 0x0;
   Int_t manuId = 0;
 
-  for ( AliMpSlat::Size_t i = 0; i < slat->GetSize(); ++i ) {
+  for ( Int_t i = 0; i < slat->GetSize(); ++i ) {
     
     AliMpPCB* pcb = slat->GetPCB(i);
     
-    for ( AliMpPCB::Size_t j = 0; j < slat->GetPCB(i)->GetSize(); ++j ) {
+    for ( Int_t j = 0; j < slat->GetPCB(i)->GetSize(); ++j ) {
       
       motifPos = pcb->GetMotifPosition(j);
       
@@ -829,8 +849,8 @@ void AliMpDEVisu::PopUpManuMotif(AliMpSector* sector)
     
     for (Int_t iRowSeg = 0; iRowSeg < sector->GetRow(iRow)->GetNofRowSegments(); ++iRowSeg){
       
-      for (Int_t iRowSeg = 0; iRowSeg < row->GetNofRowSegments(); ++iRowSeg) {
-        AliMpVRowSegment *rowSegment = row->GetRowSegment(iRowSeg);
+      for (Int_t iRowSeg2 = 0; iRowSeg2 < row->GetNofRowSegments(); ++iRowSeg2) {
+        AliMpVRowSegment *rowSegment = row->GetRowSegment(iRowSeg2);
         
         for (Int_t iMotif = 0; iMotif < rowSegment->GetNofMotifs(); ++iMotif){
           
@@ -887,9 +907,9 @@ void AliMpDEVisu::InfoManuMotif(AliMpMotifPosition* motifPos)
                               motifPos->GetMotif()->GetPadDimensions(0).Y()*2. ));
 
     fLogMessage->AddLine( Form("PopupManuMotif: manu: %d, serial number: %d, buspatch: %d",
-                              manuId, 
-                              fDDLStore->GetDetElement(fCurrentDetElem)->GetManuSerialFromId(manuId),
-                              fDDLStore->GetBusPatchId(fCurrentDetElem, manuId)) );
+                             manuId, 
+                             fManuStore->GetManuSerial(fCurrentDetElem, manuId),
+                             fDDLStore->GetBusPatchId(fCurrentDetElem, manuId)) );
 
     fLogMessage->ShowBottom();
 
@@ -919,7 +939,7 @@ void AliMpDEVisu::PopUpZoom(Int_t ix0, Int_t iy0, Int_t ix1, Int_t iy1)
   
   if ( area.IsValid() )
   {
-    AliMpVPadIterator* iterator = fSegmentation->CreateIterator(area);
+    AliMpVPadIterator* iterator = fkSegmentation->CreateIterator(area);
     if (iterator)
     {
       AliMpVPainter* painter = AliMpVPainter::CreatePainter(iterator);