Added V0A23 (V0 rings 2-3), V0C01 (V0 rings 0-1) and V0S = V0A23+V0C01
[u/mrichter/AliRoot.git] / STEER / STEERBase / AliTOFTriggerMask.cxx
CommitLineData
1f4ce44e 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
49a1368d 29Int_t AliTOFTriggerMask::fPowerMask[24];
1f4ce44e 30
49a1368d 31ClassImp(AliTOFTriggerMask)
1f4ce44e 32//_________________________________________________________
33
34AliTOFTriggerMask::AliTOFTriggerMask() :
35 TObject(),
36 fTriggerMask()
37{
38 /*
39 * default constructor
40 */
41
42 for (Int_t iddl = 0; iddl < 72; iddl++) fTriggerMask[iddl] = 0;
49a1368d 43
44 fPowerMask[0] = 1;
45 for(Int_t i=1;i <= 23;i++){
46 fPowerMask[i] = fPowerMask[i-1]*2;
47 }
48
1f4ce44e 49}
50
51//_________________________________________________________
52
53AliTOFTriggerMask::~AliTOFTriggerMask()
54{
55 /*
56 * default destructor
57 */
58
59}
60
61//_________________________________________________________
62
63AliTOFTriggerMask::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
76AliTOFTriggerMask &
77AliTOFTriggerMask::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
93void
94AliTOFTriggerMask::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}
5977c99f 102//_________________________________________________________
1f4ce44e 103
5977c99f 104Int_t AliTOFTriggerMask::GetNumberMaxiPadOn() {
105 Int_t n=0;
106 for(Int_t j=0;j<72;j++)
09c70ff8 107 for(Int_t i=22;i>=0;i--)
49a1368d 108 n += (fTriggerMask[j]%fPowerMask[i+1])/fPowerMask[i];
5977c99f 109 return n;
110};
09c70ff8 111//_________________________________________________________
49a1368d 112void AliTOFTriggerMask::SetON(Int_t icrate,Int_t ich){
2cc79506 113 if(ich < 24 && icrate < 72) fTriggerMask[icrate] += fPowerMask[ich];
49a1368d 114}
115//_________________________________________________________
116Bool_t AliTOFTriggerMask::IsON(Int_t icrate,Int_t ich){
2cc79506 117 if(ich < 24 && icrate < 72) return (fTriggerMask[icrate] & fPowerMask[ich]);
49a1368d 118 else return kFALSE;
119}
120//_________________________________________________________
09c70ff8 121
122TH2F *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--)
49a1368d 126 h->SetBinContent(j+1,i+1,(fTriggerMask[j]%fPowerMask[i+1])/fPowerMask[i]);
09c70ff8 127 return h;
128};
49a1368d 129//_________________________________________________________
130void AliTOFTriggerMask::ResetMask() {
131 for (Int_t iddl = 0; iddl < 72; iddl++) fTriggerMask[iddl] = 0;
132}