The notion of event, experiment and sample space I'm learning basics of the probability theory and trying to map the probability concepts I learnt to the following example from my book (Introduction to Algorithms (or CLRS):

Suppose that we have a fair coin and a biased coin that always comes up heads. We run an experiment consisting of three independent events: we choose one of the two coins at random, we flip that coin once, and then we flip it again. Suppose that the coin we have chosen comes up heads both times. What is the probability that it is biased?

I'm confused with what the author here means by an experiment and by an event? What's the sample space in this problem?
My thoughts: the experiment here is actually "choose a coin, flip it twice" meaning that a possible outcome of this experiment is, for example, "biased coin, two heads" or "fair coin, head, tail" etc. Therefore this means that this "biased coin, two heads" and this "fair coin, head, tail" are elementary events.
Consequently our sample space is something like
$$ S = \{ \text{(F, TT), (F, HT), (F, TH), (F, HH), (B, HH)} \} $$
Therefore events should be subsets of the $S$, but author's event is like "choose a coin" or "flip coin first time" which are definitely can't be subsets of $S$.
Where am I wrong and what's exactly the author means by his experiment and events and how they are related to the sample space concept.
 A: 
My thoughts: the experiment here is actually "choose a coin, flip it
twice" meaning that a possible outcome of this experiment is, for
example, "biased coin, two heads" or "fair coin, head, tail" etc.
Therefore this means that this "biased coin, two heads" and this "fair
coin, head, tail" are elementary events.
Consequently our sample space is something like
$$ S = \{ \text{(F, TT), (F, HT), (F, TH), (F, HH), (B, HH)} \} $$

Yes, your explanation and illustration of the terminology (which I've boldfaced) are exactly correct.

Therefore events should be subsets of the $S$,

Yes, and this experiment has $2^5=32$ distinct events associated with it.

but author's event is
like "choose a coin" or "flip coin first time" which are definitely
can't be subsets of $S$.

Yes, because these are experiment trials, not events.
Although it is common to associate trials with events— e.g., the event of landing Tail in the first flip is $\{FTT,FTH\}$ and the event of landing Head in the first flip is $\{FHT,FHH,BHH\}$ —this clearly isn't what author means either.
A: *

*The experiment is what you actually do: "you choose one of the two coins at random, you flip that coin once, and then you flip it again"


*The sampe space is exactly what you stated


*An Event is each element of the sample space


*Of course any event of you sample space is composed by 3 elementary events; the first related to the choice of the coin and the other two related to the coin's outcomes
Thus the solution is
$$P(B|HH)=\frac{P(B,HH)}{P(F,HH)+P(B,HH)}=\frac{\frac{1}{2}\times1}{\frac{1}{2}\times \frac{1}{4}+\frac{1}{2}\times1}=\frac{4}{5}$$
