Recent Changes - Search:

BookCrystal

Modify

NOT UPDATED to bookCRY

Introduction

It's suggested that you run check for a basic cross-check each time that you add n-tuple variables or constants in the fortran code. It is extremely welcome that you mail to the mantainer of Book95 the patches that you have done ( please use diff -u) once they are stable.

Usage of constants from init files

Declare that you want a constant from the ini file(s) by adding an entry in f_lbook_user, like call lgetconst(symbolic_name,real_variable)
where
symbolic_name is the name of the entry in the ini file,
real_variable is the variable that will hold the data, of REAL type. Or like
call lgetnconst(symbolic_name,real_variable(1),lenght)
where symbolic_name is the name of the entry in the ini file, real_variable(1) is the first element of the array that will hold the data, lenght is the max number of values the array can contain.

If you have to do calculations on constants, or create new constants, that DO NOT depend on the event values, put them into the f_calc_const subroutine, that is executed only at the beginning of the readout of each .dml file. This will save (a bit) of time in running book95.

Since no way is given to detect whether the call to f_calc_const is the first or not, it is wiser not to modify values that are read out of the ini file, but create new constants instead.

Ok, it's finally time for the interesting stuff, to be written in f_calib; something like xcal(i_calo)=xdc(rlg2)*c_lg2(2)+c_lg2(1)

This example also uses a variable from the non-calculated xdc() array, and a variable from the calculated xcal() array.

If you tought it was enough, i'm sorry you still have to work. First, in book95.inc, add your variable, or array, and any other variable you created in /f_cal_const/, in the /f_cal_const/ common, and declare it real right below it. Second, run the check script. It will (hopefully) tell if you missed any of the steps, or did any other common mistake. Third, write in your ini file the constant(s) that you wanted ! Finally, remake book95 and test it !

Adding calculations/variables in the nutple

Declare that you want a variable in the ntuple by adding an entry in f_lbook_user using call lbook(name,kind,bits,min,max) like call lbook("calo",'R',0,0.,0.) or, if you want to reduce the size of the ntuple you can specify a packing, like call lbook("phiin",'R',16,-pi/2,pi/2) where name (string)
is the name of the ntuple variable, kind (char)
is the kind of data that is stored ( compulsory R for REAL, at present). bits (integer, valid 0-32)
is the number of bits to use for storage (0 stands for the full size = 32 bits in Linux) min, max (real)
is the range that the variable will cover (take care to check this in the calculations, evenctually forcing it to be so, otherwise HBOOK will complain loudly, with a LOT of printout) Now, retrieve the index to access the variable in the xcal() array , adding, in f_get_vars, a line like: idx =lgetcal(name) like i_calo =lgetcal("calo") where
idx (integer)
is the variable to store of the index value, name (string)
is the same name that you used above.

Ok, it's finally time for the interesting stuff, to be written in f_calib using xcal(idx); something like xcal(i_calo)=xdc(rlg2)*c_lg2(2)+c_lg2(1)
This example uses a variable from the non-calculated xdc() array, and constants from the ini file.

If you tought it was enough, i'm sorry you still have to work. First, in book95.inc, add your index variable in the /f_cal/ common, and declare it integer right below it. Second, run the check script. It will (hopefully) tell if you missed any of the steps, or did any other common mistake. Third, check in your ini file that you didn't by chance exclude from storage in the N-tuple just the variable you created - it can happen when using wildcards.

Finally, re-make book95 and test it !

As a general rule, do not add too many variables, because this leads to excessive file sizes on disk and increased analysis times in PAW.

Defining cuts

since you can add calculations and retrieve constants from a setup file, you can use these to setup whatever kind of cut you might imagine. Just write your if statement in f_sel_uncal, if rejection of the event can be decided before any calibration is appiled (in this way avoiding lots of calculations, for that event), or in f_sel_cal, if you need calibrated data. A value of f_sel_cal or f_sel_uncal equal to .false. rejects the event (it will not be written in the N-tuple) Remember that all of the raw and of the calculated variables are always there in memory, no matter what the user chooses about the storage of variables in the ntuple; so all of them can always be accessed.

Edit - History - Print - Recent Changes - Search
Page last modified on October 27, 2007, at 12:26 pm