Warning, /macros/calibrations/tpc/gemcurrents/README.org is written in an unsupported language. File is not indexed.
0001 #+TITLE: GEM Current CDB Generator
0002 #+AUTHOR: Charles Hughes
0003 #+STARTUP: overview
0004
0005 Last Modified: 16:26:19 08/05/26
0006
0007 * Overview
0008
0009 This repository contains utilities for extracting GEM current information from
0010 the DAQ database and converting it into a CDB-compatible ROOT object for use
0011 within the sPHENIX software framework.
0012
0013 The repository currently contains two programs:
0014
0015 ** daqdbreader_tpc_GEM_charge_status_2.py
0016
0017 Python utility that queries the DAQ database for a specified run and produces a
0018 CSV file containing the measured current draw for every TPC GEM module.
0019
0020 The output file has the form
0021
0022 #+begin_example
0023 ./tpc_GEM_current_status/run_<RunNumber>_GEM_BCO.csv
0024 #+end_example
0025
0026 Each row contains
0027
0028 - BCO timestamp
0029 - GEM module name
0030 - Current draw (μA)
0031
0032 The current measurements are sampled every 60 seconds throughout the run.
0033
0034 ** FillGemCurrents.C
0035
0036 ROOT macro that reads the CSV produced by
0037 ~daqdbreader_tpc_GEM_charge_status_2.py~ and converts it into a
0038 CDB-compatible ROOT object.
0039
0040 The output is
0041
0042 #+begin_example
0043 cdbttree.root
0044 #+end_example
0045
0046 which contains a TTree named
0047
0048 #+begin_example
0049 Multiple
0050 #+end_example
0051
0052 ready for use by the sPHENIX Conditions Database framework.
0053
0054 * Workflow
0055
0056 The complete workflow consists of two steps.
0057
0058 ** Step 1: Query the DAQ database
0059
0060 Run
0061
0062 #+begin_src bash
0063 python3 daqdbreader_tpc_GEM_charge_status_2.py <RunNumber>
0064 #+end_src
0065
0066 For example
0067
0068 #+begin_src text
0069 $ python3 daqdbreader_tpc_GEM_charge_status_2.py 82516
0070
0071 Begin: 1770149596
0072 End: 1770153193
0073
0074 Wrote:
0075 tpc_GEM_current_status/run_82516_GEM_BCO.csv
0076 #+end_src
0077
0078 This produces
0079
0080 #+begin_example
0081 tpc_GEM_current_status/run_82516_GEM_BCO.csv
0082 #+end_example
0083
0084 which contains
0085
0086 - GEM current draws (μA)
0087 - corresponding BCO timestamps
0088 - measurements sampled every 60 seconds over the duration of the run
0089
0090 ** Step 2: Create the CDB object
0091
0092 Execute
0093
0094 #+begin_src bash
0095 root -l FillGemCurrents.C
0096 #+end_src
0097
0098 Example output
0099
0100 #+begin_src text
0101 root [0]
0102 Processing FillGemCurrents.C...
0103
0104 Number of float entries: 60
0105
0106 ID: 0
0107 name N01R1G4 value: 45.072
0108 name N01R2G4 value: 33.124
0109 name N01R3G4 value: 12.686
0110 ...
0111
0112 ...
0113
0114 ID: 57
0115 name bco value: 915832872830666
0116
0117 ID: 58
0118 name bco value: 915833435820666
0119
0120 ID: 59
0121 name bco value: 915833998810666
0122 #+end_src
0123
0124 The macro writes
0125
0126 #+begin_example
0127 cdbttree.root
0128 #+end_example
0129
0130 * Inspecting the Output
0131
0132 The resulting ROOT file can be inspected with
0133
0134 #+begin_src bash
0135 root --web=off -l cdbttree.root
0136 #+end_src
0137
0138 Example session
0139
0140 #+begin_src text
0141 root [0]
0142 Attaching file cdbttree.root as _file0...
0143
0144 (TFile *) 0x3a0d4e0
0145
0146 root [1] .ls
0147
0148 TFile** cdbttree.root
0149 TFile* cdbttree.root
0150 KEY: TTree Multiple;1 Multiple
0151 #+end_src
0152
0153 The tree contains the GEM current values together with their corresponding BCO
0154 timestamps in a format compatible with the sPHENIX Conditions Database.
0155
0156 * Validation
0157
0158 The generated CDB object can be plotted to produce GEM current versus BCO
0159 distributions for every detector module.
0160
0161 The resulting traces reproduce the expected behaviour observed online in
0162 Grafana, including the gradual decrease in GEM current over the course of a
0163 physics run.
0164
0165 #+CAPTION: Grafana
0166 [[file:Grafana_GEM_Current.png]]
0167
0168 #+CAPTION: ROOT output
0169 [[file:ROOT_TTree_GEM_Current_Output.png]]
0170
0171 Agreement between the CDB output and the Grafana monitoring confirms that the
0172
0173 - DAQ database query,
0174 - BCO conversion, and
0175 - CDB object generation
0176
0177 are functioning correctly.
0178