The neocortex plays a central role in higher brain functions, including perception, memory and motor control. Yet, basic anatomical and physiological features are similar across different cortical areas, suggesting that similar principles govern cortical functions. Our overarching research goal is to understand how tactile stimuli are represented by the somatosensory cortex and what enables their perception. Using in-vivo recordings, calcium imaging and optogenetics in awake mice, we study how neurons integrate excitatory and inhibitory inputs from local and distal sources and how their activity is affected by the history of stimulation as well as by the animal’s behavioral state.