Project
Loading...
Searching...
No Matches
Detector.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
13
14#include "TRDBase/Geometry.h"
15#include "TRDSimulation/TRsim.h"
18#include "DataFormatsTRD/Hit.h"
19
22#include "DetectorsBase/Stack.h"
23#include "FairVolume.h"
24#include "FairRootManager.h"
25
26#include <TGeoManager.h>
27#include <TVirtualMC.h>
28
29#include <cmath>
30#include <cstdio>
31#include <vector>
32#include <stdexcept>
33#include <string>
35
36using namespace o2::trd;
37using namespace o2::trd::constants;
38
40 : o2::base::DetImpl<Detector>("TRD", active)
41{
42 mHits = o2::utils::createSimVector<Hit>();
43 InitializeParams();
44}
45
47 : o2::base::DetImpl<Detector>(rhs),
48 mHits(o2::utils::createSimVector<Hit>()),
49 mFoilDensity(rhs.mFoilDensity),
50 mGasNobleFraction(rhs.mGasNobleFraction),
51 mGasDensity(rhs.mGasDensity),
52 mGeom(rhs.mGeom)
53{
54 InitializeParams();
55}
56
61
63{
64 // register the sensitive volumes with FairRoot
65 defineSensitiveVolumes();
66 buildVolumeIdTables();
67}
68
69void Detector::buildVolumeIdTables()
70{
71 auto* vmc = TVirtualMC::GetMC();
72 const int nVols = vmc->NofVolumes() + 1;
73 mRegionByVolId.assign(nVols, kNotSensitive);
74 mChamberByVolId.assign(nVols, -1);
75 mSectorByVolId.assign(nVols, -1);
76
77 auto record = [nVols](std::vector<int8_t>& table, int vid, int8_t value, const char* what) {
78 if (vid <= 0 || vid >= nVols) {
79 LOG(fatal) << "TRD volume " << what << " has no usable volume id (" << vid << ")";
80 }
81 table[vid] = value;
82 };
83
84 // The drift and amplification gas volumes, distinguished by the second character of
85 // their name exactly as Geometry::createVolume selects them as sensitive.
86 for (const auto& name : mGeom->getSensitiveTRDVolumes()) {
87 record(mRegionByVolId, vmc->VolId(name.c_str()), name[1] == 'J' ? kDrift : kAmplification, name.c_str());
88 }
89
90 // The readout-chamber assemblies and the supermodule mother volumes. An engine that
91 // collapses assemblies gives the chamber assemblies no volume id at all.
92 char volName[16];
93 mChamberFromName = vmc->VolId("UT00") <= 0;
94 if (mChamberFromName) {
95 LOG(info) << "TRD: chamber assemblies have no volume id, resolving the chamber by name";
96 } else {
97 for (int idet = 0; idet < NLAYER * NSTACK; ++idet) {
98 snprintf(volName, sizeof(volName), "UT%02d", idet);
99 record(mChamberByVolId, vmc->VolId(volName), idet, volName);
100 }
101 }
102 for (int sector = 0; sector < NSECTOR; ++sector) {
103 snprintf(volName, sizeof(volName), "BTRD%d", sector);
104 record(mSectorByVolId, vmc->VolId(volName), sector, volName);
105 }
106}
107
108void Detector::InitializeParams()
109{
111 mWion = 23.53; // Ionization energy XeCO2 (85/15)
113 mWion = 27.21; // Ionization energy ArCO2 (82/18)
114 } else {
115 LOG(fatal) << "Wrong gas mixture";
116 // add hard exit here!
117 }
118 // Switch on TR simulation as default
120 if (!mTRon) {
121 LOG(info) << "TR simulation off";
122 }
123 mTR = new TRsim();
124 mMaxMCStepDef = TRDSimParams::Instance().maxMCStepSize;
125
126 const auto& simParams = TRDSimParams::Instance();
127 if (simParams.ionisationModel == 1) {
128 mIonisation = std::make_unique<IonisationModel>(simParams.gas);
129 // the tables start at minBetaGamma; below it the energy deposit is used
130 mIonMinBetaGamma = std::max<double>(simParams.ionisationMinBetaGamma, IonisationModel::minBetaGamma());
131 mIonMinEkin = simParams.ionisationMinEkin;
132 LOG(info) << "TRD: ionisation from collision tables, energy deposit below beta*gamma " << mIonMinBetaGamma
133 << " or kinetic energy " << mIonMinEkin << " eV";
134 } else if (simParams.ionisationModel != 0) {
135 LOG(fatal) << "TRD: unknown ionisationModel " << simParams.ionisationModel;
136 }
137}
138
139void Detector::checkDeltaRayCut()
140{
141 // The collision tables end at the delta-ray cut they were made for. Above it Geant4 makes delta electrons
142 // with their own hits, so a different cut in the gas (medium 9, Gas-mix) would double count or lose energy.
144 std::vector<std::pair<o2::base::ECut, Float_t>> cuts;
145 mgr.getSpecialCuts(GetName(), 9, cuts);
146 double dcute = -1.; // eV
147 for (const auto& [cut, value] : cuts) {
148 if (cut == o2::base::ECut::kDCUTE) {
149 dcute = value * 1e9;
150 }
151 }
152 const double tableCut = IonisationModel::deltaRayCut();
153 if (!mgr.specialCutsEnabled() || std::abs(dcute - tableCut) > 1e-3 * tableCut) {
154 LOG(fatal) << "TRD: the ionisation tables need DCUTE = " << tableCut << " eV in the gas, the medium has "
155 << (mgr.specialCutsEnabled() ? dcute : -1.) << " eV; use TRDSimParams.ionisationModel=0 with other cuts";
156 }
157 mDeltaRayCutChecked = true;
158}
159
160double Detector::ionisationEnergy(float edep) const
161{
162 double px, py, pz, etot;
163 fMC->TrackMomentum(px, py, pz, etot);
164 const double mass = fMC->TrackMass();
165 const double epre = etot + fMC->Edep(); // total energy before the step
166 const double ekin = (epre - mass) * 1e9;
167 const double betaGamma = std::sqrt(std::max(epre * epre - mass * mass, 0.)) / mass;
168 // slow tracks, including the step that stops a track, keep the energy deposit
169 if (betaGamma < mIonMinBetaGamma || ekin < mIonMinEkin) {
170 return edep;
171 }
172 // bare charge, no effective charge: an ion is close to bare for beta >> Z/137, for alphas above the beta*gamma cut
173 const double z = fMC->TrackCharge();
174 return std::min(mIonisation->stepEnergy(fMC->TrackStep(), betaGamma, z * z, *o2::base::simRandom()), ekin);
175}
176
178{
179 // If not charged track or already stopped or disappeared, just return.
180 if ((!fMC->TrackCharge()) || fMC->IsTrackDisappeared()) {
181 return false;
182 }
183 fMC->SetMaxStep(mMaxMCStepDef); // Should we optimize this value?
184
185 // Inside sensitive volume ?
186 int copy = 0;
187 const int vid = fMC->CurrentVolID(copy);
188 const int8_t region = (vid > 0 && vid < (int)mRegionByVolId.size()) ? mRegionByVolId[vid] : kNotSensitive;
189 if (region == kNotSensitive) {
190 return false;
191 }
192 const bool drRegion = (region == kDrift);
193 const bool amRegion = (region == kAmplification);
194
195 // Find how far up the chamber and the supermodule sit, once, by walking up until the
196 // ancestor's volume id is one we know. Hard-coding the depth breaks silently whenever a
197 // level is added, removed, or flattened away by the transport engine's own conversion.
198 if (mSectorOffset < 0) {
199 for (int off = 0; off < 16; ++off) {
200 int chamber = -1;
201 if (mChamberOffset < 0 && mChamberFromName && std::sscanf(fMC->CurrentVolOffName(off), "UT%d", &chamber) == 1) {
202 mChamberOffset = off;
203 }
204 const int oid = fMC->CurrentVolOffID(off, copy);
205 if (oid <= 0 || oid >= (int)mChamberByVolId.size()) {
206 continue;
207 }
208 if (mChamberOffset < 0 && !mChamberFromName && mChamberByVolId[oid] >= 0) {
209 mChamberOffset = off;
210 }
211 if (mSectorByVolId[oid] >= 0) {
212 mSectorOffset = off;
213 break;
214 }
215 }
216 if (mChamberOffset < 0 || mSectorOffset < 0) {
217 LOG(fatal) << "No TRD chamber/supermodule ancestor above sensitive volume " << fMC->CurrentVolName();
218 }
219 LOG(info) << "TRD: chamber at mother offset " << mChamberOffset << ", supermodule at " << mSectorOffset;
220 }
221
222 int idChamber = -1;
223 if (mChamberFromName) {
224 if (std::sscanf(fMC->CurrentVolOffName(mChamberOffset), "UT%d", &idChamber) != 1) {
225 idChamber = -1;
226 }
227 } else {
228 const int chamberVol = fMC->CurrentVolOffID(mChamberOffset, copy);
229 idChamber = (chamberVol > 0 && chamberVol < (int)mChamberByVolId.size()) ? mChamberByVolId[chamberVol] : -1;
230 }
231 const int sectorVol = fMC->CurrentVolOffID(mSectorOffset, copy);
232 const int sector = (sectorVol > 0 && sectorVol < (int)mSectorByVolId.size()) ? mSectorByVolId[sectorVol] : -1;
233 if (idChamber < 0 || sector < 0) {
234 LOG(fatal) << "Cannot resolve TRD chamber/supermodule from volume " << fMC->CurrentVolName();
235 }
236
237 // The detector number (0 - 539)
238 int det = mGeom->getDetector(mGeom->getLayer(idChamber), mGeom->getStack(idChamber), sector);
239 if (det < 0 || det >= MAXCHAMBER) {
240 LOG(fatal) << "Detector number out of bounds";
241 }
242
243 // 0: InFlight 1: Entering 2: Exiting
244 int trkStat = 0;
245
246 o2::data::Stack* stack = (o2::data::Stack*)fMC->GetStack();
247 float xp, yp, zp;
248 float px, py, pz, etot;
249 float trackLength = fMC->TrackLength(); // Return the length of the current track from its origin (in cm)
250 float tof = fMC->TrackTime(); // Return the current time of flight of the track being transported (in s).
251
252 // Special hits if track is entering
253 if (drRegion && fMC->IsTrackEntering()) {
254 // Create a track reference at the entrance of each
255 // chamber that contains the momentum components of the particle
256 fMC->TrackMomentum(px, py, pz, etot);
257 fMC->TrackPosition(xp, yp, zp);
258 stack->addTrackReference(o2::TrackReference(*fMC, GetDetId()));
259 // Update track status
260 trkStat = 1;
261 // Create the hits from TR photons if electron/positron is entering the drift volume
262 const bool ele = (std::fabs(fMC->TrackPid()) == 11); // electron PDG code.
263 if (mTRon && ele) {
264 createTRhit(det);
265 }
266 } else if (amRegion && fMC->IsTrackExiting()) {
267 // Create a track reference at the exit of each
268 // chamber that contains the momentum components of the particle
269 fMC->TrackMomentum(px, py, pz, etot);
270 fMC->TrackPosition(xp, yp, zp);
271 stack->addTrackReference(o2::TrackReference(*fMC, GetDetId()));
272 // Update track status
273 trkStat = 2;
274 }
275
276 // Calculate the charge from the collision model, or from the transport engine's energy deposit
277 // Create a new dEdx hit
278 const float edep = std::max(fMC->Edep(), 0.0) * 1e9; // Energy in eV
279 if (mIonisation && !mDeltaRayCutChecked) {
280 checkDeltaRayCut();
281 }
282 const float enDep = mIonisation ? ionisationEnergy(edep) : edep;
283 const int totalChargeDep = (int)(enDep / mWion); // Total charge
284
285 // Store those hits with enDep bigger than the ionization potential of the gas mixture for in-flight tracks
286 // or store hits of tracks that are entering or exiting
287 if (totalChargeDep || trkStat) {
288 fMC->TrackPosition(xp, yp, zp);
289 tof = tof * 1e6; // The time of flight in micro-seconds
290 const int trackID = stack->GetCurrentTrackNumber();
291 double pos[3] = {xp, yp, zp};
292 double loc[3] = {-99, -99, -99};
293 gGeoManager->MasterToLocal(pos, loc); // Go to the local coordinate system (locR, locC, locT)
294 float locC = loc[0], locR = loc[1], locT = loc[2];
295 if (drRegion) {
296 locT = locT - 0.5 * (Geometry::drThick() + Geometry::amThick()); // Relative to middle of amplification region
297 }
298 addHit(xp, yp, zp, locC, locR, locT, tof, totalChargeDep, trackID, det, drRegion);
299 stack->addHit(GetDetId());
300 return true;
301 }
302 return false;
303}
304
305void Detector::createTRhit(int det)
306{
307 //
308 // Creates an electron cluster from a TR photon.
309 // The photon is assumed to be created a the end of the radiator. The
310 // distance after which it deposits its energy takes into account the
311 // absorbtion of the entrance window and of the gas mixture in drift
312 // volume.
313 //
314
315 // Maximum number of TR photons per track
316 constexpr int mMaxNumberOfTRPhotons = 50; // Make this a class member?
317
318 float px, py, pz, etot;
319 fMC->TrackMomentum(px, py, pz, etot);
320 float pTot = std::sqrt(px * px + py * py + pz * pz);
321 std::vector<float> photonEnergyContainer; // energy in keV
322 mTR->createPhotons(11, pTot, photonEnergyContainer); // Create TR photons
323 if (photonEnergyContainer.size() > mMaxNumberOfTRPhotons) {
324 LOG(error) << "Boundary error: nTR = " << photonEnergyContainer.size() << ", mMaxNumberOfTRPhotons = " << mMaxNumberOfTRPhotons;
325 }
326
327 // Loop through the TR photons
328 for (const float& photonEnergy : photonEnergyContainer) {
329 const double energyMeV = photonEnergy * 1e-3;
330 const double energyeV = photonEnergy * 1e3;
331 double absLength = 0.0;
332 double sigma = 0.0;
333 // Take the absorbtion in the entrance window into account
334 double muMy = mTR->getMuMy(energyMeV);
335 sigma = muMy * mFoilDensity;
336 if (sigma > 0.0) {
337 absLength = o2::base::simRandom()->Exp(1.0 / sigma);
338 if (absLength < Geometry::myThick()) {
339 continue;
340 }
341 } else {
342 continue;
343 }
344 // The absorbtion cross sections in the drift gas
345 // Gas-mixture (Xe/CO2)
346 double muNo = 0.0;
348 muNo = mTR->getMuXe(energyMeV);
350 muNo = mTR->getMuAr(energyMeV);
351 }
352 double muCO = mTR->getMuCO(energyMeV);
353 // double fGasNobleFraction = 1;
354 // double fGasDensity = 1;
355 sigma = (mGasNobleFraction * muNo + (1.0 - mGasNobleFraction) * muCO) * mGasDensity * mTR->getTemp();
356
357 // The distance after which the energy of the TR photon
358 // is deposited.
359 if (sigma > 0.0) {
360 absLength = o2::base::simRandom()->Exp(1.0 / sigma);
361 if (absLength > (Geometry::drThick() + Geometry::amThick())) {
362 continue;
363 }
364 } else {
365 continue;
366 }
367
368 // The position of the absorbtion
369 float xp, yp, zp;
370 fMC->TrackPosition(xp, yp, zp);
371 float invpTot = 1. / pTot;
372 float x = xp + px * invpTot * absLength;
373 float y = yp + py * invpTot * absLength;
374 float z = zp + pz * invpTot * absLength;
375
376 // Add the hit to the array. TR photon hits are marked by negative energy (and not by charge)
377 float tof = fMC->TrackTime() * 1e6; // The time of flight in micro-seconds
378 o2::data::Stack* stack = (o2::data::Stack*)fMC->GetStack();
379 const int trackID = stack->GetCurrentTrackNumber();
380 const int totalChargeDep = -1 * (int)(energyeV / mWion); // Negative charge for tagging TR photon hits
381 // prepare local coordinates
382 double pos[3] = {x, y, z};
383 double loc[3] = {-99, -99, -99};
384 gGeoManager->MasterToLocal(pos, loc); // Go to the local coordinate system (locR, locC, locT)
385 float locC = loc[0], locR = loc[1], locT = loc[2];
386 locT = locT - 0.5 * (Geometry::drThick() + Geometry::amThick()); // Relative to middle of amplification region
387 addHit(x, y, z, locC, locR, locT, tof, totalChargeDep, trackID, det, true); // All TR hits are in drift region
388 stack->addHit(GetDetId());
389 }
390}
391
393{
394 FairRootManager::Instance()->RegisterAny(addNameTo("Hit").data(), mHits, true);
395}
396
398{
399 // Sort hit vector by detector number before the End of the Event
400 std::sort(mHits->begin(), mHits->end(),
401 [](const Hit& a, const Hit& b) {
402 return a.GetDetectorID() < b.GetDetectorID();
403 });
404}
405
406// this is very problematic; we should do round robin or the clear needs
407// to be done by the HitMerger
409{
410 if (!o2::utils::ShmManager::Instance().isOperational()) {
411 mHits->clear();
412 }
413}
414
416
417//_____________________________________________________________________________
419{
420 //
421 // Create the materials for the TRD
422 //
423 int isxfld = 2;
424 float sxmgmx = 10.;
426
428 // Define Materials
430
431 // Aluminum
432 Material(1, "Al", 26.98, 13.0, 2.7, 8.9, 37.2);
433 // Copper
434 Material(2, "Cu", 63.54, 29.0, 8.96, 1.43, 14.8);
435 // Carbon
436 Material(3, "C", 12.01, 6.0, 2.265, 18.8, 74.4);
437 // Carbon for fiber mats
438 Material(4, "C2", 12.01, 6.0, 1.75, 18.8, 74.4);
439 // Zinc
440 Material(5, "Sn", 118.71, 50.0, 7.31, 1.21, 14.8);
441 // Silicon
442 Material(6, "Si", 28.09, 14.0, 2.33, 9.36, 37.2);
443 // Iron
444 Material(7, "Fe", 55.85, 26.0, 7.87, 1.76, 14.8);
445
446 // Air
447 float aAir[4] = {12.011, 14.0, 15.9994, 36.0};
448 float zAir[4] = {6.0, 7.0, 8.0, 18.0};
449 float wAir[4] = {0.000124, 0.755267, 0.231781, 0.012827};
450 float dAir = 1.20479e-03;
451 Mixture(51, "Air", aAir, zAir, dAir, 4, wAir);
452 // Polyethilene (CH2)
453 float ape[2] = {12.011, 1.0079};
454 float zpe[2] = {6.0, 1.0};
455 float wpe[2] = {1.0, 2.0};
456 float dpe = 0.95;
457 Mixture(52, "Polyethilene", ape, zpe, dpe, -2, wpe);
458 // Gas mixtures
459 // Xe/CO2-gas-mixture (85% / 15%)
460 float aXeCO2[3] = {131.29, 12.0107, 15.9994};
461 float zXeCO2[3] = {54.0, 6.0, 8.0};
462 float wXeCO2[3] = {8.5, 1.5, 3.0};
463 float fxc = 0.85;
464 float dxe = 0.00549; // at 20C
465 float dco = 0.00186; // at 20C
466 float dgmXe = fxc * dxe + (1.0 - fxc) * dco;
467 // Ar/CO2-gas-mixture
468 float aArCO2[3] = {39.948, 12.0107, 15.9994};
469 float zArCO2[3] = {18.0, 6.0, 8.0};
470 float wArCO2[3] = {8.2, 1.8, 3.6};
471 float fac = 0.82;
472 float dar = 0.00166; // at 20C
473 float dgmAr = fac * dar + (1.0 - fac) * dco;
475 Mixture(53, "XeCO2", aXeCO2, zXeCO2, dgmXe, -3, wXeCO2);
477 LOG(info) << "Gas mixture: Ar C02 (80/20)";
478 Mixture(53, "ArCO2", aArCO2, zArCO2, dgmAr, -3, wArCO2);
479 } else {
480 LOG(fatal) << "Wrong gas mixture";
481 exit(1);
482 }
483 // G10
484 float aG10[4] = {1.0079, 12.011, 15.9994, 28.086};
485 float zG10[4] = {1.0, 6.0, 8.0, 14.0};
486 float wG10[4] = {0.023, 0.194, 0.443, 0.340};
487 float dG10 = 2.0;
488 Mixture(54, "G10", aG10, zG10, dG10, 4, wG10);
489 // Water
490 float awa[2] = {1.0079, 15.9994};
491 float zwa[2] = {1.0, 8.0};
492 float wwa[2] = {2.0, 1.0};
493 float dwa = 1.0;
494 Mixture(55, "Water", awa, zwa, dwa, -2, wwa);
495 // Rohacell (C5H8O2), X0 = 535.005cm
496 float arh[3] = {12.011, 1.0079, 15.9994};
497 float zrh[3] = {6.0, 1.0, 8.0};
498 float wrh[3] = {5.0, 8.0, 2.0};
499 float drh = 0.075;
500 Mixture(56, "Rohacell", arh, zrh, drh, -3, wrh);
501 // Epoxy (C18H19O3)
502 float aEpoxy[3] = {15.9994, 1.0079, 12.011};
503 float zEpoxy[3] = {8.0, 1.0, 6.0};
504 float wEpoxy[3] = {3.0, 19.0, 18.0};
505 float dEpoxy = 1.8;
506 Mixture(57, "Epoxy", aEpoxy, zEpoxy, dEpoxy, -3, wEpoxy);
507 // Araldite, low density epoxy (C18H19O3)
508 float aAral[3] = {15.9994, 1.0079, 12.011};
509 float zAral[3] = {8.0, 1.0, 6.0};
510 float wAral[3] = {3.0, 19.0, 18.0};
511 float dAral = 1.12; // Hardener: 1.15, epoxy: 1.1, mixture: 1/2
512 Mixture(58, "Araldite", aAral, zAral, dAral, -3, wAral);
513 // Mylar
514 float aMy[3] = {12.011, 1.0, 15.9994};
515 float zMy[3] = {6.0, 1.0, 8.0};
516 float wMy[3] = {5.0, 4.0, 2.0};
517 float dMy = 1.39;
518 Mixture(59, "Mylar", aMy, zMy, dMy, -3, wMy);
519 // Polypropylene (C3H6) for radiator fibers
520 float app[2] = {12.011, 1.0079};
521 float zpp[2] = {6.0, 1.0};
522 float wpp[2] = {3.0, 6.0};
523 float dpp = 0.068;
524 Mixture(60, "Polypropylene", app, zpp, dpp, -2, wpp);
525 // Aramide for honeycomb
526 float aAra[4] = {1.0079, 12.011, 15.9994, 14.0067};
527 float zAra[4] = {1.0, 6.0, 8.0, 7.0};
528 float wAra[4] = {3.0, 1.0, 1.0, 1.0};
529 float dAra = 0.032;
530 Mixture(61, "Aramide", aAra, zAra, dAra, -4, wAra);
531 // GFK for Wacosit (Epoxy + Si)
532 float aGFK[4] = {1.0079, 12.011, 15.9994, 28.086};
533 float zGFK[4] = {1.0, 6.0, 8.0, 14.0};
534 float wGFK[4] = {0.0445, 0.5031, 0.1118, 0.340};
535 float dGFK = 2.0;
536 Mixture(62, "GFK", aGFK, zGFK, dGFK, 4, wGFK);
537
539 // Tracking Media Parameters
541
542 // General tracking parameter
543 float tmaxfd = -10.0;
544 float stemax = -1.0e10;
545 float deemax = -0.1;
546 float epsil = 1.0e-4;
547 float stmin = -0.001;
548
549 // Al Frame
550 Medium(1, "Al Frame", 1, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
551 // Air
552 Medium(2, "Air", 51, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
553 // Wires
554 Medium(3, "Wires", 2, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
555 // All other ROB materials (caps, etc.)
556 Medium(4, "ROB Other", 2, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
557 // Cu pads
558 Medium(5, "Padplane", 2, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
559 // Fee + cables
560 Medium(6, "Readout", 2, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
561 // C frame (Wacosit)
562 Medium(7, "Wacosit", 62, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
563 // INOX of cooling bus bars
564 Medium(8, "Cooling bus", 7, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
565 // Gas-mixture (Xe/CO2)
566 Medium(9, "Gas-mix", 53, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
567 // Honeycomb
568 Medium(10, "Honeycomb", 61, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
569 // Araldite glue
570 Medium(11, "Glue", 58, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
571 // G10-plates
572 Medium(13, "G10-plates", 54, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
573 // Cooling water
574 Medium(14, "Water", 55, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
575 // Rohacell for the radiator
576 Medium(15, "Rohacell", 56, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
577 // Al layer in MCMs
578 Medium(16, "MCM-Al", 1, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
579 // Sn layer in MCMs
580 Medium(17, "MCM-Sn", 5, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
581 // Cu layer in MCMs
582 Medium(18, "MCM-Cu", 2, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
583 // G10 layer in MCMs
584 Medium(19, "MCM-G10", 54, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
585 // Si in readout chips
586 Medium(20, "Chip-Si", 6, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
587 // Epoxy in readout chips
588 Medium(21, "Chip-Ep", 57, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
589 // PE in connectors
590 Medium(22, "Conn-PE", 52, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
591 // Cu in connectors
592 Medium(23, "Chip-Cu", 2, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
593 // Al of cooling pipes
594 Medium(24, "Cooling", 1, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
595 // Cu in services
596 Medium(25, "Serv-Cu", 2, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
597 // Carbon fiber mat
598 Medium(26, "Carbon", 4, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
599 // Mylar foil
600 Medium(27, "Mylar", 59, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
601 // Polypropylene fibers
602 Medium(28, "Fiber", 60, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
603
604 // Save the density values for the TRD absorbtion
605 float dmy = 1.39;
606 mFoilDensity = dmy;
608 mGasDensity = dgmXe;
609 mGasNobleFraction = fxc;
611 mGasDensity = dgmAr;
612 mGasNobleFraction = fac;
613 }
614}
615
616// setting up the geometry
618{
620
621 std::vector<int> medmapping;
622 // now query the medium mapping and fill a vector to be passed along
623 // to the geometry creation
624 getMediumIDMappingAsVector(medmapping);
625
626 mGeom = Geometry::instance();
627 mGeom->createGeometry(medmapping);
628}
629
630void Detector::defineSensitiveVolumes()
631{
632 auto vols = mGeom->getSensitiveTRDVolumes();
633 for (auto& name : vols) {
634 auto tgeovol = gGeoManager->GetVolume(name.c_str());
635 if (tgeovol != nullptr) {
636 AddSensitiveVolume(tgeovol);
637 } else {
638 LOG(error) << "No TGeo volume for TRD vol name " << name << " found\n";
639 }
640 }
641}
642
644{
645 mGeom->addAlignableVolumes();
646}
647
Global TRD definitions and constants.
Definition of the Stack class.
configStandalone Light OpenGL display display_light Apply smoothing to points Enable Z buffer Highlight links Highlight seeds Highlight sector tracks Highlight final tracks Show individual sector
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char e
char error[CURL_ERROR_SIZE]
ClassImp(IdPath)
uint16_t pos
Definition RawData.h:3
uint32_t stack
Definition RawData.h:1
Int_t GetDetId()
void AddSensitiveVolume(TGeoVolume *v)
TVirtualMC * fMC
flag for initialisation
Definition FairModule.h:160
void RegisterAny(const char *name, T *&obj, Bool_t toFile)
static FairRootManager * Instance()
void getMediumIDMappingAsVector(std::vector< int > &mapping)
Definition Detector.h:144
Detector()
Default Constructor.
Definition Detector.cxx:36
void Mixture(Int_t imat, const char *name, Float_t *a, Float_t *z, Float_t dens, Int_t nlmat, Float_t *wmat)
Definition Detector.cxx:66
void Medium(Int_t numed, const char *name, Int_t nmat, Int_t isvol, Int_t ifield, Float_t fieldm, Float_t tmaxfd, Float_t stemax, Float_t deemax, Float_t epsil, Float_t stmin, Float_t *ubuf=nullptr, Int_t nbuf=0)
Definition Detector.cxx:72
static void initFieldTrackingParams(int &mode, float &maxfield)
Definition Detector.cxx:143
void Material(Int_t imat, const char *name, Float_t a, Float_t z, Float_t dens, Float_t radl, Float_t absl, Float_t *buf=nullptr, Int_t nwbuf=0)
Definition Detector.cxx:59
std::string addNameTo(const char *ext) const
Definition Detector.h:151
static MaterialManager & Instance()
~Detector() override
Definition Detector.cxx:57
void InitializeO2Detector() override
Definition Detector.cxx:62
void EndOfEvent() override
Definition Detector.cxx:415
void Register() override
Definition Detector.cxx:392
Detector(Bool_t active=true)
Definition Detector.cxx:39
void ConstructGeometry() override
Definition Detector.cxx:617
void addAlignableVolumes() const override
Add alignable top volumes.
Definition Detector.cxx:643
bool ProcessHits(FairVolume *v=nullptr) override
Definition Detector.cxx:177
void Reset() override
Definition Detector.cxx:408
void FinishEvent() override
Definition Detector.cxx:397
void addAlignableVolumes() const
static Geometry * instance()
Definition Geometry.h:33
void createGeometry(std::vector< int > const &idtmed)
Definition Geometry.cxx:258
std::vector< std::string > const & getSensitiveTRDVolumes() const
Definition Geometry.h:46
static double minBetaGamma()
Lowest beta*gamma of the tables.
static double deltaRayCut()
Delta-ray production cut (eV) the tables were made for.
int createPhotons(int pdg, float p, std::vector< float > &ePhoton)
Definition TRsim.cxx:123
double getMuAr(double energyMeV)
Definition TRsim.cxx:419
double getMuXe(double energyMeV)
Definition TRsim.cxx:376
float getTemp() const
Definition TRsim.h:114
double getMuCO(double energyMeV)
Definition TRsim.cxx:341
double getMuMy(double energyMeV)
Definition TRsim.cxx:456
static ShmManager & Instance()
Definition ShmManager.h:62
GLint GLenum GLint x
Definition glcorearb.h:403
const GLdouble * v
Definition glcorearb.h:832
GLuint const GLchar * name
Definition glcorearb.h:781
GLboolean GLboolean GLboolean b
Definition glcorearb.h:1233
GLint y
Definition glcorearb.h:270
GLsizei const GLfloat * value
Definition glcorearb.h:819
GLboolean GLboolean GLboolean GLboolean a
Definition glcorearb.h:1233
GLdouble GLdouble GLdouble z
Definition glcorearb.h:843
uint8_t int statusCode int
TRandom * simRandom()
Definition SimRandom.cxx:22
void freeSimVector(std::vector< T > *ptr)
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
Common utility functions.
bool doTR
switch for transition radiation
SimParam::GasMixture gas
the gas mixture in the TRD
float maxMCStepSize
maximum size of MC steps
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"