-
Notifications
You must be signed in to change notification settings - Fork 26
Migrating Analysis Tools from vfatqc-python-scripts to gem-plotting-tools #4
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
anaUltraScurve was not merged properly.
anaUltraScurve.py
Outdated
fitENC = [] | ||
strList = [] | ||
masks.append([]) | ||
for ch in range (0, 128): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was not correctly merged. This should now be a loop over strips and also lookup_table should be changed to chToStrLUT.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fitSums x-axis is labeled Strips but the resulting output is in channel units this way. I do things for a reason, one of the two LUT replaces lookup_table and the other is new so I could make fitSums in strip units easily.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The resulting x-axis is the same in both cases...if it's a concern over axis labeling then I would prefer the implementation shown in anaUltraThresholds.py:
https://github.com/bdorney/gem-plotting-tools/blob/master/anaUltraThreshold.py
Lines 81-119
If I understand this correctly it makes the output plots x-axis based on the three user input options automatically:
->strips
->vfat ch
->panasonic pins
Might be good to unify this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not true, look at my code harder. The code this way will definitely be in channel units.
This first version of fitSums is only in strip units, I will add other options when I clean up the code that takes care of switching between the three cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Look at the output plot, the distributions are following each other. The x-axis labels may be wrong but the value plotted in fitSummary appears to follow Summary. For example look at VFAT0, the spike matches in the two positions. Also VFAT3 and VFAT4 match pretty well. The rest appear to also.
I doubt this is just a coincidence. Again it seems like the problem is the label on the x-axis
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that is right, strList fixes it, I forgot I did that. We should add panList and chList so we can control which we pass to build the TGraphErrors and can control the units of the x-axis then. As the code is now, it will always be in strip units.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be better to have one variable here instead of strList which gets passed to the TGraphErrors constructor which is filled depending on the users choice.
anaUltraScurve.py
Outdated
for i, line in enumerate(intext): | ||
if i == 0: continue | ||
mapping = line.rsplit('\t') | ||
#chToStrLUT[int(mapping[0])][int(mapping[2]) - 1] = int(mapping[1]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use my more complete set of LUTs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, would prefer the implementation shown in anaUltraThresholds.py:
https://github.com/bdorney/gem-plotting-tools/blob/master/anaUltraThreshold.py
Lines 81-119 to automatically ensure the correct mapping & x-axis label.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we please change the name of lookup_table to chToStrLUT because it is more descriptive. lookup_table is a terrible variable name. I might as well call all my integers int1 int2 int3...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair point, will do, but I will use "strip" to avoid confusion with "string"
anaUltraScurve.py
Outdated
for vfat in fitSums.keys(): | ||
r.gStyle.SetOptStat(0) | ||
canv.cd(vfat+1) | ||
fitSums[vfat].Draw('ap') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Crashes here when not using the -f option:
Traceback (most recent call last):
File "/home/louis/Documents/CERN Summer School/GEM/gem-plotting-tools/anaUltraScurve.py", line 367, in <module>
for vfat in fitSums.keys():
NameError: name 'fitSums' is not defined
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At @cbravo135 is there are usage case where we would not want to use the option -f
this seems like the primary use case...
...nevermind I'll just patch it, simple fix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is an easy fix anyways right? Just put the if protection like the rest of the blocks for the fitting option. The idea is without -f it only makes the Summary plot and runs faster since it is skipping all the fitting part. This plot doesn't make sense unless you do the fits, I just forgot to put the if part to protect it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes in fact I've already patched it, just making some updates to anaUltraLatency so it will make summary plot as a 8x3 grid
anaUltraScurve.py
Outdated
canv.cd(vfat+1) | ||
fitSums[vfat].Draw('ap') | ||
canv.Update() | ||
for vfat in fitSums.keys(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no reason to have .keys() here, that is what python uses by default when you iterate over a dict.
@@ -83,4 +83,3 @@ | |||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like you still haven't added the 8x3 summary plot yet, so I will wait to approve.
Addressing:
#3
cms-gem-daq-project/vfatqc-python-scripts#99
cms-gem-daq-project/vfatqc-python-scripts#104
Also addressing:
cms-gem-daq-project/vfatqc-python-scripts#98
Also built on:
cms-gem-daq-project/vfatqc-python-scripts#100
Tested:
http://cmsonline.cern.ch/cms-elog/998496
Requires joint PR:
cms-gem-daq-project/vfatqc-python-scripts#105
User should have following
$SHELL
variables declared:$BUILD_HOME
$DATA_PATH
$ELOG_PATH
Then execute:
setup/paths.sh
Then you'll be ready to go.
Description of how to use ana_scans.py to analyze scan data is found:
https://twiki.cern.ch/twiki/bin/view/CMS/GEMDOCDoc#How_to_Produce_Scan_Plots
Note ana_scans.py was tested separately on a clone of $DATA_PATH on the gemdqm machine. However I didn't make an E-Log documenting this (rookie mistake!).
Requesting review from @cbravo135 and @mexanick