Skip to content

Commit

Permalink
add option to set layer 0 respcorr to 0.5/1.2 in hardcode conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
kpedro88 committed Oct 26, 2016
1 parent 6ce1f65 commit 90feb78
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 24 deletions.
2 changes: 1 addition & 1 deletion CalibCalorimetry/HcalAlgos/interface/HcalDbHardcode.h
Expand Up @@ -91,9 +91,9 @@ class HcalDbHardcode {
void makeHardcodeSiPMCharacteristics (HcalSiPMCharacteristics& sipm);
HcalTPChannelParameter makeHardcodeTPChannelParameter (HcalGenericDetId fId);
void makeHardcodeTPParameters (HcalTPParameters& tppar);
int getLayersInDepth(int ieta, int depth, const HcalTopology* topo);

private:
int getLayersInDepth(int ieta, int depth, const HcalTopology* topo);
//member variables
HcalHardcodeParameters theDefaultParameters_;
HcalHardcodeParameters theHBParameters_, theHEParameters_, theHFParameters_, theHOParameters_;
Expand Down
Expand Up @@ -24,6 +24,7 @@
useHOUpgrade = cms.bool(True),
testHFQIE10 = cms.bool(False),
killHE = cms.bool(False),
useLayer0Weight = cms.bool(False),
hb = cms.PSet(
pedestal = cms.double(3.0),
pedestalWidth = cms.double(0.55),
Expand Down Expand Up @@ -160,7 +161,8 @@
HEreCalibCutoff = cms.double(100.),
useHBUpgrade = cms.bool(True),
useHEUpgrade = cms.bool(True),
useHFUpgrade = cms.bool(True)
useHFUpgrade = cms.bool(True),
useLayer0Weight = cms.bool(True),
)

from Configuration.Eras.Modifier_phase2_hgcal_cff import phase2_hgcal
Expand Down
43 changes: 21 additions & 22 deletions CalibCalorimetry/HcalPlugins/src/HcalHardcodeCalibrations.cc
Expand Up @@ -140,6 +140,7 @@ HcalHardcodeCalibrations::HcalHardcodeCalibrations ( const edm::ParameterSet& iC
dbHardcode.setKillHE(iConfig.getParameter<bool>("killHE"));
dbHardcode.setSiPMCharacteristics(iConfig.getParameter<std::vector<edm::ParameterSet>>("SiPMCharacteristics"));

useLayer0Weight = iConfig.getParameter<bool>("useLayer0Weight");
// HE and HF recalibration preparation
iLumi=iConfig.getParameter<double>("iLumi");

Expand Down Expand Up @@ -443,37 +444,34 @@ std::unique_ptr<HcalRespCorrs> HcalHardcodeCalibrations::produceRespCorrs (const

auto result = std::make_unique<HcalRespCorrs>(topo);
std::vector <HcalGenericDetId> cells = allCells(*topo, dbHardcode.killHE());
for (std::vector <HcalGenericDetId>::const_iterator cell = cells.begin (); cell != cells.end (); ++cell) {
for (const auto& cell : cells) {

double corr = 1.0;

if ((he_recalibration != 0 ) &&
((*cell).genericSubdet() == HcalGenericDetId::HcalGenEndcap)) {

int depth_ = HcalDetId(*cell).depth();
int ieta_ = HcalDetId(*cell).ieta();
corr = he_recalibration->getCorr(ieta_, depth_);

/*
std::cout << "HE ieta, depth = " << ieta_ << ", " << depth_
<< " corr = " << corr << std::endl;
*/
//check for layer 0 reweighting: when depth 1 has only one layer, it is layer 0
if( useLayer0Weight &&
((cell.genericSubdet() == HcalGenericDetId::HcalGenEndcap) || (cell.genericSubdet() == HcalGenericDetId::HcalGenBarrel)) &&
(HcalDetId(cell).depth()==1 && dbHardcode.getLayersInDepth(HcalDetId(cell).ieta(),HcalDetId(cell).depth(),topo)==1) )
{
corr = 0.5/1.2;
}

if ((he_recalibration != 0 ) && (cell.genericSubdet() == HcalGenericDetId::HcalGenEndcap)) {
int depth_ = HcalDetId(cell).depth();
int ieta_ = HcalDetId(cell).ieta();
corr *= he_recalibration->getCorr(ieta_, depth_);

//std::cout << "HE ieta, depth = " << ieta_ << ", " << depth_ << " corr = " << corr << std::endl;
}
else if ((hf_recalibration != 0 ) &&
((*cell).genericSubdet() == HcalGenericDetId::HcalGenForward)) {
int depth_ = HcalDetId(*cell).depth();
int ieta_ = HcalDetId(*cell).ieta();
else if ((hf_recalibration != 0 ) && (cell.genericSubdet() == HcalGenericDetId::HcalGenForward)) {
int depth_ = HcalDetId(cell).depth();
int ieta_ = HcalDetId(cell).ieta();
corr = hf_recalibration->getCorr(ieta_, depth_, iLumi);

/*
std::cout << "HF ieta, depth = " << ieta_ << ", " << depth_
<< " corr = " << corr << std::endl;
*/

//std::cout << "HF ieta, depth = " << ieta_ << ", " << depth_ << " corr = " << corr << std::endl;
}

HcalRespCorr item(cell->rawId(),corr);
HcalRespCorr item(cell.rawId(),corr);
result->addValues(item);
}
return result;
Expand Down Expand Up @@ -846,6 +844,7 @@ void HcalHardcodeCalibrations::fillDescriptions(edm::ConfigurationDescriptions &
desc.add<bool>("useHOUpgrade",true);
desc.add<bool>("testHFQIE10",false);
desc.add<bool>("killHE",false);
desc.add<bool>("useLayer0Weight",false);
desc.addUntracked<std::vector<std::string> >("toGet",std::vector<std::string>());
desc.addUntracked<bool>("fromDDD",false);

Expand Down
Expand Up @@ -107,5 +107,6 @@ class HcalHardcodeCalibrations : public edm::ESProducer, public edm::EventSetupR
bool switchGainWidthsForTrigPrims;
bool setHEdsegm;
bool setHBdsegm;
bool useLayer0Weight;
};

0 comments on commit 90feb78

Please sign in to comment.