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

Expand Hcal DetId (supersedes #12829) #12883

Merged
merged 3 commits into from Jan 12, 2016
Merged
Show file tree
Hide file tree
Changes from all 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
Expand Up @@ -6,6 +6,7 @@
#include "Geometry/CaloGeometry/interface/CaloGeometry.h"
#include "FWCore/Framework/interface/EDProducer.h"
#include "DataFormats/HcalDetId/interface/HcalDetId.h"
#include "DataFormats/HcalDetId/interface/HcalSubdetector.h"
#include "Geometry/CaloTopology/interface/HcalTopology.h"

#include <iostream>
Expand All @@ -20,16 +21,14 @@ class CaloMiscalibMapHcal: public CaloMiscalibMap {

void prefillMap(const HcalTopology & topology){

for (int det = 1; det < 5; det++) {
for (int eta = -63; eta < 64; eta++) {
for (int phi = 0; phi < 128; phi++) {
for (int depth = 1; depth < 5; depth++) {
for (int det = 1; det <= HcalForward; det++) {
for (int eta = -HcalDetId::kHcalEtaMask2; eta <= HcalDetId::kHcalEtaMask2; eta++) {
for (int phi = 1; phi <= HcalDetId::kHcalPhiMask2; phi++) {
for (int depth = 1; depth <= HcalDetId::kHcalDepthMask2; depth++) {

try {
HcalDetId hcaldetid ((HcalSubdetector) det, eta, phi, depth);
if (topology.valid(hcaldetid))
// mapHcal_.setValue(hcaldetid.rawId(),1.0);
{
if (topology.valid(hcaldetid)) {
mapHcal_[hcaldetid.rawId()]=1.0;
// std::cout << "Valid cell found: " << det << " " << eta << " " << phi << " " << depth << std::endl;
}
Expand Down
2 changes: 1 addition & 1 deletion CalibCalorimetry/CastorCalib/src/CastorDbHardcode.cc
Expand Up @@ -378,7 +378,7 @@ void CastorDbHardcode::makeHardcodeMap(CastorElectronicsMap& emap) {
if (ieta==0) { // unmapped
emap.mapEId2chId(elId,DetId(HcalDetId::Undefined));
} else {
HcalDetId hId(HcalOuter,ieta*iside,iphi,idepth+3); // HO is officially "depth=4"
HcalDetId hId(HcalOuter,ieta*iside,iphi,4); // HO is officially "depth=4"
emap.mapEId2chId(elId,hId);
}
// printf(" %9d %9d %9d %9d %9s %9d %9d %9s %9d %9d %9d %9d %9d %9d\n",iside,ieta,iphi,idepth,&det,icrate,ihtr,&fpga,ihtr_fi,ifi_ch,ispigot,idcc,idcc_sl,ifed);
Expand Down
28 changes: 14 additions & 14 deletions CalibCalorimetry/HcalPlugins/src/HcalHardcodeCalibrations.cc
Expand Up @@ -6,13 +6,12 @@
#include <memory>
#include <iostream>

#include "HcalHardcodeCalibrations.h"
#include "FWCore/Framework/interface/ValidityInterval.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "DataFormats/HcalDetId/interface/HcalSubdetector.h"
#include "DataFormats/HcalDetId/interface/HcalZDCDetId.h"
#include "DataFormats/HcalDetId/interface/HcalDetId.h"
#include "DataFormats/HcalDetId/interface/HcalGenericDetId.h"
#include "DataFormats/HcalDetId/interface/HcalSubdetector.h"
#include "DataFormats/HcalDetId/interface/HcalTrigTowerDetId.h"
#include "CalibCalorimetry/HcalAlgos/interface/HcalDbHardcode.h"

Expand All @@ -23,6 +22,7 @@
#include "Geometry/CaloTopology/interface/HcalTopology.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"

#include "HcalHardcodeCalibrations.h"

// class decleration
//
Expand All @@ -42,11 +42,11 @@ namespace {
*/

if (result.size () <= 0) {
for (int eta = -HcalHardcodeCalibrations::kHcalEtaMask2;
eta <= HcalHardcodeCalibrations::kHcalEtaMask2; eta++) {
for (int phi = 0; phi <= HcalHardcodeCalibrations::kHcalPhiMask2; phi++) {
for (int depth = 1; depth < maxDepthHB + maxDepthHE; depth++) {
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++) {
for (int det = 1; det <= HcalForward; det++) {
HcalDetId cell ((HcalSubdetector) det, eta, phi, depth);
if (hcaltopology.valid(cell)) result.push_back (cell);

Expand Down Expand Up @@ -89,13 +89,13 @@ namespace {
// - As no valid(cell) check found for HcalTrigTowerDetId
// to create HT cells (ieta=1-28, iphi=1-72)&(ieta=29-32, iphi=1,5,... 69)

for (int vers=0; vers<=HcalHardcodeCalibrations::kHcalVersMask; ++vers) {
for (int depth=0; depth<=HcalHardcodeCalibrations::kHcalDepthMask; ++depth) {
for (int eta = -HcalHardcodeCalibrations::kHcalEtaMask;
eta <= HcalHardcodeCalibrations::kHcalEtaMask; eta++) {
for (int phi = 1; phi <= HcalHardcodeCalibrations::kHcalPhiMask; phi++) {
HcalTrigTowerDetId cell(eta, phi,depth,vers);
if (hcaltopology.validHT(cell)) result.push_back (cell);
for (int vers=0; vers<=HcalTrigTowerDetId::kHcalVersMask; ++vers) {
for (int depth=0; depth<=HcalTrigTowerDetId::kHcalDepthMask; ++depth) {
for (int eta = -HcalTrigTowerDetId::kHcalEtaMask;
eta <= HcalTrigTowerDetId::kHcalEtaMask; eta++) {
for (int phi = 1; phi <= HcalTrigTowerDetId::kHcalPhiMask; phi++) {
HcalTrigTowerDetId cell(eta, phi,depth,vers);
if (hcaltopology.validHT(cell)) result.push_back (cell);
}
}
}
Expand Down
8 changes: 0 additions & 8 deletions CalibCalorimetry/HcalPlugins/src/HcalHardcodeCalibrations.h
Expand Up @@ -44,14 +44,6 @@ class HcalCholeskyMatricesRcd;
class HcalCovarianceMatricesRcd;

class HcalHardcodeCalibrations : public edm::ESProducer, public edm::EventSetupRecordIntervalFinder {
public:
static const int kHcalPhiMask2 = 0x3FF;
static const int kHcalEtaMask2 = 0x1FF;
static const int kHcalDepthMask2 = 0xF;
static const int kHcalPhiMask = 0x7F;
static const int kHcalEtaMask = 0x3F;
static const int kHcalDepthMask = 0x7;
static const int kHcalVersMask = 0x7;

public:
HcalHardcodeCalibrations (const edm::ParameterSet& );
Expand Down
35 changes: 26 additions & 9 deletions DataFormats/HcalDetId/interface/HcalDetId.h
Expand Up @@ -8,12 +8,9 @@

/** \class HcalDetId
* Cell identifier class for the HCAL subdetectors, precision readout cells only
*
* \author J. Mans - Minnesota
*
* Rev.1.11: A.Kubik,R.Ofierzynski: add the hashed_index
*/
class HcalDetId : public DetId {

public:
static const int kHcalPhiMask1 = 0x7F;
static const int kHcalPhiMask2 = 0x3FF;
Expand All @@ -30,6 +27,9 @@ class HcalDetId : public DetId {
static const int kHcalDepthSet1 = 0x1C000;
static const int kHcalDepthSet2 = 0xF00000;
static const int kHcalIdFormat2 = 0x1000000;
static const int kHcalIdMask = 0xFE000000;

public:
/** Create a null cellid*/
HcalDetId();
/** Create cellid from raw id (0=invalid tower id) */
Expand All @@ -40,21 +40,34 @@ class HcalDetId : public DetId {
HcalDetId(const DetId& id);
/** Assignment from a generic cell id */
HcalDetId& operator=(const DetId& id);
/** Comparison operator */
bool operator==(DetId id) const;
bool operator!=(DetId id) const;
bool operator<(DetId id) const;

/// get the subdetector
HcalSubdetector subdet() const { return (HcalSubdetector)(subdetId()); }
bool oldFormat() const { return ((id_&kHcalIdFormat2)==0)?(true):(false); }
/// get the z-side of the cell (1/-1)
int zside() const { return (id_&kHcalZsideMask1)?(1):(-1); }
int zside() const;
/// get the absolute value of the cell ieta
int ietaAbs() const { return (id_>>kHcalEtaOffset1)&kHcalEtaMask1; }
int ietaAbs() const;
/// get the cell ieta
int ieta() const { return zside()*ietaAbs(); }
/// get the cell iphi
int iphi() const { return id_&kHcalPhiMask1; }
int iphi() const;
/// get the tower depth
int depth() const { return (id_>>kHcalDepthOffset1)&kHcalDepthMask1; }
int depth() const;
/// get full depth information for HF
int hfdepth() const;
/// get the tower depth
uint32_t maskDepth() const { return (id_ | kHcalDepthSet1); }
uint32_t maskDepth() const;
/// change format
uint32_t otherForm() const;
void changeForm();
uint32_t newForm() const;
static uint32_t newForm(const uint32_t&);

/// get the smallest crystal_ieta of the crystal in front of this tower (HB and HE tower 17 only)
int crystal_ieta_low() const { return ((ieta()-zside())*5)+zside(); }
/// get the largest crystal_ieta of the crystal in front of this tower (HB and HE tower 17 only)
Expand All @@ -66,6 +79,10 @@ class HcalDetId : public DetId {

static const HcalDetId Undefined;

private:

void newFromOld(const uint32_t&);
static void unpackId(const uint32_t&, int&, int&, int&, int&);
};

std::ostream& operator<<(std::ostream&,const HcalDetId& id);
Expand Down
19 changes: 14 additions & 5 deletions DataFormats/HcalDetId/interface/HcalTrigTowerDetId.h
Expand Up @@ -13,6 +13,15 @@ Cell id for an Calo Trigger tower
*/
class HcalTrigTowerDetId : public DetId {
public:
static const int kHcalPhiMask = 0x7F;
static const int kHcalEtaOffset = 7;
static const int kHcalEtaMask = 0x3F;
static const int kHcalZsideMask = 0x2000;
static const int kHcalDepthOffset = 14;
static const int kHcalDepthMask = 0x7;
static const int kHcalVersOffset = 17;
static const int kHcalVersMask = 0x7;
public:
/** Constructor of a null id */
HcalTrigTowerDetId();
/** Constructor from a raw value */
Expand All @@ -37,17 +46,17 @@ class HcalTrigTowerDetId : public DetId {
/// get the subdetector
HcalSubdetector subdet() const { return (HcalSubdetector)(subdetId()); }
/// get the z-side of the tower (1/-1)
int zside() const { return (id_&0x2000)?(1):(-1); }
int zside() const { return (id_&kHcalZsideMask)?(1):(-1); }
/// get the absolute value of the tower ieta
int ietaAbs() const { return (id_>>7)&0x3f; }
int ietaAbs() const { return (id_>>kHcalEtaOffset)&kHcalEtaMask; }
/// get the tower ieta
int ieta() const { return zside()*ietaAbs(); }
/// get the tower iphi
int iphi() const { return id_&0x7F; }
int iphi() const { return id_&kHcalPhiMask; }
/// get the depth (zero for LHC Run 1, may be nonzero for later runs)
int depth() const { return (id_>>14)&0x7; }
int depth() const { return (id_>>kHcalDepthOffset)&kHcalDepthMask; }
/// get the version code for the trigger tower
int version() const { return (id_>>17)&0x7; }
int version() const { return (id_>>kHcalVersOffset)&kHcalVersMask; }

static const HcalTrigTowerDetId Undefined;

Expand Down