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