4) Relative Gain Calibration with MIPs

Under:

Getting Started

1) The code needed to perform the gain calibrations can be checked out from CVS and compiled. In your working directory, do:

cvs co StRoot/StEmcPool/StEmcOfflineCalibrationMaker/
cons

You can move the required files to your working directory, or make soft links. You need the following files, which are in the macros/ directory:
-- bemcCalibMacro.C
-- btow_mapping.20030401.0.txt
-- CalibrationHelperFunctions.cxx
-- CalibrationHelperFunctions.h
-- electron_drawfits.C
-- electron_histogram_maker.C
-- electron_master.C
-- electron_master_alt.C
-- electron_tree_maker.C
-- geant_fits.root
-- mip_histogram_fitter.C
-- mip_histogram_maker.C
-- SubmitCalibJobs.pl
-- runMIPjobs.sh
-- runElecJobs.sh
-- runFinalElecJobs.sh

Some of the files have lists of triggers which need to be hard-coded in for each year.  In particular, in bemcCalibrationMacro.C you should ensure that the correct trigger list is present, and the trigger IDs for the HT triggers need to be written in StEmcOfflineCalibrationMaker.cxx.  (In most cases I have already typed in the values for Run 11, but they are commented out while the Run 9 values are commented in.)  If you want to use the TOF information (in Run 11 and beyond), there are some lines of code that need to be commented in in StEmcOfflineCalibrationMaker.cxx. 

Generating Trees

2) Generate the list of runs with the following command (for Run 9)
get_file_list.pl -keys "runnumber" -distinct -cond "production=P11id,filetype=daq_reco_MuDst,sanity=1,trgsetupname=production2009_200GeV_Single,filename~st_physics,tpx=1,emc=1,storage!=HPSS" -limit 0 | sort -u > runlist.txt

or similar for other years.

3) Run SubmitCalibJobs.pl, which will execute the bemcCalibMacro.C macro.  Make sure that the correct catalog query lines are commented in/out in the submit script.  Also ensure that the appropriate directories exist ($workingDir, $schedDir, $outDir, $logDir, $scriptDir) as specified at the top of the submit script.

This macro creates trees which store primary tracks which will be further analyzed for the calibration.  For each primary track we write out the track information from the TPC, the EMC information for the 3x3 tower cluster around the track, the TOF information (in Run 11 and beyond), and the trigger information. 

The trees created by this step are stored on HPSS here:
Run 9: /home/aohlson/bemcCalib2009_x.tar where x=0,...,9
Run 11: /home/aohlson/bemcCalib2011_05_x.tar where x=0,...,14 and /home/aohlson/bemcCalib2011_07_x.tar where x=0,...,18

MIP calibration

The relative gain calibration is obtained by finding the MIP peak in each of the 4800 BEMC towers. 

The MIP energy deposit has the following functional form, which was determined from test beam data and simulations:
MIP = (264 MeV)×(1+0.056η2)/sin(θ)

From this expression we can calculate a calibration constant
C = 0.264×(1+0.056η2)/(ADCMIP×sin(θ))
where ADCMIP is the location of the MIP peak in the ADC spectrum.  This allows us to combine towers at the same η and thus find the absolute gain calibration in each crate-slice using electrons (see next section).

The procedure for obtaining the MIP calibration is as follows...
4) Make the MIP histograms with runMIPjobs.sh which executes mip_histogram_maker.C  Ensure that the correct output filenames are specified in the submit script.

Events with |vz| < 30 cm are selected, and any towers that have multiple tracks associated with them are excluded.  We select tracks with p > 1 GeV/c, and require that they enter and exit the same tower.  We require that the towers surrounding the central tower do not contain a large energy deposition.  We require that ADC-ped > 1.5*pedRMS.  After these track quality cuts we fill histograms with the ADC-ped values for each tower. 

5) Make a list of the output files from step (4) called mips.list.  Run mip_histogram_fitter.C

We fit each histogram with a gaussian on a pedestal; the histograms and fits are shown in mip.pdf. If the fit values fail basic quality cuts (such as if the mean is < 5), then the tower is assigned a bad status (!=1).  These fits are marked as red in mip.pdf.  For each tower we record the mean and sigma of the gaussian fit, and the status.

6) Check mip.pdf by eye to look for any other towers which were obviously bad.  Write a function like isBadTower2009(int id) (see examples in the code) which identifies these bad towers so that they can be assigned a bad status.  You can either put this function in mip_histogram_fitter and re-run it, or you can put it in the electron codes.  Note that most of the towers with bad MIP peaks were marked as bad (cold/hot/stuck bit) towers when the status/pedestal tables were originally computed.