LCOV - code coverage report
Current view: top level - TOF/TOFbase - AliTOFChannelOnlineStatusArray.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 24 98 24.5 %
Date: 2016-06-14 17:26:59 Functions: 7 21 33.3 %

          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             : ///////////////////////////////////////////////////////////////////////////////
      17             : //                                                                           //
      18             : // class for TOF Online calibration: defining channel status                 //
      19             : // New object created, to use an array instead of a TObjArray.               //
      20             : // Storing all the info coming from HW FEE map, pulser runs, and noise       //
      21             : // runs in a single object (char).                                           // 
      22             : //                                                                           //
      23             : ///////////////////////////////////////////////////////////////////////////////
      24             : 
      25             : #include <AliTOFChannelOnlineStatusArray.h>
      26             : #include <AliLog.h>
      27             : 
      28          26 : ClassImp(AliTOFChannelOnlineStatusArray)
      29             : 
      30             : //________________________________________________________________
      31             : AliTOFChannelOnlineStatusArray::AliTOFChannelOnlineStatusArray():
      32           3 :         TObject(),
      33           3 :         fSize(0),
      34           3 :         fArray(0x0),
      35           3 :         fLatencyWindow(0x0)
      36          15 : {
      37             :         //default constructor
      38           6 : }
      39             : //________________________________________________________________
      40             : AliTOFChannelOnlineStatusArray::~AliTOFChannelOnlineStatusArray()
      41           0 : {
      42             :         //distructor
      43           0 :         delete [] fArray;
      44           0 :         delete [] fLatencyWindow;
      45           0 : }
      46             : //________________________________________________________________
      47             : AliTOFChannelOnlineStatusArray::AliTOFChannelOnlineStatusArray(Int_t size):
      48           0 :         TObject(),
      49           0 :         fSize(size),
      50           0 :         fArray(new UChar_t[size]),
      51           0 :         fLatencyWindow(new Int_t[size])
      52           0 : {
      53             :         // ctor with size
      54           0 :         for (Int_t ich = 0; ich<size; ich ++){
      55           0 :           SetStatus(ich,kTOFOnlineUnknown);
      56           0 :           SetLatencyWindow(ich, 0);
      57             :         }
      58           0 : }
      59             : //________________________________________________________________
      60             : AliTOFChannelOnlineStatusArray::AliTOFChannelOnlineStatusArray(const AliTOFChannelOnlineStatusArray & source):
      61           0 :       TObject(),
      62           0 :       fSize(source.fSize),
      63           0 :       fArray(0x0),
      64           0 :       fLatencyWindow(0x0)
      65           0 : { 
      66             :         // copy constructor
      67           0 :         fArray = new UChar_t[fSize];
      68           0 :         fLatencyWindow = new Int_t[fSize];
      69           0 :         for (Int_t ich = 0; ich<fSize; ich ++){
      70           0 :                 fArray[ich] = source.fArray[ich];
      71           0 :                 fLatencyWindow[ich] = source.fLatencyWindow[ich];
      72             :         }
      73           0 : }
      74             : //________________________________________________________________
      75             : AliTOFChannelOnlineStatusArray &AliTOFChannelOnlineStatusArray::operator=(const AliTOFChannelOnlineStatusArray & source) 
      76             : { 
      77             :         // assignment operator
      78             : 
      79           0 :   if (this == &source)
      80           0 :     return *this;
      81             : 
      82           0 :   TObject::operator=(source);
      83           0 :   fSize= source.fSize;
      84           0 :   delete [] fArray;
      85           0 :   fArray = new UChar_t[fSize];
      86           0 :   delete [] fLatencyWindow;
      87           0 :   fLatencyWindow = new Int_t[fSize];
      88           0 :   memcpy(fArray,source.fArray,sizeof(UChar_t)*fSize);
      89           0 :   memcpy(fLatencyWindow,source.fLatencyWindow,sizeof(Int_t)*fSize);
      90             : 
      91           0 :   return *this;
      92           0 : }
      93             : //________________________________________________________________
      94             : void AliTOFChannelOnlineStatusArray::SetStatus(Int_t pos, UChar_t parr)
      95             : {
      96             :         // setting status for channel at position = pos
      97           0 :         AliDebug(2,Form("status = %d",(UInt_t)parr));
      98           0 :         if (pos>-1 && pos < fSize)fArray[pos] = parr;
      99           0 :         AliDebug(2,Form("fArray[%d] = %d",pos,(UInt_t)fArray[pos]));
     100           0 : }
     101             : //________________________________________________________________
     102             : void AliTOFChannelOnlineStatusArray::SetHWStatus(Int_t pos, UChar_t parr)
     103             : {
     104             :         // setting status for channel at position = pos
     105           0 :         AliDebug(2,Form("HW status = %d",(UInt_t)parr));
     106           0 :         if (pos>-1 && pos < fSize) {
     107           0 :                 fArray[pos] &= kTOFHWReset;
     108           0 :                 fArray[pos] |= parr;
     109           0 :         }
     110           0 :         AliDebug(2,Form("fArray[%d] = %d",pos,(UInt_t)fArray[pos]));
     111           0 : }
     112             : //________________________________________________________________
     113             : void AliTOFChannelOnlineStatusArray::SetPulserStatus(Int_t pos, UChar_t parr)
     114             : {
     115             :         // setting status for channel at position = pos
     116           0 :         AliDebug(2,Form("Pulser status = %d",(UInt_t)parr));
     117           0 :         if (pos>-1 && pos < fSize){
     118           0 :                 fArray[pos] &= kTOFPulserReset;
     119           0 :                 fArray[pos] |= parr;
     120           0 :         }
     121           0 :         AliDebug(2,Form("fArray[%d] = %d",pos,(UInt_t)fArray[pos]));
     122           0 : }
     123             : //________________________________________________________________
     124             : void AliTOFChannelOnlineStatusArray::SetNoiseStatus(Int_t pos, UChar_t parr)
     125             : {
     126             :         // setting status for channel at position = pos
     127           0 :         AliDebug(2,Form("Noise status = %d",(UInt_t)parr));
     128           0 :         if (pos>-1 && pos < fSize){
     129           0 :                 fArray[pos] &= kTOFNoiseReset;
     130           0 :                 fArray[pos] |= parr;
     131           0 :         }
     132           0 :         AliDebug(2,Form("fArray[%d] = %d",pos,(UInt_t)fArray[pos]));
     133           0 : }
     134             : //________________________________________________________________
     135             : void AliTOFChannelOnlineStatusArray::SetLatencyWindow(Int_t pos, Int_t parr)
     136             : {
     137             :         // setting latency window for channel at position = pos
     138           0 :   if (!fLatencyWindow) {
     139           0 :     AliWarning("couldn't set latency window");
     140           0 :     return;
     141             :   }
     142             :         // setting latency window for channel at position = pos
     143           0 :         AliDebug(2,Form("Latency window = %d",parr));
     144           0 :         if (pos>-1 && pos < fSize){
     145           0 :           fLatencyWindow[pos] = parr;
     146           0 :         }
     147           0 :         AliDebug(2,Form("fLatencyWindow[%d] = %d",pos,fLatencyWindow[pos]));
     148           0 : }
     149             : //________________________________________________________________
     150             : UChar_t AliTOFChannelOnlineStatusArray::GetStatus(Int_t pos) const 
     151             : {
     152             :         // getting the status for channel at position = pos 
     153             :         UChar_t parr = 0x0; 
     154           0 :         if  (pos>-1 && pos < fSize)parr = fArray[pos];
     155           0 :         return parr;
     156             : }
     157             : //________________________________________________________________
     158             : UChar_t AliTOFChannelOnlineStatusArray::GetHWStatus(Int_t pos) const 
     159             : {
     160             :         // getting the HW status for channel at position = pos 
     161             :         UChar_t parr = 0x0; 
     162        1512 :         if  (pos>-1 && pos < fSize)parr = fArray[pos];
     163        1134 :         AliDebug(2,Form("parr = %d ",(UInt_t)parr));
     164         378 :         UChar_t hwSt = parr & kTOFHW;
     165             :         //UChar_t hwSt = parr & 0x3;
     166         378 :         return hwSt;
     167             : }
     168             : //________________________________________________________________
     169             : UChar_t AliTOFChannelOnlineStatusArray::GetPulserStatus(Int_t pos) const 
     170             : {
     171             :         // getting the Pulser status for channel at position = pos 
     172             :         UChar_t parr = 0x0; 
     173        1512 :         if  (pos>-1 && pos < fSize)parr = fArray[pos];
     174        1134 :         AliDebug(2,Form("parr = %d ",(UInt_t)parr));
     175         378 :         UChar_t pulserSt = parr & kTOFPulser;
     176             :         //UChar_t pulserSt = parr & 0xc;
     177         378 :         return pulserSt;
     178             :     }
     179             : //________________________________________________________________
     180             : UChar_t AliTOFChannelOnlineStatusArray::GetNoiseStatus(Int_t pos) const 
     181             : {
     182             :         // getting the noise status for channel at position = pos 
     183             :         UChar_t parr = 0x0; 
     184        1512 :         if  (pos>-1 && pos < fSize)parr = fArray[pos];
     185        1134 :         AliDebug(2,Form("parr = %d ",(UInt_t)parr));
     186         378 :         UChar_t noiseSt = parr & kTOFNoise;
     187             :         //      UChar_t noiseSt = parr & 0x30;
     188         378 :         return noiseSt; 
     189             : }
     190             : //________________________________________________________________
     191             : Int_t AliTOFChannelOnlineStatusArray::GetLatencyWindow(Int_t pos) const 
     192             : {
     193             :         // getting the latency window for channel at position = pos 
     194             :   Int_t lw = 0; 
     195         600 :   if (!fLatencyWindow) {
     196           0 :     AliWarning("cannot get latency window");
     197           0 :     return lw;
     198             :   }
     199         900 :   if  (pos>-1 && pos < fSize)lw = fLatencyWindow[pos];
     200         900 :   AliDebug(2,Form("lw = %d ",lw));
     201         300 :   return lw;
     202         300 : }

Generated by: LCOV version 1.11