// Scintillators for the tracking station // Simone Bianco 10/02/2010 { const Double_t kDx = 1.; // in cm!! const Double_t kDy = 10.; // in cm!! const Double_t kDz = 0.1; // in cm!! // Positions of the detectors const Double_t kPos1 = -45.; // (cm) const Double_t kPos2 = kPos1 + 2*kDz; // (cm) const Double_t kPos3 = +45.; // (cm) const Double_t kPos4 = kPos3 + 2*kDz; // (cm) //################################################## gROOT->Macro("$VMCWORKDIR/gconfig/rootlogon.C"); // Load this libraries gSystem->Load("libGeoBase"); gSystem->Load("libParBase"); gSystem->Load("libBase"); gSystem->Load("libPndData"); gSystem->Load("libPassive"); TString outfile= "Scintillators.root"; TFile* fi = new TFile(outfile,"RECREATE"); FairGeoLoader* geoLoad = new FairGeoLoader("TGeo","FairGeoLoader"); FairGeoInterface *geoFace = geoLoad->getGeoInterface(); geoFace->setMediaFile("../../../geometry/media_pnd.geo"); geoFace->readMedia(); geoFace->print(); //################################################## FairGeoMedia *Media = geoFace->getMedia(); FairGeoBuilder *geobuild=geoLoad->getGeoBuilder(); FairGeoMedium *CbmMediumAir = Media->getMedium("air"); FairGeoMedium *CbmMediumScint = Media->getMedium("FscScint"); // TO BE CHANGED!!! Int_t nmed=geobuild->createMedium(CbmMediumAir); nmed=geobuild->createMedium(CbmMediumScint); TGeoManager* gGeoMan = (TGeoManager*)gROOT->FindObject("FAIRGeom"); TGeoVolume *top = new TGeoVolumeAssembly("Scintillators"); gGeoMan->SetTopVolume(top); TGeoShape *BoxScint1 = new TGeoBBox("Scint1", kDx, kDy, kDz); TGeoShape *BoxScint2 = new TGeoBBox("Scint2", kDx, kDy, kDz); TGeoShape *BoxScint3 = new TGeoBBox("Scint3", kDx, kDy, kDz); TGeoShape *BoxScint4 = new TGeoBBox("Scint4", kDx, kDy, kDz); TGeoVolume* BoxVolScint1 = new TGeoVolume("ScintVol1",BoxScint1,gGeoMan->GetMedium("FscScint")); TGeoVolume* BoxVolScint2 = new TGeoVolume("ScintVol2",BoxScint2,gGeoMan->GetMedium("FscScint")); TGeoVolume* BoxVolScint3 = new TGeoVolume("ScintVol3",BoxScint3,gGeoMan->GetMedium("FscScint")); TGeoVolume* BoxVolScint4 = new TGeoVolume("ScintVol4",BoxScint4,gGeoMan->GetMedium("FscScint")); // BoxVolScint4->SetUniqueID(77); TGeoTranslation* trt1 = new TGeoTranslation(0.,0.,kPos1); TGeoTranslation* trt2 = new TGeoTranslation(0.,0.,kPos2); TGeoTranslation* trt3 = new TGeoTranslation(0.,0.,kPos3); TGeoTranslation* trt4 = new TGeoTranslation(0.,0.,kPos4); TGeoRotation* dummyrot = new TGeoRotation(); TGeoRotation* rotPlus = new TGeoRotation("",45.,0.,0.); TGeoRotation* rotMinus = new TGeoRotation("",-45.,0.,0.); TGeoCombiTrans* trc1= new TGeoCombiTrans(*trt1,*rotPlus); trc1->SetName("S1"); trc1->RegisterYourself(); TGeoCombiTrans* trc2= new TGeoCombiTrans(*trt2,*rotMinus); trc2->SetName("S2"); trc2->RegisterYourself(); TGeoCombiTrans* trc3= new TGeoCombiTrans(*trt3,*rotPlus); trc3->SetName("S3"); trc3->RegisterYourself(); TGeoCombiTrans* trc4= new TGeoCombiTrans(*trt4,*rotMinus); trc4->SetName("S4"); trc4->RegisterYourself(); TGeoVolumeAssembly* SubunitVol = new TGeoVolumeAssembly("Vol"); // TGeoVolumeAssembly* SubunitDouble = new TGeoVolumeAssembly("TTDouble"); SubunitVol->AddNode(BoxVolScint1,0,trc1); SubunitVol->AddNode(BoxVolScint2,0,trc2); SubunitVol->AddNode(BoxVolScint3,0,trc3); SubunitVol->AddNode(BoxVolScint4,0,trc4); top->AddNode(SubunitVol,0,new TGeoCombiTrans()); gGeoMan->CloseGeometry(); top->Write(); fi->Close(); // gGeoManager->Export(outfile); top->Draw("ogl"); }