diff --git a/MC/GeneratorConfig.C b/MC/GeneratorConfig.C index 0ff6fb2c..2139cd30 100644 --- a/MC/GeneratorConfig.C +++ b/MC/GeneratorConfig.C @@ -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(" =%.3f =%.3f =%.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(" =%.3f =%.3f =%.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 diff --git a/MC/SimulationConfig.C b/MC/SimulationConfig.C index 2aeef312..b4a8eb60 100644 --- a/MC/SimulationConfig.C +++ b/MC/SimulationConfig.C @@ -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(); // diff --git a/MC/dpgsim.sh b/MC/dpgsim.sh index 27ac6b70..46c4014c 100755 --- a/MC/dpgsim.sh +++ b/MC/dpgsim.sh @@ -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 @@ -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"