Changes in display/DelphesBranchElement.h [341014c:7066f9c] in git
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
display/DelphesBranchElement.h
r341014c r7066f9c 20 20 #define DelphesBranchElement_h 21 21 22 #include "TColor.h" 23 #include "TString.h" 24 #include "TClonesArray.h" 22 25 #include "TClass.h" 23 #include "TClonesArray.h" 24 #include "TColor.h" 26 #include <exception> 27 #include <iostream> 28 #include "display/DelphesCaloData.h" 25 29 #include "TEveElement.h" 26 30 #include "TEveTrack.h" 27 #include "TString.h"28 #include "display/DelphesCaloData.h"29 #include <exception>30 #include <iostream>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.) : 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; 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; 52 46 53 protected:54 TString name_;55 Float_t maxPt_;56 TClonesArray *branch_;57 const enum EColor color_;58 Float_t tkRadius_,tkHalfLength_, tk_Bz_;47 protected: 48 TString name_; 49 Float_t maxPt_; 50 TClonesArray* branch_; 51 const enum EColor color_; 52 Float_t tkRadius_,tkHalfLength_, tk_Bz_; 59 53 }; 60 54 61 55 // concrete implementations. EveContainer can be a TrackList, ElementList or CaloData. 62 template <typename EveContainer> 63 class DelphesBranchElement: public DelphesBranchBase 56 template<typename EveContainer> class DelphesBranchElement: public DelphesBranchBase 64 57 { 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 } 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 } 72 63 73 // destructor74 virtual ~DelphesBranchElement() { delete data_; }64 // destructor 65 virtual ~DelphesBranchElement() { delete data_; } 75 66 76 // get the container (ElementList, TrackList, or CaloData)77 EveContainer *GetContainer() { return data_; }67 // get the container (ElementList, TrackList, or CaloData) 68 EveContainer* GetContainer() { return data_; } 78 69 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 } 70 // tracking volume 71 virtual void SetTrackingVolume(Float_t r, Float_t l, Float_t Bz=0.) { tkRadius_ = r; tkHalfLength_ = l; tk_Bz_ = Bz; } 86 72 87 // resets the collection (before moving to the next event)88 virtual void Reset(){};73 // resets the collection (before moving to the next event) 74 virtual void Reset() {}; 89 75 90 // template class name91 virtual const char *GetClassName() { return data_->ClassName(); }76 // template class name 77 virtual const char* GetClassName() { return data_->ClassName(); } 92 78 93 // read the branch and fill elements for display94 virtual void ReadBranch() {}79 // read the branch and fill elements for display 80 virtual void ReadBranch() {} 95 81 96 // return the vector for all elements 97 virtual std::vector<TLorentzVector> GetVectors() 98 { 99 std::vector<TLorentzVector> v; 100 return v; 101 } 82 // return the vector for all elements 83 virtual std::vector<TLorentzVector> GetVectors() { std::vector<TLorentzVector> v; return v; } 102 84 103 private:104 EveContainer *data_;85 private: 86 EveContainer* data_; 105 87 }; 106 88 … … 108 90 109 91 // special case for calo towers 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(); 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(); 118 96 119 97 // special case for element lists 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(); 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(); 128 102 129 103 // special case for track lists 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(); 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(); 140 109 141 110 #endif // CINT, CLING
Note:
See TracChangeset
for help on using the changeset viewer.