36 : fp_(conf_.getParameter<
edm::FileInPath>(
"file")),
37 t_topo_fp_(conf_.getParameter<
edm::FileInPath>(
"topologyInput")),
38 myLabel_(conf_.getParameter<
std::
string>(
"appendToDataLabel")),
39 BPixParameters_(conf_.getParameter<
Parameters>(
"BPixParameters")),
40 FPixParameters_(conf_.getParameter<
Parameters>(
"FPixParameters")),
41 ModuleParameters_(conf_.getParameter<
Parameters>(
"ModuleParameters")),
42 bPixLorentzAnglePerTesla_((
float)conf_.getUntrackedParameter<double>(
"bPixLorentzAnglePerTesla", -9999.)),
43 fPixLorentzAnglePerTesla_((
float)conf_.getUntrackedParameter<double>(
"fPixLorentzAnglePerTesla", -9999.)) {
44 edm::LogInfo(
"SiPixelFakeLorentzAngleESSource::SiPixelFakeLorentzAngleESSource");
47 findingRecord<SiPixelLorentzAngleRcd>();
52 unsigned int nmodules = 0;
55 const std::vector<uint32_t>& DetIds =
reader.getAllDetIds();
60 for (
const auto& detit : DetIds) {
62 const DetId detid(detit);
63 auto rawId = detid.
rawId();
65 int side = tTopo.
side(detid);
80 LogDebug(
"SiPixelFakeLorentzAngleESSource") <<
" pixel barrel:" 82 <<
" rawId=" << rawId <<
" side " << side;
90 <<
"ERROR!: detid " << rawId <<
" already exists" << std::endl;
94 if (it.getParameter<
unsigned int>(
"rawid") == detid.
rawId()) {
95 float lorentzangle = (
float)it.getParameter<
double>(
"angle");
97 obj->putLorentzAngle(detid.
rawId(), lorentzangle);
99 <<
" LA= " << lorentzangle <<
" individual value " << detid.
rawId() << std::endl;
102 edm::LogError(
"SiPixelFakeLorentzAngleESSource") <<
"ERROR!: detid already exists" << std::endl;
108 if (it.exists(
"layer"))
109 if (it.getParameter<
int>(
"layer") !=
layer)
111 if (it.exists(
"ladder"))
112 if (it.getParameter<
int>(
"ladder") !=
ladder)
114 if (it.exists(
"module"))
115 if (it.getParameter<
int>(
"module") !=
module)
117 if (it.exists(
"side"))
118 if (it.getParameter<
int>(
"side") != side)
121 float lorentzangle = (
float)it.getParameter<
double>(
"angle");
122 obj->putLorentzAngle(detid.
rawId(), lorentzangle);
123 edm::LogInfo(
"SiPixelFakeLorentzAngleESSource") <<
" LA= " << lorentzangle << std::endl;
125 }
else if (
found == 1) {
127 <<
"detid already given in ModuleParameters, skipping ..." << std::endl;
130 <<
" ERROR!: detid " << rawId <<
" already exists" << std::endl;
148 LogDebug(
"SiPixelFakeLorentzAngleESSource") <<
" pixel endcap:" 149 <<
" side=" << side <<
" disk=" << disk <<
" blade =" << blade
150 <<
" pannel=" << panel <<
" ring=" <<
ring <<
" rawId=" << rawId;
157 edm::LogError(
"SiPixelFakeLorentzAngleESSource") <<
" ERROR! detid already exists" << std::endl;
161 if (it.getParameter<
unsigned int>(
"rawid") == detid.
rawId()) {
162 float lorentzangle = (
float)it.getParameter<
double>(
"angle");
164 obj->putLorentzAngle(detid.
rawId(), lorentzangle);
166 <<
" LA= " << lorentzangle <<
" individual value " << detid.
rawId() << std::endl;
170 <<
"ERROR!: detid " << rawId <<
" already exists" << std::endl;
176 if (it.exists(
"side"))
177 if (it.getParameter<
int>(
"side") != side)
179 if (it.exists(
"disk"))
180 if (it.getParameter<
int>(
"disk") != disk)
182 if (it.exists(
"ring"))
183 if (it.getParameter<
int>(
"ring") !=
ring)
185 if (it.exists(
"blade"))
186 if (it.getParameter<
int>(
"blade") != blade)
188 if (it.exists(
"panel"))
189 if (it.getParameter<
int>(
"panel") != panel)
191 if (it.exists(
"HVgroup"))
192 if (it.getParameter<
int>(
"HVgroup") !=
HVgroup(panel,
ring))
195 float lorentzangle = (
float)it.getParameter<
double>(
"angle");
196 obj->putLorentzAngle(detid.
rawId(), lorentzangle);
197 edm::LogInfo(
"SiPixelFakeLorentzAngleESSource") <<
" LA= " << lorentzangle << std::endl;
199 }
else if (
found == 1) {
201 <<
" detid " << rawId <<
" already given in ModuleParameters, skipping ..." << std::endl;
204 <<
"ERROR!: detid" << rawId <<
"already exists" << std::endl;
210 edm::LogInfo(
"SiPixelFakeLorentzAngleESSource") <<
"Modules = " << nmodules << std::endl;
212 return std::unique_ptr<SiPixelLorentzAngle>(
obj);
225 }
else if (1 == panel && (3 ==
module || 4 ==
module)) {
227 }
else if (2 == panel && 1 ==
module) {
229 }
else if (2 == panel && (2 ==
module || 3 ==
module)) {
233 <<
" ERROR! in SiPixelFakeLorentzAngleESSource::HVgroup(...), panel = " << panel <<
", module = " <<
module 241 desc.setComment(
"ESSource to supply per-module SiPixelLorentzAngle payloads in the EventSetup");
244 "file",
edm::FileInPath(
"SLHCUpgradeSimulations/Geometry/data/PhaseI/PixelSkimmedGeometry_phase1.txt"))
245 ->setComment(
"Tracker skimmed geometry");
247 edm::FileInPath(
"Geometry/TrackerCommonData/data/PhaseI/trackerParameters.xml"))
248 ->setComment(
"Tracker Topology");
250 desc.add<
std::string>(
"appendToDataLabel",
"")->setComment(
"label to which write the data");
251 desc.addUntracked<
double>(
"bPixLorentzAnglePerTesla", -9999.)->setComment(
"LA value for all BPix");
252 desc.addUntracked<
double>(
"fPixLorentzAnglePerTesla", -9999.)->setComment(
"LA value for all FPix");
259 desc_BPixParameters.
add<
double>(
"angle");
260 std::vector<edm::ParameterSet> default_BPixParametersToAdd;
261 desc.addVPSet(
"BPixParameters", desc_BPixParameters, default_BPixParametersToAdd)
262 ->setComment(
"LA values for given BPix regions");
271 desc_FPixParameters.
add<
double>(
"angle");
272 std::vector<edm::ParameterSet> default_FPixParametersToAdd;
273 desc.addVPSet(
"FPixParameters", desc_FPixParameters, default_FPixParametersToAdd)
274 ->setComment(
"LA values for given FPix regions");
277 desc_ModuleParameters.
add<
unsigned int>(
"rawid");
278 desc_ModuleParameters.
add<
double>(
"angle");
279 std::vector<edm::ParameterSet> default_ModuleParametersToAdd;
280 desc.addVPSet(
"ModuleParameters", desc_ModuleParameters, default_ModuleParametersToAdd)
281 ->setComment(
"LA values for given modules");
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
unsigned int pxbLayer(const DetId &id) const
ParameterDescriptionBase * addOptional(U const &iLabel, T const &value)
int ringName() const
ring Id
Parameters FPixParameters_
std::string fullPath() const
int bladeName() const
blade id
static const IOVSyncValue & endOfTime()
const edm::FileInPath fp_
unsigned int pxbLadder(const DetId &id) const
Log< level::Error, false > LogError
unsigned int side(const DetId &id) const
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
std::vector< edm::ParameterSet > Parameters
float bPixLorentzAnglePerTesla_
static const IOVSyncValue & beginOfTime()
int diskName() const
disk id
int HVgroup(int panel, int module)
virtual std::unique_ptr< SiPixelLorentzAngle > produce(const SiPixelLorentzAngleRcd &)
SiPixelFakeLorentzAngleESSource(const edm::ParameterSet &)
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
const edm::FileInPath t_topo_fp_
ParameterDescriptionBase * add(U const &iLabel, T const &value)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Log< level::Info, false > LogInfo
float fPixLorentzAnglePerTesla_
constexpr uint32_t rawId() const
get the raw id
void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &) override
TrackerTopology fromTrackerParametersXMLFile(const std::string &xmlFileName)
unsigned int pxbModule(const DetId &id) const
Log< level::Warning, false > LogWarning
Parameters ModuleParameters_
Parameters BPixParameters_
int pannelName() const
pannel id