void runLaserMC(TString jobname, int nEvents=1, unsigned int seed=0) { // ------------------------------------------------------------------------ gRandom->SetSeed(seed); // ======================================================================== // Verbosity level (0=quiet, 1=event level, 2=track level, 3=debug) Int_t iVerbose = 1; FairRunSim *fRun = new FairRunSim(); // set the MC version used // -------------------------------------------------- TString mcMode = "TGeant3"; fRun->SetName(mcMode); TString outfile = jobname; outfile.Append(".mc.root"); TString copy = outfile; std::cout<SetOutputFile(outfile); std::cout<<"Set output file to "<Getenv("VMCWORKDIR"); digifile+="/tpc/parfiles/tpc.par"; FairRuntimeDb *rtdb=fRun->GetRuntimeDb(); FairParAsciiFileIo* parIo1 = new FairParAsciiFileIo(); parIo1->open(digifile.Data(),"in"); rtdb->setFirstInput(parIo1); Bool_t kParameterMerged=kTRUE; FairParRootFileIo* parOut=new FairParRootFileIo(kParameterMerged); parOut->open(parfile.Data()); rtdb->setOutput(parOut); // In general, the following parts need not be touched // ======================================================================== // ----- Timer -------------------------------------------------------- TStopwatch timer; timer.Start(); // ------------------------------------------------------------------------ // Set Material file Name //----------------------- fRun->SetMaterials("media_pnd.geo"); // Create and add detectors //------------------------- FairModule *Cave= new PndCave("CAVE"); Cave->SetGeometryFileName("pndcave.geo"); fRun->AddModule(Cave); FairModule *Magnet= new PndMagnet("MAGNET"); Magnet->SetGeometryFileName("FullSuperconductingSolenoid_v831.root"); fRun->AddModule(Magnet); FairModule *Pipe= new PndPipe("PIPE"); fRun->AddModule(Pipe); TpcDetector *Tpc = new TpcDetector("TPC", kTRUE); Tpc->SetGeometryFileName("TPC_V1.1.root"); //new ROOT geometry if(mcMode=="TGeant3") Tpc->SetAliMC(); fRun->AddModule(Tpc); FairPrimaryGenerator* primGen = new FairPrimaryGenerator(); fRun->SetGenerator(primGen); FairBoxGenerator* boxGen = new FairBoxGenerator(11, 1); boxGen->SetPRange(2,2); // GeV/c boxGen->SetPhiRange(0, 360); // Azimuth angle range [degree] boxGen->SetThetaRange(0, 1); // Polar angle in lab system range [degree] boxGen->SetXYZ(0., 0., 0.); primGen->AddGenerator(boxGen); // Create and Set Magnetic Field //------------------------------- fRun->SetBeamMom(15); //PndMultiField *fField= new PndMultiField("FULL"); //fRun->SetField(fField); //constant zero-field PndConstField *fMagField=new PndConstField(); fMagField->SetField(0., 0. ,0. ); // values are in kG fMagField->SetFieldRegion(-50, 50,-50, 50, -2000, 2000); fRun->SetField(fMagField); /**Initialize the session*/ fRun->Init(); //rtdb->setOutput(output); rtdb->saveOutput(); rtdb->print(); // Transport nEvents // ----------------- fRun->Run(nEvents); 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; cout << endl; // ------------------------------------------------------------------------ }