Skip to content
This repository has been archived by the owner on Jan 31, 2022. It is now read-only.

Feature docs migration: Round II: Three macros and fitting.fitScanData #123

Merged
merged 14 commits into from
Jul 4, 2018

Conversation

lmoureaux
Copy link
Contributor

@lmoureaux lmoureaux commented Jun 29, 2018

Description

Add the documentation for:

  • clusterAnaScurve.py
  • gemTreeDrawWrapper.py
  • packageFiles4Docker.py
  • fitting.fitScanData

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Motivation and Context

#94

How Has This Been Tested?

Docs produced and viewed in man and a Web browser. Build available here.

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@bdorney
Copy link
Contributor

bdorney commented Jul 3, 2018

For clusterAnaScurve.py the following options are not reported:

  Options for channel mask decisionsParameters which specify how Dead, Noisy, and High Pedestal Channels are charaterized:
    --maxEffPedPercent=maxEffPedPercent
                        Percentage, Threshold for setting the HighEffPed mask
                        reason, if channel (effPed > maxEffPedPercent * nevts)
                        then HighEffPed is set
    --highNoiseCut=highNoiseCut
                        Threshold for setting the HighNoise maskReason, if
                        channel (scurve_sigma > highNoiseCut) then HighNoise
                        is set
    --deadChanCutLow=deadChanCutLow
                        If channel (deadChanCutLow < scurve_sigma <
                        deadChanCutHigh) then DeadChannel is set
    --deadChanCutHigh=deadChanCutHigh
                        If channel (deadChanCutHigh < scurve_sigma <
                        deadChanCutHigh) then DeadChannel is set

Most likely they did not make their way into the README.md but right now would be a good time to add them.

We should also make some statement that the immediate subdirectories of $DATA_PATH should be expected to be the GEMINImXLY directories which was not readily apparent previously. User reported this was not known which indirectly leads to #124 (the real fix should include some error message in the script of course but putting info into the documentation will also help!).

@bdorney
Copy link
Contributor

bdorney commented Jul 3, 2018

packageFiles4Docker.rst

I assume this is a typo and refers to packageFiles4Docker.py?

self.scanFuncs[vfat][ch] = r.TF1('scurveFit_vfat%i_chan%i'%(vfat,ch),'[3]*TMath::Erf((TMath::Max([2],x)-[0])/(TMath::Sqrt(2)*[1]))+[3]',
self.calDAC2Q_m[vfat]*1+self.calDAC2Q_b[vfat],self.calDAC2Q_m[vfat]*253+self.calDAC2Q_b[vfat])
self.scanHistos[vfat][ch] = r.TH1D('scurve_vfat%i_chan%i_h'%(vfat,ch),'scurve_vfat%i_chan%i_h'%(vfat,ch),
254,self.calDAC2Q_m[vfat]*0.5+self.calDAC2Q_b[vfat],self.calDAC2Q_m[vfat]*254.5+self.calDAC2Q_b[vfat])
Copy link
Contributor

@bdorney bdorney Jul 3, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the reason for this change? Which commit is this coming from? In a documentation PR I would not expect the algorithm to be changed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which commit is this coming from?

For the record: 3991798 I'll revert and update.

@@ -84,25 +170,28 @@ def feed(self, event):
if(event.vcal > 254):
self.scanCount[event.vfatN][event.vfatCH] += event.Nhits
else:
charge = self.calDAC2Q_m[event.vfatN]*(event.vcal)+self.calDAC2Q_b[event.vfatN]
charge = self.calDAC2Q_m[event.vfatN]*(256-event.vcal)+self.calDAC2Q_b[event.vfatN]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In a documentation PR we should not change the algorithm.

chargeBin = first_index_gt(self.scanHistosChargeBins[event.vfatN][event.vfatCH], charge)-1
self.scanHistos[event.vfatN][event.vfatCH].SetBinContent(chargeBin,event.Nhits)
self.scanHistos[event.vfatN][event.vfatCH].SetBinError(chargeBin,sqrt(event.Nhits))
self.scanHistos[event.vfatN][event.vfatCH].Fill(charge,event.Nhits)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This appears to be incorrect; I think you merged/rebased from a bad starting point.

fitTF1 = r.TF1('myERF','[3]*TMath::Erf((TMath::Max([2],x)-[0])/(TMath::Sqrt(2)*[1]))+[3]',
self.calDAC2Q_m[vfat]*1+self.calDAC2Q_b[vfat],self.calDAC2Q_m[vfat]*253+self.calDAC2Q_b[vfat])
fitTF1 = r.TF1('myERF','[3]*TMath::Erf((TMath::Max([2],x)-[0])/(TMath::Sqrt(2)*[1]))+[3]',
self.calDAC2Q_m[vfat]*1+self.calDAC2Q_b[vfat],self.calDAC2Q_m[vfat]*253+self.calDAC2Q_b[vfat])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In a documentation PR we should not change the algorithm.

print "| ------ | -- | ------- | ------ | -- | ------- | ------ | -- | ------- |"
while(stepN < 15):
rand = max(0.0, random.Gaus(10, 5)) # do not accept negative numbers

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For sure this is not correct as for the case of vfat3 it will cause only 1/2 of the CAL_DAC register to be scanned. Double check your commit history and revert this; you may need to cherry-pick to remove bad commits or resolve this issue.

fitTF1.SetParameter(0, self.calDAC2Q_m[vfat]*(8+stepN*8)+self.calDAC2Q_b[vfat])
fitTF1.SetParameter(1, self.calDAC2Q_m[vfat]*rand)
fitTF1.SetParameter(2, self.calDAC2Q_m[vfat]*(8+stepN*8)+self.calDAC2Q_b[vfat])
fitTF1.SetParameter(3, self.Nev[vfat][ch]/2.)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Algo shouldn't change in a documentation PR.

fitTF1.SetParLimits(0, 0.01, self.calDAC2Q_m[vfat]*(256)+self.calDAC2Q_b[vfat])
fitTF1.SetParLimits(1, 0.0, self.calDAC2Q_m[vfat]*(128)+self.calDAC2Q_b[vfat])
fitTF1.SetParLimits(2, 0.0, self.calDAC2Q_m[vfat]*(256)+self.calDAC2Q_b[vfat])
fitTF1.SetParLimits(3, 0.0, self.Nev[vfat][ch] * 2.)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same

0.0,
self.calDAC2Q_m[vfat]*(8+stepN*8)+self.calDAC2Q_b[vfat],
self.calDAC2Q_m[vfat]*(256)+self.calDAC2Q_b[vfat]
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

self.scanFitResults[3][vfat][ch],
self.scanFitResults[5][vfat][ch],
self.scanFitResults[3][vfat][ch] / self.scanFitResults[5][vfat][ch])
pass
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

@@ -93,7 +92,7 @@
# #Set the Latency - 10x10 PMT on R&D Setup
# "CFG_LATENCY":98,
# #Correct the bug in the shaper
# "CFG_PT":7,
# "CFG_PT":3,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

revert.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And this is 873af00

@@ -128,7 +127,7 @@
# #Set the Latency - 10x10 PMT on R&D Setup
# "CFG_LATENCY":98,
# #Correct the bug in the shaper
# "CFG_PT":7,
# "CFG_PT":3,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

revert

Copy link
Contributor

@bdorney bdorney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like the starting point for these changes was not chosen adequately as significant changes to the algorithms are made; no go for a documentation PR. Double check branch/merge/rebase points and revert commits where necessary.

@bdorney
Copy link
Contributor

bdorney commented Jul 3, 2018

I didn't have a look at the added documentation for the others:

gemTreeDrawWrapper.py
packageFiles4Docker.py
fitting.fitScanData

But my overall comment would be to xcheck the help menu of the actual script to make sure what is included in the documentation reflects that.

Also due to laziness of imports we may have some options that do nothing (since we use a common options menu for several scripts). This is certainly the case in vfatqc. If this is the case here we should try not to have those in the documentation (not sure if that is possible).

@lmoureaux
Copy link
Contributor Author

Probably forgot to refresh the files in my editor after a git rebase. Will fix.

@lmoureaux lmoureaux force-pushed the feature_docs_migration branch from 873af00 to d0f80a4 Compare July 3, 2018 13:12
@lmoureaux
Copy link
Contributor Author

Removed all code changes from history.

@lmoureaux
Copy link
Contributor Author

For clusterAnaScurve.py the following options are not reported:

The documentation says:

Finally clusterAnaScurve.py can also be passed the cut values used in assigning a maskReason described at Providing Cuts for maskReason at Runtime.

I copied this from the README, but adding the options is a 10min change.

@bdorney
Copy link
Contributor

bdorney commented Jul 3, 2018

I copied this from the README, but adding the options is a 10min change.

Great, so I trust you'll be able to quickly implement it.

--maxEffPedPercent
--highNoiseCut
--deadChanCutLow
--deadChanCutHigh

See PR cms-gem-daq-project#123
lmoureaux added a commit to lmoureaux/gem-plotting-tools that referenced this pull request Jul 3, 2018
@lmoureaux lmoureaux force-pushed the feature_docs_migration branch from b7fb74f to a7ff025 Compare July 3, 2018 14:10
@lmoureaux
Copy link
Contributor Author

But my overall comment would be to xcheck the help menu of the actual script to make sure what is included in the documentation reflects that.

Done.

Also due to laziness of imports we may have some options that do nothing (since we use a common options menu for several scripts). This is certainly the case in vfatqc. If this is the case here we should try not to have those in the documentation (not sure if that is possible).

Easy, just don't include it in the docstring (it will still be shown by -h)

@bdorney
Copy link
Contributor

bdorney commented Jul 4, 2018

travis had a time out issue again. Could you re-start 156.6?

Probably everything is fine; but should xcheck before merging.

Copy link
Contributor

@jsturdy jsturdy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@lmoureaux lmoureaux mentioned this pull request Jul 4, 2018
8 tasks
@jsturdy jsturdy merged commit b396b34 into cms-gem-daq-project:develop Jul 4, 2018
jsturdy pushed a commit that referenced this pull request Jul 4, 2018
jsturdy pushed a commit that referenced this pull request Jul 4, 2018
@lmoureaux lmoureaux deleted the feature_docs_migration branch July 9, 2018 14:27
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants