LCOV - code coverage report
Current view: top level - STEER/STEERBase - AliTimeStamp.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 23 53 43.4 %
Date: 2016-06-14 17:26:59 Functions: 7 14 50.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: AliTimeStamp.cxx 22322 2007-11-22 11:43:14Z cvetan $ */
      17             : 
      18             : ///////////////////////////////////////////////////////////////////////////////
      19             : //
      20             : //  Class to define Event Timestamp from : 
      21             : //
      22             : //               Orbit
      23             : //               Period counter
      24             : //               Seconds    |
      25             : //                  +       |   <===> Bunch cross 
      26             : //               Microsecs  | 
      27             : //
      28             : //////////////////////////////////////////////////////////////////////////////
      29             : 
      30             : #include <Riostream.h>
      31             : 
      32             : 
      33             : #include "TObject.h"
      34             : 
      35             : #include "AliLog.h"   
      36             : #include "AliTimeStamp.h"
      37             : 
      38             : using std::endl;
      39             : using std::cout;
      40         176 : ClassImp(AliTimeStamp)
      41             :    
      42             : //_____________________________________________________________________________
      43             :    
      44             : const Int_t AliTimeStamp::fNanosecPerBC = 25;   // nanosecs per bunch cross
      45             :    
      46             : //_____________________________________________________________________________
      47          88 : AliTimeStamp::AliTimeStamp():
      48          88 :   fOrbit(0),        
      49          88 :   fPeriod(0),        
      50          88 :   fBunchCross(0)
      51         440 : {
      52             :  // Default constructor
      53         176 : }     
      54             : 
      55             : //_____________________________________________________________________________
      56           8 : AliTimeStamp::AliTimeStamp( UInt_t orbit, UInt_t period, 
      57             :                             ULong64_t bunchcross ):
      58           8 :   fOrbit(orbit),        
      59           8 :   fPeriod(period),        
      60           8 :   fBunchCross( bunchcross )
      61          40 : {
      62          16 : }
      63             : //_____________________________________________________________________________
      64           0 : AliTimeStamp::AliTimeStamp( UInt_t orbit, UInt_t period, 
      65             :                             UInt_t seconds, UInt_t microsecs):
      66           0 :   fOrbit(orbit),        
      67           0 :   fPeriod(period),        
      68           0 :   fBunchCross( (ULong64_t)((seconds*1000000.+microsecs)*1000./fNanosecPerBC+0.5) )
      69           0 : {
      70           0 : }     
      71             : //___________________________________________________________________________
      72             : AliTimeStamp::AliTimeStamp(const AliTimeStamp &stamp):
      73           0 :  TObject(stamp),
      74           0 :  fOrbit(stamp.fOrbit),
      75           0 :  fPeriod(stamp.fPeriod),
      76           0 :  fBunchCross(stamp.fBunchCross)
      77           0 : {
      78             :  // copy constructor
      79           0 : }
      80             : //_____________________________________________________________________________
      81             : AliTimeStamp& AliTimeStamp::operator=(const AliTimeStamp &stamp)
      82             : {
      83             :  //assignment operator
      84          52 :  if(this==&stamp) return *this;
      85          26 :  ((TObject *)this)->operator=(stamp);
      86          26 :  fOrbit=stamp.fOrbit;
      87          26 :  fPeriod=stamp.fPeriod;
      88          26 :  fBunchCross=stamp.fBunchCross;
      89          26 :  return *this;
      90          26 : }
      91             : //_____________________________________________________________________________
      92             : void AliTimeStamp::SetTimeStamp( UInt_t orbit, UInt_t period, 
      93             :                             ULong64_t bunchcross )
      94             : {
      95           0 :   fOrbit = orbit;        
      96           0 :   fPeriod = period;  
      97           0 :   fBunchCross = bunchcross;
      98           0 : }
      99             :  
     100             : //_____________________________________________________________________________
     101             : void AliTimeStamp::SetTimeStamp( UInt_t orbit, UInt_t period, 
     102             :                             UInt_t seconds, UInt_t microsecs )
     103             : {
     104           0 :   fOrbit = orbit;        
     105           0 :   fPeriod = period;  
     106           0 :   fBunchCross = (ULong64_t)((seconds*1000000.+microsecs)*1000./fNanosecPerBC+0.5);
     107           0 : }
     108             :                             
     109             :      
     110             : 
     111             : //_____________________________________________________________________________
     112             : Int_t AliTimeStamp::Compare( const TObject* obj ) const
     113             : {
     114             :   // Compare 
     115             : 
     116         152 :   if( fPeriod > ((AliTimeStamp*)obj)->fPeriod )  return 1;
     117         152 :   else { if( fPeriod < ((AliTimeStamp*)obj)->fPeriod )  return -1;
     118           0 :   else { if( fOrbit > ((AliTimeStamp*)obj)->fOrbit )  return 1;
     119           0 :   else { if( fOrbit < ((AliTimeStamp*)obj)->fOrbit )  return -1;
     120           0 :   else { if( fBunchCross > ((AliTimeStamp*)obj)->fBunchCross )  return 1;
     121           0 :   else { if( fBunchCross < ((AliTimeStamp*)obj)->fBunchCross )  return -1;
     122           0 :   else return 0;
     123             : }}}}}
     124             : 
     125          76 : }
     126             : 
     127             : //_____________________________________________________________________________
     128             : void AliTimeStamp::Print( const Option_t* ) const
     129             : {
     130             :    // Print
     131           0 :   cout << "Timestamp: " << endl;
     132           0 :   cout << "  Orbit: " << fOrbit << " Period: " << fPeriod << endl;
     133           0 :   cout << "  Bunch Cross: " << GetBunchCross() << endl;
     134           0 :   cout << "  Seconds: " << GetSeconds() << " MicroSecs: " << GetMicroSecs() << endl;
     135           0 : }

Generated by: LCOV version 1.11