1 |
loizides |
1.1 |
//--------------------------------------------------------------------------------------------------
|
2 |
loizides |
1.3 |
// $Id: Selector.h,v 1.2 2008/06/24 14:08:39 loizides Exp $
|
3 |
loizides |
1.1 |
//
|
4 |
loizides |
1.2 |
// 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. (This needs to be implemented.)
|
7 |
loizides |
1.1 |
//
|
8 |
|
|
// Authors: C.Loizides
|
9 |
|
|
//--------------------------------------------------------------------------------------------------
|
10 |
|
|
|
11 |
|
|
#ifndef TREEMOD_SELECTOR_H
|
12 |
|
|
#define TREEMOD_SELECTOR_H
|
13 |
|
|
|
14 |
|
|
#include "MitAna/TAM/interface/TAModule.h"
|
15 |
|
|
#include "MitAna/TAM/interface/TAMSelector.h"
|
16 |
loizides |
1.2 |
#include "MitAna/DataTree/interface/EventHeader.h"
|
17 |
|
|
#include "MitAna/DataTree/interface/LAHeader.h"
|
18 |
|
|
#include "MitAna/DataTree/interface/RunInfo.h"
|
19 |
loizides |
1.1 |
|
20 |
|
|
namespace mithep {
|
21 |
|
|
class Selector : public TAMSelector
|
22 |
|
|
{
|
23 |
|
|
public:
|
24 |
|
|
Selector();
|
25 |
|
|
~Selector();
|
26 |
|
|
|
27 |
loizides |
1.3 |
Bool_t BeginRun();
|
28 |
|
|
Bool_t EndRun();
|
29 |
|
|
const EventHeader *GetEventHeader() const { return fEventHeader; }
|
30 |
|
|
const RunInfo *GetRunInfo() const { return fRunInfo; }
|
31 |
|
|
Bool_t Notify();
|
32 |
|
|
void SlaveBegin(TTree* tree);
|
33 |
|
|
Bool_t ValidRunInfo() const;
|
34 |
|
|
Bool_t ValidRunNum() const { return fCurRunNum!=UInt_t(-1); }
|
35 |
loizides |
1.2 |
|
36 |
|
|
protected:
|
37 |
loizides |
1.3 |
Bool_t ConsistentRunNum() const;
|
38 |
|
|
void UpdateRunInfo();
|
39 |
|
|
void UpdateRunInfoTree();
|
40 |
|
|
|
41 |
|
|
Bool_t fDoRunInfo; //=true then get RunInfo (def=1)
|
42 |
|
|
TTree *fRunTree; //run info tree in current file
|
43 |
|
|
EventHeader *fEventHeader; //event header for current event
|
44 |
|
|
RunInfo *fRunInfo; //run information for current run
|
45 |
|
|
TTree *fLATree; //look-ahead tree in current file
|
46 |
|
|
LAHeader *fLAHeader; //event header for next event
|
47 |
|
|
UInt_t fCurRunNum; //current run number
|
48 |
loizides |
1.2 |
|
49 |
loizides |
1.1 |
ClassDef(Selector,1)
|
50 |
|
|
};
|
51 |
loizides |
1.2 |
|
52 |
|
|
//--------------------------------------------------------------------------------------------------
|
53 |
|
|
inline Bool_t Selector::ConsistentRunNum() const
|
54 |
|
|
{
|
55 |
|
|
return (ValidRunNum() && fCurRunNum==fEventHeader->RunNum());
|
56 |
|
|
}
|
57 |
|
|
|
58 |
|
|
//--------------------------------------------------------------------------------------------------
|
59 |
|
|
inline Bool_t Selector::ValidRunInfo() const
|
60 |
|
|
{
|
61 |
|
|
return (fRunInfo && fCurRunNum==fRunInfo->RunNum());
|
62 |
|
|
}
|
63 |
loizides |
1.1 |
}
|
64 |
|
|
#endif
|