1 |
//--------------------------------------------------------------------------------------------------
|
2 |
// $Id: Selector.h,v 1.10 2008/12/10 14:20:27 loizides Exp $
|
3 |
//
|
4 |
// Our selector class for modular processing of a tree (or chain). In addition to the generic
|
5 |
// TAMSelector it determines the begin and end of a run and does the necessary bookkeeping.
|
6 |
// Modules can ask the selector to provide the run information.
|
7 |
//
|
8 |
// Authors: C.Loizides
|
9 |
//--------------------------------------------------------------------------------------------------
|
10 |
|
11 |
#ifndef MITANA_TREEMOD_SELECTOR_H
|
12 |
#define MITANA_TREEMOD_SELECTOR_H
|
13 |
|
14 |
#include "MitAna/TAM/interface/TAModule.h"
|
15 |
#include "MitAna/TAM/interface/TAMSelector.h"
|
16 |
#include "MitAna/DataTree/interface/Collections.h"
|
17 |
#include "MitAna/DataTree/interface/EventHeader.h"
|
18 |
#include "MitAna/DataTree/interface/LAHeader.h"
|
19 |
#include "MitAna/DataTree/interface/RunInfo.h"
|
20 |
|
21 |
namespace mithep {
|
22 |
class OutputMod;
|
23 |
|
24 |
class Selector : public TAMSelector
|
25 |
{
|
26 |
public:
|
27 |
Selector();
|
28 |
~Selector();
|
29 |
|
30 |
const char *GetAllEvtTreeName() const { return fAllEvtTreeName; }
|
31 |
const char *GetAllEvtHdrBrn() const { return fAllEvtHdrBrn; }
|
32 |
const THashTable &GetBranchTable() const { return fBranchTable; }
|
33 |
const char *GetEvtHdrName() const { return fEvtHdrName; }
|
34 |
const EventHeader *GetEventHeader() const { return fEventHeader; }
|
35 |
const char *GetLATreeName() const { return fLATreeName; }
|
36 |
const char *GetLAHdrName() const { return fLAHdrName; }
|
37 |
const char *GetRunTreeName() const { return fRunTreeName; }
|
38 |
const char *GetRunInfoName() const { return fRunInfoName; }
|
39 |
const RunInfo *GetRunInfo() const { return fRunInfo; }
|
40 |
Bool_t ValidRunInfo() const;
|
41 |
Bool_t ValidRunNum() const { return fCurRunNum!=UInt_t(-1); }
|
42 |
|
43 |
protected:
|
44 |
Bool_t BeginRun();
|
45 |
Bool_t ConsistentRunNum() const;
|
46 |
Bool_t EndRun();
|
47 |
Bool_t Notify();
|
48 |
void SlaveBegin(TTree* tree);
|
49 |
void UpdateRunInfo();
|
50 |
void UpdateRunInfoTree();
|
51 |
|
52 |
Bool_t fDoRunInfo; //=true then get RunInfo (def=1)
|
53 |
TString fEvtHdrName; //name of event header branch
|
54 |
TString fRunTreeName; //name of run info tree
|
55 |
TString fRunInfoName; //name of run info branch
|
56 |
TString fAllEvtHdrBrn; //name of all-event header branch
|
57 |
TString fLATreeName; //name of look-ahead tree
|
58 |
TString fLAHdrName; //name of look-ahead event header branch
|
59 |
TString fAllEvtTreeName; //name of all-event tree
|
60 |
TTree *fRunTree; //!run info tree in current file
|
61 |
EventHeader *fEventHeader; //!event header for current event
|
62 |
RunInfo *fRunInfo; //!run information for current run
|
63 |
TTree *fLATree; //!look-ahead tree in current file
|
64 |
LAHeader *fLAHeader; //!event header for next event
|
65 |
UInt_t fCurRunNum; //!current run number
|
66 |
TList fOutputMods; //!pointer to output modules
|
67 |
private:
|
68 |
void SearchOutputMods(const TAModule *mod);
|
69 |
|
70 |
friend class OutputMod;
|
71 |
|
72 |
ClassDef(Selector, 1) // Customized selector class
|
73 |
};
|
74 |
}
|
75 |
|
76 |
//--------------------------------------------------------------------------------------------------
|
77 |
inline Bool_t mithep::Selector::ConsistentRunNum() const
|
78 |
{
|
79 |
return (ValidRunNum() && fCurRunNum==fEventHeader->RunNum());
|
80 |
}
|
81 |
|
82 |
//--------------------------------------------------------------------------------------------------
|
83 |
inline Bool_t mithep::Selector::ValidRunInfo() const
|
84 |
{
|
85 |
return (fRunInfo && fCurRunNum==fRunInfo->RunNum());
|
86 |
}
|
87 |
#endif
|