// Macro for running Cbm with Geant3 or Geant4 (M. Al-Turany , D. Bertini) // Modified 22/06/2005 D.Bertini Int_t runMvdSimZ(Int_t runSeed,Int_t events,std::string outpath, std::string geo){ gROOT->Macro("$VMCWORKDIR/gconfig/rootlogon.C"); // setting the run number seed gRandom->SetSeed(runSeed); TStopwatch timer; timer.Start(); gDebug=0; int verboseLevel = 0; Int_t nEvents = events; //FileNames //TString path ="/hiskp1/bianco/mvd/THOMAS/HV/B4/HV/CORE/"; // TString path ="/hiskp1/bianco/mvd/THOMAS/SUPPORT/FLANGE34/"; TString path = outpath.c_str(); TString outfile; ///////////////////////////////////// // // // Modify Here // // // ///////////////////////////////////// // Int_t mintheta = 35.; // 10 // Int_t maxtheta = 180.; //145 Int_t mintheta = 90.; // 10 Int_t maxtheta = 90.; //145 Double_t xpos = 0; Double_t ypos = 0; Double_t zpos = -20.; Double_t deltaz = 80.; Int_t pdg = 0; Double_t momentum = 0.5; outfile = Form("Mvd-00-0031_%d_%d_%lf_%lf_%lf_%lf_%d_%d_%d.root",events,pdg,momentum,xpos,ypos,zpos,mintheta,maxtheta,runSeed); TString simOutput = path + outfile; // std::string mvdgeom("ULTIMO/SUPPORT/New-Mvd-Support_Sbl_3-4.root"); std::string mvdgeom = geo.c_str(); //std::string mvdgeom("Test-Cone.root"); TString parOutput="MvdParams.root"; // Load basic libraries gROOT->Macro("Libs.C"); FairRunSim *fRun = new FairRunSim(); // set the MC version used // ------------------------ fRun->SetName("TGeant4"); // Choose the Geant Navigation System fRun->SetOutputFile(simOutput); // Set Material file Name //----------------------- fRun->SetMaterials("media_pnd.geo"); // Create and add detectors //------------------------- FairModule *Cave= new PndCave("CAVE"); Cave->SetGeometryFileName("pndcave_small2.geo"); fRun->AddModule(Cave); // FairModule *Magnet= new PndMagnet("MAGNET"); // Magnet->SetGeometryFileName("FullSolenoid.root"); // fRun->AddModule(Magnet); // FairModule *Dipole= new PndMagnet("MAGNET"); // Dipole->SetGeometryFileName("dipole.geo"); // fRun->AddModule(Dipole); FairDetector *Mvd = new PndMvdDetector("MVD", kFALSE); Mvd->SetGeometryFileName(mvdgeom.c_str()); Mvd->SetVerboseLevel(verboseLevel); fRun->AddModule(Mvd); // FairDetector *abs = new PndMvdDetector("Absorber", kFALSE); // abs->SetGeometryFileName("Absorber.root"); // fRun->AddModule(abs); //FairDetector *Stt= new PndStt("STT", kFALSE); //Stt->SetGeometryFileName("straws_skewed_blocks_35cm_pipe.geo"); //fRun->AddModule(Stt); //FairDetector *Emc = new PndEmc("EMC",kFALSE); //Emc->SetGeometryFileName("emc_module12345.dat"); //fRun->AddModule(Emc); //FairDetector *Drc = new PndDrc("DIRC", kFALSE); //Drc->SetGeometryFileName("dirc.geo"); //fRun->AddModule(Drc); // FairDetector *Tof= PndTof("TOF", kTRUE); // Tof->SetGeometryFileName("tofbarrel.geo"); // fRun->AddModule(Tof); // FairDetector *Muo = new PndMdt("MDT",kFALSE); // Muo->SetGeometryFileName("muopars.root"); // Muo->SetMdtVersion("torino"); // fRun->AddModule(Muo); FairPrimaryGenerator* primGen = new FairPrimaryGenerator(); fRun->SetGenerator(primGen); // Box Generator //Pi+ PndBoxGenerator* boxPiMinus = new PndBoxGenerator(pdg, 1); boxPiMinus->SetPRange(momentum,momentum); // momentumMin, momentumMax boxPiMinus->SetThetaRange(mintheta,maxtheta); // thetaMin, thetaMax boxPiMinus->SetPhiRange(0,360); // thetaMin, thetaMax //boxPiMinus->SetXYZ(0.,0.,zpos); // position of the source boxPiMinus->SetBoxXYZ(0.,0.,zpos-deltaz,0.,0.,zpos+deltaz); primGen->AddGenerator(boxPiMinus); fRun->SetStoreTraj(kFALSE); fRun->SetRadLenRegister(kTRUE); fRun->Init(); // -Trajectories Visualization (TGeoManager Only ) // ----------------------------------------------- // Set cuts for storing the trajectpries // FairTrajFilter* trajFilter = FairTrajFilter::Instance(); // trajFilter->SetStepSizeCut(0.01); // 1 cm // trajFilter->SetVertexCut(-200., -200., -200, 200., 200., 200.); // trajFilter->SetMomentumCutP(10e-3); // p_lab > 10 MeV // trajFilter->SetEnergyCut(0., 1.02); // 0 < Etot < 1.04 GeV // trajFilter->SetStorePrimaries(kTRUE); // trajFilter->SetStoreSecondaries(kTRUE); // Fill the Parameter containers for this run //------------------------------------------- FairRuntimeDb *rtdb=fRun->GetRuntimeDb(); Bool_t kParameterMerged=kTRUE; FairParRootFileIo* output=new FairParRootFileIo(kParameterMerged); output->open(parOutput.Data()); rtdb->setOutput(output); // Transport nEvents // ----------------- fRun->Run(nEvents); rtdb->saveOutput(); rtdb->print(); timer.Stop(); Double_t rtime = timer.RealTime(); Double_t ctime = timer.CpuTime(); printf("RealTime=%f seconds, CpuTime=%f seconds\n",rtime,ctime); TString text; text = Form("name_%d.dat",runSeed); ofstream textout(text); textout << simOutput << endl; textout.close(); delete fRun; exit(0); }