Skip to content
Snippets Groups Projects
Commit 3840aac4 authored by Eoin Clerkin's avatar Eoin Clerkin Committed by Florian Uhlig
Browse files

Handle more than one beampipe

Modifies registerSetup to handle more than one beampipe. Changes to
allow mvd_sim macro to execute normally.
parent 696d693c
No related branches found
No related tags found
1 merge request!1113Geometry and parameter hash update
......@@ -11,6 +11,9 @@
// updated P.Sitzmann 22/11/2016
// --------------------------------------------------------------------------
#include "../../sim/transport/gconfig/g3Config.C"
void mvd_sim(Int_t nEvents = 100, TString setup = "sis100_electron")
{
// ========================================================================
......@@ -20,7 +23,6 @@ void mvd_sim(Int_t nEvents = 100, TString setup = "sis100_electron")
TString inDir = gSystem->Getenv("VMCWORKDIR");
TString inFile = "";
// Output file name
TString outDir = "data/";
TString outFile = outDir + "mvd.mc.root";
......@@ -36,11 +38,11 @@ void mvd_sim(Int_t nEvents = 100, TString setup = "sis100_electron")
gROOT->LoadMacro(setupFile);
gInterpreter->ProcessLine(setupFunct);
CbmSetup* cbmsetup = CbmSetup::Instance();
cbmsetup->RemoveModule(kSTS);
cbmsetup->RemoveModule(kRICH);
cbmsetup->RemoveModule(kTRD);
cbmsetup->RemoveModule(kTOF);
cbmsetup->RemoveModule(kPSD);
cbmsetup->RemoveModule(ECbmModuleId::kSts);
cbmsetup->RemoveModule(ECbmModuleId::kRich);
cbmsetup->RemoveModule(ECbmModuleId::kTrd);
cbmsetup->RemoveModule(ECbmModuleId::kTof);
cbmsetup->RemoveModule(ECbmModuleId::kPsd);
// In general, the following parts need not be touched
// ========================================================================
......@@ -127,7 +129,7 @@ void mvd_sim(Int_t nEvents = 100, TString setup = "sis100_electron")
CbmTarget* target = new CbmTarget(targetElement.Data(), targetThickness, targetDiameter);
target->SetPosition(targetPosX, targetPosY, targetPosZ);
target->SetRotation(targetRotY);
target->Print();
std::cout << "Register and Create: " << target->GetName() << std::endl;
fRun->AddModule(target);
// ------------------------------------------------------------------------
......@@ -156,15 +158,13 @@ void mvd_sim(Int_t nEvents = 100, TString setup = "sis100_electron")
// --- Uniform distribution of event plane angle
primGen->SetEventPlane(0., 2. * TMath::Pi());
// --- Get target parameters
Double_t tX = 0.;
Double_t tY = 0.;
Double_t tZ = 0.;
TVector3 tXYZ(0, 0, -44.0);
Double_t tDz = 0.;
if (target) {
target->GetPosition(tX, tY, tZ);
tXYZ = target->GetPosition();
tDz = target->GetThickness();
}
primGen->SetTarget(tZ, tDz);
primGen->SetTarget(tXYZ[2], tDz);
primGen->SetBeam(0., 0., beamWidthX, beamWidthY);
primGen->SmearGausVertexXY(smearVertexXY);
primGen->SmearVertexZ(smearVertexZ);
......
......@@ -11,7 +11,6 @@
** @date 5 February 2016
**/
void registerSetup()
{
......@@ -48,11 +47,28 @@ void registerSetup()
// --- Register beam pipe
if (setup->GetGeoFileName(ECbmModuleId::kPipe, fileName)) {
setup->GetGeoTag(ECbmModuleId::kPipe, geoTag);
std::cout << "-I- registerSetup: Registering PIPE " << geoTag << " using " << fileName << std::endl;
FairModule* pipe = new CbmPipe("PIPE");
pipe->SetGeometryFileName(fileName.Data());
run->AddModule(pipe);
// handle more than 1 beampipe;
FairModule* pipe;
int pipe_counter = 0;
char *file, *ptr;
file = (char*) malloc(500 * sizeof(char));
strncpy(file, fileName.Data(), 500);
do {
ptr = strchr(file, ':');
pipe = new CbmPipe();
if (ptr) *ptr = '\0';
pipe->SetGeometryFileName(file);
std::cout << "Beampipe " << pipe_counter << " is " << file << std::endl;
pipe->SetTitle(("pipe" + std::to_string(pipe_counter)).c_str());
run->AddModule(pipe);
pipe_counter++;
file = (ptr + 1);
} while (ptr);
}
// --- Register other modules
......
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