1 |
formato |
1.1 |
#ifndef VK_MASK_PAMCUT |
2 |
|
|
#define VK_MASK_PAMCUT |
3 |
|
|
|
4 |
|
|
#define NPLN 12 |
5 |
|
|
#define NLAD 3 |
6 |
|
|
#define NVKL 8 |
7 |
|
|
|
8 |
|
|
#include <iostream> |
9 |
|
|
#include <TObject.h> |
10 |
|
|
using std::cout; |
11 |
|
|
using std::endl; |
12 |
|
|
|
13 |
|
|
class VKmask : public TObject |
14 |
|
|
{ |
15 |
|
|
UInt_t fvk_mask [NPLN]; |
16 |
|
|
|
17 |
|
|
public: |
18 |
|
|
|
19 |
|
|
VKmask(){ |
20 |
|
|
for(Int_t j = 0; j<NPLN; j++) fvk_mask[j] = 16777215; //full-mask |
21 |
|
|
} |
22 |
|
|
|
23 |
|
|
VKmask( UInt_t msk[NPLN] ){ |
24 |
|
|
for(Int_t j = 0; j<NPLN; j++) SetMaskRow(j,msk[j]); |
25 |
|
|
} |
26 |
|
|
|
27 |
|
|
|
28 |
|
|
virtual ~VKmask(){;} |
29 |
|
|
virtual void Clear(Option_t * = ""){ this->~VKmask(); } |
30 |
|
|
|
31 |
|
|
UInt_t GetMaskRow(Int_t j) const { return fvk_mask[j]; } |
32 |
|
|
Bool_t GetMaskBool(Int_t iv, Int_t ivk){ |
33 |
|
|
Int_t whichbit = (Int_t)pow(2,ivk); |
34 |
|
|
return (whichbit&fvk_mask[iv]) != 0; |
35 |
|
|
} |
36 |
|
|
void GetMaskBool( Bool_t ***vk_matrix ){ |
37 |
|
|
for(Int_t v = 1; v<NPLN+1; v++){ |
38 |
|
|
for(Int_t jl = 1; jl < NLAD+1; jl++){ |
39 |
|
|
for(Int_t iv = 1; iv < NVKL+1; iv++){ |
40 |
|
|
Int_t ivk = (jl-1)*NVKL+iv-1; |
41 |
|
|
Int_t whichbit = (Int_t)pow(2,ivk); |
42 |
|
|
Bool_t val = ((whichbit&fvk_mask[v-1])!=0); |
43 |
|
|
vk_matrix[v-1][jl-1][iv-1] = val; |
44 |
|
|
} |
45 |
|
|
} |
46 |
|
|
} |
47 |
|
|
} |
48 |
|
|
void SetMaskRow(Int_t j, UInt_t val){ |
49 |
|
|
fvk_mask[j] = val; |
50 |
|
|
}; |
51 |
|
|
|
52 |
|
|
|
53 |
|
|
inline Bool_t operator==(const VKmask& other) const { |
54 |
|
|
for(Int_t j = 0; j<NPLN; j++) |
55 |
|
|
if( fvk_mask[j] != other.GetMaskRow(j)) return kFALSE; |
56 |
|
|
return kTRUE; |
57 |
|
|
} |
58 |
|
|
|
59 |
|
|
ClassDef(VKmask,1); |
60 |
|
|
|
61 |
|
|
}; |
62 |
|
|
|
63 |
|
|
|
64 |
|
|
|
65 |
|
|
#endif //VK_MASK_PAMCUT |