38 ~UETableProducer()
override;
45 void endJob()
override;
50 bool jetCorrectorFormat_;
52 string calibrationFile_;
55 unsigned int index = 0,
np[5], ni0[2], ni1[2], ni2[2];
97 UETableProducer::~UETableProducer() {
112 void UETableProducer::endJob() {
114 std::ifstream textTable_(qpDataName.c_str());
116 std::vector<float> ue_vec;
117 std::unique_ptr<UETable> ue_predictor_pf;
119 if (!jetCorrectorFormat_) {
120 ue_predictor_pf = std::make_unique<UETable>();
123 unsigned int Nnp =
np[0] *
np[1] * (1 + (
np[2] - 1) *
np[3]) *
np[4];
124 unsigned int Nni0 = ni0[0] * ni0[1];
125 unsigned int Nni1 = ni1[0] * ni1[1];
126 unsigned int Nni2 = ni2[0] * ni2[1];
128 if (!jetCorrectorFormat_) {
129 ue_predictor_pf->np.resize(5);
130 ue_predictor_pf->ni0.resize(2);
131 ue_predictor_pf->ni1.resize(2);
132 ue_predictor_pf->ni2.resize(2);
135 std::copy(ni0, ni0 + 2, ue_predictor_pf->ni0.begin());
136 std::copy(ni1, ni1 + 2, ue_predictor_pf->ni1.begin());
137 std::copy(ni2, ni2 + 2, ue_predictor_pf->ni2.begin());
139 static const float edge_pseudorapidity[16] = {-5.191,
156 ue_predictor_pf->edgeEta.resize(16);
158 std::copy(edge_pseudorapidity, edge_pseudorapidity + 16, ue_predictor_pf->edgeEta.begin());
163 while (std::getline(textTable_,
line)) {
164 if (
line.empty() ||
line[0] ==
'#') {
168 std::istringstream linestream(
line);
170 int bin0, bin1, bin2, bin3, bin4;
172 linestream >> bin0 >> bin1 >> bin2 >> bin3 >> bin4 >>
val;
173 ue_vec.push_back(
val);
174 }
else if (
index < Nnp + Nni0) {
175 linestream >> bin0 >> bin1 >>
val;
176 ue_vec.push_back(
val);
177 }
else if (
index < Nnp + Nni0 + Nni1) {
178 linestream >> bin0 >> bin1 >>
val;
179 ue_vec.push_back(
val);
180 }
else if (
index < Nnp + Nni0 + Nni1 + Nni2) {
181 linestream >> bin0 >> bin1 >>
val;
182 ue_vec.push_back(
val);
189 if (
pool.isAvailable()) {
190 if (jetCorrectorFormat_) {
193 std::vector<JetCorrectorParameters::Record>
record(
196 ue_vec.size(), std::vector<float>(ue_vec.size(), 0), std::vector<float>(ue_vec.size(), 0), ue_vec));
199 std::unique_ptr<JetCorrectorParametersCollection> jme_payload =
200 std::make_unique<JetCorrectorParametersCollection>();
204 if (
pool->isNewTagRequest(
"JetCorrectionsRecord")) {
210 ue_predictor_pf->values = ue_vec;
212 if (
pool->isNewTagRequest(
"HeavyIonUERcd")) {
213 pool->createOneIOV<
UETable>(*ue_predictor_pf,
pool->beginOfTime(),
"HeavyIonUERcd");
215 pool->appendOneIOV<
UETable>(*ue_predictor_pf,
pool->currentTime(),
"HeavyIonUERcd");
224 desc.addUntracked<
bool>(
"debug",
false);
225 desc.addUntracked<
bool>(
"jetCorrectorFormat",
false);
226 descriptions.
add(
"produceUETable",
desc);
T getParameter(std::string const &) const
example_stream void analyze(const edm::Event &, const edm::EventSetup &) override
T getUntrackedParameter(std::string const &, T const &) const
#define DEFINE_FWK_MODULE(type)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void add(std::string const &label, ParameterSetDescription const &psetDescription)