LCOV - code coverage report
Current view: top level - VZERO/VZERObase - AliVZEROLogicalSignal.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 22 59 37.3 %
Date: 2016-06-14 17:26:59 Functions: 6 14 42.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             : // 
      17             : // Class AliVZEROLogicalSignal
      18             : // ---------------------------
      19             : // Describes a logical signal in the electronics. 
      20             : // Use it to generate observation windows
      21             : // which are used by AliVZEROTriggerSimulator class
      22             : // 
      23             : 
      24             : #include "AliLog.h"
      25             : #include "AliVZEROLogicalSignal.h"
      26             : 
      27          44 : ClassImp(AliVZEROLogicalSignal)
      28             : 
      29             : //_____________________________________________________________________________
      30         128 : AliVZEROLogicalSignal::AliVZEROLogicalSignal() : TObject(), fStart(0.), fStop(0.)
      31         320 : {
      32             :         // Default constructor
      33         128 : }
      34             : //_____________________________________________________________________________
      35         256 : AliVZEROLogicalSignal::AliVZEROLogicalSignal(UShort_t profilClock, UInt_t delay, Bool_t run2) : TObject(), fStart(0.), fStop(0.)
      36         384 : {
      37             :         // Constructor using the profilClock and delay parameters comming from the FEE
      38             :         
      39             :         Bool_t word;
      40             :         Bool_t up=kFALSE;
      41             :         Bool_t down=kFALSE;
      42             : 
      43         128 :         if (!run2) {
      44        1536 :           for(int i=0 ; i<5 ; i++) {
      45         640 :             Int_t shift = (i<4) ? (3-i) : 4;
      46         640 :             word = (profilClock >> shift) & 0x1;
      47         768 :             if(word&&!up) {
      48         128 :               fStart = 5. * (i + 1);
      49             :               up = kTRUE;
      50         128 :             }
      51        1472 :             if(!word&&up&&!down) {
      52         128 :               fStop = 5. * (i + 1);
      53             :               down = kTRUE;
      54         128 :             }           
      55             :           }
      56         128 :           if(!down) fStop = 30.;
      57             :         }
      58             :         else {
      59           0 :           for(int i=0 ; i<5 ; i++) {
      60           0 :             Int_t shift = (i<2) ? (1-i) : (6-i);
      61           0 :             word = (profilClock >> shift) & 0x1;
      62           0 :             if(word&&!up) {
      63           0 :               fStart = 5. * (i + 3);
      64             :               up = kTRUE;
      65           0 :             }
      66           0 :             if(!word&&up&&!down) {
      67           0 :               fStop = 5. * (i + 3);
      68             :               down = kTRUE;
      69           0 :             }           
      70             :           }
      71           0 :           if(!down) fStop = 40.;
      72             :         }
      73             :         
      74         128 :         fStart += delay*1e-2; // Add 10 ps par register unit
      75         128 :         fStop  += delay*1e-2; 
      76         256 : }
      77             : //_____________________________________________________________________________
      78             : AliVZEROLogicalSignal::AliVZEROLogicalSignal(const AliVZEROLogicalSignal &signal) : 
      79           0 :         TObject(), fStart(signal.fStart), 
      80           0 :         fStop(signal.fStop)
      81           0 : {
      82             :         // Copy constructor
      83           0 : }
      84             : 
      85             : //_____________________________________________________________________________
      86           0 : AliVZEROLogicalSignal::~AliVZEROLogicalSignal(){
      87             :         // Destructor
      88           0 : }
      89             : 
      90             : //_____________________________________________________________________________
      91             : AliVZEROLogicalSignal& AliVZEROLogicalSignal::operator = 
      92             : (const AliVZEROLogicalSignal& signal)
      93             : {
      94             :         // Operator =
      95           0 :         if(&signal == this) return *this;
      96           0 :         fStart = signal.fStart;
      97           0 :         fStop  = signal.fStop;
      98           0 :         return *this;
      99           0 : }
     100             : 
     101             : //_____________________________________________________________________________
     102             : AliVZEROLogicalSignal AliVZEROLogicalSignal::operator|(const AliVZEROLogicalSignal& signal) const 
     103             : {
     104             :         // Perform the Logical OR of two signals: C = A or B
     105           0 :         if((fStart>signal.fStop) || (signal.fStart>fStop))
     106           0 :                 AliError(Form("Both signal do not superpose in time.\n  Start(A) = %f Stop(A) = %f\n   Start(B) = %f Stop(B) = %f",fStart, fStop, signal.fStart,signal.fStop));
     107             :         
     108           0 :         AliVZEROLogicalSignal result;
     109           0 :         if(fStart<signal.fStart) result.fStart = fStart;
     110           0 :         else result.fStart = signal.fStart;
     111             :         
     112           0 :         if(fStop>signal.fStop) result.fStop = fStop;
     113           0 :         else result.fStop = signal.fStop;
     114             :                 
     115             :         return result;
     116           0 : }
     117             : //_____________________________________________________________________________
     118             : AliVZEROLogicalSignal AliVZEROLogicalSignal::operator&(const AliVZEROLogicalSignal& signal) const
     119             : {
     120             :         // Perform the Logical AND of two signals: C = A and B
     121           0 :         if((fStart>signal.fStop) || (signal.fStart>fStop))
     122           0 :                 AliError(Form("Both signal do not superpose in time.\n  Start(A) = %f Stop(A) = %f\n   Start(B) = %f Stop(B) = %f",fStart, fStop, signal.fStart,signal.fStop));
     123             :         
     124           0 :         AliVZEROLogicalSignal result;
     125           0 :         if(fStart>signal.fStart) result.fStart = fStart;
     126           0 :         else result.fStart = signal.fStart;
     127             :         
     128           0 :         if(fStop<signal.fStop) result.fStop = fStop;
     129           0 :         else result.fStop = signal.fStop;
     130             :         
     131             :         return result;
     132           0 : }
     133             : 
     134             : //_____________________________________________________________________________
     135             : Bool_t AliVZEROLogicalSignal::IsInCoincidence(Float_t time) const
     136             : {
     137             :         // Check if a signal arriving at the time "time" is in coincidence with the logical signal
     138             :         Bool_t result = kFALSE;
     139        1178 :         if((time>fStart) && (time<fStop)) result = kTRUE;
     140         512 :         return result;
     141             : }
     142             : 

Generated by: LCOV version 1.11