1 |
loizides |
1.1 |
//--------------------------------------------------------------------------------------------------
|
2 |
bendavid |
1.2 |
// $Id: TriggerMask.h,v 1.1 2009/03/08 12:10:42 loizides Exp $
|
3 |
loizides |
1.1 |
//
|
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 |
bendavid |
1.2 |
#include "MitAna/DataCont/interface/CacheFlag.h"
|
17 |
loizides |
1.1 |
|
18 |
|
|
namespace mithep
|
19 |
|
|
{
|
20 |
|
|
class TriggerMask : public DataBase
|
21 |
|
|
{
|
22 |
|
|
public:
|
23 |
bendavid |
1.2 |
TriggerMask() : fFilledLargeMask(kFALSE) {}
|
24 |
|
|
TriggerMask(const BitMask1024 &mask) : fMasknew(mask), fFilledLargeMask(kTRUE) {}
|
25 |
loizides |
1.1 |
|
26 |
bendavid |
1.2 |
Bool_t At(UInt_t n) const { return TestBit(n); }
|
27 |
|
|
const BitMask1024 &Get() const;
|
28 |
loizides |
1.1 |
EObjType ObjType() const { return kTriggerMask; }
|
29 |
bendavid |
1.2 |
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 |
loizides |
1.1 |
|
35 |
|
|
protected:
|
36 |
bendavid |
1.2 |
BitMask256 fMask; //trigger mask
|
37 |
|
|
mutable BitMask1024 fMasknew; //larger trigger mask
|
38 |
|
|
Bool_t fFilledLargeMask; //bool switch, was large mask filled originally
|
39 |
loizides |
1.1 |
|
40 |
bendavid |
1.2 |
ClassDef(TriggerMask, 2) // Trigger mask
|
41 |
loizides |
1.1 |
};
|
42 |
|
|
}
|
43 |
bendavid |
1.2 |
|
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 |
loizides |
1.1 |
#endif
|