21#include "FairGeoBuilder.h"
22#include "FairGeoInterface.h"
23#include "FairGeoLoader.h"
24#include "FairGeoMedia.h"
25#include "FairGeoMedium.h"
26#include "FairGeoNode.h"
27#include "FairGeoTransform.h"
28#include "FairGeoVolume.h"
31#include "FairRuntimeDb.h"
32#include "FairRuntimeDb.h"
33#include "FairVolume.h"
40#include "TGeoCompositeShape.h"
41#include "TGeoManager.h"
42#include "TGeoMaterial.h"
43#include "TGeoMedium.h"
46#include "TGeoUniformMagField.h"
50#include "TParticleClassPDG.h"
51#include "TParticlePDG.h"
54#include "TVirtualMC.h"
55#include "TVirtualMCStack.h"
72 Info(
"SetDetectorDesign",
" to %i",
fDesign);
105 Double_t PBTh, Double_t EPlW, Double_t LeadTh,
117 Double_t BrPackX, Double_t BrPackY, Double_t BrPackZ,
118 Int_t number_of_plates_) {
171 TGeoMedium* air = gGeoManager->GetMedium(
"air");
174 TGeoMedium* PBase = gGeoManager->GetMedium(
"PlasticBase");
177 TGeoMedium* NEmu = gGeoManager->GetMedium(
"NuclearEmulsion");
179 TGeoMaterial* NEmuMat =
181 TGeoMaterial* PBaseMat = PBase->GetMaterial();
191 cout <<
"TARGET PRINTOUT: Single volume for emulsion film chosen: average "
193 << rho_film <<
" fraction in mass of emulsion " << frac_emu << endl;
195 TGeoMixture* emufilmmixture =
new TGeoMixture(
196 "EmulsionFilmMixture",
199 emufilmmixture->AddElement(NEmuMat, frac_emu);
200 emufilmmixture->AddElement(PBaseMat, 1. - frac_emu);
202 TGeoMedium* Emufilm =
new TGeoMedium(
"EmulsionFilm", 100, emufilmmixture);
205 TGeoMedium* tungsten = gGeoManager->GetMedium(
"tungsten");
211 TGeoBBox* TargetBox =
213 TGeoVolume* volTarget =
new TGeoVolume(
"volTarget", TargetBox, air);
219 [[maybe_unused]] TGeoBBox* Cell =
221 [[maybe_unused]] TGeoVolume* volCell =
new TGeoVolume(
"Cell", Cell, air);
225 TGeoVolume* volBrick =
new TGeoVolume(
"Brick", Brick, air);
226 volBrick->SetLineColor(kCyan);
227 volBrick->SetTransparency(1);
231 auto* volAbsorber =
new TGeoVolume(
"volAbsorber", Absorber, tungsten);
233 volAbsorber->SetTransparency(1);
234 volAbsorber->SetLineColor(kGray);
235 for (Int_t n = 0; n < NPlates; n++) {
238 new TGeoTranslation(0, 0,
244 TGeoBBox* EmulsionFilm =
new TGeoBBox(
"EmulsionFilm",
EmulsionX / 2,
246 TGeoVolume* volEmulsionFilm =
247 new TGeoVolume(
"Emulsion", EmulsionFilm, Emufilm);
248 volEmulsionFilm->SetLineColor(kBlue);
251 AddSensitiveVolume(volEmulsionFilm);
254 for (Int_t n = 0; n < NPlates + 1; n++) {
257 new TGeoTranslation(0, 0,
263 TGeoBBox* EmulsionFilm =
new TGeoBBox(
"EmulsionFilm",
EmulsionX / 2,
265 TGeoVolume* volEmulsionFilm =
266 new TGeoVolume(
"Emulsion", EmulsionFilm, NEmu);
267 TGeoVolume* volEmulsionFilm2 =
268 new TGeoVolume(
"Emulsion2", EmulsionFilm, NEmu);
269 volEmulsionFilm->SetLineColor(kBlue);
270 volEmulsionFilm2->SetLineColor(kBlue);
273 AddSensitiveVolume(volEmulsionFilm);
274 AddSensitiveVolume(volEmulsionFilm2);
278 TGeoVolume* volPlBase =
new TGeoVolume(
"PlasticBase", PlBase, PBase);
279 volPlBase->SetLineColor(kYellow - 4);
280 for (Int_t n = 0; n < NPlates + 1; n++) {
281 volBrick->AddNode(volEmulsionFilm2, n,
282 new TGeoTranslation(0, 0,
294 new TGeoTranslation(0, 0,
301 volBrick->SetVisibility(kTRUE);
302 TGeoVolume* top = gGeoManager->GetTopVolume();
303 TGeoVolumeAssembly* tTauNuDet =
new TGeoVolumeAssembly(
"tTauNuDet");
304 top->AddNode(tTauNuDet, 1,
new TGeoTranslation(0, 0, 0));
306 tTauNuDet->AddNode(volTarget, 1,
new TGeoTranslation(0, 0,
fCenterZ));
308 TGeoVolume* volRow =
new TGeoVolume(
"Row", Row, air);
309 volRow->SetLineColor(20);
312 for (
int j = 0; j <
fNCol; j++) {
313 volRow->AddNode(volBrick, j,
314 new TGeoTranslation(d_cl_x +
BrickX / 2, 0, 0));
319 TGeoVolume* volWall =
new TGeoVolume(
"Wall", Wall, air);
320 volWall->SetLineColor(kGreen);
323 for (
int k = 0; k <
fNRow; k++) {
324 volWall->AddNode(volRow, k,
new TGeoTranslation(0, d_cl_y +
BrickY / 2, 0));
332 for (
int l = 0; l <
fNWall; l++) {
333 volTarget->AddNode(volWall, l,
334 new TGeoTranslation(0, 0, d_cl_z +
BrickZ / 2));
345 if (gMC->IsTrackEntering()) {
347 fTime = gMC->TrackTime() * 1.0e09;
349 gMC->TrackPosition(
fPos);
350 gMC->TrackMomentum(
fMom);
356 if (gMC->IsTrackExiting() || gMC->IsTrackStop() ||
357 gMC->IsTrackDisappeared()) {
358 fTrackID = gMC->GetStack()->GetCurrentTrackNumber();
365 Int_t MaxLevel = gGeoManager->GetLevel();
369 std::vector<Int_t> motherV(MaxLevel);
370 Bool_t EmTop =
false;
374 name = gMC->CurrentVolName();
377 if (
strcmp(name,
"Emulsion") == 0) {
381 if (
strcmp(name,
"Emulsion2") == 0) {
386 Int_t NWall = 0, NColumn = 0, NRow = 0;
388 for (Int_t i = 0; i < MaxLevel; i++) {
389 motherV[i] = gGeoManager->GetMother(i)->GetNumber();
390 const char* mumname = gMC->CurrentVolOffName(i);
391 if (motherV[0] == 1 && motherV[0] != detID) {
392 if (
strcmp(mumname,
"Brick") == 0) NColumn = motherV[i];
393 if (
strcmp(mumname,
"Cell") == 0) NRow = motherV[i];
394 if (
strcmp(mumname,
"Row") == 0) NWall = motherV[i];
395 if ((
strcmp(mumname,
"Wall") == 0) && (motherV[i] == 2))
398 if (
strcmp(mumname,
"Cell") == 0) NColumn = motherV[i];
399 if (
strcmp(mumname,
"Row") == 0) NRow = motherV[i];
400 if (
strcmp(mumname,
"Wall") == 0) NWall = motherV[i];
401 if ((
strcmp(mumname,
"volTarget") == 0) && (motherV[i] == 2))
407 detID = (NWall + 1) * 1E7 + (NRow + 1) * 1E6 + (NColumn + 1) * 1E4 +
408 (NPlate + 1) * 1E1 + EmTop;
415 TParticle* p = gMC->GetStack()->GetCurrentTrack();
417 Int_t pdgCode = p->GetPdgCode();
420 gMC->TrackPosition(Pos);
421 Double_t xmean = (
fPos.X() + Pos.X()) / 2.;
422 Double_t ymean = (
fPos.Y() + Pos.Y()) / 2.;
423 Double_t zmean = (
fPos.Z() + Pos.Z()) / 2.;
448 auto divt_E7 = std::div(detID, 1E7);
450 Int_t NWall = divt_E7.quot;
451 auto divt_E6 = std::div(divt_E7.rem, 1E6);
453 Int_t NRow = divt_E6.quot;
454 auto divt_E4 = std::div(divt_E6.rem, 1E4);
456 Int_t NColumn = divt_E4.quot;
457 auto divt_E1 = std::div(divt_E4.rem, 1E1);
459 Int_t NPlate = divt_E1.quot;
460 Bool_t EmTop =
static_cast<Bool_t
>(divt_E1.rem);
462 return std::make_tuple(NWall, NRow, NColumn, NPlate, EmTop);
Int_t fTrackID
event index
Int_t fVolumeID
track index
TLorentzVector fPos
volume id
Double_t fTime
momentum at entrance
TargetPoint * AddHit(Args &&... args)
TLorentzVector fMom
position at entrance
void SetMagnetHeight(Double_t Y)
void SetHpTParam(Int_t n, Double_t dd, Double_t DZ)
void ConstructGeometry() override
void MergeTopBot(Bool_t SingleEmFilm)
Double_t PlasticBaseThickness
void SetCoilDownHeight(Double_t H2)
void SetNumberBricks(Double_t col, Double_t row, Double_t wall)
static std::tuple< Int_t, Int_t, Int_t, Int_t, Bool_t > DecodeBrickID(Int_t detID)
void SetNumberTargets(Int_t target)
void SetDetectorDesign(Int_t Design)
void SetColumnHeight(Double_t Y)
Bool_t ProcessHits(FairVolume *v=0) override
void SetBrickParam(Double_t BrX, Double_t BrY, Double_t BrZ, Double_t BrPackX, Double_t BrPackY, Double_t BrPackZ, Int_t number_of_plates_)
void SetTargetWallDimension(Double_t WallXDim, Double_t WallYDim, Double_t WallZDim)
void SetCenterZ(Double_t z)
void SetDetectorDimension(Double_t xdim, Double_t ydim, Double_t zdim)
void SetEmulsionParam(Double_t EmTh, Double_t EmX, Double_t EmY, Double_t PBTh, Double_t EPlW, Double_t LeadTh, Double_t AllPW)
void SetPillarDimension(Double_t X, Double_t Y, Double_t Z)
Double_t EmulsionThickness
void SetCoilUpHeight(Double_t H1)
void SetTTzdimension(Double_t TTZ)
void SetCellParam(Double_t CellW)
Bool_t fsingleemulsionfilm
void SetBaseHeight(Double_t Y)
void MakeNuTargetPassive(Bool_t a)
void SetMagneticField(Double_t B)
void SetBaseDimension(Double_t X, Double_t Y, Double_t Z)
Int_t InitMedium(const char *name)
int strcmp(const String &s1, const String &s2)