CMS 3D CMS Logo

PixelCPEFastParamsESProducerAlpaka.cc
Go to the documentation of this file.
1 #include <memory>
2 #include <string>
3 #include <alpaka/alpaka.hpp>
5 
14 
21 
25 
27  template <typename TrackerTraits>
29  public:
31  std::unique_ptr<PixelCPEFastParamsHost<TrackerTraits>> produce(const PixelCPEFastParamsRecord& iRecord);
32 
33  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
34 
35  private:
42 
45  };
46 
47  using namespace edm;
48 
49  template <typename TrackerTraits>
51  : ESProducer(p), pset_(p) {
52  auto const& myname = p.getParameter<std::string>("ComponentName");
53  auto const& magname = p.getParameter<edm::ESInputTag>("MagneticFieldRecord");
54  useErrorsFromTemplates_ = p.getParameter<bool>("UseErrorsFromTemplates");
55 
56  auto cc = setWhatProduced(this, myname);
57  magfieldToken_ = cc.consumes(magname);
58  pDDToken_ = cc.consumes();
59  hTTToken_ = cc.consumes();
60  lorentzAngleToken_ = cc.consumes(edm::ESInputTag(""));
61  lorentzAngleWidthToken_ = cc.consumes(edm::ESInputTag("", "forWidth"));
63  genErrorDBObjectToken_ = cc.consumes();
64  }
65  }
66 
67  template <typename TrackerTraits>
68  std::unique_ptr<PixelCPEFastParamsHost<TrackerTraits>> PixelCPEFastParamsESProducerAlpaka<TrackerTraits>::produce(
69  const PixelCPEFastParamsRecord& iRecord) {
70  // add the new la width object
71  const SiPixelLorentzAngle* lorentzAngleWidthProduct = &iRecord.get(lorentzAngleWidthToken_);
72 
73  const SiPixelGenErrorDBObject* genErrorDBObjectProduct = nullptr;
74 
75  // Errors take only from new GenError
76  if (useErrorsFromTemplates_) { // do only when generrors are needed
77  genErrorDBObjectProduct = &iRecord.get(genErrorDBObjectToken_);
78  //} else {
79  //std::cout<<" pass an empty GenError pointer"<<std::endl;
80  }
81  return std::make_unique<PixelCPEFastParamsHost<TrackerTraits>>(pset_,
82  &iRecord.get(magfieldToken_),
83  iRecord.get(pDDToken_),
84  iRecord.get(hTTToken_),
85  &iRecord.get(lorentzAngleToken_),
86  genErrorDBObjectProduct,
87  lorentzAngleWidthProduct);
88  }
89 
90  template <typename TrackerTraits>
92  edm::ConfigurationDescriptions& descriptions) {
94 
95  // from PixelCPEBase
97 
98  // from PixelCPEFast
100 
101  // used by PixelCPEFast
102  desc.add<double>("EdgeClusterErrorX", 50.0);
103  desc.add<double>("EdgeClusterErrorY", 85.0);
104  desc.add<bool>("UseErrorsFromTemplates", true);
105  desc.add<bool>("TruncatePixelCharge", true);
106 
107  std::string name = "PixelCPEFastParams";
108  name += TrackerTraits::nameModifier;
109  desc.add<std::string>("ComponentName", name);
110  desc.add<edm::ESInputTag>("MagneticFieldRecord", edm::ESInputTag());
111 
112  descriptions.addWithDefaultLabel(desc);
113  }
114 
117 } // namespace ALPAKA_ACCELERATOR_NAMESPACE
118 
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:166
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
PixelCPEFastParamsESProducerAlpaka< pixelTopology::Phase1 > PixelCPEFastParamsESProducerAlpakaPhase1
edm::ESGetToken< SiPixelLorentzAngle, SiPixelLorentzAngleRcd > lorentzAngleWidthToken_
uint32_t cc[maxCellsPerHit]
Definition: gpuFishbone.h:49
PixelCPEFastParamsESProducerAlpaka< pixelTopology::Phase2 > PixelCPEFastParamsESProducerAlpakaPhase2
static void fillPSetDescription(edm::ParameterSetDescription &desc)
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > pDDToken_
edm::ESGetToken< SiPixelGenErrorDBObject, SiPixelGenErrorDBObjectRcd > genErrorDBObjectToken_
edm::ESGetToken< SiPixelLorentzAngle, SiPixelLorentzAngleRcd > lorentzAngleToken_
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magfieldToken_
HLT enums.
#define DEFINE_FWK_EVENTSETUP_ALPAKA_MODULE(type)
Definition: ModuleFactory.h:17
static void fillPSetDescription(edm::ParameterSetDescription &desc)
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
std::unique_ptr< PixelCPEFastParamsHost< TrackerTraits > > produce(const PixelCPEFastParamsRecord &iRecord)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)