void run_eve(TString InputDataFile = "output.root",TString OutputDataFile = "output.reco_display.root", TString unpackDir="/Unpack_GETDecoder2/") { FairLogger *fLogger = FairLogger::GetLogger(); fLogger -> SetLogToScreen(kTRUE); fLogger->SetLogVerbosityLevel("MEDIUM"); TString dir = getenv("VMCWORKDIR"); TString geoFile = "ATTPC_v1.1_geomanager.root"; TString InputDataPath = dir + "/macro/"+ unpackDir + InputDataFile; TString OutputDataPath = dir + "/macro/"+ unpackDir + OutputDataFile; TString GeoDataPath = dir + "/geometry/" + geoFile; FairRunAna *fRun= new FairRunAna(); fRun -> SetInputFile(InputDataPath); fRun -> SetOutputFile(OutputDataPath); fRun -> SetGeomFile(GeoDataPath); FairRuntimeDb* rtdb = fRun->GetRuntimeDb(); FairParRootFileIo* parIo1 = new FairParRootFileIo(); //parIo1->open("param.dummy.root"); rtdb->setFirstInput(parIo1); FairRootManager* ioman = FairRootManager::Instance(); ATEventManager *eveMan = new ATEventManager(); ATEventDrawTask* eve = new ATEventDrawTask(); eve->Set3DHitStyleBox(); eve->SetMultiHit(100); //Set the maximum number of multihits in the visualization eve->SetSaveTextData(); eve->UnpackHoughSpace(); eveMan->AddTask(eve); eveMan->Init(); }
void run_eveTransform_proto() { TString dir = getenv("VMCWORKDIR"); TString protomapfile = "proto.map"; TString protomapdir = dir + "/scripts/"+ protomapfile; FairLogger *fLogger = FairLogger::GetLogger(); fLogger -> SetLogToScreen(kTRUE); fLogger->SetLogVerbosityLevel("MEDIUM"); FairRunAna *fRun= new FairRunAna(); fRun -> SetInputFile("output_proto.root"); fRun -> SetOutputFile("output_proto.reco_display.root"); FairRuntimeDb* rtdb = fRun->GetRuntimeDb(); FairParRootFileIo* parIo1 = new FairParRootFileIo(); parIo1->open("param.dummy_proto.root"); rtdb->setFirstInput(parIo1); FairRootManager* ioman = FairRootManager::Instance(); ATEventManager *eveMan = new ATEventManager(); ATEventDrawTask* eve = new ATEventProtoDrawTask(); eve->SetGeoOption("Prototype"); // Options: "ATTPC" - "Prototype" eve->SetProtoMap(protomapdir.Data()); eveMan->AddTask(eve); eveMan->Init(); }
void run_eve_proto_lite(TString InputDataFile = "output_proto.root",TString OutputDataFile = "output_proto.reco_display.root", TString unpackDir="/Unpack_GETDecoder2/") { TString dir = getenv("VMCWORKDIR"); TString protomapfile = "proto.map"; TString protomapdir = dir + "/scripts/"+ protomapfile; TString geoFile = "ATTPC_Proto_v1.0_geomanager.root"; TString InputDataPath = dir + "/macro/"+ unpackDir + InputDataFile; TString OutputDataPath = dir + "/macro/"+ unpackDir + OutputDataFile; TString GeoDataPath = dir + "/geometry/" + geoFile; FairLogger *fLogger = FairLogger::GetLogger(); fLogger -> SetLogToScreen(kTRUE); fLogger->SetLogVerbosityLevel("MEDIUM"); FairRunAna *fRun= new FairRunAna(); fRun -> SetInputFile(InputDataPath); fRun -> SetOutputFile(OutputDataPath); fRun -> SetGeomFile(GeoDataPath); FairRuntimeDb* rtdb = fRun->GetRuntimeDb(); FairParRootFileIo* parIo1 = new FairParRootFileIo(); //parIo1->open("param.dummy_proto.root"); rtdb->setFirstInput(parIo1); FairRootManager* ioman = FairRootManager::Instance(); ATEventManagerProto *eveMan = new ATEventManagerProto(); ATEventDrawTaskProto* eve = new ATEventDrawTaskProto(); eve->Set3DHitStyleBox(); eve->SetProtoMap(protomapdir.Data()); eveMan->AddTask(eve); eveMan->Init(); }
void run_trac_its(Int_t nEvents = 10, TString mcEngine = "TGeant3"){ // Initialize logger FairLogger *logger = FairLogger::GetLogger(); logger->SetLogVerbosityLevel("LOW"); logger->SetLogScreenLevel("INFO"); // Input and output file name std::stringstream inputfile, outputfile, paramfile; inputfile << "AliceO2_" << mcEngine << ".clus_" << nEvents << "_event.root"; paramfile << "AliceO2_" << mcEngine << ".params_" << nEvents << ".root"; outputfile << "AliceO2_" << mcEngine << ".trac_" << nEvents << "_event.root"; // Setup timer TStopwatch timer; // Setup FairRoot analysis manager FairRunAna * fRun = new FairRunAna(); FairFileSource *fFileSource = new FairFileSource(inputfile.str().c_str()); fRun->SetSource(fFileSource); fRun->SetOutputFile(outputfile.str().c_str()); // Setup Runtime DB FairRuntimeDb* rtdb = fRun->GetRuntimeDb(); FairParRootFileIo* parInput1 = new FairParRootFileIo(); parInput1->open(paramfile.str().c_str()); rtdb->setFirstInput(parInput1); // Setup tracker // To run with n threads call AliceO2::ITS::CookedTrackerTask(n) AliceO2::ITS::CookedTrackerTask *trac = new AliceO2::ITS::CookedTrackerTask; fRun->AddTask(trac); fRun->Init(); AliceO2::Field::MagneticField* fld = (AliceO2::Field::MagneticField*)fRun->GetField(); if (!fld) { std::cout << "Failed to get field instance from FairRunAna" << std::endl; return; } trac->setBz(fld->solenoidField()); //in kG timer.Start(); fRun->Run(); std::cout << std::endl << std::endl; // Extract the maximal used memory an add is as Dart measurement // This line is filtered by CTest and the value send to CDash FairSystemInfo sysInfo; Float_t maxMemory=sysInfo.GetMaxMemory(); std::cout << "<DartMeasurement name=\"MaxMemory\" type=\"numeric/double\">"; std::cout << maxMemory; std::cout << "</DartMeasurement>" << std::endl; timer.Stop(); Double_t rtime = timer.RealTime(); Double_t ctime = timer.CpuTime(); Float_t cpuUsage=ctime/rtime; cout << "<DartMeasurement name=\"CpuLoad\" type=\"numeric/double\">"; cout << cpuUsage; cout << "</DartMeasurement>" << endl; cout << endl << endl; cout << "Macro finished succesfully." << endl; std::cout << endl << std::endl; std::cout << "Output file is " << outputfile.str() << std::endl; //std::cout << "Parameter file is " << parFile << std::endl; std::cout << "Real time " << rtime << " s, CPU time " << ctime << "s" << endl << endl; }
void run_DiReLo(Int_t nofFiles, TString mcEngine="TGeant3" ) { FairLogger *logger = FairLogger::GetLogger(); // logger->SetLogFileName("MyLog.log"); // logger->SetLogToScreen(kTRUE); // logger->SetLogToFile(kTRUE); logger->SetLogVerbosityLevel("LOW"); // logger->SetLogFileLevel("DEBUG4"); // logger->SetLogScreenLevel("DEBUG"); TString workDir = gSystem->WorkingDirectory(); // Verbosity level (0=quiet, 1=event level, 2=track level, 3=debug) Int_t iVerbose = 0; // just forget about it, for the moment // Input file (MC events) // TString inFile = "data/testrun_"; // inFile = inFile + mcEngine + ".root"; // Parameter file // TString parFile = "data/testparams_"; // parFile = parFile + mcEngine + ".root"; // Output file TString outFile = Form("data/testDiReLo_%df_",nofFiles); outFile = outFile + mcEngine + ".root"; // ----- Timer -------------------------------------------------------- TStopwatch timer; // ----- Reconstruction run ------------------------------------------- FairRunAna *fRun= new FairRunAna(); fRun->SetInputFile(Form("file://%s/data/testrun_%s_f%d.root",workDir.Data(),mcEngine.Data(),0)); for ( Int_t ifile = 1 ; ifile < nofFiles ; ifile++ ) { cout << "fRun->AddFile(....f" << ifile << ".root" << endl; fRun->AddFile (Form("file://%s/data/testrun_%s_f%d.root",workDir.Data(),mcEngine.Data(),ifile)); } fRun->SetOutputFile(outFile); FairRuntimeDb* rtdb = fRun->GetRuntimeDb(); FairParRootFileIo* parInput1 = new FairParRootFileIo(); TList* fnamelist = new TList(); for ( Int_t ifile = 0 ; ifile < nofFiles ; ifile++ ) fnamelist->Add(new TObjString(Form("%s/data/testpar_%s_f%d.root",workDir.Data(),mcEngine.Data(),ifile))); cout << "PAR LIST CREATED" << endl; parInput1->open(fnamelist); // parInput1->open(parFile.Data()); rtdb->setFirstInput(parInput1); FairTestDetectorDigiTask* digiTask = new FairTestDetectorDigiTask(); fRun->AddTask(digiTask); FairTestDetectorRecoTask* hitProducer = new FairTestDetectorRecoTask(); fRun->AddTask(hitProducer); fRun->Init(); timer.Start(); fRun->Run(); // ----- Finish ------------------------------------------------------- cout << endl << endl; // Extract the maximal used memory an add is as Dart measurement // This line is filtered by CTest and the value send to CDash FairSystemInfo sysInfo; Float_t maxMemory=sysInfo.GetMaxMemory(); cout << "<DartMeasurement name=\"MaxMemory\" type=\"numeric/double\">"; cout << maxMemory; cout << "</DartMeasurement>" << endl; timer.Stop(); Double_t rtime = timer.RealTime(); Double_t ctime = timer.CpuTime(); Float_t cpuUsage=ctime/rtime; cout << "<DartMeasurement name=\"CpuLoad\" type=\"numeric/double\">"; cout << cpuUsage; cout << "</DartMeasurement>" << endl; cout << endl << endl; cout << "Output file is " << outFile << endl; cout << "Real time " << rtime << " s, CPU time " << ctime << "s" << endl << endl; cout << "Macro finished successfully." << endl; // ------------------------------------------------------------------------ }
void run_reco( TString mcEngine="TGeant3" ) { FairLogger *logger = FairLogger::GetLogger(); logger->SetLogFileName("MyLog.log"); logger->SetLogToScreen(kTRUE); // logger->SetLogToFile(kTRUE); logger->SetLogVerbosityLevel("LOW"); // logger->SetLogFileLevel("DEBUG4"); logger->SetLogScreenLevel("INFO"); // Verbosity level (0=quiet, 1=event level, 2=track level, 3=debug) Int_t iVerbose = 0; // just forget about it, for the moment // Input file (MC events) TString inFile = "data/testdigi_"; inFile = inFile + mcEngine + ".root"; // Parameter file TString parFile = "data/testparams_"; parFile = parFile + mcEngine + ".root"; // Output file TString outFile = "data/testreco_"; outFile = outFile + mcEngine + ".root"; // ----- Timer -------------------------------------------------------- TStopwatch timer; // ----- Reconstruction run ------------------------------------------- FairRunAna *fRun= new FairRunAna(); fRun->SetInputFile(inFile); fRun->SetOutputFile(outFile); FairRuntimeDb* rtdb = fRun->GetRuntimeDb(); FairParRootFileIo* parInput1 = new FairParRootFileIo(); parInput1->open(parFile.Data()); rtdb->setFirstInput(parInput1); // ----- TorinoDetector hit producers --------------------------------- FairTestDetectorRecoTask* hitProducer = new FairTestDetectorRecoTask(); fRun->AddTask(hitProducer); fRun->Init(); timer.Start(); fRun->Run(); // ----- Finish ------------------------------------------------------- timer.Stop(); Double_t rtime = timer.RealTime(); Double_t ctime = timer.CpuTime(); cout << endl << endl; cout << "Macro finished successfully." << 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; // ------------------------------------------------------------------------ cout << " Test passed" << endl; cout << " All ok " << endl; exit(0); }
/******************************************************************************** * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence version 3 (LGPL) version 3, * * copied verbatim in the file "LICENSE" * ********************************************************************************/ void run_reco_timebased( TString mcEngine="TGeant3" ) { FairLogger *logger = FairLogger::GetLogger(); logger->SetLogFileName("MyLog.log"); // logger->SetLogToScreen(kTRUE); // logger->SetLogToFile(kTRUE); // logger->SetLogVerbosityLevel("HIGH"); // logger->SetLogFileLevel("DEBUG4"); // logger->SetLogScreenLevel("DEBUG"); // Verbosity level (0=quiet, 1=event level, 2=track level, 3=debug) Int_t iVerbose = 0; // just forget about it, for the moment // Input file (MC events) TString inFile = "data/testdigitimebased_"; inFile = inFile + mcEngine + ".root"; // Parameter file TString parFile = "data/testparams_"; parFile = parFile + mcEngine + ".root"; // Output file TString outFile = "data/testrecotimebased_"; outFile = outFile + mcEngine + ".root"; // ----- Timer -------------------------------------------------------- TStopwatch timer; // ----- Reconstruction run ------------------------------------------- FairRunAna *fRun= new FairRunAna(); fRun->SetInputFile(inFile); fRun->SetOutputFile(outFile); fRun->RunWithTimeStamps(); fRun->SetUseFairLinks(kTRUE); FairRuntimeDb* rtdb = fRun->GetRuntimeDb(); FairParRootFileIo* parInput1 = new FairParRootFileIo(); parInput1->open(parFile.Data()); rtdb->setFirstInput(parInput1); // ----- TorinoDetector hit producers --------------------------------- FairTestDetectorTimeRecoTask* hitProducer = new FairTestDetectorTimeRecoTask(); fRun->AddTask(hitProducer); fRun->Init(); timer.Start(); fRun->Run(); // ----- Finish ------------------------------------------------------- cout << endl << endl; // Extract the maximal used memory an add is as Dart measurement // This line is filtered by CTest and the value send to CDash FairSystemInfo sysInfo; Float_t maxMemory=sysInfo.GetMaxMemory(); cout << "<DartMeasurement name=\"MaxMemory\" type=\"numeric/double\">"; cout << maxMemory; cout << "</DartMeasurement>" << endl; timer.Stop(); Double_t rtime = timer.RealTime(); Double_t ctime = timer.CpuTime(); Float_t cpuUsage=ctime/rtime; cout << "<DartMeasurement name=\"CpuLoad\" type=\"numeric/double\">"; cout << cpuUsage; cout << "</DartMeasurement>" << endl; cout << endl << endl; cout << "Output file is " << outFile << endl; cout << "Parameter file is " << parFile << endl; cout << "Real time " << rtime << " s, CPU time " << ctime << "s" << endl << endl; cout << "Macro finished successfully." << endl; // ------------------------------------------------------------------------ }
void run_digi_tpc(Int_t nEvents = 10, TString mcEngine = "TGeant3"){ // Initialize logger FairLogger *logger = FairLogger::GetLogger(); logger->SetLogVerbosityLevel("LOW"); logger->SetLogScreenLevel("INFO"); // Input and output file name std::stringstream inputfile, outputfile, paramfile; inputfile << "AliceO2_" << mcEngine << ".tpc.mc_" << nEvents << "_event.root"; paramfile << "AliceO2_" << mcEngine << ".tpc.params_" << nEvents << ".root"; outputfile << "AliceO2_" << mcEngine << ".tpc.digi_" << nEvents << "_event.root"; // Setup timer TStopwatch timer; // Setup FairRoot analysis manager FairRunAna * fRun = new FairRunAna(); FairFileSource *fFileSource = new FairFileSource(inputfile.str().c_str()); fRun->SetSource(fFileSource); fRun->SetOutputFile(outputfile.str().c_str()); // Setup Runtime DB FairRuntimeDb* rtdb = fRun->GetRuntimeDb(); FairParRootFileIo* parInput1 = new FairParRootFileIo(); parInput1->open(paramfile.str().c_str()); rtdb->setFirstInput(parInput1); // TGeoManager::Import("geofile_full.root"); // Setup digitizer AliceO2::ITS::DigitizerTask *digi = new AliceO2::ITS::DigitizerTask; fRun->AddTask(digi); AliceO2::TPC::DigitizerTask *digiTPC = new AliceO2::TPC::DigitizerTask; fRun->AddTask(digiTPC); fRun->Init(); timer.Start(); fRun->Run(); std::cout << std::endl << std::endl; // Extract the maximal used memory an add is as Dart measurement // This line is filtered by CTest and the value send to CDash FairSystemInfo sysInfo; Float_t maxMemory=sysInfo.GetMaxMemory(); std::cout << "<DartMeasurement name=\"MaxMemory\" type=\"numeric/double\">"; std::cout << maxMemory; std::cout << "</DartMeasurement>" << std::endl; timer.Stop(); Double_t rtime = timer.RealTime(); Double_t ctime = timer.CpuTime(); Float_t cpuUsage=ctime/rtime; cout << "<DartMeasurement name=\"CpuLoad\" type=\"numeric/double\">"; cout << cpuUsage; cout << "</DartMeasurement>" << endl; cout << endl << endl; std::cout << "Macro finished succesfully." << std::endl; std::cout << endl << std::endl; std::cout << "Output file is " << outputfile.str() << std::endl; //std::cout << "Parameter file is " << parFile << std::endl; std::cout << "Real time " << rtime << " s, CPU time " << ctime << "s" << endl << endl; }
/******************************************************************************** * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * * copied verbatim in the file "LICENSE" * ********************************************************************************/ void run_reco( TString mcEngine="TGeant3", Bool_t AlignDone=true ) { // ---- Load libraries ------------------------------------------------- FairLogger *logger = FairLogger::GetLogger(); // logger->SetLogFileName("MyLog.log"); logger->SetLogToScreen(kTRUE); // logger->SetLogToFile(kTRUE); // logger->SetLogVerbosityLevel("HIGH"); // logger->SetLogFileLevel("DEBUG4"); logger->SetLogScreenLevel("INFO"); // Verbosity level (0=quiet, 1=event level, 2=track level, 3=debug) Int_t iVerbose = 0; // just forget about it, for the moment TString Align= ""; if (AlignDone) { Align= "align_"; } TString InDir = "./data/"; // Input file (MC Events) TString inFile ="testrun_"; inFile = InDir +inFile + Align + mcEngine + ".root"; // Output file name TString outFile ="testreco_"; outFile = InDir + outFile + Align + mcEngine + ".root"; // Parameter file TString parFile ="testparams_"; parFile = InDir + parFile + Align + mcEngine + ".root"; // Millepede file name TString milleFile ="testmille_"; milleFile = InDir + milleFile + Align + mcEngine; TList *parFileList = new TList(); TString workDir = gSystem->Getenv("VMCWORKDIR"); TString paramDir = workDir + "/simulation/Tutorial4/parameters/"; TString paramFile = paramDir + "example.par"; TObjString tutDetDigiFile; tutDetDigiFile.SetString(paramFile); parFileList->Add(&tutDetDigiFile); // ----- Timer -------------------------------------------------------- TStopwatch timer; // ----- Reconstruction run ------------------------------------------- FairRunAna *fRun= new FairRunAna(); FairFileSource *fFileSource = new FairFileSource(inFile); fRun->SetSource(fFileSource); fRun->SetSink(new FairRootFileSink(outFile)); FairRuntimeDb* rtdb = fRun->GetRuntimeDb(); FairParRootFileIo* parInput1 = new FairParRootFileIo(); FairParAsciiFileIo* parIo2 = new FairParAsciiFileIo(); parIo2->open(parFileList, "in"); parInput1->open(parFile.Data()); parIo2->open(parFileList, "in"); rtdb->setFirstInput(parInput1); rtdb->setSecondInput(parIo2); rtdb->setOutput(parInput1); rtdb->saveOutput(); // ----- TorinoDetector hit producers --------------------------------- FairTutorialDet4HitProducerIdealMisalign* hitProducer = new FairTutorialDet4HitProducerIdealMisalign(); hitProducer->DoMisalignment(kFALSE); fRun->AddTask(hitProducer); FairTutorialDet4StraightLineFitter* fitter = new FairTutorialDet4StraightLineFitter(); fitter->SetVersion(2); fRun->AddTask(fitter); FairTutorialDet4MilleWriter* writer = new FairTutorialDet4MilleWriter(); // writer->SetWriteAscii(kTRUE); writer->SetVersion(2); writer->SetFileName(milleFile); fRun->AddTask(writer); fRun->Init(); timer.Start(); fRun->Run(); // ----- Finish ------------------------------------------------------- cout << endl << endl; // Extract the maximal used memory an add is as Dart measurement // This line is filtered by CTest and the value send to CDash FairSystemInfo sysInfo; Float_t maxMemory=sysInfo.GetMaxMemory(); cout << "<DartMeasurement name=\"MaxMemory\" type=\"numeric/double\">"; cout << maxMemory; cout << "</DartMeasurement>" << endl; timer.Stop(); Double_t rtime = timer.RealTime(); Double_t ctime = timer.CpuTime(); Float_t cpuUsage=ctime/rtime; cout << "<DartMeasurement name=\"CpuLoad\" type=\"numeric/double\">"; cout << cpuUsage; cout << "</DartMeasurement>" << endl; cout << endl << endl; cout << "Output file is " << outFile << endl; cout << "Parameter file is " << parFile << endl; cout << "Real time " << rtime << " s, CPU time " << ctime << "s" << endl << endl; cout << "Macro finished successfully." << endl; // ------------------------------------------------------------------------ }
void makeDummy(const Int_t nEvents = 10) { gRandom -> SetSeed(time(0)); //TString dir = gSystem->Getenv("SPIRITDIR"); //TString geomdir = dir + "/geometry"; //gSystem->Setenv("GEOMPATH", geomdir.Data()); FairLogger *logger = FairLogger::GetLogger(); logger->SetLogToScreen(kTRUE); logger->SetLogVerbosityLevel("MEDIUM"); TString outFile = "mc.dummy.root"; TString parFile = "param.dummy.root"; // ----- Create simulation run ---------------------------------------- // FairRunSim* run = new FairRunSim(); run->SetName("TGeant4"); // Transport engine run->SetOutputFile(outFile); // Output file run->SetWriteRunInfoFile(kFALSE); FairRuntimeDb* rtdb = run->GetRuntimeDb(); ATVertexPropagator* vertex_prop = new ATVertexPropagator(); // ------------------------------------------------------------------------ // ----- Create geometry ---------------------------------------------- /*FairModule* cave= new FairCave("CAVE"); cave->SetGeometryFileName("cave_vacuum.geo"); run->AddModule(cave); FairModule* target= new FairTarget("SnTarget"); target->SetGeometryFileName("target.geo"); run->AddModule(target); FairDetector* spirit = new STDetector("STDetector", kTRUE); spirit->SetGeometryFileName("spirit_v03.1.root"); run->AddModule(spirit);*/ FairModule* cave= new AtCave("CAVE"); cave->SetGeometryFileName("cave.geo"); run->AddModule(cave); FairModule* magnet = new AtMagnet("Magnet"); run->AddModule(magnet); FairModule* pipe = new AtPipe("Pipe"); run->AddModule(pipe); FairDetector* ATTPC = new AtTpc("ATTPC", kTRUE); ATTPC->SetGeometryFileName("ATTPC_v1.1.root"); //ATTPC->SetModifyGeometry(kTRUE); run->AddModule(ATTPC); // ------------------------------------------------------------------------ run->SetMaterials("media.geo"); // ----- Create PrimaryGenerator -------------------------------------- FairPrimaryGenerator *primGen = new FairPrimaryGenerator(); FairParticleGenerator *particleGen = new FairParticleGenerator(2112, 1, 0, 0, 0, 0, 0, 0); primGen->AddGenerator(particleGen); run->SetGenerator(primGen); /* Int_t dnum=7; const int gennum=pid[dnum].size(); cout << gennum << endl; FairParticleGenerator *fIongen[gennum]; for (Int_t i=0; i<gennum; i++) { fIongen[i] = new FairParticleGenerator(pid[dnum][i],1,pxl[dnum][i],pyl[dnum][i],pzl[dnum][i],0.0,-21.33,-3.52); //cout << pid[dnum][i] << "\t" << pxl[dnum][i] << "\t" << pyl[dnum][i] << "\t" << pzl[dnum][i] << "\t" << kinl[dnum][i] << endl; primGen->AddGenerator(fIongen[i]); } //primGen->AddTrack(pdg,pionpC[0][i],pionpC[1][i],pionpC[2][i],pionrC[0][i]*1.0E-13,pionrC[1][i]*1.0E-13-21.33,pionrC[2][i]*1.0E-13-3.52); //fIongen[i] = new FairParticleGenerator(pdg,1,pionpC[0][i],pionpC[1][i],pionpC[2][i],pionrC[0][i]*1.0E-13,pionrC[1][i]*1.0E-13-21.33,pionrC[2][i]*1.0E-13-3.52); //fIongen[i] = new FairParticleGenerator(pdg,1,px,py,pz,0.0,-21.33,-3.52); //primGen->AddGenerator(fIongen[i]); //primGen->AddTrack(pdg,pionpC[0][i],pionpC[1][i],pionpC[2][i],pionrC[0][i]*1.0E-13,pionrC[1][i]*1.0E-13-21.33,pionrC[2][i]*1.0E-13-3.52); //} //} // if (partt==0) FairBoxGenerator* boxGen1 = new FairBoxGenerator(2212, 1); // if (partt==1) FairBoxGenerator* boxGen1 = new FairBoxGenerator(1000010020, 1); // if (partt==2) FairBoxGenerator* boxGen1 = new FairBoxGenerator(1000010030, 1); // if (partt==3) FairBoxGenerator* boxGen1 = new FairBoxGenerator(1000020030, 1); // if (partt==4) FairBoxGenerator* boxGen1 = new FairBoxGenerator(1000020040, 1); // if (partt==5) FairBoxGenerator* boxGen1 = new FairBoxGenerator(211, 1); // if (partt==6) FairBoxGenerator* boxGen1 = new FairBoxGenerator(-211, 1); // if (partt==7) FairBoxGenerator* boxGen1 = new FairBoxGenerator(11, 1); // if (partt==8) FairBoxGenerator* boxGen1 = new FairBoxGenerator(-11, 1); // //FairBoxGenerator* boxGen1 = new FairBoxGenerator(1000020040, 1); // boxGen1->SetPRange(0.25,0.5); //GeV/c ?? // boxGen1->SetPhiRange(0.,360.); //degrees // boxGen1->SetThetaRange(0.,90.); //degrees // boxGen1->SetXYZ(0.,-21.33, -3.52); // cm // primGen->AddGenerator(boxGen1); // ------------------------------------------------------------------------ run->SetStoreTraj(kTRUE); */ // ----- Run initialisation ------------------------------------------- run->Init(); // ------------------------------------------------------------------------ // ----- Runtime database --------------------------------------------- Bool_t kParameterMerged = kTRUE; FairParRootFileIo* parOut = new FairParRootFileIo(kParameterMerged); parOut->open(parFile.Data()); rtdb->setOutput(parOut); rtdb->saveOutput(); // ------------------------------------------------------------------------ // ----- Start run ---------------------------------------------------- run->Run(nEvents); // ----- Finish ------------------------------------------------------- }
void run_rad(Int_t nEvents = 100, TString mcEngine="TGeant3") { TString dir = gSystem->Getenv("VMCWORKDIR"); TString tutdir = dir + "/rutherford/macros"; TString tut_geomdir = dir + "/geometry"; gSystem->Setenv("GEOMPATH",tut_geomdir.Data()); TString tut_configdir = dir + "/gconfig"; gSystem->Setenv("CONFIG_DIR",tut_configdir.Data()); TString outDir = "data"; TString outFile = outDir + "/test1_"; outFile = outFile + mcEngine + ".mc.root"; TString parFile = outDir + "/params1_"; parFile = parFile + mcEngine + ".root"; // In general, the following parts need not be touched // ======================================================================== // ---- Debug option ------------------------------------------------- gDebug = 0; // ------------------------------------------------------------------------ // ----- Timer -------------------------------------------------------- TStopwatch timer; timer.Start(); // ------------------------------------------------------------------------ FairLogger *logger = FairLogger::GetLogger(); // define log file name logger->SetLogFileName("MyLog.log"); // log to screen and to file logger->SetLogToScreen(kTRUE); logger->SetLogToFile(kTRUE); // Print very accurate output. Levels are LOW, MEDIUM and HIGH logger->SetLogVerbosityLevel("HIGH"); // ----- Create simulation run ---------------------------------------- FairRunSim* run = new FairRunSim(); run->SetName(mcEngine); // Transport engine run->SetOutputFile(outFile); // Output file FairRuntimeDb* rtdb = run->GetRuntimeDb(); // ------------------------------------------------------------------------ // ----- Create media ------------------------------------------------- run->SetMaterials("media.geo"); // Materials // ------------------------------------------------------------------------ //----Start the radiation length manager ---------------------------------- run->SetRadLenRegister(kTRUE); // ----- Create geometry ---------------------------------------------- FairModule* cave= new FairCave("CAVE"); cave->SetGeometryFileName("cave_vacuum.geo"); run->AddModule(cave); FairModule* target= new FairTarget("Target"); target->SetGeometryFileName("target_rutherford.geo"); run->AddModule(target); FairDetector* rutherford = new FairRutherford("RutherfordDetector", kFALSE); rutherford->SetGeometryFileName("rutherford.geo"); run->AddModule(rutherford); // ------------------------------------------------------------------------ // ----- Create PrimaryGenerator -------------------------------------- FairPrimaryGenerator* primGen = new FairPrimaryGenerator(); run->SetGenerator(primGen); FairBoxGenerator* boxGen1 = new FairBoxGenerator(0, 1); boxGen1->SetPRange(.005,.005); boxGen1->SetPhiRange(0.,0.); boxGen1->SetThetaRange(-90.,90.); boxGen1->SetXYZ(0.,0.,-3.); primGen->AddGenerator(boxGen1); // ------------------------------------------------------------------------ run->SetStoreTraj(kTRUE); // ----- Run initialisation ------------------------------------------- run->Init(); // ------------------------------------------------------------------------ // Set cuts for storing the trajectories. // Switch this on only if trajectories are stored. // Choose this cuts according to your needs, but be aware // that the file size of the output file depends on these cuts FairTrajFilter* trajFilter = FairTrajFilter::Instance(); // trajFilter->SetStepSizeCut(0.01); // 1 cm // trajFilter->SetVertexCut(-2000., -2000., 4., 2000., 2000., 100.); // trajFilter->SetMomentumCutP(10e-3); // p_lab > 10 MeV // trajFilter->SetEnergyCut(0., 1.02); // 0 < Etot < 1.04 GeV trajFilter->SetStorePrimaries(kTRUE); trajFilter->SetStoreSecondaries(kTRUE); // ------------------------------------------------------------------------ // ----- Runtime database --------------------------------------------- Bool_t kParameterMerged = kTRUE; FairParRootFileIo* parOut = new FairParRootFileIo(kParameterMerged); parOut->open(parFile.Data()); rtdb->setOutput(parOut); rtdb->saveOutput(); rtdb->print(); // ------------------------------------------------------------------------ // ----- Start run ---------------------------------------------------- run->Run(nEvents); // ------------------------------------------------------------------------ run->CreateGeometryFile("data/geofile_full.root"); // ----- Finish ------------------------------------------------------- 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 << endl; // ------------------------------------------------------------------------ }