1 | /*
|
---|
2 | * Delphes: a framework for fast simulation of a generic collider experiment
|
---|
3 | * Copyright (C) 2012-2014 Universite catholique de Louvain (UCL), Belgium
|
---|
4 | *
|
---|
5 | * This program is free software: you can redistribute it and/or modify
|
---|
6 | * it under the terms of the GNU General Public License as published by
|
---|
7 | * the Free Software Foundation, either version 3 of the License, or
|
---|
8 | * (at your option) any later version.
|
---|
9 | *
|
---|
10 | * This program is distributed in the hope that it will be useful,
|
---|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
13 | * GNU General Public License for more details.
|
---|
14 | *
|
---|
15 | * You should have received a copy of the GNU General Public License
|
---|
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>.
|
---|
17 | */
|
---|
18 |
|
---|
19 | #ifndef DelphesBranchElement_h
|
---|
20 | #define DelphesBranchElement_h
|
---|
21 |
|
---|
22 | #include "TColor.h"
|
---|
23 | #include "TString.h"
|
---|
24 | #include <exception>
|
---|
25 | #include "display/DelphesCaloData.h"
|
---|
26 | #include "TEveElement.h"
|
---|
27 | #include "TEveTrack.h"
|
---|
28 |
|
---|
29 | // virtual class to represent objects from a Delphes-tree branch
|
---|
30 | class DelphesBranchBase
|
---|
31 | {
|
---|
32 | public:
|
---|
33 | DelphesBranchBase(const char* name="", const char*type="", const enum EColor color=kBlack):name_(name),type_(type),color_(color) {}
|
---|
34 | virtual ~DelphesBranchBase() {};
|
---|
35 | const char* GetName() const { return (const char*)name_; }
|
---|
36 | const char* GetType() const { return (const char*)type_; }
|
---|
37 | enum EColor GetColor() const { return color_; }
|
---|
38 | virtual const char* GetClassName() = 0;
|
---|
39 | virtual void Reset() = 0;
|
---|
40 |
|
---|
41 | protected:
|
---|
42 | TString name_;
|
---|
43 | TString type_; // needed for parsing the branch later on
|
---|
44 | const enum EColor color_;
|
---|
45 | };
|
---|
46 |
|
---|
47 | // concrete implementations. EveContainer can be a TrackList, ElementList or CaloData.
|
---|
48 | template<typename EveContainer> class DelphesBranchElement: public DelphesBranchBase
|
---|
49 | {
|
---|
50 | public:
|
---|
51 | // constructor
|
---|
52 | DelphesBranchElement(const char* name="", const char*type="", const enum EColor color=kBlack):DelphesBranchBase(name, type, color) {
|
---|
53 | throw std::exception();
|
---|
54 | }
|
---|
55 |
|
---|
56 | // destructor
|
---|
57 | virtual ~DelphesBranchElement() { delete data_; }
|
---|
58 |
|
---|
59 | // get the container (ElementList, TrackList, or CaloData)
|
---|
60 | EveContainer* GetContainer() { return data_; }
|
---|
61 |
|
---|
62 | // resets the collection (before moving to the next event)
|
---|
63 | virtual void Reset() {};
|
---|
64 |
|
---|
65 | // template class name
|
---|
66 | virtual const char* GetClassName() { return data_->ClassName(); }
|
---|
67 |
|
---|
68 | private:
|
---|
69 | EveContainer* data_;
|
---|
70 | };
|
---|
71 |
|
---|
72 | #if !defined(__CINT__) && !defined(__CLING__)
|
---|
73 |
|
---|
74 | // special case for calo towers
|
---|
75 | template<> DelphesBranchElement<DelphesCaloData>::DelphesBranchElement(const char* name, const char*type, const enum EColor color);
|
---|
76 | template<> void DelphesBranchElement<DelphesCaloData>::Reset();
|
---|
77 |
|
---|
78 | // special case for element lists
|
---|
79 | template<> DelphesBranchElement<TEveElementList>::DelphesBranchElement(const char* name, const char*type, const enum EColor color);
|
---|
80 | template<> void DelphesBranchElement<TEveElementList>::Reset();
|
---|
81 |
|
---|
82 | // special case for track lists
|
---|
83 | template<> DelphesBranchElement<TEveTrackList>::DelphesBranchElement(const char* name, const char*type, const enum EColor color);
|
---|
84 | template<> void DelphesBranchElement<TEveTrackList>::Reset();
|
---|
85 |
|
---|
86 | #endif // CINT, CLING
|
---|
87 |
|
---|
88 | #endif //DelphesBranchElement_h
|
---|