1 |
//--------------------------------------------------------------------------------------------------
|
2 |
// $Id: HLTMod.h,v 1.16 2011/03/21 15:58:37 paus Exp $
|
3 |
//
|
4 |
// HLTMod
|
5 |
//
|
6 |
// This module allows to select events according to given HLT trigger bits. The trigger bits
|
7 |
// are selected via their corresponding HLT trigger name.
|
8 |
// The trigger name is added to the list of accepted triggers using AddTrigger(). Each member of
|
9 |
// this list will be logically "ored" to the search mask (see description of AddTrigger()).
|
10 |
// For every accepted event the list of trigger objects will be published. The name of the
|
11 |
// published objects can be specified via SetTrigObjsName.
|
12 |
// The objects can be retrieved in sub-modules with BaseModule::GetHLTObjects().
|
13 |
// HLTMod will abort processing the chain of sub-modules if the trigger bits did not
|
14 |
// match the given trigger mask, unless you call SetAbortIfNotAccepted(kFALSE).
|
15 |
// For convenience HLTMod defines two virtual functions, OnAccepted() and OnFailed()
|
16 |
// that can be implemented in derived classes. OnAccepted() will be called if the event passes
|
17 |
// the trigger mask, on Failed() if it did not.
|
18 |
//
|
19 |
// An example of how this is supposed to work can be found in
|
20 |
// $CMSSW_BASE/src/MitAna/macros/examples/runHLTExample.C
|
21 |
//
|
22 |
// Authors: C.Loizides
|
23 |
//--------------------------------------------------------------------------------------------------
|
24 |
|
25 |
#ifndef MITANA_TREEMOD_HLTMOD_H
|
26 |
#define MITANA_TREEMOD_HLTMOD_H
|
27 |
|
28 |
#include <string>
|
29 |
#include <utility>
|
30 |
#include <TString.h>
|
31 |
#include "MitAna/TreeMod/interface/BaseMod.h"
|
32 |
#include "MitAna/DataTree/interface/TriggerObjectFwd.h"
|
33 |
|
34 |
namespace mithep
|
35 |
{
|
36 |
class TriggerTable;
|
37 |
class TriggerObjectsTable;
|
38 |
class TriggerMask;
|
39 |
|
40 |
class HLTMod : public BaseMod {
|
41 |
public:
|
42 |
enum EObjMode { // which objects to get
|
43 |
kAll = 0,
|
44 |
kL1,
|
45 |
kHlt
|
46 |
};
|
47 |
|
48 |
HLTMod(const char *name="HLTMod", const char *title="High-level trigger module");
|
49 |
~HLTMod();
|
50 |
|
51 |
void AddTrigger(const char *expr, UInt_t firstRun=0, UInt_t lastRun=0);
|
52 |
const char *GetBitsName() const { return fBitsName; }
|
53 |
Int_t GetNEvents() const { return fNEvents; }
|
54 |
Int_t GetNAccepted() const { return fNAccepted; }
|
55 |
Int_t GetNFailed() const { return fNFailed; }
|
56 |
const char *GetOutputName() const { return fMyObjsNamePub; }
|
57 |
const char *GetTrigObjsName() const { return fMyObjsNamePub; }
|
58 |
void SetAbortIfNotAccepted(Bool_t b) { fAbort = b; }
|
59 |
void SetBitsName(const char *n) { fBitsName = n; }
|
60 |
void SetIgnoreBits(Bool_t b) { fIgnoreBits = b; }
|
61 |
void SetInputName(const char *n) { fMyObjsNamePub = n; }
|
62 |
void SetObjMode(EObjMode m ) { fObjMode = m; }
|
63 |
void SetPrintTable(Bool_t b) { fPrintTable = b; }
|
64 |
void SetTrigObjsName(const char *n) { fMyObjsNamePub = n; }
|
65 |
|
66 |
protected:
|
67 |
void AddTrigObjs(UInt_t tid);
|
68 |
void BeginRun();
|
69 |
virtual void OnAccepted() {/*could be implemented in derived classes*/}
|
70 |
virtual void OnFailed() {/*could be implemented in derived classes*/}
|
71 |
void Process();
|
72 |
void SlaveBegin();
|
73 |
void SlaveTerminate();
|
74 |
|
75 |
Bool_t fAbort; //=true then abort (sub-)modules if not accepted
|
76 |
Bool_t fPrintTable; //=true then print HLT trigger table in BeginRun
|
77 |
Bool_t fIgnoreBits; //=true then try to get trigger objects (def=0)
|
78 |
EObjMode fObjMode; //defines which objects to get (def=kHlt)
|
79 |
TString fBitsName; //trigger bits branch name
|
80 |
TString fMyObjsNamePub; //name of exported trigger object array
|
81 |
std::vector<std::pair<std::string,std::pair<UInt_t,UInt_t> > > fTrigNames; //trigger names requested for test mask with valid run range
|
82 |
const TriggerMask *fBits; //!trigger bits branch
|
83 |
std::vector<BitMask1024> fTrigBitsAnd; //!trigger bits used in mask
|
84 |
std::vector<BitMask1024> fTrigBitsCmp; //!trigger bits used for comparison
|
85 |
BitMask1024 fBitsDone; //!bits for which trigger objects are copied
|
86 |
TriggerObjectOArr *fMyTrgObjs; //!exported published trigger object array
|
87 |
const TriggerTable *fTriggers; //!imported published HLT trigger table
|
88 |
const TriggerObjectsTable *fTrigObjs; //!imported published HLT trigger objects table
|
89 |
Int_t fNEvents; //!number of processed events
|
90 |
Int_t fNAccepted; //!number of accepted events
|
91 |
Int_t fNFailed; //!number of failed events
|
92 |
|
93 |
ClassDef(HLTMod, 1) // HLT TAM module
|
94 |
};
|
95 |
}
|
96 |
#endif
|