CMS 3D CMS Logo

PixelCPEClusterRepairESProducer.cc
Go to the documentation of this file.
11 
16 
17 
18 
19 #include <string>
20 #include <memory>
21 
22 using namespace edm;
23 
25 {
26  std::string myname = p.getParameter<std::string>("ComponentName");
27 
28  //DoLorentz_ = p.getParameter<bool>("DoLorentz"); // True when LA from alignment is used
29  DoLorentz_ = p.existsAs<bool>("DoLorentz")?p.getParameter<bool>("DoLorentz"):false;
30 
31  pset_ = p;
32  setWhatProduced(this,myname);
33 
34  //std::cout<<" from ES Producer Templates "<<myname<<" "<<DoLorentz_<<std::endl; //dk
35 
36 }
37 
39 
41  // templates2
43  desc.add<bool>("DoLorentz", true);
44  desc.add<bool>("DoCosmics", false);
45  desc.add<bool>("LoadTemplatesFromDB", true);
46  desc.add<bool>("RunDamagedClusters", false);
47  desc.add<std::string>("ComponentName", "PixelCPEClusterRepair");
48  desc.add<double>("MinChargeRatio", 0.8);
49  desc.add<double>("MaxSizeMismatchInY", 0.3);
50  desc.add<bool>("Alpha2Order", true);
51  desc.add<std::vector<std::string>>("Recommend2D", {
52  "PXB 2",
53  "PXB 3",
54  "PXB 4",
55  });
56  desc.add<int>("ClusterProbComputationFlag", 0);
57  desc.add<int>("speed", -2);
58  desc.add<bool>("UseClusterSplitter", false);
59  descriptions.add("templates2", desc);
60 }
61 
62 std::unique_ptr<PixelClusterParameterEstimator>
64 
65  ESHandle<MagneticField> magfield;
66  iRecord.getRecord<IdealMagneticFieldRecord>().get(magfield );
67 
69  iRecord.getRecord<TrackerDigiGeometryRecord>().get( pDD );
70 
72  iRecord.getRecord<TrackerDigiGeometryRecord>().getRecord<TrackerTopologyRcd>().get(hTT);
73 
75  const SiPixelLorentzAngle * lorentzAngleProduct = nullptr;
76  if(DoLorentz_) { // LA correction from alignment
77  iRecord.getRecord<SiPixelLorentzAngleRcd>().get("fromAlignment",lorentzAngle);
78  lorentzAngleProduct = lorentzAngle.product();
79  } else { // Normal, deafult LA actually is NOT needed
80  //iRecord.getRecord<SiPixelLorentzAngleRcd>().get(lorentzAngle);
81  lorentzAngleProduct=nullptr; // null is ok becuse LA is not use by templates in this mode
82  }
83 
84  ESHandle<SiPixelTemplateDBObject> templateDBobject;
85  iRecord.getRecord<SiPixelTemplateDBObjectESProducerRcd>().get(templateDBobject);
86 
87  ESHandle<SiPixel2DTemplateDBObject> templateDBobject2D;
88  iRecord.getRecord<SiPixel2DTemplateDBObjectESProducerRcd>().get(templateDBobject2D);
89 
90  return
91  std::make_unique<PixelCPEClusterRepair>(pset_,
92  magfield.product(),
93  *pDD.product(),
94  *hTT.product(),
95  lorentzAngleProduct,
96  templateDBobject.product(),
97  templateDBobject2D.product() );
98 }
99 
100 
T getParameter(std::string const &) const
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:161
PixelCPEClusterRepairESProducer(const edm::ParameterSet &p)
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
ParameterDescriptionBase * add(U const &iLabel, T const &value)
std::unique_ptr< PixelClusterParameterEstimator > produce(const TkPixelCPERecord &)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
HLT enums.
T const * product() const
Definition: ESHandle.h:86