One locator will be cameras center of interest that is in focus and other one drives range of focus. So you don’t need to manually take measures… input in camera attributes. Or you can parent you locator on moving object in scene and than its always in focus of your camera.
For this tutorial we’ll use some simple expressions and basic parenting. So you need to give right names for your objects so your expressions can work. I’ll live names on maya default names.
So let’s start.
First you need to create one camera with aim and position that camera on greed like in picture. Camera creation can be found in menu’s Create/ Cameras/Camera and aim
You should position you camera like in picture. Aim of camera should be snapped on greed. You snap with X keyboard button.

Now you should create measure tool called Distance tool that measure distance between two locators that you create with that tool. Distance tool can be found in
Create / Measure tools / distance tool
Create measure tool with pressed X on keyboard so you can create with snap function. One click near to camera lens and other click on camera target so you need to end with something like this :

Now we should make some parenting that make right hierarchy for camera rig. You parent like you select first object that want to be child in hierarchy and shift select second object that need to be parent and pres P on keyboard
So you need to parent :
1 Cameras aim on locator that is on place of that aim.
2. locator that is on lens position parent on camera
Be sure that you do this steps correctly! To test Rig, if you move camera locator should be following camera and if you move second locator aim should follow locator. And you hierarchy in outliner should look something like this:

If everything is correct than we can proceed. Now you should make another distance tool. And position locators for that distance tool like :
1.first locator on same place like locator that is on camera lens
2.Second locator somewhere in between camera and target.
And after that parent first locator also on camera and second one to locator that is on camera aim.
Should look like this now:

Now rig is complete just need to connect parameters with expressions.
Basic idea is to take measure from first distance tool and make that measure driver for focus distance.
And difference from those two measures driver for focus stop.
So if you look on the picture above. Focus distance should be 15 and focus stop 7.
So lets make those expression connections.
You make expressions in expression editor. First you need to enable depth of field in camera attributes. Pres RMB on focus distance and hold until you get pull down menu and choose “create new expression” expression editor should open after that.

For next steps.. if you changed names in you scene for some objects. Camera or locators you need to change names in expression to if you don’t won’t work! So you need to adjust expression to match your naming in your scene.
So in expression editor you should put next lines:
cameraShape1.focusDistance = distanceDimensionShape1.distance;
cameraShape1.fStop = distanceDimensionShape1.distance - distanceDimensionShape2.distance;
so you can see.. that for focus distance I took measure from first distance tool and for focus stop difference of those two measure tools.
If everything ok in camera attributes for f stop and Focus distance color should be changed in some purple color! That means all connected right and now those inputs are driven with expressions.

now your rig is finished! :)
You can save scene like this and reuse this camera later if you need in some scene.
And how this work really… you can position camera aim locator on some place and you can be sure that object will be in focus, and with other locator that is in between camera and aim you can change range of focus. Closer to aim you range will be smaller and opposite.
Hope this was clear enough and you can find use of this rigs in your scenes. This rig is special effective if you have some moving object in scene and you want to have that object always in focus. You just need to parent aim locator to object and you’re done! :)
Here’s the test render. I just made 2 boxes. Put locator on box which I want to be in focus and moved second locator where I want my focus area to stop! And that’s it!
Happy DOF-ing! ;)