Skip to content

Commit

Permalink
Usage of the correct Hcal geometry in FastSim
Browse files Browse the repository at this point in the history
  • Loading branch information
Sunanda committed Jun 20, 2018
1 parent 6bc486f commit 7577705
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
11 changes: 6 additions & 5 deletions FastSimulation/CaloGeometryTools/src/CaloGeometryHelper.cc
Expand Up @@ -99,10 +99,10 @@ DetId CaloGeometryHelper::getClosestCell(const XYZPoint& point, bool ecal, bool
}
else
{
result=HcalGeometry_->getClosestCell(GlobalPoint(point.X(),point.Y(),point.Z()));
result=static_cast<const HcalGeometry*>(HcalGeometry_)->getClosestCell(GlobalPoint(point.X(),point.Y(),point.Z()),true);
HcalDetId myDetId(result);

// special patch for HF
// special patch for HF (this is already a part of HcalGeometry)
if ( myDetId.subdetId() == HcalForward ) {
int mylayer;
if ( fabs(point.Z()) > 1132. ) {
Expand All @@ -112,12 +112,12 @@ DetId CaloGeometryHelper::getClosestCell(const XYZPoint& point, bool ecal, bool
}
HcalDetId myDetId2((HcalSubdetector)myDetId.subdetId(),myDetId.ieta(),myDetId.iphi(),mylayer);
result = myDetId2;
return result;
// return result;
}


// Special patch to correct the HCAL geometry (does not work)
/*
if(result.subdetId()!=HcalEndcap) return result;
// Special patch to correct the HCAL geometry
if(myDetId.depth()==3) return result;
int ieta=myDetId.ietaAbs();
Expand All @@ -141,6 +141,7 @@ DetId CaloGeometryHelper::getClosestCell(const XYZPoint& point, bool ecal, bool
HcalDetId second(HcalEndcap,myDetId.ieta(),myDetId.iphi(),2);
if(second!=HcalDetId()) result=second;
}
*/
#ifdef DEBUGGCC
if(result.null())
{
Expand Down
1 change: 1 addition & 0 deletions Geometry/HcalTowerAlgo/interface/HcalGeometry.h
Expand Up @@ -56,6 +56,7 @@ class HcalGeometry : public CaloSubdetectorGeometry {
std::shared_ptr<const CaloCellGeometry> getGeometry( const DetId& id ) const override ;

DetId getClosestCell(const GlobalPoint& r) const override ;
DetId getClosestCell(const GlobalPoint& r, bool ignoreCorrect) const;

CaloSubdetectorGeometry::DetIdSet getCells(const GlobalPoint& r, double dR) const override ;

Expand Down
13 changes: 11 additions & 2 deletions Geometry/HcalTowerAlgo/src/HcalGeometry.cc
Expand Up @@ -104,6 +104,11 @@ std::shared_ptr<const CaloCellGeometry> HcalGeometry::getGeometry(const DetId& i
}

DetId HcalGeometry::getClosestCell(const GlobalPoint& r) const {
return getClosestCell(r,false);
}

DetId HcalGeometry::getClosestCell(const GlobalPoint& r,
bool ignoreCorrect) const {

// Now find the closest eta_bin, eta value of a bin i is average
// of eta[i] and eta[i-1]
Expand Down Expand Up @@ -163,8 +168,12 @@ DetId HcalGeometry::getClosestCell(const GlobalPoint& r) const {
}
}
}

return correctId(bestId);
#ifdef EDM_ML_DEBUG
std::cout << bestId << " Corrected to " << HcalDetId(correctId(bestId))
<< std::endl;
#endif

return (ignoreCorrect ? bestId : correctId(bestId));
}
}

Expand Down

0 comments on commit 7577705

Please sign in to comment.