CADC_BANK *cadc; PRIV_BANK *priv; ... n = bk_locate(pevent, "CADC", &cadc); ... bk_create(pevent, "PRIV", TID_STRUCT, &priv); priv->x = cadc->adc_sum * 2; bk_close(pevent, priv+1);
extern ANA_MODULE
private_module;
to the list of modules. Next, add a reference
to your module to the trigger_module list like
ANA_MODULE *trigger_module[] = { &adc_calib_module, &mwpc_calib_module, &angle_module, &private_module, NULL };Then add your new bank to the list of calculated banks:
PRIV_BANK_STR(priv_bank_str); ... /* calculated banks */ { "CADC", TID_STRUCT, sizeof(CADC_BANK), CADC_BANK_STR }, { "MWPC", TID_STRUCT, sizeof(MWPC_BANK), MWPC_BANK_STR, mwpc_bank_str }, { "PRIV", TID_STRUCT, sizeof(PRIV_BANK), PRIV_BANK_STR, priv_bank_str }, { "" },By default, all new banks are included in the output. If you want to disable a bank to be written to the output, change the flag
/Analyzer/Banks/[bank]
to zero.
Start "odbedit" in the analyzer directory and go to the variable definition of event "trigger":
> odbedit [local]/> cd /equipment/trigger/variables [local]/Equipment/Trigger/Variables> lsAs you can see, there are already a couple of banks defined. Banks with fixed length like ANGL are actually a subdirectory. You can examine their contents with "ls angl". Now create a bank PRIV with a value "New sum" of type double (real*8). Then create a parameter "gain" for the module "private":
[local]/Equipment/Trigger/Variables> cr key PRIV [local]/Equipment/Trigger/Variables> cd PRIV [local]/Equipment/Trigger/Variables/PRIV> cr double "New sum" [local]/Equipment/Trigger/Variables/PRIV> ls [local]/Equipment/Trigger/Variables/PRIV> cd /analyzer/parameters [local]/Analyzer/Parameters> cr key Private [local]/Analyzer/Parameters> cd Private [local]/Analyzer/Parameters/Private> cr double "Gain" [local]/Analyzer/Parameters/Private> lsNow this information has to be propagated to the compiler in form of C-structures. This is done automatically by issuing the "make" command in odbedit. This command creates a new experim.h file which contains C-structures which map the new bank PRIV and the parameters for module "Private". Have a look at experim.h. You will find PRIV_BANK and PRIVATE_PARAM which are used in your private.c. Note that "New sum" has been converted to new_sum since a C variable cannot contain blanks.
analyzer -i run00122.mid -o res00122.asc -n 100Look at res00122.asc. Note that you see a new bank PRIV starting with "BK PRIV TP STRUCT SZ 8" containg a single value "New sum" being zero. Now you can change your gain value and re-analyze the data:
analyzer -i run00122.mid -o res00122.asc -p parameters/private/gain=1Note how your "New Sum" in the output file changed with the new gain value.
> cd ~/analyzer > odbedit [local]/> cd /Equipment/Trigger/Variables/PRIV [local]/Equipment/Trigger/Variables/PRIV> cr double "New sum 2" [local]/Equipment/Trigger/Variables/PRIV> cd /analyzer/parameters/private [local]/Analyzer/Parameters/Private> cr double "Gain 2" [local]/Analyzer/Parameters/Private> make [local]/Analyzer/Parameters/Private> quit [edit private.c, use priv->new_sum_2 and private_param.gain_2] > make > cd data > analyzer -i run00122.mid -o res00122.ascIn case of questions, first look in the FAQ list.
S. Ritt, 2 May 1997