Fork me on GitHub

source: git/display/DelphesBranchElement.h@ 4265189

Timing
Last change on this file since 4265189 was 341014c, checked in by Pavel Demin <pavel-demin@…>, 6 years ago

apply .clang-format to all .h, .cc and .cpp files

  • Property mode set to 100644
File size: 4.6 KB
Line 
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 "TClass.h"
23#include "TClonesArray.h"
24#include "TColor.h"
25#include "TEveElement.h"
26#include "TEveTrack.h"
27#include "TString.h"
28#include "display/DelphesCaloData.h"
29#include <exception>
30#include <iostream>
31
32// virtual class to represent objects from a Delphes-tree branch
33class DelphesBranchBase
34{
35public:
36 DelphesBranchBase(const char *name = "", TClonesArray *branch = NULL, const enum EColor color = kBlack, Float_t maxPt = 50.) :
37 name_(name), maxPt_(maxPt), branch_(branch), color_(color) {}
38 virtual ~DelphesBranchBase() {}
39 const char *GetName() const { return (const char *)name_; }
40 const char *GetType() const { return branch_ ? branch_->GetClass()->GetName() : "None"; }
41 virtual const char *GetClassName() = 0;
42 enum EColor GetColor() const { return color_; }
43 virtual void Reset() = 0;
44 virtual void SetTrackingVolume(Float_t r, Float_t l, Float_t Bz = 0.)
45 {
46 tkRadius_ = r;
47 tkHalfLength_ = l;
48 tk_Bz_ = Bz;
49 }
50 virtual void ReadBranch() = 0;
51 virtual std::vector<TLorentzVector> GetVectors() = 0;
52
53protected:
54 TString name_;
55 Float_t maxPt_;
56 TClonesArray *branch_;
57 const enum EColor color_;
58 Float_t tkRadius_, tkHalfLength_, tk_Bz_;
59};
60
61// concrete implementations. EveContainer can be a TrackList, ElementList or CaloData.
62template <typename EveContainer>
63class DelphesBranchElement: public DelphesBranchBase
64{
65public:
66 // constructor
67 DelphesBranchElement(const char *name = "", TClonesArray *branch = NULL, const enum EColor color = kBlack, Float_t maxPt = 50.) :
68 DelphesBranchBase(name, branch, color, maxPt)
69 {
70 throw std::exception();
71 }
72
73 // destructor
74 virtual ~DelphesBranchElement() { delete data_; }
75
76 // get the container (ElementList, TrackList, or CaloData)
77 EveContainer *GetContainer() { return data_; }
78
79 // tracking volume
80 virtual void SetTrackingVolume(Float_t r, Float_t l, Float_t Bz = 0.)
81 {
82 tkRadius_ = r;
83 tkHalfLength_ = l;
84 tk_Bz_ = Bz;
85 }
86
87 // resets the collection (before moving to the next event)
88 virtual void Reset(){};
89
90 // template class name
91 virtual const char *GetClassName() { return data_->ClassName(); }
92
93 // read the branch and fill elements for display
94 virtual void ReadBranch() {}
95
96 // return the vector for all elements
97 virtual std::vector<TLorentzVector> GetVectors()
98 {
99 std::vector<TLorentzVector> v;
100 return v;
101 }
102
103private:
104 EveContainer *data_;
105};
106
107#if !defined(__CINT__) && !defined(__CLING__)
108
109// special case for calo towers
110template <>
111DelphesBranchElement<DelphesCaloData>::DelphesBranchElement(const char *name, TClonesArray *branch, const enum EColor color, Float_t maxPt);
112template <>
113void DelphesBranchElement<DelphesCaloData>::Reset();
114template <>
115void DelphesBranchElement<DelphesCaloData>::ReadBranch();
116template <>
117std::vector<TLorentzVector> DelphesBranchElement<DelphesCaloData>::GetVectors();
118
119// special case for element lists
120template <>
121DelphesBranchElement<TEveElementList>::DelphesBranchElement(const char *name, TClonesArray *branch, const enum EColor color, Float_t maxPt);
122template <>
123void DelphesBranchElement<TEveElementList>::Reset();
124template <>
125void DelphesBranchElement<TEveElementList>::ReadBranch();
126template <>
127std::vector<TLorentzVector> DelphesBranchElement<TEveElementList>::GetVectors();
128
129// special case for track lists
130template <>
131DelphesBranchElement<TEveTrackList>::DelphesBranchElement(const char *name, TClonesArray *branch, const enum EColor color, Float_t maxPt);
132template <>
133void DelphesBranchElement<TEveTrackList>::SetTrackingVolume(Float_t r, Float_t l, Float_t Bz);
134template <>
135void DelphesBranchElement<TEveTrackList>::Reset();
136template <>
137void DelphesBranchElement<TEveTrackList>::ReadBranch();
138template <>
139std::vector<TLorentzVector> DelphesBranchElement<TEveTrackList>::GetVectors();
140
141#endif // CINT, CLING
142
143#endif //DelphesBranchElement_h
Note: See TracBrowser for help on using the repository browser.