]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/mapping/AliMpBusPatch.cxx
Fix in AliMpSectorSegmentation::PadByPosition;
[u/mrichter/AliRoot.git] / MUON / mapping / AliMpBusPatch.cxx
index c5917775c7ad9b03a0b18fe6b0324d7352dea23c..b8e603fbed9af1c05f0d61b4e637dd2198ea59d0 100644 (file)
 
 // $Id$
 // $MpId: AliMpBusPatch.cxx,v 1.4 2006/05/24 13:58:34 ivana Exp $
-//
-// --------------------
+
+//-----------------------------------------------------------------------------
 // Class AliMpBusPatch
 // --------------------
 // The class defines the properties of BusPatch
 // Author: Ivana Hrivnacova, IPN Orsay
+//-----------------------------------------------------------------------------
 
 #include "AliMpBusPatch.h"
+
+#include "AliDAQ.h"
 #include "AliMpConstants.h"
 #include "AliMpDEManager.h"
 #include "AliMpSegmentation.h"
-#include "AliMpSlatSegmentation.h"
 #include "AliMpSlat.h"
 #include "AliMpPCB.h"
 #include "AliMpMotifPosition.h"
@@ -69,7 +71,10 @@ AliMpBusPatch::AliMpBusPatch(Int_t id, Int_t detElemId, Int_t ddlId)
     fDdlId(ddlId),
     fManus(false),
     fNofManusPerModule(false),
-    fCableLength(-1)
+    fCableLength(-1),
+    fCableLabel(),
+    fTranslatorLabel(),
+    fFrtId(0)
 {
 /// Standard constructor
 }
@@ -80,9 +85,12 @@ AliMpBusPatch::AliMpBusPatch(TRootIOCtor* /*ioCtor*/)
     fId(),
     fDEId(),
     fDdlId(),
-    fManus(),
+    fManus(false),
     fNofManusPerModule(false),
-    fCableLength(-1)
+    fCableLength(-1),
+    fCableLabel(),
+    fTranslatorLabel(),
+    fFrtId(0)
 {
 /// Root IO constructor
 }
@@ -122,7 +130,7 @@ Bool_t AliMpBusPatch::SetNofManusPerModule(Int_t manuNumber)
 /// - for stations 2 there maximum two PCBs per buspatch,
 /// - for slat stations there are maximum three PCBs per buspatch
 
-  if ( AliMpDEManager::GetStationType(fDEId) == AliMp::kStation1) {
+  if ( AliMpDEManager::GetStation12Type(fDEId) == AliMq::kStation1) {
 
     // simply fill the number of manus, no bridge for station 1
        
@@ -130,7 +138,7 @@ Bool_t AliMpBusPatch::SetNofManusPerModule(Int_t manuNumber)
     return true;
   }
 
- if ( AliMpDEManager::GetStationType(fDEId) == AliMp::kStation2) {
+ if ( AliMpDEManager::GetStation12Type(fDEId) == AliMq::kStation2) {
 
     // there is max two patch modules per buspatch
        
@@ -143,17 +151,11 @@ Bool_t AliMpBusPatch::SetNofManusPerModule(Int_t manuNumber)
 
   if ( AliMpDEManager::GetStationType(fDEId) == AliMp::kStation345 ) {
   
-    const AliMpSlatSegmentation* seg0 
-       = static_cast<const AliMpSlatSegmentation*>(
-            AliMpSegmentation::Instance()->GetMpSegmentation(fDEId, AliMp::kCath0));
-
-    const AliMpSlatSegmentation* seg1 
-       = static_cast<const AliMpSlatSegmentation*>(
-            AliMpSegmentation::Instance()->GetMpSegmentation(fDEId, AliMp::kCath1));
-
-    const AliMpSlat* slat0 = seg0->Slat();
-    const AliMpSlat* slat1 = seg1->Slat();
+    const AliMpSlat* kSlat0 
+       = AliMpSegmentation::Instance()->GetSlat(fDEId, AliMp::kCath0);
 
+    const AliMpSlat* kSlat1 
+       = AliMpSegmentation::Instance()->GetSlat(fDEId, AliMp::kCath1);
        
     Int_t iPcb = 0;
     Int_t iPcbPrev = -1;
@@ -165,8 +167,8 @@ Bool_t AliMpBusPatch::SetNofManusPerModule(Int_t manuNumber)
     // Loop over manu
     for (Int_t iManu = 0; iManu < GetNofManus(); ++iManu) {
       Int_t manuId = GetManuId(iManu);
-      AliMpMotifPosition* motifPos0 = slat0->FindMotifPosition(manuId);
-      AliMpMotifPosition* motifPos1 = slat1->FindMotifPosition(manuId);          
+      AliMpMotifPosition* motifPos0 = kSlat0->FindMotifPosition(manuId);
+      AliMpMotifPosition* motifPos1 = kSlat1->FindMotifPosition(manuId);         
       
       if ( !motifPos0 && !motifPos1 ) {
         // should never happen
@@ -178,11 +180,11 @@ Bool_t AliMpBusPatch::SetNofManusPerModule(Int_t manuNumber)
       // find PCB id
       if ( motifPos0 ) {
         x = motifPos0->Position().X();
-        length = slat0->GetPCB(0)->DX()*2.;
+        length = kSlat0->GetPCB(0)->DX()*2.;
       }
       if ( motifPos1 ) {
         x = motifPos1->Position().X();
-        length = slat1->GetPCB(0)->DX()*2.;
+        length = kSlat1->GetPCB(0)->DX()*2.;
       }
       
       iPcb = Int_t(x/length + AliMpConstants::LengthTolerance());
@@ -209,6 +211,22 @@ Bool_t AliMpBusPatch::SetNofManusPerModule(Int_t manuNumber)
   return false; 
 }     
 
+//______________________________________________________________________________
+void  AliMpBusPatch::RevertReadout()
+{
+/// Revert order of manus
+
+  fManus.Revert();
+}
+
+//______________________________________________________________________________
+void  AliMpBusPatch::ResetReadout()
+{
+/// Revert order of manus
+
+  fManus.Reset();
+}
+
 //______________________________________________________________________________
 Int_t AliMpBusPatch::GetNofManus() const
 {  
@@ -241,6 +259,15 @@ Int_t  AliMpBusPatch::GetNofPatchModules() const
   return fNofManusPerModule.GetSize();
 }  
   
+//______________________________________________________________________________
+TString
+AliMpBusPatch::GetFRTPosition() const
+{
+  /// Return CRXX-Y-Z where XX is the Crocus number, Y the FRT number
+  /// and Z the local bus patch number.
+  return Form("CR%2d-%d-%d",fDdlId,fFrtId+1,GetLocalBusID(fId,fDdlId));
+}
+
 //______________________________________________________________________________
 Int_t  AliMpBusPatch::GetNofManusPerModule(Int_t patchModule) const
 {
@@ -253,3 +280,52 @@ Int_t  AliMpBusPatch::GetNofManusPerModule(Int_t patchModule) const
   
   return fNofManusPerModule.GetValue(patchModule);
 }     
+
+//______________________________________________________________________________
+void 
+AliMpBusPatch::Print(Option_t* opt) const
+{
+  /// Printout
+  
+  cout << Form("BusPatch %04d DDL %d : %s <> %s / %s",
+               fId,
+               AliDAQ::DdlID("MUONTRK",fDdlId),
+               GetFRTPosition().Data(),
+               fCableLabel.Data(),
+               fTranslatorLabel.Data()) << endl;
+
+  TString sopt(opt);
+  sopt.ToUpper();
+  
+  if ( sopt.Contains("FULL") ) 
+  {
+    cout << Form("Nof of PCBs (i.e. patch modules) = %d",fNofManusPerModule.GetSize()) << endl;
+    
+    for ( Int_t i = 0; i < fNofManusPerModule.GetSize(); ++i ) 
+    {
+      cout << Form("\t\t %d manus in patch module %d",fNofManusPerModule.GetValue(i),i) << endl;
+    }
+    
+    if ( sopt.Contains("MANU") )
+    {
+      cout << "Manus of that buspatch=" << endl;
+      
+      for ( Int_t i = 0; i < fManus.GetSize(); ++i ) 
+      {
+        cout << Form("%4d,",fManus.GetValue(i));
+      }
+      cout << endl;
+    }
+  }
+  
+//  Int_t        fId;     ///< Identifier (unique)
+//  Int_t        fDEId;   ///< Detection element to which this bus patch is connected
+//  Int_t        fDdlId;  ///< DDL to which this bus patch is connected
+//  AliMpArrayI  fManus;  ///< Manu Ids connected to this bus patch
+//  AliMpArrayI  fNofManusPerModule; ///< Nof Manus per patch modules (PCBs)
+//  Float_t      fCableLength;       ///< length of the buspatch cable
+//  TString      fCableLabel;        ///< label of the buspatch cable
+//  TString      fTranslatorLabel;   ///< label of the translator board
+//  Int_t        fFrtId;               ///< FRT Ids connected to this bus patch
+  
+}