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
refactored first part of PFAlgo::processBlock #26894
Conversation
The code-checks are being triggered in jenkins. |
+code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-26894/9932
|
A new Pull Request was created by @jpata (Joosep Pata) for master. It involves the following packages: RecoParticleFlow/PFProducer @perrotta, @cmsbuild, @slava77 can you please review it and eventually sign? Thanks. cms-bot commands are listed here |
please test |
The tests are being triggered in jenkins. |
Comparison job queued. |
Comparison is ready Comparison Summary:
|
|
||
void PFAlgo::elementLoop(const reco::PFBlock &block, reco::PFBlock::LinkData& linkData, const edm::OwnVector<reco::PFBlockElement> &elements, std::vector<bool>& active, const reco::PFBlockRef &blockref, ElementIndices& inds, std::vector<bool> &deadArea) { |
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.
Lines as such could be more better readable if splitted into some reasonable way.
This will be automatically done anyhow in the clang cleaning campaign ongoing
@@ -619,7 +495,7 @@ void PFAlgo::processBlock( const reco::PFBlockRef& blockref, | |||
assert( !trackRef.isNull() ); | |||
|
|||
if (debug_ ) { | |||
cout <<"PFAlgo:processBlock "<<" "<<trackIs.size()<<" "<<ecalIs.size()<<" "<<hcalIs.size()<<" "<<hoIs.size()<<endl; | |||
cout <<"PFAlgo:processBlock "<<" "<< inds.trackIs.size()<<" "<< inds.ecalIs.size()<<" "<< inds.hcalIs.size()<<" "<< inds.hoIs.size()<<endl; |
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.
Also here some line splitting may help
@@ -1333,14 +1209,145 @@ void PFAlgo::processBlock( const reco::PFBlockRef& blockref, | |||
} | |||
} //loop hcal elements | |||
} // end of loop 1 on elements iEle of any type | |||
} | |||
|
|||
int PFAlgo::decideType(const edm::OwnVector<reco::PFBlockElement> &elements, const reco::PFBlockElement::Type type, std::vector<bool>& active, ElementIndices& inds, std::vector<bool> &deadArea, unsigned int iEle) { |
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.
Line splitting would allow a better readability also here
Please @jpata let us know whether you plan to apply here the style fixes pointed out in #26894 (review) |
The tests are being triggered in jenkins. |
Thank you @jpata @perrotta . Otherwise this change looks good to me. Thank you. |
Thanks for the suggestion @hatakeyamak. My take on this would be to spend a few iterations quickly over some days to factorize all the code functionally, also breaking apart |
Comparison job queued. |
Comparison is ready Comparison Summary:
|
@jpata Thankis. I understand that you plan to introduce additional functions for other loops and HF portion in the next PR. Probably you can consider my suggestions along the side of such subsequent step. |
+1
|
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. @davidlange6, @slava77, @smuzaffar, @fabiocos (and backports should be raised in the release meeting by the corresponding L2) |
+1 |
PR description:
Proposal to start refactoring the PFAlgo::processBlock, which is a single function of several thousand lines, into smaller independent subfunctions based on physics functionality. As the original code is laid out quite clearly, simply in a long stream of consciousness, it is easy to factorize.
At this stage, we tackle a part of the
PFAlgo::processBlock
, introducing the following factorizations:egammaFilters
: code inPFAlgo::processblock { if(useEGammaFilters_) { ... } }
conversionAlgo
: code inPFAlgo::processblock { if(usePFConversions_) { ... } }
elementLoop
: big loop in PF code (line in code) that does multiple things:o Deals with tracks that are not associated to electrons or HCAL clusters
o Sorts the ECAL and HCAL elements in separate vectors
o For tracks which are connected to more than one HCAL cluster, cuts the links between the track and the cluster for all clusters but the closest one
This is meant as an inital PR to start clearing up the PFAlgo code, for which I imagine the path could be something like the following:
PFAlgo::processBlock
to smaller subfunctions (this PR, partly)PR validation:
We do not change the functionality of the PFAlgo, hence the output should not change at all and timing performance should change only in as much as the C++ compiler is able to optimize the code better. We have checked this in a previous version of this PR, see here. Nevertheless, I'm running the following comparisons:
runTheMatrix -l 38.0
between 43fd1cf and 3b1ae07: exactly the same reconstruction output on 10 events, output files have the same number of bytes.if this PR is a backport please specify the original PR:
usePFPhotons_
: refactor PFAlgo::processblock usePFPhotons part #26825.cc PF group: @hatakeyamak @bendavid