The pinocchio algorithm: pinpointing orbit-crossing collapsed hierarchical objects in a linear density field