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
Conversation
@cmsbuild Please test |
The tests are being triggered in jenkins. |
A new Pull Request was created by @bsunanda for master. It involves the following packages: Calibration/HcalCalibAlgos @ghellwig, @arunhep, @cerminar, @cmsbuild, @franzoni, @mmusich, @davidlange6 can you please review it and eventually sign? Thanks. cms-bot commands are listed here #13028 |
Comparison job queued. |
@franzoni Kindly approve the PR |
#ifdef DebugLog | ||
edm::LogInfo("HcalHBHEMuon") << "Run " << RunNumber << " Event " << EventNumber | ||
<< " Lumi " << LumiNumber << " BX " << BXNumber; | ||
int depthHE = (maxDepth_ <= 6) ? 3 : 4; |
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.
@bsunanda could you add a comment on these magic numbers, please
Or better use constants with a meaningful name.
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.
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]; |
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.
@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
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.
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) |
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.
see above
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.
Done that
std::vector<double> hcalDepth4EnergyHot_, hcalDepth4ActiveLengthHot_; | ||
std::vector<double> hcalDepth5EnergyHot_, hcalDepth5ActiveLengthHot_; | ||
std::vector<double> hcalDepth6EnergyHot_, hcalDepth6ActiveLengthHot_; | ||
std::vector<double> hcalDepth7EnergyHot_, hcalDepth7ActiveLengthHot_; |
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.
@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.
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.
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
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 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" |
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.
this should be
#include "FWCore/Framework/interface/one/EDAnalyzer.h"
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.
Done that
TimeMaxCutECAL = cms.untracked.double(500.0), | ||
TimeMinCutHCAL = cms.untracked.double(-500.0), | ||
TimeMaxCutHCAL = cms.untracked.double(500.0), | ||
) |
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.
this would just go into fillDescriptions
above
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 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); |
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.
Is this specialization really needed? From a quick look, it seems like you just write down what is done also in the general case.
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 believe so. Could not use the template version
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 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.
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.
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); |
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.
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); |
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.
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); |
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.
see above
@cmsbuild Please test |
The tests are being triggered in jenkins. |
@cmsbuild Please test |
The tests are being triggered in jenkins. |
@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 |
@bsunanda I believe what @davidlange6 meant was to replace |
Comparison job queued. |
Comparison is ready Comparison Summary:
|
+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 requires discussion in the ORP meeting before it's merged. @Muzaffar, @davidlange6, @smuzaffar |
@davidlange6 Could you please integrate this PR. Need this to be used for plan 1 calibration |
I agree that the ifdef followed by an if debug is duplicating things, but doesn't affect anything unless the debuging is compiled in |
Enables study of the hit energy at the SIM level of muons in the calorimeter. Useful to validate MIP calibration of HB/HE