Sure you can. I've used a ps3 controller on my PC. I don't recommend it though if you have a 360 controller. The ps3 controller driver I was trying to use was a hassle and the should buttons were a headache to get to work right.
You can use both but be warned, if you use either one in a fps on a pc you will get your button kicked...... Bad. A mouse and keyboard is much more precise at moving and aiming then a controller that it buts you at an unfair disadvantage.
You can connect your PS3 controller to your pc but it's really not worth it. I'd suggest using Xbox 360 controller if you insist on playing Black Ops 2 with it. Games compatibility is much better with 360 controller and you won't have any problems with drivers.
I have used both and really for PC gaming the Xbox 360 controller is the best. If I could get my Xbox controller working on my PS3 I would use that instead. For me the PS3 controller is not near as good as the Xbox.
Note a lot of games make use of the XInput API, which a lot of gamepads do NOT work well with. Most common symptom is spinning in circles (any Unreal 3 game). Easy fix is to use x360CE (Xbox 360 Controller Emulator) to map your controllers buttons to the corresponding Xbox 360 controller buttons, basically fooling the game into thinking you are using a 360 controller.