+ # Find the number of primaries for this job (the same for all line and different of 0)
+ # Get the number of primaries from edep and square_edep to determine the std.
+ nbPrimary=0
+ for i in $(seq 2 $nblines); do
+ #Get the line
+ file2=`sed -n "${i}p" < ${IN2}`
+
+ edep2=$(echo ${file2} | cut -f3 -d' ')
+ stdEdep2=$(echo ${file2} | cut -f4 -d' ')
+ sqEdep2=$(echo ${file2} | cut -f5 -d' ')
+ nbPrimary=$(python <<EOP
+if ($edep2 == 0 or $sqEdep2 == 0):
+ print(0)
+else:
+ temp=pow($edep2,2)*(pow($stdEdep2,2)-1)/(pow($stdEdep2*$edep2,2)-$sqEdep2)
+ print(int(round(temp)))
+EOP
+ )
+ if [ $nbPrimary -ne 0 ]; then
+ break
+ fi
+
+ dose2=$(echo ${file2} | cut -f6 -d' ')
+ stdDose2=$(echo ${file2} | cut -f7 -d' ')
+ sqDose2=$(echo ${file2} | cut -f8 -d' ')
+ nbPrimary=$(python <<EOP
+if ($dose2 == 0 or $sqDose2 == 0):
+ print(0)
+else:
+ temp=pow($dose2,2)*(pow($stdDose2,2)-1)/(pow($stdDose2*$dose2,2)-$sqDose2)
+ print(int(round(temp)))
+EOP
+ )
+ if [ $nbPrimary -ne 0 ]; then
+ break
+ fi
+ done
+