]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/mapping/AliMpTriggerCrate.cxx
Fix in AliMpSectorSegmentation::PadByPosition;
[u/mrichter/AliRoot.git] / MUON / mapping / AliMpTriggerCrate.cxx
index 30d86b3baa5c3ae2efa0405ee6de77d505b7a1f6..96c5f13d4ad62999526f7369a3e6dea70273a318 100644 (file)
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
+// $Id$
+// $MpId: AliMpTrigger.cxx,v 1.4 2006/05/24 13:58:52 ivana Exp $
 
-//
-// --------------------
+//-----------------------------------------------------------------------------
 // Class AliMpTriggerCrate
 // --------------------
 // The class defines the properties of trigger crate
 // Author: Ch. Finck, Subatech Nantes
+//-----------------------------------------------------------------------------
 
 #include "AliMpTriggerCrate.h"
-#include "AliMpDEManager.h"
 
 #include "AliLog.h"
 
@@ -39,11 +40,18 @@ TString AliMpTriggerCrate::GenerateName(Int_t crateId, Int_t ddlId, Int_t nofDDL
 /// Generate name
 
   TString name;
-  // \todo parameterise this
-  if (crateId == 23)
+
+  if (crateId < 2)
+    name = Form("%d", crateId+1);
+  
+  if (crateId == 2)
       name = "2-3";
-  else 
+  
+  if (crateId > 2)
       name = Form("%d", crateId);
+  
+  if (crateId > 7)
+    printf("crateId index too large\n");
  
   if (ddlId == nofDDLs)
       name.Append("R");
@@ -53,20 +61,21 @@ TString AliMpTriggerCrate::GenerateName(Int_t crateId, Int_t ddlId, Int_t nofDDL
   return name;
 }  
  
-
 //______________________________________________________________________________
-AliMpTriggerCrate::AliMpTriggerCrate(const Char_t* name, Int_t ddlId)
+AliMpTriggerCrate::AliMpTriggerCrate(const Char_t* name, UShort_t id)
   : TNamed(name, "mapping trigger crate"),
-    fDdlId(ddlId),
+    fId(id),
+    fDdlId(-1),
     fLocalBoard(false)
  
 {
-/// Standard constructor
+/// Standard constructor 
 }
 
 //______________________________________________________________________________
 AliMpTriggerCrate::AliMpTriggerCrate(TRootIOCtor* /*ioCtor*/)
   : TNamed(),
+    fId(),
     fDdlId(),
     fLocalBoard()
 {
@@ -86,8 +95,8 @@ AliMpTriggerCrate::~AliMpTriggerCrate()
 //______________________________________________________________________________
 Bool_t AliMpTriggerCrate::AddLocalBoard(Int_t localBoardId)
 {
-/// Add detection element with given detElemId.
-/// Return true if the detection element was added
+/// Add local boards with given detElemId.
+/// Return true if the local board was added
 
   if ( HasLocalBoard(localBoardId) ) {
     AliWarningStream() 
@@ -114,7 +123,10 @@ Int_t  AliMpTriggerCrate::GetLocalBoardId(Int_t index) const
 {  
 /// Return the local board by index (in loop)
 
-  return fLocalBoard.GetValue(index); 
+  if (index >= 0 && index < fLocalBoard.GetSize())
+      return fLocalBoard.GetValue(index); 
+  else 
+      return 0; // begin at 1
 }
 
 //______________________________________________________________________________