]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/STEERBase/AliTOFTriggerMask.cxx
option to switch CR off
[u/mrichter/AliRoot.git] / STEER / STEERBase / AliTOFTriggerMask.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 // *
19 // * this class defines the TOF object to be stored
20 // * in OCDB on a run-by-run basis in order to have the status
21 // * of TOF trigger inputs. it stores 32 bit masks for each crate
22 // * 
23 // *
24 // *
25 // *
26
27 #include "AliTOFTriggerMask.h"
28
29 Int_t AliTOFTriggerMask::fPowerMask[24];
30
31 ClassImp(AliTOFTriggerMask)
32 //_________________________________________________________
33
34 AliTOFTriggerMask::AliTOFTriggerMask() :
35   TObject(),
36   fTriggerMask()
37 {
38   /*
39    * default constructor
40    */
41
42   for (Int_t iddl = 0; iddl < 72; iddl++) fTriggerMask[iddl] = 0;
43
44   fPowerMask[0] = 1;
45   for(Int_t i=1;i <= 23;i++){
46       fPowerMask[i] = fPowerMask[i-1]*2;
47   }
48
49 }
50
51 //_________________________________________________________
52
53 AliTOFTriggerMask::~AliTOFTriggerMask()
54 {
55   /*
56    * default destructor
57    */
58
59 }
60
61 //_________________________________________________________
62
63 AliTOFTriggerMask::AliTOFTriggerMask(const AliTOFTriggerMask &source) :
64   TObject(source),
65   fTriggerMask()
66 {
67   /*
68    * copy constructor
69    */
70
71   for (Int_t iddl = 0; iddl < 72; iddl++) fTriggerMask[iddl] = source.fTriggerMask[iddl];
72 }
73
74 //_________________________________________________________
75
76 AliTOFTriggerMask &
77 AliTOFTriggerMask::operator=(const AliTOFTriggerMask &source)
78 {
79   /*
80    * operator=
81    */
82
83   if (this == &source) return *this;
84   TObject::operator=(source);
85   
86   for (Int_t iddl = 0; iddl < 72; iddl++) fTriggerMask[iddl] = source.fTriggerMask[iddl];
87
88   return *this;
89 }
90
91 //_________________________________________________________
92
93 void
94 AliTOFTriggerMask::SetTriggerMaskArray(UInt_t *array)
95 {
96   /*
97    * set trigger mask array
98    */
99
100   for (Int_t iddl = 0; iddl < 72; iddl++) fTriggerMask[iddl] = array[iddl];
101 }
102 //_________________________________________________________
103
104 Int_t AliTOFTriggerMask::GetNumberMaxiPadOn() {
105   Int_t n=0;
106   for(Int_t j=0;j<72;j++) 
107     for(Int_t i=22;i>=0;i--) 
108       n += (fTriggerMask[j]%fPowerMask[i+1])/fPowerMask[i];
109   return n;
110 };
111 //_________________________________________________________
112 void AliTOFTriggerMask::SetON(Int_t icrate,Int_t ich){
113   if(ich < 24 && icrate < 72) fTriggerMask[icrate] += fPowerMask[ich];
114 }
115 //_________________________________________________________
116 Bool_t AliTOFTriggerMask::IsON(Int_t icrate,Int_t ich){
117   if(ich < 24 && icrate < 72) return (fTriggerMask[icrate] & fPowerMask[ich]);
118   else return kFALSE;
119 }
120 //_________________________________________________________
121
122 TH2F *AliTOFTriggerMask::GetHistoMask() {
123   TH2F *h = new TH2F("hTOFTriggerMask","TOF trigger mask;crate;MaxiPad",72,0,72,23,0,23);
124   for(Int_t j=0;j<72;j++) 
125     for(Int_t i=22;i>=0;i--) 
126       h->SetBinContent(j+1,i+1,(fTriggerMask[j]%fPowerMask[i+1])/fPowerMask[i]);
127   return h;
128 };
129 //_________________________________________________________
130 void AliTOFTriggerMask::ResetMask() {
131   for (Int_t iddl = 0; iddl < 72; iddl++) fTriggerMask[iddl] = 0;
132 }