1 |
//--------------------------------------------------------------------------------------------------
|
2 |
// $Id: TriggerMask.h,v 1.1 2009/03/08 12:10:42 loizides Exp $
|
3 |
//
|
4 |
// TriggerMask
|
5 |
//
|
6 |
// A class to hold the trigger mask.
|
7 |
//
|
8 |
// Authors: C.Loizides
|
9 |
//--------------------------------------------------------------------------------------------------
|
10 |
|
11 |
#ifndef MITANA_DATATREE_TRIGGERMASK_H
|
12 |
#define MITANA_DATATREE_TRIGGERMASK_H
|
13 |
|
14 |
#include "MitAna/DataTree/interface/DataBase.h"
|
15 |
#include "MitAna/DataTree/interface/Types.h"
|
16 |
#include "MitAna/DataCont/interface/CacheFlag.h"
|
17 |
|
18 |
namespace mithep
|
19 |
{
|
20 |
class TriggerMask : public DataBase
|
21 |
{
|
22 |
public:
|
23 |
TriggerMask() : fFilledLargeMask(kFALSE) {}
|
24 |
TriggerMask(const BitMask1024 &mask) : fMasknew(mask), fFilledLargeMask(kTRUE) {}
|
25 |
|
26 |
Bool_t At(UInt_t n) const { return TestBit(n); }
|
27 |
const BitMask1024 &Get() const;
|
28 |
EObjType ObjType() const { return kTriggerMask; }
|
29 |
void Print(Option_t *opt="") const { Get().Print(opt); }
|
30 |
void SetBits(const BitMask1024 &m) { fFilledLargeMask=kTRUE; fMasknew.SetBits(m); }
|
31 |
UInt_t Size() const { return fFilledLargeMask ? fMasknew.Size() : fMask.Size(); }
|
32 |
UInt_t MaxSize() const { return fMasknew.Size(); }
|
33 |
Bool_t TestBit(UInt_t n) const { return fFilledLargeMask ? fMasknew.TestBit(n) : fMask.TestBit(n); }
|
34 |
|
35 |
protected:
|
36 |
BitMask256 fMask; //trigger mask
|
37 |
mutable BitMask1024 fMasknew; //larger trigger mask
|
38 |
Bool_t fFilledLargeMask; //bool switch, was large mask filled originally
|
39 |
|
40 |
ClassDef(TriggerMask, 2) // Trigger mask
|
41 |
};
|
42 |
}
|
43 |
|
44 |
//--------------------------------------------------------------------------------------------------
|
45 |
inline const mithep::BitMask1024 &mithep::TriggerMask::Get() const
|
46 |
{
|
47 |
//printf("get bitmask, fUseLargeMask = %i, fFilledLargeMask = %i\n",fUseLargeMask.IsValid(),fFilledLargeMask);
|
48 |
|
49 |
// Return bitmask, filling new bitmask from old one if necessary
|
50 |
if (fFilledLargeMask) return fMasknew;
|
51 |
|
52 |
fMasknew.Clear();
|
53 |
for (UInt_t i=0; i<fMask.Size(); ++i) {
|
54 |
fMasknew.SetBit(i,fMask.TestBit(i));
|
55 |
}
|
56 |
|
57 |
return fMasknew;
|
58 |
|
59 |
}
|
60 |
#endif
|