53 INT
tof_ana(EVENT_HEADER*,
void*);
67 (
const char **)tof_ana_param_str,
91 char title[256], name[256];
95 cm_get_experiment_database(&hDB, NULL);
96 db_create_record(hDB, 0,
"/Equipment/Trigger/Variables/POSI", strcomb(posi_bank_str));
100 sprintf(name,
"hTOF%02d", i);
106 hTOFHist[i] = H1_BOOK(name, title, nbin, xlow, xhigh);
112 sprintf(title,
"%s, Ext. ON, Run %s_%04d", tof_ana_param.
histotitles.
toftitles.titles[i-N_TOFHIST],
117 hTOFHist[i] = H1_BOOK(name, title, nbin, xlow, xhigh);
121 for (i=0; i<2; i++) {
122 sprintf(name,
"hProj%02d", i);
128 hProjHist[i] = H1_BOOK(name, title, nbin, xlow, xhigh);
132 for (i=2; i<4; i++) {
139 hProjHist[i] = H1_BOOK(name, title, nbin, xlow, xhigh);
144 sprintf(name,
"hPos%02d", i);
150 hPosHist[i] = H2_BOOK(name, title, nbin, xlow, xhigh, nbin, xlow, xhigh);
161 hPosHist[i] = H2_BOOK(name, title, nbin, xlow, xhigh, nbin, xlow, xhigh);
186 sprintf(title,
"%s, Ext. ON, Run %s_%04d", tof_ana_param.
histotitles.
toftitles.titles[i-N_TOFHIST],
192 for (i=0; i<2; i++) {
199 for (i=2; i<4; i++) {
207 if ( (i == 2) || (i == 3) )
208 sprintf(title,
"%s, Ext. OFF, %d - %d Run %s_%04d",
222 if ( (i == 2+N_POSHIST) || (i == 3+N_POSHIST) )
223 sprintf(title,
"%s, Ext. ON, %d - %d Run %s_%04d",
261 INT
tof_ana(EVENT_HEADER *pheader,
void *pevent)
265 float tof_TD_M2F, tof_TD_M2R;
266 float x, y, x1, x2, y1, y2, timesum;
269 BOOL TIMEcut, SUMcut, TOFcut, foundTD, foundM2, foundBC;
271 INT difftime_last, difftime_now;
274 n = bk_locate(pevent,
"TDC0", &ptdc);
284 TIMEcut = SUMcut = TOFcut = foundM2 = foundTD = foundBC = FALSE;
285 memset(&counter, 0x00,
sizeof(counter));
286 memset(&tdc_data, 0x00,
sizeof(tdc_data));
288 for (i = 1; i < n; i++) {
294 tdc_data[channel][counter[channel]] = lem_data->
data;
318 tof_TD_M2F = (float) (tdc_data[
MCP2F][0] - tdc_data[
TD][0]);
319 tof_TD_M2R = (float) (tdc_data[
MCP2R][0] - tdc_data[TD][0]);
321 x1 = (float) (tdc_data[
MCP2X1][0] - tdc_data[
MCP2F][0]);
322 x2 = (float) (tdc_data[
MCP2X2][0] - tdc_data[MCP2F][0]);
323 y1 = (float) (tdc_data[
MCP2Y1][0] - tdc_data[MCP2F][0]);
324 y2 = (float) (tdc_data[
MCP2Y2][0] - tdc_data[MCP2F][0]);
325 timesum = x1 + x2 + y1 + y2;
354 bk_create(pevent,
"POSI", TID_STRUCT, (
void**)&pposi);
357 bk_close(pevent, pposi+1);
359 if ((tof_ana_param.
timemin <= x1 && x1 <= tof_ana_param.
timemax) &&
377 if ( TIMEcut && SUMcut ) {
378 if ( ptdc[0] & EXTOFF1_FLAG) {
381 hPosHist[4]->Fill(x1+x2, x1-x2, 1.);
382 hPosHist[5]->Fill(y1+y2, y1-y2, 1.);
386 if ( ptdc[0] & EXTON1_FLAG) {
395 if ( TIMEcut && SUMcut && TOFcut ) {
396 if ( ptdc[0] & EXTOFF1_FLAG ) {
402 if ( ptdc[0] & EXTON1_FLAG ) {
429 difftime_now = difftime_last = 0.;
432 if ( counter[i] == 0 )
continue;
433 if ( counter[i] > 0) {
434 for (j = 0; j<counter[i]; j++) {
435 difftime_last = tdc_data[i][j] - tdc_data[
TD][0];
438 hTOFHist[7]->Fill( (
float) difftime_last, 1.);
441 hTOFHist[9]->Fill( (
float) difftime_last, 1.);
445 hTOFHist[10]->Fill( (
float) difftime_last, 1.);
461 if ( counter[i] == 0 )
continue;
462 if (counter[i] > 0) {
463 for (j = 0; j<counter[i]; j++) {
465 difftime_last = tdc_data[i][j]-tdc_data[
MCP2F][0];
468 hTOFHist[8]->Fill( (
float) difftime_last, 1.);
471 hTOFHist[13]->Fill( (
float) difftime_last, 1.);
475 hTOFHist[14]->Fill( (
float) difftime_last, 1.);
492 float difftime_TDBack = 0;
494 for(
int l=0; l<counter[
MCP2F]; l++) {
495 difftime_TDBack = (float)(tdc_data[
MCP2F][l] - tdc_data[
TD][0]);
497 if (difftime_TDBack < 1800 && difftime_TDBack > 800) {
498 hTOFHist[11]->Fill(difftime_TDBack, 1.);
501 float difftime_TDLya = 0;
502 float difftime_MCP2Lya = 0;
504 for (j=0; j<counter[i]; j++) {
505 difftime_TDLya = (float)(tdc_data[i][j]-tdc_data[TD][0])-66560;
506 difftime_MCP2Lya = 66560-(float)(tdc_data[i][j]-tdc_data[
MCP2F][l]);
508 if (difftime_TDLya > 700 && difftime_TDLya < 900) {
509 if (difftime_MCP2Lya > 400 && difftime_MCP2Lya < 800) {
512 hTOFHist[12]->Fill(difftime_TDBack, 1.);
static TH1F * hProjHist[2 *2]
INT tof_ana(EVENT_HEADER *, void *)
ANA_MODULE tof_ana_module
static TH2F * hPosHist[2 *N_POSHIST]
struct TOFANAMODULE_PARAM::@4::@8 positiontitles
INT tof_eor(INT run_number)
struct TOFANAMODULE_PARAM::@5::@10 projbin
struct TOFANAMODULE_PARAM::@5::@11 positionbin
#define EXTON1_FLAG
flag for "red/green", "on/off" mode: ON
TObjArray * gHistoFolderStack
TRIGGER_SETTINGS trigger_settings
TOFANAMODULE_PARAM_STR(tof_ana_param_str)
struct TRIGGER_SETTINGS::@19 event_1_settings
#define DATA_N_HITS
max. of DATA_N_HITS in data file
struct TOFANAMODULE_PARAM::@5::@9 tofbin
#define EXTOFF1_FLAG
flag for "red/green", "on/off" mode: OFF
struct TOFANAMODULE_PARAM::@4::@6 toftitles
TFolder * gManaHistosFolder
struct TOFANAMODULE_PARAM::@4 histotitles
#define N_TDC_CHANNELS
number of TDC channels
struct TOFANAMODULE_PARAM::@4::@7 projtitles
static TH1F * hTOFHist[2 *N_TOFHIST]
INT tof_bor(INT run_number)
#define N_OFFSET_ONOFF_HISTOGRAMS
ID offset for "on/off", "red/green" histograms: no offset means "off".
TOFANAMODULE_PARAM tof_ana_param
POSI_BANK_STR(posi_bank_str)
#define EVENT_0_TYPE
EVENT type 0 = BC-MCP1-(e+)
struct TOFANAMODULE_PARAM::@5 histobinning