Skip to content
Snippets Groups Projects
Commit 11baa4ee authored by Eoin Clerkin's avatar Eoin Clerkin
Browse files

Provides tof_v21d_mcbm.digi

Digi generated from attached macros.
parent 2853fe5b
No related branches found
No related tags found
1 merge request!127provides tof_v21d digi file
/* Copyright (C) 2013-2017 Facility for Antiproton and Ion Research in Europe, Darmstadt
SPDX-License-Identifier: GPL-3.0-only
Authors: Florian Uhlig, Pierre-Alain Loizeau [committer] */
// --------------------------------------------------------------------------
//
// Macro to create digi parameters for the TOF
//
// The way how the pad layout looks like has to be
// implemented in a task called in this macro.
// CbmTofCreateDigiPar is the implementation used
// here.
//
// F.Uhlig 07.05.2010
//
// --------------------------------------------------------------------------
void create_digipar(TString fileName = "tof_v16a_1e", Int_t nEvents = 0)
{
cout << "fileName: " << fileName << endl;
// ========================================================================
// Adjust this part according to your requirements
// Verbosity level (0=quiet, 1=event level, 2=track level, 3=debug)
Int_t iVerbose = 0;
// Input file (MC events)
TString inFile = "auaumbias." + fileName + ".mc.root";
// Geometry File
TString geoFile = "geofile_" + fileName + ".root";
// Output file
TString outFile = "test.esd." + fileName + ".root";
// Digi Parameter Output File
// TString digiFile = fileName + ".digi.par.long";
TString digiFile = fileName + ".digi.par";
// In general, the following parts need not be touched
// ========================================================================
// ---- Debug option -------------------------------------------------
gDebug = 0;
// ------------------------------------------------------------------------
// ----- Timer --------------------------------------------------------
TStopwatch timer;
timer.Start();
// ------------------------------------------------------------------------
// ----- Reconstruction run -------------------------------------------
FairRunAna* run = new FairRunAna();
run->SetOutputFile(outFile);
run->SetGeomFile(geoFile);
FairFileSource* inFileSource = new FairFileSource(inFile);
// run->SetInputFile(inFile);
run->SetSource(inFileSource);
FairLogger::GetLogger()->SetLogScreenLevel("INFO");
// FairLogger::GetLogger()->SetLogScreenLevel("DEBUG2");
// ------------------------------------------------------------------------
FairRuntimeDb* rtdb = run->GetRuntimeDb();
FairParAsciiFileIo* parIo2 = new FairParAsciiFileIo();
parIo2->open(digiFile, "out");
rtdb->setOutput(parIo2);
CbmTofCreateDigiPar* tofDigiProducer = new CbmTofCreateDigiPar("TOF Digi Producer", "TOF task");
run->AddTask(tofDigiProducer);
// -------------------------------------------------------------------------
rtdb->saveOutput();
// ----- Intialise and run --------------------------------------------
// run->LoadGeometry();
run->Init();
rtdb->print();
CbmTofDigiPar* DigiPar = (CbmTofDigiPar*) rtdb->getContainer("CbmTofDigiPar");
DigiPar->setChanged();
DigiPar->setInputVersion(run->GetRunId(), 1);
rtdb->print();
rtdb->saveOutput();
// ----- 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 << "Real time " << rtime << " s, CPU time " << ctime << " s" << endl;
cout << endl;
// ------------------------------------------------------------------------
cout << " Test passed" << endl;
cout << " All ok " << endl;
exit(0);
}
/* Copyright (C) 2013-2020 Facility for Antiproton and Ion Research in Europe, Darmstadt
SPDX-License-Identifier: GPL-3.0-only
Authors: Pierre-Alain Loizeau [committer] */
// --------------------------------------------------------------------------
//
// Macro for standard transport simulation using UrQMD input and GEANT3
// Standard CBM setup with MVD, STS, RICH, TRD, TOF and ECAL
//
// V. Friese 22/02/2007
// processing more than 1 input file does not work. - nh
//
// --------------------------------------------------------------------------
void make_geofile(TString stofGeom = "tof_v16a_1e")
{
Int_t nEvents = 1;
// ========================================================================
// Adjust this part according to your requirements
// ----- Paths and file names --------------------------------------------
TString inDir = gSystem->Getenv("VMCWORKDIR");
TString inFile = inDir + "/input/urqmd.ftn14";
TString outDir = ".";
TString outFile = outDir + "/auaumbias." + stofGeom + ".mc.root";
TString parFile = outDir + "/auaumbias." + stofGeom + ".params.root";
// configuration
TString tut_configdir = inDir + "/sim/transport/gconfig";
gSystem->Setenv("CONFIG_DIR", tut_configdir.Data());
// ----- Geometries -----------------------------------------------------
TString caveGeom = "cave.geo";
//TString targetGeom = "target_au_250mu.geo";
//TString pipeGeom = "pipe_standard.geo";
TString targetGeom = "";
TString pipeGeom = "";
TString magnetGeom = "";
TString stsGeom = "";
// TString tofGeom = "tof/tof_V13-2b.geo";
TString tofGeom = "tof/" + stofGeom + ".geo.root";
// ----- Magnetic field -----------------------------------------------
TString fieldMap = "field_v18a"; // name of field map
Double_t fieldZ = 0.; // field centre z position
Double_t fieldScale = 1.0; // field scaling factor
// In general, the following parts need not be touched
// ========================================================================
// ---- Debug option -------------------------------------------------
gDebug = 0;
// ------------------------------------------------------------------------
// ----- Timer --------------------------------------------------------
TStopwatch timer;
timer.Start();
// ------------------------------------------------------------------------
// gLogger->SetLogScreenLevel("DEBUG2");
// ----- Create simulation run ----------------------------------------
FairRunSim* fRun = new FairRunSim();
fRun->SetName("TGeant3"); // Transport engine
//fRun->SetTrackingDebugMode(kTRUE); // Geant3 debug output can be set in ./gconfig/g3Config.C
fRun->SetOutputFile(outFile); // Output file
FairRuntimeDb* rtdb = fRun->GetRuntimeDb();
// ------------------------------------------------------------------------
// ----- Create media -------------------------------------------------
fRun->SetMaterials("media.geo"); // Materials
// ------------------------------------------------------------------------
// ----- Create detectors and passive volumes -------------------------
if (caveGeom != "") {
FairModule* cave = new CbmCave("CAVE");
cave->SetGeometryFileName(caveGeom);
fRun->AddModule(cave);
}
if (pipeGeom != "") {
FairModule* pipe = new CbmPipe("PIPE");
pipe->SetGeometryFileName(pipeGeom);
fRun->AddModule(pipe);
}
if (targetGeom != "") {
FairModule* target = new CbmTarget("Target");
target->SetGeometryFileName(targetGeom);
fRun->AddModule(target);
}
if (magnetGeom != "") {
FairModule* magnet = new CbmMagnet("MAGNET");
magnet->SetGeometryFileName(magnetGeom);
fRun->AddModule(magnet);
}
if (stsGeom != "") {
FairDetector* sts = new CbmStsMC(kTRUE);
sts->SetGeometryFileName(stsGeom);
fRun->AddModule(sts);
}
if (tofGeom != "") {
FairDetector* tof = new CbmTof("TOF", kTRUE);
tof->SetGeometryFileName(tofGeom);
fRun->AddModule(tof);
}
// ------------------------------------------------------------------------
// ----- Create magnetic field ----------------------------------------
/*
CbmFieldMap* magField = new CbmFieldMapSym3(fieldMap);
magField->SetPosition(0., 0., fieldZ);
magField->SetScale(fieldScale);
fRun->SetField(magField);
*/
// ------------------------------------------------------------------------
// Use the experiment specific MC Event header instead of the default one
// This one stores additional information about the reaction plane
// => OBSOLETE, therefore removed
// CbmMCEventHeader* mcHeader = new CbmMCEventHeader();
// fRun->SetMCEventHeader(mcHeader);
FairPrimaryGenerator* primGen = new FairPrimaryGenerator();
// Ion Generator
// FairIonGenerator *fIongen= new FairIonGenerator(79, 197,79,1, 0.,0., 25, 0.,0.,-1.);
// FairParticleGenerator *fPartGen= new FairParticleGenerator(2212, 1.,0.,5., 25., 0.,0.,0.);
//primGen->AddGenerator(fPartGen);
// Use the CbmUrqmdGenrator which calculates a reaction plane and
// rotate all particles accordingly
if (1) {
FairUrqmdGenerator* urqmdGen = new FairUrqmdGenerator(inFile);
primGen->SetEventPlane(-TMath::Pi(), TMath::Pi());
//(CbmUrqmdGenerator *)urqmdGen->SetVertex(0.,0.,20.); // test shifted vertex
//urqmdGen->SetEventPlane(-180., 180.);
primGen->AddGenerator(urqmdGen);
primGen->SetTarget(0., 0.025);
fRun->SetGenerator(primGen);
}
// -Trajectories Visualization (TGeoManager only )
// Switch this on if you want to visualize tracks in the
// eventdisplay.
// This is normally switch off, because of the huge files created
// when it is switched on.
// fRun->SetStoreTraj(kTRUE);
// ----- Run initialisation -------------------------------------------
fRun->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 ---------------------------------------------
/*
CbmFieldPar* fieldPar = (CbmFieldPar*) rtdb->getContainer("CbmFieldPar");
fieldPar->SetParameters(magField);
fieldPar->setChanged();
fieldPar->setInputVersion(fRun->GetRunId(),1);
*/
Bool_t kParameterMerged = kTRUE;
FairParRootFileIo* parOut = new FairParRootFileIo(kParameterMerged);
parOut->open(parFile.Data());
rtdb->setOutput(parOut);
rtdb->saveOutput();
rtdb->print();
// ------------------------------------------------------------------------
// ----- Start run ----------------------------------------------------
fRun->Run(nEvents);
// ------------------------------------------------------------------------
fRun->CreateGeometryFile("./geofile_" + stofGeom + ".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;
// ------------------------------------------------------------------------
cout << " Test passed" << endl;
cout << " All ok " << endl;
}
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment