m (q^3+q^2+q+1-x)+x, \end{equation} where $m=q^{2(r-2)}+q^{2(r-3)}+ \cdots +q^2+1$ is the number of planes in ${\mathcal H}(r,q^2)$ through $\ell$. From \eqref{eq7}, we obtain $x>q^2+1$, a contradiction. \end{proof} \begin{lemma} \label{maxindex} For each line $\ell$ of ${\mathcal H}(r,q^2)$, $q>4$ and $q = p^h$, $p$ odd prime, $h\geq 1$, either $|\ell \cap {\mathcal V}| \leq q+1$ or $|\ell \cap {\mathcal V}| \geq q^2-q+1$. \end{lemma} \begin{proof} Let $\ell$ be a line of ${\mathcal H}(r,q^2)$ and let $\pi$ be a plane through $\ell$ such that $|\pi \cap {\mathcal V}|\leq q^3+q^2+q+1$; Lemma \ref{lemma1} shows that such a plane exists. Set $B=\pi \cap {\mathcal V}$. By Corollary \ref{subgeocodes}, $B$ is a codeword of the code of the lines of $\pi$, so we can write it as a linear combination of some lines of $\pi$, that is $\sum_i \lambda_iv^{e_i}$, where $v^{e_i}$ are the characteristic vectors of the lines $e_i$ in $\pi$. Let $B^*$ be the multiset consisting of the lines $e_i$, with multiplicity $\lambda_i$, in the dual plane of $\pi$. The weight of the codeword $B$ is at most $q^3 + q^2 +q+1 $, hence in the dual plane this is the number of lines intersecting $B^*$ in not $0\pmod{p}$ points. Actually, as $B$ is a proper set, we know that each non $0\pmod{p}$ secant of $B^*$ must be a $1\pmod{p}$ secant. Using Result \ref{bmost}, with $\delta=q^3 + q^2 +q+1$, in ${\mathcal H}(2,q^2)$, the number of non $0\pmod{p}$ secants through any point is at most $$\frac{\delta}{q^2+1}+2\frac{\delta^2}{(q^2+1)^3}=q+1+2\frac{(q+1)^2}{q^2+1}q^2-q-3.$$ In the original plane $\pi$, this means that each line intersects $B$ in either at most $q+3$ or in at least $q^2-q-2$ points. Since such lines must be $1\pmod{p}$ secants and $p>2$, then each line intersects $B$ in either at most $q+1$ or in at least $q^2-q+1$ points. \end{proof} \begin{proposition} \label{charplanes1} Assume that $\pi$ is a plane of ${\mathcal H}(r,q^2)$, $q>4$, and $q = p^h$, $p$ odd prime, $h\geq 1$, such that $|\pi \cap {\mathcal V}|\leq q^3+2q^2$. Furthermore, suppose also that there exists a line $\ell$ meeting $\pi \cap {\mathcal V}$ in at least $q^2-q+1$ points, when $q^3 +1 \leq |\pi \cap {\mathcal V}|$. Then $\pi \cap {\mathcal V}$ is a linear combination of at most $q+1$ lines, each with weight $1$. \end{proposition} \begin{proof} Let $B$ be the point set $\pi \cap {\mathcal V}$. By Corollary \ref{subgeocodes}, $B$ is the corresponding point set of a codeword $c$ of lines of $\pi$, that is $c = \sum_i \lambda_iv^{e_i}$, where lines of $\pi$ are denoted by $e_i$. Let $C^*$ be the multiset in the dual plane containing the dual of each line $e_i$ with multiplicity $\lambda_i$. Clearly the number of lines intersecting $C^*$ in not $0\pmod{p}$ points is $w(c )=|B|$. Note also, that every line that is not a $0\pmod{p}$ secant is a $1\pmod{p}$ secant, as $B$ is a proper point set. Our very first aim is to show that $c$ is a linear combination of at most $q+3$ different lines. When $|B| < q^3+1$, then, by Result \ref{codewords}, it is a linear combination of at most $q$ different lines. %Assume first that $|B| < q^3+1$. %The dual of Result \ref{general} yields that there are exactly %$\lceil {|B|\over q^2+1}\rceil$ lines $m_j$ with some multiplicity $\mu_j$, such that %if we add the lines $m_j$ with multiplicity $\mu_j$ to $B$ then through any point of PG$(2, q^2)$, % we see $0\pmod{p}$ lines (counted with multiplicity). %In other words, we get that %$c + \sum_{j = 1}^{\lceil {|B|\over q^2+1}\rceil }\mu_j m_j = \sum_i \lambda_i e_i + \sum_{j = 1}^{\lceil {w(c)\over q^2+1}\rceil }\mu_j m_j $ is the \underline 0 codeword.% %Hence, $c = \sum_{j = 1}^{\lceil {|B|\over q^2+1}\rceil }(p-\mu_j) m_j $. That is, $c$ is a linear combination of at most $q$ different lines. Next assume that $|B| \geq q^3+1$. From the assumption of the proposition, we know that there exists a line $\ell$ meeting $\pi \cap {\mathcal V}$ in at least $q^2-q+1$ points and from Lemma \ref{maxindex}, we also know that each line intersects $B$ in either at most $q+1$ or in at least $q^2-q+1$ points. Hence, if we add the line $\ell$ to $c$ with multiplicity $-1$, we reduce the weight by at least $q^2-q+1-q$ and by at most $q^2+1$. %Hence $q^3-q^2\leq w(c) - (q^2+1) \leq w(c+v^l) \leq w(c) - q^2+q+p$. If $w(c-v^\ell) < q^3+1$, then from the above we know that $c -v^\ell$ is a linear combination of $\lceil \frac{w(c-v^\ell)}{ q^2+1}\rceil$ lines. Hence, $c$ is a linear combination of at most $q+1$ lines. If $w(c-v^\ell) \geq q^3+1$, then $w(c) \geq q^3+q^2-2q-2$ (see above) and so it follows that through any point of $B$, there passes at least one line intersecting $B$ in at least $q^2-q+1$ points. This means that we easily find three lines $\ell_1$, $\ell_2$, and $\ell_3$ intersecting $B$ in at least $q^2-q+1$ points. Since $w(c) \leq q^3+2q^2$, we get that $w(c - v^{\ell_1}- v^{\ell_2} - v^{\ell_3}) \leq q^3+2q^2 -3 \cdot( q^2-2q -2) < q^3+1$. Hence, similarly as before, we get that $c$ is a linear combination of at most $q+3$ lines. Next we show that each line in the linear combination (that constructs $c$) has weight $1$. Take a line $\ell$ which is in the linear combination with coefficient $\lambda \not = 0$. Then there are at least $q^2+1-(q+2)$ positions, such that the corresponding point is in $\ell$ and the value at that position is $\lambda$. As $B$ is a proper set, this yields that $\lambda = 1$. By Remark \ref{1modpremark}, the number of lines with non-zero multiplicity in the linear combination of $c$ must be $1\pmod{p}$; hence it can be at most $q+1$. \end{proof} \begin{proposition} \label{charplanes2} Assume that $\pi$ is a plane of ${\mathcal H}(r,q^2)$, $q>4$, and $q = p^h$, $p$ odd prime, $h\geq 1$, such that $|\pi \cap {\mathcal V}|\leq q^3+2q^2$. Furthermore, suppose that every line meets $ \pi\cap {\mathcal V}$ in at most $q+1$ points. Then $\pi \cap {\mathcal V}$ is a classical unital. \end{proposition} \begin{proof} Again let $B = \pi \cap {\mathcal V}$ and first assume that $|B| < q^3+1$. Proposition \ref{charplanes1} shows that $B$ is a linear combination of at most $q+1$ lines, each with weight $1$. But this yields that these lines intersect $B$ in at least $q^2+1-q$ points. So this case cannot occur. Hence, $q^3+1\leq |B|\leq q^3+2q^2$. We are going to prove that there exists at least a tangent line to $B$ in $\pi$. Let $t_i$ be the number of lines meeting $B$ in $i$ points. Set $x=|B|$. Then double counting arguments give the following equations for the integers $t_i$. \begin{equation} \label{tg1} \left\{\begin{array}{l} \sum_{i=1}^{q+1}t_i=q^4+q^2+1 \\ \\ \sum_{i=1}^{q+1}it_i=x(q^2+1)\\ \\ \sum_{i=1}^{q+1}i(i-1)t_i=x(x-1). \end{array} \right. \end{equation} Consider $f(x)=\sum_{i=1}^{q+1}(i-2)(q+1-i)t_i$. From \eqref{tg1}, we get \[f(x)=-x^2+x[(q^2+1)(q+2)+1]-2(q+1)(q^4+q^2+1).\] Since $f(q^3/2)>0$, whereas $f(q^3+1)<0$ and $f(q^3+2q^2)<0$, it follows that if $q^3+1\leq x\leq q^3+2q^2$, then $f(x)<0$ and thus $t_1$ must be different from zero. Consider now the quantity $\sum_{i=1}^{q+1}(i-1)(q+1-i)t_i$. We have that $$\sum_{i=1}^{q+1}(i-1)(q+1-i)t_i=f(x)+\sum_{i=1}^{q+1}(q+1-i)t_i=f(x)+(q+1)\sum_{i=1}^{q+1}t_i-\sum_{i=1}^{q+1}it_i$$ $$=f(x)+(q+1)(q^4+q^2+1)-x(q^2+1)=-x^2+x[(q^2+1)(q+1)+1]-(q+1)(q^4+q^2+1).$$ Since $\sum_{i=1}^{q+1}(i-1)(q+1-i)t_i\geq 0$, we have that $x\leq\frac{(q^2+1)(q+1)+1+(q^3-q^2-q)}{2}=q^3+1$. Therefore, $x=q^3+1$ and $\sum_{i=1}^{q+1}(i-1)(q+1-i)t_i=0$. Since $(i-1)(q+1-i)> 0$, for $2\leq i\leq q$, we obtain $t_2=t_3=\cdots=t_q=0$, that is, $B$ is a set of $q^3+1$ points such that each line is a 1-secant or a $(q+1)$-secant of $B$. Namely, $B$ is a unital and precisely a classical unital since $B$ is a codeword of $\pi$ \cite{BBW}. \end{proof} The above two propositions and Lemma \ref{maxindex} imply the following corollary. \begin{corollary} \label{charunital} Assume that $\pi$ is a plane of ${\mathcal H}(r,q^2), q>4$ and $q = p^h$, $p$ odd prime, $h\geq 1$, such that $|\pi \cap {\mathcal V}|\leq q^3+2q^2$. Then $\pi \cap {\mathcal V}$ is a linear combination of at most $q+1$ lines, each with weight $1$, or it is a classical unital. \qed \end{corollary} \begin{corollary} \label{charunitalbis} Suppose that $\pi$ is a plane of ${\mathcal H}(r,q^2), q>4$ and $q = p^h$, $p$ odd prime, $h\geq 1$, containing exactly $q^3+1$ points of ${\mathcal V}$. Then $\pi \cap {\mathcal V}$ is a classical unital. \end{corollary} \begin{proof} Let $B$ be the point set $\pi \cap {\mathcal V}$. We know that $B$ is the support of a codeword of lines of $\pi$. By Proposition \ref{charplanes1}, if there is a line intersecting $B$ in at least $q^2-q+1$ points, then $B$ is a linear combination of at most $q+1$ lines, each with multiplicity $1$. First of all note that a codeword that is a linear combination of $q+1$ lines has weight at least $(q^2+1)(q+1) - 2\binom{q+1}{2}$, that is exactly $q^3+1$. In fact, in a linear combination of $q+1$ lines the minimum number of points is obtained if there is a hole at the intersection of any two lines. There are $\binom{q+1}{2}$ intersections and each intersection is counted twice, therefore we have to subtract $2 \binom{q+1}{2}$. To achieve this, we need that the intersection points of any two lines from such a linear combination are all different and the sum of the coefficients of any two lines is zero; which is clearly not the case (as all the coefficients are $1$). From Remark \ref{1modpremark}, in this case $B$ would be a linear combination of at most $q+1-p$ lines and so its weight would be less than $q^3+1$, a contradiction. %Hence, $B$, as a codeword, is a linear combination of at most $q$ lines. %Note that at most $q$ lines can cover at most $q^3+1$ points and to achieve this we need exactly $q$ concurrent lines. But, from %Proposition \ref{charplanes1}, we also know that these lines have weight $1$, which implies that the common point of the lines has weight $0$, so the overall weight is $q^3$ only. Hence, there is no line intersecting $B$ in at least $q^2-q+1$ points, so Proposition \ref{charplanes2} finishes the proof. \end{proof} \subsection{Case \texorpdfstring{$r=3$}{Lg}} In ${\mathcal H}(3,q^2)$, each plane intersects ${\mathcal V}$ in either $q^3+1$ or $q^3+q^2+1$ points since these are the intersection numbers of a quasi-Hermitian variety with a plane of ${\mathcal H}(3,q^2)$. \subsubsection{\texorpdfstring{$q=p$}{Lg}} Let ${\mathcal V}$ be a quasi-Hermitian variety of ${\mathcal H}(3,p^2)$, $p$ prime. \begin{lemma} \label{lem1bis} Every plane $\pi$ of ${\mathcal H}(3,p^2)$ sharing $p^3+1$ points with ${\mathcal V}$ intersects ${\mathcal V}$ in a unital of $\pi$. \end{lemma} \begin{proof} Set $U=\pi \cap {\mathcal V}$. Let $P$ be a point in $U$. Assume that every line $\ell$ in $\pi$ through the point $P$ meets $U$ in at least $p+1$ points. We get $|\pi \cap {\mathcal V}|=p^3+1\geq (p^2+1)p+1=p^3+p+1$, which is impossible. Thus, $P$ lies on at least one tangent line to $U$ and this implies that $U$ is a minimal blocking set in $\pi$ of size $p^3+1$. From a result obtained by Bruen and Thas, see \cite{BT}, it follows that $U$ is a unital of $\pi$ and hence every line in $\pi$ meets $U$ in either $1$ or $p+1$ points. \end{proof} \begin{lemma}\label{lem2bis} Let $\pi$ be a plane in ${\mathcal H}(3,p^2)$ such that $|\pi \cap {\mathcal V}|=p^3+p^2+1$, then every line in $\pi$ meets $\pi \cap {\mathcal V}$ in either $1$ or $p+1$ or $p^2+1$ points. \end{lemma} \begin{proof} Set $C=\pi \cap {\mathcal V}$ and Let $m$ be a line in $\pi$ such that $|m \cap C|=s$ with $s\neq 1$ and $s\neq p+1$. Thus, from Lemma \ref{lem1bis}, every plane through $m$ has to meet ${\mathcal V}$ in $p^3+p^2+1$ points and thus \[|{\mathcal V}|=(p^2+1)(p^3+p^2+1-s)+s,\] which gives $s=p^2+1$. \end{proof} From Lemmas \ref{lem1bis} and \ref{lem2bis}, it follows that every line in ${\mathcal H}(3,p^2)$ meets ${\mathcal V}$ in either $1$ or, $p+1$ or, $p^2+1$ points. %\begin{lemma} \label{lem11} %Every plane $\pi$ of PG$(3,p^2)$, $p\in \{3,5\}$ sharing $p^3+1$ points with ${\mathcal V}$ intersects ${\mathcal V}$ in a unital of $\pi$. %\end{lemma} %\begin{proof} Set $U=\pi \cap {\mathcal V}$. %Let $P$ be a point in $U$. Assume that every line $\ell$ in $\pi$ through the point $P$ meets $U$ is at least $p+1$ points. We get %$|\pi \cap {\mathcal V}|=p^3+1\geq (p^2+1)p+1=p^3+p+1$, which is impossible. %Thus, $P$ lies on at least one tangent line to $U$ and this implies the $U$ is a minimal blocking set in $\pi$ of size $p^3+1$. From a result due %to Bruen and Thas, see \cite{BT}, it follows that $U$ is a unital of $\pi$ and hence every line in $\pi$ meets $U$ in either $1$ or $p+1$ points. %\end{proof} \subsubsection{\texorpdfstring{$q=p^h$}{Lg}, \texorpdfstring{$q\geq 5$}{Lg} odd} Let ${\mathcal V}$ be a quasi-Hermitian variety of ${\mathcal H}(3,q^2)$, $q\geq 5$ odd. \begin{lemma}\label{lem2} Let $\pi$ be a plane in ${\mathcal H}(3,q^2)$ such that $|\pi \cap {\mathcal V}|=q^3+q^2+1$, then every line in $\pi$ meets $\pi \cap {\mathcal V}$ in either $1$, $q+1$ or $q^2+1$ points. \end{lemma} \begin{proof} Set $C=\pi \cap {\mathcal V}$ and let $m$ be a line in $\pi$ such that $|m \cap C|=s$, with $s\neq 1$ and $s\neq q+1$. Thus, from Corollary \ref{charunitalbis}, every plane through $m$ has to meet ${\mathcal V}$ in $q^3+q^2+1$ points and thus \[|{\mathcal V}|=(q^2+1)(q^3+q^2+1-s)+s,\] which gives $s=q^2+1$. \end{proof} From Corollary \ref{charunitalbis} and Lemma \ref{lem2}, it follows that every line in ${\mathcal H}(3,q^2)$ meets ${\mathcal V}$ in either $1$, $q+1$, or $q^2+1$ points. \subsubsection{\texorpdfstring{$q=2^{h}$}{Lg}, \texorpdfstring{$h>2$}{Lg}} Let ${\mathcal V}$ be a quasi-Hermitian variety of ${\mathcal H}(3,2^{2h})$, $h > 2$. \begin{lemma}\label{3.7bis} For each line $\ell$ of ${\mathcal H}(3,2^{2h})$, $h>2$, either $|\ell \cap {\mathcal V}| \leq q+1$ or $|\ell \cap {\mathcal V}| \geq q^2-q-1$. \end{lemma} \begin{proof} Let $\ell$ be a line of ${\mathcal H}(3,2^{2h})$. Since $\ell$ is at least a tangent to ${\mathcal V}$, there exists a plane through $\ell$ meeting ${\mathcal V}$ in $q^3+q^2+1$ points. Let $\pi$ be a plane through $\ell$ such that $|\pi \cap {\mathcal V}|=q^3+q^2+1$. Set $B=\pi \cap {\mathcal V}$. As before, by Corollary \ref{subgeocodes}, $B$ is a codeword of the code of the lines of $\pi$, so we can write it as a linear combination of some lines of $\pi$, that is $\sum_i \lambda_iv^{e_i}$, where $v^{e_i}$ are the characteristic vectors of the lines $e_i$ in $\pi$. Let $B^*$ be the multiset consisting of the lines $e_i$, with multiplicity $\lambda_i$, in the dual plane of $\pi$. The weight of the codeword $B$ is $q^3 + q^2+1 $, hence in the dual plane this is the number of lines intersecting $B^*$ in not $0\pmod{p}$ points. Actually, as $B$ is a proper set, we know that each non $0\pmod{p}$ secant of $B^*$ must be a $1\pmod{p}$ secant. Using Result \ref{bmost}, with $\delta=q^3 + q^2 +1$ in ${\mathcal H}(2,2^{2h})$, the number $s$ of non $0\pmod{p}$ secants through any point of $B$ satisfies the inequality $s^2-(q^2+1)s-(q^3+q^2+1)\geq 0$. Since the determinant, $(q^2+1)^2+4(q^3+q^2+1)>((q^2+1)-2(q+3))^2$, we get $sq^2-q-2$ In the original plane $\pi$, this means that each line intersects $B$ in either at most $q+2$ or in at least $q^2-q-1$ points. Since such lines must be $1\pmod{p}$ secants and $p=2$, then each line intersects $B$ in either at most $q+1$ or in at least $q^2-q-1$ points. \end{proof} Let $\alpha$ be a plane meeting ${\mathcal V}$ in a point set $B'$ of size $q^3+q^2+1$ points. We want to prove that $\alpha$ contains some $s$-secant, with $s$ at least $q^2-q-1$. Assume on the contrary that each line in $\alpha$ meets ${\mathcal V}$ in at most $q+1$ points. Let $P$ be a point of $B'$ and consider the $q^2+1$ lines through $P$. We get $q^3+q^2+1\leq (q^2+1)q+1$, a contradiction. Therefore, there exists a line $\ell$ in $\alpha$ meeting $B'$ in at least $q^2-q-1$ points. We are going to show that $B'$ is a linear combination of exactly $q+1$ lines each with weight 1. Again, by Corollary \ref{subgeocodes}, $B'$ is the corresponding point set of a codeword $c'$ of lines of $\pi$, that is $c' = \sum_i \lambda_iv^{e_i}$, where lines of $\pi$ are denoted by $e_i$. Let $C'^*$ be the multiset in the dual plane containing the dual of each line $e_i$ with multiplicity $\lambda_i$. As before, the number of lines intersecting $C'^*$ in not $0\pmod{p}$ points is $w(c' )=|B'|=q^3+q^2+1$ and every line that is not a $0\pmod{p}$ secant is a $1\pmod{p}$ secant, as $B'$ is a proper point set. Hence, if we add the line $\ell$ to $c$ with multiplicity $1$, we reduce the weight by at least $q^2-q-1-q-2=q^2-2q-3$ and at most by $q^2+1$. Now, through any point of $B'$, there passes at least one line intersecting $B'$ in at least $q^2-q-1$ points. Thus, we easily find two lines $\ell_1$ and $\ell_2$ intersecting $B$ in at least $q^2-q-1$ points. We get that $w(c' - v^{\ell_1}- v^{\ell_2} ) < q^3+1$. Hence, similarly as before, we get that $c' -v^{\ell_1}-v^{\ell_2}$ is a linear combination of $\lceil \frac{w(c'-v^{\ell_1}-v^{\ell_2})}{ q^2+1}\rceil$ lines. Hence, $c'$ is a linear combination of at most $q+2$ lines. By Remark \ref{1modpremark}, the number of lines with non-zero multiplicity in the linear combination of $c'$ must be $1$ $\pmod{p}$; hence, as $p=2$ it can be at most $q+1$. For $p=2$, a codeword that is a linear combination of at most $q+1$ lines each with weight 1, has weight at most $q^3+q^2+1$ and this is achieved when the $q+1$ lines are concurrent. This implies that each line in $\alpha$ is either a $1$ or $q+1$ or $q^2+1$-secant to ${\mathcal V}$. Now consider a line $m'$ that is an $s$-secant to ${\mathcal V}$ with $s$ different from $1,q+1$, and also different from $q^2+1$. Each plane through $m'$ has to meet ${\mathcal V}$ in $q^3+1$ points. From $|V|=q^5+q^3+q^2+1=(q^2+1)(q^3+1-s)+s$ we get $s=0$, a contradiction. Thus each line of ${\mathcal H}(3,2^{2h})$ meets ${\mathcal V}$ in either $1$ or $q+1$ or $q^2+1$ points. \vspace*{0.5 cm} \noindent {\bf Proof of Theorem \ref{mainth} (case $r = 3$): } From all previous lemmas of this section, it follows that every line in ${\mathcal H}(3,q^2)$, with $q=p^h \neq 4$ and $p$ any prime, meets ${\mathcal V}$ in either $1$, $q+1$, or $q^2+1$ points. Now, suppose on the contrary that there exists a singular point $P$ on ${\mathcal V}$; this means that all lines through $P$ are either tangents or $(q^2+1)$-secants to ${\mathcal V}$. Take a plane $\pi$ which does not contain $P$. Then $|{\mathcal V}|=q^2|\pi \cap {\mathcal V}|+1$ and since the two possible sizes of the planar sections are $q^3+1$ or $q^3+q^2+1$, we get a contradiction. Thus, every point in ${\mathcal V}$ lies on at least one $(q+1)$-secant and, from Theorem \ref{main1}, we obtain that ${\mathcal V}$ is a Hermitian surface. \qed \subsection{Case \texorpdfstring{$r\geq4$}{Lg} and \texorpdfstring{$q=p\geq 5$}{Lg}} We first prove the following result. \begin{lemma} If $\pi$ is a plane of ${\mathcal H}(r,p^2)$, which is not contained in ${\mathcal V}$, then either \[|\pi \cap {\mathcal V}|= p^2+1 \mbox{ or } \ |\pi \cap {\mathcal V}| \geq p^3+1.\] \end{lemma} \begin{proof} Let $\pi$ be a plane of ${\mathcal H}(r,p^2)$ and set $B= \pi \cap {\mathcal V}$. By Remark \ref{1modpremark}, $B$ is a linear combination of $1\pmod{p}$ not necessarily distinct lines. If $|B|< p^3+1$, then by Result \ref{codewords}, $B$ is a linear combination of at most $p$ distinct lines. This and the previous observation yield that when $|B|< p^3+1$, then it is the scalar multiple of one line; hence $|B|=p^2+1$. \end{proof} \begin{proposition} \label{concurrent} Let $\pi$ be a plane of ${\mathcal H}(r,p^2)$, such that $ |\pi \cap {\mathcal V}| \leq p^3+p^2+p+1$. Then $B=\pi \cap {\mathcal V}$ is either a classical unital or a linear combination of $p+1$ concurrent lines or just one line, each with weight $1$. \end{proposition} \begin{proof} From Corollary \ref{charunital}, we have that $B$ is either a linear combination of at most $p+1$ lines or a classical unital. In the first case, since $B$ intersects every line in $1\pmod{p}$ points and $B$ is a proper point set, the only possibilities are that $B$ is a linear combination of $p+1$ concurrent lines or just one line, each with weight $1$. \end{proof} \noindent {\bf Proof of Theorem \ref{mainth} (case $r\geq 4$, $q = p$): } Consider a line $\ell$ of ${\mathcal H}(r,p^2)$ which is not contained in ${\mathcal V}$. By Lemma \ref{lemma1}, there is a plane $\pi$ through $\ell$ such that $|\pi \cap {\mathcal V}|\leq q^3+q^2+q+1$. From Proposition \ref{concurrent}, we have that $\ell$ is either a unisecant or a $(p+1)$-secant of ${\mathcal V}$ and we also have that ${\mathcal V}$ has no plane section of size $(p+1)(p^2+1)$. Finally, it is easy to see like in the previous case $r=3$, that ${\mathcal V}$ has no singular points, thus ${\mathcal V}$ turns out to be a Hermitian variety of ${\mathcal H}(r,p^2)$ (Theorem \ref{main2}). \subsection{Case \texorpdfstring{$r\geq 4$}{Lg} and \texorpdfstring{$q=p^2$}{Lg}, \texorpdfstring{$p$}{Lg} odd}\label{alsin0} Assume now that ${\mathcal V}$ is a quasi-Hermitian variety of ${\mathcal H}(r,p^4)$, with $r\geq 4$. Lemma \ref{maxindex} states that every line contains at most $p^2+1$ points of ${\mathcal V}$ or at least $p^4-p^2+1$ points of ${\mathcal V}$. \begin{lemma} \label{lem31} If $\ell$ is a line of ${\mathcal H}(r,p^4)$, such that $|\ell \cap {\mathcal V}|\geq p^4-p^2+1$, then $|\ell \cap {\mathcal V}|\geq p^4-p+1$. \end{lemma} \begin{proof} Set $|\ell \cap {\mathcal V}|= p^4-x+1$, where $x\leq p^2$. It suffices to prove that $x0$, $f(p^8-p^5+p^4-p)>0$. This finishes the proof of the lemma. \end{proof} \begin{lemma}\label{lem33} If $\pi$ is a plane of ${\mathcal H}(r,p^4)$, such that $ |\pi \cap {\mathcal V}|\geq p^8-p^5+p^4-p+1$, then either $\pi$ is entirely contained in ${\mathcal V}$ or $ \pi \cap {\mathcal V}$ consists of $p^8-p^5+p^4+1$ points and it only contains $i$-secants, with $i\in \{1, p^4-p+1,p^4+1\}$. \end{lemma} \begin{proof} Set $S=\pi \setminus {\mathcal V}$. Suppose that there exists some point $P \in S$. We have the following two possibilities: either each line of the pencil with center at $P$ is a $(p^4-p+1)$-secant or only one line through $P$ is an $i$-secant, with $1\leq i\leq p^2+1$, whereas the other $p^4$ lines through $P$ are $(p^4-p+1)$-secants. In the former case, when there are no $i$-secants, $1\leq i\leq p^2+1$, each line $\ell$ in $\pi$ either is disjoint from $S$ or it meets $S$ in $p$ points since $\ell$ is a $(p^4-p+1)$-secant. This implies that $S$ is a maximal arc and this is impossible for $p\neq 2$ \cite{BB,BBM}. In the latter case, we observe that the size of $\pi\cap {\mathcal V}$ must be $p^8-p^5+p^4+i$, where $1\leq i\leq p^2+1$. Next, we denote by $t_s$ the number of $s$-secants in $\pi$, where $s\in \{i,p^4-p+1,p^4+1 \}$. We have that \begin{equation} \label{tg3} \left\{\begin{array}{l} \sum_{s}t_s=p^8+p^4+1 \\ \\ \sum_{s}st_s=(p^4+1)(p^8-p^5+p^4+i)\\ \\ \sum_{s}s(s-1)t_s=(p^8-p^5+p^4+i)(p^8-p^5+p^4+i-1). \end{array} \right. \end{equation} From \eqref{tg3} we get \begin{equation} \label{tg3.1} t_i=\frac{p(p^4-p-i+1)(p^5-i+1)}{p(p^4-p-i+1)(p^4-i+1)}=\frac{p^5-i+1}{p^4-i+1}, \end{equation} and we can see that the only possibility for $t_i$ to be an integer is $ip-p-i+1=0$, that is $i=1$. For $i=1$, we get $|B|=p^8-p^5+p^4+1$. \end{proof} \begin{lemma}\label{lem4} If $\pi$ is a plane of ${\mathcal H}(r,p^4)$, not contained in ${\mathcal V}$ and which does not contain any $(p^4-p+1)$-secant, then $\pi \cap {\mathcal V}$ is either a classical unital or the union of $i$ concurrent lines, with $1\leq i\leq p^2+1$. \end{lemma} \begin{proof} Because of Lemmas \ref{lem31}, \ref{lem32} and \ref{lem33}, the plane $\pi$ meets ${\mathcal V}$ in at most $p^6+2p^4-p^2-p+1$ points. Furthermore, each line of $\pi$ which is not contained in ${\mathcal V}$ is an $i$-secant, with $1\leq i\leq p^2+1$ (Lemma \ref{lem31} and the sentence preceding Lemma \ref{lem31}). Set $B=\pi \cap {\mathcal V}$. If in $\pi$ there are no $(p^4+1)$-secants to $B$, then $|B|\leq p^6+p^2+1$ and by Proposition \ref{charplanes2} it follows that $B$ is a classical unital. If there is a $(p^4+1)$-secant to $B$ in $\pi$, then arguing as in the proof of Proposition \ref{charplanes1}, we get that $B$ is still a linear combination of $m$ lines, with $m\leq p^2+1$. Each of these $m$ lines is a $(p^4+1)$-secant to ${\mathcal V}$. In fact if one of these lines, say $v$, was an $s$-secant, with $1\leq s\leq p^2+1$, then through each point $P\in v \setminus B$, there would pass at least $p$ lines of the codeword corresponding to $B$ and hence $B$ would be a linear combination of at least $(p^4+1-s)(p-1)+1>p^2+1$ lines, which is impossible. We are going to prove that these $m$ lines, say $\ell_1,\ldots, \ell_m$, are concurrent. Assume on the contrary that they are not. We can assume that through a point $P\in \ell_n$, there pass at least $p+1$ lines of our codeword but there is a line $\ell_j$ which does not pass through $P$. Thus through at least $p+1$ points on $\ell_j$, there are at least $p+1$ lines of our codeword and thus we find at least $(p+1)p+1>m$ lines of $B$, a contradiction. \end{proof} \begin{lemma}\label{lem5} A plane $\pi$ of ${\mathcal H}(r,p^4)$ meeting ${\mathcal V}$ in at most $p^6+2p^4-p^2-p+1$ points and containing a $(p^4-p+1)$-secant to ${\mathcal V}$ has at most $(p^2+1)( p^4-p+1)$ points of ${\mathcal V}$. \end{lemma} \begin{proof} Let $\ell$ be a line of $\pi$ which is a $(p^4-p+1)$-secant to ${\mathcal V}$. In this case, $\pi \cap {\mathcal V}$ is a linear combination of at most $p^2+1$ lines, each with weight 1 (Proposition \ref{charplanes1}). A line not in the codeword can contain at most $p^2+1$ points. In particular, since $\ell$ contains more than $p^4-p^2+1$ points of ${\mathcal V}$, $\ell$ is a line of the codeword and hence through each of the missing points of $\ell$ there are at least $p$ lines of the codeword corresponding to $B$. On these $p$ lines we can see at most $p^4-p+1$ points of ${\mathcal V}$. So let $\ell_1, \ell_2, \ldots, \ell_p$ be $p$ lines of the codeword through a point of $\ell \setminus {\mathcal V}$. Each of these lines contains at most $p^4-p+1$ points of ${\mathcal V}$. Thus these $p$ lines contain together at most $ p(p^4-p+1)$ points of ${\mathcal V}$. Now take any other line of the codeword, say $e$. If $e$ goes through the common point of the lines $\ell_i$, then there is already one point missing from $e$, so adding $e$ to our set, we can add at most $p^4-p+1$ points. If $e$ does not go through the common point, then it intersects $\ell_i$ in $p$ different points. These points either do not belong to the set $\pi\cap {\mathcal V}$ or they belong to the set $\pi\cap {\mathcal V}$, but we have already counted them when we counted the points of $\ell_i$, so again $e$ can add at most $p^4-p+1$ points to the set $\pi\cap {\mathcal V}$. Thus adding the lines of the codewords one by one to $\ell_i$ and counting the number of points, each time we add only at most $p^4-p+1$ points to the set $\pi\cap {\mathcal V}$. Hence, the plane $\pi$ contains at most $(p^2+1)(p^4-p+1)$ points of ${\mathcal V}$. \end{proof} \begin{lemma}\label{lem51} Let $\pi$ be a plane of ${\mathcal H}(r,p^4)$, containing an $i$-secant, $1< i < p^2 + 1$, to ${\mathcal V}$. Then $\pi \cap {\mathcal V}$ is either the union of $i$ concurrent lines or it is a linear combination of $p^2+1$ lines (each with weight 1) so that they form a subplane of order $p$, minus $p$ concurrent lines. \end{lemma} \begin{proof} By Lemmas \ref{lem32}, \ref{lem33} and \ref{lem4}, $\pi$ meets ${\mathcal V}$ in at most $p^6 +2p^4 -p^2 -p+1$ points and must contain a $(p^4-p+1)$-secant to ${\mathcal V}$ or $\pi \cap {\mathcal V}$ is the union of $i$ concurrent lines. Hence, from now on, we assume that $\pi$ contains a $(p^4 -p+1)$-secant. By Result \ref{codewords}, such a plane is a linear combination of at most $p^2+1$ lines. As before each line from the linear combination has weight $1$. Note that the above two statements imply that a line of the linear combination will be either a $(p^4 +1)$-secant or a $(p^4 -p+1)$-secant. As we have at most $p^2+ 1$ lines in the combination, a $(p^4- p + 1)$-secant must be one of these lines. This also means that through each of the $p$ missing points of this line, there must pass at least $p-1$ other lines from the linear combination. Hence, we already get $(p-1)p +1$ lines. In the case in which the linear combination contains exactly $p^2-p+1$ lines, then from each of these lines there are exactly $p$ points missing and through each missing point there are exactly $p$ lines from the linear combination. Hence, the missing points and these lines form a projective plane of order $p-1$, a contradiction as $p>3$. Therefore, as the number of the lines of the linear combination must be $1$ $\pmod{p}$ and at most $p^2+1$, we can assume that the linear combination contains $p^2 +1$ lines. We are going to prove that through each point of the plane there pass either $0$, $1$, $p$ or $p+1$ lines from the linear combination. From earlier arguments, we know that the number of lines through one point $P$ is $0$ or $1 \pmod{p}$. Assume to the contrary that through $P$ there pass at least $p+2$ of such lines. These $p^2+1$ lines forming the linear combination are not concurrent, so there is a line $\ell$ not through $P$. Through each of the intersection points of $\ell$ and a line through $P$, there pass at least $p-1$ more other lines of the linear combination, so in total we get at least $(p-1)(p+2)+1$ lines forming the linear combination, a contradiction. Since there are $p^2 +1$ lines forming the linear combination and through each point of the plane there pass either $0$, $1$, $p$ or $p+1$ of these lines, we obtain that on a $(p^4-p+1)$-secant there is exactly one point, say $P$, through which there pass exactly $p+1$ lines from the linear combination and $p$ points, not in the quasi Hermitian variety, through each of which there pass exactly $p$ lines. If all the $p^2+1$ lines forming the linear combination, were $(p^4-p+1)$-secants then the number of points through which there pass exactly $p$ lines would be $(p^2+1)p / p$. On the other hand, through $P$ there pass $p+1$ $(p^4-p+1)$-secants, hence we already get $(p+1)p$ such points, a contradiction. Thus, there exists a line $m$ of the linear combination that is a $(p^4+1)$-secant. From the above arguments, on this line there are exactly $p$ points through each of which there pass exactly $p+1$ lines, whereas through the rest of the points of the line $m$ there pass no other lines of the linear combination. Assume that there is a line $m' \neq m$ of the linear combination that is also a $(p^4+1)$-secant. Then there is a point $Q$ on $m'$ but not on $m$ through which there pass $p+1$ lines. This would mean that there are at least $p+1$ points on $m$, through which there pass more than $2$ lines of the linear combination, a contradiction. Hence, there is exactly one line $m$ of the linear combination that is a $(p^4+1)$-secant and all the other lines of the linear combination are $(p^4-p+1)$-secants. It is easy to check that the points through which there are more than $2$ lines plus the $(p^4-p+1)$-secants form a dual affine plane. % There are p^2 points not on l, through which there pass at least 2 lines from the lin. combination. This is so, because there are p^2 (p^4-p+1)-secants, on each we see p such points and each such point was calculated exactly p times. %Hence there are $p^2+p$ ``lines'' (in the dual setting) and $p^2$ ``points''. Through each``point'' there are $(p+1)$ ``lines'', on each ``line'' there are p ``points'' (obvious from above).) Hence our lemma follows. \end{proof} \begin{lemma}\label{lem35} There are no $i$-secants to ${\mathcal V}$, with $1

1$ then an $i$-secant is at least a $(p^2-p+1)$-secant. In fact, since the $p^2+1$ lines of the linear combination do not intersect outside of ${\mathcal H}(2,p)$, each of the $p^2+1$ lines of the linear combination is at least a $(p^4-p+1)$-secant, whereas the $p$ concurrent lines are $1$-secants. Also, all the other lines of ${\mathcal H}(2,p^4)$ intersect ${\mathcal H}(2,p)$ in either $1$ or zero points. If they intersect ${\mathcal H}(2,p)$ in zero points they are $(p^2+1)$-secants to ${\mathcal V}$. If they intersect ${\mathcal H}(2,p)$ in a unique point $P$, then they are at least $(p^2-p+1)$-secants since $P$ lies on $p$ or $p+1$ lines of the linear combination and each line intersects ${\mathcal V}$ in $1\pmod p$ points. %In fact a line $\ell$ in a plane of order $p^4$ which is external with the respect to a subplane $\sigma$ of order $p$ intersects $\sigma$ in a unique point $P$ and there are at most $p+1$ lines among the $p^2+1$ passing through $P$: all the other $p^2-p$ lines intersect $\ell$ in other $p^2-p$ pairwise distinct points. Hence, if there is an $i$-secant with $12$. Arguing as in the corresponding non-singular case, it turns out that a $(q^3+q^2+1)$-plane meets $\mathcal S$ in a pencil of $q+1$ lines. Now, assume that there is an $i$-secant line to ${\mathcal S}$, say $m$, with $2< i< q$. Then, each plane through $m$ has to be a $(q^3+1)$-plane of ${\mathcal S}$. Counting the number of points of ${\mathcal S}$ by using all planes through $m$ we obtain $q^5+q^2+1=q^5+q^3+q^2-iq^2+1$, hence $i=q$, a contradiction since every line contains $1\pmod 2$ points of ${\mathcal V}$. Therefore, each line of ${\mathcal H}(3,2^{2h})$, $h\neq 2$ meets $\mathcal{S}$ in $1$, $q+1$ or $q^2+1$ points. Finally, $\mathcal{S}$ is a $k_{q+1,3,q^2}$ for all $q \neq 4$. Also, $\mathcal{S}$ cannot be non-singular by assumption. When $q\neq 2$, Theorem \ref{th:singularcase1} applies and ${\mathcal S}$ turns out to be a cone $\Pi_0\mathcal{S}^{\prime}$ with $\mathcal{S}^{\prime}$ of type {I}, {II}, {III} or {IV } as the possible intersection sizes with planes are $q^2+1,q^3+1,q^3+q^2+1$. Possibilities {II}, {III}, and {IV} must be excluded, since their sizes cannot be possible. This implies that $ \mathcal{S}=\Pi_0\mathcal{H}$, where $\mathcal{H}$ is a non-singular Hermitian curve. For $q=2$, there is just one point set in ${\mathcal H}(3,4)$ up to equivalence, meeting each line in $1$, $3$ or $5$ points and each plane in $5$, $9$ or $13$ points, that is the Hermitian cone, see \cite[Theorem 19.6.8]{JH2}. \subsection{Case \texorpdfstring{$r\geq 4$}{Lg}} Let $\ell$ be a line of ${\mathcal H}(r,q^2)$ containing $xq^2+1$, a contradiction. Therefore, there exists at least one plane through $\ell$ having less than $q^3+q^2+q+1$ points of $\mathcal{S}$ and hence Lemma \ref{lemma1}, Lemma \ref{maxindex}, Proposition \ref{charplanes1}, and Corollary \ref{charunital}, are still valid in this singular case for any odd $q>4$. Next, we are going to prove that ${\mathcal S}$ is a $k_{q+1,r,q^2}$, with $q=p^{h}>4$, $h=1,2$. \medskip \noindent{\bf Case $q = p\geq 5$: } Let $\ell$ be a line of ${\mathcal H}(r,p^2)$. As we have seen, there is a plane $\pi$ through $\ell$ such that $|\pi \cap {\mathcal V}|< p^3+p^2+p+1$. Proposition \ref{concurrent} is still valid in this case and thus we have that $\ell$ is either a unisecant or a $(p+1)$-secant of ${\mathcal S}$. Furthermore, we also have that ${\mathcal S}$ has no plane section of size $(p+1)(p^2+1)$ and hence ${\mathcal S}$ is a regular $k_{p+1,r,p^2}$. \medskip \noindent{\bf Case $q = p^2$, $p$ odd: } We first observe that \eqref{eq17} and \eqref{alsin} hold true in the case in which ${\mathcal V}$ is assumed to be a singular quasi-Hermitian variety. This implies that all lemmas stated in the subparagraph \ref{alsin0} are valid in our case. Thus, we obtain that $\mathcal{S}$ is a $k_{p^2+1,r,p^4}$ and it is straightforward to check that $\mathcal{S}$ is also regular. Finally, in both cases $q=p$ or $q=p^2$, we have that ${\mathcal S}$ is a singular $k_{q+1,r,q^2}$ because if $\mathcal{S}$ were a non-singular $k_{q+1,r,q^2}$, then, from Theorem \ref{main2}, $\mathcal{S}$ would be a non-singular Hermitian variety and this is not possible by our assumptions. Therefore, by Theorem \ref{th:singularcase}, the only possibility is that $\mathcal{S}$ is a cone $\Pi_d \mathcal{S}^\prime$, with $\mathcal{S}^{\prime}$ a non-singular $k_{q+1,r-d-1,q^2}$. By Lemma \ref{CDS}, $\mathcal{S}^{\prime}$ belongs to the code of points and hyperplanes of ${\mathcal H}(r-d-1,q^2)$. Since $r-d-1\geq 2$, then, by \cite{BBW} and Theorem \ref{mainth}, $\mathcal{S}^{\prime}$ is a non-singular Hermitian variety and, therefore, $\mathcal{S}$ is a singular Hermitian variety with a vertex of dimension $d$. \end{proof} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \subsection*{Acknowledgements} The research of the first two authors was partially supported by Ministry for Education, University and Research of Italy (MIUR) (Project PRIN 2012 ``Geometrie di Galois e strutture di incidenza'' - Prot. N. 2012XZE22K\_005) and by the Italian National Group for Algebraic and Geometric Structures and their Applications (GNSAGA - INdAM). The third and fourth author acknowledge the financial support of the Fund for Scientific Research - Flanders (FWO) and the Hungarian Academy of Sciences (HAS) project: Substructures of projective spaces (VS.073.16N). The fourth author was also partially supported by OTKA Grant K124950. \begin{thebibliography}{10} \bibitem{AA} A.~Aguglia. \newblock Quasi-Hermitian varieties in $\mathrm{PG}(r,q^2)$, $q$ even. \newblock {\em Contrib. Discrete Math.}, 8(1):31--37, 2013. \bibitem{ACK} A.~Aguglia, A.~Cossidente, and G.~Korchm\'{a}ros. \newblock On quasi-Hermitian varieties. \newblock {\em J. Combin. Des.}, 20(10):433--447, 2012. \bibitem{AK} E.~F. Assmus and J.~D. Key. \newblock {\em Designs and their codes}. \newblock Cambridge Tracts in Mathematics, Cambridge University Press, Cambridge, 1992. \bibitem{BB} S.~Ball and A.~Blokhuis. \newblock An easier proof of the maximal arcs conjecture. \newblock {\em Proc. Amer. Math. Soc.}, 126(11):3377--3380, 1998. \bibitem{BBM} S.~Ball, A.~Blokhuis, and F.~Mazzocca. \newblock Maximal arcs in Desarguesian planes of odd order do not exist. \newblock {\em Combinatorica}, 17(1):31--41, 1997. \bibitem{BBW} A.~Blokhuis, A.~E. Brouwer, and H.~Wilbrink. \newblock Hermitian unitals are code words. \newblock {\em Discrete Math.}, 97:63--68, 1991. \bibitem{BT} A.~A. Bruen and J.~A. Thas. \newblock Blocking sets. \newblock {\em Geom. Dedicata}, 6:193--203, 1977. \bibitem{B} F.~Buekenhout. \newblock Existence of unitals in finite translation planes of order $q^2$ with a kernel of order $q$. \newblock {\em Geom. Dedicata}, 5:189--194, 1976. \bibitem{DS} S.~De Winter and J.~Schillewaert. \newblock A note on quasi-Hermitian varieties and singular quasi-quadrics. \newblock {\em Bull. Belg. Math. Soc. Simon Stevin}, 17(5):911--918, 2010. \bibitem{JH} J.~W.~P. Hirschfeld. \newblock {\em Finite Projective Spaces of Three Dimensions.} \newblock Oxford Mathematical Monographs, Oxford University Press, Oxford, 1985. \bibitem{JH2} J.~W.~P. Hirschfeld. \newblock {\em Projective Geometries over Finite Fields, 2nd edn.} \newblock Oxford Mathematical Monographs, Oxford University Press, Oxford, 1998. \bibitem{HT} J.~W.~P. Hirschfeld and J.~A. Thas. \newblock {\em General Galois Geometries}. \newblock Oxford Mathematical Monographs, Oxford University Press, Oxford, 1991. \bibitem{JK} J.~D. Key. \newblock Hermitian varieties as Codewords. \newblock {\em Des. Codes Cryptogr.}, 1:255--259, 1991. \bibitem{M} R.~Metz. \newblock On a class of unitals. \newblock {\em Geom. Dedicata}, 8:125--126, 1979. \bibitem{FP} F.~Pavese. \newblock Geometric constructions of two-character sets. \newblock {\em Discrete Math.}, 338(3):202--208, 2015. \bibitem{S} B.~Segre. \newblock Forme e geometrie Hermitiane, con particolare riguardo al caso finito. \newblock {\em Ann. Mat. Pura Appl. (4)}, 70:1--201, 1965. \bibitem{SzW} T.~Sz\H onyi and Zs.~Weiner. \newblock Stability of $k$ mod $p$ multisets and small weight codewords of the code generated by the lines of PG$(2, q)$. \newblock {\em J. Combin. Theory Ser. A}, 157:321--333, 2018. \end{thebibliography} \end{document}