196 int NTungstenPlatesTB24 =
conf_ints[
"EmulsionDet/n_tungsten_plates_tb24"];
197 bool testbeam_2024_setup =
false;
198 if (NTungstenPlatesTB24 > 0) {
199 testbeam_2024_setup =
true;
202 TGeoVolume *top=gGeoManager->FindVolumeFast(
"Detector");
203 if(!top) LOG(ERROR) <<
"no Detector volume found " ;
204 gGeoManager->SetVisLevel(10);
210 TGeoMedium *vacuum =gGeoManager->GetMedium(
"vacuum");
213 TGeoMedium *air =gGeoManager->GetMedium(
"air");
216 TGeoMedium *Al = gGeoManager->GetMedium(
"Aluminum");
219 TGeoMedium *PBase =gGeoManager->GetMedium(
"PlasticBase");
222 TGeoMedium *NEmu =gGeoManager->GetMedium(
"NuclearEmulsion");
224 TGeoMaterial *NEmuMat = NEmu->GetMaterial();
225 TGeoMaterial *PBaseMat = PBase->GetMaterial();
227 TGeoMixture * emufilmmixture =
new TGeoMixture(
"EmulsionFilmMixture", 2.00);
230 emufilmmixture->AddElement(NEmuMat,frac_emu);
231 emufilmmixture->AddElement(PBaseMat,1. - frac_emu);
233 TGeoMedium *Emufilm =
new TGeoMedium(
"EmulsionFilm",100,emufilmmixture);
236 TGeoMedium *tungsten = gGeoManager->GetMedium(
"tungstensifon");
246 TGeoVolumeAssembly *volTarget =
new TGeoVolumeAssembly(
"volTarget");
263 TGeoTranslation * Wallborderpos =
new TGeoTranslation(
"Walborderpos",0,0,
WallZBorder_offset);
264 Wallborderpos->RegisterYourself();
266 TGeoCompositeShape *Wallborder =
new TGeoCompositeShape(
"wallborder",
"walltot - (wallint:Walborderpos)");
267 TGeoVolume *volWallborder =
new TGeoVolume(
"volWallborder", Wallborder, Al);
268 volWallborder->SetLineColor(kGray);
270 TGeoVolume *volWall =
new TGeoVolume(
"Wall",Wallint,air);
271 TGeoVolume *volWall_2 =
new TGeoVolume(
"Wall_2",Wallint,air);
275 TGeoVolume *volRow =
new TGeoVolume(
"Row",Row,air);
277 TGeoVolume *volRow_W2 =
new TGeoVolume(
"Row_W2",Row_W2,air);
281 TGeoVolume *volBrick =
new TGeoVolume(
"Brick",Brick,air);
282 volBrick->SetLineColor(kCyan);
283 volBrick->SetTransparency(1);
286 TGeoVolume *volBrick_W2 =
new TGeoVolume(
"Brick_W2",Brick_W2,air);
287 volBrick_W2->SetLineColor(kOrange);
288 volBrick_W2->SetTransparency(1);
291 TGeoVolume *volPassive =
new TGeoVolume(
"volPassive",Passive,tungsten);
292 volPassive->SetTransparency(1);
293 volPassive->SetLineColor(kGray);
296 float UpstreamPlasticThickness = (NPlates-NTungstenPlatesTB24)*
AllPlateWidth;
299 float UpstreamPlasticThickness_W2 = UpstreamPlasticThickness - correction_W2;
300 TGeoBBox *Passive_plastic =
new TGeoBBox(
"Passive_plastic", (
EmulsionX-2.)/2, (
EmulsionY-2.)/2, UpstreamPlasticThickness/2);
301 TGeoVolume *volPassive_plastic =
new TGeoVolume(
"volPassive_plastic",Passive_plastic,PBase);
302 volPassive_plastic->SetLineColor(kMagenta);
303 volPassive_plastic->SetVisibility(kTRUE);
305 TGeoBBox *Passive_plastic_W2 =
new TGeoBBox(
"Passive_plastic_W2", (
EmulsionX-2.)/2, (
EmulsionY-2.)/2, UpstreamPlasticThickness_W2/2);
306 TGeoVolume *volPassive_plastic_W2 =
new TGeoVolume(
"volPassive_plastic_W2",Passive_plastic_W2,PBase);
307 volPassive_plastic_W2->SetLineColor(kMagenta+2);
308 volPassive_plastic_W2->SetVisibility(kTRUE);
310 float accumulatve_width = UpstreamPlasticThickness_W2;
312 for(Int_t n=0; n<NPlates; n++)
314 if (n==0 && testbeam_2024_setup){
315 volBrick->AddNode(volPassive_plastic, n,
316 new TGeoTranslation(0,0,-
BrickZ/2 + UpstreamPlasticThickness/2));
317 volBrick_W2->AddNode(volPassive_plastic_W2, n,
new TGeoTranslation(0,0,-
BrickZ/2 + UpstreamPlasticThickness_W2/2));
319 if (n>=(NPlates-NTungstenPlatesTB24) || !testbeam_2024_setup) {
320 volBrick->AddNode(volPassive, n,
322 if (testbeam_2024_setup){
324 volBrick_W2->AddNode(volPassive, n,
332 TGeoVolume *volEmulsionFilm =
new TGeoVolume(
"Emulsion",EmulsionFilm,Emufilm);
333 volEmulsionFilm->SetLineColor(kBlue);
334 LOG(INFO) <<
"EmulsionDet : Passive option (0: all active, 1: all passive) set to " <<
fPassiveOption ;
336 if (!testbeam_2024_setup){
337 for(Int_t n=0; n<NPlates+1; n++)
343 volBrick->SetVisibility(kTRUE);
344 if (testbeam_2024_setup) {
345 volBrick_W2->SetVisibility(kTRUE);
353 top->AddNode(volTarget,1,
new TGeoTranslation(0,0,0));
359 if (!testbeam_2024_setup){
360 for(
int l = 0; l <
fNWall; l++) {
378 for(
int k= 0; k<
fNRow; k++)
380 volWall->AddNode(volRow,k,
new TGeoTranslation(0, d_cl_y +
BrickY/2,0));
381 if (testbeam_2024_setup){
382 volWall_2->AddNode(volRow_W2,k,
new TGeoTranslation(0, d_cl_y +
BrickY/2,0));
391 for(
int j= 0; j <
fNCol; j++)
393 volRow->AddNode(volBrick,j,
new TGeoTranslation(d_cl_x+
BrickX/2, 0, 0));
394 if (testbeam_2024_setup){
395 volRow_W2->AddNode(volBrick_W2,j,
new TGeoTranslation(d_cl_x+
BrickX/2, 0, 0));
409 if ( gMC->IsTrackEntering() ) {
411 fTime = gMC->TrackTime() * 1.0e09;
413 gMC->TrackPosition(
fPos);
414 gMC->TrackMomentum(
fMom);
420 if ( gMC->IsTrackExiting() ||
421 gMC->IsTrackStop() ||
422 gMC->IsTrackDisappeared() ) {
423 fTrackID = gMC->GetStack()->GetCurrentTrackNumber();
428 Int_t MaxLevel = gGeoManager->GetLevel();
429 const Int_t MaxL = MaxLevel;
438 name = gMC->CurrentVolName();
442 Int_t NWall = -2, NColumn =-2, NRow =-2;
444 for(Int_t i = 0; i <= MaxL;i++)
446 gMC->CurrentVolOffID(i, motherV[i]);
447 const char *mumname = gMC->CurrentVolOffName(i);
449 if(strcmp(mumname,
"Brick") == 0) NColumn = (1-motherV[i]);
450 if(strcmp(mumname,
"Row") == 0) NRow = motherV[i];
451 if(strcmp(mumname,
"Wall") == 0) NWall = motherV[i];
455 detID = (NWall+1)*1E4+(NRow*2+NColumn+1)*1E3+(NPlate+1);
459 TParticle* p=gMC->GetStack()->GetCurrentTrack();
460 Int_t pdgCode = p->GetPdgCode();
461 if (pdgCode == 22) {
return kFALSE; }
464 gMC->TrackPosition(Pos);
465 Double_t xmean = (
fPos.X()+Pos.X())/2. ;
466 Double_t ymean = (
fPos.Y()+Pos.Y())/2. ;
467 Double_t zmean = (
fPos.Z()+Pos.Z())/2. ;
470 gMC->TrackMomentum(Mom);
473 fELoss,pdgCode,TVector3(Pos.X(), Pos.Y(), Pos.Z()),TVector3(Mom.Px(), Mom.Py(), Mom.Pz()) );