120 if ((!fMC->TrackCharge()) || fMC->IsTrackDisappeared()) {
123 fMC->SetMaxStep(mMaxMCStepDef);
127 const int vid = fMC->CurrentVolID(copy);
128 const int8_t region = (vid > 0 && vid < (
int)mRegionByVolId.size()) ? mRegionByVolId[vid] : kNotSensitive;
129 if (region == kNotSensitive) {
132 const bool drRegion = (region == kDrift);
133 const bool amRegion = (region == kAmplification);
138 if (mSectorOffset < 0) {
139 for (
int off = 0; off < 16; ++off) {
140 const int oid = fMC->CurrentVolOffID(off, copy);
141 if (oid <= 0 || oid >= (
int)mChamberByVolId.size()) {
144 if (mChamberOffset < 0 && mChamberByVolId[oid] >= 0) {
145 mChamberOffset = off;
147 if (mSectorByVolId[oid] >= 0) {
152 if (mChamberOffset < 0 || mSectorOffset < 0) {
153 LOG(fatal) <<
"No TRD chamber/supermodule ancestor above sensitive volume " << fMC->CurrentVolName();
155 LOG(info) <<
"TRD: chamber at mother offset " << mChamberOffset <<
", supermodule at " << mSectorOffset;
158 const int chamberVol = fMC->CurrentVolOffID(mChamberOffset, copy);
159 const int sectorVol = fMC->CurrentVolOffID(mSectorOffset, copy);
160 const int idChamber = (chamberVol > 0 && chamberVol < (
int)mChamberByVolId.size()) ? mChamberByVolId[chamberVol] : -1;
161 const int sector = (sectorVol > 0 && sectorVol < (
int)mSectorByVolId.size()) ? mSectorByVolId[sectorVol] : -1;
162 if (idChamber < 0 || sector < 0) {
163 LOG(fatal) <<
"Cannot resolve TRD chamber/supermodule from volume " << fMC->CurrentVolName();
167 int det = mGeom->getDetector(mGeom->getLayer(idChamber), mGeom->getStack(idChamber), sector);
169 LOG(fatal) <<
"Detector number out of bounds";
177 float px, py, pz, etot;
178 float trackLength = fMC->TrackLength();
179 float tof = fMC->TrackTime();
182 if (drRegion && fMC->IsTrackEntering()) {
185 fMC->TrackMomentum(px, py, pz, etot);
186 fMC->TrackPosition(xp, yp, zp);
191 const bool ele = (std::fabs(fMC->TrackPid()) == 11);
195 }
else if (amRegion && fMC->IsTrackExiting()) {
198 fMC->TrackMomentum(px, py, pz, etot);
199 fMC->TrackPosition(xp, yp, zp);
207 const float enDep = std::max(fMC->Edep(), 0.0) * 1e9;
208 const int totalChargeDep = (
int)(enDep / mWion);
212 if (totalChargeDep || trkStat) {
213 fMC->TrackPosition(xp, yp, zp);
215 const int trackID =
stack->GetCurrentTrackNumber();
216 double pos[3] = {xp, yp, zp};
217 double loc[3] = {-99, -99, -99};
218 gGeoManager->MasterToLocal(
pos, loc);
219 float locC = loc[0], locR = loc[1], locT = loc[2];
221 locT = locT - 0.5 * (Geometry::drThick() + Geometry::amThick());
223 addHit(xp, yp, zp, locC, locR, locT, tof, totalChargeDep, trackID, det, drRegion);
224 stack->addHit(GetDetId());
357 Material(1,
"Al", 26.98, 13.0, 2.7, 8.9, 37.2);
359 Material(2,
"Cu", 63.54, 29.0, 8.96, 1.43, 14.8);
361 Material(3,
"C", 12.01, 6.0, 2.265, 18.8, 74.4);
363 Material(4,
"C2", 12.01, 6.0, 1.75, 18.8, 74.4);
365 Material(5,
"Sn", 118.71, 50.0, 7.31, 1.21, 14.8);
367 Material(6,
"Si", 28.09, 14.0, 2.33, 9.36, 37.2);
369 Material(7,
"Fe", 55.85, 26.0, 7.87, 1.76, 14.8);
372 float aAir[4] = {12.011, 14.0, 15.9994, 36.0};
373 float zAir[4] = {6.0, 7.0, 8.0, 18.0};
374 float wAir[4] = {0.000124, 0.755267, 0.231781, 0.012827};
375 float dAir = 1.20479e-03;
376 Mixture(51,
"Air", aAir, zAir, dAir, 4, wAir);
378 float ape[2] = {12.011, 1.0079};
379 float zpe[2] = {6.0, 1.0};
380 float wpe[2] = {1.0, 2.0};
382 Mixture(52,
"Polyethilene", ape, zpe, dpe, -2, wpe);
385 float aXeCO2[3] = {131.29, 12.0107, 15.9994};
386 float zXeCO2[3] = {54.0, 6.0, 8.0};
387 float wXeCO2[3] = {8.5, 1.5, 3.0};
391 float dgmXe = fxc * dxe + (1.0 - fxc) * dco;
393 float aArCO2[3] = {39.948, 12.0107, 15.9994};
394 float zArCO2[3] = {18.0, 6.0, 8.0};
395 float wArCO2[3] = {8.2, 1.8, 3.6};
398 float dgmAr = fac * dar + (1.0 - fac) * dco;
400 Mixture(53,
"XeCO2", aXeCO2, zXeCO2, dgmXe, -3, wXeCO2);
402 LOG(info) <<
"Gas mixture: Ar C02 (80/20)";
403 Mixture(53,
"ArCO2", aArCO2, zArCO2, dgmAr, -3, wArCO2);
405 LOG(fatal) <<
"Wrong gas mixture";
409 float aG10[4] = {1.0079, 12.011, 15.9994, 28.086};
410 float zG10[4] = {1.0, 6.0, 8.0, 14.0};
411 float wG10[4] = {0.023, 0.194, 0.443, 0.340};
413 Mixture(54,
"G10", aG10, zG10, dG10, 4, wG10);
415 float awa[2] = {1.0079, 15.9994};
416 float zwa[2] = {1.0, 8.0};
417 float wwa[2] = {2.0, 1.0};
419 Mixture(55,
"Water", awa, zwa, dwa, -2, wwa);
421 float arh[3] = {12.011, 1.0079, 15.9994};
422 float zrh[3] = {6.0, 1.0, 8.0};
423 float wrh[3] = {5.0, 8.0, 2.0};
425 Mixture(56,
"Rohacell", arh, zrh, drh, -3, wrh);
427 float aEpoxy[3] = {15.9994, 1.0079, 12.011};
428 float zEpoxy[3] = {8.0, 1.0, 6.0};
429 float wEpoxy[3] = {3.0, 19.0, 18.0};
431 Mixture(57,
"Epoxy", aEpoxy, zEpoxy, dEpoxy, -3, wEpoxy);
433 float aAral[3] = {15.9994, 1.0079, 12.011};
434 float zAral[3] = {8.0, 1.0, 6.0};
435 float wAral[3] = {3.0, 19.0, 18.0};
437 Mixture(58,
"Araldite", aAral, zAral, dAral, -3, wAral);
439 float aMy[3] = {12.011, 1.0, 15.9994};
440 float zMy[3] = {6.0, 1.0, 8.0};
441 float wMy[3] = {5.0, 4.0, 2.0};
443 Mixture(59,
"Mylar", aMy, zMy, dMy, -3, wMy);
445 float app[2] = {12.011, 1.0079};
446 float zpp[2] = {6.0, 1.0};
447 float wpp[2] = {3.0, 6.0};
449 Mixture(60,
"Polypropylene", app, zpp, dpp, -2, wpp);
451 float aAra[4] = {1.0079, 12.011, 15.9994, 14.0067};
452 float zAra[4] = {1.0, 6.0, 8.0, 7.0};
453 float wAra[4] = {3.0, 1.0, 1.0, 1.0};
455 Mixture(61,
"Aramide", aAra, zAra, dAra, -4, wAra);
457 float aGFK[4] = {1.0079, 12.011, 15.9994, 28.086};
458 float zGFK[4] = {1.0, 6.0, 8.0, 14.0};
459 float wGFK[4] = {0.0445, 0.5031, 0.1118, 0.340};
461 Mixture(62,
"GFK", aGFK, zGFK, dGFK, 4, wGFK);
468 float tmaxfd = -10.0;
469 float stemax = -1.0e10;
471 float epsil = 1.0e-4;
472 float stmin = -0.001;
475 Medium(1,
"Al Frame", 1, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
477 Medium(2,
"Air", 51, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
479 Medium(3,
"Wires", 2, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
481 Medium(4,
"ROB Other", 2, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
483 Medium(5,
"Padplane", 2, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
485 Medium(6,
"Readout", 2, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
487 Medium(7,
"Wacosit", 62, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
489 Medium(8,
"Cooling bus", 7, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
491 Medium(9,
"Gas-mix", 53, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
493 Medium(10,
"Honeycomb", 61, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
495 Medium(11,
"Glue", 58, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
497 Medium(13,
"G10-plates", 54, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
499 Medium(14,
"Water", 55, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
501 Medium(15,
"Rohacell", 56, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
503 Medium(16,
"MCM-Al", 1, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
505 Medium(17,
"MCM-Sn", 5, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
507 Medium(18,
"MCM-Cu", 2, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
509 Medium(19,
"MCM-G10", 54, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
511 Medium(20,
"Chip-Si", 6, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
513 Medium(21,
"Chip-Ep", 57, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
515 Medium(22,
"Conn-PE", 52, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
517 Medium(23,
"Chip-Cu", 2, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
519 Medium(24,
"Cooling", 1, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
521 Medium(25,
"Serv-Cu", 2, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
523 Medium(26,
"Carbon", 4, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
525 Medium(27,
"Mylar", 59, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
527 Medium(28,
"Fiber", 60, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
534 mGasNobleFraction = fxc;
537 mGasNobleFraction = fac;