// Macro created 20/09/2006 by S.Spataro // It creates a geant simulation file for emc sim_gg(TString simdatei="sim_gg.root", TString input="gg.evt", TString param="simparam.root", Int_t nEvents=10, Char_t TransportModel[] = "TGeant4", Double_t pbeam=15, UInt_t seed=0) { 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(); FairRunSim *fRun = new FairRunSim(); // set the MC version used // ------------------------ fRun->SetName(TransportModel); fRun->SetOutputFile(simdatei); // 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.root"); fRun->AddModule(Magnet); FairModule *Dipole= new PndMagnet("MAGNET"); Dipole->SetGeometryFileName("dipole.geo"); fRun->AddModule(Dipole); FairModule *Pipe= new PndPipe("PIPE"); Pipe->SetGeometryFileName("pipe.geo"); fRun->AddModule(Pipe); //FairDetector *Stt= new PndStt("STT", kTRUE); //Stt->SetGeometryFileName("straws_skewed_blocks.geo"); //fRun->AddModule(Stt); FairDetector *Tpc = new PndTpcDetector("TPC", kTRUE); Tpc->SetGeometryFileName("tpc.geo"); fRun->AddModule(Tpc); FairDetector *Mvd = new PndMvdDetector("MVD", kTRUE); Mvd->SetGeometryFileName("MVD_v1.0_woPassiveTraps.root"); fRun->AddModule(Mvd); //FairDetector *Emc = new PndEmc("EMC",kTRUE); PndEmc *Emc = new PndEmc("EMC",kTRUE); //Emc->SetGeometryFileName("emc_module12345.dat"); // if you want to use old geometry for FwEndCap Emc->SetGeometryFileNameDouble("emc_module1245.dat","emc_module3new.root"); // if you want to use new geometry for FwEndCap fRun->AddModule(Emc); FairDetector *Tof = new PndTof("TOF",kTRUE); Tof->SetGeometryFileName("tofbarrel.geo"); fRun->AddModule(Tof); FairDetector *Drc = new PndDrc("DIRC", kTRUE); Drc->SetGeometryFileName("dirc.geo"); fRun->AddModule(Drc); //PndMdt* Mdt = new PndMdt("MDT",kTRUE); //Mdt->SetMdtVersion("torino"); //Mdt->SetGeometryFileName("muopars.root"); //fRun->AddModule(Mdt); //FairDetector *Dch = new PndDchDetector("DCH", kTRUE); //Dch->SetGeometryFileName("dch.root"); //fRun->AddModule(Dch); // Create and Set Event Generator //------------------------------- FairPrimaryGenerator* primGen = new FairPrimaryGenerator(); fRun->SetGenerator(primGen); FairEvtGenGenerator* evtGen = new FairEvtGenGenerator(input); primGen->AddGenerator(evtGen); //fRun->SetStoreTraj(kTRUE); // to store particle trajectories fRun->SetBeamMom(pbeam); PndMultiField *fField= new PndMultiField(); PndTransMap *map_t= new PndTransMap("TransMap", "R"); PndDipoleMap *map_d1= new PndDipoleMap("DipoleMap1", "R"); PndDipoleMap *map_d2= new PndDipoleMap("DipoleMap2", "R"); PndSolenoidMap *map_s1= new PndSolenoidMap("SolenoidMap1", "R"); PndSolenoidMap *map_s2= new PndSolenoidMap("SolenoidMap2", "R"); PndSolenoidMap *map_s3= new PndSolenoidMap("SolenoidMap3", "R"); PndSolenoidMap *map_s4= new PndSolenoidMap("SolenoidMap4", "R"); fField->AddField(map_t); fField->AddField(map_d1); fField->AddField(map_d2); fField->AddField(map_s1); fField->AddField(map_s2); fField->AddField(map_s3); fField->AddField(map_s4); fRun->SetField(fField); fRun->Init(); // Fill the Parameter containers for this run //------------------------------------------- FairRuntimeDb *rtdb=fRun->GetRuntimeDb(); Bool_t kParameterMerged=kTRUE; PndMultiFieldPar* Par = (PndMultiFieldPar*) rtdb->getContainer("PndMultiFieldPar"); if (fField) { Par->SetParameters(fField); } Par->setInputVersion(fRun->GetRunId(),1); Par->setChanged(); FairParRootFileIo* output=new FairParRootFileIo(kParameterMerged); output->open(param); 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); }