Skip to content

Commit

Permalink
Cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
jbsauvan committed Jan 12, 2018
1 parent 3f9d459 commit 71e7774
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 65 deletions.
61 changes: 14 additions & 47 deletions L1Trigger/L1THGCal/plugins/ntuples/HGCalTriggerNtupleHGCPanels.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,6 @@ class HGCalTriggerNtupleHGCPanels : public HGCalTriggerNtupleBase
std::vector<int> panel_layer_;
std::vector<int> panel_sector_;
std::vector<int> panel_number_;
// std::vector<uint32_t> panel_mod_n_;
// std::vector<std::vector<uint32_t> > panel_mod_id_;
// std::vector<std::vector<float> > panel_mod_mipPt_;
// std::vector<uint32_t> panel_third_n_;
// std::vector<std::vector<uint32_t> > panel_third_id_;
// std::vector<std::vector<float> > panel_third_mipPt_;
std::vector<unsigned> panel_tc_n_;
std::vector<std::vector<uint32_t> > panel_tc_id_;
std::vector<std::vector<uint32_t> > panel_tc_mod_;
Expand All @@ -43,6 +37,15 @@ class HGCalTriggerNtupleHGCPanels : public HGCalTriggerNtupleBase
std::vector<std::vector<float> > panel_tc_mipPt_;
std::vector<std::vector<float> > panel_tc_pt_;

private:
static const unsigned kPanel_offset_ = 0;
static const unsigned kPanel_mask_ = 0x1F;
static const unsigned kSector_offset_ = 5;
static const unsigned kSector_mask_ = 0x7;
static const unsigned kThird_offset_ = 4;
static const unsigned kThird_mask_ = 0x3;
static const unsigned kCell_mask_ = 0xF;

};

DEFINE_EDM_PLUGIN(HGCalTriggerNtupleFactory,
Expand All @@ -67,12 +70,6 @@ initialize(TTree& tree, const edm::ParameterSet& conf, edm::ConsumesCollector&&
tree.Branch("panel_layer", &panel_layer_);
tree.Branch("panel_sector", &panel_sector_);
tree.Branch("panel_number", &panel_number_);
// tree.Branch("panel_mod_n", &panel_mod_n_);
// tree.Branch("panel_mod_id", &panel_mod_id_);
// tree.Branch("panel_mod_mipPt", &panel_mod_mipPt_);
// tree.Branch("panel_third_n", &panel_third_n_);
// tree.Branch("panel_third_id", &panel_third_id_);
// tree.Branch("panel_third_mipPt", &panel_third_mipPt_);
tree.Branch("panel_tc_n", &panel_tc_n_);
tree.Branch("panel_tc_id", &panel_tc_id_);
tree.Branch("panel_tc_mod", &panel_tc_mod_);
Expand Down Expand Up @@ -109,20 +106,12 @@ fill(const edm::Event& e, const edm::EventSetup& es)
panelids_tcs[panelid].push_back(tc_itr);
}
}
unsigned panel_offset = 0;
unsigned panel_mask = 0x1F;
unsigned sector_offset = 5;
unsigned sector_mask = 0x7;
unsigned third_offset = 4;
unsigned third_mask = 0x3;
unsigned cell_mask = 0xF;

for (const auto& panelid_tcs : panelids_tcs)
for (const auto& panelid_tcs : panelids_tcs)
{
panel_n_++;
HGCalDetId panelid(panelid_tcs.first);
int panel_sector = (panelid.wafer()>>sector_offset) & sector_mask ;
int panel_number = (panelid.wafer()>>panel_offset) & panel_mask ;
int panel_sector = (panelid.wafer()>>kSector_offset_) & kSector_mask_ ;
int panel_number = (panelid.wafer()>>kPanel_offset_) & kPanel_mask_ ;
const auto& tcs = panelid_tcs.second;
panel_id_.emplace_back(panelid);
panel_zside_.emplace_back(panelid.zside());
Expand All @@ -146,30 +135,14 @@ fill(const edm::Event& e, const edm::EventSetup& es)
panel_tc_pt_.back().push_back(tc->pt());
HGCalDetId tc_detid(tc->detId());
unsigned module_id = tc_detid.wafer();
unsigned third_id = (tc_detid.cell()>>third_offset) & third_mask;
unsigned cell_id = tc_detid.cell() & cell_mask;
unsigned third_id = (tc_detid.cell()>>kThird_offset_) & kThird_mask_;
unsigned cell_id = tc_detid.cell() & kCell_mask_;
panel_tc_mod_.back().push_back(module_id);
panel_tc_third_.back().push_back(third_id);
panel_tc_cell_.back().push_back(cell_id);
modules_mipPt[module_id] += tc->mipPt();
thirds_mipPt[third_id] += tc->mipPt();
}
// panel_mod_n_.emplace_back(modules_mipPt.size());
// panel_mod_id_.emplace_back();
// panel_mod_mipPt_.emplace_back();
// for(const auto& id_mipPt : modules_mipPt)
// {
// panel_mod_id_.back().push_back(id_mipPt.first);
// panel_mod_mipPt_.back().push_back(id_mipPt.second);
// }
// panel_third_n_.emplace_back(thirds_mipPt.size());
// panel_third_id_.emplace_back();
// panel_third_mipPt_.emplace_back();
// for(const auto& id_mipPt : thirds_mipPt)
// {
// panel_third_id_.back().push_back(id_mipPt.first);
// panel_third_mipPt_.back().push_back(id_mipPt.second);
// }
}
}

Expand All @@ -184,12 +157,6 @@ clear()
panel_layer_.clear();
panel_sector_.clear();
panel_number_.clear();
// panel_mod_n_.clear();
// panel_mod_id_.clear();
// panel_mod_mipPt_.clear();
// panel_third_n_.clear();
// panel_third_id_.clear();
// panel_third_mipPt_.clear();
panel_tc_n_.clear();
panel_tc_id_.clear();
panel_tc_mod_.clear();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class HGCalTriggerNtupleHGCTriggerCells : public HGCalTriggerNtupleBase
virtual void fill(const edm::Event& e, const edm::EventSetup& es) override final;

private:
double calibrate(double, int, int);
void simhits(const edm::Event& e, std::unordered_map<uint32_t, double>& simhits_ee, std::unordered_map<uint32_t, double>& simhits_fh, std::unordered_map<uint32_t, double>& simhits_bh);
virtual void clear() override final;

Expand Down Expand Up @@ -211,10 +212,7 @@ fill(const edm::Event& e, const edm::EventSetup& es)
HGCalDetId detid(c_id);
int thickness = geometry_->eeTopology().dddConstants().waferTypeL(detid.wafer())-1;
int layer = detid.layer();
double fcPerMip = fcPerMip_[thickness];
double thicknessCorrection = thicknessCorrections_[thickness];
double layerWeight = layerWeights_[layer];
energy += itr->second*1.e6*keV2fC_/fcPerMip*layerWeight*1.e-3/thicknessCorrection;
energy += calibrate(itr->second, thickness, layer);
}
break;
}
Expand All @@ -226,10 +224,7 @@ fill(const edm::Event& e, const edm::EventSetup& es)
HGCalDetId detid(c_id);
int thickness = geometry_->fhTopology().dddConstants().waferTypeL(detid.wafer())-1;
int layer = detid.layer();
float fcPerMip = fcPerMip_[thickness];
double thicknessCorrection = thicknessCorrections_[thickness];
float layerWeight = layerWeights_[layer];
energy += itr->second*1.e6*keV2fC_/fcPerMip*layerWeight*1.e-3/thicknessCorrection;
energy += calibrate(itr->second, thickness, layer);
}
break;
}
Expand All @@ -249,6 +244,16 @@ fill(const edm::Event& e, const edm::EventSetup& es)
}
}

double
HGCalTriggerNtupleHGCTriggerCells::
calibrate(double energy, int thickness, int layer)
{
double fcPerMip = fcPerMip_[thickness];
double thicknessCorrection = thicknessCorrections_[thickness];
double layerWeight = layerWeights_[layer];
double TeV2GeV = 1.e3;
return energy*keV2fC_/fcPerMip*layerWeight*TeV2GeV/thicknessCorrection;
}

void
HGCalTriggerNtupleHGCTriggerCells::
Expand Down
1 change: 0 additions & 1 deletion L1Trigger/L1THGCal/python/hgcalTriggerNtuples_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

fcPerMip = recoparam.HGCalUncalibRecHit.HGCEEConfig.fCPerMIP
keV2fC = digiparam.hgceeDigitizer.digiCfg.keV2fC
# layerWeights = recocalibparam.HGCalRecHit.layerWeights
layerWeights = layercalibparam.TrgLayer_dEdX_weights
thicknessCorrections = recocalibparam.HGCalRecHit.thicknessCorrection

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
# Reco calibration parameters
fCPerMIPee = recoparam.HGCalUncalibRecHit.HGCEEConfig.fCPerMIP
fCPerMIPfh = recoparam.HGCalUncalibRecHit.HGCHEFConfig.fCPerMIP
# layerWeights = recocalibparam.HGCalRecHit.layerWeights
layerWeights = layercalibparam.TrgLayer_dEdX_weights
thicknessCorrection = recocalibparam.HGCalRecHit.thicknessCorrection

Expand All @@ -38,8 +37,8 @@
linnBits = cms.uint32(16),
triggerCellTruncationBits = cms.uint32(triggerCellTruncationBits),
NData = cms.uint32(999),
TCThreshold_fC = cms.double(0.1),
TCThresholdBH_MIP = cms.double(0.1),
TCThreshold_fC = cms.double(0.),
TCThresholdBH_MIP = cms.double(0.),
#take the following parameters from the digitization config file
adcsaturation = adcSaturation_fC,
adcnBits = adcNbits,
Expand Down
6 changes: 0 additions & 6 deletions L1Trigger/L1THGCal/test/testHGCalL1TGeometry_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,6 @@
process.load('L1Trigger.L1THGCal.hgcalTriggerPrimitives_cff')
# Eventually modify default geometry parameters
process.hgcalTriggerGeometryESProducer.TriggerGeometry.L1TModulesMapping = cms.FileInPath("L1Trigger/L1THGCal/data/panel_mapping_tdr.txt")
# process.hgcalTriggerGeometryESProducer.TriggerGeometry.TriggerGeometryName = cms.string('HGCalTriggerGeometryHexLayerBasedImp1')
# process.hgcalTriggerGeometryESProducer.TriggerGeometry.L1TCellsMapping = cms.FileInPath("L1Trigger/L1THGCal/data/triggercell_mapping_8inch_aligned_192_432_V8_0.txt")
# process.hgcalTriggerGeometryESProducer.TriggerGeometry.L1TModulesMapping = cms.FileInPath("L1Trigger/L1THGCal/data/panel_mapping_60deg_6mod_0.txt")
# process.hgcalTriggerGeometryESProducer.TriggerGeometry.L1TCellNeighborsMapping = cms.FileInPath("L1Trigger/L1THGCal/data/triggercell_neighbor_mapping_8inch_aligned_192_432_0.txt")
# process.hgcalTriggerGeometryESProducer.TriggerGeometry.L1TCellsBHMapping = cms.FileInPath("L1Trigger/L1THGCal/data/triggercell_mapping_BH_3x3_30deg_0.txt")
# process.hgcalTriggerGeometryESProducer.TriggerGeometry.L1TCellNeighborsBHMapping = cms.FileInPath("L1Trigger/L1THGCal/data/triggercell_neighbor_mapping_BH_3x3_30deg_0.txt")

process.hgcaltriggergeomtester = cms.EDAnalyzer(
"HGCalTriggerGeomTester"
Expand Down

0 comments on commit 71e7774

Please sign in to comment.