-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement TH2Poly in DQM Services for HGCal DQM #41932
base: master
Are you sure you want to change the base?
Conversation
+code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-41932/35885
|
A new Pull Request was created by @ywkao for master. It involves the following packages:
@smuzaffar, @Dr15Jones, @makortel, @nothingface0, @emanueleusai, @cmsbuild, @pmandrik, @syuvivida, @tjavaid, @micsucmed, @rvenditti can you please review it and eventually sign? Thanks. cms-bot commands are listed here |
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 in addition the following places need to be amended accordingly
cmssw/DQMServices/FwkIO/plugins/DQMRootOutputModule.cc
Lines 250 to 253 in e18c96d
static TreeHelperBase* makeHelper(unsigned int iTypeIndex, TTree* iTree, std::string* iFullNameBufferPtr) { | |
switch (iTypeIndex) { | |
case kIntIndex: | |
return new IntTreeHelper(iTree, iFullNameBufferPtr); |
cmssw/DQMServices/FwkIO/plugins/DQMRootSource.cc
Lines 465 to 468 in e18c96d
m_treeReaders[kTProfileIndex].reset(new TreeObjectReader<TProfile>(MonitorElementData::Kind::TPROFILE, m_rescope)); | |
m_treeReaders[kTProfile2DIndex].reset( | |
new TreeObjectReader<TProfile2D>(MonitorElementData::Kind::TPROFILE2D, m_rescope)); | |
} |
How about adding some tests to make sure all the I/O components work properly? (I don't remember if there are already any such tests that could be easily amended)
double lowY, | ||
double highY, | ||
FUNC onbooking = NOOP()) { | ||
return bookME(name, MonitorElementData::Kind::TH2F, [=]() { |
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.
Shouldn't this be
return bookME(name, MonitorElementData::Kind::TH2F, [=]() { | |
return bookME(name, MonitorElementData::Kind::TH2Poly, [=]() { |
?
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.
Indeed, this should be corrected. I will update it in a commit accordingly.
/// set polygon bin (TH2Poly) | ||
void MonitorElement::addBin(TGraph *graph) { | ||
auto access = this->accessMut(); | ||
static_cast<TH2Poly *>(accessRootObject(access, __PRETTY_FUNCTION__, 2))->AddBin(graph); |
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.
What if the ROOT object is not TH2Poly
? The other similar functions throw an exception via the incompatible()
function.
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.
Indeed, incompatible()
function is necessary. This block of code will be modified as follows:
- static_cast<TH2Poly *>(accessRootObject(access, __PRETTY_FUNCTION__, 2))->AddBin(graph);
+ if (kind() == Kind::TH2Poly) {
+ static_cast<TH2Poly *>(accessRootObject(access, __PRETTY_FUNCTION__, 2))->AddBin(graph);
+ } else {
+ incompatible(__PRETTY_FUNCTION__);
+ }
@@ -140,7 +140,8 @@ struct MonitorElementData { | |||
TH2I = 0x23, | |||
TH3F = 0x30, | |||
TPROFILE = 0x40, | |||
TPROFILE2D = 0x41 | |||
TPROFILE2D = 0x41, | |||
TH2Poly = 0x60 |
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.
Why such a large gap between the previous value (0x41)?
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 guess I kept thinking of hexagons for a wafer map and then put a number starting with six. We can assign 0x24 for TH2Poly if it is feasible.
+ TH2Poly = 0x24,
TH3F = 0x30,
TPROFILE = 0x40,
- TPROFILE2D = 0x41,
- TH2Poly = 0x60
+ TPROFILE2D = 0x41
type hgcal |
please test |
+1 Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-03d614/33112/summary.html Comparison SummarySummary:
|
+code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-41932/35914
|
Pull request #41932 was updated. @smuzaffar, @Dr15Jones, @makortel, @nothingface0, @emanueleusai, @cmsbuild, @pmandrik, @syuvivida, @tjavaid, @micsucmed, @rvenditti can you please check and sign again. |
Okay, I will modify the lines and test it. Would PR #37665 be a good reference for the implementation of TH2Poly? Also, I would appreciate any instructions from experts on how to test all the I/O components. |
That PR indeeds looks like a good example. |
it doesn't depend on me :) |
// curr->update(it->getNbinsX() * it->getNbinsY(), | ||
// getEmptyMetric(it->getTH2Poly()->GetArray(), it->getNbinsX() + 2, it->getNbinsY() + 2, 0), | ||
// it->getNbinsX() * it->getNbinsY() * sizeof(int)); | ||
// break; |
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.
What about this code? Is something needed here? (I have no idea what exactly is being done in this function in general)
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 am not sure all the details either. I referred to PR#37665-files, the implementation of DQM support of TH1I and TH2I.
@mmusich could you help evaluate the necessity of having TH2Poly::GetArray() functionality? Maybe we need help from ROOT experts.
// double value2 = newMEtoEDMObject[i].object.GetBinContent(ibin); | ||
// double total = value1 + value2; | ||
// MEtoEdmObject[j].object.SetBinContent(ibin, total); | ||
// } |
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.
Does uncommenting of this block not compile? If that is the case (i.e. that motivates the specialization of the entire mergeProduct()
function), I think we need to think a bit for a solution that wouldn't require duplicating the entire logic of the mergeProduct()
function.
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, uncommenting this block of code can now compile without an error if a dummy structure in DataFormats/Histograms/test/metoedmformat_t.cc
is properly handled:
+ void Add(const Dummy* iOther, float weight=1.) { m_i += iOther->m_i; }
+ int GetNcells() const { return 9; }
+ float GetBinContent(int bin) const { return -1.; }
+ void SetBinContent(int bin, float value) const { return; }
+ const TClass* IsA() const { return 0; }
We can also remove the ad-hoc mergeProduct()
for TH2Poly and have minimal modification on L151:
- MEtoEdmObject[j].object.Add(&newMEtoEDMObject[i].object);
+ MEtoEdmObject[j].object.Add(&newMEtoEDMObject[i].object, 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.
After the modification of L151, I found that removing this ad-hoc TH2Poly addition code can also pass compilation and unit tests in DQMServices/Demo/test/runtests.sh
. To ensure the complete functionality, I plan to:
- Add polygonal bins test cases in
DQMServices/Demo/test/TestDQMEDAnalyzer.cc
. - Produce a few DQM root files for verification.
hi, since this PR touches the DQMStore which is the basic class that the clients use to manipulate/fill Histograms, we need to test it in our playback system DQM machines. The latter is unfortunately down for the programmed YETS, so I am afraid we will have to postpone this batch of test to the new year. |
code-checks |
-code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-41932/43100
Code check has found code style and quality issues which could be resolved by applying following patch(s)
|
+code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-41932/43111
|
Pull request #41932 was updated. @Dr15Jones, @antoniovagnerini, @cmsbuild, @makortel, @rseidita, @smuzaffar can you please check and sign again. |
please test |
+1 Size: This PR adds an extra 20KB to repository Comparison SummarySummary:
|
PR description:
This PR introduces a new type of DQM MonitorElement, TH2Poly, for HGCal DQM in the future. This feature allows a display of polygonal histograms on the CMS DQM GUI. As a demonstration, a wafer map can be displayed like the screenshot here [1].
TH2Poly is a 2D histogram class inherited from TH2. Polygonal bins, defined by TGraph, can be loaded using the AddBin() method. After setting up the polygonal bins, a TH2Poly object can store information through Fill() or SetBinContent().
A workflow for creating polygonal histograms looks like this:
DQM Service -> DQM EDAnalyzer -> CMS DQM GUI
An implementation of TH2Poly in DQM Service and MonitorElement is necessary to display the polygonal histograms. It involves updates on two repositories: cmssw and dqmgui_prod. A pull request is created in the dqmgui_prod repository [2] with a relevant issue reported in this link [3], which is about setting up a CMS DQM GUI with the new feature.
PR validation:
The workflow and the implementation have been tested: (a) From this feature branch, monitor elements of TH2Poly can be stored in a DQM root file [4]. (b) The DQM root file can be uploaded to a CMS DQM GUI, which is built following the steps noted in this issue [3]. Polygonal maps can be displayed on the DQM GUI, as demonstrated in [1].
[1] https://ykao.web.cern.ch/ykao/raw_data_handling/hgcal_dqm_gui/screenshot_demo_th2poly_wafermap.png
[2] cms-DQM/dqmgui_prod#14
[3] cms-DQM/dqmgui_prod#13
[4] A DQM root file containing demo polygonal maps: /afs/cern.ch/work/y/ykao/public/example_HGCAL_DQM/DQM_V0001_HGCAL_R000123469.root