Skip to content

Commit

Permalink
Bug fix for BH work
Browse files Browse the repository at this point in the history
  • Loading branch information
Sunanda committed Jun 3, 2016
1 parent d0b7bad commit 83f7098
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 26 deletions.
5 changes: 3 additions & 2 deletions Geometry/CaloTopology/interface/HcalTopology.h
Expand Up @@ -205,18 +205,19 @@ class HcalTopology : public CaloSubdetectorTopology {
kHEhalf = 1296 ,
kHOhalf = 1080 ,
kHFhalf = 864 ,
kHThalf = 2088,
kHThalf = 2088 ,
kZDChalf = 11,
kCASTORhalf = 224,
kCALIBhalf = 693,
kHThalfPhase1 = 2520 ,
kHcalhalf = kHBhalf + kHEhalf + kHOhalf + kHFhalf } ;
enum { kSizeForDenseIndexingPreLS1 = 2*kHcalhalf } ;
enum { kHBSizePreLS1 = 2*kHBhalf } ;
enum { kHESizePreLS1 = 2*kHEhalf } ;
enum { kHOSizePreLS1 = 2*kHOhalf } ;
enum { kHFSizePreLS1 = 2*kHFhalf } ;
enum { kHTSizePreLS1 = 2*kHThalf } ;
enum { kHTSizePhase1 = (kHTSizePreLS1+(2*12*36)) } ;
enum { kHTSizePhase1 = 2*kHThalfPhase1 } ;
enum { kCALIBSizePreLS1 = 2*kCALIBhalf };
};

Expand Down
40 changes: 21 additions & 19 deletions Geometry/CaloTopology/src/HcalTopology.cc
Expand Up @@ -68,7 +68,6 @@ HcalTopology::HcalTopology(const HcalDDDRecConstants* hcons) :
} else {
HTSize_ = kHTSizePhase1;
}

#ifdef DebugLog
std::cout << "Topo sizes " << HBSize_ << ":" << HESize_ << ":" << HOSize_
<< ":" << HFSize_ << ":" << HTSize_ << " for mode " << mode_
Expand Down Expand Up @@ -170,10 +169,8 @@ HcalTopology::HcalTopology(HcalTopologyMode::Mode mode, int maxDepthHB, int maxD
nEtaHE_ = (lastHERing_-firstHERing_+1);
if (triggerMode_ == HcalTopologyMode::tm_LHC_RCT) {
HTSize_ = kHTSizePreLS1;
} else if (triggerMode_ == HcalTopologyMode::tm_LHC_RCT_and_1x1) {
HTSize_ = kHTSizePhase1;
} else {
HTSize_ = kHTSizePhase1-kHTSizePreLS1;
HTSize_ = kHTSizePhase1;
}

edm::LogWarning("CaloTopology") << "This is an incomplete constructor of HcalTopology - be warned that many functionalities will not be there - revert from this - get from EventSetup";
Expand Down Expand Up @@ -202,17 +199,17 @@ bool HcalTopology::validDetId(HcalSubdetector subdet, int ieta, int iphi,
bool HcalTopology::validHT(const HcalTrigTowerDetId& id) const {

if (id.iphi()<1 || id.iphi()>IPHI_MAX || id.ieta()==0) return false;
if (id.depth() != 0) return false;
if (id.depth() != 0) return false;
if (id.version()==0) {
if ((triggerMode_==HcalTopologyMode::tm_LHC_1x1 && id.ietaAbs()>29) ||
(id.ietaAbs()>32)) return false;
(id.ietaAbs()>32)) return false;
int ietaMax = (triggerMode_==HcalTopologyMode::tm_LHC_1x1) ? 29 : 28;
if (id.ietaAbs()>ietaMax && ((id.iphi()%4)!=1)) return false;
if (id.ietaAbs()>ietaMax && ((id.iphi()%4)!=1)) return false;
} else {
if (triggerMode_==HcalTopologyMode::tm_LHC_RCT) return false;
if (id.ietaAbs()<30 || id.ietaAbs()>41) return false;
if (id.ietaAbs()>29 && ((id.iphi()%2)==0)) return false;
if (id.ietaAbs()>39 && ((id.iphi()%4)!=3)) return false;
if (triggerMode_==HcalTopologyMode::tm_LHC_RCT) return false;
if (id.ietaAbs()<30 || id.ietaAbs()>41) return false;
if (id.ietaAbs()>29 && ((id.iphi()%2)==0)) return false;
if (id.ietaAbs()>39 && ((id.iphi()%4)!=3)) return false;
}
return true;
}
Expand Down Expand Up @@ -1022,16 +1019,21 @@ unsigned int HcalTopology::detId2denseIdHT(const DetId& id) const {
unsigned int ivers = tid.version();

unsigned int index;
if (ivers == 0) {
if ((iphi-1)%4==0) index = (iphi-1)*32 + (ietaAbs-1) - (12*((iphi-1)/4));
else index = (iphi-1)*28 + (ietaAbs-1) + (4*(((iphi-1)/4)+1));
if (zside == -1) index += kHThalf;
if (triggerMode_ == HcalTopologyMode::tm_LHC_RCT) {
if (ivers == 0) {
if ((iphi-1)%4==0) index = (iphi-1)*32 + (ietaAbs-1) - (12*((iphi-1)/4));
else index = (iphi-1)*28 + (ietaAbs-1) + (4*(((iphi-1)/4)+1));
if (zside == -1) index += kHThalf;
} else {
index = kHTSizePreLS1;
if (zside == -1) index += ((kHTSizePhase1-kHTSizePreLS1)/2);
index += (36 * (ietaAbs - 30) + ((iphi - 1)/2));
}
} else {
index = kHTSizePreLS1;
if (zside == -1) index += ((kHTSizePhase1-kHTSizePreLS1)/2);
index += (36 * (ietaAbs - 30) + ((iphi - 1)/2));
if ((iphi-1)%2==0) index = (iphi-1)*41 + (ietaAbs-1) - (12*((iphi-1)/2));
else index = (iphi-1)*29 + (ietaAbs-1) + (12*(((iphi-1)/2)+1));
if (zside == -1) index += kHThalfPhase1;
}

return index;
}

Expand Down
28 changes: 27 additions & 1 deletion Geometry/CaloTopology/test/HcalTopologyTester.cc
Expand Up @@ -55,7 +55,8 @@ void HcalTopologyTester::analyze(const edm::Event& ,
}

void HcalTopologyTester::doTest(const HcalTopology& topology) {


// First test on movements along eta/phi directions
for (int idet=0; idet<4; idet++) {
HcalSubdetector subdet = HcalBarrel;
if (idet == 1) subdet = HcalOuter;
Expand Down Expand Up @@ -98,6 +99,31 @@ void HcalTopologyTester::doTest(const HcalTopology& topology) {
}
}

// Check on Dense Index

int maxDepthHB = topology.maxDepthHB();
int maxDepthHE = topology.maxDepthHE();
for (int det = 1; det <= HcalForward; det++) {
for (int eta = -HcalDetId::kHcalEtaMask2;
eta <= HcalDetId::kHcalEtaMask2; eta++) {
for (int phi = 0; phi <= HcalDetId::kHcalPhiMask2; phi++) {
for (int depth = 1; depth < maxDepthHB + maxDepthHE; depth++) {
HcalDetId cell ((HcalSubdetector) det, eta, phi, depth);
if (topology.valid(cell)) {
unsigned int dense = topology.detId2denseId(DetId(cell));
DetId id = topology.denseId2detId(dense);
if (cell == HcalDetId(id))
std::cout << cell << " Dense " << std::hex << dense << std::dec
<< " o/p " << HcalDetId(id) << std::endl;
else
std::cout << cell << " Dense " << std::hex << dense << std::dec
<< " o/p " << HcalDetId(id) << " **** ERROR *****"
<< std::endl;
}
}
}
}
}
}

//define this as a plug-in
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.testPhase2GeometryXML_cfi")
process.load("Geometry.HcalCommonData.testPhase2GeometryFineXML_cfi")
process.load("Geometry.HcalCommonData.hcalDDConstants_cff")
process.load("Geometry.HcalEventSetup.hcalTopologyIdeal_cfi")

Expand Down
2 changes: 1 addition & 1 deletion Geometry/HcalCommonData/data/PhaseII/hcalSimNumbering.xml
Expand Up @@ -81,7 +81,7 @@
1137.0*cm
</Vector>
<Vector name="noff" type="numeric" nEntries="19">
15, 99, 4, 10, 5, 2, 4, 18, 19, 11, 12, 13, 14, 3, 4, 53, 4, 0, 1
15,101, 4, 10, 5, 2, 4, 18, 19, 11, 12, 13, 14, 3, 4, 53, 4, 0, 1
</Vector>
<Vector name="Layer0Wt" type="numeric" nEntries="2">
1.2, 1.2
Expand Down
2 changes: 1 addition & 1 deletion Geometry/HcalCommonData/interface/HcalDDDRecConstants.h
Expand Up @@ -86,7 +86,7 @@ class HcalDDDRecConstants {
double getRZ(int subdet, int ieta, int depth) const;
std::vector<HcalActiveLength> getThickActive(const int type) const;
int getTopoMode() const {return ((hpar->topologyMode)&0xFF);}
int getTriggerMode() const {return (((hpar->topologyMode)>>8)&0xFF);}
int getTriggerMode() const {return ((((hpar->topologyMode)&0xFF) == 0) ? 0 : (((hpar->topologyMode)>>8)&0xFF));}
std::vector<HcalCellType> HcalCellTypes(HcalSubdetector) const;
bool isBH() const {return hcons.isBH();}
int maxHFDepth(int ieta, int iphi) const {return hcons.maxHFDepth(ieta,iphi);}
Expand Down
3 changes: 2 additions & 1 deletion Geometry/HcalCommonData/src/HcalDDDSimConstants.cc
Expand Up @@ -609,8 +609,9 @@ void HcalDDDSimConstants::initialize( void ) {
depthEta29[0] = 2;
depthEta29[1] = 1;
}
std::cout << "isBH_ " << hpar->noff.size() << ":" << noffsize << ":" << noffl << ":" << isBH_ << std::endl;
#ifdef DebugLog
std::cout << "isBH_ " << hpar->noff.size() << ":" << noffsize << ":"
<< noffl << ":" << isBH_ << std::endl;
std::cout << "Depth index at ieta = 16 for HB (max) " << depthEta16[0]
<< " HE (min) " << depthEta16[1] << "; max depth for itea = 29 : ("
<< depthEta29[0] << ":" << depthEta29[1] << ")" << std::endl;
Expand Down

0 comments on commit 83f7098

Please sign in to comment.