]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliTriggerBCMask.cxx
New class to represent the CTP bunch-crossing masks
[u/mrichter/AliRoot.git] / STEER / AliTriggerBCMask.cxx
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 // This class which defines the trigger bunch-crossing mask
19 //
20 //
21 ///////////////////////////////////////////////////////////////////////////////
22
23 #include "AliTriggerBCMask.h"
24
25 ClassImp(AliTriggerBCMask)
26
27 //_____________________________________________________________________________
28 AliTriggerBCMask::AliTriggerBCMask():
29   TNamed()
30 {
31   // Default constructor
32   for (Int_t i = 0; i < kNBytesPerBCMask; i++) fBCMask[i] = 0;
33 }
34
35 //_____________________________________________________________________________
36 AliTriggerBCMask::AliTriggerMask( TString & name, UChar_t *mask ):
37   TNamed( name, name )
38 {
39   // Constructor
40   for (Int_t i = 0; i < kNBytesPerBCMask; i++) fBCMask[i] = mask[i];
41 }
42 //_____________________________________________________________________________
43 AliTriggerBCMask::~AliTriggerBCMask() 
44
45   // Destructor
46 }
47 //_____________________________________________________________________________
48 AliTriggerBCMask::AliTriggerBCMask( const AliTriggerBCMask& mask ):
49   TNamed( mask ),
50 {
51    // Copy constructor
52   for (Int_t i = 0; i < kNBytesPerBCMask; i++) fBCMask[i] = mask.fBCMask[i];
53 }
54
55 //______________________________________________________________________________
56 AliTriggerBCMask& AliTriggerBCMask::operator=(const AliTriggerBCMask& mask)
57 {
58    // AliTriggerBCMask assignment operator.
59
60    if (this != &mask) {
61       TNamed::operator=(mask);
62       for (Int_t i = 0; i < kNBytesPerBCMask; i++) fBCMask[i] = mask.fBCMask[i];
63    }
64    return *this;
65 }
66
67 //_____________________________________________________________________________
68 Bool_t AliTriggerBCMask::GetMask( UShort_t index)
69 {
70   // Return true or false whenever the mask is active
71   // for the bunch-crossing # = index
72   UShort_t position = index/8;
73   if (position >= kNBytesPerBCMask) return kFALSE;
74   UChar_t offset = index%8;
75   return (fBCMask[position] & (0x1 << offset));
76 }