Difference between revisions of "Qweak R1 Software"
Line 57: | Line 57: | ||
== CODA file to Tracking data structure== | == 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. | 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. | ||
Line 66: | Line 66: | ||
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. | 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 suck that the first VFAT card readout out the even numbered strip on the lower half of the chamber (low radial distance from beam pipe). The next VFAT card entered readouts out the even strips in the upper half of the detector. The next 2 VFAT cards | ||
+ | |||
+ | ===QWanalysis software=== | ||
The table below defines the data structure | The table below defines the data structure |
Revision as of 17:27, 18 June 2009
Slow Control GUI
MEDM
use EPICS se set HV channels and alarms
Lab View
rotation control.
VFAT setup
The VFAT setup is done through a web interface.
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
Firmware
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 (
) and representing the local polar angle in which 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.
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 suck that the first VFAT card readout out the even numbered strip on the lower half of the chamber (low radial distance from beam pipe). The next VFAT card entered readouts out the even strips in the upper half of the detector. The next 2 VFAT cards
QWanalysis software
The table below defines the data structure
The SVN repository for the Qweak Analysis and tracking software is at
https://qweaksvn.jlab.org/repos/QwAnalysis/trunk/Analysis
Qweak wiki describing the software is at
https://qweak.jlab.org/wiki/index.php/Installation_and_compilation
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 */
QwGasElectronMultiplier->fHits
create a tracking source file in the subdirectory which contains the actual code to do the above
QwAnalysis/Tracking/src/QwGasElectronMultiplier.cc
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
Tracking/src/QwDriftChamber.cc
Int_t QwDriftChamber::LoadChannelMap(TString mapfile){ TString varname, varvalue; UInt_t chan, package, plane, wire, direction, DIRMODE; DIRMODE=0; 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
Tracking/src/QwMainDetector.cc
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. varname.ToLower(); UInt_t value = atol(varvalue.Data()); if (varname=="roc"){ RegisterROCNumber(value); } else if (varname=="bank"){ RegisterSubbank(value); } 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
HVdrift HVGEM Octant VFATChipID_A VFATChipID_B VFATChipID_C VFATChipID_D VFATChipID_E VFATChipID_F
Each of the 6 electronics cards (VFATChip_ID) above have the following information
IPreampIn IPreampFeed IPreampOut IShaper IShaperFeed IComp UpsetReg Lat VThreshold1 VThreshold2
In addition to the above variables each chip has 128 Channels which can contain TrimDAC offsets and a mask
ChanReg_1_Mask ChanReg_1_TrimDAC ChanReg_2_Mask ChanReg_2_TrimDAC ChanReg_3_Mask ChanReg_4_TrimDAC
....
ChanReg_128_Mask ChanReg_128_TrimDAC
At the end of a tracking run each of the above chips will have "scaler" counts recorded with the following names
HitCount0 HitCount1 HitCount2
Monitoring Histograms GUI
Hit display
References