-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathTStarJetReaderParticleContainer.cxx
More file actions
121 lines (103 loc) · 2.6 KB
/
TStarJetReaderParticleContainer.cxx
File metadata and controls
121 lines (103 loc) · 2.6 KB
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#include "TStarJetReaderParticleContainer.h"
#include <TChain.h>
#include <TList.h>
#include <TStopwatch.h>
#include "TStarJetPicoUtils.h"
#include "TStarJetPicoDefinitions.h"
#include "TStarJetVectorContainer.h"
ClassImp(TStarJetReaderParticleContainer)
TStarJetReaderParticleContainer::TStarJetReaderParticleContainer()
: TStarJetPicoReaderBase()
, fBranchName("Particles")
{
//
// Default constructor
//
}
TStarJetReaderParticleContainer::~TStarJetReaderParticleContainer()
{
//
// Destructor
//
}
Int_t TStarJetReaderParticleContainer::ReadEvent(Long64_t ientry)
{
//
// Load an event with return codes:
// -1 == error;
// 0 == event loaded but not passed cuts;
// 1 == OK!
// Calling ProcessEvent().
//
fOutputContainer->Clear();
fSelectedTracks->Clear();
fSelectedTowers->Clear();
fSelectedV0s->Clear();
if (ientry < fNofEntries && ientry >= 0)
{
if (fOutputContainer == 0)
{
__ERROR(Form("Bad output container pointer %p", fOutputContainer));
return -1;
}
fInputTree->SetBranchAddress(fBranchName.Data(), &fOutputContainer, &fBranch);
//Long64_t centry = fInputTree->LoadTree(ientry);
Long64_t centrybytes = fInputTree->GetEvent(ientry);
if (centrybytes < 0)
{
__ERROR(Form("Unable to load entry %lld", ientry));
return -1;
}
else
{
fNEntry = ientry;
fNEntryLoaded = ientry;
Bool_t isaccept = ProcessEvent();
if (isaccept == kTRUE)
{
fNEntriesAccepted++;
__DEBUG(3, Form("Events accepted %lld.", fNEntriesAccepted));
return 1;
}
else
{
return 0;
}
}
}
if (GetStopWatch() != 0)
GetStopWatch()->Stop();
__ERROR(Form("Request for an event outside limits (%lld-%lld). NEntries is %lld",
0ll, fNofEntries-1, fNofEntries));
return -1;
}
void TStarJetReaderParticleContainer::Init(Long64_t nevents)
{
//
// Initialize. Must be called before NextEvent() or ReadEvent().
//
__INFO("INIT");
// do some more init here! with the current chain... or the input is
if (fInputTree == 0)
{
__ERROR("Chain not initialized! SetInput first.");
}
fBranch = fInputTree->GetBranch(fBranchName.Data());
if (fBranch == 0)
{
__ERROR("Unable to get the branch!");
return;
}
fBranch->SetAddress(&fOutputContainer);
fNofEntries = fInputTree->GetEntries();
__INFO(Form("Number of events in the chain %lld", fNofEntries));
if (nevents > -1)
{
if (nevents < fNofEntries)
{
fNofEntries = nevents;
}
}
__INFO(Form("Run set for %lld events.", fNofEntries));
fNEntry = 0;
}