LCOV - code coverage report
Current view: top level - TOF/TOFbase - AliTOFdigit.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 25 102 24.5 %
Date: 2016-06-14 17:26:59 Functions: 5 15 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             : /* $Id$ */
      17             : 
      18             : //_________________________________________________________________________//
      19             : //                                                                         //
      20             : //  TOF digit: member variables                                            //
      21             : //  fSector  : TOF sector                                                  //
      22             : //  fPlate   : TOF plate                                                   //
      23             : //  fStrip   : strips number                                               //
      24             : //  fPadx    : pad number along x                                          //
      25             : //  fPadz    : pad number along z                                          //
      26             : //  fTdc     : TDC                                                         //
      27             : //  fAdc     : ADC                                                         //
      28             : //                                                                         //
      29             : //  Getters, setters and member functions  defined here                    //
      30             : //                                                                         //
      31             : // -- Authors: F. Pierella, A. Seganti, D. Vicinanza                       //
      32             : //_________________________________________________________________________//
      33             : 
      34             :  
      35             : #include "Riostream.h"
      36             : 
      37             : #include "AliTOFdigit.h"
      38             : #include "AliTOFGeometry.h"
      39             : 
      40             : using std::endl;
      41             : using std::cout;
      42          26 : ClassImp(AliTOFdigit)
      43             : 
      44             : //______________________________________________________________________________
      45             : AliTOFdigit::AliTOFdigit()
      46         466 :   :AliDigit(),
      47         466 :    fSector(-1),
      48         466 :    fPlate(-1),
      49         466 :    fStrip(-1),
      50         466 :    fPadx(-1),
      51         466 :    fPadz(-1),
      52         466 :    fTdc(0),
      53         466 :    fTdcND(0),
      54         466 :    fAdc(0),
      55         466 :    fToT(0)
      56        2330 : {
      57         932 : }
      58             : //______________________________________________________________________________
      59             : AliTOFdigit::AliTOFdigit(Int_t *tracks, Int_t *vol, Int_t *digit)
      60         100 :   :AliDigit(tracks),
      61         100 :    fSector(vol[0]),
      62         100 :    fPlate(vol[1]),
      63         100 :    fStrip(vol[2]),
      64         100 :    fPadx(vol[3]),
      65         100 :    fPadz(vol[4]),
      66         100 :    fTdc(digit[0]),
      67         100 :    fTdcND(digit[3]),
      68         100 :    fAdc(digit[1]),
      69         100 :    fToT(digit[2])
      70         500 : {
      71             : //
      72             : // Constructor of digit object
      73             : //
      74         200 : }
      75             : 
      76             : //____________________________________________________________________________
      77             : AliTOFdigit::AliTOFdigit(const AliTOFdigit & digit)
      78           0 :   :AliDigit(digit),
      79           0 :    fSector(digit.fSector),
      80           0 :    fPlate(digit.fPlate),
      81           0 :    fStrip(digit.fStrip),
      82           0 :    fPadx(digit.fPadx),
      83           0 :    fPadz(digit.fPadz),
      84           0 :    fTdc(digit.fTdc),
      85           0 :    fTdcND(digit.fTdcND),
      86           0 :    fAdc(digit.fAdc),
      87           0 :    fToT(digit.fToT)
      88           0 : {
      89             :   // 
      90             :   // copy ctor for AliTOFdigit object
      91             :   //
      92             : 
      93             :   Int_t i ;
      94           0 :   for ( i = 0; i < 3 ; i++)
      95           0 :     fTracks[i]  = digit.fTracks[i] ;
      96             : 
      97           0 : }
      98             : 
      99             : //______________________________________________________________________________
     100           0 : AliTOFdigit::AliTOFdigit(Int_t sector, Int_t plate, Int_t strip, Int_t padx,
     101             :                          Int_t padz, Int_t tdc, Int_t adc):
     102           0 :    fSector(sector),
     103           0 :    fPlate(plate),
     104           0 :    fStrip(strip),
     105           0 :    fPadx(padx),
     106           0 :    fPadz(padz),
     107           0 :    fTdc(tdc),
     108           0 :    fTdcND(0),
     109           0 :    fAdc(adc),
     110           0 :    fToT(0)
     111           0 : {
     112             : //
     113             : // Constructor for sdigit
     114             : //
     115           0 : }
     116             :    
     117             : //______________________________________________________________________________
     118             : void AliTOFdigit::GetLocation(Int_t *loc) const
     119             : {
     120             : //
     121             : // Get the cohordinates of the digit
     122             : // in terms of Sector - Plate - Strip - Pad
     123             : //
     124             : 
     125           0 :    loc[0] = fSector;
     126           0 :    loc[1] = fPlate;
     127           0 :    loc[2] = fStrip;
     128           0 :    loc[3] = fPadx;
     129           0 :    loc[4] = fPadz;
     130           0 : }
     131             : 
     132             : //______________________________________________________________________________
     133             : Int_t AliTOFdigit::GetTotPad() const
     134             : {
     135             : //
     136             : // Get the "total" index of the pad inside a Sector
     137             : // starting from the digits data.
     138             : //
     139             : 
     140             :   Int_t before=0;
     141             : 
     142           0 :   switch(fPlate){ 
     143             :   case 0:
     144             :     //before = 0;
     145             :     break;
     146             :   case 1:
     147           0 :     before = AliTOFGeometry::NStripC();
     148           0 :     break;
     149             :   case 2:
     150           0 :     before = AliTOFGeometry::NStripC() +   AliTOFGeometry::NStripB();
     151           0 :     break;
     152             :   case 3:
     153           0 :     before = AliTOFGeometry::NStripC() +   AliTOFGeometry::NStripB() + AliTOFGeometry::NStripA();
     154           0 :     break;
     155             :   case 4:
     156           0 :     before = AliTOFGeometry::NStripC() + 2*AliTOFGeometry::NStripB() + AliTOFGeometry::NStripA();
     157           0 :     break;
     158             :   }
     159             :   
     160           0 :   Int_t pad = AliTOFGeometry::NpadZ()*fPadx + fPadz;
     161           0 :   Int_t strip  = fStrip + before;
     162           0 :   Int_t padTot = AliTOFGeometry::NpadXStrip()*strip + pad;
     163             : 
     164           0 :   return padTot;
     165             : }
     166             : 
     167             : //______________________________________________________________________________
     168             : void AliTOFdigit::AddTrack(Int_t track)
     169             : {
     170             : //
     171             : // Add a new and different track to the digit 
     172             : //
     173           0 :   if (track==fTracks[0] || track==fTracks[1] || track==fTracks[2]) return;
     174           0 :    if (fTracks[1]==-1)
     175           0 :       fTracks[1] = track;
     176           0 :    else if (fTracks[2]==-1)
     177           0 :       fTracks[2] = track;
     178             :    else
     179           0 :      printf("W-AliTOFdigit::AddTrack: Too many tracks (>3) that contribute to the same TOF digit\n");
     180             : 
     181           0 : }
     182             : 
     183             : // Overloading of Streaming, Sum and Comparison operators
     184             : 
     185             : //______________________________________________________________________________
     186             : Bool_t AliTOFdigit::operator==(AliTOFdigit const &digit) const
     187             : {
     188             : //
     189             : // Overloading of Comparison operator
     190             : //   
     191           0 :  if (fSector==digit.fSector &&
     192           0 :      fPlate==digit.fPlate &&
     193           0 :      fStrip==digit.fStrip &&
     194           0 :      fPadx==digit.fPadx &&
     195           0 :      fPadz==digit.fPadz &&
     196           0 :      fTdc==digit.fTdc &&
     197           0 :      fTdcND==digit.fTdcND &&
     198           0 :      fAdc==digit.fAdc &&
     199           0 :      fToT==digit.fToT ) return kTRUE;
     200           0 :      else return kFALSE;
     201           0 : }
     202             : 
     203             : //______________________________________________________________________________
     204             : AliTOFdigit AliTOFdigit::operator+(const AliTOFdigit &digit)
     205             : {
     206             : //
     207             : // Overloading of Sum operator
     208             : // Note: Some convolution 
     209             : // between the two digit variables has to be inserted
     210             : //
     211           0 : if  (fSector==digit.fSector &&
     212           0 :      fPlate==digit.fPlate &&
     213           0 :      fStrip==digit.fStrip &&
     214           0 :      fPadx==digit.fPadx &&
     215           0 :      fPadz==digit.fPadz) {
     216             :                             // convolution to be inserted here
     217           0 :                              fTdc+=digit.fTdc;
     218           0 :                              fAdc+=digit.fAdc;
     219           0 :                            } else
     220           0 :                 AliTOFdigit(fSector,fPlate,fStrip,fPadx,fPadz,fTdc,fAdc);
     221           0 :   return *this;
     222             : }
     223             : 
     224             : //______________________________________________________________________________
     225             : ostream& operator << (ostream & out, const AliTOFdigit &digit)
     226             : {
     227             :   //
     228             :   // Output streamer: output of the digit data
     229             :   //
     230             : 
     231           0 :   out << "Sector " << digit.fSector << ", Plate " << digit.fPlate << ", Strip " << digit.fStrip << endl;
     232           0 :   out << "Padx" << digit.fPadx << ", Padz " << digit.fPadz << endl;
     233           0 :   out << "TDC " << digit.fTdc << ", ADC "<< digit.fAdc << endl;
     234             : 
     235           0 :   return out;
     236             : }

Generated by: LCOV version 1.11