CMS 3D CMS Logo

PPSPixelTopologyESSource.cc
Go to the documentation of this file.
1 /****************************************************************************
2  *
3  * CondFormats/PPSObjects/plugins/PPSPixelTopologyESSource.cc
4  *
5  * Description : - Loads PPSPixelTopology from the PPSPixelTopologyESSource_cfi.py
6  * config file.
7  *
8  *
9  * Author: F.Ferro ferro@ge.infn.it
10  *
11  *
12  ****************************************************************************/
13 
17 
24 
28 
29 #include <memory>
30 
36 public:
38  ~PPSPixelTopologyESSource() override = default;
39 
40  std::unique_ptr<PPSPixelTopology> produce(const PPSPixelTopologyRcd&);
42 
43 private:
47  std::unique_ptr<PPSPixelTopology> fillPPSPixelTopology();
48 
49  // Topology parameters
51  double pitch_simY_;
52  double pitch_simX_;
53  double thickness_;
54  unsigned short no_of_pixels_simX_;
55  unsigned short no_of_pixels_simY_;
56  unsigned short no_of_pixels_;
57  double simX_width_;
58  double simY_width_;
62 
63 protected:
66  const edm::IOVSyncValue&,
67  edm::ValidityInterval&) override;
68 };
69 
70 //----------------------------------------------------------------------------------------------------
71 
73  : runType_(""),
74  pitch_simY_(0.),
75  pitch_simX_(0.),
76  thickness_(0.),
77  no_of_pixels_simX_(0.),
78  no_of_pixels_simY_(0.),
79  no_of_pixels_(0.),
80  simX_width_(0.),
81  simY_width_(0.),
82  dead_edge_width_(0.),
83  active_edge_sigma_(0.),
84  phys_active_edge_dist_(0.) {
85  setPPSPixelTopology(iConfig);
86 
87  // validate input
88  if (runType_ != "Run2" && runType_ != "Run3")
89  throw cms::Exception("PPS") << runType_ << " is not valid runType.";
90 
91  setWhatProduced(this);
92  findingRecord<PPSPixelTopologyRcd>();
93 }
94 
95 //----------------------------------------------------------------------------------------------------
96 
97 std::unique_ptr<PPSPixelTopology> PPSPixelTopologyESSource::produce(const PPSPixelTopologyRcd&) {
98  auto topo = fillPPSPixelTopology();
99 
100  edm::LogInfo("PPS") << "PixelTopologyESSource::produce \n" << *topo;
101 
102  return topo;
103 }
104 
105 //----------------------------------------------------------------------------------------------------
106 
108  runType_ = iConfig.getParameter<std::string>("RunType");
109  pitch_simY_ = iConfig.getParameter<double>("PitchSimY");
110  pitch_simX_ = iConfig.getParameter<double>("PitchSimX");
111  thickness_ = iConfig.getParameter<double>("thickness");
112  no_of_pixels_simX_ = iConfig.getParameter<int>("noOfPixelSimX");
113  no_of_pixels_simY_ = iConfig.getParameter<int>("noOfPixelSimY");
114  no_of_pixels_ = iConfig.getParameter<int>("noOfPixels");
115  simX_width_ = iConfig.getParameter<double>("simXWidth");
116  simY_width_ = iConfig.getParameter<double>("simYWidth");
117  dead_edge_width_ = iConfig.getParameter<double>("deadEdgeWidth");
118  active_edge_sigma_ = iConfig.getParameter<double>("activeEdgeSigma");
119  phys_active_edge_dist_ = iConfig.getParameter<double>("physActiveEdgeDist");
120 }
121 
122 //----------------------------------------------------------------------------------------------------
123 
124 std::unique_ptr<PPSPixelTopology> PPSPixelTopologyESSource::fillPPSPixelTopology() {
125  auto p = std::make_unique<PPSPixelTopology>();
126 
127  p->setRunType(runType_);
128  p->setPitchSimY(pitch_simY_);
129  p->setPitchSimX(pitch_simX_);
130  p->setThickness(thickness_);
131  p->setNoPixelsSimX(no_of_pixels_simX_);
132  p->setNoPixelsSimY(no_of_pixels_simY_);
133  p->setNoPixels(no_of_pixels_);
134  p->setSimXWidth(simX_width_);
135  p->setSimYWidth(simY_width_);
136  p->setDeadEdgeWidth(dead_edge_width_);
137  p->setActiveEdgeSigma(active_edge_sigma_);
138  p->setPhysActiveEdgeDist(phys_active_edge_dist_);
139  p->setActiveEdgeX(simX_width_ / 2. - phys_active_edge_dist_);
140  p->setActiveEdgeY(simY_width_ / 2. - phys_active_edge_dist_);
141 
142  return p;
143 }
144 
145 //----------------------------------------------------------------------------------------------------
146 
148  const edm::IOVSyncValue& iosv,
149  edm::ValidityInterval& oValidity) {
150  edm::LogInfo("PPS") << ">> PPSPixelTopologyESSource::setIntervalFor(" << key.name() << ")\n"
151  << " run=" << iosv.eventID().run() << ", event=" << iosv.eventID().event();
152 
154  oValidity = infinity;
155 }
156 
157 //----------------------------------------------------------------------------------------------------
158 
161  desc.add<std::string>("RunType", "Run3");
162  desc.add<double>("PitchSimY", 150e-3);
163  desc.add<double>("PitchSimX", 100e-3);
164  desc.add<double>("thickness", 0.23);
165  desc.add<int>("noOfPixelSimX", 160);
166  desc.add<int>("noOfPixelSimY", 104);
167  desc.add<int>("noOfPixels", 160 * 104);
168  desc.add<double>("simXWidth", 16.6);
169  desc.add<double>("simYWidth", 16.2);
170  desc.add<double>("deadEdgeWidth", 200e-3);
171  desc.add<double>("activeEdgeSigma", 0.02);
172  desc.add<double>("physActiveEdgeDist", 0.150);
173 
174  descriptions.add("ppsPixelTopologyESSource", desc);
175 }
176 
177 //----------------------------------------------------------------------------------------------------
178 
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:163
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
~PPSPixelTopologyESSource() override=default
std::unique_ptr< PPSPixelTopology > produce(const PPSPixelTopologyRcd &)
static const IOVSyncValue & endOfTime()
Definition: IOVSyncValue.cc:82
static void fillDescriptions(edm::ConfigurationDescriptions &)
static const IOVSyncValue & beginOfTime()
Definition: IOVSyncValue.cc:88
const double infinity
std::unique_ptr< PPSPixelTopology > fillPPSPixelTopology()
Fill PPSPixelTopology object.
void setPPSPixelTopology(const edm::ParameterSet &)
Set PPS Topology parameters to their values from config.
Log< level::Info, false > LogInfo
RunNumber_t run() const
Definition: EventID.h:38
#define DEFINE_FWK_EVENTSETUP_SOURCE(type)
Definition: SourceFactory.h:91
PPSPixelTopologyESSource(const edm::ParameterSet &)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
const EventID & eventID() const
Definition: IOVSyncValue.h:40
void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &) override
sets infinite validity of this data
Loads PPSPixelTopology from a config file.
EventNumber_t event() const
Definition: EventID.h:40