How do I Access Unpacked Raw Data?

The first part of this file applies to counter systems. The second part applies to drift and straw chamber data. Counter Systems: To DUMP all the TDC/ADC/LAT hits on a given event, put the following line in stage 5 (or later) of the offline job: $DUMP EVUTDC(6); $DUMP EVUADC(6); $DUMP EVULAT(6); This works for COUNTER systems only, not WIREs. The "6" refers to FORTRAN UNIT 6, the printer (STDOUT). The following shows how to access individual channels. This example was prepared for the TSC group. The same principle works for all the counter systems, replacing the $$TSC macro with $$CER, $$MHO, $$PBG or $$MRG. These Mortran MACROs are defined in file latmac.mortmac and are automatically available to all subroutines you may write. The TSC has only FTDCs. One makes the following replacements to apply the explanation to FADCs or LATches: FTDC: /EVUTDC/ ITDCUT IPTTUX FADC: /EVUADC/ IADCUA IPTAUX LAT: /EVULAT/ ILATUL IPTLUX COMMON/EVUTDC/ contains the TSC FTDCs in a fixed length array ITDCUT. If you want to know the FTDC value read out of TSC channel #93, you find it in: ITDCUT(IPTTUX($$TSC)+93) ITDCUT is an integer in the range 0-255. 255 means overflow. ITDCUT(i)=-1 for any channel(i) not read out. The offset variable IPTTUX is found in COMMON/IDXUCT/, which must be included in the code, along with /EVUTDC/. The COMMON/IDXRAW/ defines the order in which TDC channels are unpacked into ITDCUT. You need to know this order before you can write a new COMMON/IDXTSC/ to map the TSC channel into TSC tube number. The order for the 1993 Engineering Run is: crate 27, region 0, TSC1: LXU,LXB, 64 channels crate 27, region 1, TSC1: RXU,RXB, 64 channels crate 25, region 2, TSC2: LXU,LXB, 64 channels crate 25, region 0, TSC2: RXU,RXB, 64 channels crate 25, region 3, TSC2: LY , 64 channels crate 25, region 1, TSC2: RY , 64 channels Here the crate and region numbers are the HARDWARE nos. You see that the 6 TSC modules are in a semi-reasonable order in ITDCUT, but the channels are still scrambled within each module. COMMON/IDXTSC/ needs to address that intra-module scrambling. Drift and Straw Chambers: To dump all the WIRE hits on a given event to the printer, add this line in stage 5 or later: $DUMP EVUWIR(6); Here's how to access individual channels: For the DCH (Drift Chamber) and SDC (Straw Tracking Chamber) data the hits are unpacked into a variable length array IHITUW(4,ihit) in COMMON/EVUWIR/. The NHPPUW(icr) array contains the number of hits in each crate-region. The IOPPUW(icr) array contains the index offset of each crate-region's hits in the IHITUW(,ihit) array. The COMMON/IDXRAW/ gives the correspondence between WIRE PLANE and crate/region in COMMON/EVUWIR/. Currently /EVUWIR/ has space for 30 crate-regions, corresponding to 22 planes.