275 TGeoVolume *top=gGeoManager->GetTopVolume();
278 TGeoMedium *air =gGeoManager->GetMedium(
"air");
281 TGeoMedium *Fe =gGeoManager->GetMedium(
"iron");
284 TGeoMedium *Al = gGeoManager->GetMedium(
"CoilAluminium");
287 TGeoMedium *Cu = gGeoManager->GetMedium(
"CoilCopper");
290 TGeoMedium *PBase =gGeoManager->GetMedium(
"PlasticBase");
293 TGeoMedium *NEmu =gGeoManager->GetMedium(
"NuclearEmulsion");
295 TGeoMaterial *NEmuMat = NEmu->GetMaterial();
296 TGeoMaterial *PBaseMat = PBase->GetMaterial();
301 if (
fsingleemulsionfilm) cout<<
"TARGET PRINTOUT: Single volume for emulsion film chosen: average density: "<<rho_film<<
" fraction in mass of emulsion "<<frac_emu<<endl;
303 TGeoMixture * emufilmmixture =
new TGeoMixture(
"EmulsionFilmMixture", 2.00);
305 emufilmmixture->AddElement(NEmuMat,frac_emu);
306 emufilmmixture->AddElement(PBaseMat,1. - frac_emu);
308 TGeoMedium *Emufilm =
new TGeoMedium(
"EmulsionFilm",100,emufilmmixture);
311 TGeoMedium *lead = gGeoManager->GetMedium(
"lead");
314 TGeoMedium *rohacell = gGeoManager->GetMedium(
"rohacell");
317 TGeoMedium *Conc =gGeoManager->GetMedium(
"Concrete");
320 TGeoMedium *Steel =gGeoManager->GetMedium(
"steel");
323 Int_t NRohacellGap = 2;
327 TGeoVolume *volTarget =
new TGeoVolume(
"volTarget",TargetBox, air);
332 TGeoVolume *MagnetVol;
335 TGeoUniformMagField *magField2 =
new TGeoUniformMagField();
339 magField2->SetFieldValue(
fField,0,0.);
340 MagnetVol=gGeoManager->GetVolume(
"Davide");
344 MagnetVol=gGeoManager->GetVolume(
"Goliath");
345 magField2->SetFieldValue(0.,
fField,0.);
349 magField2->SetFieldValue(
fField,0,0.);
350 MagnetVol=gGeoManager->GetVolume(
"NudetMagnet");
354 if (
fDesign != 3) volTarget->SetField(magField2);
355 volTarget->SetVisibility(1);
356 volTarget->SetVisDaughters(1);
362 TGeoVolume *volMagRegion=gGeoManager->GetVolume(
"volMagRegion");
363 Double_t ZDimMagnetizedRegion = ((TGeoBBox*) volMagRegion->GetShape())->GetDZ() * 2.;
381 TGeoVolume *volCell =
new TGeoVolume(
"Cell",Cell,air);
385 TGeoVolume *volBrick =
new TGeoVolume(
"Brick",Brick,air);
386 volBrick->SetLineColor(kCyan);
387 volBrick->SetTransparency(1);
390 TGeoVolume *volLead =
new TGeoVolume(
"Lead",Lead,lead);
391 volLead->SetTransparency(1);
392 volLead->SetLineColor(kGray);
395 for(Int_t n=0; n<NPlates; n++)
401 TGeoVolume *volEmulsionFilm =
new TGeoVolume(
"Emulsion",EmulsionFilm,Emufilm);
402 volEmulsionFilm->SetLineColor(kBlue);
406 AddSensitiveVolume(volEmulsionFilm);
409 for(Int_t n=0; n<NPlates+1; n++)
416 TGeoVolume *volEmulsionFilm =
new TGeoVolume(
"Emulsion",EmulsionFilm,NEmu);
417 TGeoVolume *volEmulsionFilm2 =
new TGeoVolume(
"Emulsion2",EmulsionFilm,NEmu);
418 volEmulsionFilm->SetLineColor(kBlue);
419 volEmulsionFilm2->SetLineColor(kBlue);
423 AddSensitiveVolume(volEmulsionFilm);
424 AddSensitiveVolume(volEmulsionFilm2);
427 TGeoVolume *volPlBase =
new TGeoVolume(
"PlasticBase",PlBase,PBase);
428 volPlBase->SetLineColor(kYellow-4);
429 for(Int_t n=0; n<NPlates+1; n++)
437 volBrick->SetVisibility(kTRUE);
445 TGeoVolume *volCES =
new TGeoVolume(
"CES", CES, air);
446 volCES->SetTransparency(5);
447 volCES->SetLineColor(kYellow-10);
448 volCES->SetVisibility(kTRUE);
451 TGeoVolume *volRohGap =
new TGeoVolume(
"RohacellGap",RohGap,air);
452 volRohGap->SetTransparency(1);
453 volRohGap->SetLineColor(kYellow);
455 for(Int_t n=0; n<NRohacellGap; n++)
461 TGeoVolume *volEmulsionFilmCES =
new TGeoVolume(
"EmulsionCES",EmulsionFilmCES,Emufilm);
462 volEmulsionFilmCES->SetLineColor(kBlue);
465 AddSensitiveVolume(volEmulsionFilmCES);
468 for(Int_t n=0; n<NRohacellGap+1;n++)
477 TGeoVolume *volEmulsionFilmCES =
new TGeoVolume(
"EmulsionCES",EmulsionFilmCES,NEmu);
478 TGeoVolume *volEmulsionFilm2CES =
new TGeoVolume(
"Emulsion2CES",EmulsionFilmCES,NEmu);
479 volEmulsionFilmCES->SetLineColor(kBlue);
480 volEmulsionFilm2CES->SetLineColor(kBlue);
483 AddSensitiveVolume(volEmulsionFilmCES);
484 AddSensitiveVolume(volEmulsionFilm2CES);
488 TGeoVolume *volPlBaseCES =
new TGeoVolume(
"PlasticBaseCES",PlBaseCES,PBase);
489 volPlBaseCES->SetLineColor(kYellow);
490 for(Int_t n=0; n<NRohacellGap+1;n++)
501 volCell->AddNode(volBrick,1,
new TGeoTranslation(0,0,-
CellWidth/2 +
BrickZ/2));
505 TGeoVolume *volRow =
new TGeoVolume(
"Row",Row,air);
506 volRow->SetLineColor(20);
509 for(
int j= 0; j <
fNCol; j++)
511 volRow->AddNode(volCell,j,
new TGeoTranslation(d_cl_x+
BrickX/2, 0, 0));
516 TGeoVolume *volWall =
new TGeoVolume(
"Wall",Wall,air);
519 for(
int k= 0; k<
fNRow; k++)
521 volWall->AddNode(volRow,k,
new TGeoTranslation(0, d_cl_y +
BrickY/2, 0));
532 for(
int l = 0; l <
fNWall; l++)
534 volTarget->AddNode(volWall,l,
new TGeoTranslation(0, 0, d_cl_z +
CellWidth/2));
548 TGeoVolume *tTauNuDet = gGeoManager->GetVolume(
"tTauNuDet");
549 cout<<
"Tau Nu Detector fMagnetConfig: "<<
fDesign<<endl;
551 tTauNuDet->AddNode(volTarget,1,
new TGeoTranslation(0,0,
fCenterZ));
554 TGeoVolume *volRow =
new TGeoVolume(
"Row",Row,air);
555 volRow->SetLineColor(20);
558 for(
int j= 0; j <
fNCol; j++)
560 volRow->AddNode(volBrick,j,
new TGeoTranslation(d_cl_x+
BrickX/2, 0, 0));
564 TGeoVolume *volWall =
new TGeoVolume(
"Wall",Wall,air);
567 for(
int k= 0; k<
fNRow; k++)
569 volWall->AddNode(volRow,k,
new TGeoTranslation(0, d_cl_y +
BrickY/2, 0));
579 for(
int l = 0; l <
fNWall; l++)
581 volTarget->AddNode(volWall,l,
new TGeoTranslation(0, 0, d_cl_z +
BrickZ/2));
588 TGeoVolume *volBase =
new TGeoVolume(
"volBase",Base,Conc);
589 volBase->SetLineColor(kYellow-3);
595 TGeoVolume *PillarVol =
new TGeoVolume(
"PillarVol",PillarBox,Steel);
596 PillarVol->SetLineColor(kGreen+3);
609 if ( gMC->IsTrackEntering() ) {
611 fTime = gMC->TrackTime() * 1.0e09;
613 gMC->TrackPosition(
fPos);
614 gMC->TrackMomentum(
fMom);
620 if ( gMC->IsTrackExiting() ||
621 gMC->IsTrackStop() ||
622 gMC->IsTrackDisappeared() ) {
623 fTrackID = gMC->GetStack()->GetCurrentTrackNumber();
630 Int_t MaxLevel = gGeoManager->GetLevel();
631 const Int_t MaxL = MaxLevel;
638 Bool_t EmBrick = 0, EmCES = 0, EmTop;
642 name = gMC->CurrentVolName();
645 if(strcmp(name,
"Emulsion") == 0)
651 if(strcmp(name,
"Emulsion2") == 0)
657 if(strcmp(name,
"EmulsionCES") == 0)
663 if(strcmp(name,
"Emulsion2CES") == 0)
670 Int_t NWall = 0, NColumn =0, NRow =0;
672 for(Int_t i = 0; i < MaxL;i++)
674 motherV[i] = gGeoManager->GetMother(i)->GetNumber();
675 const char *mumname = gMC->CurrentVolOffName(i);
676 if(motherV[0]==1 && motherV[0]!=detID)
678 if(strcmp(mumname,
"Brick") == 0 ||strcmp(mumname,
"CES") == 0) NColumn = motherV[i];
679 if(strcmp(mumname,
"Cell") == 0) NRow = motherV[i];
680 if(strcmp(mumname,
"Row") == 0) NWall = motherV[i];
681 if((strcmp(mumname,
"Wall") == 0)&& (motherV[i]==2)) NWall +=
fNWall;
686 if(strcmp(mumname,
"Cell") == 0) NColumn = motherV[i];
687 if(strcmp(mumname,
"Row") == 0) NRow = motherV[i];
688 if(strcmp(mumname,
"Wall") == 0) NWall = motherV[i];
689 if((strcmp(mumname,
"volTarget") == 0) && (motherV[i]==2)) NWall +=
fNWall;
694 Bool_t BrickorCES = 0;
698 Double_t zEnd = 0, zStart =0;
701 detID = (NWall+1) *1E7 + (NRow+1) * 1E6 + (NColumn+1)*1E4 + BrickorCES *1E3 + (NPlate+1)*1E1 + EmTop*1 ;
706 if (
fELoss == 0. ) {
return kFALSE; }
707 TParticle* p=gMC->GetStack()->GetCurrentTrack();
709 Int_t fMotherID =p->GetFirstMother();
710 Int_t pdgCode = p->GetPdgCode();
715 gMC->TrackPosition(Pos);
716 Double_t xmean = (
fPos.X()+Pos.X())/2. ;
717 Double_t ymean = (
fPos.Y()+Pos.Y())/2. ;
718 Double_t zmean = (
fPos.Z()+Pos.Z())/2. ;