-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEngMatSelector.C
61 lines (50 loc) · 1.45 KB
/
EngMatSelector.C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include "TH2D"
#include "TSelector.h"
#include "TTreeReader.h"
#include "TTreeReaderValue.h"
#include "./TXPConfig.h"
class EngMatSelector : public TSelector
{
public:
TH2D* fMatEn;
TXPConfig* fCal;
TTreeReader fReader;
TTreeReaderValue<int> fenergy;
TTreeReaderValue<short> fadc;
EngMatSelector(TTree* = 0): fMatEn(nullptr),
fCal(nullptr),
fenergy(fReader, "energy"),
fadc(fReader, "adc"),
fmultiplicity(fReader, "multiplicity") {}
virtual ~EngMatSelector() {}
virtual void Init( TTree* Tree );
virtual void SlaveBegin(TTree *tree);
virtual Bool_t Process(Long64_t entry);
virtual void Terminate();
virtual Int_t Version() const { return 1; }
ClassDef(EngMatSelector,0);
};
void TutorialSelector::Init(TTree *tree)
{
fReader.SetTree(Tree);
fCal = new TXPConfig("./XPConfig.txt"); // Set the calibration
}
void TutorialSelector::SlaveBegin(TTree *tree)
{
fMatEn = new TH2D("engMat", "Energy Matrix",
100, 0, 100,
7000, 0, 7000);
GetOutputList()->Add(fMatEn);
}
Bool_t TutorialSelector::Process(Long64_t entry)
{
fReader.SetEntry(entry);
if ( *fmultiplicity == 1 )
if( *energy > 2 )
fMatEn->Fill( *adc, fCal->GetEnergy( *energy, *adc ) );
return kTrue;
}
void TutorialSelector::Terminate()
{
fMatEn->Print();
}