50 INT
tof_ana(EVENT_HEADER*,
void*);
64 (
const char **)tof_ana_param_str,
88 char title[256], name[256];
92 cm_get_experiment_database(&hDB, NULL);
93 db_create_record(hDB, 0,
"/Equipment/Trigger/Variables/POSI", strcomb(posi_bank_str));
97 sprintf(name,
"hTOF%02d", i);
103 hTOFHist[i] = H1_BOOK(name, title, nbin, xlow, xhigh);
109 sprintf(title,
"%s, Ext. ON, Run %s_%04d", tof_ana_param.
histotitles.
toftitles.titles[i-N_TOFHIST],
114 hTOFHist[i] = H1_BOOK(name, title, nbin, xlow, xhigh);
119 sprintf(name,
"hProj%02d", i);
125 hProjHist[i] = H1_BOOK(name, title, nbin, xlow, xhigh);
136 hProjHist[i] = H1_BOOK(name, title, nbin, xlow, xhigh);
141 sprintf(name,
"hPos%02d", i);
147 hPosHist[i] = H2_BOOK(name, title, nbin, xlow, xhigh, nbin, xlow, xhigh);
158 hPosHist[i] = H2_BOOK(name, title, nbin, xlow, xhigh, nbin, xlow, xhigh);
183 sprintf(title,
"%s, Ext. ON, Run %s_%04d", tof_ana_param.
histotitles.
toftitles.titles[i-N_TOFHIST],
204 if ( i == 2 || i == 3 )
205 sprintf(title,
"%s, Ext. OFF, %d - %d Run %s_%04d",
219 if ( i == 2+N_POSHIST || i == 3+N_POSHIST )
220 sprintf(title,
"%s, Ext. ON, %d - %d Run %s_%04d",
258 INT
tof_ana(EVENT_HEADER *pheader,
void *pevent)
262 float tof_TD_M2F, tof_TD_M2R;
263 float x, y, x1, x2, y1, y2, timesum;
266 BOOL TIMEcut, SUMcut, TOFcut, foundTD, foundM2, foundBC;
268 INT difftime_last, difftime_now;
271 n = bk_locate(pevent,
"TDC0", &ptdc);
281 TIMEcut = SUMcut = TOFcut = foundM2 = foundTD = foundBC = FALSE;
282 memset(&counter, 0x00,
sizeof(counter));
283 memset(&tdc_data, 0x00,
sizeof(tdc_data));
285 for (i = 1; i < n; i++){
291 tdc_data[channel][counter[channel]] = lem_data->
data;
314 tof_TD_M2F = (float) (tdc_data[
MCP2F][0] - tdc_data[
TD][0]);
315 tof_TD_M2R = (float) (tdc_data[
MCP2R][0] - tdc_data[TD][0]);
316 x1 = (float) (tdc_data[
MCP2X1][0] - tdc_data[
MCP2F][0]);
317 x2 = (float) (tdc_data[
MCP2X2][0] - tdc_data[MCP2F][0]);
318 y1 = (float) (tdc_data[
MCP2Y1][0] - tdc_data[MCP2F][0]);
319 y2 = (float) (tdc_data[
MCP2Y2][0] - tdc_data[MCP2F][0]);
320 timesum = x1 + x2 + y1 + y2;
345 bk_create(pevent,
"POSI", TID_STRUCT, (
void**)&pposi);
348 bk_close(pevent, pposi+1);
350 if ((tof_ana_param.
timemin <= x1 && x1 <= tof_ana_param.
timemax) &&
368 if ( TIMEcut && SUMcut ){
369 if ( ptdc[0] & EXTOFF1_FLAG){
372 hPosHist[4]->Fill(x1+x2, x1-x2, 1.);
373 hPosHist[5]->Fill(y1+y2, y1-y2, 1.);
377 if ( ptdc[0] & EXTON1_FLAG){
386 if (TIMEcut && SUMcut && TOFcut ){
387 if ( ptdc[0] & EXTOFF1_FLAG){
393 if ( ptdc[0] & EXTON1_FLAG){
436 difftime_now = difftime_last = 0.;
439 if ( counter[i] == 0 )
continue;
440 difftime_last = tdc_data[i][0] - tdc_data[
TD][0];
443 hTOFHist[7]->Fill( (
float) difftime_last, 1.);
446 hTOFHist[9]->Fill( (
float) difftime_last, 1.);
450 hTOFHist[10]->Fill( (
float) difftime_last, 1.);
454 hTOFHist[11]->Fill( (
float) difftime_last, 1.);
458 hTOFHist[12]->Fill( (
float) difftime_last, 1.);
487 difftime_now = difftime_last = -2*trigger_settings.
tof_bc_window;
490 if ( counter[i] == 0 )
continue;
491 for (j = 0; j<counter[i]; j++){
492 difftime_now = tdc_data[i][j] - tdc_data[
MCP2F][0];
493 if ( (difftime_now < 0) &&
495 (difftime_now > difftime_last))
496 difftime_last = difftime_now;
498 if ( counter[i] > 0 )
break;
503 hTOFHist[8]->Fill( (
float) difftime_last, 1.);
506 hTOFHist[13]->Fill( (
float) difftime_last, 1.);
510 hTOFHist[14]->Fill( (
float) difftime_last, 1.);
514 hTOFHist[15]->Fill( (
float) difftime_last, 1.);
518 hTOFHist[16]->Fill( (
float) difftime_last, 1.);
static TH2F * hPosHist[2 *N_POSHIST]
POSI_BANK_STR(posi_bank_str)
INT tof_eor(INT run_number)
struct TOFANAMODULE_PARAM::@4::@8 positiontitles
TOFANAMODULE_PARAM tof_ana_param
struct TOFANAMODULE_PARAM::@5::@10 projbin
struct TOFANAMODULE_PARAM::@5::@11 positionbin
#define EXTON1_FLAG
flag for "red/green", "on/off" mode: ON
RUNINFO runinfo
/Runinfo ODB key, defined in from midas.h
ANA_MODULE tof_ana_module
static TH1F * hProjHist[2 *2]
struct TRIGGER_SETTINGS::@19 event_1_settings
INT tof_bor(INT run_number)
static TH1F * hTOFHist[2 *N_TOFHIST]
INT tof_ana(EVENT_HEADER *, void *)
#define DATA_N_HITS
max. of DATA_N_HITS in data file
TOFANAMODULE_PARAM_STR(tof_ana_param_str)
TObjArray * gHistoFolderStack
struct TOFANAMODULE_PARAM::@5::@9 tofbin
#define EXTOFF1_FLAG
flag for "red/green", "on/off" mode: OFF
struct TOFANAMODULE_PARAM::@4::@6 toftitles
struct TOFANAMODULE_PARAM::@4 histotitles
TRIGGER_SETTINGS trigger_settings
/Equipment/Trigger/Settings
#define N_TDC_CHANNELS
number of TDC channels
struct TOFANAMODULE_PARAM::@4::@7 projtitles
#define N_OFFSET_ONOFF_HISTOGRAMS
ID offset for "on/off", "red/green" histograms: no offset means "off".
#define EVENT_0_TYPE
EVENT type 0 = BC-MCP1-(e+)
TFolder * gManaHistosFolder
struct TOFANAMODULE_PARAM::@5 histobinning