-
Notifications
You must be signed in to change notification settings - Fork 4
/
multidraw.h
97 lines (74 loc) · 2.99 KB
/
multidraw.h
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
// @(#)root/treeplayer:$Id$
// Author: Rene Brun 12/01/96
/*************************************************************************
* Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
* All rights reserved. *
* *
* For the licensing terms see $ROOTSYS/LICENSE. *
* For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/
#ifndef ROOT_TMultiDrawTreePlayer
#define ROOT_TMultiDrawTreePlayer
//////////////////////////////////////////////////////////////////////////
// //
// TMultiDrawTreePlayer //
// //
// A TTree object is a list of TBranch. //
// To Create a TTree object one must: //
// - Create the TTree header via the TTree constructor //
// - Call the TBranch constructor for every branch. //
// //
// To Fill this object, use member function Fill with no parameters. //
// The Fill function loops on all defined TBranch. //
// //
//////////////////////////////////////////////////////////////////////////
#ifndef ROOT_TTreePlayer
#include "TTreePlayer.h"
#endif
#include "multiselect.h"
#include <TTree.h>
#include <TVirtualTreePlayer.h>
#include <memory>
#include <unordered_map>
#include <iostream>
#include <unistd.h>
#include <chrono>
#include <ctime>
#include <numeric>
class TVirtualIndex;
struct DrawData {
std::shared_ptr<TSelectorDraw> selector;
std::shared_ptr<TList> input;
Long64_t firstentry;
Long64_t nentries;
std::string options;
};
class NotifyProxier: public TObject {
public:
NotifyProxier(const std::vector<DrawData>& draws):
m_draws(draws) {
// Empty
}
virtual Bool_t Notify() override {
bool ret = true;
for (auto& draw: m_draws) {
ret &= draw.selector->Notify();
}
return ret;
}
private:
const std::vector<DrawData>& m_draws;
};
class TMultiDrawTreePlayer: public TTreePlayer {
private:
TMultiDrawTreePlayer(const TMultiDrawTreePlayer &);
TMultiDrawTreePlayer& operator=(const TMultiDrawTreePlayer &);
protected:
std::vector<DrawData> m_draws;
public:
TMultiDrawTreePlayer();
virtual ~TMultiDrawTreePlayer();
virtual bool queueDraw(const char* varexp, const char* selection, Option_t *option = "", Long64_t nentries = 1000000000, Long64_t firstentry = 0);
virtual bool execute();
};
#endif