How to calculate the expectation of a "ceiling" normal distribution besides Monte Carlo? Let's say I have a random variable B transformed from a standard normal distribution. When the value is larger than 1, it is set to be 0. Is there an analytical way to get the expectation of random variable B?
 A: One approach is (in outline form) as follows: 
You can write the distribution of $B$ as a mixture of a truncated normal and a variable that's constant at 0.
You can then write an expression for the mean of the truncated normal easily enough, via standard methods, obtaining a result in terms of the density and cdf of a standard normal evaluated at the truncation point (i.e. $-\phi(1)/\Phi(1)\approx -0.2876000$). 
The expectation of the mixture is straightforward (via the law of total expectation, for example), it's the sum of the component expectations times their mixing proportions (component weights). Since the spike at $0$ has expectation $0$, you just end up with the expectation of the truncated normal times its mixing proportion (which proportion is just the denominator of the above expression), leaving you with an expectation of $-\phi(1)$ ($\approx -0.24197$).
Checking via simulation:
x <- rnorm(1000000)
mean(ifelse(x>1,0,x))
[1] -0.2419247

seems to fit with the analytical calculation $E(B)=-\phi(1)$.
[This is not necessarily the simplest possible way to tackle the problem.]
