// Macro created 5/04/2007 by A.Sanchez // It creates a geant simulation file for hypGe void sim_hypGe_extparameters_urqmd(Int_t nEvents, Int_t WhichDetector,Int_t iurqmdFile,Int_t StartEvent,Int_t SecTarget){ // Load basic libraries // If it does not work, please check the path of the libs and put it by hands gROOT->Macro("$VMCWORKDIR/gconfig/rootlogon.C"); gSystem->Load("libHypGe"); FairRunSim *fRun = new FairRunSim(); TStopwatch timer; timer.Start(); gDebug=0; TString urqmdFile = "pbarC_"; urqmdFile += iurqmdFile; TString inFile="/home/steinen/work/urqmd/pbarC_3GeV/"; inFile += urqmdFile; inFile += ".root"; //Choose geometry TString outFile="$SIMDATADIR/Neutron/"; // If no SIMDATADIR, same folder as the macro TString GeoFile; if (WhichDetector == 3) { GeoFile ="hypGe_GeoMarcell.root"; outFile += "TripleV2_"; } else if (WhichDetector == 31) { GeoFile = "hypGeGeoTripleCluster_V3.root"; outFile += "TripleBall30_"; } else if (WhichDetector == 32) { GeoFile = "hypGeGeoTripleCluster_Straight.root"; outFile += "TripleStraight_"; } else if (WhichDetector == 33) { GeoFile = "hypGeGeoTripleCluster_Ball40_Offset10.root"; outFile += "TripleBall40Offset10_"; } else if (WhichDetector == 34) { GeoFile = "hypGeGeoTripleCluster_Ball40_Offset20.root"; outFile += "TripleBall40Offset20_"; } else if (WhichDetector == 35) { GeoFile = "hypGeGeoTripleCluster_Ball40_Offset10_STTFitting.root"; outFile += "TripleBall40Offset10STT_"; } else if (WhichDetector == 36) { GeoFile = "hypGeGeoTripleCluster_Ball40_Offset20_STTFitting.root"; outFile += "TripleBall40Offset20STT_"; } else if (WhichDetector == 2) { GeoFile = "hypGe_GeoMarcell_2er.root"; outFile += "DoubleV2_"; } else if (WhichDetector == 21) { GeoFile = "hypGeGeoDoubleCluster_V3.root"; outFile += "DoubleV3_"; } //compose the name of the output file and the simparams file outFile += "urqmd_"; outFile += urqmdFile; outFile +="_"; outFile += nEvents; outFile += "Evts_StartEvent_"; outFile += StartEvent; if(SecTarget) outFile += "_SecTar"; TString SimparamsFile; SimparamsFile=outFile; outFile +=".root"; SimparamsFile += "__Simparams.root"; //TString inFile="/d/panda02/urqmd_smm/pbarC_3_GeV.root"; //TString inFile="/u/asanchez/razhyp_gt12.dat"; // set the MC version used // ------------------------ fRun->SetName("TGeant4"); fRun->SetOutputFile(outFile); // Set Material file Name //----------------------- fRun->SetMaterials("media_pnd_hypGe.geo"); // Create and add detectors //------------------------- FairModule *Cave= new PndCave("CAVE"); Cave->SetGeometryFileName("pndcave.geo"); fRun->AddModule(Cave); if(SecTarget) { //acc sec. target PndHyp *Hyp= new PndHyp("HYP",kFALSE); Hyp->SetAbsorberVol("Absorber"); // absorber layer Hyp->SetSensorVol("Sensor"); // silicon sensor Hyp->SetGeometryFileName("../macro/hyp/Sebastian/SekTarget_open_varAbs4Si5_3Q_HYPbe_1mm_MVD.root"); fRun->AddModule(Hyp); //add MVD outer barrel FairDetector *Mvd = new PndMvdDetector("MVD", kFALSE); Mvd->SetGeometryFileName("../macro/hyp/Sebastian/Mvd-2.2_Simplified_onlyStrip5_z-verschoben550.root"); fRun->AddModule(Mvd); } PndHypGe *HypGe= new PndHypGe("HYPGE",kTRUE); TString nam = gSystem->Getenv("VMCWORKDIR"); HypGe->SetPathGeo(nam.Data()); HypGe->SetGeometryFileName(GeoFile); fRun->AddModule(HypGe); // FairDetector *Hyp= new FairHyp("HYP",kTRUE); // Hyp->SetGeometryFileName("HypST_prueba24pipe.geo"); // fRun->AddModule(Hyp); // FairDetector *Drc = new FairDrc("DIRC", kTRUE); // Drc->SetGeometryFileName("dirc.geo"); // fRun->AddModule(Drc); // FairModule *Magnet= new FairMagnet("MAGNET"); // Magnet->SetGeometryFileName("magnet.geo"); // fRun->AddModule(Magnet); // FairDetector *Emc = new FairEmc("EMC",kTRUE); // Emc->SetGeometryFileName("emc_module123.dat"); // fRun->AddModule(Emc); // Create and Set Event Generator //------------------------------- FairPrimaryGenerator* primGen = new FairPrimaryGenerator(); fRun->SetGenerator(primGen); PndUrqmdSmmGenerator* UrqmdGen = new PndUrqmdSmmGenerator(inFile,StartEvent); primGen->SetTarget(-55.,0.); primGen->AddGenerator(UrqmdGen); fRun->SetStoreTraj(kTRUE); // to store particle trajectories //magnetic field: no field when commented put PndConstField *fMagField=new PndConstField(); fMagField->SetField(0.,0.,10.); // values are in kG fMagField->SetFieldRegion(-50, 50,-50, 50, -100, 100); //values are in cm (xmin,xmax,ymin,ymax,zmin,zmax) fRun->SetField(fMagField); fRun->Init(); // Fill the Parameter containers for this run //------------------------------------------- FairRuntimeDb *rtdb=fRun->GetRuntimeDb(); Bool_t kParameterMerged=kTRUE; FairParRootFileIo* output=new FairParRootFileIo(kParameterMerged); output->open(SimparamsFile); 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); }