LCOV - code coverage report
Current view: top level - MUON/MUONmapping - AliMpTriggerCrate.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 37 42 88.1 %
Date: 2016-06-14 17:26:59 Functions: 13 13 100.0 %

          Line data    Source code
       1             : /**************************************************************************
       2             :  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
       3             :  *                                                                        *
       4             :  * Author: The ALICE Off-line Project.                                    *
       5             :  * Contributors are mentioned in the code where appropriate.              *
       6             :  *                                                                        *
       7             :  * Permission to use, copy, modify and distribute this software and its   *
       8             :  * documentation strictly for non-commercial purposes is hereby granted   *
       9             :  * without fee, provided that the above copyright notice appears in all   *
      10             :  * copies and that both the copyright notice and this permission notice   *
      11             :  * appear in the supporting documentation. The authors make no claims     *
      12             :  * about the suitability of this software for any purpose. It is          *
      13             :  * provided "as is" without express or implied warranty.                  *
      14             :  **************************************************************************/
      15             : 
      16             : // $Id$
      17             : // $MpId: AliMpTrigger.cxx,v 1.4 2006/05/24 13:58:52 ivana Exp $
      18             : 
      19             : //-----------------------------------------------------------------------------
      20             : // Class AliMpTriggerCrate
      21             : // --------------------
      22             : // The class defines the properties of trigger crate
      23             : // Author: Ch. Finck, Subatech Nantes
      24             : //-----------------------------------------------------------------------------
      25             : 
      26             : #include "AliMpTriggerCrate.h"
      27             : 
      28             : #include "AliLog.h"
      29             : 
      30             : #include <Riostream.h>
      31             : 
      32             : using std::endl;
      33             : /// \cond CLASSIMP
      34          18 : ClassImp(AliMpTriggerCrate)
      35             : /// \endcond
      36             : 
      37             : 
      38             : //______________________________________________________________________________
      39             : TString AliMpTriggerCrate::GenerateName(Int_t crateId, Int_t ddlId, Int_t nofDDLs)
      40             : {
      41             : /// Generate name
      42             : 
      43         256 :   TString name;
      44             : 
      45         128 :   if (crateId < 2)
      46          64 :     name = Form("%d", crateId+1);
      47             :   
      48         128 :   if (crateId == 2)
      49          16 :       name = "2-3";
      50             :   
      51         128 :   if (crateId > 2)
      52         160 :       name = Form("%d", crateId);
      53             :   
      54         128 :   if (crateId > 7)
      55           0 :     printf("crateId index too large\n");
      56             :  
      57         128 :   if (ddlId == nofDDLs)
      58          64 :       name.Append("R");
      59             :   else 
      60          64 :       name.Append("L"); 
      61             : 
      62             :   return name;
      63         256 : }  
      64             :  
      65             : //______________________________________________________________________________
      66             : AliMpTriggerCrate::AliMpTriggerCrate(const Char_t* name, UShort_t id)
      67          48 :   : TNamed(name, "mapping trigger crate"),
      68          48 :     fId(id),
      69          48 :     fDdlId(-1),
      70          48 :     fLocalBoard(false)
      71             :  
      72         240 : {
      73             : /// Standard constructor 
      74          96 : }
      75             : 
      76             : //______________________________________________________________________________
      77             : AliMpTriggerCrate::AliMpTriggerCrate(TRootIOCtor* /*ioCtor*/)
      78          48 :   : TNamed(),
      79          48 :     fId(),
      80          48 :     fDdlId(),
      81          48 :     fLocalBoard()
      82         240 : {
      83             : /// Root IO constructor
      84          96 : }
      85             : 
      86             : //______________________________________________________________________________
      87             : AliMpTriggerCrate::~AliMpTriggerCrate()
      88         192 : {
      89             : /// Destructor
      90          96 : }
      91             : 
      92             : //
      93             : // public methods
      94             : //
      95             : 
      96             : //______________________________________________________________________________
      97             : Bool_t AliMpTriggerCrate::AddLocalBoard(Int_t localBoardId)
      98             : {
      99             : /// Add local boards with given detElemId.
     100             : /// Return true if the local board was added
     101             : 
     102        1452 :   if ( HasLocalBoard(localBoardId) ) {
     103           0 :     AliWarningStream() 
     104           0 :       << "Local board with Id=" << localBoardId << " already present."
     105           0 :       << endl;
     106           0 :     return false;
     107             :   }    
     108             : 
     109         726 :   fLocalBoard.Add(localBoardId);
     110         726 :   return true;
     111         726 : }   
     112             : 
     113             : 
     114             : //______________________________________________________________________________
     115             : Int_t AliMpTriggerCrate::GetNofLocalBoards() const
     116             : {  
     117             : /// Return the number of local board in this crate
     118             : 
     119        4644 :   return fLocalBoard.GetSize(); 
     120             : }
     121             : 
     122             : //______________________________________________________________________________
     123             : Int_t  AliMpTriggerCrate::GetLocalBoardId(Int_t index) const
     124             : {  
     125             : /// Return the local board by index (in loop)
     126             : 
     127       12510 :   if (index >= 0 && index < fLocalBoard.GetSize())
     128        4114 :       return fLocalBoard.GetValue(index); 
     129             :   else 
     130          56 :       return 0; // begin at 1
     131        4170 : }
     132             : 
     133             : //______________________________________________________________________________
     134             : Bool_t  AliMpTriggerCrate::HasLocalBoard(Int_t localBoardId) const
     135             : {  
     136             : /// Return true if crate has local boardwith given localBoardId
     137             : 
     138        1452 :   return fLocalBoard.HasValue(localBoardId); 
     139             : }
     140             : 

Generated by: LCOV version 1.11