-
Notifications
You must be signed in to change notification settings - Fork 26
Ge21 generalizing #252
Ge21 generalizing #252
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.
- extraneous whitespace should be cleaned up
- all debugging
print
statements should be removed (or added to an appropriatedebug
block) - all necessary
print
s should bepython3
compatible, i.e.,print()
instead ofprint
- all new string formatting should use
"{}".format()
rather than"%"()
style
I think there are some additional lookup optimizations that can be made, so that map lookups happen only as needed
utils/threshAlgos.py
Outdated
# initialize a TGraphErrors and a TF1 for each vfat | ||
for idx in range(len(dacNameArray)): | ||
dacName = np.asscalar(dacNameArray[idx]) | ||
for entry in crateMap: | ||
ohKey = (entry['shelf'],entry['slot'],entry['link']) | ||
for vfat in range(0,25): #24th VFAT represents "overall case" | ||
for vfat in range(0,vfatsPerGemVariant[gemType]+1): #24th VFAT represents "overall case" |
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.
unfortunately, there are two conventions for the "all VFATs summary" plot, one is to put it in index -1, one is to put it in index 24
this should be cleaned up everywhere, but this is outside this PR
when you go to address comments, you should |
I do have some questions as shown by the comments to code blocks, and after those are answered, I can fix and test on files again to make sure everything is working correctly |
OK, it would probably be good to sit together and go over the |
763ebf2
to
c987b20
Compare
I looked into this and I removed the extraneous commits and rebased them on the newest changes. The commit log shows only the 6 commits on top of the develop branch, so all seems to have worked, but this might need to be looked over since my git skills are still pretty poor 😝 |
ieta_h_ch[ieta] = r.TH1F("h_ieta{0}_chan_vs_hit".format(ieta), "i#eta = {0} | i#phi (1,2,3)".format(ieta), 384, 0., 384.) | ||
for ieta in range(1, maxiEta+1): | ||
ieta_h_strip[ieta] = r.TH1F("h_ieta{0}_strips_vs_hit".format(ieta), "i#eta = {0} | i#phi (1,2,3)".format(ieta), 128*maxiPhi, 0., 128.*maxiPhi) | ||
ieta_h_ch[ieta] = r.TH1F("h_ieta{0}_chan_vs_hit".format(ieta), "i#eta = {0} | i#phi (1,2,3)".format(ieta), maxChans*maxiPhi, 0., maxChans*maxiPhi) | ||
ieta_h_sbitSize[ieta] = r.TH1F("h_ieta{0}_sbitSize_vs_hit".format(ieta), "i#eta = {0} SBIT Size".format(ieta), 8, 0., 8.) |
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.
Here possibly 8
-> NUM_IETA_SECTORS
Actually, I think it's the s-bit partition, which is not tied to the ieta
sectors
|
||
# loop over all branch names but the first (evnt num) | ||
from gempython.gemplotting.mapping.chamberInfo import chamber_vfatPos2iEtaiPhi as vfat_to_etaphi | ||
|
||
from gempython.utils.gemlogger import printRed, printYellow | ||
print("Analyzing Raw Data\nThis may take some time please be patient") | ||
h_clusterMulti = r.TH1F("h_clusterMulti".format(vfat), "", 9,-0.5,8.5) |
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.
Here possibly 9
-> NUM_IETA_SECTORS+1
, probably best to check the semantics when the Fill
is done
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.
Hard to tell, but I don't think. This variable is based on a loop that runs over the clusterNames which are derived from the branches in file, ie
gem-plotting-tools/anaSBitReadout.py
Lines 282 to 295 in c987b20
for cName in clusterNames: | |
# Remove in a later refactoring | |
# Right now if an sbit is not sent L1A delay will be max and sbit address is 0x0 and cluster size is 0x0, this is 0x3ffc000; so we ignore this word | |
# Otherwise it will always report SBIT 0 of VFAT 7 | |
word = event[cName] | |
if word == 0x3ffc000: | |
continue | |
# INVALID ADDRESS CHECK | |
sbitAddr = ((word) & 0x7FF) | |
if sbitAddr >= 1536: | |
continue | |
nValidClusters+=1 |
and
gem-plotting-tools/anaSBitReadout.py
Lines 190 to 193 in c987b20
for branch in inT.GetListOfBranches(): | |
bNames.append(branch.GetName()) | |
clusterNames = copy.deepcopy(bNames) | |
clusterNames.remove("evtNum") |
@@ -313,7 +314,7 @@ def fit(self, debug=False): | |||
|
|||
if debug: | |||
if self.isVFAT3: | |||
print "| %i | %i | %i | %i | %f | %f | %f | %f | %f | %f | %f | %f | %f |"%( | |||
print("| {0} | {1} | {2} | {3} | {4} | {5} | {6} | {7} | {8} | {9} | {10} | {11} | {12} |".format( |
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 wasn't my intention with my comment to have you do all the conversions, (just the ones that were in code you added/modified), but it's a good thing to have done anyway :-)
However, here does the formatting stay constant?
I suppose it can guess at the type, just need to make sure there isn't any implicit type conversion happening during the formatting...
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.
I ended up doing a replace for the files I edited, and changed up the numbers when need be! I can add types to these just to be on the safe side
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.
A few small checks
utils/scurveAlgos.py
Outdated
#### Off by one error...? | ||
vfatHistos[event.vfatN].SetBinContent(63-(stripPinOrChan+1),chargeBin,event.Nhits) | ||
vfatHistos[event.vfatN].SetBinError(63-(stripPinOrChan+1),chargeBin,sqrt(event.Nhits)) |
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 seems like an off by one error, namely the (64-1) and (stripPinOrChan+1) seem to be in opposition, eg
stripPinOrChan = 0 => bin = 62
stripPinOrChan = 63 => bin = -1
Want to confirm before I try and change 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.
I don't know...
- What is the valid range of values for
stripPinOrChan
? - What do the current histograms look like (especially if you show the over/underflow stats)
- All things being equal, it looks to me like the
+1
should be outside the parentheses, and maybe alsovfatHistos
should bevfatHistosPanPin2
...
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.
I did some tests, and having the +1 outside was correct. stripPinOrChan in {0,...,127} and the code works by if done by PanPin, the channels are split between the two histograms, vfatHistos
and vfatHistosPanPin2
, each having a domain of [0,63].
All that being said, I made the fix!
Ran tests and made minor changes. Tests are the same as before, namely:
I did notice that All of the gemType reading in is surrounded by comments saying If anyone has files for run over the files I haven't checked or wants other files, namely in the |
You can verify by using the unmodified code to run the same analysis on the same file (since it's GE1/1) |
I ran the code in the develop branch, and it seems like this code isn't used much because it doesn't work out of the box! ( |
@AndrewLevin there was some issue in the past that was related to this |
Pinging for status |
I think maybe you are referring to this change but that has nothing to do with this.
|
OK, thanks @AndrewLevin, I just wanted to make sure that this change was properly motivated and not rehashing something historical. |
@dteague, sorry, can you |
Question whether all macros need to be switched/what files are used regularly
eabd5de
to
6612de6
Compare
Just took care of that. Hopefully I rebased correctly and all is up to snuff! |
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.
Ready for squash
While testing the new GE2/1 setup at FIT, Stephen and I encountered an issue with the usage of this PR within the GE2/1 compatibility PR in Indeed, in In fact, why is the GEM type even required to be given to the DB util functions? I mean, one should be able to request the data for an arbitrary number of VFATs; 24 for GE1/1, 12 for GE2/1 or n for a manual lookup. I see that gem-plotting-tools/utils/dbutils.py Line 176 in 6612de6
Couldn't |
Very fair, @lpetre-ulb, that is a much better implementation that I didn't see! Let me fix that quickly |
Thank you for the quick fix @dteague! |
|
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.
now ready for squash
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.
I think it is fine to merge and start testing. Bug reports/fixes should be provided upon necessity.
@sbutalla and I discovered what seems like a bug yesterday in the DAC scans plots for GE2/1 (at least). The title is a fifth order polynomial and the axis do not have any legend. Stephen, can you open an issue? I don't have access to the plots. |
PR for changing the gem plotting code to be compatible with GE21 plotting
Description
The gem-plotting code is hardcoded with many magic numbers that are specific to the GE11, so with changes in the tree structure to add gemtype and detectortype, the plotting code can be expanded to allow for GE21 plotting that is determined on the fly by this gemType variable.
The bulk of the code is removing instances of 24, 8, 3, and combinations of these to more generic variables, ie nVFATS, maxiEta, maxiPhi. These variables are derived from
chamber_maxiEtaiPhiPair
in./mapping/chamberInfo.py
and fromvfatsPerGemVariant
ingempython.tools.hw_constants
All of the mapping/chamberInfo.py variables have been turned into dictionaries that require the gemType to get the correct variables, iechamber_vfatPos2iEta => chamber_vfatPos2iEta["ge11"]
etc.
Since a large code change is the actual canvas creation code, the largest change is to canvas making. The
makeAxBCanvas
has been removed in place of merging this functionality into thesaveSummaryCanvas
to make a new function calledgetSummaryCanvas
. This means the function now always returns a canvas created and there is a flag to decide to save the canvas or not. ie function def is nowAlso, because the
makeAxBCanvas
function also added histograms to an existing canvas, this functionality has be put to a helper functionaddPlotToCanvas
which hopefully will make the code more readable as well. So the change becomesLast, many functions include now a gemType variable that needs to be supplied to give the right gemType. The default is "ge11", so the code remains backwards compatible for all cases where the gemType isn't actually supplied.
Types of changes
Motivation and Context
This change has mainly be motivated to be backwards compatible and to default to ge11 in all unknown cases. Since ge21 is needing plots specifically made for it (and not ones derived from ge11 algorithms), having code that can flexibly handle ge21 and in the future, me0 is a must.
For further information on this, look at issue #226
How Has This Been Tested?
For testing, the code was run over ge11 and ge21 files with the internal gemType flag flipped (ge21 files didn't have that tree in it).
NOTE: currently, only the main run files (ie files in the top directory) are changed. Files in the
./macros
area have not been touched. Here is a list of what has been done.anaDACScan.py
,anaUltraScurve.py
,anaSBitThresh.py
,anaUltraLatency.py
- work for bothanaUltraThreshold.py
,anaSBitMonitor.py
- work for ge11, could not fine ge21 fileanaSBitReadout.py
,anaXDAQLatency.py
- could not find input file for eitherChecklist: