180 if ((!
fMC->TrackCharge()) ||
fMC->IsTrackDisappeared()) {
183 fMC->SetMaxStep(mMaxMCStepDef);
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) {
192 const bool drRegion = (region == kDrift);
193 const bool amRegion = (region == kAmplification);
198 if (mSectorOffset < 0) {
199 for (
int off = 0; off < 16; ++off) {
201 if (mChamberOffset < 0 && mChamberFromName && std::sscanf(
fMC->CurrentVolOffName(off),
"UT%d", &chamber) == 1) {
202 mChamberOffset = off;
204 const int oid =
fMC->CurrentVolOffID(off, copy);
205 if (oid <= 0 || oid >= (
int)mChamberByVolId.size()) {
208 if (mChamberOffset < 0 && !mChamberFromName && mChamberByVolId[oid] >= 0) {
209 mChamberOffset = off;
211 if (mSectorByVolId[oid] >= 0) {
216 if (mChamberOffset < 0 || mSectorOffset < 0) {
217 LOG(fatal) <<
"No TRD chamber/supermodule ancestor above sensitive volume " <<
fMC->CurrentVolName();
219 LOG(info) <<
"TRD: chamber at mother offset " << mChamberOffset <<
", supermodule at " << mSectorOffset;
223 if (mChamberFromName) {
224 if (std::sscanf(
fMC->CurrentVolOffName(mChamberOffset),
"UT%d", &idChamber) != 1) {
228 const int chamberVol =
fMC->CurrentVolOffID(mChamberOffset, copy);
229 idChamber = (chamberVol > 0 && chamberVol < (int)mChamberByVolId.size()) ? mChamberByVolId[chamberVol] : -1;
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();
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";
248 float px, py, pz, etot;
249 float trackLength =
fMC->TrackLength();
250 float tof =
fMC->TrackTime();
253 if (drRegion &&
fMC->IsTrackEntering()) {
256 fMC->TrackMomentum(px, py, pz, etot);
257 fMC->TrackPosition(xp, yp, zp);
262 const bool ele = (std::fabs(
fMC->TrackPid()) == 11);
266 }
else if (amRegion &&
fMC->IsTrackExiting()) {
269 fMC->TrackMomentum(px, py, pz, etot);
270 fMC->TrackPosition(xp, yp, zp);
278 const float edep = std::max(
fMC->Edep(), 0.0) * 1e9;
279 if (mIonisation && !mDeltaRayCutChecked) {
282 const float enDep = mIonisation ? ionisationEnergy(edep) : edep;
283 const int totalChargeDep = (int)(enDep / mWion);
287 if (totalChargeDep || trkStat) {
288 fMC->TrackPosition(xp, yp, zp);
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);
294 float locC = loc[0], locR = loc[1], locT = loc[2];
296 locT = locT - 0.5 * (Geometry::drThick() + Geometry::amThick());
298 addHit(xp, yp, zp, locC, locR, locT, tof, totalChargeDep, trackID, det, drRegion);
432 Material(1,
"Al", 26.98, 13.0, 2.7, 8.9, 37.2);
434 Material(2,
"Cu", 63.54, 29.0, 8.96, 1.43, 14.8);
436 Material(3,
"C", 12.01, 6.0, 2.265, 18.8, 74.4);
438 Material(4,
"C2", 12.01, 6.0, 1.75, 18.8, 74.4);
440 Material(5,
"Sn", 118.71, 50.0, 7.31, 1.21, 14.8);
442 Material(6,
"Si", 28.09, 14.0, 2.33, 9.36, 37.2);
444 Material(7,
"Fe", 55.85, 26.0, 7.87, 1.76, 14.8);
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);
453 float ape[2] = {12.011, 1.0079};
454 float zpe[2] = {6.0, 1.0};
455 float wpe[2] = {1.0, 2.0};
457 Mixture(52,
"Polyethilene", ape, zpe, dpe, -2, wpe);
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};
466 float dgmXe = fxc * dxe + (1.0 - fxc) * dco;
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};
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);
480 LOG(fatal) <<
"Wrong gas mixture";
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};
488 Mixture(54,
"G10", aG10, zG10, dG10, 4, wG10);
490 float awa[2] = {1.0079, 15.9994};
491 float zwa[2] = {1.0, 8.0};
492 float wwa[2] = {2.0, 1.0};
494 Mixture(55,
"Water", awa, zwa, dwa, -2, wwa);
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};
500 Mixture(56,
"Rohacell", arh, zrh, drh, -3, wrh);
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};
506 Mixture(57,
"Epoxy", aEpoxy, zEpoxy, dEpoxy, -3, wEpoxy);
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};
512 Mixture(58,
"Araldite", aAral, zAral, dAral, -3, wAral);
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};
518 Mixture(59,
"Mylar", aMy, zMy, dMy, -3, wMy);
520 float app[2] = {12.011, 1.0079};
521 float zpp[2] = {6.0, 1.0};
522 float wpp[2] = {3.0, 6.0};
524 Mixture(60,
"Polypropylene", app, zpp, dpp, -2, wpp);
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};
530 Mixture(61,
"Aramide", aAra, zAra, dAra, -4, wAra);
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};
536 Mixture(62,
"GFK", aGFK, zGFK, dGFK, 4, wGFK);
543 float tmaxfd = -10.0;
544 float stemax = -1.0e10;
546 float epsil = 1.0e-4;
547 float stmin = -0.001;
550 Medium(1,
"Al Frame", 1, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
552 Medium(2,
"Air", 51, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
554 Medium(3,
"Wires", 2, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
556 Medium(4,
"ROB Other", 2, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
558 Medium(5,
"Padplane", 2, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
560 Medium(6,
"Readout", 2, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
562 Medium(7,
"Wacosit", 62, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
564 Medium(8,
"Cooling bus", 7, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
566 Medium(9,
"Gas-mix", 53, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
568 Medium(10,
"Honeycomb", 61, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
570 Medium(11,
"Glue", 58, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
572 Medium(13,
"G10-plates", 54, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
574 Medium(14,
"Water", 55, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
576 Medium(15,
"Rohacell", 56, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
578 Medium(16,
"MCM-Al", 1, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
580 Medium(17,
"MCM-Sn", 5, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
582 Medium(18,
"MCM-Cu", 2, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
584 Medium(19,
"MCM-G10", 54, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
586 Medium(20,
"Chip-Si", 6, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
588 Medium(21,
"Chip-Ep", 57, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
590 Medium(22,
"Conn-PE", 52, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
592 Medium(23,
"Chip-Cu", 2, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
594 Medium(24,
"Cooling", 1, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
596 Medium(25,
"Serv-Cu", 2, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
598 Medium(26,
"Carbon", 4, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
600 Medium(27,
"Mylar", 59, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
602 Medium(28,
"Fiber", 60, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
609 mGasNobleFraction = fxc;
612 mGasNobleFraction = fac;