Pooing on the floor

Hi  

Mu daughter is 3 and a half years old and waiting her assessment. 

Through the day she is completely clean and toilet trained. On a night once shes in her room she wees and poos in the carpet in her bedroom and often picks it up or rubs it into the carpet. 

Any ideas of what I can do to break the cycle of her doing this on an evening?? 

Thank you.