Qweak R1 Software

From New IAC Wiki
Revision as of 15:23, 22 January 2010 by Oborn (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Slow Control GUI


use EPICS se set HV channels and alarms

Lab View

rotation control.

VFAT setup

The VFAT setup is done through a web interface.

The GUMSTIX computer is currently registered at JLab under the name


you can login to it from outside only after you login to login1.jlab.org

GEM data processing

The GEM detector contains 6 VFAT cards which are used to digitize the charge from an ionization event. Each channel of the VFAT is associated with a charge collection strip within the GEM ionization chamber. Once triggered the VFAT card will transfer 192 bits (Defined in Figure 8 of the VFAT manual V2.0) from each VFAT card to separate I/O channels on a CAEN V1495 module.

VFAT to V1495


V1495 to CODA data file

ROC library

CODA ReadoutList

below are the changes to make to my ROC readout list

Define a bank ID at the top of the readout list

const GEM_BTYPE     = 0x3102

In the begin trigger section

rol->dabufp = (long *)0;

open the data file so it expects to write banks

 open event type EVTYPE of BT_BANK

Now create a bank for the V1495 data

open bank GEM_BTYPE of BT_UI4

now transfer the data from the V1495 to a ROC data buffer

 if (V1495DataReady(id)!=0){
               rol->dabufp+=V1495ReadData(id, rol->dabufp);

You may only have one bank open at a time. Close the bank after you fill the rol->dabufp.

 close bank

CODA file to Tracking data structure

CODA event structure

A ROC will transfer GEM data from a CAEN V1495 to the host DAQ computer. At the local institution there will only be one element of the Qweak tracking software. Once the ROC is writing data to a CODA file from the V1495 we will need to write software which will take the raw data and create a data structure for tracking. The data structure for tracking, in the case of R1, will contain the distance of the elastic scattering event from the beam pipe center ([math]R[/math]) and [math]\phi[/math] representing the local polar angle in which [math]\phi=0[/math] at the center of the detector.

Below is a dump of the first VFAT data event as recorded in a CODA data file and visualized using the CODA utility xcefdmp. Only 6 VFAT cards were present so the lower half of the data field is padded with zeros.

VFAT FirstCODADataFile 3Events using xcefdmp 6-15-09.png

The bank ID is 0x7513 (G=7,E=5,M=13 counting alphabetically)as outlined by the thick red oval. The thin red ovals identify the location of the 6 VFAT chip IDs labeled 6ec,a6c,66c,8ec,6ec, and 8ec. They are not unique in the data stream but they are in the I2C data base. All of the data bits are zero and underlined in black. There are 4 sets of 8 bit hex words which come to 4 sets of 32 bits or 128 bits total.

Readout Map

We need to decode the above data structure recorded into a CODA data file into hit locations of the track. The first 6 VFAT ChipIDs shown in the above data file are mounted onto the GEM detector such that the first VFAT card (CHip ID =0xe6ec) reads the even numbered strips on the lower half of the chamber (low radial distance from beam pipe). The next VFAT card (CHip ID =0xea6c) entered readouts out the even strips in the upper half of the detector. The next 2 VFAT cards are the "right" side and "left side of the detector respectively. The next card in the data array reads the top half of the odd radial strips and the last card (CHip ID =0xe6ec) records hits on the lower half of the odd strips. The VFAT card Chip IDs do not contain enough bits to uniquely identify a chip in the data stream. We plan on adding a bit to identify VFAT card location and use this in the decoding software.

QWanalysis software

The table below defines the data structure

The SVN repository for the Qweak Analysis and tracking software is at


Qweak wiki describing the software is at


GEM data header file is located in

QwAnalysis/ Tracking/include/QwGasElectronMultiplier.h

The above defines the processed data structure, it includes a ProcessEventBuffer function to strip data out of the raw CODA data buffer, defines the function to create a QwHit for each r and phi strip hit

Int_t ProcessConfigurationBuffer(const UInt_t roc_id, const UInt_t bank_id, UInt_t* buffer, UInt_t num_words){return 0;};  /* contains IPreamp info if needed occurs during Prestart*/
 Int_t ProcessEvBuffer(UInt_t roc_id, UInt_t bank_id, UInt_t* buffer, UInt_t num_words){return 0;};/* filters out VFAT data from CODA bank*/
 void  ProcessEvent() /* fills hit list */

create a tracking source file in the subdirectory which contains the actual code to do the above


The above *.cc file also needs a LoadMap function to read a prminput file (located in Tracking/prminput/)

an example of which is shown in

Int_t QwDriftChamber::LoadChannelMap(TString mapfile){
  TString varname, varvalue;
  UInt_t  chan, package, plane, wire, direction, DIRMODE;

  fDirectionData.resize(2);//currently we have 2  package - Rakitha (10/23/2008)
  fDirectionData.at(0).resize(12); //currently we have 12 wire planes in each package - Rakitha (10/23/2008)
  fDirectionData.at(1).resize(12); //currently we have 12 wire planes in each package - Rakitha (10/23/2008)

  QwParameterFile mapstr(mapfile.Data());  //Open the file

  while (mapstr.ReadNextLine()){
    mapstr.TrimComment('!');   // Remove everything after a '!' character.
    mapstr.TrimWhitespace();   // Get rid of leading and trailing spaces.
    if (mapstr.LineIsEmpty())  continue;

Another simpler eaxample is in

Int_t QwMainDetector::LoadChannelMap(TString mapfile){
  TString varname, varvalue;
  TString modtype, dettype, name;
  Int_t modnum, channum;

  QwParameterFile mapstr(mapfile.Data());  //Open the file
  while (mapstr.ReadNextLine()){
    mapstr.TrimComment('!');   // Remove everything after a '!' character.
    mapstr.TrimWhitespace();   // Get rid of leading and trailing spaces.
    if (mapstr.LineIsEmpty())  continue;

    if (mapstr.HasVariablePair("=",varname,varvalue)){
      //  This is a declaration line.  Decode it.
      UInt_t value = atol(varvalue.Data());
      if (varname=="roc"){
      } else if (varname=="bank"){
      } else if (varname=="slot"){

DataBase info

The following run-by-run information should be included in a database table

Two tables:

   R1G1  = Region 1 GEM Detector 1
   R1G2  = Region 1 GEM Detector 1

Each of the 2 tables has 2 High Voltage entries, an Octant location, and 6 sub tables one for each VFAT electronics card


Each of the 6 electronics cards (VFATChip_ID) above have the following information


In addition to the above variables each chip has 128 Channels which can contain TrimDAC offsets and a mask




At the end of a tracking run each of the above chips will have "scaler" counts recorded with the following names


Monitoring Histograms GUI

Hit display

First Primitive Display attempt

Below is an example of an ideal hit in the GEM chamber. The hits below are a Cosmic event seen by the R1 GEM detector at ISU, readout using the VFAT front end cards and recorded into a CODA data file through a V1495 module. The data file was analyzed using ROOT to draw the histograms below. The Histogram channels are intended to represent strip numbers. The histograms labeled VFATCard2_Hist and VFATCard3_Hist are recording hits from the VFATs on the "phi" strips. The other histograms are recording hits on the radial strips. The hit in VFATCard5_Hist shows a cosmic event recorded in the lower half of the detector on strip # 61. The left hand histograms (VFATCard4_Hist and VFATCard5_Hist) recorded the odd radial readout strips and the right hand cards recorded the even radial strip hits.

R1 GEM GUI IdealCosmicHit 6-24-09.png


VFAT manual

Go Back Qweak