46 virtual void endJob()
override;
51 bool jetCorrectorFormat_;
53 string calibrationFile_;
56 unsigned int index = 0,
106 UETableProducer::~UETableProducer()
126 UETableProducer::endJob() {
128 std::ifstream textTable_(qpDataName.c_str());
130 std::vector<float> ue_vec;
131 std::unique_ptr<UETable> ue_predictor_pf;
133 if (!jetCorrectorFormat_) {
134 ue_predictor_pf = std::make_unique<UETable>();
137 unsigned int Nnp =
np[0] *
np[1] * (1 + (
np[2] - 1) *
np[3]) *
np[4];
138 unsigned int Nni0 = ni0[0]*ni0[1];
139 unsigned int Nni1 = ni1[0]*ni1[1];
140 unsigned int Nni2 = ni2[0]*ni2[1];
142 if (!jetCorrectorFormat_) {
143 ue_predictor_pf->np.resize(5);
144 ue_predictor_pf->ni0.resize(2);
145 ue_predictor_pf->ni1.resize(2);
146 ue_predictor_pf->ni2.resize(2);
148 std::copy(np, np + 5, ue_predictor_pf->np.begin());
149 std::copy(ni0, ni0 + 2, ue_predictor_pf->ni0.begin());
150 std::copy(ni1, ni1 + 2, ue_predictor_pf->ni1.begin());
151 std::copy(ni2, ni2 + 2, ue_predictor_pf->ni2.begin());
153 static const float edge_pseudorapidity[16] = {
154 -5.191, -2.650, -2.043, -1.740, -1.479, -1.131, -0.783, -0.522, 0.522, 0.783, 1.131, 1.479, 1.740, 2.043, 2.650, 5.191
157 ue_predictor_pf->edgeEta.resize(16);
159 std::copy(edge_pseudorapidity, edge_pseudorapidity + 16, ue_predictor_pf->edgeEta.begin());
165 while( std::getline( textTable_, line)){
166 if(!line.size() || line[0]==
'#') {
170 std::istringstream linestream(line);
172 int bin0, bin1, bin2, bin3, bin4;
174 linestream>>bin0>>bin1>>bin2>>bin3>>bin4>>val;
175 ue_vec.push_back(val);
176 }
else if(
index < Nnp + Nni0){
177 linestream>>bin0>>bin1>>val;
178 ue_vec.push_back(val);
179 }
else if(
index < Nnp + Nni0 + Nni1){
180 linestream>>bin0>>bin1>>val;
181 ue_vec.push_back(val);
182 }
else if(
index < Nnp + Nni0 + Nni1 + Nni2){
183 linestream>>bin0>>bin1>>val;
184 ue_vec.push_back(val);
194 if (jetCorrectorFormat_) {
197 std::vector<JetCorrectorParameters::Record>
record(1,
JetCorrectorParameters::Record(ue_vec.size(), std::vector<float>(ue_vec.size(), 0), std::vector<float>(ue_vec.size(), 0), ue_vec));
200 std::unique_ptr<JetCorrectorParametersCollection> jme_payload = std::make_unique<JetCorrectorParametersCollection>();
211 ue_predictor_pf->values = ue_vec;
227 descriptions.
add(
"produceUETable", desc);
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
#define DEFINE_FWK_MODULE(type)
void appendSinceTime(T *payloadObj, cond::Time_t sinceTime, const std::string &recordName, bool withlogging=false)
bool isNewTagRequest(const std::string &recordName)
cond::Time_t beginOfTime() const
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void createNewIOV(T *firstPayloadObj, cond::Time_t firstSinceTime, cond::Time_t firstTillTime, const std::string &recordName, bool withlogging=false)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
cond::Time_t endOfTime() const
cond::Time_t currentTime() const