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

Run2-hcx144 Correct the active length calculation and its usage #20179

Merged
merged 7 commits into from
Aug 30, 2017
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 15 additions & 13 deletions Calibration/HcalCalibAlgos/plugins/HcalHBHEMuonAnalyzer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,14 @@ class HcalHBHEMuonAnalyzer : public edm::one::EDAnalyzer<edm::one::WatchRuns,ed

public:
explicit HcalHBHEMuonAnalyzer(const edm::ParameterSet&);
~HcalHBHEMuonAnalyzer();

static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);

Copy link
Contributor

Choose a reason for hiding this comment

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

@bsunanda - please, apply the patch from the code checks:

diff --git a/Calibration/HcalCalibAlgos/plugins/HcalHBHEMuonAnalyzer.cc b/Calibration/HcalCalibAlgos/plugins/HcalHBHEMuonAnalyzer.cc
index afef29c..a471582 100644
--- a/Calibration/HcalCalibAlgos/plugins/HcalHBHEMuonAnalyzer.cc
+++ b/Calibration/HcalCalibAlgos/plugins/HcalHBHEMuonAnalyzer.cc
@@ -71,10 +71,10 @@ public:
   static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
 
 private:
-  virtual void beginJob() override;
-  virtual void analyze(edm::Event const&, edm::EventSetup const&) override;
-  virtual void beginRun(edm::Run const&, edm::EventSetup const&) override;
-  virtual void endRun(edm::Run const&, edm::EventSetup const&) override {}
+  void beginJob() override;
+  void analyze(edm::Event const&, edm::EventSetup const&) override;
+  void beginRun(edm::Run const&, edm::EventSetup const&) override;
+  void endRun(edm::Run const&, edm::EventSetup const&) override {}
   virtual void beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) {}
   virtual void endLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) {}
   void   clearVectors();

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

private:
virtual void beginJob() override;
virtual void analyze(edm::Event const&, edm::EventSetup const&) override;
virtual void beginRun(edm::Run const&, edm::EventSetup const&) override;
virtual void endRun(edm::Run const&, edm::EventSetup const&) override {}
void beginJob() override;
void analyze(edm::Event const&, edm::EventSetup const&) override;
void beginRun(edm::Run const&, edm::EventSetup const&) override;
void endRun(edm::Run const&, edm::EventSetup const&) override {}
virtual void beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) {}
virtual void endLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) {}
void clearVectors();
Expand Down Expand Up @@ -136,7 +135,7 @@ class HcalHBHEMuonAnalyzer : public edm::one::EDAnalyzer<edm::one::WatchRuns,ed
unsigned int runNumber_, eventNumber_ , lumiNumber_, bxNumber_;
};

HcalHBHEMuonAnalyzer::HcalHBHEMuonAnalyzer(const edm::ParameterSet& iConfig) : hdc(0) {
HcalHBHEMuonAnalyzer::HcalHBHEMuonAnalyzer(const edm::ParameterSet& iConfig) : hdc(nullptr) {

usesResource(TFileService::kSharedResource);
//now do what ever initialization is needed
Expand Down Expand Up @@ -184,11 +183,6 @@ HcalHBHEMuonAnalyzer::HcalHBHEMuonAnalyzer(const edm::ParameterSet& iConfig) : h
}
}

HcalHBHEMuonAnalyzer::~HcalHBHEMuonAnalyzer() {
// do anything here that needs to be done at desctruction time
// (e.g. close files, deallocate resources etc.)
}

//
// member functions
//
Expand Down Expand Up @@ -821,17 +815,25 @@ double HcalHBHEMuonAnalyzer::activeLength(const DetId& id_) {
HcalDetId id(id_);
int ieta = id.ietaAbs();
int depth= id.depth();
int zside= id.zside();
int iphi = id.iphi();
double lx(0);
if (id.subdet() == HcalBarrel) {
for (unsigned int i=0; i<actHB.size(); ++i) {
if (ieta == actHB[i].ieta && depth == actHB[i].depth) {
if ((ieta == actHB[i].ieta) && (depth == actHB[i].depth) &&
(zside == actHB[i].zside) &&
(std::find(actHB[i].iphis.begin(),actHB[i].iphis.end(),iphi) !=
actHB[i].iphis.end())) {
lx = actHB[i].thick;
break;
}
}
} else {
for (unsigned int i=0; i<actHE.size(); ++i) {
if (ieta == actHE[i].ieta && depth == actHE[i].depth) {
if ((ieta == actHE[i].ieta) && (depth == actHE[i].depth) &&
(zside == actHE[i].zside) &&
(std::find(actHE[i].iphis.begin(),actHE[i].iphis.end(),iphi) !=
actHE[i].iphis.end())) {
lx = actHE[i].thick;
break;
}
Expand Down
1 change: 1 addition & 0 deletions Geometry/HcalCommonData/BuildFile.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<use name="DetectorDescription/Core"/>
<use name="DataFormats/HcalDetId"/>
<use name="clhep"/>
<export>
<lib name="1"/>
</export>
61 changes: 32 additions & 29 deletions Geometry/HcalCommonData/interface/HcalDDDRecConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class HcalDDDRecConstants {
struct HcalActiveLength {
int ieta, depth, zside, stype;
double eta, thick;
std::vector<int> iphis;
HcalActiveLength(int ie=0, int d=0, int z=0, int s=0, double et=0,
double t=0) : ieta(ie), depth(d), zside(z), stype(s),
eta(et), thick(t) {}
Expand All @@ -57,49 +58,51 @@ class HcalDDDRecConstants {
nPhi(nfi), rMin(r1), rMax(r2) {}
};

std::vector<std::pair<double,double> > getConstHBHE(const int type) const {
std::vector<std::pair<double,double> > getConstHBHE(const int& type) const {
if (type == 0) return gconsHB;
else if (type == 1) return gconsHE;
else {std::vector<std::pair<double,double> > gcons; return gcons;}
}
std::vector<int> getDepth(int det, int phi,
int zside, unsigned int eta) const;
std::vector<int> getDepth(unsigned int eta, bool extra) const;
int getDepthEta16(const int det, const int iphi,
const int zside) const {return hcons.getDepthEta16(det,iphi,zside);}
std::vector<HcalEtaBin> getEtaBins(int itype) const;
std::pair<double,double> getEtaPhi(int subdet, int ieta, int iphi) const;
std::pair<int,int> getEtaRange(const int i) const
std::vector<int> getDepth(const int& det, const int& phi,
const int& zside, const unsigned int& eta) const;
std::vector<int> getDepth(const unsigned int& eta, const bool& extra) const;
int getDepthEta16(const int& det, const int& iphi,
const int& zside) const {return hcons.getDepthEta16(det,iphi,zside);}
std::vector<HcalEtaBin> getEtaBins(const int& itype) const;
std::pair<double,double> getEtaPhi(const int& subdet, const int& ieta, const int& iphi) const;
std::pair<int,int> getEtaRange(const int& i) const
{return std::pair<int,int>(iEtaMin[i],iEtaMax[i]);}
const std::vector<double> & getEtaTable() const {return etaTable;}
const std::vector<double> & getEtaTableHF() const {return hpar->etaTableHF;}
std::pair<double,double> getEtaLimit(const int i) const
std::pair<double,double> getEtaLimit(const int& i) const
{return std::pair<double,double>(etaTable[i],etaTable[i+1]);}
HcalID getHCID(int subdet, int ieta, int iphi, int lay,
int idepth) const;
HcalID getHCID(int subdet, int ieta, int iphi, int lay, int idepth) const;
std::vector<HFCellParameters> getHFCellParameters() const;
void getLayerDepth(int ieta, std::map<int,int>& layers) const;
int getLayerFront(int det, int eta, int phi, int depth) const;
double getLayer0Wt(int det, int phi, int zside) const {return hcons.getLayer0Wt(det,phi,zside);}
int getMaxDepth(const int type) const {return maxDepth[type];}
int getMaxDepth(int itype, int ieta,
int iphi, int zside) const;
int getMinDepth(int itype, int ieta,
int iphi, int zside) const;
void getLayerDepth(const int& ieta, std::map<int,int>& layers) const;
int getLayerFront(const int& det, const int& eta, const int& phi,
const int& depth) const;
double getLayer0Wt(const int& det, const int& phi,
const int& zside) const {return hcons.getLayer0Wt(det,phi,zside);}
int getMaxDepth(const int& type) const {return maxDepth[type];}
int getMaxDepth(const int& itype, const int& ieta,
const int& iphi, const int& zside) const;
int getMinDepth(const int& itype, const int& ieta,
const int& iphi, const int& zside) 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];}
double getPhiBin(const int i) const {return phibin[i];}
double getPhiOff(const int i) const {return hpar->phioff[i];}
int getNoff(const int& i) const {return hpar->noff[i];}
int getNPhi(const int& type) const {return nPhiBins[type];}
double getPhiBin(const int& i) const {return phibin[i];}
double getPhiOff(const int& i) const {return hpar->phioff[i];}
const std::vector<double> & getPhiOffs() const {return hpar->phioff;}
std::vector<std::pair<int,double> > getPhis(int subdet, int ieta) const;
std::vector<std::pair<int,double> > getPhis(const int& subdet, const int& ieta) const;
const std::vector<double> & getPhiTable() const {return phibin;}
const std::vector<double> & getPhiTableHF() const {return hpar->phitable;}
int getPhiZOne(std::vector<std::pair<int,int> >& phiz) const;
double getRZ(int subdet, int ieta, int depth) const;
double getRZ(int subdet, int ieta, int iphi, int depth) const;
double getRZ(int subdet, int layer) const;
std::vector<HcalActiveLength> getThickActive(int type) const;
double getRZ(const int& subdet, const int& ieta, const int& depth) const;
double getRZ(const int& subdet, const int& ieta, const int& iphi,
const int& depth) const;
double getRZ(const int& subdet, const int& layer) const;
std::vector<HcalActiveLength> getThickActive(const int& type) const;
int getTopoMode() const {return ((hpar->topologyMode)&0xFF);}
int getTriggerMode() const {return (((hpar->topologyMode)>>8)&0xFF);}
std::vector<HcalCellType> HcalCellTypes(HcalSubdetector) const;
Expand Down
127 changes: 63 additions & 64 deletions Geometry/HcalCommonData/interface/HcalDDDSimConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,79 +28,80 @@ class HcalDDDSimConstants {
HcalDDDSimConstants(const HcalParameters* hp);
~HcalDDDSimConstants();

HcalCellType::HcalCell cell(int det, int zside,
int depth, int etaR,
int iphi) const;
int findDepth(int det, int eta,
int phi, int zside,
int lay) const;
unsigned int findLayer(int layer, const std::vector<HcalParameters::LayerItem>& layerGroup) const;
std::vector<std::pair<double,double> > getConstHBHE(int type) const;
int getDepthEta16(int det, int phi,
int zside) const;
int getDepthEta16M(int det) const;
int getDepthEta29(int phi, int zside, int i) const;
int getDepthEta29M(int i, bool planOne) const;
std::pair<int,double> getDetEta(double eta, int depth);
int getEta(int det, int lay, double hetaR);
std::pair<int,int> getEtaDepth(int det, int etaR, int phi,
int zside, int depth, int lay);
double getEtaHO(double& etaR, double& x, double& y,
double& z) const;
std::pair<int,int> getiEtaRange(const int i) const {return std::pair<int,int>(hpar->etaMin[i],hpar->etaMax[i]);}
HcalCellType::HcalCell cell(const int& det, const int& zside, const int& depth,
const int& etaR, const int& iphi) const;
int findDepth(const int& det, const int& eta, const int& phi,
const int& zside, const int& lay) const;
unsigned int findLayer(const int& layer, const std::vector<HcalParameters::LayerItem>& layerGroup) const;
std::vector<std::pair<double,double> > getConstHBHE(const int& type) const;
int getDepthEta16(const int& det, const int& phi,
const int& zside) const;
int getDepthEta16M(const int& det) const;
int getDepthEta29(const int& phi, const int& zside, const int& i) const;
int getDepthEta29M(const int& i, const bool& planOne) const;
std::pair<int,double> getDetEta(const double& eta, const int& depth);
int getEta(const int& det, const int& lay, const double& hetaR);
std::pair<int,int> getEtaDepth(const int& det, int etaR, const int& phi,
const int& zside, int depth, const int& lay);
double getEtaHO(const double& etaR, const double& x, const double& y,
const double& z) const;
std::pair<int,int> getiEtaRange(const int& i) const {return std::pair<int,int>(hpar->etaMin[i],hpar->etaMax[i]);}
const std::vector<double> & getEtaTableHF() const {return hpar->etaTableHF;}
const std::vector<double> & getGparHF() const {return hpar->gparHF;}
const std::vector<HcalDetId> & getIdHF2QIE() const {return idHF2QIE;}
double getLayer0Wt(int det, int phi,
int zside) const;
int getFrontLayer(int det, int eta) const;
int getLayerFront(int det, int eta,
int phi, int zside,
int depth) const;
int getLayerBack(int det, int eta,
int phi, int zside,
int depth) const;
int getLayerMax(int eta, int depth) const;
int getMaxDepth(const int type) const {return maxDepth[type];}
int getMaxDepth(int det, int eta,
int phi, int zside,
bool partialOnly) const;
std::pair<int,int> getMaxDepthDet(const int i) const {return ((i==1) ? depthMaxDf_ : depthMaxSp_);}
int getMinDepth(int det, int eta,
int phi, int zside,
bool partialOnly) const;
std::pair<int,int> getModHalfHBHE(int type) const;
std::pair<double,double> getPhiCons(int det, int ieta) const;
std::vector<std::pair<int,double> > getPhis(int subdet, int ieta) const;
double getLayer0Wt(const int& det, const int& phi,
const int& zside) const;
int getFrontLayer(const int& det, const int& eta) const;
int getLastLayer(const int& det, const int& eta) const;
int getLayerFront(const int& det, const int& eta,
const int& phi, const int& zside,
const int& depth) const;
int getLayerBack(const int& det, const int& eta,
const int& phi, const int& zside,
const int& depth) const;
int getLayerMax(const int& eta, const int& depth) const;
int getMaxDepth(const int& type) const {return maxDepth[type];}
int getMaxDepth(const int& det, const int& eta,
const int& phi, const int& zside,
const bool& partialOnly) const;
std::pair<int,int> getMaxDepthDet(const int& i) const {return ((i==1) ? depthMaxDf_ : depthMaxSp_);}
int getMinDepth(const int& det, const int& eta,
const int& phi, const int& zside,
const bool& partialOnly) const;
std::pair<int,int> getModHalfHBHE(const int& type) const;
std::pair<double,double> getPhiCons(const int& det, const int& ieta) const;
std::vector<std::pair<int,double> > getPhis(const int& subdet, const int& ieta) const;
const std::vector<double> & getPhiTableHF() const {return hpar->phitable;}
const std::vector<double> & getRTableHF() const {return hpar->rTable;}
std::vector<HcalCellType> HcalCellTypes() const;
std::vector<HcalCellType> HcalCellTypes(HcalSubdetector, int ieta=-1,
std::vector<HcalCellType> HcalCellTypes(const HcalSubdetector&, int ieta=-1,
int depth=-1) const;
bool isBH() const {return isBH_;}
const HcalLayerDepthMap* ldMap() const {return &ldmap_;}
int maxHFDepth(int ieta, int iphi) const;
unsigned int numberOfCells(HcalSubdetector) const;
int phiNumber(int phi, int unit) const;
int maxHFDepth(const int& ieta, const int& iphi) const;
unsigned int numberOfCells(const HcalSubdetector&) const;
int phiNumber(const int& phi, const int& unit) const;
void printTiles() const;
int unitPhi(int det, int etaR) const;
int unitPhi(double dphi) const;
int unitPhi(const int& det, const int& etaR) const;
int unitPhi(const double& dphi) const;

private:

static const int nDepthMax=9;
static const int maxLayer_=18;
static const int maxLayerHB_=16;

void initialize();
double deltaEta(int det, int eta,
int depth) const;
double getEta(int det, int etaR,
int zside, int depth=1) const;
double getEta(double r, double z) const;
int getShift(HcalSubdetector subdet,
int depth) const;
double getGain (HcalSubdetector subdet,
int depth) const;
void printTileHB(int eta, int phi,
int zside, int depth) const;
void printTileHE(int eta, int phi,
int zside, int depth) const;
double deltaEta(const int& det, const int& eta, const int& depth) const;
double getEta(const int& det, const int& etaR,
const int& zside, int depth=1) const;
double getEta(const double& r, const double& z) const;
int getShift(const HcalSubdetector& subdet, const int& depth) const;
double getGain (const HcalSubdetector& subdet, const int& depth) const;
void printTileHB(const int& eta, const int& phi,
const int& zside, const int& depth) const;
void printTileHE(const int& eta, const int& phi,
const int& zside, const int& depth) const;
unsigned int layerGroupSize(int eta) const;
unsigned int layerGroup(int eta, int i) const;
unsigned int layerGroup(int det, int eta,
Expand All @@ -110,10 +111,6 @@ class HcalDDDSimConstants {
const HcalParameters* hpar;
HcalLayerDepthMap ldmap_;

static const int nDepthMax=9;
static const int maxLayer_=18;
static const int maxLayerHB_=16;

std::vector<int> maxDepth; // Maximum depths in HB/HE/HF/HO
int nEta; // Number of bins in eta for HB and HE
int nR; // Number of bins in r
Expand All @@ -130,6 +127,8 @@ class HcalDDDSimConstants {
int depthEta29[2]; // maximum depth index for ieta=29
int layFHB[2]; // first layers in HB (normal, special 16)
int layFHE[3]; // first layers in HE (normal, special 16, 18)
int layBHB[3]; // last layers in HB (normal, special 15, 16)
int layBHE[4]; // last layers in HE (normal, special 16, 17, 18)
bool isBH_; // if HE is BH
std::vector<HcalDetId> idHF2QIE; // DetId's of HF modules with 2 QIE's
std::pair<int,int> depthMaxDf_, depthMaxSp_; // (subdet,maximum depth) default,special
Expand Down
Loading