Fork me on GitHub

source: git/display/Delphes3DGeometry.cc@ 3cac201

ImprovedOutputFile Timing dual_readout llp
Last change on this file since 3cac201 was 042c7b3, checked in by Michele Selvaggi <michele.selvaggi@…>, 10 years ago

adapted Event Display detector card parser for reading efficiency formula without backslashes

  • Property mode set to 100644
File size: 19.4 KB
RevLine 
[369744d]1/*
2 * Delphes: a framework for fast simulation of a generic collider experiment
3 * Copyright (C) 2012-2014 Universite catholique de Louvain (UCL), Belgium
[1fa50c2]4 *
[369744d]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.
[1fa50c2]9 *
[369744d]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.
[1fa50c2]14 *
[369744d]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
[cfc3160]19#include "display/Delphes3DGeometry.h"
20#include <set>
21#include <map>
[042c7b3]22#include <string>
[cfc3160]23#include <utility>
24#include <vector>
25#include <algorithm>
26#include <sstream>
27#include <cassert>
28#include "TGeoManager.h"
29#include "TGeoVolume.h"
30#include "TGeoMedium.h"
31#include "TGeoNode.h"
32#include "TGeoCompositeShape.h"
33#include "TGeoMatrix.h"
34#include "TGeoTube.h"
35#include "TGeoCone.h"
36#include "TGeoArb8.h"
37#include "external/ExRootAnalysis/ExRootConfReader.h"
38#include "classes/DelphesClasses.h"
39#include "TF2.h"
[042c7b3]40#include "TFormula.h"
[cfc3160]41#include "TH1F.h"
42#include "TMath.h"
43
44using namespace std;
45
[110821a]46Delphes3DGeometry::Delphes3DGeometry(TGeoManager *geom, bool transp) {
[cfc3160]47
48 //--- the geometry manager
49 geom_ = geom==NULL? gGeoManager : geom;
50 //gGeoManager->DefaultColors();
51
52 //--- define some materials
53 TGeoMaterial *matVacuum = new TGeoMaterial("Vacuum", 0,0,0);
54 TGeoMaterial *matAl = new TGeoMaterial("Al", 26.98,13,2.7); // placeholder
[110821a]55 if(transp) {
56 matVacuum->SetTransparency(85);
57 matAl->SetTransparency(85);
58 }
[cfc3160]59
60 //--- define some media
61 TGeoMedium *Vacuum = new TGeoMedium("Vacuum",1, matVacuum);
62 TGeoMedium *Al = new TGeoMedium("Root Material",2, matAl);
63 vacuum_ = Vacuum;
64 tkmed_ = Vacuum; // placeholder
65 calomed_ = Al; // placeholder
66 mudetmed_ = Al; // placeholder
67
68 // custom parameters
69 contingency_ = 10.;
70 calo_barrel_thickness_ = 50.;
71 calo_endcap_thickness_ = 75.;
72 muonSystem_thickn_ = 10.;
73
74 // read these parameters from the Delphes Card (with default values)
75 etaAxis_ = NULL;
76 phiAxis_ = NULL;
77 tk_radius_ = 120.;
78 tk_length_ = 150.;
79 tk_etamax_ = 3.0;
80 tk_Bz_ = 1.;
81 muonSystem_radius_ = 200.;
82}
83
84void Delphes3DGeometry::readFile(const char *configFile,
85 const char* ParticlePropagator, const char* TrackingEfficiency,
86 const char* MuonEfficiency, const char* Calorimeters) {
87
88 ExRootConfReader *confReader = new ExRootConfReader;
89 confReader->ReadFile(configFile);
90
91 tk_radius_ = confReader->GetDouble(Form("%s::Radius",ParticlePropagator), 1.0)*100.; // tk_radius
92 tk_length_ = confReader->GetDouble(Form("%s::HalfLength",ParticlePropagator), 3.0)*100.; // tk_length
93 tk_Bz_ = confReader->GetDouble("ParticlePropagator::Bz", 0.0); // tk_Bz
[042c7b3]94
95 string buffer;
96 const char *it;
97
98
[cfc3160]99 {
100 TString tkEffFormula = confReader->GetString(Form("%s::EfficiencyFormula",TrackingEfficiency),"abs(eta)<3.0");
101 tkEffFormula.ReplaceAll("pt","x");
102 tkEffFormula.ReplaceAll("eta","y");
103 tkEffFormula.ReplaceAll("phi","0.");
[042c7b3]104
105 for(it = tkEffFormula.Data(); *it; ++it)
106 {
107 if(*it == ' ' || *it == '\t' || *it == '\r' || *it == '\n' || *it == '\\' ) continue;
108 buffer.push_back(*it);
109 }
110
111 TF2* tkEffFunction = new TF2("tkEff",buffer.c_str(),0,1000,-10,10);
[cfc3160]112 TH1F etaHisto("eta","eta",100,5.,-5.);
113 Double_t pt,eta;
114 for(int i=0;i<1000;++i) {
115 tkEffFunction->GetRandom2(pt,eta);
116 etaHisto.Fill(eta);
117 }
118 Int_t bin = -1;
119 bin = etaHisto.FindFirstBinAbove(0.5);
120 Double_t etamin = (bin>-1) ? etaHisto.GetBinLowEdge(bin) : -10.;
121 bin = etaHisto.FindLastBinAbove(0.5);
122 Double_t etamax = (bin>-1) ? etaHisto.GetBinLowEdge(bin+1) : -10.;
123 tk_etamax_ = TMath::Max(fabs(etamin),fabs(etamax)); // tk_etamax
124 delete tkEffFunction;
125 }
126
127 {
128 muondets_.push_back("muons");
129 TString muonEffFormula = confReader->GetString(Form("%s::EfficiencyFormula",MuonEfficiency),"abs(eta)<2.0");
130 muonEffFormula.ReplaceAll("pt","x");
131 muonEffFormula.ReplaceAll("eta","y");
132 muonEffFormula.ReplaceAll("phi","0.");
[042c7b3]133
134 buffer.clear();
135 for(it = muonEffFormula.Data(); *it; ++it)
136 {
137 if(*it == ' ' || *it == '\t' || *it == '\r' || *it == '\n' || *it == '\\' ) continue;
138 buffer.push_back(*it);
139 }
140
141 TF2* muEffFunction = new TF2("muEff",buffer.c_str(),0,1000,-10,10);
[cfc3160]142 TH1F etaHisto("eta2","eta2",100,5.,-5.);
143 Double_t pt,eta;
144 for(int i=0;i<1000;++i) {
145 muEffFunction->GetRandom2(pt,eta);
146 etaHisto.Fill(eta);
147 }
148 Int_t bin = -1;
149 bin = etaHisto.FindFirstBinAbove(0.5);
150 Double_t etamin = (bin>-1) ? etaHisto.GetBinLowEdge(bin) : -10.;
151 bin = etaHisto.FindLastBinAbove(0.5);
152 Double_t etamax = (bin>-1) ? etaHisto.GetBinLowEdge(bin+1) : -10.;
153 muonSystem_etamax_["muons"] = TMath::Max(fabs(etamin),fabs(etamax)); // muonSystem_etamax
154 delete muEffFunction;
155 }
156
157 std::string s(Calorimeters);
158 std::replace( s.begin(), s.end(), ',', ' ' );
159 std::istringstream stream( s );
160 std::string word;
161 while (stream >> word) calorimeters_.push_back(word);
162
163 caloBinning_.clear(); // calo binning
164 for(std::vector<std::string>::const_iterator calo=calorimeters_.begin();calo!=calorimeters_.end(); ++calo) {
165 set< pair<Double_t, Int_t> > caloBinning;
166 ExRootConfParam paramEtaBins, paramPhiBins;
167 ExRootConfParam param = confReader->GetParam(Form("%s::EtaPhiBins",calo->c_str()));
168 Int_t size = param.GetSize();
169 for(int i = 0; i < size/2; ++i) {
170 paramEtaBins = param[i*2];
171 paramPhiBins = param[i*2+1];
172 assert(paramEtaBins.GetSize()==1);
173 caloBinning.insert(std::make_pair(paramEtaBins[0].GetDouble(),paramPhiBins.GetSize()-1));
174 }
175 caloBinning_[*calo] = caloBinning;
176 }
177
178 set< pair<Double_t, Int_t> > caloBinning = caloBinning_[*calorimeters_.begin()];
179 Double_t *etaBins = new Double_t[caloBinning.size()]; // note that this is the eta binning of the first calo
180 unsigned int ii = 0;
181 for(set< pair<Double_t, Int_t> >::const_iterator itEtaSet = caloBinning.begin(); itEtaSet != caloBinning.end(); ++itEtaSet) {
182 etaBins[ii++] = itEtaSet->first;
183 }
184 etaAxis_ = new TAxis(caloBinning.size() - 1, etaBins);
185 phiAxis_ = new TAxis(72, -TMath::Pi(), TMath::Pi()); // note that this is fixed while #phibins could vary, also with eta, which doesn't seem possible in ROOT
186
187 muonSystem_radius_ = tk_radius_ + contingency_ + (contingency_+calo_barrel_thickness_)*calorimeters_.size() + muonSystem_thickn_;
188 muonSystem_length_ = tk_length_ + contingency_ + (contingency_+calo_endcap_thickness_)*calorimeters_.size() + muonSystem_thickn_;
189
190 delete confReader;
191
192}
193
194TGeoVolume* Delphes3DGeometry::getDetector(bool withTowers) {
195 // compute the envelope
196 Double_t system_radius = tk_radius_+calo_barrel_thickness_+3*contingency_;
197 Double_t system_length = tk_length_+contingency_+(contingency_+calo_endcap_thickness_)*calorimeters_.size()+contingency_;
198 // the detector volume
199 TGeoVolume *top = geom_->MakeBox("Delphes3DGeometry", vacuum_, system_radius, system_radius, system_length);
200 // build the detector
201 std::pair<Double_t, Double_t> limits = addTracker(top);
202 Double_t radius = limits.first;
203 Double_t length = limits.second;
204 for(std::vector<std::string>::const_iterator calo = calorimeters_.begin(); calo != calorimeters_.end(); ++calo) {
205 limits = addCalorimeter(top,calo->c_str(),radius,length,caloBinning_[*calo]);
206 if (withTowers) {
207 addCaloTowers(top,calo->c_str(),radius,length,caloBinning_[*calo]);
208 }
209 radius = limits.first;
210 length = limits.second;
211 }
212 for(std::vector<std::string>::const_iterator muon = muondets_.begin(); muon != muondets_.end(); ++muon) {
213 limits = addMuonDets(top, muon->c_str(), radius, length);
214 radius = limits.first;
215 length = limits.second;
216 }
217 // return the result
218 return top;
219}
220
221std::pair<Double_t, Double_t> Delphes3DGeometry::addTracker(TGeoVolume *top) {
222 // tracker: a cylinder with two cones substracted
223 new TGeoCone("forwardTkAcceptance",(tk_length_/2.+0.05),0.,tk_radius_,(tk_length_)*2.*exp(-tk_etamax_)/(1-exp(-2.*tk_etamax_)),tk_radius_);
224 TGeoTranslation *tr1 = new TGeoTranslation("tkacc1",0., 0., tk_length_/2.);
225 tr1->RegisterYourself();
226 TGeoRotation *negz = new TGeoRotation("tknegz",0,180,0);
227 negz->RegisterYourself();
228 TGeoCombiTrans *tr2 = new TGeoCombiTrans("tkacc2",0.,0.,-tk_length_/2.,negz);
229 tr2->RegisterYourself();
230 TGeoCompositeShape* tracker_cs = new TGeoCompositeShape("tracker_cs","forwardTkAcceptance:tkacc1+forwardTkAcceptance:tkacc2");
231 TGeoVolume *tracker = new TGeoVolume("tracker",tracker_cs,tkmed_);
232 tracker->SetLineColor(kYellow);
233 top->AddNode(tracker,1);
234 return std::make_pair(tk_radius_,tk_length_);
235}
236
237std::pair<Double_t, Double_t> Delphes3DGeometry::addCalorimeter(TGeoVolume *top, const char* name,
238 Double_t innerBarrelRadius, Double_t innerBarrelLength, set< pair<Double_t, Int_t> >& caloBinning) {
239 // parameters derived from the inputs
240 Double_t calo_endcap_etamax = TMath::Max(fabs(caloBinning.begin()->first),fabs(caloBinning.rbegin()->first));
241 Double_t calo_barrel_innerRadius = innerBarrelRadius+contingency_;
242 Double_t calo_barrel_length = innerBarrelLength + calo_barrel_thickness_;
243 Double_t calo_endcap_etamin = -log(innerBarrelRadius/(2*innerBarrelLength));
244 Double_t calo_endcap_innerRadius1 = innerBarrelLength*2.*exp(-calo_endcap_etamax)/(1-exp(-2.*calo_endcap_etamax));
245 Double_t calo_endcap_innerRadius2 = (innerBarrelLength+calo_endcap_thickness_)*2.*exp(-calo_endcap_etamax)/(1-exp(-2.*calo_endcap_etamax));
246 Double_t calo_endcap_outerRadius1 = innerBarrelRadius;
247 Double_t calo_endcap_outerRadius2 = innerBarrelRadius+calo_barrel_thickness_;
248 Double_t calo_endcap_coneThickness = TMath::Min(calo_barrel_thickness_ * (1-exp(-2.*calo_endcap_etamin)) / (2.*exp(-calo_endcap_etamin)), calo_endcap_thickness_);
249 Double_t calo_endcap_diskThickness = TMath::Max(0.,calo_endcap_thickness_-calo_endcap_coneThickness);
250
251 // calorimeters: tube truncated in eta + cones
252 new TGeoTube(Form("%s_barrel_cylinder",name),calo_barrel_innerRadius,calo_barrel_innerRadius+calo_barrel_thickness_,calo_barrel_length);
253 new TGeoCone(Form("%s_endcap_cone",name),calo_endcap_coneThickness/2.,calo_endcap_innerRadius1,calo_endcap_outerRadius1,calo_endcap_innerRadius2,calo_endcap_outerRadius2);
254 new TGeoTube(Form("%s_endcap_disk",name),calo_endcap_innerRadius2,tk_radius_+calo_barrel_thickness_,calo_endcap_diskThickness/2.);
255 TGeoTranslation *tr1 = new TGeoTranslation(Form("%s_tr1",name),0., 0., (calo_endcap_coneThickness+calo_endcap_diskThickness)/2.);
256 tr1->RegisterYourself();
257 TGeoCompositeShape *calo_endcap_cs = new TGeoCompositeShape(Form("%s_endcap_cs",name),Form("%s_endcap_cone+%s_endcap_disk:%s_tr1",name,name,name));
258 TGeoTranslation *trc1 = new TGeoTranslation(Form("%s_endcap1_position",name),0.,0., innerBarrelLength+calo_endcap_coneThickness/2.);
259 trc1->RegisterYourself();
260 TGeoRotation *negz = new TGeoRotation(Form("%s_negz",name),0,180,0);
261 TGeoCombiTrans *trc2 = new TGeoCombiTrans(Form("%s_endcap2_position",name),0.,0.,-(innerBarrelLength+calo_endcap_coneThickness/2.),negz);
262 trc2->RegisterYourself();
263 TGeoTranslation *trc1c = new TGeoTranslation(Form("%s_endcap1_position_cont",name),0.,0., innerBarrelLength+calo_endcap_coneThickness/2.+contingency_);
264 trc1c->RegisterYourself();
265 TGeoCombiTrans *trc2c = new TGeoCombiTrans(Form("%s_endcap2_position_cont",name),0.,0.,-(innerBarrelLength+calo_endcap_coneThickness/2.)-contingency_,negz);
266 trc2c->RegisterYourself();
267 TGeoVolume *calo_endcap = new TGeoVolume(Form("%s_endcap",name),calo_endcap_cs,calomed_);
268 TGeoCompositeShape *calo_barrel_cs = new TGeoCompositeShape(Form("%s_barrel_cs",name),
269 Form("%s_barrel_cylinder-%s_endcap_cs:%s_endcap1_position-%s_endcap_cs:%s_endcap2_position",name,name,name,name,name));
270 TGeoVolume *calo_barrel = new TGeoVolume(Form("%s_barrel",name),calo_barrel_cs,calomed_);
271 calo_endcap->SetLineColor(kViolet);
272 calo_endcap->SetFillColor(kViolet);
273 calo_barrel->SetLineColor(kRed);
274 top->AddNode(calo_endcap,1,trc1c);
275 top->AddNode(calo_endcap,2,trc2c);
276 top->AddNode(calo_barrel,1);
277 return std::make_pair(calo_barrel_innerRadius+calo_barrel_thickness_,innerBarrelLength+calo_endcap_thickness_+contingency_);
278}
279
280std::pair<Double_t, Double_t> Delphes3DGeometry::addMuonDets(TGeoVolume *top, const char* name, Double_t innerBarrelRadius, Double_t innerBarrelLength) {
281 // muon system: tube + disks
282 Double_t muonSystem_radius = innerBarrelRadius + contingency_;
283 Double_t muonSystem_length = innerBarrelLength + contingency_;
284 Double_t muonSystem_rmin = muonSystem_length*2.*exp(-muonSystem_etamax_[name])/(1-exp(-2.*muonSystem_etamax_[name]));
285 TGeoVolume *muon_barrel = geom_->MakeTube(Form("%s_barrel",name),mudetmed_,muonSystem_radius,muonSystem_radius+muonSystem_thickn_,muonSystem_length);
286 muon_barrel->SetLineColor(kBlue);
287 top->AddNode(muon_barrel,1);
288 TGeoVolume *muon_endcap = geom_->MakeTube(Form("%s_endcap",name),mudetmed_,muonSystem_rmin,muonSystem_radius+muonSystem_thickn_,muonSystem_thickn_/2.);
289 muon_endcap->SetLineColor(kBlue);
290 TGeoTranslation *trm1 = new TGeoTranslation(Form("%sEndcap1_position",name),0.,0.,muonSystem_length);
291 trm1->RegisterYourself();
292 TGeoTranslation *trm2 = new TGeoTranslation(Form("%sEndcap2_position",name),0.,0.,-muonSystem_length);
293 trm1->RegisterYourself();
294 top->AddNode(muon_endcap,1,trm1);
295 top->AddNode(muon_endcap,2,trm2);
296 return std::make_pair(muonSystem_radius,muonSystem_length);
297}
298
299void Delphes3DGeometry::addCaloTowers(TGeoVolume *top, const char* name,
300 Double_t innerBarrelRadius, Double_t innerBarrelLength, set< pair<Double_t, Int_t> >& caloBinning) {
301
302 TGeoVolume* calo_endcap = top->GetNode(Form("%s_endcap_1",name))->GetVolume();
303 TGeoVolume* calo_barrel = top->GetNode(Form("%s_barrel_1",name))->GetVolume();
304 Double_t calo_endcap_etamin = -log(innerBarrelRadius/(2*innerBarrelLength));
305 Double_t calo_endcap_coneThickness = TMath::Min(calo_barrel_thickness_ * (1-exp(-2.*calo_endcap_etamin)) / (2.*exp(-calo_endcap_etamin)), calo_endcap_thickness_);
306
307 // calo towers in the barrel
308 Double_t vertices[16] = {0.,0.,0.,0.,0.,0.,0.,0.}; // summit of the pyramid
309 Double_t R = tk_radius_ + contingency_+(contingency_+calo_barrel_thickness_)*calorimeters_.size(); // radius of the muons system = height of the pyramid
310 Int_t nEtaBins = caloBinning.size();
311 // this rotation is to make the tower point "up"
312 TGeoRotation* initTowerRot = new TGeoRotation(Form("%s_initTowerRot",name),0.,90.,0.);
313 TGeoCombiTrans* initTower = new TGeoCombiTrans(Form("%s_initTower",name),0.,-R/2.,0.,initTowerRot);
314 initTower->RegisterYourself();
315 // eta bins... we build one pyramid per eta slice and then translate it nphi times.
316 // phi bins represented by rotations around z
317 Double_t *y = new Double_t[nEtaBins];
318 Double_t *dx = new Double_t[nEtaBins];
319 Int_t *nphi = new Int_t[nEtaBins];
320 Int_t etaslice = 0;
321 std::map<std::pair<int,int>, TGeoRotation*> phirotations;
322 for(set< pair<Double_t, Int_t> >::const_iterator bin=caloBinning.begin(); bin!=caloBinning.end();++bin) {
323 if(abs(bin->first)>calo_endcap_etamin) continue; // only in the barrel
324 nphi[etaslice] = bin->second;
325 y[etaslice] = 0.5*R*(1-exp(-2*bin->first))/exp(-bin->first);
326 Double_t phiRotationAngle = 360./nphi[etaslice];
327 dx[etaslice] = R*tan(TMath::Pi()*phiRotationAngle/360.);
328 for(int phislice=0;phislice<nphi[etaslice];++phislice) {
329 phirotations[make_pair(etaslice,phislice)] = new TGeoRotation(Form("%s_phi%d_%d",name,etaslice,phislice),phiRotationAngle*phislice,0.,0.);
330 phirotations[make_pair(etaslice,phislice)]->RegisterYourself();
331 }
332 ++etaslice;
333 }
334 nEtaBins = etaslice;
335 for(int i=0;i<nEtaBins-1;++i) { // loop on the eta slices
336 vertices[8] = -dx[i]; vertices[9] = y[i];
337 vertices[10] = -dx[i]; vertices[11] = y[i+1];
338 vertices[12] = dx[i]; vertices[13] = y[i+1];
339 vertices[14] = dx[i]; vertices[15] = y[i];
340 new TGeoArb8(Form("%s_tower%d",name,i),R/2., vertices); // tower in the proper eta slice, at phi=0
341 // intersection between the tower and the calo_barrel
342 TGeoCompositeShape *finaltower_cs = new TGeoCompositeShape(Form("%s_ftower%d_cs",name,i),Form("%s_tower%d:%s_initTower*%s_barrel_cs",name,i,name,name));
343 TGeoVolume *finaltower = new TGeoVolume(Form("%s_ftower%d",name,i),finaltower_cs,calomed_);
344 finaltower->SetLineColor(kRed);
345 for(int j=0;j<nphi[i];++j) { // loop on the phi slices
346 calo_barrel->AddNode(finaltower,j,phirotations[make_pair(i,j)]);
347 }
348 }
349 delete[] y;
350 delete[] dx;
351 delete[] nphi;
352 //the towers in the forward region
353 R = tk_length_+contingency_+(contingency_+calo_endcap_thickness_)*calorimeters_.size(); // Z of the muons system = height of the pyramid
354 nEtaBins = caloBinning.size();
355 // translation to bring the origin of the tower to (0,0,0) (well, not really as the endcap is not yet in place)
356 TGeoTranslation* towerdz = new TGeoTranslation(Form("%s_towerdz",name),0.,0.,R/2.-(innerBarrelLength+calo_endcap_coneThickness/2.));
357 towerdz->RegisterYourself();
358 // eta bins... we build one pyramid per eta slice and then translate it nphi times.
359 Double_t *r = new Double_t[nEtaBins];
360 nphi = new Int_t[nEtaBins];
361 etaslice = 0;
362 phirotations.clear();
363 for(set< pair<Double_t, Int_t> >::const_iterator bin=caloBinning.begin(); bin!=caloBinning.end();++bin) {
364 if(bin->first<calo_endcap_etamin) continue; // only in the + endcap
365 r[etaslice] = R*2*exp(-bin->first)/(1-exp(-2*bin->first));
366 nphi[etaslice] = bin->second;
367 Double_t phiRotationAngle = 360./nphi[etaslice];
368 for(int phislice=0;phislice<nphi[etaslice];++phislice) {
369 phirotations[make_pair(etaslice,phislice)] = new TGeoRotation(Form("%s_forward_phi%d_%d",name,etaslice,phislice),phiRotationAngle*phislice,0.,0.);
370 phirotations[make_pair(etaslice,phislice)]->RegisterYourself();
371 }
372 ++etaslice;
373 }
374 nEtaBins = etaslice;
375 for(int i=0;i<nEtaBins-1;++i) { // loop on the eta slices
376 vertices[8] = -r[i+1]*sin(TMath::Pi()/nphi[i]); vertices[9] = r[i+1]*cos(TMath::Pi()/nphi[i]);
377 vertices[10] = -r[i]*sin(TMath::Pi()/nphi[i]); vertices[11] = r[i]*cos(TMath::Pi()/nphi[i]);
378 vertices[12] = r[i]*sin(TMath::Pi()/nphi[i]); vertices[13] = r[i]*cos(TMath::Pi()/nphi[i]);
379 vertices[14] = r[i+1]*sin(TMath::Pi()/nphi[i]); vertices[15] = r[i+1]*cos(TMath::Pi()/nphi[i]);
380 new TGeoArb8(Form("%sfwdtower%d",name,i),R/2., vertices); // tower in the proper eta slice, at phi=0
381 // intersection between the tower and the calo_endcap
382 TGeoCompositeShape *finalfwdtower_cs = new TGeoCompositeShape(Form("%sffwdtower%d_cs",name,i),Form("%sfwdtower%d:%s_towerdz*%s_endcap_cs",name,i,name,name));
383 TGeoVolume *finalfwdtower = new TGeoVolume(Form("%sffwdtower%d",name,i),finalfwdtower_cs,calomed_);
384 finalfwdtower->SetLineColor(kViolet);
385 for(int j=0;j<nphi[i];++j) { // loop on the phi slices
386 calo_endcap->AddNode(finalfwdtower,j,phirotations[make_pair(i,j)]);
387 }
388 }
389 delete[] r;
390 delete[] nphi;
391}
392
Note: See TracBrowser for help on using the repository browser.