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>();
51 using namespace edm::es;
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);
69 int layer = tTopo.pxbLayer(detid);
71 int ladder = tTopo.pxbLadder(detid);
73 int module = tTopo.pxbModule(detid);
80 LogDebug(
"SiPixelFakeLorentzAngleESSource") <<
" pixel barrel:"
81 <<
" layer=" << layer <<
" ladder=" << ladder <<
" module=" << module
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);
223 if (1 == panel && (1 == module || 2 == module)) {
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");
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)
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
void setComment(std::string const &value)
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
ParameterDescriptionBase * addOptional(U const &iLabel, T const &value)
ParameterDescriptionBase * addVPSet(U const &iLabel, ParameterSetDescription const &validator, std::vector< ParameterSet > const &defaults)
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
Parameters FPixParameters_
static const IOVSyncValue & endOfTime()
constexpr uint32_t rawId() const
get the raw id
const edm::FileInPath fp_
Log< level::Error, false > LogError
constexpr std::array< uint8_t, layerIndexSize > layer
std::vector< edm::ParameterSet > Parameters
int bladeName() const
blade id
void setComment(std::string const &value)
float bPixLorentzAnglePerTesla_
static const IOVSyncValue & beginOfTime()
int HVgroup(int panel, int module)
virtual std::unique_ptr< SiPixelLorentzAngle > produce(const SiPixelLorentzAngleRcd &)
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
SiPixelFakeLorentzAngleESSource(const edm::ParameterSet &)
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_
void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &) override
int pannelName() const
pannel id
TrackerTopology fromTrackerParametersXMLFile(const std::string &xmlFileName)
std::string fullPath() const
int diskName() const
disk id
Log< level::Warning, false > LogWarning
int ringName() const
ring Id
Parameters ModuleParameters_
Parameters BPixParameters_