MDQ_FADCBufferOverflow
[Low Level Data Quality Checks]

Plots information related to FADC buffer overflow, as in when the data buffer is full and no more data can be taken. More...

Functions

INT MDQ_FADCBufferOverflow_init (void)
INT MDQ_FADCBufferOverflow_BOR (INT run_number)
INT MDQ_FADCBufferOverflow_EOR (INT run_number)
INT MDQ_FADCBufferOverflow (EVENT_HEADER *, void *)

Variables

HNDLE hDB
TGlobalDatagData
 Object to hold data used and produced by modules throughout alcapana stage of analysis.
TSetupDatagSetup
 Hardware information about digitizers and detectors to be used during alcapana stage of analysis.
static TH1 * hDQ_FADCBufferOverflow_Total
 Plots the total number of MIDAS events in which the FADC buffer overflowed for each board.
static TH1 * hDQ_FADCBufferOverflow_Fraction
 Plots the fraction of MIDAS events where the FADC buffer overflowed for each board.
static TH2 * hDQ_FADCBufferOverflow_TotalByEvent
 Plots the total number of FADC buffer overflows in each board on an event-by-event basis.
static int n_total_midas_events
ANA_MODULE MDQ_FADCBufferOverflow_module

Detailed Description

Plots information related to FADC buffer overflow, as in when the data buffer is full and no more data can be taken.

Author:
Andrew Edmonds
Joe Grange

Creates hDQ_FADCBufferOverflow_Total, hDQ_FADCBufferOverflow_Fraction, and hDQ_FADCBufferOverflow_TotalByEvent.


Function Documentation

INT MDQ_FADCBufferOverflow ( EVENT_HEADER *  pheader,
void *  pevent 
)

This method processes one MIDAS block, producing a vector of TOctalFADCIsland objects from the raw Octal FADC data.

Definition at line 151 of file MDQ_FADCBufferOverflow.cpp.

References hDQ_FADCBufferOverflow_Fraction, hDQ_FADCBufferOverflow_Total, hDQ_FADCBufferOverflow_TotalByEvent, and n_total_midas_events.

00152 {
00153   // Get the event number
00154   int midas_event_number = pheader->serial_number;
00155 
00156   // Get the NBUF bank and get a pointer to the raw data
00157   unsigned int* raw; // points at the raw data
00158   int bankSize = bk_locate(pevent,"NBUF",&raw);
00159 
00160   int board_number = 0;
00161   int n_buffers_overflow = 0;
00162 
00163   bool Boards[256]; // We can have maximally 256 FADC boards due to the address space
00164   for(int i=0; i<256; ++i) Boards[i] = false;
00165 
00166   for (int i = 0; i < bankSize; i++) {
00167     board_number = *(raw+i);
00168 
00169     if(*(raw+i) >= 0 && *(raw+i) < 255) Boards[i] = true;
00170 
00171     n_buffers_overflow++;
00172     //printf("Event #%d: Board %d n buffers overflowed %d\n", midas_event_number, board_number,n_buffers_overflow);
00173 
00174     // Fill Diagnostic histogram
00175     hDQ_FADCBufferOverflow_Total->Fill(board_number, 1);   
00176     hDQ_FADCBufferOverflow_Fraction->Fill(board_number, 1);
00177     hDQ_FADCBufferOverflow_TotalByEvent->Fill(board_number,midas_event_number, 1);
00178 
00179   }
00180 
00181   /*
00182   for(int i=0; i<256; ++i){
00183     if(Boards[i] == true){
00184       hDQ_FADCBufferOverflow_Fraction->Scale(1.0 / n_total_midas_events);
00185     }
00186   }
00187   */  
00188 
00189   ++n_total_midas_events;
00190 
00191   return SUCCESS;
00192 }

INT MDQ_FADCBufferOverflow_BOR ( INT  run_number  ) 

This method executes at the start of each run

Definition at line 141 of file MDQ_FADCBufferOverflow.cpp.

References n_total_midas_events.

00142 {
00143   n_total_midas_events = 1;
00144   
00145   return SUCCESS;
00146 }

INT MDQ_FADCBufferOverflow_EOR ( INT  run_number  ) 

Definition at line 194 of file MDQ_FADCBufferOverflow.cpp.

References hDQ_FADCBufferOverflow_Fraction, and n_total_midas_events.

00195 {
00196 
00197   //for(int i=0; i<256; ++i){
00198     //if(Boards[i] == true){
00199       hDQ_FADCBufferOverflow_Fraction->Scale(1.0 / n_total_midas_events);
00200     //}
00201   //}
00202 
00203   return SUCCESS;
00204 }

INT MDQ_FADCBufferOverflow_init (  ) 

This method initializes histograms.

Definition at line 91 of file MDQ_FADCBufferOverflow.cpp.

References hDB, hDQ_FADCBufferOverflow_Fraction, hDQ_FADCBufferOverflow_Total, and hDQ_FADCBufferOverflow_TotalByEvent.

00092 {
00093   // See if the DataQuality_LowLevel/ directory already exists
00094   if (!gDirectory->Cd("DataQuality_LowLevel")) {
00095     
00096     std::string dir_name("DataQuality_LowLevel/");
00097     gDirectory->mkdir(dir_name.c_str());
00098     gDirectory->Cd(dir_name.c_str());
00099   }
00100 
00101   // Get run number
00102   char key_name[80];
00103   int size,run_number;
00104   sprintf(key_name, "Runinfo/Run number");
00105   size=sizeof(int);
00106   db_get_value(hDB,0,key_name, &run_number, &size, TID_INT,1);
00107 
00108   // Create the histograms
00109   hDQ_FADCBufferOverflow_Total = new TH1F(
00110     "hDQ_FADCBufferOverflow_Total",
00111     Form("Total number of MIDAS Events with buffer overflows per board, run %d",run_number),
00112     4,128, 132);
00113   hDQ_FADCBufferOverflow_Total->SetBit(TH1::kCanRebin);
00114   hDQ_FADCBufferOverflow_Total->GetXaxis()->SetTitle("FADC Board Number");
00115   hDQ_FADCBufferOverflow_Total->GetYaxis()->SetTitle("Number of events with buffer overflows");
00116 
00117   hDQ_FADCBufferOverflow_Fraction = new TH1F(
00118     "hDQ_FADCBufferOverflow_Fraction",
00119     Form("Fraction of MIDAS Events with FADC buffer overflows by board, run %d",run_number),
00120     4,128, 132);
00121   hDQ_FADCBufferOverflow_Fraction->SetBit(TH1::kCanRebin);
00122   hDQ_FADCBufferOverflow_Fraction->GetXaxis()->SetTitle("FADC Board Number");
00123   hDQ_FADCBufferOverflow_Fraction->GetYaxis()->SetTitle("Fraction of events with buffer overflows");
00124 
00125   hDQ_FADCBufferOverflow_TotalByEvent = new TH2F(
00126     "hDQ_FADCBufferOverflow_TotalByEvent",
00127     Form("FADC buffer overflows by board and event, run %d",run_number),
00128     4,128, 132,5000,0,5000);
00129   hDQ_FADCBufferOverflow_TotalByEvent->SetBit(TH1::kCanRebin);
00130   hDQ_FADCBufferOverflow_TotalByEvent->GetXaxis()->SetTitle("FADC Board Number");
00131   hDQ_FADCBufferOverflow_TotalByEvent->GetYaxis()->SetTitle("MIDAS event");
00132 
00133   gDirectory->Cd("/MidasHists/");
00134 
00135   return SUCCESS;
00136 }


Variable Documentation

Object to hold data used and produced by modules throughout alcapana stage of analysis.

Definition at line 76 of file analyzer.cpp.

Hardware information about digitizers and detectors to be used during alcapana stage of analysis.

Definition at line 80 of file analyzer.cpp.

HNDLE hDB

Plots the fraction of MIDAS events where the FADC buffer overflowed for each board.

Definition at line 70 of file MDQ_FADCBufferOverflow.cpp.

Referenced by MDQ_FADCBufferOverflow(), MDQ_FADCBufferOverflow_EOR(), and MDQ_FADCBufferOverflow_init().

Plots the total number of MIDAS events in which the FADC buffer overflowed for each board.

Definition at line 69 of file MDQ_FADCBufferOverflow.cpp.

Referenced by MDQ_FADCBufferOverflow(), and MDQ_FADCBufferOverflow_init().

Plots the total number of FADC buffer overflows in each board on an event-by-event basis.

Definition at line 71 of file MDQ_FADCBufferOverflow.cpp.

Referenced by MDQ_FADCBufferOverflow(), and MDQ_FADCBufferOverflow_init().

Initial value:
{
  "MDQ_FADCBufferOverflow",        
  "Andrew Edmonds",              
  MDQ_FADCBufferOverflow,          
  MDQ_FADCBufferOverflow_BOR,      
  MDQ_FADCBufferOverflow_EOR,      
  MDQ_FADCBufferOverflow_init,     
  NULL,                          
  NULL,                          
  0,                             
  NULL,                          
}

Definition at line 75 of file MDQ_FADCBufferOverflow.cpp.

int n_total_midas_events [static]

Generated on 15 Jun 2016 for AlcapDAQ by  doxygen 1.6.1