Skip to content
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

Introduction of New-All-In-One tool for Offline Validation of TrkAlignment #38304

Merged
merged 35 commits into from Nov 8, 2022

Conversation

antoniovagnerini
Copy link
Contributor

PR description:

The aim of this PR is to introduce a new "All-In-One-Tool" common interface for the offline validation of the alignment. In particular, the validations affected are the functionality of DMR, PV (and relative trends), Geometry Comparisons as well as the JetHT validation.

The main improvements consist in the following:

  • semi-automatic analysis using CRAB
  • compatibility with Python3
  • git for output tracking
  • common plotting style for trends

PR validation:

Unit test have been devised for each validation type to ensure correctness of the outcome.

@connorpa @consuegs @mmusich

@cmsbuild
Copy link
Contributor

cmsbuild commented Jun 9, 2022

@tvami
Copy link
Contributor

tvami commented Jun 9, 2022

@antoniovagnerini seems we have a merge conflict

CONFLICT (content): Merge conflict in Alignment/OfflineValidation/scripts/validateAlignments.py
Auto-merging Alignment/OfflineValidation/test/BuildFile.xml
CONFLICT (content): Merge conflict in Alignment/OfflineValidation/test/BuildFile.xml

Please resolve conflict and commit again.

Also having more commits than the number of files changed... that's somewhat discouraged. Please group them together into a few bigger commits with the squash option of git.

@tvami
Copy link
Contributor

tvami commented Jun 9, 2022

Oh also, just looking at the first file, .gitignore should not be commited.

@mmusich
Copy link
Contributor

mmusich commented Jun 9, 2022

Also what does "aligned" in the title mean?

@tvami
Copy link
Contributor

tvami commented Jun 9, 2022

type trk

@cmsbuild cmsbuild added the trk label Jun 9, 2022
@tvami
Copy link
Contributor

tvami commented Jun 10, 2022

@cms-sw/orp-l2 can you remind me what's our review policy for files under /bin/? Is that the same policy as for /test/?

@tvami
Copy link
Contributor

tvami commented Jun 10, 2022

@antoniovagnerini et al, I see a few files added under /data/, so those should technically go into the cms-data repository not the main repo here

Comment on lines +48 to +50
#define logInfo std::cout << "INFO: "
#define logWarning std::cout << "WARNING: "
#define logError std::cout << "ERROR!!! "
Copy link
Contributor

Choose a reason for hiding this comment

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

Wouldnt it have been easier to just used the MsgLogger variants of this?

Copy link
Contributor

Choose a reason for hiding this comment

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

in the original implementation this was part of a ROOT macro which was supposed to work also without a cms environment. Given this is now in interface (even though it not very clear to me why it should be the case....) and so by construction implied to be distributed with cmssw, it probably makes sense to change it to MsgLogger.

public:

SmartSelectionMonitor(){}
~SmartSelectionMonitor() { }
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
~SmartSelectionMonitor() { }
~SmartSelectionMonitor() = default;

Copy link
Contributor

Choose a reason for hiding this comment

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

Addressed in next commit.

Copy link
Contributor

@tvami tvami left a comment

Choose a reason for hiding this comment

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

Some cleanup/cosmetic changes / memory leak suggestion for new

h->Reset("ICE");
h->SetDirectory(gROOT);
(*map)[tag] = h;
// printf("new histo created with name = %30s and tag = %15s: Name=%s\n",allName.c_str(), tag.c_str(), h->GetName());
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove commented out code

Copy link
Contributor

Choose a reason for hiding this comment

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

Addressed in next commit.

if(h->second->GetEntries()>0)neverFilled = false;

if(h->first=="all"){h->second->SetName(Form("%s_%s",h->first.c_str(),h->second->GetName()));}
//printf("histo = %30s tag = %15s Name = %s\n",it->first.c_str(), h->first.c_str(), h->second->GetName());
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here

Copy link
Contributor

Choose a reason for hiding this comment

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

Addressed in next commit.

#include <TROOT.h>
#include <TCanvas.h>
#include <TLegend.h>
//#include <TH1.h> // TODO
Copy link
Contributor

Choose a reason for hiding this comment

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

is this still a TODO?

Copy link
Contributor

Choose a reason for hiding this comment

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

Removed in next commit.

Comment on lines 45 to 41
//float dZTest =2;
//float xLegObj = 20;
//float yLegObj = 18;

Copy link
Contributor

Choose a reason for hiding this comment

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

same here

Copy link
Contributor

Choose a reason for hiding this comment

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

Cleaned in next commit.

//Plot10Mu( name, xLim/2, yLim, 0.2*xLim );
TPaveText* atext = new TPaveText(0.2*xLim,0.85*yLim,0.66*xLim,0.99*yLim);
//atext->AddText(sliceLeg);
Copy link
Contributor

Choose a reason for hiding this comment

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

you added a commented line... either explain why this might be needed or remove

Copy link
Contributor

Choose a reason for hiding this comment

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

Cleaned.

Comment on lines 97 to 109
//char outfile[192];
//sprintf( outfile, "%s/%s.png", outputDir_, name );
//OBPCanvas->Print( outfile );
std::ostringstream outfile_s;
outfile_s << outputDir_ << "/" << name << ".png";
TString outfile(outfile_s.str());
OBPCanvas->Print( outfile );
sprintf(outfile, "%s/%s.pdf", outputDir_, name);
OBPCanvas->SaveAs(outfile);
std::ostringstream outfile2_s;
outfile2_s << outputDir_ << "/" << name << ".pdf";
TString outfile2(outfile2_s.str());
//sprintf(outfile, "%s/%s.pdf", outputDir_, name);
//OBPCanvas->SaveAs(outfile);
Copy link
Contributor

Choose a reason for hiding this comment

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

same

Copy link
Contributor

Choose a reason for hiding this comment

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

Yep. Generally I left only quite an extensive snippet of code with makeRZArrowPlot function commented out. I believe that is unnecessary to remove.

Comment on lines 352 to 349
//Specify that only 'tracks' is allowed
//To use, remove the default given above and uncomment below
//ParameterSetDescription desc;
//desc.addUntracked<edm::InputTag>("tracks","ctfWithMaterialTracks");
//descriptions.addDefault(desc);
Copy link
Contributor

Choose a reason for hiding this comment

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

this default text could be cleaned up

Copy link
Contributor

Choose a reason for hiding this comment

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

That explains why text bellow is commented out and when it should be un-commented. Therefore I would leave it.

Copy link
Contributor

Choose a reason for hiding this comment

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

actually a real fillDescriptions method should be provided and the boiler plate code removed.

Copy link
Contributor

Choose a reason for hiding this comment

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

fillDescriptions was added

vFPIX_plus_ = SimplePoint(FPIX_plus_);
vFPIX_minus_ = SimplePoint(FPIX_minus_);

for (unsigned int i = 0; i < 4; i++) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Magic numbers like the 4 here and the 3 below should be made a named constant (especially since this is going to change for Phase-2)

Copy link
Contributor

Choose a reason for hiding this comment

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

Changed within next commit.

}
}
fout->Close();
}
Copy link
Contributor

Choose a reason for hiding this comment

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

the things that are new-ed technically should be delete-ed as well in the end

Copy link
Contributor

Choose a reason for hiding this comment

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

Pointers properly dealt with.

Comment on lines 26 to 36
<!-- <bin file="testAlignmentOfflineValidation.cpp" name="PVsingle"> -->
<!-- <flags TEST_RUNNER_ARGS=" /bin/bash Alignment/OfflineValidation/test test_all.sh"/> -->
<!-- <use name="FWCore/Utilities"/> -->
<!-- </bin> -->
<!-- <bin file="testPVPlotting.cpp"> -->
<!-- <flags PRE_TEST="PVsingle"/> -->
<!-- <use name="rootmath"/> -->
<!-- <use name="roothistmatrix"/> -->
<!-- <use name="rootgraphics"/> -->
<!-- <use name="Alignment/OfflineValidation"/> -->
<!-- </bin> -->
Copy link
Contributor

Choose a reason for hiding this comment

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

Are these not needed in the end?

Copy link
Contributor

Choose a reason for hiding this comment

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

these should definitely be maintained.

Copy link
Contributor

Choose a reason for hiding this comment

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

This was fully changed.

@mmusich
Copy link
Contributor

mmusich commented Jun 13, 2022

assign trk-dpg

@TomasKello
Copy link
Contributor

I am having a look at suggested changes and will try to perform rebase. It will take me some time, so please be patient. It is also likely I will add some small changes with fully new commits. In any case you can contact me here.

@antoniovagnerini antoniovagnerini changed the title New all in one tool aligned Introduction of New-All-In-One tool for Offline Validation of TrkAlignment Jun 13, 2022
Copy link
Contributor

@mmusich mmusich left a comment

Choose a reason for hiding this comment

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

here's some preliminary set of comments.
I might post more, once the preliminary set is addressed.


namespace AllInOneConfig {

//boost::property_tree::ptree get_unique_child (const boost::property_tree::ptree& tree)
Copy link
Contributor

Choose a reason for hiding this comment

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

is all of this commented text needed?

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually this namespace is barely used as far as I can tell only in Alignment/OfflineValidation/bin/DMRsingle.cc and I see no previous reference to get_unique_child that could hint its usage. ---> Removing this commented part with the next commit.

.gitignore Outdated
*.ini
*.old
*.bckp
*.info
Copy link
Contributor

Choose a reason for hiding this comment

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

I am not sure these changes are appropriate.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok we do no keep .gitignore anymore.

@@ -25,6 +25,8 @@
<use name="CLHEP"/>
<use name="rootmath"/>
<use name="roothistmatrix"/>
<use name="rootgraphics"/>
<lib name="MultiProc" />
Copy link
Contributor

Choose a reason for hiding this comment

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

this is also in the Alignment/OfflineValidation/bin/BuildFile.xml.
Is it needed in both places?

Copy link
Contributor

Choose a reason for hiding this comment

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

Seems not to be needed in /bin. Removing.

validateAlignments.py $CMSSW_BASE/src/Alignment/OfflineValidation/test/test.yaml

-----------------------------------------------------------------------
File for submitting this DAG to HTCondor : /afs/cern.ch/user/d/dbrunner/ToolDev/CMSSW_10_6_0/src/MyTest/DAG/dagFile.condor.sub
Copy link
Contributor

Choose a reason for hiding this comment

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

please don't use personal user accounts in README files.

Copy link
Contributor

Choose a reason for hiding this comment

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

Removed.

- from DMR toy to real application
- GCP (get "n-tuples" + grid, 3D, TkMaps)
- DMRs (single + merge + trend)
- PV (single + merge + trend)
Copy link
Contributor

Choose a reason for hiding this comment

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

aren't some of these already implemented??

Copy link
Contributor

Choose a reason for hiding this comment

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

Yep, updated.


##Read in AllInOne config in JSON format
with open(options.config, "r") as configFile:
config = _byteify(json.load(configFile, object_hook=_byteify),ignore_dicts=True)
Copy link
Contributor

Choose a reason for hiding this comment

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

I thought the _byteify was not needed anymore?

Copy link
Contributor

Choose a reason for hiding this comment

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

That was removed to make runtests work.

TkMap_drange_full = TkAlMap('test', title, in_file, use_default_range=True, two_sigma_cap=False, GEO_file=geometry_file, tracker='full', palette=palette, check_tracker=auto_tk)
TkMap_drange_pixel = TkAlMap('test', title, in_file, use_default_range=True, two_sigma_cap=False, GEO_file=geometry_file, tracker='pixel', palette=palette, check_tracker=auto_tk)
TkMap_drange_strips = TkAlMap('test', title, in_file, use_default_range=True, two_sigma_cap=False, GEO_file=geometry_file, tracker='strips', palette=palette, check_tracker=auto_tk)

Copy link
Contributor

Choose a reason for hiding this comment

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

please remove empty lines at the end of this file.

Copy link
Contributor

Choose a reason for hiding this comment

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

Done

@@ -541,12 +499,16 @@ void PlotAlignmentValidation::plotSS(const std::string& options, const std::stri
bool plotLayers = false; // overrides plotLayerN
// bool plotRings = false; // Todo: implement this?
bool plotSplits = false;
if (plotSplits)
;
Copy link
Contributor

Choose a reason for hiding this comment

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

what's the point of this change?

Copy link
Contributor

Choose a reason for hiding this comment

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

No idea. Removed.

Copy link
Contributor

Choose a reason for hiding this comment

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

Now I remembered. This actually is needed for a reason I have never understood. Compiler seems to throw "[-Werror=unused-but-set-variable" error eventhough 'plotSplits' is assigned in if-statement right after.

Copy link
Contributor

Choose a reason for hiding this comment

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

is plotSplits used anywhere else below?

Copy link
Contributor

Choose a reason for hiding this comment

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

yes multiple times in assignments within or out of if-statements and few times in the condition itself

Copy link
Contributor

Choose a reason for hiding this comment

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

ah it is late ... indeed in that member function it is unused. Will remove it entirely in the second commit.

Copy link
Contributor

Choose a reason for hiding this comment

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

Removed.

@@ -0,0 +1,19 @@
{
Copy link
Contributor

Choose a reason for hiding this comment

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

does this file belong here?

Copy link
Contributor

Choose a reason for hiding this comment

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

Indeed, this can be moved away. Please approve this PR: cms-data/Alignment-OfflineValidation#3

Copy link
Contributor

Choose a reason for hiding this comment

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

this PR can be tested with the cms-data one, but I would suggest to push also the txt files in Alignment/OfflineValidation/data in the same PR

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes it is tested, GCP unit test still works plus I moved file to local data dir.

<!-- <flags TEST_RUNNER_ARGS=" /bin/bash Alignment/OfflineValidation/test test_all.sh"/> -->
<!-- <use name="FWCore/Utilities"/> -->
<!-- </bin> -->
<!-- <bin file="testPVPlotting.cpp"> -->
Copy link
Contributor

Choose a reason for hiding this comment

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

please don't remove this test.

Copy link
Contributor

Choose a reason for hiding this comment

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

This one had 'test_all.sh' as a pre-requisite, however that required the old version of validateAlignments.py to be run. Plotting libraries in testPVPlotting.cpp are anyway implicitly used in unit test "PVall" so I could see no point in preserving this test.

@tvami
Copy link
Contributor

tvami commented Jun 15, 2022

Hi @antoniovagnerini given that there is a lot to do with this PR, would you mind changing it's status to a "draft PR"? Thanks!

@tvami
Copy link
Contributor

tvami commented Nov 4, 2022

oh wow #39967 is though PR... affecting MC in all times with widespread changes...

@tvami
Copy link
Contributor

tvami commented Nov 4, 2022

+alca

  • changes are coming from a different PR
  • this PR's code changes are in line with the PR desc and the follow-up to the review, thanks @TomasKello

@mmusich
Copy link
Contributor

mmusich commented Nov 8, 2022

I think this is still pending either @sroychow or @connorpa signatures

@sroychow
Copy link
Contributor

sroychow commented Nov 8, 2022

+1

@cmsbuild
Copy link
Contributor

cmsbuild commented Nov 8, 2022

This pull request is fully signed and it will be integrated in one of the next master IBs (tests are also fine). This pull request will now be reviewed by the release team before it's merged. @perrotta, @dpiparo, @rappoccio (and backports should be raised in the release meeting by the corresponding L2)

@mmusich
Copy link
Contributor

mmusich commented Nov 8, 2022

A note to @cms-sw/orp-l2: when merging, this PR requires cms-data/Alignment-OfflineValidation#3 to be merged at the same time.

@rappoccio
Copy link
Contributor

+1

Extensive review but seems to have converged.

@mmusich
Copy link
Contributor

mmusich commented Nov 9, 2022

mmusich added a commit to mmusich/cmssw that referenced this pull request Nov 9, 2022
@cmsbuild cmsbuild mentioned this pull request Nov 9, 2022
mmusich added a commit to mmusich/cmssw that referenced this pull request Nov 9, 2022
cmsbuild added a commit that referenced this pull request Nov 10, 2022
…ompilationEL8

fix `gcc11` compilation issues in `CompareAlignments`, post #38304 merge
cramonal pushed a commit to cramonal/cmssw that referenced this pull request Nov 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet