- Timestamp:
- Oct 15, 2014, 2:09:13 AM (10 years ago)
- Branches:
- ImprovedOutputFile, Timing, dual_readout, llp, master
- Children:
- b3c42d3
- Parents:
- 5bb66c9
- Location:
- display
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
display/DelphesBranchElement.cc
r5bb66c9 r115298d 1 /*2 * Delphes: a framework for fast simulation of a generic collider experiment3 * Copyright (C) 2012-2014 Universite catholique de Louvain (UCL), Belgium4 *5 * This program is free software: you can redistribute it and/or modify6 * it under the terms of the GNU General Public License as published by7 * the Free Software Foundation, either version 3 of the License, or8 * (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 of12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the13 * GNU General Public License for more details.14 *15 * You should have received a copy of the GNU General Public License16 * along with this program. If not, see <http://www.gnu.org/licenses/>.17 */18 19 #include "display/DelphesBranchElement.h"20 21 // special case for calo towers22 template<> DelphesBranchElement<DelphesCaloData>::DelphesBranchElement(const char* name, const char*type, const enum EColor color):DelphesBranchBase(name, type, color) {23 if(TString(type)=="tower") {24 data_ = new DelphesCaloData(2);25 data_->RefSliceInfo(0).Setup("ECAL", 0.1, kRed);26 data_->RefSliceInfo(1).Setup("HCAL", 0.1, kBlue);27 data_->IncDenyDestroy();28 } else {29 throw std::exception();30 }31 }32 template<> void DelphesBranchElement<DelphesCaloData>::Reset() { data_->ClearTowers(); }33 34 // special case for element lists35 template<> DelphesBranchElement<TEveElementList>::DelphesBranchElement(const char* name, const char*type, const enum EColor color):DelphesBranchBase(name, type, color) {36 if(TString(type)=="vector" || TString(type)=="jet") {37 data_ = new TEveElementList(name);38 data_->SetMainColor(color_);39 } else {40 throw std::exception();41 }42 }43 template<> void DelphesBranchElement<TEveElementList>::Reset() { data_->DestroyElements(); }44 45 // special case for track lists46 template<> DelphesBranchElement<TEveTrackList>::DelphesBranchElement(const char* name, const char*type, const enum EColor color):DelphesBranchBase(name, type, color) {47 if(TString(type)=="track") {48 data_ = new TEveTrackList(name);49 data_->SetMainColor(color_);50 data_->SetMarkerColor(color_);51 data_->SetMarkerStyle(kCircle);52 data_->SetMarkerSize(0.5);53 } else if(TString(type)=="photon") {54 data_ = new TEveTrackList(name);55 data_->SetMainColor(color_);56 data_->SetMarkerColor(color_);57 data_->SetMarkerStyle(kCircle);58 data_->SetMarkerSize(0.5);59 } else {60 throw std::exception();61 }62 }63 template<> void DelphesBranchElement<TEveTrackList>::Reset() { data_->DestroyElements(); }64 -
display/DelphesBranchElement.h
r5bb66c9 r115298d 31 31 { 32 32 public: 33 DelphesBranchBase(const char* name="", const char*type="", const enum EColor color=kBlack):name_(name),type_(type),color_(color) {} 33 DelphesBranchBase():color_(kBlack) {} 34 DelphesBranchBase(const char* name, const char*type, const enum EColor color):name_(name),type_(type),color_(color) {} 34 35 virtual ~DelphesBranchBase() {}; 35 36 const char* GetName() const { return (const char*)name_; } … … 50 51 public: 51 52 // constructor 52 DelphesBranchElement(const char* name="", const char*type="", const enum EColor color=kBlack):DelphesBranchBase(name, type, color) { 53 throw std::exception(); 54 } 53 DelphesBranchElement():DelphesBranchBase() {} 54 DelphesBranchElement(const char* name, const char*type, const enum EColor color):DelphesBranchBase(name, type, color) {} 55 55 56 56 // destructor … … 61 61 62 62 // resets the collection (before moving to the next event) 63 virtual void Reset() {};63 virtual void Reset() = 0; 64 64 65 65 // template class name … … 71 71 72 72 // special case for calo towers 73 template<> DelphesBranchElement<DelphesCaloData>::DelphesBranchElement(const char* name, const char*type, const enum EColor color); 74 template<> void DelphesBranchElement<DelphesCaloData>::Reset(); 73 template<> class DelphesBranchElement<DelphesCaloData>: public DelphesBranchBase 74 { 75 public: 76 // constructor 77 DelphesBranchElement():DelphesBranchBase() {} 78 DelphesBranchElement(const char* name, const char*type, const enum EColor color):DelphesBranchBase(name, type, color) { 79 if(TString(type)=="tower") { 80 data_ = new DelphesCaloData(2); 81 data_->RefSliceInfo(0).Setup("ECAL", 0.1, kRed); 82 data_->RefSliceInfo(1).Setup("HCAL", 0.1, kBlue); 83 data_->IncDenyDestroy(); 84 } else { 85 throw std::exception(); 86 } 87 } 88 89 // destructor 90 virtual ~DelphesBranchElement() { delete data_; } 91 92 // get the container (ElementList, TrackList, or CaloData) 93 DelphesCaloData* GetContainer() { return data_; } 94 95 // resets the collection (before moving to the next event) 96 virtual void Reset() { data_->ClearTowers(); } 97 98 // template class name 99 virtual const char* GetClassName() { return data_->ClassName(); } 100 101 private: 102 DelphesCaloData* data_; 103 }; 104 //template<> DelphesBranchElement<DelphesCaloData>::DelphesBranchElement(const char* name, const char*type, const enum EColor color); 105 //template<> void DelphesBranchElement<DelphesCaloData>::Reset(); 75 106 76 107 // special case for element lists 77 template<> DelphesBranchElement<TEveElementList>::DelphesBranchElement(const char* name, const char*type, const enum EColor color); 78 template<> void DelphesBranchElement<TEveElementList>::Reset(); 108 template<> class DelphesBranchElement<TEveElementList>: public DelphesBranchBase 109 { 110 public: 111 // constructor 112 DelphesBranchElement():DelphesBranchBase() {} 113 DelphesBranchElement(const char* name, const char*type, const enum EColor color):DelphesBranchBase(name, type, color) { 114 if(TString(type)=="vector" || TString(type)=="jet") { 115 data_ = new TEveElementList(name); 116 data_->SetMainColor(color_); 117 } else { 118 throw std::exception(); 119 } 120 } 121 122 // destructor 123 virtual ~DelphesBranchElement() { delete data_; } 124 125 // get the container (ElementList, TrackList, or CaloData) 126 TEveElementList* GetContainer() { return data_; } 127 128 // resets the collection (before moving to the next event) 129 virtual void Reset() { data_->DestroyElements(); } 130 131 // template class name 132 virtual const char* GetClassName() { return data_->ClassName(); } 133 134 private: 135 TEveElementList* data_; 136 }; 137 //template<> DelphesBranchElement<TEveElementList>::DelphesBranchElement(const char* name, const char*type, const enum EColor color); 138 //template<> void DelphesBranchElement<TEveElementList>::Reset(); 79 139 80 140 // special case for track lists 81 template<> DelphesBranchElement<TEveTrackList>::DelphesBranchElement(const char* name, const char*type, const enum EColor color); 82 template<> void DelphesBranchElement<TEveTrackList>::Reset(); 141 template<> class DelphesBranchElement<TEveTrackList>: public DelphesBranchBase 142 { 143 public: 144 // constructor 145 DelphesBranchElement():DelphesBranchBase() {} 146 DelphesBranchElement(const char* name, const char*type, const enum EColor color):DelphesBranchBase(name, type, color) { 147 if(TString(type)=="track") { 148 data_ = new TEveTrackList(name); 149 data_->SetMainColor(color_); 150 data_->SetMarkerColor(color_); 151 data_->SetMarkerStyle(kCircle); 152 data_->SetMarkerSize(0.5); 153 } else if(TString(type)=="photon") { 154 data_ = new TEveTrackList(name); 155 data_->SetMainColor(color_); 156 data_->SetMarkerColor(color_); 157 data_->SetMarkerStyle(kCircle); 158 data_->SetMarkerSize(0.5); 159 } else { 160 throw std::exception(); 161 } 162 } 163 164 // destructor 165 virtual ~DelphesBranchElement() { delete data_; } 166 167 // get the container (ElementList, TrackList, or CaloData) 168 TEveTrackList* GetContainer() { return data_; } 169 170 // resets the collection (before moving to the next event) 171 virtual void Reset() { data_->DestroyElements(); } 172 173 // template class name 174 virtual const char* GetClassName() { return data_->ClassName(); } 175 176 private: 177 TEveTrackList* data_; 178 }; 179 //template<> DelphesBranchElement<TEveTrackList>::DelphesBranchElement(const char* name, const char*type, const enum EColor color); 180 //template<> void DelphesBranchElement<TEveTrackList>::Reset(); 83 181 84 182 #endif //DelphesBranchElement_h -
display/DisplayLinkDef.h
r5bb66c9 r115298d 42 42 #pragma link C++ class DelphesDisplay+; 43 43 #pragma link C++ class DelphesCaloData+; 44 #pragma link C++ class DelphesBranchElement<DelphesCaloData>-!; 45 #pragma link C++ class DelphesBranchElement<TEveElementList>-!; 46 #pragma link C++ class DelphesBranchElement<TEveTrackList>-!; 44 //#pragma link C++ function DelphesBranchElement<DelphesCaloData>::DelphesBranchElement(const char*, const char*, const enum EColor); 45 //#pragma link C++ function DelphesBranchElement<DelphesCaloData>::Reset(); 46 #pragma link C++ class DelphesBranchElement<DelphesCaloData>; 47 #pragma link C++ class DelphesBranchElement<TEveElementList>; 48 #pragma link C++ class DelphesBranchElement<TEveTrackList>; 47 49 48 50 #endif
Note:
See TracChangeset
for help on using the changeset viewer.