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-hcx83 Update Geometry to handle minimum depth > 1 and max phi > 72 #14594

Merged
merged 4 commits into from May 25, 2016
Merged
Show file tree
Hide file tree
Changes from 3 commits
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
2 changes: 1 addition & 1 deletion Geometry/CaloTopology/interface/HcalTopology.h
Expand Up @@ -180,7 +180,7 @@ class HcalTopology : public CaloSubdetectorTopology {
int singlePhiBins_, doublePhiBins_;
int maxDepthHB_, maxDepthHE_, maxDepthHF_;
int etaHE2HF_, etaHF2HE_;
int maxEta_;
int maxEta_, maxPhiHE_;

unsigned int HBSize_;
unsigned int HESize_;
Expand Down
48 changes: 25 additions & 23 deletions Geometry/CaloTopology/src/HcalTopology.cc
Expand Up @@ -23,7 +23,7 @@ HcalTopology::HcalTopology(const HcalDDDRecConstants* hcons) :
firstHORing_(1), lastHORing_(15),
firstHEDoublePhiRing_(999), firstHEQuadPhiRing_(999),
firstHFQuadPhiRing_(40), firstHETripleDepthRing_(999),
singlePhiBins_(72), doublePhiBins_(36) {
singlePhiBins_(IPHI_MAX), doublePhiBins_(36), maxPhiHE_(IPHI_MAX) {

mode_ = (HcalTopologyMode::Mode)(hcons_->getTopoMode());
triggerMode_= (HcalTopologyMode::TriggerMode)(hcons_->getTriggerMode());
Expand All @@ -34,6 +34,7 @@ HcalTopology::HcalTopology(const HcalDDDRecConstants* hcons) :
etaBinsHE_ = hcons_->getEtaBins(1);
nEtaHB_ = (int)(etaBinsHB_.size());
lastHBRing_ = firstHBRing_+nEtaHB_-1;
if (hcons_->getNPhi(1) > maxPhiHE_) maxPhiHE_ = hcons_->getNPhi(1);
for (int i = 0; i < (int)(etaBinsHE_.size()); ++i) {
if (firstHERing_ > etaBinsHE_[i].ieta) firstHERing_ = etaBinsHE_[i].ieta;
if (lastHERing_ < etaBinsHE_[i].ieta) lastHERing_ = etaBinsHE_[i].ieta;
Expand All @@ -56,7 +57,7 @@ HcalTopology::HcalTopology(const HcalDDDRecConstants* hcons) :
} else if (mode_==HcalTopologyMode::SLHC) { // need to know more eventually
topoVersion_=10;
HBSize_ = nEtaHB_*IPHI_MAX*maxDepthHB_*2;
HESize_ = nEtaHE_*IPHI_MAX*maxDepthHE_*2;
HESize_ = nEtaHE_*maxPhiHE_*maxDepthHE_*2;
HOSize_ = (lastHORing_-firstHORing_+1)*IPHI_MAX*2; // ieta * iphi * 2
HFSize_ = (lastHFRing_-firstHFRing_+1)*IPHI_MAX*maxDepthHF_*2; // ieta * iphi * depth * 2
numberOfShapes_ = 500;
Expand Down Expand Up @@ -127,7 +128,7 @@ HcalTopology::HcalTopology(const HcalDDDRecConstants* hcons) :
<< lastHFRing_ << ":" << firstHFQuadPhiRing_ << " " << firstHORing_
<< ":" << lastHORing_ << " " << maxDepthHB_ << ":" << maxDepthHE_
<< " " << nEtaHB_ << ":" << nEtaHE_ << " " << etaHE2HF_ << ":"
<< etaHF2HE_ << std::endl;
<< etaHF2HE_ << " " << maxPhiHE_ << std::endl;
#endif
}

Expand All @@ -144,7 +145,7 @@ HcalTopology::HcalTopology(HcalTopologyMode::Mode mode, int maxDepthHB, int maxD
firstHETripleDepthRing_((mode==HcalTopologyMode::H2 || mode==HcalTopologyMode::H2HE)?(24):(27)),
singlePhiBins_(72), doublePhiBins_(36),
Copy link
Contributor

Choose a reason for hiding this comment

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

@bsunanda - why singlePhiBins_ initialisation is kept unchanged here, while it was changed in the other constructor? BTW, the variable is not modified anywhere. Is it needed as a variable or the IPHI_MAX constant can be used instead?

maxDepthHB_(maxDepthHB), maxDepthHE_(maxDepthHE), maxDepthHF_(2),
etaHE2HF_(30), etaHF2HE_(29),
etaHE2HF_(30), etaHF2HE_(29), maxPhiHE_(IPHI_MAX),
HBSize_(kHBSizePreLS1),
HESize_(kHESizePreLS1),
HOSize_(kHOSizePreLS1),
Expand All @@ -160,7 +161,7 @@ HcalTopology::HcalTopology(HcalTopologyMode::Mode mode, int maxDepthHB, int maxD
HFSize_= kHFSizePreLS1; // phi * eta * depth * pm
} else if (mode_==HcalTopologyMode::SLHC) { // need to know more eventually
HBSize_= maxDepthHB*16*IPHI_MAX*2;
HESize_= maxDepthHE*(29-16+1)*IPHI_MAX*2;
HESize_= maxDepthHE*(29-16+1)*maxPhiHE_*2;
HOSize_= 15*IPHI_MAX*2; // ieta * iphi * 2
HFSize_= IPHI_MAX*13*maxDepthHF_*2; // phi * eta * depth * pm
topoVersion_=10;
Expand Down Expand Up @@ -424,21 +425,23 @@ bool HcalTopology::validRaw(const HcalDetId& id) const {
int aieta=id.ietaAbs();
int depth=id.depth();
int iphi=id.iphi();
if ((ieta==0 || iphi<=0 || iphi>IPHI_MAX) || aieta>maxEta_) ok = false; // outer limits
HcalSubdetector subdet=id.subdet();
int maxPhi = (subdet==HcalEndcap) ? maxPhiHE_ : IPHI_MAX;
if ((ieta==0 || iphi<=0 || iphi>maxPhi) || aieta>maxEta_) ok = false; // outer limits

if (ok) {
HcalSubdetector subdet=id.subdet();
if (subdet==HcalBarrel) {
if (mode_==HcalTopologyMode::SLHC || mode_==HcalTopologyMode::H2HE) {
if ((aieta>lastHBRing()) || (depth>hcons_->getMaxDepth(0,aieta))) ok=false;
if ((aieta>lastHBRing()) || (depth>hcons_->getMaxDepth(0,aieta)) ||
(depth<hcons_->getMinDepth(0,aieta))) ok=false;
} else {
if (aieta>lastHBRing() || depth>2 || (aieta<=14 && depth>1)) ok=false;
}
} else if (subdet==HcalEndcap) {
if (mode_==HcalTopologyMode::SLHC || mode_==HcalTopologyMode::H2HE) {
if ((depth>hcons_->getMaxDepth(1,aieta)) ||
(aieta<firstHERing()) || (aieta>lastHERing()) ||
(aieta==firstHERing() && depth<hcons_->getDepthEta16(1))) {
(depth<hcons_->getMinDepth(1,aieta))) {
ok = false;
} else {
for (unsigned int i=0; i<etaBinsHE_.size(); ++i) {
Expand Down Expand Up @@ -494,7 +497,7 @@ bool HcalTopology::incIPhi(const HcalDetId& id, HcalDetId &neighbor) const {
if (id.iphi()==IPHI_MAX-1) neighbor=HcalDetId(id.subdet(),id.ieta(),1,id.depth());
else neighbor=HcalDetId(id.subdet(),id.ieta(),id.iphi()+2,id.depth());
} else {
if (id.iphi()==IPHI_MAX) neighbor=HcalDetId(id.subdet(),id.ieta(),1,id.depth());
if (id.iphi()==maxPhiHE_) neighbor=HcalDetId(id.subdet(),id.ieta(),1,id.depth());
else neighbor=HcalDetId(id.subdet(),id.ieta(),id.iphi()+1,id.depth());
}
break;
Expand Down Expand Up @@ -532,7 +535,7 @@ bool HcalTopology::decIPhi(const HcalDetId& id, HcalDetId &neighbor) const {
if (id.iphi()==1) neighbor=HcalDetId(id.subdet(),id.ieta(),IPHI_MAX-1,id.depth());
else neighbor=HcalDetId(id.subdet(),id.ieta(),id.iphi()-2,id.depth());
} else {
if (id.iphi()==1) neighbor=HcalDetId(id.subdet(),id.ieta(),IPHI_MAX,id.depth());
if (id.iphi()==1) neighbor=HcalDetId(id.subdet(),id.ieta(),maxPhiHE_,id.depth());
else neighbor=HcalDetId(id.subdet(),id.ieta(),id.iphi()-1,id.depth());
}
break;
Expand Down Expand Up @@ -631,11 +634,11 @@ void HcalTopology::depthBinInformation(HcalSubdetector subdet, int etaRing,

if(subdet == HcalBarrel) {
if (mode_==HcalTopologyMode::SLHC || mode_==HcalTopologyMode::H2HE) {
startingBin = 1;
startingBin = hcons_->getMinDepth(0,etaRing);
if (etaRing==lastHBRing()) {
nDepthBins = hcons_->getDepthEta16(0);
nDepthBins = hcons_->getDepthEta16(0) - startingBin + 1;
} else {
nDepthBins = hcons_->getMaxDepth(0,etaRing);
nDepthBins = hcons_->getMaxDepth(0,etaRing) - startingBin + 1;
}
} else {
if (etaRing<=14) {
Expand All @@ -650,11 +653,10 @@ void HcalTopology::depthBinInformation(HcalSubdetector subdet, int etaRing,
if (mode_==HcalTopologyMode::SLHC || mode_==HcalTopologyMode::H2HE) {
if (etaRing==firstHERing()) {
startingBin = hcons_->getDepthEta16(1);
nDepthBins = hcons_->getMaxDepth(1,etaRing) - startingBin + 1;
} else {
nDepthBins = hcons_->getMaxDepth(1,etaRing);
startingBin = 1;
startingBin = hcons_->getMinDepth(1,etaRing);
}
nDepthBins = hcons_->getMaxDepth(1,etaRing) - startingBin + 1;
} else {
if (etaRing==firstHERing()) {
nDepthBins = 1;
Expand Down Expand Up @@ -966,8 +968,8 @@ unsigned int HcalTopology::detId2denseIdHE(const DetId& id) const {
26 + 2*( ie - 29 ) + dp - 1 ) ) ) ) + zn*kHEhalf;
} else if (topoVersion_==10) {
retval=(dp-1)+maxDepthHE_*(ip-1);
if (hid.ieta()>0) retval+=maxDepthHE_*IPHI_MAX*(hid.ieta()-firstHERing());
else retval+=maxDepthHE_*IPHI_MAX*(hid.ieta()+lastHERing()+nEtaHE_);
if (hid.ieta()>0) retval+=maxDepthHE_*maxPhiHE_*(hid.ieta()-firstHERing());
else retval+=maxDepthHE_*maxPhiHE_*(hid.ieta()+lastHERing()+nEtaHE_);
}
return retval;
}
Expand Down Expand Up @@ -1099,8 +1101,8 @@ unsigned int HcalTopology::detId2denseId(const DetId& id) const {
} else if (hid.subdet()==HcalEndcap) {
retval = HBSize_;
retval+= (hid.depth()-1)+maxDepthHE_*(hid.iphi()-1);
if (hid.ieta()>0) retval+=maxDepthHE_*IPHI_MAX*(hid.ieta()-firstHERing());
else retval+=maxDepthHE_*IPHI_MAX*(hid.ieta()+lastHERing()+nEtaHE_);
if (hid.ieta()>0) retval+=maxDepthHE_*maxPhiHE_*(hid.ieta()-firstHERing());
else retval+=maxDepthHE_*maxPhiHE_*(hid.ieta()+lastHERing()+nEtaHE_);
} else if (hid.subdet()==HcalOuter) {
retval = HBSize_+HESize_;
if (hid.ieta()>0) retval+=(hid.iphi()-1)+IPHI_MAX*(hid.ieta()-1);
Expand Down Expand Up @@ -1206,9 +1208,9 @@ DetId HcalTopology::denseId2detId(unsigned int denseid) const {
sd = HcalEndcap ;
in -= (HBSize_);
dp = (in%maxDepthHE_)+1;
ip = (in - dp + 1)%(maxDepthHE_*IPHI_MAX);
ip = (in - dp + 1)%(maxDepthHE_*maxPhiHE_);
ip = (ip/maxDepthHE_) + 1;
ie = (in - dp + 1 - maxDepthHE_*(ip-1))/(IPHI_MAX*maxDepthHE_);
ie = (in - dp + 1 - maxDepthHE_*(ip-1))/(maxPhiHE_*maxDepthHE_);
if (ie >= nEtaHE_) {ie = lastHERing()+nEtaHE_ - ie; iz = -1;}
else {ie = firstHERing() + ie; iz = 1;}
} else {
Expand Down
2 changes: 1 addition & 1 deletion Geometry/CaloTopology/test/testHcalTopology_cfg.py
Expand Up @@ -3,7 +3,7 @@
process = cms.Process("PROD")
process.load("SimGeneral.HepPDTESSource.pdt_cfi")

process.load("Geometry.HcalCommonData.testHcalOnlyGeometryXML_cfi")
process.load("Geometry.HcalCommonData.testPhase2GeometryXML_cfi")
process.load("Geometry.HcalCommonData.hcalDDConstants_cff")
process.load("Geometry.HcalEventSetup.hcalTopologyIdeal_cfi")

Expand Down
1 change: 1 addition & 0 deletions Geometry/HcalCommonData/interface/HcalDDDRecConstants.h
Expand Up @@ -74,6 +74,7 @@ class HcalDDDRecConstants {
std::vector<HFCellParameters> getHFCellParameters() const;
int getMaxDepth(const int type) const {return maxDepth[type];}
int getMaxDepth(const int itype, const int ieta) const;
int getMinDepth(const int itype, const int ieta) const;
int getNEta() const {return hpar->etagroup.size();}
int getNoff(const int i) const {return hpar->noff[i];}
int getNPhi(const int type) const {return nPhiBins[type];}
Expand Down
16 changes: 16 additions & 0 deletions Geometry/HcalCommonData/src/HcalDDDRecConstants.cc
Expand Up @@ -255,6 +255,22 @@ int HcalDDDRecConstants::getMaxDepth (const int itype, const int ieta) const {
return lmax;
}

int HcalDDDRecConstants::getMinDepth (const int itype, const int ieta) const {

int lmin(1);
if (itype == 2) { // HF
} else if (itype == 3) { //HO
lmin = maxDepth[3];
} else {
unsigned int type = (itype == 0) ? 0 : 1;
if (layerGroupSize(ieta-1) > 0) {
lmin = (int)(layerGroup(ieta-1, 0));
if (type == 1 && ieta == iEtaMin[type]) lmin = hcons.getDepthEta16(1);
}
}
return lmin;
}

double HcalDDDRecConstants::getRZ(int subdet, int ieta, int depth) const {

int ietaAbs = (ieta > 0) ? ieta : -ieta;
Expand Down
10 changes: 10 additions & 0 deletions Geometry/HcalCommonData/test/HcalRecNumberingTester.cc
Expand Up @@ -79,6 +79,16 @@ void HcalRecNumberingTester::analyze( const edm::Event& iEvent, const edm::Event
}
std::cout << ")" << std::endl;
}
for (int type=0; type<2; ++type) {
std::pair<int,int> etar = hdc.getEtaRange(type);
std::cout << "Detector type: " << type << " with eta ranges "
<< etar.first << ":" << etar.second << std::endl;
for (int eta=etar.first; eta<=etar.second; ++eta) {
std::cout << "Type:Eta " << type << ":" << eta << " Depth range "
<< hdc.getMinDepth(type,eta) << ":"
<< hdc.getMaxDepth(type,eta) << std::endl;
}
}
std::vector<HcalDDDRecConstants::HcalEtaBin> hbar = hdc.getEtaBins(0);
std::vector<HcalDDDRecConstants::HcalEtaBin> hcap = hdc.getEtaBins(1);
std::cout << "Topology Mode " << hdc.getTopoMode()
Expand Down
@@ -1,7 +1,7 @@
import FWCore.ParameterSet.Config as cms
process = cms.Process("HcalParametersTest")

process.load('Geometry.HcalCommonData.testPhase2GeometryXML_cfi')
process.load('Geometry.HcalCommonData.testPhase1GeometryXML_cfi')
process.load('Geometry.HcalCommonData.hcalDDConstants_cff')

process.source = cms.Source("EmptySource")
Expand Down
6 changes: 3 additions & 3 deletions RecoLocalCalo/CaloTowersCreator/src/CaloTowersCreationAlgo.cc
Expand Up @@ -1359,7 +1359,8 @@ GlobalPoint CaloTowersCreationAlgo::hadShwrPos(CaloTowerDetId towerId, float fra
for(unsigned i = 0; i < items.size(); i++){
if(items[i].det()!=DetId::Hcal) continue;
HcalDetId hid(items[i]);
if(hid.subdet() == HcalOuter) continue;
if(hid.subdet() == HcalOuter) continue;
if(!theHcalTopology->validHcal(hid)) continue;

if(hid.depth()<frontDepth) { frontCellId = hid; frontDepth = hid.depth(); }
if(hid.depth()>backDepth) { backCellId = hid; backDepth = hid.depth(); }
Expand All @@ -1372,13 +1373,12 @@ GlobalPoint CaloTowersCreationAlgo::hadShwrPos(CaloTowerDetId towerId, float fra
for(unsigned i = 0; i < items28.size(); i++){
if(items28[i].det()!=DetId::Hcal) continue;
HcalDetId hid(items28[i]);
if(hid.subdet() == HcalOuter) continue;
if(hid.subdet() == HcalOuter) continue;

if(hid.depth()>backDepth) { backCellId = hid; backDepth = hid.depth(); }
}
}
}

point = hadShwPosFromCells(DetId(frontCellId), DetId(backCellId), fracDepth);

return point;
Expand Down