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

bsunanda:Run2-alca77 Try Muon analysis in HB/HE using SIM information #18125

Merged
merged 4 commits into from May 1, 2017

Conversation

bsunanda
Copy link
Contributor

@bsunanda bsunanda commented Mar 29, 2017

Enables study of the hit energy at the SIM level of muons in the calorimeter. Useful to validate MIP calibration of HB/HE

@bsunanda
Copy link
Contributor Author

@cmsbuild Please test

@cmsbuild cmsbuild added this to the Next CMSSW_9_1_X milestone Mar 29, 2017
@cmsbuild
Copy link
Contributor

cmsbuild commented Mar 29, 2017

The tests are being triggered in jenkins.
https://cmssdt.cern.ch/jenkins/job/ib-any-integration/18795/console Started: 2017/03/29 21:49

@cmsbuild
Copy link
Contributor

A new Pull Request was created by @bsunanda for master.

It involves the following packages:

Calibration/HcalCalibAlgos
Calibration/IsolatedParticles

@ghellwig, @arunhep, @cerminar, @cmsbuild, @franzoni, @mmusich, @davidlange6 can you please review it and eventually sign? Thanks.
@ghellwig, @tocheng this is something you requested to watch as well.
@Muzaffar, @davidlange6, @smuzaffar you are the release manager for this.

cms-bot commands are listed here #13028

@cmsbuild
Copy link
Contributor

@cmsbuild
Copy link
Contributor

Comparison job queued.

@cmsbuild
Copy link
Contributor

@bsunanda
Copy link
Contributor Author

bsunanda commented Apr 5, 2017

@franzoni Kindly approve the PR

#ifdef DebugLog
edm::LogInfo("HcalHBHEMuon") << "Run " << RunNumber << " Event " << EventNumber
<< " Lumi " << LumiNumber << " BX " << BXNumber;
int depthHE = (maxDepth_ <= 6) ? 3 : 4;

Choose a reason for hiding this comment

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

@bsunanda could you add a comment on these magic numbers, please
Or better use constants with a meaningful name.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done that

unsigned int isHot = 0;
for (int i=0; i<7; ++i) eHcalDepth[i]=eHcalDepthHot[i]=-10000;
double eEcal(0), eHcal(0), activeLengthTot(0), activeLengthHotTot(0);
double eHcalDepth[7], eHcalDepthHot[7], activeL[7], activeHotL[7];

Choose a reason for hiding this comment

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

@bsunanda please use a named constant to clarify where the magic number 7 comes from or just use the size of the std::array proposed above

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done that

double eHcalDepth[7], eHcalDepthHot[7], activeL[7], activeHotL[7];
unsigned int isHot(0);
bool tmpmatch(false);
for (int i=0; i<7; ++i)

Choose a reason for hiding this comment

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

see above

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done that

std::vector<double> hcalDepth4EnergyHot_, hcalDepth4ActiveLengthHot_;
std::vector<double> hcalDepth5EnergyHot_, hcalDepth5ActiveLengthHot_;
std::vector<double> hcalDepth6EnergyHot_, hcalDepth6ActiveLengthHot_;
std::vector<double> hcalDepth7EnergyHot_, hcalDepth7ActiveLengthHot_;

Choose a reason for hiding this comment

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

@bsunanda I think, it would be more readible if you replace the 7 vectors with an std::array<std::vector<double>, 7>.
This would then need to be propagated to the rest of the code, of course.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There have been some downstream codes made by a few users which utilizes the current construct. It is better if we leave this for the time being

Choose a reason for hiding this comment

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

I do not see how downstream code would need to know how the private data members are organized...
The branches written to the tree could still have the same name and would still be vectors.
You just replace seven lines of code with a loop containing one line of code (+1 line for the head of the loop).
Having this multiple times reduces a lot the complexity and makes reading the code a lot easier.


// user include files
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/EDAnalyzer.h"

Choose a reason for hiding this comment

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

this should be

#include "FWCore/Framework/interface/one/EDAnalyzer.h"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done that

TimeMaxCutECAL = cms.untracked.double(500.0),
TimeMinCutHCAL = cms.untracked.double(-500.0),
TimeMaxCutHCAL = cms.untracked.double(500.0),
)

Choose a reason for hiding this comment

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

this would just go into fillDescriptions above

Choose a reason for hiding this comment

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

Why is this file still here?
If you rename the description in fillDescriptions from "hcalHBHEMuonSim" to "HcalHBHEMuonSimAnalyzer" you can drop this file because it will be automatically created.

@@ -34,6 +34,8 @@ namespace spr {
template <typename T>
std::vector<typename T::const_iterator> findHit(edm::Handle<T>& hits, DetId thisDet, bool debug=false);

std::vector<std::vector<PCaloHit>::const_iterator> findHit(std::vector<PCaloHit>& hits, DetId thisDet, bool debug=false);

Choose a reason for hiding this comment

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

Is this specialization really needed? From a quick look, it seems like you just write down what is done also in the general case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe so. Could not use the template version

Choose a reason for hiding this comment

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

Why couldn't you use the template version?
I simply don't like to add specialization for every type one uses. This is almost the same as not using templates at all.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can one use edm::Handle and std::vector in the same version?

@@ -39,6 +39,8 @@ namespace spr{
template< typename T>
double eHCALmatrix(const HcalTopology* topology, const DetId& det, edm::Handle<T>& hits, int ieta, int iphi, bool includeHO=false, bool algoNew=true, double hbThr=-100, double heThr=-100, double hfThr=-100, double hoThr=-100, double tMin=-500, double tMax=500, bool useRaw=false, bool debug=false);

double eHCALmatrix(const HcalTopology* topology, const DetId& det, std::vector<PCaloHit>& hits, int ieta, int iphi, bool includeHO=false, double hbThr=-100, double heThr=-100, double hfThr=-100, double hoThr=-100, double tMin=-500, double tMax=500, bool debug=false);

Choose a reason for hiding this comment

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

is this specialization really needed? or should the general template be updated to take a reference to T instead of a handle to T?

@@ -51,6 +53,8 @@ namespace spr{
template <typename T>
double eHCALmatrix(const CaloGeometry* geo, const HcalTopology* topology, const DetId& det0, edm::Handle<T>& hits, int ieta, int iphi, HcalDetId& hotCell, bool includeHO=false, bool useRaw=false, bool debug=false);

double eHCALmatrix(const CaloGeometry* geo, const HcalTopology* topology, const DetId& det0, std::vector<PCaloHit>& hits, int ieta, int iphi, HcalDetId& hotCell, bool includeHO=false, bool debug=false);

Choose a reason for hiding this comment

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

see above

@@ -69,12 +73,16 @@ namespace spr{
template <typename T>
void energyHCALCell(HcalDetId detId, edm::Handle<T>& hits, std::vector<std::pair<double,int> >& energyCell, int maxDepth=1, double hbThr=-100, double heThr=-100, double hfThr=-100, double hoThr=-100, double tMin=-500, double tMax=500, bool useRaw=false, bool debug=false);

void energyHCALCell(HcalDetId detId, std::vector<PCaloHit>& hits, std::vector<std::pair<double,int> >& energyCell, int maxDepth=1, double hbThr=-100, double heThr=-100, double hfThr=-100, double hoThr=-100, double tMin=-500, double tMax=500, bool debug=false);
Copy link

@ghellwig ghellwig Apr 10, 2017

Choose a reason for hiding this comment

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

see above

@bsunanda
Copy link
Contributor Author

@cmsbuild Please test

@cmsbuild
Copy link
Contributor

cmsbuild commented Apr 10, 2017

The tests are being triggered in jenkins.
https://cmssdt.cern.ch/jenkins/job/ib-any-integration/19076/console Started: 2017/04/10 23:26

@bsunanda
Copy link
Contributor Author

@cmsbuild Please test

@cmsbuild
Copy link
Contributor

Pull request #18125 was updated. @ghellwig, @arunhep, @cerminar, @cmsbuild, @franzoni, @mmusich, @davidlange6 can you please check and sign again.

@cmsbuild
Copy link
Contributor

cmsbuild commented Apr 20, 2017

The tests are being triggered in jenkins.
https://cmssdt.cern.ch/jenkins/job/ib-any-integration/19282/console Started: 2017/04/20 10:11

@bsunanda
Copy link
Contributor Author

@ghellwig David asked me to protect the std::cout withing compile time switch which I did. Could you please check and approve this at the earliest. Now this PR is stuck for > 3 weeks

@ghellwig
Copy link

@bsunanda I believe what @davidlange6 meant was to replace debug with the macro, not to decorate it with the macro

@cmsbuild
Copy link
Contributor

@cmsbuild
Copy link
Contributor

Comparison job queued.

@cmsbuild
Copy link
Contributor

Comparison is ready
https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-18125/19282/summary.html

Comparison Summary:

  • No significant changes to the logs found
  • Reco comparison results: 1669 differences found in the comparisons
  • DQMHistoTests: Total files compared: 23
  • DQMHistoTests: Total histograms compared: 1826171
  • DQMHistoTests: Total failures: 6239
  • DQMHistoTests: Total nulls: 0
  • DQMHistoTests: Total successes: 1819759
  • DQMHistoTests: Total skipped: 173
  • DQMHistoTests: Total Missing objects: 0
  • Checked 94 log files, 14 edm output root files, 23 DQM output files

@ghellwig
Copy link

+1
@bsunanda approving for alca, but I let @davidlange6 decide on how he judges your handling of his comment

@cmsbuild
Copy link
Contributor

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 requires discussion in the ORP meeting before it's merged. @Muzaffar, @davidlange6, @smuzaffar

@bsunanda
Copy link
Contributor Author

@davidlange6 Could you please integrate this PR. Need this to be used for plan 1 calibration

@davidlange6
Copy link
Contributor

I agree that the ifdef followed by an if debug is duplicating things, but doesn't affect anything unless the debuging is compiled in

@davidlange6 davidlange6 merged commit 46f7453 into cms-sw:master May 1, 2017
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

4 participants