//Felix Boehmer, 26.3.2012 //Standard macro using DPMDirect void runSimSpaceCharge(unsigned int nEvents=10, TString outFile="MC_spaceCharge", UInt_t seed = 0, unsigned int mode = 1, double thMin = 1.E-2, Float_t mom = 3.672 ){ gRandom->SetSeed(seed); TStopwatch timer; timer.Start(); gDebug=0; // Load basic libraries // If it does not work, please check the path of the libs and put it by hands // gROOT->LoadMacro("$VMCWORKDIR/gconfig/rootlogon.C"); // rootlogon(); TString digiFile = "tpc.par"; outFile.Append("_mode"); char bufferMode[2]; sprintf(bufferMode, "%i",mode); outFile.Append(bufferMode); outFile.Append("_mom"); char bufferMom[10]; sprintf(bufferMom, "%.3f",mom); outFile.Append(bufferMom); outFile.Append("_thMin"); char bufferth[10]; sprintf(bufferth, "%.3f",thMin); outFile.Append(bufferth); outFile.Append(".mc.root"); TString parFile = outFile; parFile.ReplaceAll(".mc.root",".par.root"); TString mcMode = "TGeant3"; FairRunSim *fRun = new FairRunSim(); // set the MC version used // ------------------------ fRun->SetName(mcMode); fRun->SetOutputFile(outFile); // Set the parameters //------------------------------- TString allDigiFile = gSystem->Getenv("VMCWORKDIR"); allDigiFile += "/tpc/parfiles/"; allDigiFile += digiFile; FairRuntimeDb* rtdb = fRun->GetRuntimeDb(); FairParAsciiFileIo* parIo1 = new FairParAsciiFileIo(); parIo1->open(allDigiFile.Data(),"in"); rtdb->setFirstInput(parIo1); Bool_t kParameterMerged=kTRUE; FairParRootFileIo* output=new FairParRootFileIo(kParameterMerged); output->open(parFile); rtdb->setOutput(output); // 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("FullSolenoid_V842.root"); Magnet->SetGeometryFileName("FullSuperconductingSolenoid_v831.root"); fRun->AddModule(Magnet); FairModule *Pipe= new PndPipe("PIPE"); fRun->AddModule(Pipe); // FairDetector *Mvd = new PndMvdDetector("MVD", kTRUE); // Mvd->SetGeometryFileName("Mvd-2.1_FullVersion.root"); // fRun->AddModule(Mvd); TpcDetector *Tpc = new TpcDetector("TPC", kTRUE); Tpc->SetGeometryFileName("TPC_V1.1.root"); if(mcMode=="TGeant3") Tpc->SetAliMC(); fRun->AddModule(Tpc); // Create and Set Event Generator //------------------------------- FairPrimaryGenerator* primGen = new FairPrimaryGenerator(); fRun->SetGenerator(primGen); //thMin was set to 2. as default in the pandaroot version of this macro ... ? //PndDpmDirect *dpmGen = new PndDpmDirect(mom,mode, gRandom->GetSeed(), thMin); //primGen->AddGenerator(dpmGen); FairBoxGenerator* boxGen = new FairBoxGenerator(11, 1); boxGen->SetPRange(0.2,2); // GeV/c boxGen->SetPhiRange(0, 360); // Azimuth angle range [degree] boxGen->SetThetaRange(0,360); // 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); /**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(); printf("RealTime=%f seconds, CpuTime=%f seconds\n",rtime,ctime); std::cout<<"Generated Output: "<