LCOV - code coverage report
Current view: top level - MUON/MUONmapping - AliMpDDL.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 50 73 68.5 %
Date: 2016-06-14 17:26:59 Functions: 20 26 76.9 %

          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: AliMpDDL.cxx,v 1.4 2006/05/24 13:58:34 ivana Exp $
      18             : // Category: management
      19             : 
      20             : //-----------------------------------------------------------------------------
      21             : // Class AliMpDDL
      22             : // --------------------
      23             : // The class defines electronics properties of DDL
      24             : // Authors: Ivana Hrivnacova, IPN Orsay
      25             : //          Christian Finck, SUBATECH Nantes
      26             : //-----------------------------------------------------------------------------
      27             : 
      28             : #include "AliMpDDL.h"
      29             : #include "AliMpDEManager.h"
      30             : #include "AliMpDetElement.h"
      31             : 
      32             : #include "AliLog.h"
      33             : 
      34             : #include <Riostream.h>
      35             : 
      36             : 
      37             : using std::endl;
      38             : /// \cond CLASSIMP
      39          18 : ClassImp(AliMpDDL)
      40             : /// \endcond
      41             : 
      42             : //______________________________________________________________________________
      43             : AliMpDDL::AliMpDDL(Int_t id)
      44          66 :   : TObject(),
      45          66 :     fId(id),
      46          66 :     fDEIds(),
      47          66 :     fFrtIds(false),
      48          66 :     fBusPatchIds(),
      49          66 :     fTriggerCrateIds(false)
      50             : 
      51         330 : {
      52             : /// Standard constructor
      53         132 : }
      54             : 
      55             : //______________________________________________________________________________
      56             : AliMpDDL::AliMpDDL(TRootIOCtor* /*ioCtor*/)
      57           0 :   : TObject(),
      58           0 :     fId(0),
      59           0 :     fDEIds(),
      60           0 :     fFrtIds(false),    
      61           0 :     fBusPatchIds(),
      62           0 :     fTriggerCrateIds()
      63           0 : {
      64             : /// Root IO constructor
      65           0 : }
      66             : 
      67             : //______________________________________________________________________________
      68             : AliMpDDL::~AliMpDDL()
      69         264 : {
      70             : /// Destructor
      71         132 : }
      72             : 
      73             : //
      74             : // private methods
      75             : //
      76             : 
      77             : //______________________________________________________________________________
      78             : void AliMpDDL::FillBusPatchIds()
      79             : {
      80             : /// Fill array with bus patch Ids
      81             : 
      82        1116 :   for ( Int_t i=0; i<GetNofDEs(); i++ ) {
      83             :     AliMpDetElement* detElement 
      84         468 :       = AliMpDEManager::GetDetElement(GetDEId(i));
      85             :     
      86        6264 :     for ( Int_t j=0; j<detElement->GetNofBusPatches(); j++ )
      87        2664 :       fBusPatchIds.Add(detElement->GetBusPatchId(j));
      88             :   }
      89          60 : }      
      90             : 
      91             : //
      92             : // public methods
      93             : //
      94             : 
      95             : //______________________________________________________________________________
      96             : Bool_t AliMpDDL::AddDE(Int_t detElemId)
      97             : {
      98             : /// Add detection element with given detElemId.
      99             : /// Return true if the detection element was added
     100             : 
     101        1368 :   if ( ! AliMpDEManager::IsValidDetElemId(detElemId) ) return false;
     102             :  
     103        1368 :   if ( HasDEId(detElemId) ) {
     104         684 :     AliWarningStream() 
     105           0 :       << "Detection element Id = " << detElemId << " already present."
     106           0 :       << endl;
     107           0 :     return false;
     108             :   }    
     109             : 
     110         684 :   AliDebugStream(3) << "Adding detElemId " << detElemId << endl;
     111             : 
     112         684 :   fDEIds.Add(detElemId);
     113         684 :   return true;
     114         684 : }   
     115             : 
     116             : //______________________________________________________________________________
     117             : Bool_t AliMpDDL::AddTriggerCrate(Int_t crateId)
     118             : {
     119             : /// Add trigger crate with given crateId.
     120             : /// Return true if the trigger crate was added
     121             : 
     122          96 :   if ( HasTriggerCrateId(crateId) ) {
     123           0 :     AliWarningStream() 
     124           0 :         << "Trigger crate Id = " << crateId << " already present."
     125           0 :         << endl;
     126           0 :     return false;
     127             :   }    
     128             :   
     129          48 :   fTriggerCrateIds.Add(crateId);
     130             : 
     131          48 :   return true;
     132          48 : }      
     133             : 
     134             : //______________________________________________________________________________
     135             : Bool_t AliMpDDL::AddFrt(Int_t frtId)
     136             : {
     137             : /// Add FRT with given frtId.
     138             : /// Return true if the FRT was added
     139             : 
     140         552 :   if ( HasFrtId(frtId) ) {
     141           0 :     AliWarningStream() 
     142           0 :         << "FRT Id = " << frtId << " already present."
     143           0 :         << endl;
     144           0 :     return false;
     145             :   }    
     146             :   
     147         276 :   fFrtIds.Add(frtId);
     148             : 
     149         276 :   return true;
     150         276 : }      
     151             : 
     152             : 
     153             : //______________________________________________________________________________
     154             : Int_t AliMpDDL::GetNofDEs() const
     155             : {  
     156             : /// Return the number of detection elements connected to this DDL
     157             : 
     158        2112 :   return fDEIds.GetSize(); 
     159             : }
     160             : 
     161             : //______________________________________________________________________________
     162             : Int_t  AliMpDDL::GetDEId(Int_t index) const
     163             : {  
     164             : /// Return the detection element by index (in loop)
     165             : 
     166        1872 :   return fDEIds.GetValue(index); 
     167             : }
     168             : 
     169             : //______________________________________________________________________________
     170             : Bool_t  AliMpDDL::HasDEId(Int_t detElemId) const
     171             : {  
     172             : /// Return true if the detection element Id is present
     173             : 
     174        6984 :   return fDEIds.HasValue(detElemId);; 
     175             : }
     176             : 
     177             : //______________________________________________________________________________
     178             : Int_t AliMpDDL::GetNofFrts() const
     179             : {  
     180             : /// Return the number of FRT connected to this DDL
     181             : 
     182           0 :   return fFrtIds.GetSize(); 
     183             : }
     184             : 
     185             : //______________________________________________________________________________
     186             : Int_t  AliMpDDL::GetFrtId(Int_t index) const
     187             : {  
     188             : /// Return the FRT by index (in loop)
     189             : 
     190           0 :   return fFrtIds.GetValue(index); 
     191             : }
     192             : 
     193             : //______________________________________________________________________________
     194             : Bool_t  AliMpDDL::HasFrtId(Int_t frtId) const
     195             : {  
     196             : /// Return true if the FRT Id is present
     197             : 
     198        5880 :   return fFrtIds.HasValue(frtId);; 
     199             : }
     200             : 
     201             : 
     202             : //______________________________________________________________________________
     203             : Int_t AliMpDDL::GetNofBusPatches() const
     204             : {  
     205             : /// Return the number of detection elements connected to this DDL
     206             : 
     207        5608 :   return fBusPatchIds.GetSize(); 
     208             : }
     209             : 
     210             : //______________________________________________________________________________
     211             : Int_t  AliMpDDL::GetBusPatchId(Int_t index) const
     212             : {  
     213             : /// Return the detection element by index (in loop)
     214             : 
     215       12432 :   return fBusPatchIds.GetValue(index); 
     216             : }
     217             : 
     218             : //______________________________________________________________________________
     219             : Bool_t  AliMpDDL::HasBusPatchId(Int_t busPatchId) const
     220             : {  
     221             : /// Return true if the detection element Id is present
     222             : 
     223           0 :   return fBusPatchIds.HasValue(busPatchId);; 
     224             : }
     225             : 
     226             : //______________________________________________________________________________
     227             : Int_t AliMpDDL::GetNofTriggerCrates() const
     228             : {  
     229             : /// Return the number of trigger crate connected to this DDL
     230             : 
     231         256 :   return fTriggerCrateIds.GetSize(); 
     232             : }
     233             : 
     234             : //______________________________________________________________________________
     235             : Int_t  AliMpDDL::GetTriggerCrateId(Int_t index) const
     236             : {  
     237             : /// Return the trigger crate by index (in loop)
     238             : 
     239           0 :   return fTriggerCrateIds.GetValue(index); 
     240             : }
     241             : 
     242             : //______________________________________________________________________________
     243             : Bool_t  AliMpDDL::HasTriggerCrateId(Int_t triggerCrateId) const
     244             : {  
     245             : /// Return true if the trigger crate Id is present
     246             : 
     247         192 :   return fTriggerCrateIds.HasValue(triggerCrateId);
     248             : }
     249             : 
     250             : //____________________________________________________________________
     251             : Int_t AliMpDDL::GetMaxDsp() const
     252             : {
     253             : /// calculates the number of DSP 
     254             : 
     255        1056 :   Int_t iBusPerBlk = fBusPatchIds.GetSize()/2; //per block
     256             : 
     257         528 :   Int_t iDspMax =  iBusPerBlk/5; //number max of DSP per block
     258         528 :   if (iBusPerBlk % 5 != 0)
     259         336 :     iDspMax += 1;
     260             : 
     261         528 :   return iDspMax;
     262             : }
     263             : 
     264             : //____________________________________________________________________
     265             : void AliMpDDL::GetBusPerDsp(Int_t* iBusPerDSP) 
     266             : const
     267             : {
     268             : /// calculates buspatch per block
     269             : 
     270         160 :   Int_t iBusPerBlk = fBusPatchIds.GetSize()/2; //per block
     271             : 
     272         896 :   for (Int_t i = 0; i < GetMaxDsp(); i++) {
     273         368 :     if ((iBusPerBlk -= 5) > 0) 
     274         288 :       iBusPerDSP[i] = 5;
     275             :     else 
     276          80 :       iBusPerDSP[i] = iBusPerBlk + 5;
     277             :   }
     278          80 : }
     279             : 

Generated by: LCOV version 1.11