Skip to content

Commit

Permalink
Possibility to set vertex positions from the outside (#337)
Browse files Browse the repository at this point in the history
* Possibility to set vertex positions from the outside

* Additional options to set the vertex from command arguments

* Updated format for argument
  • Loading branch information
fprino authored and gconesab committed Jan 24, 2020
1 parent 0742bb4 commit b01104c
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 11 deletions.
65 changes: 55 additions & 10 deletions MC/GeneratorConfig.C
Original file line number Diff line number Diff line change
Expand Up @@ -417,25 +417,70 @@ void GeneratorConfig(Int_t tag)
}
printf(">>>>> Diamond sigma-xy: %f \n", sigmaxy);

gen->SetOrigin(0., 0., 0.);

if(gSystem->Getenv("CONFIG_SIMULATION")){
if(strcmp(gSystem->Getenv("CONFIG_SIMULATION"), "GeneratorOnly") == 0){
Printf("Generator only simulation => ideal vertex at (0,0,0)");
Bool_t customDiam=kFALSE;
if(gSystem->Getenv("CONFIG_GENVERT")){
if(strcmp(gSystem->Getenv("CONFIG_GENVERT"), "VertexFromConfig") == 0){
Printf("Simulation with vertex position and sigma from Config file");
Float_t vx,vy,vz;
gen->GetOrigin(vx,vy,vz);
Printf(" <xv>=%.3f <yv>=%.3f <zv>=%.3f cm",vx,vy,vz);
customDiam=kTRUE;
}
else if(strcmp(gSystem->Getenv("CONFIG_GENVERT"), "NominalVertex") == 0){
Printf("Simulation with vertex fixed in (0,0,0)");
gen->SetOrigin(0., 0., 0.);
gen->SetSigma(0.,0.,0.);
gen->SetVertexSmear(kNoSmear);
customDiam=kTRUE;
}
else if(strstr(gSystem->Getenv("CONFIG_GENVERT"), "FixedIn") != 0){
Float_t vx,vy,vz;
Int_t ncoord=sscanf(gSystem->Getenv("CONFIG_GENVERT"),"FixedIn-%f_%f_%f-",&vx,&vy,&vz);
if(ncoord==3){
Printf("Simulation with vertex position fixed from command argument");
Printf(" xv=%.3f yv=%.3f zv=%.3f cm",vx,vy,vz);
gen->SetOrigin(vx,vy,vz);
gen->SetSigma(0.,0.,0.);
gen->SetVertexSmear(kNoSmear);
customDiam=kTRUE;
}else{
Printf("Failed to extract vertex position from command argument --genvert %s",gSystem->Getenv("CONFIG_GENVERT"));
}
}
else if(strstr(gSystem->Getenv("CONFIG_GENVERT"), "Gauss") != 0){
Float_t vx,vy,vz,sx,sy,sz;
Int_t ncoord=sscanf(gSystem->Getenv("CONFIG_GENVERT"),"GaussMean-%f_%f_%f-Sigma-%f_%f_%f-",&vx,&vy,&vz,&sx,&sy,&sz);
if(ncoord==6){
Printf("Simulation with gaussian vertex from command argument");
Printf(" <xv>=%.3f <yv>=%.3f <zv>=%.3f cm --- sigmax=%.3f sigmay=%.3f sigmaz=%.3f cm",vx,vy,vz,sx,sy,sz);
gen->SetOrigin(vx,vy,vz);
gen->SetSigma(sx,sy,sz);
gen->SetVertexSmear(kPerEvent);
customDiam=kTRUE;
}else{
Printf("Failed to extract vertex mean and sigma from command argument --genvert %s",gSystem->Getenv("CONFIG_GENVERT"));
}
}
}
if(!customDiam){
gen->SetOrigin(0., 0., 0.);
if(gSystem->Getenv("CONFIG_SIMULATION")){
if(strcmp(gSystem->Getenv("CONFIG_SIMULATION"), "GeneratorOnly") == 0){
Printf("Generator only simulation => ideal vertex at (0,0,0)");
gen->SetSigma(0.,0.,0.);
gen->SetVertexSmear(kNoSmear);
}
else{
gen->SetSigma(sigmaxy, sigmaxy, 5.);
gen->SetVertexSmear(kPerEvent);
}
}
else{
gen->SetSigma(sigmaxy, sigmaxy, 5.);
gen->SetVertexSmear(kPerEvent);
}
}
else{
gen->SetSigma(sigmaxy, sigmaxy, 5.);
gen->SetVertexSmear(kPerEvent);
}


gen->Init();
printf(">>>>> Generator Configuration: %s \n", comment.Data());
// Set the trigger configuration: proton-proton
Expand Down
4 changes: 3 additions & 1 deletion MC/SimulationConfig.C
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,9 @@ void SimulationDefault(AliSimulation &sim)

//
//
sim.UseVertexFromCDB();
if(!gSystem->Getenv("CONFIG_GENVERT") || strcmp(gSystem->Getenv("CONFIG_GENVERT"), "NominalVertex") !=0 || strcmp(gSystem->Getenv("CONFIG_GENVERT"), "VertexFromConfig") != 0){
sim.UseVertexFromCDB();
}
sim.UseMagFieldFromGRP();

//
Expand Down
5 changes: 5 additions & 0 deletions MC/dpgsim.sh
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,10 @@ while [ ! -z "$1" ]; do
CONFIG_GENERATOR="$1"
export CONFIG_GENERATOR
shift
elif [ "$option" = "--genvertex" ]; then
CONFIG_GENVERT="$1"
export CONFIG_GENVERT
shift
elif [ "$option" = "--background" ]; then
CONFIG_BACKGROUND="$1"
export CONFIG_BACKGROUND
Expand Down Expand Up @@ -849,6 +853,7 @@ echo "No. Events....... $CONFIG_NEVENTS"
echo "Unique-ID........ $CONFIG_UID"
echo "MC seed.......... $CONFIG_SEED"
echo "PROCID........... $CONFIG_PROCID"
echo "Vertex........... $CONFIG_GENVERT"
echo "============================================"
echo "Background....... $CONFIG_BACKGROUND"
echo "Override record.. $OVERRIDE_BKG_PATH_RECORD"
Expand Down

0 comments on commit b01104c

Please sign in to comment.