CST - Energy Histogram Analysis in ES-PIC Solver for Particle 2D Monitor

Greetings,

I designed a gridded electron gun in CST Studio Suite. I would like to prove a phenomenon called, 'short-tail and long-tail bunch extraction' in the space between cathode and grid area. I will explain what I need,

According to the Fig.1, I attached multiple 2D monitors in the space between cathode and grid,

Fig. 1: 20 layers of particle 2D monitors are assigned in between cathode and grid. Cathode is on the left side; grid is on right side.

In a fixed time frame, let us say t = 0.290 ns, some electrons exist in between this area, it is depicted in Fig.2.

Fig. 2: Energy distribution of electrons existing in this space is shown. Other electrons also exist after the grid but we only need those in the space assigned in Fig. 1.

In each 2D monitor layer, we have lots of electrons. I would like to calculate the average energy of electrons in each layer. For instance, CST says, 'the average energy of electrons in layer 18 is 100 eV, for layer 19 is 120 eV, etc.' Then, I want to have histogram of the average energy of each layer; x-axis is the number of the layer, y-axis is the average energy of electrons corresponding to those layers.

Thank you for yours time and consideration.