Fork me on GitHub

source: git/display/Delphes3DGeometry.cc@ 77e9ae1

ImprovedOutputFile Timing llp
Last change on this file since 77e9ae1 was 77e9ae1, checked in by Pavel Demin <pavel-demin@…>, 5 years ago

set Standard to Cpp03 in .clang-format

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