Skip to content

Commit d261e4b

Browse files
committed
repo tided up and README_Analysis completed
1 parent dc83f4f commit d261e4b

File tree

9 files changed

+69
-17
lines changed

9 files changed

+69
-17
lines changed

DQM_SiPM.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ def parsing():
2121

2222
parser.add_argument("-N", "--runs_interval", default=None, help="Runs to run", nargs='+')
2323

24+
parser.add_argument("--No_list", default=False, action='store_true', help="Enforce no bad/good run listing")
25+
26+
2427
args = parser.parse_args()
2528
return args
2629

@@ -418,7 +421,7 @@ def circle_filter(h_arr, cx, cy, rx, ry):
418421
canvas['wave'][k].SetLogz()
419422
h.DrawCopy('colz')
420423
canvas['wave'][k].Update()
421-
canvas['wave'][k].SaveAs(out_dir + '/Waveform_ch{:02d}.png'.format(k))
424+
canvas['wave'][k].SaveAs(out_dir + '/WaveColor_ch{:02d}.png'.format(k))
422425

423426
'''=========================== Track position ==========================='''
424427
if conf['idx_dut'] >= 0:
@@ -782,7 +785,7 @@ def create_regression_input(x, y, amp):
782785
if aux > 0.3:
783786
print '\n\n============ Run to be discarted!!!!! ===============\n\n'
784787

785-
if 'List' in configurations.TracksConsistency.keys() and flag[1:].isdigit():
788+
if (not args.No_list) and ('List' in configurations.TracksConsistency.keys() and flag[1:].isdigit()):
786789
f_aux = flag[1:]
787790
file = args.save_loc
788791
if aux > 0.3:

README.md

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,4 @@
11
# DataQualityMonitor
2-
Code to control the quality of data
2+
Code to control the quality of data and run the analysis.
33

4-
DQM_Coincidence.py Instructions
5-
Run Dat2Root first
6-
Use the root file from Dat2Root, run DQM_Coincidence.py
7-
Example of how to run code
8-
python DQM_Coincidence.py S13360-3025_10450_57V_anotherSiPM_57V_Na22_Coincidence_version2.root -S /home/lab-cpt03/DataQualityMonitor-master -N 0 0
9-
-S is the saving location
10-
-N is the number of runs, we only need to run once, put 2 numbers that are the same
11-
Default config file: Na22_config.txt
12-
need to add what graphs to draw in the first row, example: IL_2
4+
### Sorry, README file needs to be updated. You can still check directly the code header.

README_Analysis.md

Lines changed: 55 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ mkdir data/VME/RECO
1010
mkdir data/Tracks
1111
mkdir data/NimPlus
1212
13+
mkdir results
14+
1315
git clone https://github.com/CaltechPrecisionTiming/TimingDAQ.git
1416
git clone https://github.com/CaltechPrecisionTiming/DataQualityMonitor.git
1517
@@ -20,8 +22,58 @@ cd -
2022

2123
Copy in the proper data folder all the necessary collected data.
2224

25+
Optional: what is possible to do it to replace the folder results with a symbolic link to the eos ww folder. A possible example is:
26+
```
27+
rmdir results
28+
ln -s ~/cernbox/www/TB results
29+
```
30+
2331
## Decode the raw data and create root files
2432

25-
Create config files to run on the desired channels. A new version of config files is supposed to be created for each different set of analysis (i.e. whenever the analyzed channel content is not consistent).
26-
Two config files need to be created and placed in the proper directories. One for ``TimingDAQ`` with the name ``VME_<v>.config`` (like this one [here](https://github.com/CaltechPrecisionTiming/TimingDAQ/blob/master/config/FNAL_TestBeam_1811/VME_vr3.config)) and on for the DQM with the name ``VME_<v>.txt`` (like this one [here](https://github.com/CaltechPrecisionTiming/DataQualityMonitor/blob/master/config/FNAL_TB_1811/VME_vr3.txt)), where ``<v>`` is the version name. The standard is to use ``v<N>`` for TB versions and ``vr<N>`` for post TB versions, where ``<N>`` is an increasing number.
27-
When creating the ``TimingDAQ`` config make sure that it is placed in the same directory stated [here](https://github.com/CaltechPrecisionTiming/TimingDAQ/blob/master/automation/DecodeData.py#L14).
33+
Create config files to run on the desired channels. A new version of config files is supposed to be created for each different set of analysis (i.e. whenever the analyzed channel content is not consistent). We will work in the assumption that for the set of considered runs the hardware has not been modified (OV, cable length, position w.t.r. to the tracker, etc.).
34+
Two config files need to be created and placed in the proper directories. One for ``TimingDAQ`` with the name ``VME_<v>.config`` (like this one [here](https://github.com/CaltechPrecisionTiming/TimingDAQ/blob/master/config/FNAL_TestBeam_1811/VME_vr3.config)) and on for the DQM with the name ``VME_<v>.txt`` (like this one [here](https://github.com/CaltechPrecisionTiming/DataQualityMonitor/blob/master/config/FNAL_TB_1811/VME_vr3.txt)), where ``<v>`` is the version name. The standard is to use ``<v> = v<N>`` for TB versions and ``<v> = vr<N>`` for post TB versions, where ``<N>`` is an increasing number.
35+
When creating the ``TimingDAQ`` config make sure that it is in a directory consistent with [this](https://github.com/CaltechPrecisionTiming/TimingDAQ/blob/master/automation/DecodeData.py#L14).
36+
37+
### Configurations validation
38+
39+
Before running the decoding on the full set of runs it is necessary to be sure that the two config are properly set. Particular attention needs to be given to the baseline computation interval.
40+
For this purpose, decode one single condition-safe run (let's assume it has a run number ``<RN>``), version you are willing to use.
41+
```
42+
cd TimingDAQ
43+
python automation/DecodeData.py --vVME <v> -f -R <RN>
44+
```
45+
In the DQM config, make sure to add the ``WaveColor`` plot in the print statement. Then run:
46+
```
47+
mkdir results/<v>
48+
cd DataQualityMonitor
49+
python DQM_SiPM.py -C config/<TB_dir>/VME_<v>.txt -S ../results/<v>/ -i ../data/VME/RECO/<v>/DataVMETiming_RunXXX.root -N <RN> --No_list
50+
```
51+
Check the DQM output plot to validate the config file. In particular check form ``WaveColor_ch*.png`` taht the baseline is properly computed.
52+
53+
When the config is finalized, remove ``WaveColor`` from the print statement.
54+
55+
### Decode the whole set of runs
56+
57+
To create the root output file for all the runs in the interval ``<N_st>`` - ``<N_end>``:
58+
```
59+
cd TimingDAQ
60+
python automation/run_REdecode.py --opt_DecodeData "xxNO_save_meas" --v_fast <v> -R <N_st> <N_end> --run_DQM
61+
```
62+
It might be usefull to use add ``xxforce`` at the string passed to ``--opt_DecodeData`` in order to force the re-processing.
63+
Inside the ``results/<v>`` folder two files conteinning the good runs an bad runs will be automatically created if ``List`` is present in the ``TracksConsistency`` statement of the DQM config.
64+
65+
### Run the analysis
66+
67+
Two different analysis scripts exists. The first one is meant to run on tiles: it runs the analysis on single channels and produce plots tile-orinted. The second one is meant to run on bars: it runs the analysis on couple of channels and produce plots bars-orinted.
68+
Both of them require the creation of a special config file which states the details of the analysis. Example of the config file can be found [here](https://github.com/CaltechPrecisionTiming/DataQualityMonitor/blob/master/config/FNAL_TB_1811/Analysis_SiPM_Tile_vr21.txt) for tiles analysis and [here](https://github.com/CaltechPrecisionTiming/DataQualityMonitor/blob/master/config/FNAL_TB_1811/Analysis_SiPM_Bar_vr4.txt) for bars analysis.
69+
70+
When the config file is ready, run the tile analysis with:
71+
```
72+
python Analysis_SiPM_Tile.py -C config/<TB_dir>/Analysis_SiPM_Tile_<vA>.txt -S ../results/<v>/ -i ../data/VME/RECO/<v>/DataVMETiming_RunXXX.root -N ../results/<v>/TracksConsistency_Good.txt
73+
```
74+
where ``<vA>`` is the analysis version. The standard is to use ``<vA> = <v><NA>``, where ``<NA>`` is an incremental number identifying the subversion of the analysis, if any (e.g. ``<vA> = vr1`` or ``<vA> = vr12``).
75+
It is save to run different analysis versions on the same reco version since different directories will be created.
76+
Similarly, to run the bar analysis:
77+
```
78+
python Analysis_SiPM_Bar.py -C config/<TB_dir>/Analysis_SiPM_Bar_<vA>.txt -S ../results/<v>/ -i ../data/VME/RECO/<v>/DataVMETiming_RunXXX.root -N ../results/<v>/TracksConsistency_Good.txt
79+
```

config/FNAL_TB_1811/VME_vr1.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#-->Print: Amp PosRaw PosWeight TimeResRaw TimeCorrected
2-
-->Print: AllTracks Amp Int PosRaw PosSel+ PosWeight
2+
-->Print: AllTracks Amp Int PosRaw PosSel+ PosWeight WaveColor
33
-->XYcenter-width: 15 25 10
44
-->TracksCleaning: CutOnCh9 ntracks==1 chi2<5
55
-->TracksConsistency: RefCh9 List
File renamed without changes.

runDQM.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
source ~/.bash_profile
22
cd $3/DataQualityMonitor
3-
python DQM_SiPM.py -C config/FNAL_TB_1811/VME_$2.txt -S ~/cernbox/www/FNAL_TB_1811/$2/ -i ../data/VME/RECO/$2/DataVMETiming_RunXXX.root -N $1
3+
4+
if [ ! -d "../results/$2" ]; then
5+
mkdir -p ../results/$2
6+
fi
7+
8+
python DQM_SiPM.py -C config/FNAL_TB_1811/VME_$2.txt -S ../results/$2/ -i ../data/VME/RECO/$2/DataVMETiming_RunXXX.root -N $1

0 commit comments

Comments
 (0)