MIDAS
Loading...
Searching...
No Matches
feoV1720.cxx File Reference
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#include <sched.h>
#include <sys/resource.h>
#include <vector>
#include "midas.h"
#include "CAENComm.h"
#include "ov1720drv.h"
#include "v1720CONET2.hxx"
Include dependency graph for feoV1720.cxx:

Go to the source code of this file.

Macros

#define NBLINKSPERA3818   1
 Number of optical links used per A3818.
 
#define NBLINKSPERFE   1
 Number of optical links controlled by each frontend.
 
#define NB1720PERLINK   2
 Number of daisy-chained v1720s per optical link.
 
#define NBV1720TOTAL   2
 Number of v1720 boards in total.
 
#define EQ_EVID   1
 Event ID.
 
#define EQ_TRGMSK   0
 Trigger mask.
 
#define FE_NAME   "feov1720"
 Frontend name.
 
#define UNUSED(x)   ((void)(x))
 Suppress compiler warnings.
 

Functions

INT frontend_init ()
 Frontend initialization.
 
INT frontend_exit ()
 Frontend exit.
 
INT begin_of_run (INT run_number, char *error)
 Begin of Run.
 
INT end_of_run (INT run_number, char *error)
 End of Run.
 
INT pause_run (INT run_number, char *error)
 Pause Run.
 
INT resume_run (INT run_number, char *error)
 Resume Run.
 
INT frontend_loop ()
 Frontend loop.
 
void interrupt_routine (void)
 Interrupt Service Routine.
 
INT read_trigger_event (char *pevent, INT off)
 Event readout.
 
INT read_scaler_event (char *pevent, INT off)
 Placeholder.
 
void seq_callback (INT hDB, INT hseq, void *info)
 Sequencer callback info.
 
INT poll_event (INT source, INT count, BOOL test)
 Polling routine for events.
 
INT interrupt_configure (INT cmd, INT source, POINTER_T adr)
 Interrupt configuration (not implemented)
 

Variables

HNDLE hDB
 main ODB handle
 
BOOL debug
 debug printouts
 
BOOL debugpolling = false
 debug msgs polling loop
 
BOOL debugtrigger = false
 debug msgs read trigger event
 
charfrontend_name = (char*)FE_NAME
 The frontend name (client name) as seen by other MIDAS clients.
 
charfrontend_file_name = (char*)__FILE__
 The frontend file name, don't change it.
 
BOOL frontend_call_loop = FALSE
 frontend_loop is called periodically if this variable is TRUE
 
INT display_period = 000
 a frontend status page is displayed with this frequency in ms
 
INT max_event_size = 32 * 34000
 maximum event size produced by this frontend
 
INT max_event_size_frag = 5 * 1024 * 1024
 maximum event size for fragmented events (EQ_FRAGMENTED)
 
INT event_buffer_size = 200 * max_event_size + 10000
 buffer size to hold events
 
bool runInProgress = false
 run is in progress
 
bool runOver = false
 run is over
 
bool runStopRequested = false
 stop run requested
 
EQUIPMENT equipment []
 Main structure for midas equipment.
 
vector< v1720CONET2ov1720
 objects for the v1720 modules controlled by this frontend
 
vector< v1720CONET2 >::iterator itv1720
 iterator
 
int Nloop
 Number of loops executed in event polling.
 
int Ncount
 Loop count for event polling timeout.
 

Macro Definition Documentation

◆ EQ_EVID

#define EQ_EVID   1

Event ID.

Definition at line 128 of file feoV1720.cxx.

◆ EQ_TRGMSK

#define EQ_TRGMSK   0

Trigger mask.

Definition at line 129 of file feoV1720.cxx.

◆ FE_NAME

#define FE_NAME   "feov1720"

Frontend name.

Definition at line 133 of file feoV1720.cxx.

◆ NB1720PERLINK

#define NB1720PERLINK   2

Number of daisy-chained v1720s per optical link.

Definition at line 124 of file feoV1720.cxx.

◆ NBLINKSPERA3818

#define NBLINKSPERA3818   1

Number of optical links used per A3818.

Definition at line 122 of file feoV1720.cxx.

◆ NBLINKSPERFE

#define NBLINKSPERFE   1

Number of optical links controlled by each frontend.

Definition at line 123 of file feoV1720.cxx.

◆ NBV1720TOTAL

#define NBV1720TOTAL   2

Number of v1720 boards in total.

Definition at line 125 of file feoV1720.cxx.

◆ UNUSED

#define UNUSED (   x)    ((void)(x))

Suppress compiler warnings.

Definition at line 136 of file feoV1720.cxx.

Function Documentation

◆ begin_of_run()

INT begin_of_run ( INT  run_number,
char error 
)

Begin of Run.

Called every run start transition. Set equipment status in ODB, start acquisition on the modules.

Parameters
[in]run_numberNumber of the run being started
[out]errorCan be used to write a message string to midas.log

Definition at line 471 of file feoV1720.cxx.

471 {
472
473 set_equipment_status(equipment[0].name, "Starting run...", "#FFFF00");
474
475 printf("<<< Begin of begin_of_run\n");
476
478 //we've decided to only initialize at start of frontend
479 //if odb stuff is changed, will need to restart fe to take effect.
480
481 // Reset and Start v1720s
482 for (itv1720 = ov1720.begin(); itv1720 != ov1720.end(); ++itv1720) {
483 if (! itv1720->IsConnected()) continue; // Skip unconnected board
484 printf("Starting module iBoard %d\n", itv1720->GetModuleID());
485 // Reset card (Alex) Moved to the beginning
486 //sCAEN = ov1720[iBoard]->WriteReg(v1720_SW_RESET, 0x1);
487 //sCAEN = ov1720[iBoard]->WriteReg(v1720_SW_CLEAR, 0x1);
488 // Start run then wait for trigger
489 itv1720->StartRun();
490 }
491
492 runInProgress = true;
493
494 printf(">>> End of begin_of_run\n\n");
495 set_equipment_status(equipment[0].name, "Started run", "#00ff00");
496
497 return (sCAEN == CAENComm_Success ? SUCCESS : sCAEN);
498}
bool runInProgress
run is in progress
Definition feoV1720.cxx:168
vector< v1720CONET2 > ov1720
objects for the v1720 modules controlled by this frontend
Definition feoV1720.cxx:241
EQUIPMENT equipment[]
Main structure for midas equipment.
Definition feoV1720.cxx:191
vector< v1720CONET2 >::iterator itv1720
iterator
Definition feoV1720.cxx:242
#define SUCCESS
Definition mcstd.h:54
int set_equipment_status(const char *name, const char *equipment_status, const char *status_class)
Definition mfe.cxx:884
#define name(x)
Definition midas_macro.h:24
TH1X EXPRT * h1_book(const char *name, const char *title, int bins, double min, double max)
Definition rmidas.h:24
Here is the call graph for this function:

◆ end_of_run()

INT end_of_run ( INT  run_number,
char error 
)

End of Run.

Called every stop run transition. Set equipment status in ODB, stop acquisition on the modules.

Parameters
[in]run_numberNumber of the run being ended
[out]errorCan be used to write a message string to midas.log

Definition at line 509 of file feoV1720.cxx.

509 {
510
512
513 set_equipment_status(equipment[0].name, "Ending run...", "#FFFF00");
514
515 printf("<<< Beging of end_of_run \n");
516 // Stop run
518
519 for (itv1720 = ov1720.begin(); itv1720 != ov1720.end(); ++itv1720) {
520 if (itv1720->IsConnected()) { // Skip unconnected board
521 sCAEN = itv1720->StopRun();
522 }
523 }
524
525 runOver = false;
526 runStopRequested = false;
527 runInProgress = false;
528
529#if SIMULATION
530 sCAEN = ov1720[0].Poll(&buffLvl);
531#else
532 sCAEN = ov1720[0].Poll(&buffLvl);
533 if(buffLvl != 0x0) {
534 cm_msg(MERROR, "feov1720:EOR", "Events left in the v1720: %d",buffLvl);
535 }
536#endif
537
538 printf(">>> End Of end_of_run\n\n");
539 set_equipment_status(equipment[0].name, "Ended run", "#00ff00");
540
541 return (sCAEN == CAENComm_Success ? SUCCESS : sCAEN);
542}
bool runOver
run is over
Definition feoV1720.cxx:169
bool runStopRequested
stop run requested
Definition feoV1720.cxx:170
unsigned int DWORD
Definition mcstd.h:51
#define MERROR
Definition midas.h:559
INT cm_msg(INT message_type, const char *filename, INT line, const char *routine, const char *format,...)
Definition midas.cxx:915
Here is the call graph for this function:

◆ frontend_exit()

INT frontend_exit ( void  )

Frontend exit.

Runs at frontend shutdown. Disconnect hardware and set equipment status in ODB

Returns
Midas status code

Definition at line 449 of file feoV1720.cxx.

449 {
450
451 set_equipment_status(equipment[0].name, "Exiting...", "#FFFF00");
452
453 for (itv1720 = ov1720.begin(); itv1720 != ov1720.end(); ++itv1720) {
454 if (itv1720->IsConnected()){
455 itv1720->Disconnect();
456 }
457 }
458 set_equipment_status(equipment[0].name, "Exited", "#00ff00");
459 return SUCCESS;
460}
Here is the call graph for this function:

◆ frontend_init()

INT frontend_init ( void  )

Frontend initialization.

Runs once at application startup. We initialize the hardware and optical interfaces and set the equipment status in ODB. We also lock the frontend to once physical cpu core.

Returns
Midas status code

Definition at line 280 of file feoV1720.cxx.

280 {
281
282 set_equipment_status(equipment[0].name, "Initializing...", "#FFFF00");
283
284 // --- Suppress watchdog for PICe for now
286
287#if SIMULATION
288 for (int iBoard=0; iBoard < Nv1720; iBoard++)
289 {
290 printf("<<< Init board %i\n", iBoard);
291 ov1720.push_back(v1720CONET2(iBoard));
292 ov1720[iBoard].verbose = 1;
293
294 //load ODB settings
295 ov1720[iBoard].SetODBRecord(hDB,seq_callback);
296
297 // Open Optical interface
299 sCAEN = ov1720[iBoard].Connect();
300 if (sCAEN != CAENComm_Success) {
301 cm_msg(MERROR, "fe", "Could not connect to board; error:%d", sCAEN);
302 }
303 else {
304 printf("Connected successfully to module; handle: %d\n",ov1720[iBoard].GetHandle());
305
306 ov1720[iBoard].InitializeForAcq();
307 ov1720[iBoard].mZLE = false;
308 }
309 }
310
311 // Lock to one core on the processor. Need to be moved to TFeCommon
313 CPU_ZERO(&mask);
314 CPU_SET(4, &mask); // arbitrarily chose 4
315 if( sched_setaffinity(0, sizeof(mask), &mask) < 0 ){
316 printf("ERROR: affinity not set\n");
317 }
318 printf(">>> End of Init.\n\n");
319#else
320 // --- Get the frontend index. Derive the Optical link number
322
323 int tNActivev1720=0; //Number of v1720 boards activated at the end of frontend_init
324
325 // If no index was supplied on the command-line, assume 1 frontend
326 // to control all the links and boards
327 if(feIndex == -1){
328
329 printf("<<< No index supplied! Assuming only 1 frontend only and starting all boards on all links\n");
330 for (int iLink=0; iLink < NBLINKSPERA3818; iLink++)
331 {
332 for (int iBoard=0; iBoard < NB1720PERLINK; iBoard++)
333 {
334 printf("<<< Begin of Init \n link:%i, board:%i\n", iLink, iBoard);
335
336 // Compose unique module ID
338
339 // Create module objects
341 ov1720.back().verbose = 1;
342
343 // Setup ODB record (create if necessary)
344 ov1720.back().SetODBRecord(hDB,seq_callback);
345
346 // Open Optical interface
347 printf("Opening optical interface Link %d, Board %d\n", iLink, iBoard);
349 sCAEN = ov1720.back().Connect();
350 if (sCAEN != CAENComm_Success) {
351 cm_msg(MERROR, "fe", "Link#:%d iBoard#:%d error:%d", iLink, iBoard, sCAEN);
352 }
353 else {
355 printf("Link#:%d Board#:%d Module_Handle[%d]:%d (active:%d)\n",
356 iLink, iBoard, moduleID, ov1720.back().GetHandle(), tNActivev1720);
357
358 ov1720.back().InitializeForAcq();
359
360 }
361 }
362 }
363 }
364 else { //index supplied
365
367 printf("Incorrect setup: the number of boards controlled by each frontend"
368 " is not a fraction of the total number of boards.");
369 }
370
373 printf("Front end index must be between 0 and %d\n", maxIndex);
374 exit(1);
375 }
376
378 int lastLink = firstLink + NBLINKSPERFE - 1;
379 for (int iLink=firstLink; iLink <= lastLink; iLink++)
380 {
381 for (int iBoard=0; iBoard < NB1720PERLINK; iBoard++)
382 {
383
384 printf("<<< Begin of Init \n feIndex:%i, link:%i, board:%i\n",
386
387 // Compose unique module ID
389
390 // Create module objects
392 ov1720.back().verbose = 1;
393
394 // Setup ODB record (create if necessary)
395 ov1720.back().SetODBRecord(hDB,seq_callback);
396
397 // Open Optical interface
398 printf("Opening optical interface Link %d, Board %d\n", iLink, iBoard);
400 sCAEN = ov1720.back().Connect();
401 if (sCAEN != CAENComm_Success) {
402 cm_msg(MERROR, "fe", "Link#:%d iBoard#:%d error:%d", iLink, iBoard, sCAEN);
403 }
404 else {
406 printf("Link#:%d Board#:%d Module_Handle[%d]:%d (active:%d)\n",
407 iLink, iBoard, moduleID, ov1720.back().GetHandle(), tNActivev1720);
408
409 ov1720.back().InitializeForAcq();
410 }
411 }
412 }
413 }
414
415 // Lock to one core on the processor. Need to be moved to TFeCommon
417 CPU_ZERO(&mask);
418 CPU_SET(4, &mask); // arbitrarily chose 4
419 if( sched_setaffinity(0, sizeof(mask), &mask) < 0 ){
420 printf("ERROR: affinity not set\n");
421 }
422
423 if(feIndex == -1 )
424 printf(">>> End of Init. %d active v1720. Expected %d\n\n",
426 else
427 printf(">>> End of Init. %d active v1720. Expected %d\n\n",
429#endif //SIMULATION
430
431
432 set_equipment_status(equipment[0].name, "Initialized", "#00ff00");
433
434#if SIMULATION
435 printf("*** RUNNING SIMULATION ***\n");
436#endif
437
438 return SUCCESS;
439}
#define FALSE
Definition cfortran.h:309
void seq_callback(INT hDB, INT hseq, void *info)
Sequencer callback info.
Definition feoV1720.cxx:258
#define NBV1720TOTAL
Number of v1720 boards in total.
Definition feoV1720.cxx:125
#define NB1720PERLINK
Number of daisy-chained v1720s per optical link.
Definition feoV1720.cxx:124
#define NBLINKSPERFE
Number of optical links controlled by each frontend.
Definition feoV1720.cxx:123
HNDLE hDB
main ODB handle
Definition mana.cxx:207
#define NBLINKSPERA3818
Number of optical links used per A3818.
Definition feoV1720.cxx:122
INT cm_set_watchdog_params(BOOL call_watchdog, DWORD timeout)
Definition midas.cxx:3283
INT get_frontend_index()
Definition mfe.cxx:2391
#define mask(slot)
Definition midas_macro.h:54
Here is the call graph for this function:

◆ frontend_loop()

INT frontend_loop ( void  )

Frontend loop.

If frontend_call_loop is true, this routine gets called when the frontend is idle or once between every event.

Returns
Midas status code

Definition at line 584 of file feoV1720.cxx.

585{
586 char str[128];
587 static DWORD evlimit;
588
589 if (runStopRequested && !runOver) {
590 db_set_value(hDB,0,"/logger/channels/0/Settings/Event limit", &evlimit, sizeof(evlimit), 1, TID_DWORD);
591 if (cm_transition(TR_STOP, 0, str, sizeof(str), ASYNC, FALSE) != CM_SUCCESS) {
592 cm_msg(MERROR, "feov1720", "cannot stop run: %s", str);
593 }
594 runInProgress = false;
595 runOver = true;
596 cm_msg(MERROR, "feov1720","feov1720 Stop requested");
597 }
598 return SUCCESS;
599}
DWORD evlimit
INT cm_transition(INT transition, INT run_number, char *errstr, INT errstr_size, INT async_flag, INT debug_flag)
Definition midas.cxx:5286
#define CM_SUCCESS
Definition midas.h:582
#define TR_STOP
Definition midas.h:406
#define TID_DWORD
Definition midas.h:336
INT db_set_value(HNDLE hDB, HNDLE hKeyRoot, const char *key_name, const void *data, INT data_size, INT num_values, DWORD type)
Definition odb.cxx:5261
char str[256]
Definition odbhist.cxx:33
Here is the call graph for this function:

◆ interrupt_configure()

INT interrupt_configure ( INT  cmd,
INT  source,
POINTER_T  adr 
)

Interrupt configuration (not implemented)

Routine for interrupt configuration if equipment is set in EQ_INTERRUPT mode. Not implemented right now, returns SUCCESS.

Parameters
[in]cmdCommand for interrupt events (see midas.h)
[in]sourceEquipment index number
[in]adrInterrupt routine (see mfe.c)
Returns
Midas status code

Definition at line 663 of file feoV1720.cxx.

664{
665 switch (cmd) {
667 break;
669 break;
671 break;
673 break;
674 }
675 return SUCCESS;
676}
#define CMD_INTERRUPT_ATTACH
Definition midas.h:822
#define CMD_INTERRUPT_DISABLE
Definition midas.h:821
#define CMD_INTERRUPT_ENABLE
Definition midas.h:820
#define CMD_INTERRUPT_DETACH
Definition midas.h:823

◆ interrupt_routine()

void interrupt_routine ( void  )
extern

Interrupt Service Routine.

◆ pause_run()

INT pause_run ( INT  run_number,
char error 
)

Pause Run.

Called every pause run transition.

Parameters
[in]run_numberNumber of the run being ended
[out]errorCan be used to write a message string to midas.log
Returns
Midas status code

Definition at line 554 of file feoV1720.cxx.

555{
556 runInProgress = false;
557 return SUCCESS;
558}

◆ poll_event()

INT poll_event ( INT  source,
INT  count,
BOOL  test 
)

Polling routine for events.

Parameters
[in]sourceEvent source (LAM/IRQ)
[in]countLoop count for event polling timeout
[in]testflag used to time the polling
Returns
1 if event is available, 0 if done polling (no event). If test equals TRUE, don't return.

Definition at line 619 of file feoV1720.cxx.

620{
621 register int i; // , mod=-1;
622 register DWORD lam;
623 register DWORD buffLvl;
625 for (i = 0; i < count; i++) {
626 // if (gv1720Handle[board] < 0) continue; // Skip unconnected board
627 lam = 0;
628 sCAEN = ov1720[0].Poll(&buffLvl);
629
630 if (debugpolling) printf("loop: %d lam:%x, sCAEN:%d\n", i, lam, sCAEN);
631
632 if (buffLvl > 0) { // Why was this set to > 5? (Alex 01/03/13)
633
634 //event available
635 Nloop = i;
636 Ncount = count;
637#if 0
640 ov1720[0].ReadReg(v1720_EVENT_STORED ,&buffLvl);
641 printf("vme %i | acq %i | buff lvl %i | count %i\n",lam, acqStat, buffLvl, Nloop);
642#endif
643 if (!test) return 1;
644 } else {
645 ss_sleep(1);
646 }
647 }
648 return 0;
649}
int Nloop
Number of loops executed in event polling.
Definition feoV1720.cxx:605
BOOL debugpolling
debug msgs polling loop
Definition feoV1720.cxx:143
int Ncount
Loop count for event polling timeout.
Definition feoV1720.cxx:606
INT ss_sleep(INT millisec)
Definition system.cxx:3628
double count
Definition mdump.cxx:33
INT i
Definition mdump.cxx:32
program test
Definition miniana.f:6
Here is the call graph for this function:

◆ read_scaler_event()

INT read_scaler_event ( char pevent,
INT  off 
)

Placeholder.

Placeholder.

Scaler event readout routine. Not used in this example.

Parameters
[in]peventPointer to event buffer
[in]offCaller info (unused here), see mfe.c
Returns
Size of the event

Definition at line 295 of file ebfe.cxx.

296{
297 DWORD *pdata, a;
298
299 /* init bank structure */
300 bk_init(pevent);
301
302 /* create SCLR bank */
303 bk_create(pevent, Sclx, TID_DWORD, (void**)&pdata);
304
305 /* read scaler bank */
306 for (a = 0; a < N_SCLR; a++)
307 cam24i(CRATE, SLOT_SCLR, a, 0, pdata++);
308
309 bk_close(pevent, pdata);
310
311 return bk_size(pevent);
312}
#define SLOT_SCLR
Definition ebfe.cxx:63
char Sclx[5]
Definition ebfe.cxx:51
#define N_SCLR
Definition ebfe.cxx:56
#define CRATE
Definition ebfe.cxx:59
INT bk_close(void *event, void *pdata)
Definition midas.cxx:16780
void bk_init(void *event)
Definition midas.cxx:16406
void bk_create(void *event, const char *name, WORD type, void **pdata)
Definition midas.cxx:16561
INT bk_size(const void *event)
Definition midas.cxx:16495
EXTERNAL void EXPRT cam24i(const int c, const int n, const int a, const int f, DWORD *d)

◆ read_trigger_event()

INT read_trigger_event ( char pevent,
INT  off 
)

Event readout.

Event readout routine. This is called by the polling or interrupt routines. (see mfe.c). For each module, read the event buffer into a midas data bank. If ZLE data exists, create another bank for it. Finally, create a statistical bank for data throughput analysis.

Parameters
[in]peventPointer to event buffer
[in]offCaller info (unused here), see mfe.c
Returns
Size of the event

Definition at line 691 of file feoV1720.cxx.

691 {
692
693 if (!runInProgress) return 0;
694
696
697 sn = SERIAL_NUMBER(pevent);
698
699 bk_init32(pevent);
700 char bankName[5];
701 char statBankName[5];
703
704 for (itv1720 = ov1720.begin(); itv1720 != ov1720.end(); ++itv1720) {
705
706 if (! itv1720->IsConnected()) continue; // Skip unconnected board
707
708 // >>> Get time before read (for data throughput analysis. To be removed)
709 timeval tv;
710 gettimeofday(&tv,0);
711 suseconds_t usStart = tv.tv_usec;
712
713 // >>> Read a few registers
715 sCAEN = itv1720->ReadReg(V1720_EVENT_SIZE, &eSize);
716 eSizeTot = eSize; // eSize will be decremented later on
718 DWORD lam;
719 sCAEN = itv1720->ReadReg(V1720_VME_STATUS, &lam);
720 // printf("S/N:%i B:%i eSt:%i eSze%i Lvl:%i Lam:%i \n",sn,iBoard,eStored,eSize,buffLvl,lam);
721
722 if(debugtrigger){
723 printf("Module:%02d Hndle:%d S/N:%8.8d Nloop:%d/%d (%5.2f) sCAEN:%d Event Stored:0x%x Event Size:0x%x\n"
724 , itv1720->GetModuleID(), itv1720->GetHandle(), sn, Nloop, Ncount, (100.*Nloop/Ncount), sCAEN, eStored, eSize);
725 }
726
727 // >>> Calculate module number
728 int module = itv1720->GetModuleID();
729
730 // >>> create data bank
731 if(itv1720->IsZLEData()){
732 sprintf(bankName, "ZL%02d", module);
733 }
734 else{
735 sprintf(bankName, "W2%02d", module);
736 }
737 bk_create(pevent, bankName, TID_DWORD, &pdata);
738
739 //read event into bank
740 int dwords_read = 0;
741 sCAEN = itv1720->ReadEvent(pdata, &dwords_read);
742
743 // >>> close data bank
744 bk_close(pevent, pdata + dwords_read);
745
746 //might eventually move this stuff into helper
747
748 // >>> Fill Qt bank if ZLE data
749 if(itv1720->IsZLEData()){
750 itv1720->fillQtBank(pevent, pdata, module);
751 }
752
753 // >>> Statistical bank for data throughput analysis
754 sprintf(statBankName, "ST%02d", module);
756 *pdata++ = module;
757 *pdata++ = eStored;
758 *pdata++ = eSizeTot;
759 *pdata++ = buffLvl;
760 gettimeofday(&tv,0);
761 *pdata++ = usStart;
762 *pdata++ = tv.tv_usec;
763 bk_close(pevent, pdata);
764
765 }
766
767 //primitive progress bar
768 if (sn % 100 == 0) printf(".");
769
770 return bk_size(pevent);
771}
BOOL debugtrigger
debug msgs read trigger event
Definition feoV1720.cxx:144
void bk_init32(void *event)
Definition midas.cxx:16469
#define SERIAL_NUMBER(e)
Definition midas.h:880
int gettimeofday(struct timeval *tp, void *tzp)
timeval tv
Definition msysmon.cxx:1095
Here is the call graph for this function:

◆ resume_run()

INT resume_run ( INT  run_number,
char error 
)

Resume Run.

Called every resume run transition.

Parameters
[in]run_numberNumber of the run being ended
[out]errorCan be used to write a message string to midas.log
Returns
Midas status code

Definition at line 570 of file feoV1720.cxx.

571{
572 runInProgress = true;
573 return SUCCESS;
574}

◆ seq_callback()

void seq_callback ( INT  hDB,
INT  hseq,
void info 
)

Sequencer callback info.

Function which gets called when record is updated

Parameters
[in]hDBmain ODB handle
[in]hseqHandle for key where search starts in ODB, zero for root.
[in]infoRecord descriptor additional info

Definition at line 258 of file feoV1720.cxx.

258 {
259 KEY key;
260
261 for (itv1720 = ov1720.begin(); itv1720 != ov1720.end(); ++itv1720) {
262 if (hseq == itv1720->GetODBHandle()){
264 itv1720->SetSettingsTouched(true);
265 printf("Settings %s touched. Changes will take effect at start of next run.\n", key.name);
266 }
267 }
268}
INT db_get_key(HNDLE hDB, HNDLE hKey, KEY *key)
Definition odb.cxx:6019
KEY key
Definition mdump.cxx:34
Definition midas.h:1026
char name[NAME_LENGTH]
Definition midas.h:1029
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ debug

BOOL debug
extern

debug printouts

Definition at line 254 of file mana.cxx.

◆ debugpolling

BOOL debugpolling = false

debug msgs polling loop

Definition at line 143 of file feoV1720.cxx.

◆ debugtrigger

BOOL debugtrigger = false

debug msgs read trigger event

Definition at line 144 of file feoV1720.cxx.

◆ display_period

INT display_period = 000

a frontend status page is displayed with this frequency in ms

Definition at line 160 of file feoV1720.cxx.

◆ equipment

EQUIPMENT equipment[]

Main structure for midas equipment.

Definition at line 191 of file feoV1720.cxx.

192{
193 {
194#if SIMULATION
195 "FEv1720_SIM", /* equipment name */
196 {
197 EQ_EVID, EQ_TRGMSK, /* event ID, trigger mask */
198 "SYSTEM", /* event buffer */
199# ifdef USE_INT
200 EQ_INTERRUPT, /* equipment type */
201# else
202 EQ_POLLED, /* equipment type */
203# endif //USE_INT
204
205#else
206 "FEv1720I%0d", /* equipment name */
207 {
208 EQ_EVID, EQ_TRGMSK, /* event ID, trigger mask */
209 // //Use this to make different frontends (indexes) write
210 // //to different buffers
211 // "BUF%0d", /* event buffer */
212 "SYSTEM", /* event buffer */
213
214# ifdef USE_INT
215 EQ_INTERRUPT, /* equipment type */
216# else
217 EQ_POLLED | EQ_EB, /* equipment type */
218# endif //USE_INT
219
220#endif //SIMULATION
221
222 LAM_SOURCE(0, 0x0), /* event source crate 0, all stations */
223 "MIDAS", /* format */
224 TRUE, /* enabled */
225 RO_RUNNING, /* read only when running */
226 500, /* poll for 500ms */
227 0, /* stop run after this event limit */
228 0, /* number of sub events */
229 0, /* don't log history */
230 "", "", ""
231 },
232 read_trigger_event, /* readout routine */
233 },
234 {""}
235};
#define EQ_TRGMSK
Trigger mask.
Definition feoV1720.cxx:129
INT read_trigger_event(char *pevent, INT off)
Event readout.
Definition feoV1720.cxx:691
#define EQ_EVID
Event ID.
Definition feoV1720.cxx:128
#define EQ_POLLED
Definition midas.h:415
#define EQ_EB
Definition midas.h:421
#define EQ_INTERRUPT
Definition midas.h:416
#define RO_RUNNING
Definition midas.h:426
#define LAM_SOURCE(c, s)
Definition midas.h:469
#define TRUE
Definition midas.h:182

◆ event_buffer_size

INT event_buffer_size = 200 * max_event_size + 10000

buffer size to hold events

Definition at line 166 of file feoV1720.cxx.

◆ frontend_call_loop

BOOL frontend_call_loop = FALSE

frontend_loop is called periodically if this variable is TRUE

Definition at line 158 of file feoV1720.cxx.

◆ frontend_file_name

char* frontend_file_name = (char*)__FILE__

The frontend file name, don't change it.

Definition at line 156 of file feoV1720.cxx.

◆ frontend_name

char* frontend_name = (char*)FE_NAME

The frontend name (client name) as seen by other MIDAS clients.

Definition at line 154 of file feoV1720.cxx.

◆ hDB

HNDLE hDB
extern

main ODB handle

Definition at line 207 of file mana.cxx.

◆ itv1720

vector<v1720CONET2>::iterator itv1720

iterator

Definition at line 242 of file feoV1720.cxx.

◆ max_event_size

INT max_event_size = 32 * 34000

maximum event size produced by this frontend

Definition at line 162 of file feoV1720.cxx.

◆ max_event_size_frag

INT max_event_size_frag = 5 * 1024 * 1024

maximum event size for fragmented events (EQ_FRAGMENTED)

Definition at line 164 of file feoV1720.cxx.

◆ Ncount

int Ncount

Loop count for event polling timeout.

Definition at line 606 of file feoV1720.cxx.

◆ Nloop

int Nloop

Number of loops executed in event polling.

Definition at line 605 of file feoV1720.cxx.

◆ ov1720

vector<v1720CONET2> ov1720

objects for the v1720 modules controlled by this frontend

Definition at line 241 of file feoV1720.cxx.

◆ runInProgress

bool runInProgress = false

run is in progress

Definition at line 168 of file feoV1720.cxx.

◆ runOver

bool runOver = false

run is over

Definition at line 169 of file feoV1720.cxx.

◆ runStopRequested

bool runStopRequested = false

stop run requested

Definition at line 170 of file feoV1720.cxx.