// -------------------------------------------------------------- // // Macro for standard transport delta simulation using GEANT3 // CBM setup with MVD only // // P.Sitzmann 04/09/2014 // // -------------------------------------------------------------------------- void mvd_transDelta(Int_t nEvents = 5000, Int_t ProcID = 1) { // ======================================================================== // Adjust this part according to your requirements TString setup = "sis100_electron"; // Output path TString outpath ="/hera/cbm/users/psitzmann/data/"; //output file TString outfile = Form("mvd.mc.delta.ni.%i.root",ProcID); //output filename TString outFile = outpath + outfile; // Parameter file name TString parFile = outpath + "params.root"; TString inDir = gSystem->Getenv("VMCWORKDIR"); TString setupFile = inDir + "/geometry/setup/" + setup + "_setup.C"; TString setupFunct = setup; setupFunct += "_setup()"; gROOT->LoadMacro(setupFile); gInterpreter->ProcessLine(setupFunct); gRandom->SetSeed(0); // In general, the following parts need not be touched // ======================================================================== // ---- Debug option ------------------------------------------------- gDebug = 0; // ------------------------------------------------------------------------ // ----- Timer -------------------------------------------------------- TStopwatch timer; timer.Start(); // ------------------------------------------------------------------------ // ----- Create simulation run ---------------------------------------- FairRunSim* fRun = new FairRunSim(); fRun->SetName("TGeant3"); // Transport engine fRun->SetOutputFile(outFile); // Output file FairRuntimeDb* rtdb = fRun->GetRuntimeDb(); // ------------------------------------------------------------------------ // ----- Create media ------------------------------------------------- fRun->SetMaterials("media.geo"); // Materials // ------------------------------------------------------------------------ // ----- Create geometry ---------------------------------------------- FairModule* cave= new CbmCave("CAVE"); cave->SetGeometryFileName(caveGeom); fRun->AddModule(cave); FairModule* pipe= new CbmPipe("PIPE"); pipe->SetGeometryFileName(pipeGeom); fRun->AddModule(pipe); FairModule* target= new CbmTarget(58, 0.25); fRun->AddModule(target) FairModule* magnet= new CbmMagnet("MAGNET"); magnet->SetGeometryFileName(magnetGeom); fRun->AddModule(magnet); FairDetector* mvd= new CbmMvd("MVD", kTRUE); mvd->SetGeometryFileName(mvdGeom); mvd->SetMotherVolume("pipevac1"); fRun->AddModule(mvd); // ------------------------------------------------------------------------ // ----- Create magnetic field --------------------------------------- if ( 2 == fieldSymType ) { CbmFieldMap* magField = new CbmFieldMapSym2(fieldMap); } else if ( 3 == fieldSymType ) { CbmFieldMap* magField = new CbmFieldMapSym3(fieldMap); } magField->SetPosition(0., 0., fieldZ); magField->SetScale(fieldScale); fRun->SetField(magField); // ------------------------------------------------------------------------ FairIon *fIon = new FairIon("My_Ni", 58, 59, 79, 15., 58.693); fRun->AddNewIon(fIon); // ----- Create PrimaryGenerator -------------------------------------- FairPrimaryGenerator* primGen = new FairPrimaryGenerator(); FairIonGenerator* fIongen = new FairIonGenerator(58, 59, 58,1, 0.,0., 15, 0.,0.,-1.); primGen->AddGenerator(fIongen); fRun->SetGenerator(primGen); // ------------------------------------------------------------------------ // ----- Run initialisation ------------------------------------------- fRun->Init(); // ------------------------------------------------------------------------ // ----- Runtime database --------------------------------------------- CbmFieldPar* fieldPar = (CbmFieldPar*) rtdb->getContainer("CbmFieldPar"); fieldPar->SetParameters(magField); fieldPar->setChanged(); fieldPar->setInputVersion(fRun->GetRunId(),1); Bool_t kParameterMerged = kTRUE; FairParRootFileIo* parOut = new FairParRootFileIo(kParameterMerged); parOut->open(parFile.Data()); rtdb->setOutput(parOut); rtdb->saveOutput(); rtdb->print(); // ------------------------------------------------------------------------ // ----- Start run ---------------------------------------------------- fRun->Run(nEvents); // ------------------------------------------------------------------------ // ----- Finish ------------------------------------------------------- timer.Stop(); Double_t rtime = timer.RealTime(); Double_t ctime = timer.CpuTime(); cout << endl << endl; cout << "Macro finished succesfully." << endl; cout << "Output file is " << outFile << endl; cout << "Parameter file is " << parFile << endl; cout << "Real time " << rtime << " s, CPU time " << ctime << "s" << endl << endl; // ------------------------------------------------------------------------ cout << " Test passed" << endl; cout << " All ok " << endl; }