Every obstacle that you put between people and their goals have a filtering effect. If you catch X% of terrorists, then the number of attacks will drop by X%, to a first approximation at least. Keep in mind that most terrorists aren't geniuses and that terrorist have limited amounts of motivation and imagination.
It is true that the government and other security workers are incompetent, but that incompetence is not complete and utter, it is only partial, which means that it can be measured as a percentage. If you have a system that ought to catch X% of terrorists, but the operators only manage to use it correctly half of the time, the system will catch X/2 % of attempts.
Most people are not imaginative enough to think of novel ways of doing things, so it makes a lot of sense to come up with ways of preventing "the last attack" if there is a cheap and reasonably effective way of doing so. Most of the time there isn't a cheap and efficient way, like with Friday's attack in Paris. It is probably fundamentally impossible to detect rifles in urban areas using any kind of small and cheap technology.
Would-be terrorist might easily over-estimate the effectiveness of these measures and be unnecessarily and unproportionally deterred, since they like most people probably don't realise how ineffective these systems usually are. If Islamic terrorists had kept trying to check in bombs as luggage at airports and then not boarding the planes they would easily have slipped quite a few bombs past the system by now, but when measures where installed, the Islamists basically stopped trying and began to resort to highjacking planes at gunpoint instead. It was not until 2001 that they realised that you could kill more victims by doing suicide attacks. That took a good while for them to figure out.
The new measures that were installed after 9/11 are incredibly expensive in terms of manpower and equipment and not very hard to bypass, so I doubt that they make sense (you could probably lower the risk of terror more by using the money elsewhere), but I don't doubt that they do deter would-be terrorists to some extent.