-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6b19bb3
commit 4c921b3
Showing
226 changed files
with
20,346 additions
and
77 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
CalibTracker/Records/interface/SiPixelGainCalibrationForHLTSoARcd.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#ifndef CalibTracker_Records_SiPixelGainCalibrationForHLTSoARcd_h | ||
#define CalibTracker_Records_SiPixelGainCalibrationForHLTSoARcd_h | ||
|
||
#include "CondFormats/DataRecord/interface/SiPixelGainCalibrationForHLTRcd.h" | ||
#include "FWCore/Framework/interface/DependentRecordImplementation.h" | ||
#include "FWCore/Framework/interface/EventSetupRecordImplementation.h" | ||
#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" | ||
|
||
class SiPixelGainCalibrationForHLTSoARcd | ||
: public edm::eventsetup::DependentRecordImplementation< | ||
SiPixelGainCalibrationForHLTSoARcd, | ||
edm::mpl::Vector<SiPixelGainCalibrationForHLTRcd, TrackerDigiGeometryRecord>> {}; | ||
|
||
#endif // CalibTracker_Records_SiPixelGainCalibrationForHLTSoARcd_h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#ifndef CalibTracker_Records_interface_SiPixelMappingSoARecord_h | ||
#define CalibTracker_Records_interface_SiPixelMappingSoARecord_h | ||
|
||
#include "FWCore/Framework/interface/EventSetupRecordImplementation.h" | ||
#include "FWCore/Framework/interface/DependentRecordImplementation.h" | ||
#include "CondFormats/DataRecord/interface/SiPixelGainCalibrationForHLTRcd.h" | ||
#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" | ||
#include "RecoTracker/Record/interface/CkfComponentsRecord.h" | ||
#include "CondFormats/DataRecord/interface/SiPixelFedCablingMapRcd.h" | ||
#include "CondFormats/DataRecord/interface/SiPixelQualityRcd.h" | ||
|
||
class SiPixelMappingSoARecord : | ||
public edm::eventsetup::DependentRecordImplementation< | ||
SiPixelMappingSoARecord, | ||
edm::mpl::Vector<SiPixelGainCalibrationForHLTRcd, SiPixelQualityRcd, SiPixelFedCablingMapRcd, TrackerDigiGeometryRecord>> {}; | ||
|
||
#endif |
5 changes: 5 additions & 0 deletions
5
CalibTracker/Records/src/SiPixelGainCalibrationForHLTSoARcd.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#include "CalibTracker/Records/interface/SiPixelGainCalibrationForHLTSoARcd.h" | ||
#include "FWCore/Framework/interface/eventsetuprecord_registration_macro.h" | ||
#include "FWCore/Utilities/interface/typelookup.h" | ||
|
||
EVENTSETUP_RECORD_REG(SiPixelGainCalibrationForHLTSoARcd); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#include "CalibTracker/Records/interface/SiPixelMappingSoARecord.h" | ||
#include "FWCore/Framework/interface/eventsetuprecord_registration_macro.h" | ||
#include "FWCore/Utilities/interface/typelookup.h" | ||
|
||
EVENTSETUP_RECORD_REG(SiPixelMappingSoARecord); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,38 @@ | ||
<use name="cuda"/> | ||
<use name="CalibTracker/Records"/> | ||
<use name="CalibTracker/SiPixelESProducers"/> | ||
<use name="CalibTracker/StandaloneTrackerTopology"/> | ||
<use name="CondFormats/DataRecord"/> | ||
<use name="CondFormats/SiPixelObjects"/> | ||
<use name="CondFormats/SiStripObjects"/> | ||
<use name="FWCore/Framework"/> | ||
<use name="FWCore/ParameterSet"/> | ||
<use name="Geometry/Records"/> | ||
<use name="Geometry/TrackerGeometryBuilder"/> | ||
<use name="MagneticField/Engine"/> | ||
<use name="RecoTracker/Record"/> | ||
<library file="*.cc" name="CalibTrackerSiPixelESProducersPlugins"> | ||
<use name="cuda"/> | ||
<use name="CalibTracker/Records"/> | ||
<use name="CalibTracker/SiPixelESProducers"/> | ||
<use name="CalibTracker/StandaloneTrackerTopology"/> | ||
<use name="CondFormats/DataRecord"/> | ||
<use name="CondFormats/SiPixelObjects"/> | ||
<use name="CondFormats/SiStripObjects"/> | ||
<use name="FWCore/Framework"/> | ||
<use name="FWCore/ParameterSet"/> | ||
<use name="Geometry/Records"/> | ||
<use name="Geometry/TrackerGeometryBuilder"/> | ||
<use name="MagneticField/Engine"/> | ||
<use name="RecoTracker/Record"/> | ||
<flags EDM_PLUGIN="1"/> | ||
</library> | ||
|
||
<library file="alpaka/*.cc" name="CalibTrackerSiPixelESProducersPluginsPortable"> | ||
<use name="alpaka"/> | ||
<use name="CalibTracker/Records"/> | ||
<use name="FWCore/Utilities"/> | ||
<use name="HeterogeneousCore/AlpakaCore"/> | ||
<use name="HeterogeneousCore/AlpakaInterface"/> | ||
<use name="CalibTracker/SiPixelESProducers"/> | ||
<use name="CalibTracker/StandaloneTrackerTopology"/> | ||
<use name="CondFormats/DataRecord"/> | ||
<use name="CondFormats/SiPixelObjects"/> | ||
<use name="CondFormats/SiStripObjects"/> | ||
<use name="FWCore/Framework"/> | ||
<use name="FWCore/ParameterSet"/> | ||
<use name="Geometry/Records"/> | ||
<use name="Geometry/TrackerGeometryBuilder"/> | ||
<use name="MagneticField/Engine"/> | ||
<use name="RecoTracker/Record"/> | ||
|
||
<flags ALPAKA_BACKENDS="1"/> | ||
<flags EDM_PLUGIN="1"/> | ||
</library> |
147 changes: 147 additions & 0 deletions
147
CalibTracker/SiPixelESProducers/plugins/alpaka/SiPixelCablingSoAESProducer.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,147 @@ | ||
#include "CondFormats/DataRecord/interface/SiPixelFedCablingMapRcd.h" | ||
#include "CondFormats/DataRecord/interface/SiPixelQualityRcd.h" | ||
#include "CondFormats/SiPixelObjects/interface/SiPixelFedCablingMap.h" | ||
#include "CalibTracker/Records/interface/SiPixelMappingSoARecord.h" | ||
#include "CondFormats/SiPixelObjects/interface/SiPixelFedCablingTree.h" | ||
#include "CondFormats/SiPixelObjects/interface/SiPixelQuality.h" | ||
#include "DataFormats/SiPixelClusterSoA/interface/ClusteringConstants.h" | ||
#include "CondFormats/SiPixelObjects/interface/SiPixelMappingHost.h" | ||
#include "CondFormats/SiPixelObjects/interface/alpaka/SiPixelMappingDevice.h" | ||
#include "FWCore/Framework/interface/ESTransientHandle.h" | ||
#include "FWCore/Framework/interface/EventSetup.h" | ||
#include "FWCore/MessageLogger/interface/MessageLogger.h" | ||
#include "FWCore/ParameterSet/interface/ParameterSet.h" | ||
#include "FWCore/Utilities/interface/ESGetToken.h" | ||
|
||
#include "Geometry/CommonDetUnit/interface/GeomDetType.h" | ||
#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" | ||
#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" | ||
|
||
#include "HeterogeneousCore/AlpakaCore/interface/alpaka/ESProducer.h" | ||
#include "HeterogeneousCore/AlpakaCore/interface/alpaka/ModuleFactory.h" | ||
#include "HeterogeneousCore/AlpakaInterface/interface/config.h" | ||
#include "HeterogeneousCore/AlpakaInterface/interface/memory.h" | ||
|
||
#include "RecoTracker/Record/interface/CkfComponentsRecord.h" | ||
|
||
namespace ALPAKA_ACCELERATOR_NAMESPACE { | ||
|
||
using namespace cms::alpakatools; | ||
|
||
class SiPixelCablingSoAESProducer : public ESProducer { | ||
public: | ||
SiPixelCablingSoAESProducer(edm::ParameterSet const& iConfig) | ||
: ESProducer(iConfig), useQuality_(iConfig.getParameter<bool>("UseQualityInfo")) { | ||
auto const& component = iConfig.getParameter<std::string>("appendToDataLabel"); | ||
auto cc = setWhatProduced(this, component); | ||
cablingMapToken_ = cc.consumes(edm::ESInputTag{"", iConfig.getParameter<std::string>("CablingMapLabel")}); | ||
if (useQuality_) { | ||
qualityToken_ = cc.consumes(); | ||
} | ||
geometryToken_ = cc.consumes(); | ||
} | ||
|
||
static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) { | ||
edm::ParameterSetDescription desc; | ||
desc.add<std::string>("appendToDataLabel", ""); | ||
desc.add<std::string>("CablingMapLabel", "")->setComment("CablingMap label"); | ||
desc.add<bool>("UseQualityInfo", false); | ||
descriptions.addWithDefaultLabel(desc); | ||
} | ||
|
||
std::optional<SiPixelMappingHost> produce(const SiPixelMappingSoARecord& iRecord) { | ||
auto cablingMap = iRecord.getTransientHandle(cablingMapToken_); | ||
const SiPixelQuality* quality = nullptr; | ||
if (useQuality_) { | ||
auto qualityInfo = iRecord.getTransientHandle(qualityToken_); | ||
quality = qualityInfo.product(); | ||
} | ||
bool hasQuality = quality != nullptr; | ||
auto geom = iRecord.getTransientHandle(geometryToken_); | ||
SiPixelMappingHost product(pixelgpudetails::MAX_SIZE, cms::alpakatools::host()); | ||
std::vector<unsigned int> const& fedIds = cablingMap->fedIds(); | ||
std::unique_ptr<SiPixelFedCablingTree> const& cabling = cablingMap->cablingTree(); | ||
|
||
unsigned int startFed = fedIds.front(); | ||
unsigned int endFed = fedIds.back(); | ||
|
||
sipixelobjects::CablingPathToDetUnit path; | ||
int index = 1; | ||
|
||
auto mapView = product.view(); | ||
|
||
mapView.hasQuality() = hasQuality; | ||
for (unsigned int fed = startFed; fed <= endFed; fed++) { | ||
for (unsigned int link = 1; link <= pixelgpudetails::MAX_LINK; link++) { | ||
for (unsigned int roc = 1; roc <= pixelgpudetails::MAX_ROC; roc++) { | ||
path = {fed, link, roc}; | ||
const sipixelobjects::PixelROC* pixelRoc = cabling->findItem(path); | ||
mapView[index].fed() = fed; | ||
mapView[index].link() = link; | ||
mapView[index].roc() = roc; | ||
if (pixelRoc != nullptr) { | ||
mapView[index].rawId() = pixelRoc->rawId(); | ||
mapView[index].rocInDet() = pixelRoc->idInDetUnit(); | ||
mapView[index].modToUnpDefault() = false; | ||
if (quality != nullptr) | ||
mapView[index].badRocs() = quality->IsRocBad(pixelRoc->rawId(), pixelRoc->idInDetUnit()); | ||
else | ||
mapView[index].badRocs() = false; | ||
} else { // store some dummy number | ||
mapView[index].rawId() = pixelClustering::invalidModuleId; | ||
mapView[index].rocInDet() = pixelClustering::invalidModuleId; | ||
mapView[index].badRocs() = true; | ||
mapView[index].modToUnpDefault() = true; | ||
} | ||
index++; | ||
} | ||
} | ||
} // end of FED loop | ||
// Given FedId, Link and idinLnk; use the following formula | ||
// to get the rawId and idinDU | ||
// index = (FedID-1200) * MAX_LINK* MAX_ROC + (Link-1)* MAX_ROC + idinLnk; | ||
// where, MAX_LINK = 48, MAX_ROC = 8 | ||
// FedID varies between 1200 to 1338 (In total 108 FED's) | ||
// Link varies between 1 to 48 | ||
// idinLnk varies between 1 to 8 | ||
|
||
auto trackerGeom = iRecord.getTransientHandle(geometryToken_); | ||
|
||
for (int i = 1; i < index; i++) { | ||
if (mapView[i].rawId() == pixelClustering::invalidModuleId) { | ||
mapView[i].moduleId() = pixelClustering::invalidModuleId; | ||
} else { | ||
auto gdet = trackerGeom->idToDetUnit(mapView[i].rawId()); | ||
if (!gdet) { | ||
LogDebug("SiPixelCablingSoAESProducer") << " Not found: " << mapView[i].rawId() << std::endl; | ||
continue; | ||
} | ||
mapView[i].moduleId() = gdet->index(); | ||
} | ||
LogDebug("SiPixelCablingSoAESProducer") | ||
<< "----------------------------------------------------------------------------" << std::endl; | ||
LogDebug("SiPixelCablingSoAESProducer") << i << std::setw(20) << mapView[i].fed() << std::setw(20) | ||
<< mapView[i].link() << std::setw(20) << mapView[i].roc() << std::endl; | ||
LogDebug("SiPixelCablingSoAESProducer") | ||
<< i << std::setw(20) << mapView[i].rawId() << std::setw(20) << mapView[i].rocInDet() << std::setw(20) | ||
<< mapView[i].moduleId() << std::endl; | ||
LogDebug("SiPixelCablingSoAESProducer") | ||
<< i << std::setw(20) << mapView[i].badRocs() << std::setw(20) << std::endl; | ||
LogDebug("SiPixelCablingSoAESProducer") | ||
<< "----------------------------------------------------------------------------" << std::endl; | ||
} | ||
|
||
mapView.size() = index - 1; | ||
|
||
return product; | ||
} | ||
|
||
private: | ||
edm::ESGetToken<SiPixelFedCablingMap, SiPixelFedCablingMapRcd> cablingMapToken_; | ||
edm::ESGetToken<SiPixelQuality, SiPixelQualityRcd> qualityToken_; | ||
edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> geometryToken_; | ||
bool useQuality_; | ||
}; | ||
} // namespace ALPAKA_ACCELERATOR_NAMESPACE | ||
|
||
DEFINE_FWK_EVENTSETUP_ALPAKA_MODULE(SiPixelCablingSoAESProducer); |
129 changes: 129 additions & 0 deletions
129
CalibTracker/SiPixelESProducers/plugins/alpaka/SiPixelGainCalibrationForHLTSoAESProducer.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
#include "CondFormats/SiPixelObjects/interface/SiPixelGainCalibrationForHLTHost.h" | ||
#include "CalibTracker/Records/interface/SiPixelGainCalibrationForHLTSoARcd.h" | ||
#include "CondFormats/DataRecord/interface/SiPixelGainCalibrationForHLTRcd.h" | ||
#include "CondFormats/SiPixelObjects/interface/SiPixelGainCalibrationForHLT.h" | ||
#include "DataFormats/Portable/interface/alpaka/PortableCollection.h" | ||
#include "FWCore/Framework/interface/ESProducer.h" | ||
#include "FWCore/Framework/interface/EventSetup.h" | ||
#include "FWCore/Framework/interface/ESHandle.h" | ||
#include "FWCore/Framework/interface/ModuleFactory.h" | ||
#include "FWCore/ParameterSet/interface/ParameterSet.h" | ||
#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" | ||
#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" | ||
#include "Geometry/CommonDetUnit/interface/GeomDetType.h" | ||
|
||
#include "HeterogeneousCore/AlpakaCore/interface/alpaka/ESProducer.h" | ||
#include "HeterogeneousCore/AlpakaCore/interface/alpaka/ModuleFactory.h" | ||
#include "HeterogeneousCore/AlpakaInterface/interface/config.h" | ||
#include "HeterogeneousCore/AlpakaInterface/interface/memory.h" | ||
#include "FWCore/MessageLogger/interface/MessageLogger.h" | ||
|
||
#include <memory> | ||
|
||
namespace ALPAKA_ACCELERATOR_NAMESPACE { | ||
|
||
class SiPixelGainCalibrationForHLTSoAESProducer : public ESProducer { | ||
public: | ||
explicit SiPixelGainCalibrationForHLTSoAESProducer(const edm::ParameterSet& iConfig); | ||
std::unique_ptr<SiPixelGainCalibrationForHLTHost> produce(const SiPixelGainCalibrationForHLTSoARcd& iRecord); | ||
|
||
static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); | ||
|
||
private: | ||
edm::ESGetToken<SiPixelGainCalibrationForHLT, SiPixelGainCalibrationForHLTRcd> gainsToken_; | ||
edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> geometryToken_; | ||
}; | ||
|
||
SiPixelGainCalibrationForHLTSoAESProducer::SiPixelGainCalibrationForHLTSoAESProducer(const edm::ParameterSet& iConfig) | ||
: ESProducer(iConfig) { | ||
auto cc = setWhatProduced(this); | ||
gainsToken_ = cc.consumes(); | ||
geometryToken_ = cc.consumes(); | ||
} | ||
|
||
void SiPixelGainCalibrationForHLTSoAESProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { | ||
edm::ParameterSetDescription desc; | ||
descriptions.addWithDefaultLabel(desc); | ||
} | ||
|
||
std::unique_ptr<SiPixelGainCalibrationForHLTHost> SiPixelGainCalibrationForHLTSoAESProducer::produce( | ||
const SiPixelGainCalibrationForHLTSoARcd& iRecord) { | ||
|
||
auto const& gains= iRecord.get(gainsToken_); | ||
auto const& geom = iRecord.get(geometryToken_); | ||
|
||
auto product = std::make_unique<SiPixelGainCalibrationForHLTHost>(gains.data().size(), cms::alpakatools::host()); | ||
|
||
// bizzarre logic (looking for fist strip-det) don't ask | ||
auto const& dus = geom.detUnits(); | ||
unsigned int n_detectors = dus.size(); | ||
for (unsigned int i = 1; i < 7; ++i) { | ||
const auto offset = geom.offsetDU(GeomDetEnumerators::tkDetEnum[i]); | ||
if (offset != dus.size() && dus[offset]->type().isTrackerStrip()) { | ||
if (n_detectors > offset) | ||
n_detectors = offset; | ||
} | ||
} | ||
|
||
LogDebug("SiPixelGainCalibrationForHLTSoA") | ||
<< "caching calibs for " << n_detectors << " pixel detectors of size " << gains.data().size() << '\n' | ||
<< "sizes " << sizeof(char) << ' ' << sizeof(uint8_t) << ' ' << sizeof(siPixelGainsSoA::DecodingStructure); | ||
|
||
for (size_t i = 0; i < gains.data().size(); i = i + 2) { | ||
product->view().v_pedestals()[i / 2].gain = gains.data()[i]; | ||
product->view().v_pedestals()[i / 2].ped = gains.data()[i + 1]; | ||
} | ||
|
||
//std::copy here | ||
// do not read back from the (possibly write-combined) memory buffer | ||
auto minPed = gains.getPedLow(); | ||
auto maxPed = gains.getPedHigh(); | ||
auto minGain = gains.getGainLow(); | ||
auto maxGain = gains.getGainHigh(); | ||
auto nBinsToUseForEncoding = 253; | ||
|
||
// we will simplify later (not everything is needed....) | ||
product->view().minPed() = minPed; | ||
product->view().maxPed() = maxPed; | ||
product->view().minGain() = minGain; | ||
product->view().maxGain() = maxGain; | ||
|
||
product->view().numberOfRowsAveragedOver() = 80; | ||
product->view().nBinsToUseForEncoding() = nBinsToUseForEncoding; | ||
product->view().deadFlag() = 255; | ||
product->view().noisyFlag() = 254; | ||
|
||
product->view().pedPrecision() = static_cast<float>(maxPed - minPed) / nBinsToUseForEncoding; | ||
product->view().gainPrecision() = static_cast<float>(maxGain - minGain) / nBinsToUseForEncoding; | ||
|
||
LogDebug("SiPixelGainCalibrationForHLTSoA") | ||
<< "precisions g " << product->view().pedPrecision() << ' ' << product->view().gainPrecision(); | ||
|
||
// fill the index map | ||
auto const& ind = gains.getIndexes(); | ||
LogDebug("SiPixelGainCalibrationForHLTSoA") << ind.size() << " " << n_detectors; | ||
|
||
for (auto i = 0U; i < n_detectors; ++i) { | ||
auto p = std::lower_bound( | ||
ind.begin(), ind.end(), dus[i]->geographicalId().rawId(), SiPixelGainCalibrationForHLT::StrictWeakOrdering()); | ||
assert(p != ind.end() && p->detid == dus[i]->geographicalId()); | ||
assert(p->iend <= gains.data().size()); | ||
assert(p->iend >= p->ibegin); | ||
assert(0 == p->ibegin % 2); | ||
assert(0 == p->iend % 2); | ||
assert(p->ibegin != p->iend); | ||
assert(p->ncols > 0); | ||
|
||
product->view().modStarts()[i] = p->ibegin; | ||
product->view().modEnds()[i] = p->iend; | ||
product->view().modCols()[i] = p->ncols; | ||
|
||
if (ind[i].detid != dus[i]->geographicalId()) | ||
LogDebug("SiPixelGainCalibrationForHLTSoA") << ind[i].detid << "!=" << dus[i]->geographicalId(); | ||
} | ||
|
||
return product; | ||
} | ||
|
||
} // namespace ALPAKA_ACCELERATOR_NAMESPACE | ||
DEFINE_FWK_EVENTSETUP_ALPAKA_MODULE(SiPixelGainCalibrationForHLTSoAESProducer); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.