Skip to content

Commit 8665f72

Browse files
jbsauvanwaredjeb
authored andcommitted
add access to number of thickness from geometry
1 parent f2889df commit 8665f72

File tree

9 files changed

+158
-62
lines changed

9 files changed

+158
-62
lines changed

L1Trigger/L1THGCal/interface/HGCalCoarseTriggerCellMapping.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,11 @@ class HGCalCoarseTriggerCellMapping {
1313
std::vector<uint32_t> getConstituentTriggerCells(uint32_t ctcId) const;
1414
GlobalPoint getCoarseTriggerCellPosition(uint32_t ctcId) const;
1515
uint32_t getCoarseTriggerCellId(uint32_t detid) const;
16-
void checkSizeValidity(int ctcSize) const;
17-
void setGeometry(const HGCalTriggerGeometryBase* const geom) { triggerTools_.setGeometry(geom); }
16+
void checkSizeValidity() const;
17+
void setGeometry(const HGCalTriggerGeometryBase* const geom) {
18+
triggerTools_.setGeometry(geom);
19+
checkSizeValidity();
20+
}
1821

1922
static constexpr int kCTCsizeCoarse_ = 16;
2023
static constexpr int kCTCsizeMid_ = 8;
@@ -26,7 +29,6 @@ class HGCalCoarseTriggerCellMapping {
2629
static const std::map<int, int> kSplit_;
2730
static const std::map<int, int> kSplit_Scin_;
2831
static constexpr int kSTCidMaskInv_ = ~0xf;
29-
static constexpr int kNThicknesses_ = 5; // 4 silicon types + 1 for scintillator
3032
static constexpr int kNHGCalLayersMax_ = 52;
3133

3234
static constexpr int kSplit_Coarse_ = 0;

L1Trigger/L1THGCal/interface/HGCalTriggerTools.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ class HGCalTriggerTools {
4242
GlobalPoint getTCPosition(const DetId& id) const;
4343
unsigned layers(ForwardSubdetector type) const;
4444
unsigned layers(DetId::Detector type) const;
45+
unsigned nSiWaferTypes() const;
4546
unsigned layer(const DetId&) const;
4647
unsigned layerWithOffset(const DetId&) const;
4748
bool isEm(const DetId&) const;
@@ -86,8 +87,6 @@ class HGCalTriggerTools {
8687
DetId simToReco(const DetId&, const HGCalTopology&) const;
8788
unsigned triggerLayer(const unsigned id) const { return geom_->triggerLayer(id); }
8889

89-
static constexpr unsigned kScintillatorPseudoThicknessIndex_ = 4;
90-
9190
enum SubDetectorType {
9291
hgcal_silicon_CEE,
9392
hgcal_silicon_CEH,
@@ -102,6 +101,7 @@ class HGCalTriggerTools {
102101
unsigned bhLayers_;
103102
unsigned noseLayers_;
104103
unsigned totalLayers_;
104+
unsigned scintillatorPseudoThicknessIndex_;
105105
};
106106

107107
#endif

L1Trigger/L1THGCal/interface/veryfrontend/HGCalVFESummationImpl.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,16 @@ class HGCalVFESummationImpl {
1414
public:
1515
HGCalVFESummationImpl(const edm::ParameterSet& conf);
1616

17-
void setGeometry(const HGCalTriggerGeometryBase* const geom) { triggerTools_.setGeometry(geom); }
17+
void setGeometry(const HGCalTriggerGeometryBase* const geom) {
18+
triggerTools_.setGeometry(geom);
19+
checkSizeValidity();
20+
}
21+
void checkSizeValidity() const;
1822
void triggerCellSums(const std::vector<std::pair<DetId, uint32_t> >&, std::unordered_map<uint32_t, uint32_t>&);
1923

2024
private:
2125
double lsb_silicon_fC_;
2226
double lsb_scintillator_MIP_;
23-
uint32_t nThickness_;
2427
std::vector<double> thresholds_silicon_;
2528
double threshold_scintillator_;
2629

L1Trigger/L1THGCal/python/l1tHGCalConcentratorProducer_cfi.py

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import FWCore.ParameterSet.Config as cms
22
import SimCalorimetry.HGCalSimProducers.hgcalDigitizer_cfi as digiparam
3-
from Configuration.Eras.Modifier_phase2_hgcalV19_cff import phase2_hgcalV19
3+
from HLTrigger.Configuration.HLT_75e33.psets.hgcal_reco_constants_cfi import HGCAL_reco_constants as HGCAL_reco_constants
44

55
# Digitization parameters
66
adcSaturationBH_MIP = digiparam.hgchebackDigitizer.digiCfg.feCfg.adcSaturation_fC
@@ -12,14 +12,10 @@
1212
# <V19: 3 different silicon thicknesses/types (HD120, LD200, LD300) + scintillator portion
1313
# >=V19: 4 different silicon thicknesses/types (HD120, LD200, LD300, HD200) + scintillator portion
1414
MAX_LAYERS = 52
15-
N_THICKNESSES = 3
15+
N_THICKNESSES = HGCAL_reco_constants.numberOfThicknesses.value()
1616
CTC_2_SIZES = cms.vuint32( [2]*(MAX_LAYERS+1)*(N_THICKNESSES+1) )
1717
STC_4_AND_16_SIZES = cms.vuint32( [4]*(MAX_LAYERS+1)+ [16]*(MAX_LAYERS+1)*N_THICKNESSES )
1818
STC_4_AND_8_SIZES = cms.vuint32( [4]*(MAX_LAYERS+1)+ [8]*(MAX_LAYERS+1)*N_THICKNESSES )
19-
N_THICKNESSES_V19 = 4
20-
CTC_2_SIZES_V19 = cms.vuint32( [2]*(MAX_LAYERS+1)*(N_THICKNESSES_V19+1) )
21-
STC_4_AND_16_SIZES_V19 = cms.vuint32( [4]*(MAX_LAYERS+1)+ [16]*(MAX_LAYERS+1)*N_THICKNESSES_V19 )
22-
STC_4_AND_8_SIZES_V19 = cms.vuint32( [4]*(MAX_LAYERS+1)+ [8]*(MAX_LAYERS+1)*N_THICKNESSES_V19 )
2319

2420
threshold_conc_proc = cms.PSet(ProcessorName = cms.string('HGCalConcentratorProcessorSelection'),
2521
Method = cms.vstring(['thresholdSelect']*3),
@@ -31,9 +27,6 @@
3127
ctcSize = CTC_2_SIZES,
3228
)
3329

34-
phase2_hgcalV19.toModify(threshold_conc_proc,
35-
ctcSize = CTC_2_SIZES_V19,
36-
)
3730

3831
# Column is Nlinks, Row is NWafers
3932
# Requested size = 8(links)x8(wafers)
@@ -91,9 +84,6 @@
9184
superTCCalibration_nose = vfe_proc.calibrationCfg_nose.clone(),
9285
ctcSize = CTC_2_SIZES,
9386
)
94-
phase2_hgcalV19.toModify(best_conc_proc,
95-
ctcSize = CTC_2_SIZES_V19,
96-
)
9787

9888
supertc_conc_proc = cms.PSet(ProcessorName = cms.string('HGCalConcentratorProcessorSelection'),
9989
Method = cms.vstring(['superTriggerCellSelect']*3),
@@ -110,10 +100,6 @@
110100
superTCCalibration_hesc = vfe_proc.calibrationCfg_hesc.clone(),
111101
superTCCalibration_nose = vfe_proc.calibrationCfg_nose.clone(),
112102
)
113-
phase2_hgcalV19.toModify(supertc_conc_proc,
114-
stcSize = STC_4_AND_16_SIZES_V19,
115-
ctcSize = CTC_2_SIZES_V19,
116-
)
117103

118104

119105
custom_conc_proc = cms.PSet(ProcessorName = cms.string('HGCalConcentratorProcessorSelection'),
@@ -134,10 +120,6 @@
134120
superTCCalibration_hesc = vfe_proc.calibrationCfg_hesc.clone(),
135121
superTCCalibration_nose = vfe_proc.calibrationCfg_nose.clone(),
136122
)
137-
phase2_hgcalV19.toModify(custom_conc_proc,
138-
stcSize = STC_4_AND_16_SIZES_V19,
139-
ctcSize = CTC_2_SIZES_V19,
140-
)
141123

142124

143125
coarsetc_onebitfraction_proc = cms.PSet(ProcessorName = cms.string('HGCalConcentratorProcessorSelection'),
@@ -158,10 +140,6 @@
158140
superTCCalibration_hesc = vfe_proc.calibrationCfg_hesc.clone(),
159141
superTCCalibration_nose = vfe_proc.calibrationCfg_nose.clone(),
160142
)
161-
phase2_hgcalV19.toModify(coarsetc_onebitfraction_proc,
162-
stcSize = STC_4_AND_8_SIZES_V19,
163-
ctcSize = CTC_2_SIZES_V19,
164-
)
165143

166144

167145
coarsetc_equalshare_proc = cms.PSet(ProcessorName = cms.string('HGCalConcentratorProcessorSelection'),
@@ -179,10 +157,6 @@
179157
superTCCalibration_hesc = vfe_proc.calibrationCfg_hesc.clone(),
180158
superTCCalibration_nose = vfe_proc.calibrationCfg_nose.clone(),
181159
)
182-
phase2_hgcalV19.toModify(coarsetc_equalshare_proc,
183-
stcSize = STC_4_AND_8_SIZES_V19,
184-
ctcSize = CTC_2_SIZES_V19,
185-
)
186160

187161

188162
autoencoder_triggerCellRemap = [0,16, 32,

L1Trigger/L1THGCal/python/l1tHGCalVFEProducer_cfi.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -143,11 +143,7 @@
143143
eeDigis = cms.InputTag('simHGCalUnsuppressedDigis:EE'),
144144
fhDigis = cms.InputTag('simHGCalUnsuppressedDigis:HEfront'),
145145
bhDigis = cms.InputTag('simHGCalUnsuppressedDigis:HEback'),
146-
ProcessorParameters = vfe_proc.clone(
147-
summationCfg = vfe_proc.summationCfg.clone(
148-
numberOfThicknesses = HGCAL_reco_constants.numberOfThicknesses
149-
)
150-
)
146+
ProcessorParameters = vfe_proc.clone()
151147
)
152148

153149
l1tHFnoseVFEProducer = cms.EDProducer(

L1Trigger/L1THGCal/src/HGCalCoarseTriggerCellMapping.cc

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,7 @@
22
#include "DataFormats/ForwardDetId/interface/HGCalTriggerDetId.h"
33

44
HGCalCoarseTriggerCellMapping::HGCalCoarseTriggerCellMapping(const std::vector<unsigned>& ctcSize)
5-
: ctcSize_(!ctcSize.empty() ? ctcSize
6-
: std::vector<unsigned>{kNHGCalLayersMax_ * kNThicknesses_, kCTCsizeVeryFine_}) {
7-
if (ctcSize_.size() != (kNHGCalLayersMax_ + 1) * kNThicknesses_) {
8-
throw cms::Exception("HGCTriggerParameterError")
9-
<< "Inconsistent size of coarse trigger cell size vector " << ctcSize_.size();
10-
}
11-
12-
for (auto ctc : ctcSize_)
13-
checkSizeValidity(ctc);
14-
}
5+
: ctcSize_(ctcSize) {}
156

167
const std::map<int, int> HGCalCoarseTriggerCellMapping::kSplit_ = {
178
{kCTCsizeIndividual_, kSplit_Individual_},
@@ -29,12 +20,19 @@ const std::map<int, int> HGCalCoarseTriggerCellMapping::kSplit_Scin_ = {
2920
{kCTCsizeCoarse_, kSplit_Scin_Coarse_},
3021
};
3122

32-
void HGCalCoarseTriggerCellMapping::checkSizeValidity(int ctcSize) const {
33-
if (ctcSize != kCTCsizeFine_ && ctcSize != kCTCsizeCoarse_ && ctcSize != kCTCsizeMid_ &&
34-
ctcSize != kCTCsizeVeryFine_ && ctcSize != kCTCsizeIndividual_) {
23+
void HGCalCoarseTriggerCellMapping::checkSizeValidity() const {
24+
unsigned nThickness = triggerTools_.nSiWaferTypes() + 1; // +1 for scintillator
25+
if (ctcSize_.size() != (kNHGCalLayersMax_ + 1) * nThickness) {
3526
throw cms::Exception("HGCTriggerParameterError")
36-
<< "Coarse Trigger Cell should be of size " << kCTCsizeIndividual_ << " or " << kCTCsizeVeryFine_ << " or "
37-
<< kCTCsizeFine_ << " or " << kCTCsizeMid_ << " or " << kCTCsizeCoarse_;
27+
<< "Inconsistent size of coarse trigger cell size vector " << ctcSize_.size();
28+
}
29+
for (auto ctcSize : ctcSize_) {
30+
if (ctcSize != kCTCsizeFine_ && ctcSize != kCTCsizeCoarse_ && ctcSize != kCTCsizeMid_ &&
31+
ctcSize != kCTCsizeVeryFine_ && ctcSize != kCTCsizeIndividual_) {
32+
throw cms::Exception("HGCTriggerParameterError")
33+
<< "Coarse Trigger Cell should be of size " << kCTCsizeIndividual_ << " or " << kCTCsizeVeryFine_ << " or "
34+
<< kCTCsizeFine_ << " or " << kCTCsizeMid_ << " or " << kCTCsizeCoarse_;
35+
}
3836
}
3937
}
4038

L1Trigger/L1THGCal/src/HGCalTriggerTools.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ void HGCalTriggerTools::setGeometry(const HGCalTriggerGeometryBase* const geom)
4646

4747
bhLayers_ = geom_->hscTopology().dddConstants().layers(true);
4848
totalLayers_ = eeLayers_ + fhLayers_;
49+
scintillatorPseudoThicknessIndex_ = nSiWaferTypes() + 1;
4950
}
5051

5152
GlobalPoint HGCalTriggerTools::getTCPosition(const DetId& id) const {
@@ -105,6 +106,8 @@ unsigned HGCalTriggerTools::layers(DetId::Detector type) const {
105106
return layers;
106107
}
107108

109+
unsigned HGCalTriggerTools::nSiWaferTypes() const { return geom_->eeTopology().dddConstants().waferTypes(); }
110+
108111
unsigned HGCalTriggerTools::layer(const DetId& id) const {
109112
unsigned int layer = std::numeric_limits<unsigned int>::max();
110113
if (id.det() == DetId::Forward && id.subdetId() == ForwardSubdetector::HFNose) {
@@ -266,7 +269,7 @@ int HGCalTriggerTools::zside(const DetId& id) const {
266269

267270
int HGCalTriggerTools::thicknessIndex(const DetId& id) const {
268271
if (isScintillator(id)) {
269-
return kScintillatorPseudoThicknessIndex_;
272+
return scintillatorPseudoThicknessIndex_;
270273
}
271274
unsigned det = id.det();
272275
int thickness = 0;

L1Trigger/L1THGCal/src/veryfrontend/HGCalVFESummationImpl.cc

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,9 @@
33

44
HGCalVFESummationImpl::HGCalVFESummationImpl(const edm::ParameterSet& conf)
55
: lsb_silicon_fC_(conf.getParameter<double>("siliconCellLSB_fC")),
6-
lsb_scintillator_MIP_(conf.getParameter<double>("scintillatorCellLSB_MIP")),
7-
nThickness_(conf.getParameter<uint32_t>("numberOfThicknesses")) {
6+
lsb_scintillator_MIP_(conf.getParameter<double>("scintillatorCellLSB_MIP")) {
87
thresholds_silicon_ =
98
conf.getParameter<edm::ParameterSet>("noiseSilicon").getParameter<std::vector<double>>("values");
10-
if (thresholds_silicon_.size() != nThickness_) {
11-
throw cms::Exception("Configuration") << thresholds_silicon_.size() << " silicon thresholds are given instead of "
12-
<< nThickness_ << " (the number of sensor thicknesses)";
13-
}
149
threshold_scintillator_ = conf.getParameter<edm::ParameterSet>("noiseScintillator").getParameter<double>("noise_MIP");
1510
const auto threshold = conf.getParameter<double>("noiseThreshold");
1611
std::transform(
@@ -20,6 +15,14 @@ HGCalVFESummationImpl::HGCalVFESummationImpl(const edm::ParameterSet& conf)
2015
threshold_scintillator_ *= threshold;
2116
}
2217

18+
void HGCalVFESummationImpl::checkSizeValidity() const {
19+
unsigned nThickness = triggerTools_.nSiWaferTypes();
20+
if (thresholds_silicon_.size() != nThickness) {
21+
throw cms::Exception("Configuration") << thresholds_silicon_.size() << " silicon thresholds are given instead of "
22+
<< nThickness << " (the number of sensor thicknesses)";
23+
}
24+
}
25+
2326
void HGCalVFESummationImpl::triggerCellSums(const std::vector<std::pair<DetId, uint32_t>>& input_dataframes,
2427
std::unordered_map<uint32_t, uint32_t>& triggercells) {
2528
if (input_dataframes.empty())
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
import FWCore.ParameterSet.Config as cms
2+
3+
from Configuration.Eras.Era_Phase2C26I13M9_cff import Phase2C26I13M9
4+
process = cms.Process('DIGI',Phase2C26I13M9)
5+
6+
# import of standard configurations
7+
process.load('Configuration.StandardSequences.Services_cff')
8+
process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi')
9+
process.load('FWCore.MessageService.MessageLogger_cfi')
10+
process.load('Configuration.EventContent.EventContent_cff')
11+
process.load('SimGeneral.MixingModule.mixNoPU_cfi')
12+
process.load('Configuration.Geometry.GeometryExtendedRun4D120Reco_cff')
13+
process.load('Configuration.StandardSequences.MagneticField_cff')
14+
process.load('Configuration.StandardSequences.Generator_cff')
15+
process.load('IOMC.EventVertexGenerators.VtxSmearedHLLHC14TeV_cfi')
16+
process.load('GeneratorInterface.Core.genFilterSummary_cff')
17+
process.load('Configuration.StandardSequences.SimIdeal_cff')
18+
process.load('Configuration.StandardSequences.Digi_cff')
19+
process.load('Configuration.StandardSequences.SimL1Emulator_cff')
20+
process.load('Configuration.StandardSequences.DigiToRaw_cff')
21+
process.load('Configuration.StandardSequences.EndOfProcess_cff')
22+
process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
23+
24+
25+
process.maxEvents = cms.untracked.PSet(
26+
input = cms.untracked.int32(5)
27+
)
28+
29+
# Input source
30+
process.source = cms.Source("PoolSource",
31+
fileNames = cms.untracked.vstring('file:step2.root'),
32+
inputCommands=cms.untracked.vstring(
33+
'keep *',
34+
)
35+
)
36+
37+
process.options = cms.untracked.PSet(
38+
39+
)
40+
41+
# Production Info
42+
process.configurationMetadata = cms.untracked.PSet(
43+
version = cms.untracked.string('$Revision: 1.20 $'),
44+
annotation = cms.untracked.string('SingleElectronPt10_cfi nevts:10'),
45+
name = cms.untracked.string('Applications')
46+
)
47+
48+
# Output definition
49+
process.TFileService = cms.Service(
50+
"TFileService",
51+
fileName = cms.string("ntuple.root")
52+
)
53+
54+
# Other statements
55+
from Configuration.AlCa.GlobalTag import GlobalTag
56+
process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase2_realistic_T21', '')
57+
58+
# load HGCAL TPG simulation
59+
process.load('L1Trigger.L1THGCal.hgcalTriggerPrimitives_cff')
60+
process.load('L1Trigger.L1THGCalUtilities.HGC3DClusterGenMatchSelector_cff')
61+
process.load('L1Trigger.L1THGCalUtilities.hgcalTriggerNtuples_cff')
62+
from L1Trigger.L1THGCalUtilities.hgcalTriggerChains import HGCalTriggerChains
63+
import L1Trigger.L1THGCalUtilities.vfe as vfe
64+
import L1Trigger.L1THGCalUtilities.concentrator as concentrator
65+
import L1Trigger.L1THGCalUtilities.clustering2d as clustering2d
66+
import L1Trigger.L1THGCalUtilities.clustering3d as clustering3d
67+
import L1Trigger.L1THGCalUtilities.selectors as selectors
68+
import L1Trigger.L1THGCalUtilities.customNtuples as ntuple
69+
70+
71+
chains = HGCalTriggerChains()
72+
# Register algorithms
73+
## VFE
74+
chains.register_vfe("Floatingpoint", vfe.CreateVfe())
75+
## ECON
76+
chains.register_concentrator("Supertriggercell", concentrator.CreateSuperTriggerCell())
77+
chains.register_concentrator("Threshold", concentrator.CreateThreshold())
78+
chains.register_concentrator("Bestchoice", concentrator.CreateBestChoice())
79+
chains.register_concentrator("Mixed", concentrator.CreateMixedFeOptions())
80+
## BE1
81+
chains.register_backend1("Dummy", clustering2d.CreateDummy())
82+
## BE2
83+
chains.register_backend2("Histomax", clustering3d.CreateHistoMax())
84+
# Register selector
85+
chains.register_selector("Genmatch", selectors.CreateGenMatch())
86+
87+
88+
# Register ntuples
89+
ntuple_list = ['event', 'gen', 'multiclusters']
90+
chains.register_ntuple("Genclustersntuple", ntuple.CreateNtuple(ntuple_list))
91+
92+
# Register trigger chains
93+
concentrator_algos = ['Supertriggercell', 'Threshold', 'Bestchoice', 'Mixed']
94+
backend_algos = ['Histomax']
95+
## Make cross product fo ECON and BE algos
96+
import itertools
97+
for cc,be in itertools.product(concentrator_algos,backend_algos):
98+
chains.register_chain('Floatingpoint', cc, 'Dummy', be, 'Genmatch', 'Genclustersntuple')
99+
100+
process = chains.create_sequences(process)
101+
102+
# Remove towers from sequence
103+
process.L1THGCalTriggerPrimitives.remove(process.L1THGCalTowerMap)
104+
process.L1THGCalTriggerPrimitives.remove(process.L1THGCalTower)
105+
106+
process.hgcl1tpg_step = cms.Path(process.L1THGCalTriggerPrimitives)
107+
process.selector_step = cms.Path(process.L1THGCalTriggerSelector)
108+
process.ntuple_step = cms.Path(process.L1THGCalTriggerNtuples)
109+
110+
# Schedule definition
111+
process.schedule = cms.Schedule(process.hgcl1tpg_step, process.selector_step, process.ntuple_step)
112+
113+
# Add early deletion of temporary data products to reduce peak memory need
114+
from Configuration.StandardSequences.earlyDeleteSettings_cff import customiseEarlyDelete
115+
process = customiseEarlyDelete(process)
116+
# End adding early deletion
117+

0 commit comments

Comments
 (0)