ATLAS Raw Data Reading and TRT Low Threshold Optimization Ryan D. Reece University of Pennsylvania Penn Meeting at CERN July 3, 2007 Ryan D. Reece (U. Penn) Raw Data and TRT Thresholds ryan.reece@gmail.com 1 / 36
Outline 1 ATLAS Raw Data Reading 2 TRT Low Threshold Optimization 3 Statistics of Occupancy Measurement 4 Results 5 Summary Ryan D. Reece (U. Penn) Raw Data and TRT Thresholds ryan.reece@gmail.com 2 / 36
Outline ATLAS Raw Data Reading 1 ATLAS Raw Data Reading 2 TRT Low Threshold Optimization 3 Statistics of Occupancy Measurement 4 Results 5 Summary Ryan D. Reece (U. Penn) Raw Data and TRT Thresholds ryan.reece@gmail.com 3 / 36
ATLAS Raw Data Reading The ATLAS Raw Data Format 32 bit words mirrors the physical backend ROD fragment specific to sub-detector EDMS: ATL-D-ES-0019 Ryan D. Reece (U. Penn) Raw Data and TRT Thresholds ryan.reece@gmail.com 4 / 36
ATLAS Raw Data Reading The Need for a Parsing Tool no need for everyone to learn the binary format bare bones independent of Athena useful in commissioning tests I wrote a class called atlasdata. Ryan D. Reece (U. Penn) Raw Data and TRT Thresholds ryan.reece@gmail.com 5 / 36
ATLAS Raw Data Reading The atlasdata Class for Reading Raw Data Example of using atlasdata: C++ ifstream raw("rawdatafile.data"); atlasdata data(raw, 1); unsigned int ROD_Source_ID = data.getfulleventfrag(0) ->getsubdetectorfrag(1) ->getrosfrag(0) ->getrobfrag(2) ->getrodfragment() ->getheader() ->getsource(); Ryan D. Reece (U. Penn) Raw Data and TRT Thresholds ryan.reece@gmail.com 6 / 36
Outline TRT Low Threshold Optimization 1 ATLAS Raw Data Reading 2 TRT Low Threshold Optimization 3 Statistics of Occupancy Measurement 4 Results 5 Summary Ryan D. Reece (U. Penn) Raw Data and TRT Thresholds ryan.reece@gmail.com 7 / 36
TRT Low Threshold Optimization Overview of TRT Read Out Ryan D. Reece (U. Penn) Raw Data and TRT Thresholds ryan.reece@gmail.com 8 / 36
TRT Low Threshold Optimization The Need for Threshold Optimization Poor Thresholds: Better Optimized Thresholds: https://twiki.cern.ch/twiki/bin/view/atlas/trtdaqcosmics Ryan D. Reece (U. Penn) Raw Data and TRT Thresholds ryan.reece@gmail.com 9 / 36
Noise Curve TRT Low Threshold Optimization Threshold Scan Fit Threshold [DAC Counts] 145 140 135 130 125 120 115 110 105 100 0 2 4 6 8 10 12 14 16 18 20 Occupancy [%] α erfcinverse(β x) + γ Ryan D. Reece (U. Penn) Raw Data and TRT Thresholds ryan.reece@gmail.com 10 / 36
TRT Low Threshold Optimization Noise Curve Fit Performance Data - Fit Threshold [DAC Counts] 1.5 1 0.5 0-0.5-1 -1.5 0 2 4 6 8 10 12 14 16 18 20 Occupancy [%] Ryan D. Reece (U. Penn) Raw Data and TRT Thresholds ryan.reece@gmail.com 11 / 36
TRT Low Threshold Optimization Recommend New Threshold Threshold [DAC counts] Recommend New Threshold 155 150 145 140 Legend Current Occupancy: 1.800 Current Threshold: 135 Target Occupancy: 1.000 Recommended Threshold: 138 135 130 0 1 2 3 4 5 Occupancy [%] Ryan D. Reece (U. Penn) Raw Data and TRT Thresholds ryan.reece@gmail.com 12 / 36
TRT Low Threshold Optimization The Fit s Kludge ErfcInverse(x) y 2 1.5 1 0.5 0-0.5-1 -1.5-2 0 0.5 1 1.5 2 x const float lowestallowedoccupancy = 0.05; //% if(currentoccupancy < lowestallowedoccupancy) currentoccupancy = lowestallowedoccupancy; Ryan D. Reece (U. Penn) Raw Data and TRT Thresholds ryan.reece@gmail.com 13 / 36
TRT Low Threshold Optimization The trtdata Class inherits atlasdata for data parsing method for reading current thresholds from a config file method for calculating occupancy method for recommending new optimized thresholds method for writing config file with new thresholds Ryan D. Reece (U. Penn) Raw Data and TRT Thresholds ryan.reece@gmail.com 14 / 36
TRT Low Threshold Optimization The trtdata Data Structure C++ trtdata.h class ASDBLR {... std::vector<unsigned int> strawhits; unsigned int threshold; unsigned int newthreshold; unsigned int hits; float occupancy; }; typedef std::pair<asdblr*, ASDBLR*> DTMROC; typedef std::map<unsigned int, DTMROC*> channelmap; Ryan D. Reece (U. Penn) Raw Data and TRT Thresholds ryan.reece@gmail.com 15 / 36
TRT Low Threshold Optimization The trtdata Data Structure Cont. C++ trtdata.h class ROD {... channelmap channels; unsigned int eventcount; }; typedef std::map<unsigned int, ROD*> sourcemap; class trtdata: public atlasdata {... OptTrtThresholds();... sourcemap hitinfo; }; Ryan D. Reece (U. Penn) Raw Data and TRT Thresholds ryan.reece@gmail.com 16 / 36
TRT Low Threshold Optimization The Opt TRT Thresh Program Ryan D. Reece (U. Penn) Raw Data and TRT Thresholds ryan.reece@gmail.com 17 / 36
TRT Low Threshold Optimization Threshold Config Files thresholds.conf ########################################################## # Phi Side Name HWAdd Low0 High0 Low1 High1 ########################################################## 23 A 1BS 1 126 180 122 180 23 A 3BS1 1 128 180 133 180 23 A 1BS 2 124 180 119 180 23 A 3BS1 2 132 180 134 180 23 A 1BS 3 119 180 123 180 23 A 3BS1 3 134 180 133 180 23 A 1BS 4 116 180 119 180 23 A 3BS1 4 131 180 130 180 23 A 1BS 5 122 180 114 180 23 A 3BS1 5 132 180 133 180 23 A 1BS 6 125 180 120 180 Ryan D. Reece (U. Penn) Raw Data and TRT Thresholds ryan.reece@gmail.com 18 / 36
Log Files TRT Low Threshold Optimization thresholds.log ##################################################################################################### # SourceID Phi Side Name HWAdd OldLow0 NewLow0 Diff0 Occ0 OldLow1 NewLow1 Diff1 Occ1 ##################################################################################################### 0x311700 23 A 1BS 1 135 126-9 0.167 135 122-13 0.0667 0x311700 23 A 1BS 2 135 124-11 0.117 135 119-16 0.0333 0x311700 23 A 1BS 3 135 119-16 0.0333 135 123-12 0.1 0x311700 23 A 1BS 4 135 116-19 0.0167 135 119-16 0.0333 0x311700 23 A 1BS 5 135 122-13 0.0667 135 114-21 0 0x311700 23 A 1BS 6 135 125-10 0.133 135 120-15 0.05 0x311700 23 A 1BS 7 135 114-21 0 135 116-19 0.0167 0x311700 23 A 3BS2 14 135 127-8 0.2 135 125-10 0.133 0x311700 23 A 1BL 22 135 124-11 0.117 135 134-1 0.8 0x311700 23 A 3BS2 17 135 120-15 0.05 135 132-3 0.633 0x311700 23 A 1BL 25 135 123-12 0.0833 135 123-12 0.1 0x311700 23 A 1BL 26 135 123-12 0.0833 135 123-12 0.1 0x311700 23 A 1BL 27 135 116-19 0.0167 135 124-11 0.117 0x311700 23 A 3BL1 34 135 126-9 0.183 135 123-12 0.1 Ryan D. Reece (U. Penn) Raw Data and TRT Thresholds ryan.reece@gmail.com 19 / 36
TRT Low Threshold Optimization The translateboard Class ROD Source ID: 0x311700 Channel: DTMROC index 0-119 ROD Source ID Phi ROD Source ID Barrel or Endcap ROD Source ID Side (A or C) Board Name Barrel or Endcap Phi: 1-32 Board Name: 3BS1 Address: different DTMROC index ROD Source ID + Channel Board Name + Address Get all Addresses for a Board Name Ryan D. Reece (U. Penn) Raw Data and TRT Thresholds ryan.reece@gmail.com 20 / 36
Outline Statistics of Occupancy Measurement 1 ATLAS Raw Data Reading 2 TRT Low Threshold Optimization 3 Statistics of Occupancy Measurement 4 Results 5 Summary Ryan D. Reece (U. Penn) Raw Data and TRT Thresholds ryan.reece@gmail.com 21 / 36
Statistics of Occupancy Measurement Measuring Occupancy Measuring a Coin s Fairness Binomial Distribution f(k; n, p) = σ k 2 σ o 2 ( ) n p k (1 p) n k k = n p (1 p) ( σk ) 2 p (1 p) = = n n p 0.01 σ 2 (0.01) (0.99) o = n 0.01 n σ o = 1 10 n Ryan D. Reece (U. Penn) Raw Data and TRT Thresholds ryan.reece@gmail.com 22 / 36
Statistics of Occupancy Measurement Number of Events Needed for some Precision for p = 0.01 n σ o σ o /p 400 0.0050 50% 1,000 0.0032 32% 2,000 0.0022 22% 10,000 0.0010 10% 10 6 0.0001 1% Ryan D. Reece (U. Penn) Raw Data and TRT Thresholds ryan.reece@gmail.com 23 / 36
Outline Results 1 ATLAS Raw Data Reading 2 TRT Low Threshold Optimization 3 Statistics of Occupancy Measurement 4 Results 5 Summary Ryan D. Reece (U. Penn) Raw Data and TRT Thresholds ryan.reece@gmail.com 24 / 36
Before Optimization Results Occupancy Before Optimization ASDBLR Count 30 25 20 Entries 812 Mean 3.483 RMS 2.546 15 10 5 0 0 2 4 6 8 10 12 Occupancy [%] Ryan D. Reece (U. Penn) Raw Data and TRT Thresholds ryan.reece@gmail.com 25 / 36
After Optimization Results Occupancy After First Optimization ASDBLR Count 240 220 Entries 812 Mean 1.07 RMS 0.3687 200 180 160 140 120 100 80 60 40 20 0 0 2 4 6 8 10 12 Occupancy [%] Ryan D. Reece (U. Penn) Raw Data and TRT Thresholds ryan.reece@gmail.com 26 / 36
Second Iteration Results Occupancy After Second Optimization ASDBLR Count 300 250 200 Entries 812 Mean 1.02 RMS 0.09463 150 100 50 0 0 2 4 6 8 10 12 Occupancy [%] Ryan D. Reece (U. Penn) Raw Data and TRT Thresholds ryan.reece@gmail.com 27 / 36
Results Second Iteration, Log Scale Occupancy After Second Optimization ASDBLR Count 10 2 Entries 812 Mean 1.022 RMS 0.09949 10 1 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2 Occupancy [%] Ryan D. Reece (U. Penn) Raw Data and TRT Thresholds ryan.reece@gmail.com 28 / 36
Before Optimization Results Ryan D. Reece (U. Penn) Raw Data and TRT Thresholds ryan.reece@gmail.com 29 / 36
After Optimization Results Ryan D. Reece (U. Penn) Raw Data and TRT Thresholds ryan.reece@gmail.com 30 / 36
Results After Optimization, finer scale Ryan D. Reece (U. Penn) Raw Data and TRT Thresholds ryan.reece@gmail.com 31 / 36
Outline Summary 1 ATLAS Raw Data Reading 2 TRT Low Threshold Optimization 3 Statistics of Occupancy Measurement 4 Results 5 Summary Ryan D. Reece (U. Penn) Raw Data and TRT Thresholds ryan.reece@gmail.com 32 / 36
Summary Tools I ve Developed atlasdata: class for raw data parsing trtdata: class that inherits atlasdata and calibrates TRT thresholds translateboard: class for converting Source IDs and Board Names Opt TRT Thresh: executable using trtdata Check TRT Thresh: executable for just calculating and reporting occupancy to test Opt TRT Thresh All of my code and documentation can be found in the TRT DAQ CVS at DAQ/Calib. Ryan D. Reece (U. Penn) Raw Data and TRT Thresholds ryan.reece@gmail.com 33 / 36
Summary Things I ve Learned I/O binary and text writing Makefiles building shared libraries using CVS STL container classes good memory management Ryan D. Reece (U. Penn) Raw Data and TRT Thresholds ryan.reece@gmail.com 34 / 36
Summary To Do A more detailed study of the threshold scan fit High threshold optimization. Currently sets all the high thresholds to 180 DAC Counts. Ryan D. Reece (U. Penn) Raw Data and TRT Thresholds ryan.reece@gmail.com 35 / 36
Summary References Reece, Ryan D. Documentation for atlasdata, trtdata, Opt TRT Thresh, and translateboard. https://twiki.cern.ch/twiki/bin/view/atlas/trtdaq. TRT DAQ CVS: DAQ/Calib/doc. The raw event format in the ATLAS Trigger & DAQ. EDMS: ATL-D-ES-0019. Hance, Mike. Readout of the ATLAS Transition Radiation Tracker: Data Structure and Detector Granularity. https://twiki.cern.ch/twiki/bin/view/atlas/trtdaq. Ryan D. Reece (U. Penn) Raw Data and TRT Thresholds ryan.reece@gmail.com 36 / 36