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
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
710 changes: 405 additions & 305 deletions Calibration/HcalCalibAlgos/plugins/HcalHBHEMuonAnalyzer.cc

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions Calibration/IsolatedParticles/interface/FindCaloHit.h
Original file line number Diff line number Diff line change
Expand Up @@ -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?


template <typename T>
void findHit(edm::Handle<T>& hits, DetId thisDet, std::vector<typename T::const_iterator>& hit, bool debug=false);

Expand Down
8 changes: 8 additions & 0 deletions Calibration/IsolatedParticles/interface/eHCALMatrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -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?


template< typename T>
double eHCALmatrix(const HcalTopology* topology, const DetId& det, edm::Handle<T>& hits, int ietaE, int ietaW, int iphiN, int iphiS, bool includeHO=false, double hbThr=-100, double heThr=-100, double hfThr=-100, double hoThr=-100, double tMin=-500, double tMax=500, bool useRaw=false, bool debug=false);

Expand All @@ -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


template <typename T>
double energyHCALmatrixNew(const HcalTopology* topology, const DetId& det, edm::Handle<T>& 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 useRaw=false, bool debug=false);

Expand All @@ -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


template <typename T>
void hitsHCAL(std::vector<DetId>& vdets, edm::Handle<T>& hits, std::vector< typename T::const_iterator>& hitlist, bool debug=false);

HcalDetId getHotCell(std::vector<HBHERecHitCollection::const_iterator>& hit, bool includeHO, bool useRaw=false, bool debug=false);

HcalDetId getHotCell(std::vector<std::vector<PCaloHit>::const_iterator>& hit, bool includeHO, bool useRaw=false, bool debug=false);

double eHCALThreshold(int subdet, double hbThr=-100, double heThr=-100, double hfThr=-100, double hoThr=-100);
}

#include "Calibration/IsolatedParticles/interface/eHCALMatrix.icc"
Expand Down
15 changes: 6 additions & 9 deletions Calibration/IsolatedParticles/interface/eHCALMatrix.icc
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,7 @@ namespace spr{
std::vector< typename T::const_iterator> hit = spr::findHit(hits, vdets[i]);
double energy = 0;
int subdet = ((HcalDetId)(vdets[i].rawId())).subdet();
double eThr = hbThr;
if (subdet == (int)(HcalEndcap)) eThr = heThr;
else if (subdet == (int)(HcalForward)) eThr = hfThr;
else if (subdet == (int)(HcalOuter)) eThr = hoThr;
double eThr = spr::eHCALThreshold(subdet, hbThr, heThr, hfThr, hoThr);
for (unsigned int ihit=0; ihit<hit.size(); ihit++) {
if (hit[ihit] != hits->end()) {
khit++;
Expand All @@ -215,14 +212,14 @@ namespace spr{
void energyHCALCell(HcalDetId detID, edm::Handle<T>& hits, std::vector<std::pair<double,int> >& energyCell, int maxDepth, double hbThr, double heThr, double hfThr, double hoThr, double tMin, double tMax, bool useRaw, bool debug) {
energyCell.clear();
int subdet = detID.subdet();
double eThr = hbThr;
if (subdet == (int)(HcalEndcap)) eThr = heThr;
else if (subdet == (int)(HcalForward)) eThr = hfThr;
else if (subdet == (int)(HcalOuter)) eThr = hoThr;
double eThr = spr::eHCALThreshold(subdet, hbThr, heThr, hfThr, hoThr);
bool hbhe = (detID.ietaAbs() == 16);
int depthHE = (maxDepth <= 6) ? 3 : 4;
if (debug)
std::cout << "energyHCALCell: input ID " << detID << " MaxDepth " << maxDepth << " Threshold (E) " << eThr << " (T) " << tMin << ":" << tMax << std::endl;
for (int i=0; i<maxDepth; i++) {
HcalDetId hcid(detID.subdet(),detID.ieta(),detID.iphi(),i+1);
HcalSubdetector subdet0 = (hbhe) ? ((i+1 >= depthHE) ? HcalEndcap : HcalBarrel) : detID.subdet();
HcalDetId hcid(subdet0,detID.ieta(),detID.iphi(),i+1);
DetId det(hcid.rawId());
std::vector< typename T::const_iterator> hit = spr::findHit(hits, det);
double energy(0);
Expand Down
1 change: 1 addition & 0 deletions Calibration/IsolatedParticles/plugins/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,4 @@
<library name="CalibrationIsoTrackCalib" file="IsoTrackCalib.cc"> </library>
<library name="CalibrationIsoTrackCalibration" file="IsoTrackCalibration.cc"> </library>
<library name="CalibrationHcalRaddamMuon" file="HcalRaddamMuon.cc"> </library>
<library name="CalibrationHcalHBHEMuonSimAnalyzer" file="HcalHBHEMuonSimAnalyzer.cc"> </library>