CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
ALPAKA_ACCELERATOR_NAMESPACE::HGCalSoARecHitsProducer Class Reference
Inheritance diagram for ALPAKA_ACCELERATOR_NAMESPACE::HGCalSoARecHitsProducer:
ALPAKA_ACCELERATOR_NAMESPACE::stream::EDProducer<> edm::ProducerBase< edm::stream::EDProducer, Args... >

Public Member Functions

 HGCalSoARecHitsProducer (edm::ParameterSet const &config)
 
void produce (device::Event &iEvent, device::EventSetup const &iSetup) override
 
 ~HGCalSoARecHitsProducer () override=default
 
- Public Member Functions inherited from ALPAKA_ACCELERATOR_NAMESPACE::stream::EDProducer<>
void produce (edm::Event &iEvent, edm::EventSetup const &iSetup) final
 
- Public Member Functions inherited from edm::ProducerBase< edm::stream::EDProducer, Args... >
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Member Functions

void computeThreshold ()
 

Private Attributes

edm::ESGetToken< CaloGeometry, CaloGeometryRecordcaloGeomToken_
 
std::vector< double > dEdXweights_
 
int deltasi_index_regemfac_
 
std::string detector_
 
device::EDPutToken< HGCalSoARecHitsDeviceCollection > const deviceToken_
 
double ecut_
 
double fcPerEle_
 
std::vector< double > fcPerMip_
 
edm::EDGetTokenT< HGCRecHitCollectionhits_token_
 
bool initialized_
 
bool isNose_
 
unsigned int maxlayer_
 
unsigned maxNumberOfThickIndices_
 
std::vector< double > nonAgedNoises_
 
hgcal::RecHitTools rhtools_
 
double sciThicknessCorrection_
 
std::vector< double > thicknessCorrection_
 
std::vector< std::vector< double > > thresholds_
 
std::vector< std::vector< double > > v_sigmaNoise_
 

Additional Inherited Members

- Public Types inherited from edm::ProducerBase< edm::stream::EDProducer, Args... >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Protected Member Functions inherited from edm::ProducerBase< edm::stream::EDProducer, Args... >
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
BranchAliasSetterT< ProductType > produces ()
 
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
BranchAliasSetterT< ProductType > produces ()
 
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
BranchAliasSetterT< ProductType > produces ()
 
auto produces () noexcept
 
ProducesCollector producesCollector ()
 

Detailed Description

Definition at line 22 of file HGCalSoARecHitsProducer.cc.

Constructor & Destructor Documentation

◆ HGCalSoARecHitsProducer()

ALPAKA_ACCELERATOR_NAMESPACE::HGCalSoARecHitsProducer::HGCalSoARecHitsProducer ( edm::ParameterSet const &  config)
inline

Definition at line 24 of file HGCalSoARecHitsProducer.cc.

References edm::ProducerBase< edm::stream::EDProducer, Args... >::produces().

25  : detector_(config.getParameter<std::string>("detector")),
26  initialized_(false),
27  isNose_(detector_ == "HFNose"),
28  maxNumberOfThickIndices_(config.getParameter<unsigned>("maxNumberOfThickIndices")),
29  fcPerEle_(config.getParameter<double>("fcPerEle")),
30  ecut_(config.getParameter<double>("ecut")),
31  fcPerMip_(config.getParameter<std::vector<double>>("fcPerMip")),
32  nonAgedNoises_(config.getParameter<std::vector<double>>("noises")),
33  dEdXweights_(config.getParameter<std::vector<double>>("dEdXweights")),
34  thicknessCorrection_(config.getParameter<std::vector<double>>("thicknessCorrection")),
35  caloGeomToken_(consumesCollector().esConsumes<CaloGeometry, CaloGeometryRecord>()),
36  hits_token_(consumes<HGCRecHitCollection>(config.getParameter<edm::InputTag>("recHits"))),
device::EDPutToken< HGCalSoARecHitsDeviceCollection > const deviceToken_
Definition: config.py:1
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeomToken_
auto produces(std::string instanceName) noexcept
declare what type of product will make and with which optional label

◆ ~HGCalSoARecHitsProducer()

ALPAKA_ACCELERATOR_NAMESPACE::HGCalSoARecHitsProducer::~HGCalSoARecHitsProducer ( )
overridedefault

Member Function Documentation

◆ computeThreshold()

void ALPAKA_ACCELERATOR_NAMESPACE::HGCalSoARecHitsProducer::computeThreshold ( )
inlineprivate

Definition at line 176 of file HGCalSoARecHitsProducer.cc.

References gather_cfg::cout, dEdXweights_, ecut_, fcPerEle_, fcPerMip_, initialized_, isNose_, maxlayer_, maxNumberOfThickIndices_, nonAgedNoises_, thicknessCorrection_, thresholds_, and v_sigmaNoise_.

Referenced by produce().

176  {
177  // To support the TDR geometry and also the post-TDR one (v9 onwards), we
178  // need to change the logic of the vectors containing signal to noise and
179  // thresholds. The first 3 indices will keep on addressing the different
180  // thicknesses of the Silicon detectors in CE_E , the next 3 indices will address
181  // the thicknesses of the Silicon detectors in CE_H, while the last one, number 6 (the
182  // seventh) will address the Scintillators. This change will support both
183  // geometries at the same time.
184 
185  if (initialized_)
186  return; // only need to calculate thresholds once
187 
188  initialized_ = true;
189 
190  std::vector<double> dummy;
191 
192  dummy.resize(maxNumberOfThickIndices_ + !isNose_, 0); // +1 to accomodate for the Scintillators
193  thresholds_.resize(maxlayer_, dummy);
194  v_sigmaNoise_.resize(maxlayer_, dummy);
195 
196  for (unsigned ilayer = 1; ilayer <= maxlayer_; ++ilayer) {
197  for (unsigned ithick = 0; ithick < maxNumberOfThickIndices_; ++ithick) {
198  float sigmaNoise = 0.001f * fcPerEle_ * nonAgedNoises_[ithick] * dEdXweights_[ilayer] /
199  (fcPerMip_[ithick] * thicknessCorrection_[ithick]);
200  thresholds_[ilayer - 1][ithick] = sigmaNoise * ecut_;
201  v_sigmaNoise_[ilayer - 1][ithick] = sigmaNoise;
202 #if 0
203  std::cout << "ilayer: " << ilayer << " nonAgedNoises: " << nonAgedNoises_[ithick]
204  << " fcPerEle: " << fcPerEle_ << " fcPerMip: " << fcPerMip_[ithick]
205  << " noiseMip: " << fcPerEle_ * nonAgedNoises_[ithick] / fcPerMip_[ithick]
206  << " sigmaNoise: " << sigmaNoise << "\n";
207 #endif
208  }
209  }
210  }

◆ fillDescriptions()

static void ALPAKA_ACCELERATOR_NAMESPACE::HGCalSoARecHitsProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
inlinestatic

Definition at line 140 of file HGCalSoARecHitsProducer.cc.

References edm::ConfigurationDescriptions::addWithDefaultLabel(), submitPVResolutionJobs::desc, ProducerED_cfi::InputTag, and AlCaHLTBitMon_QueryRunRegistry::string.

140  {
142  desc.add<std::string>("detector", "EE")->setComment("options EE, FH, BH, HFNose; other value defaults to EE");
143  desc.add<edm::InputTag>("recHits", edm::InputTag("HGCalRecHit", "HGCEERecHits"));
144  desc.add<unsigned int>("maxNumberOfThickIndices", 6);
145  desc.add<double>("fcPerEle", 0.00016020506);
146  desc.add<std::vector<double>>("fcPerMip");
147  desc.add<std::vector<double>>("thicknessCorrection");
148  desc.add<std::vector<double>>("noises");
149  desc.add<std::vector<double>>("dEdXweights");
150  desc.add<double>("ecut", 3.);
151  descriptions.addWithDefaultLabel(desc);
152  }
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)

◆ produce()

void ALPAKA_ACCELERATOR_NAMESPACE::HGCalSoARecHitsProducer::produce ( device::Event iEvent,
device::EventSetup const &  iSetup 
)
inlineoverridevirtual

Implements ALPAKA_ACCELERATOR_NAMESPACE::stream::EDProducer<>.

Definition at line 41 of file HGCalSoARecHitsProducer.cc.

References caloGeomToken_, hgcalTBTopologyTester_cfi::cells, computeThreshold(), ALPAKA_ACCELERATOR_NAMESPACE::brokenline::constexpr(), gather_cfg::cout, deltasi_index_regemfac_, DetId::det(), detector_, CaloRecHit::detid(), deviceToken_, CaloRecHit::energy(), relativeConstraints::geom, ALPAKA_ACCELERATOR_NAMESPACE::device::EventSetup::getHandle(), hgcal::RecHitTools::getLayerWithOffset(), hgcal::RecHitTools::getPosition(), hgcal::RecHitTools::getSiThickIndex(), DetId::HGCalHSi, HGCHEF, hfClusterShapes_cfi::hits, hits_token_, mps_fire::i, iEvent, isNose_, hgcal::RecHitTools::lastLayer(), maxlayer_, maxNumberOfThickIndices_, eostools::move(), hltrates_dqm_sourceclient-live_cfg::offset, position, edm::Handle< T >::product(), DetId::rawId(), rhtools_, hgcal::RecHitTools::setGeometry(), DetId::subdetId(), thresholds_, CaloRecHit::time(), HGCRecHit::timeError(), v_sigmaNoise_, and hgcal::RecHitTools::zside().

41  {
43 
47 
48  hits_h = iEvent.getHandle(hits_token_);
49  auto const& hits = *(hits_h.product());
51 
52  // Count effective hits above threshold
53  uint32_t index = 0;
54  for (unsigned int i = 0; i < hits.size(); ++i) {
55  const HGCRecHit& hgrh = hits[i];
56  DetId detid = hgrh.detid();
57  unsigned int layerOnSide = (rhtools_.getLayerWithOffset(detid) - 1);
58 
59  // set sigmaNoise default value 1 to use kappa value directly in case of
60  // sensor-independent thresholds
61  int thickness_index = rhtools_.getSiThickIndex(detid);
62  if (thickness_index == -1) {
63  thickness_index = maxNumberOfThickIndices_;
64  }
65  double storedThreshold = thresholds_[layerOnSide][thickness_index];
66  if (hgrh.energy() < storedThreshold)
67  continue; // this sets the ZS threshold at ecut times the sigma noise
68  index++;
69  }
70 
71  // Allocate Host SoA will contain one entry for each RecHit above threshold
73  auto cellsView = cells.view();
74 
75  // loop over all hits and create the Hexel structure, skip energies below ecut
76  // for each layer and wafer calculate the thresholds (sigmaNoise and energy)
77  // once
78  index = 0;
79  for (unsigned int i = 0; i < hits.size(); ++i) {
80  const HGCRecHit& hgrh = hits[i];
81  DetId detid = hgrh.detid();
82  unsigned int layerOnSide = (rhtools_.getLayerWithOffset(detid) - 1);
83 
84  // set sigmaNoise default value 1 to use kappa value directly in case of
85  // sensor-independent thresholds
86  float sigmaNoise = 1.f;
87  int thickness_index = rhtools_.getSiThickIndex(detid);
88  if (thickness_index == -1) {
89  thickness_index = maxNumberOfThickIndices_;
90  }
91  double storedThreshold = thresholds_[layerOnSide][thickness_index];
92  if (detid.det() == DetId::HGCalHSi || detid.subdetId() == HGCHEF) {
93  storedThreshold = thresholds_.at(layerOnSide).at(thickness_index + deltasi_index_regemfac_);
94  }
95  sigmaNoise = v_sigmaNoise_.at(layerOnSide).at(thickness_index);
96 
97  if (hgrh.energy() < storedThreshold)
98  continue; // this sets the ZS threshold at ecut times the sigma noise
99  // for the sensor
100 
102  int offset = ((rhtools_.zside(detid) + 1) >> 1) * maxlayer_;
103  int layer = layerOnSide + offset;
104  auto entryInSoA = cellsView[index];
105  if (detector_ == "BH") {
106  entryInSoA.dim1() = position.eta();
107  entryInSoA.dim2() = position.phi();
108  } // else, isSilicon == true and eta phi values will not be used
109  else {
110  entryInSoA.dim1() = position.x();
111  entryInSoA.dim2() = position.y();
112  }
113  entryInSoA.dim3() = position.z();
114  entryInSoA.weight() = hgrh.energy();
115  entryInSoA.sigmaNoise() = sigmaNoise;
116  entryInSoA.layer() = layer;
117  entryInSoA.recHitIndex() = i;
118  entryInSoA.detid() = detid.rawId();
119  entryInSoA.time() = hgrh.time();
120  entryInSoA.timeError() = hgrh.timeError();
121  index++;
122  }
123 #if 0
124  std::cout << "Size: " << cells->metadata().size() << " count cells: " << index
125  << " i.e. " << cells->metadata().size() << std::endl;
126 #endif
127 
128  if constexpr (!std::is_same_v<Device, alpaka_common::DevHost>) {
129  // Trigger copy async to GPU
130  //std::cout << "GPU" << std::endl;
131  HGCalSoARecHitsDeviceCollection deviceProduct{cells->metadata().size(), iEvent.queue()};
132  alpaka::memcpy(iEvent.queue(), deviceProduct.buffer(), cells.const_buffer());
133  iEvent.emplace(deviceToken_, std::move(deviceProduct));
134  } else {
135  //std::cout << "CPU" << std::endl;
136  iEvent.emplace(deviceToken_, std::move(cells));
137  }
138  }
device::EDPutToken< HGCalSoARecHitsDeviceCollection > const deviceToken_
constexpr const DetId & detid() const
Definition: CaloRecHit.h:33
T const * product() const
Definition: Handle.h:70
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46
int zside(const DetId &id) const
Definition: RecHitTools.cc:174
constexpr float energy() const
Definition: CaloRecHit.h:29
PortableCollection< HGCalSoARecHits > HGCalSoARecHitsDeviceCollection
int iEvent
Definition: GenABIO.cc:224
GlobalPoint getPosition(const DetId &id) const
Definition: RecHitTools.cc:140
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
Definition: DetId.h:17
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
void setGeometry(CaloGeometry const &)
Definition: RecHitTools.cc:79
constexpr float time() const
Definition: CaloRecHit.h:31
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeomToken_
static int position[264][3]
Definition: ReadPGInfo.cc:289
float timeError() const
Definition: HGCRecHit.cc:79
int getSiThickIndex(const DetId &) const
Definition: RecHitTools.cc:216
def move(src, dest)
Definition: eostools.py:511
unsigned int lastLayer(bool nose=false) const
Definition: RecHitTools.h:80
unsigned int getLayerWithOffset(const DetId &) const
Definition: RecHitTools.cc:381

Member Data Documentation

◆ caloGeomToken_

edm::ESGetToken<CaloGeometry, CaloGeometryRecord> ALPAKA_ACCELERATOR_NAMESPACE::HGCalSoARecHitsProducer::caloGeomToken_
private

Definition at line 172 of file HGCalSoARecHitsProducer.cc.

Referenced by produce().

◆ dEdXweights_

std::vector<double> ALPAKA_ACCELERATOR_NAMESPACE::HGCalSoARecHitsProducer::dEdXweights_
private

Definition at line 166 of file HGCalSoARecHitsProducer.cc.

Referenced by computeThreshold().

◆ deltasi_index_regemfac_

int ALPAKA_ACCELERATOR_NAMESPACE::HGCalSoARecHitsProducer::deltasi_index_regemfac_
private

Definition at line 160 of file HGCalSoARecHitsProducer.cc.

Referenced by produce().

◆ detector_

std::string ALPAKA_ACCELERATOR_NAMESPACE::HGCalSoARecHitsProducer::detector_
private

Definition at line 155 of file HGCalSoARecHitsProducer.cc.

Referenced by produce().

◆ deviceToken_

device::EDPutToken<HGCalSoARecHitsDeviceCollection> const ALPAKA_ACCELERATOR_NAMESPACE::HGCalSoARecHitsProducer::deviceToken_
private

Definition at line 174 of file HGCalSoARecHitsProducer.cc.

Referenced by produce().

◆ ecut_

double ALPAKA_ACCELERATOR_NAMESPACE::HGCalSoARecHitsProducer::ecut_
private

Definition at line 163 of file HGCalSoARecHitsProducer.cc.

Referenced by computeThreshold().

◆ fcPerEle_

double ALPAKA_ACCELERATOR_NAMESPACE::HGCalSoARecHitsProducer::fcPerEle_
private

Definition at line 162 of file HGCalSoARecHitsProducer.cc.

Referenced by computeThreshold().

◆ fcPerMip_

std::vector<double> ALPAKA_ACCELERATOR_NAMESPACE::HGCalSoARecHitsProducer::fcPerMip_
private

Definition at line 164 of file HGCalSoARecHitsProducer.cc.

Referenced by computeThreshold().

◆ hits_token_

edm::EDGetTokenT<HGCRecHitCollection> ALPAKA_ACCELERATOR_NAMESPACE::HGCalSoARecHitsProducer::hits_token_
private

Definition at line 173 of file HGCalSoARecHitsProducer.cc.

Referenced by produce().

◆ initialized_

bool ALPAKA_ACCELERATOR_NAMESPACE::HGCalSoARecHitsProducer::initialized_
private

Definition at line 156 of file HGCalSoARecHitsProducer.cc.

Referenced by computeThreshold().

◆ isNose_

bool ALPAKA_ACCELERATOR_NAMESPACE::HGCalSoARecHitsProducer::isNose_
private

Definition at line 157 of file HGCalSoARecHitsProducer.cc.

Referenced by computeThreshold(), and produce().

◆ maxlayer_

unsigned int ALPAKA_ACCELERATOR_NAMESPACE::HGCalSoARecHitsProducer::maxlayer_
private

Definition at line 159 of file HGCalSoARecHitsProducer.cc.

Referenced by computeThreshold(), and produce().

◆ maxNumberOfThickIndices_

unsigned ALPAKA_ACCELERATOR_NAMESPACE::HGCalSoARecHitsProducer::maxNumberOfThickIndices_
private

Definition at line 158 of file HGCalSoARecHitsProducer.cc.

Referenced by computeThreshold(), and produce().

◆ nonAgedNoises_

std::vector<double> ALPAKA_ACCELERATOR_NAMESPACE::HGCalSoARecHitsProducer::nonAgedNoises_
private

Definition at line 165 of file HGCalSoARecHitsProducer.cc.

Referenced by computeThreshold().

◆ rhtools_

hgcal::RecHitTools ALPAKA_ACCELERATOR_NAMESPACE::HGCalSoARecHitsProducer::rhtools_
private

Definition at line 171 of file HGCalSoARecHitsProducer.cc.

Referenced by produce().

◆ sciThicknessCorrection_

double ALPAKA_ACCELERATOR_NAMESPACE::HGCalSoARecHitsProducer::sciThicknessCorrection_
private

Definition at line 161 of file HGCalSoARecHitsProducer.cc.

◆ thicknessCorrection_

std::vector<double> ALPAKA_ACCELERATOR_NAMESPACE::HGCalSoARecHitsProducer::thicknessCorrection_
private

Definition at line 167 of file HGCalSoARecHitsProducer.cc.

Referenced by computeThreshold().

◆ thresholds_

std::vector<std::vector<double> > ALPAKA_ACCELERATOR_NAMESPACE::HGCalSoARecHitsProducer::thresholds_
private

Definition at line 168 of file HGCalSoARecHitsProducer.cc.

Referenced by computeThreshold(), and produce().

◆ v_sigmaNoise_

std::vector<std::vector<double> > ALPAKA_ACCELERATOR_NAMESPACE::HGCalSoARecHitsProducer::v_sigmaNoise_
private

Definition at line 169 of file HGCalSoARecHitsProducer.cc.

Referenced by computeThreshold(), and produce().