info about whizard code

Asked by Andrea Paolo Puppin

hi,
i tried this code because i wanna try to simulate a beam behavior,
i wanna consider multiple angle scattering beetween A and e1 and also i wanna generate a different number of events for every angle:
process eeprovamultifasci = A, e1 => e1,e1,E1

beams = A, e1 => gaussian

beams_momentum = 50 keV, 10 GeV

!plot angle

plot E_Theta_Px_Py

sample_format = lhef

scan real x= (0 degree => 5 degree /+ 1 degree) {

!plot angle

!plot Px_Py

!n_events = 10

scan n_events= (10 => 15 /+ 1) {

  beams_theta = 0, x

  integrate (eeprovamultifasci)

 $sample = sprintf "eeff_%1.3f" (real (x))

 analysis= record E_Theta_Px_Py (eval E["E1"], eval Theta["E1"], eval Px["E1"], eval Py["E1"])

write_analysis

  simulate (eeprovamultifasci)

}

compile_analysis
i was thinking this code start the simulation for theta=0 and generates 10 events, then it does a run for theta=1 and nevents=11 and so on but the code doesn't work.
did i just write a wrong code or simply whizard can't do the simulation changing both theta and nevents?
Thank again in advance,
Kind regards

Question information

Language:
English Edit question
Status:
Solved
For:
WHIZARD Edit question
Assignee:
Juergen Reuter Edit question
Solved by:
Pia Bredt
Solved:
Last query:
Last reply:
Revision history for this message
Juergen Reuter (j.r.reuter) said :
#1

Hi Andrea,
your script contains logical errors. cf. below. You need to rename the event files properly, because
otherwise they get partially reread from the .evx file. Safest is a ?rebuild_events in the innermost
scan loop. Also it might be safer to introduce an explicit variables and reset n_events inside the loop,
though I think your solution seems fine, too.

scan real x= (0 degree => 2 degree /+ 1 degree) {

  beams_theta = 0, x
  integrate (eeprovamultifasci)

   scan real y = (10 => 12 /+ 1) {
     n_events = y
  #?rebuild_events = true

  $sample = sprintf "eeff_%1.3f_%1.3f" (real (x), real (y))

  analysis= record E_Theta_Px_Py (eval E["E1"], eval Theta["E1"], eval Px["E1"], eval Py["E1"])

   write_analysis

  simulate (eeprovamultifasci)

}}

Revision history for this message
Andrea Paolo Puppin (2andre3) said :
#2

okay i tried this code:
process eeprovamultifasci = A, e1 => e1,e1,E1

beams = A, e1 => gaussian

beams_momentum = 50 keV, 10 GeV

plot E_Theta_Px_Py

sample_format = lhef

scan real x= (0 degree => 0.01 degree /+ 0.001 degree) {

  beams_theta = 0, x

  integrate (eeprovamultifasci)

  scan real y=(1=>11/+1){

   n_events=y

  #?rebuild_events = true

 $sample = sprintf "eeff_%1.3f_%1.3f" (real (x), real (y))

 analysis= record E_Theta_Px_Py (eval E["E1"], eval Theta["E1"], eval Px["E1"], eval Py["E1"])

write_analysis

  simulate (eeprovamultifasci)

}}

compile_analysis
but there's something i don't understand.
in the file analysis.dat i foun 715 entries but i thought they should be less with the code written.
i thoungt it initially whizard starts the simulation with theta=0 and it generates 1 event.
Then theta become 0.001 and it starts the second simulation and it generated now 2 events.
the third simulation theta become 0.002 and i should generate 3 events and so on.
but if i find 715 events in whizard analyis.dat it means it does something different, can you kindly explain what is wrong in my reasoning?
Kind regards and thanks again

Revision history for this message
Pia Bredt (bredtpia) said :
#3

Hi Andrea,
Be aware that you coded a nested loop with the two scans. This would evaluate a complete scan over using 1 to 11 events for each angle theta. So for theta=0.0 you have n_events=1, 2, ...11, then theta=0.001 again n_events=1, 2, ...11 and so on, which is not intended I guess.
The solution would be to use just a single scan and construct your variables from it, e.g.

scan real y=(0=>10/+1){
x = y*0.001
n_events = y+1
...
}

Kind regards

Revision history for this message
Andrea Paolo Puppin (2andre3) said :
#4

Hi thank you very much, your answer gave me a great help!!
Can i also ask you another doubt.
I tried to read the manual but there's something i don't understand
can you explain the difference beetwen these two codes:
process eeprovamultifasci = A, e1 => e1,e1,E1
beams_momentum = 5 keV, 5 GeV
beams = A, e1 => gaussian
1) beams_theta = 0,pi
2) beams_theta = 0,0
because i think in the first simulation whizard simulates a colliding beam of photons and electrons ,so i have two beams with different momentum where the photon beam has a theta angle=0 respect to the laboratory system(suppose coming from left) and electron beam has theta=pi respect to the laboratory system(suppose coming from right) and for this they're colliding.
is my assumption correct?
therefore in the second simulation whizard simulates two beams "overlapped" with the same direction? i don't understand what means they both have theta=0.
Thank you again for your help!!
Kind regards

Revision history for this message
Best Pia Bredt (bredtpia) said :
#5

The parameter "beams_theta" describes the crossing angle of two colliding beam particles, so the angular shift with respect to the actual beam axis (in beam direction) each. That means for two colliding particles without crossing angle this parameter would correspond to beam_theta= 0,0, which is also the default.
In the case of overlapping beams you would have something like beam_theta = 0, 180 degree (which is not useful btw)

Hope that helps.
Kind regards

Revision history for this message
Juergen Reuter (j.r.reuter) said :
#6

Hi Andrea,
and please, again, do _not_ mix questions in the same Lauchpad issue, but open a new issue for a new question.
Cheers,
   JRR

Revision history for this message
Andrea Paolo Puppin (2andre3) said :
#7

Okay sorry.
I thought it was better for you to have just one at a time open request.
Kind regards

Revision history for this message
Andrea Paolo Puppin (2andre3) said :
#8

Thanks Pia Bredt, that solved my question.