Let $S$ be a smooth algebraic variety, and suppose $X\to S$ is a smooth morphism of schemes such that the geometric fibers are all projective spaces. Let us suppose that the dimension of the fibers is constant on an open subset of $S$, and changes on some strata in positive codimension (I have in mind the projectivization of the image of a map of vector bundles, and its degeneracy loci). Is there a formula to compute the cohomology of $X$? (I guess in terms of the classes of the strata).)