24 typedef std::vector<edm::ParameterSet>
Parameters;
26 for (Parameters::iterator itToPut =
toPut.begin(); itToPut !=
toPut.end(); ++itToPut) {
29 since_.push_back(itToPut->getUntrackedParameter<
unsigned int>(
"since"));
36 edm::LogError(
"StoreESCondition") <<
"PoolDBOutputService is unavailable" 41 bool toAppend =
false;
44 size_t messageSize = message.size() + 1;
45 char* messChar =
new char[messageSize];
46 strncpy(messChar, message.c_str(), messageSize);
68 edm::LogInfo(
"StoreESCondition") <<
" ESChannelStatus file read " 104 }
else if (
objectName_[
i] ==
"ESMissingEnergyCalibration") {
132 }
else if (
objectName_[
i] ==
"ESEEIntercalibConstants") {
167 strcpy(appendMode,
"append");
169 strcpy(appendMode,
"create");
194 timeinfo = localtime(&rawtime);
196 strcpy(
user, getlogin());
197 strcpy(
header, asctime(timeinfo));
204 ESThresholdsFile >> ts2;
205 ESThresholdsFile >> zs;
206 auto esThresholds = std::make_shared<ESThresholds>(ts2, zs);
213 float gammaLow0, alphaLow0, gammaHigh0, alphaHigh0, gammaLow1, alphaLow1, gammaHigh1, alphaHigh1, gammaLow2,
214 alphaLow2, gammaHigh2, alphaHigh2, gammaLow3, alphaLow3, gammaHigh3, alphaHigh3;
215 ESEEIntercalibFile >> gammaLow0;
216 ESEEIntercalibFile >> alphaLow0;
217 ESEEIntercalibFile >> gammaHigh0;
218 ESEEIntercalibFile >> alphaHigh0;
219 ESEEIntercalibFile >> gammaLow1;
220 ESEEIntercalibFile >> alphaLow1;
221 ESEEIntercalibFile >> gammaHigh1;
222 ESEEIntercalibFile >> alphaHigh1;
223 ESEEIntercalibFile >> gammaLow2;
224 ESEEIntercalibFile >> alphaLow2;
225 ESEEIntercalibFile >> gammaHigh2;
226 ESEEIntercalibFile >> alphaHigh2;
227 ESEEIntercalibFile >> gammaLow3;
228 ESEEIntercalibFile >> alphaLow3;
229 ESEEIntercalibFile >> gammaHigh3;
230 ESEEIntercalibFile >> alphaHigh3;
231 auto eseeIntercalibConstants = std::make_shared<ESEEIntercalibConstants>(gammaLow0,
248 return eseeIntercalibConstants;
253 float ConstAEta0, ConstBEta0, ConstAEta1, ConstBEta1, ConstAEta2, ConstBEta2, ConstAEta3, ConstBEta3;
254 ESMissingEnergyFile >> ConstAEta0;
255 ESMissingEnergyFile >> ConstBEta0;
256 ESMissingEnergyFile >> ConstAEta1;
257 ESMissingEnergyFile >> ConstBEta1;
258 ESMissingEnergyFile >> ConstAEta2;
259 ESMissingEnergyFile >> ConstBEta2;
260 ESMissingEnergyFile >> ConstAEta3;
261 ESMissingEnergyFile >> ConstBEta3;
262 auto esMissingEnergy = std::make_shared<ESMissingEnergyCalibration>(
263 ConstAEta0, ConstBEta0, ConstAEta1, ConstBEta1, ConstAEta2, ConstBEta2, ConstAEta3, ConstBEta3);
265 return esMissingEnergy;
269 auto esPedestals = std::make_shared<ESPedestals>();
281 int iz, ip, ix, iy, is, ped_,
zside;
284 for (
int i = 0;
i < 137216; ++
i) {
285 pedestalFile >> iz >> ip >> ix >> iy >> is >> ped_;
287 zside = (iz == -1) ? 1 : 0;
288 ped[
zside][ip - 1][ix - 1][iy - 1][is - 1] = ped_;
291 for (
int iz = -1; iz <= 1; ++iz) {
294 zside = (iz == -1) ? 1 : 0;
301 ESitem.
mean = ped[
zside][iplane - 1][ix - 1][iy - 1][istrip - 1];
305 ESDetId esId(istrip, ix, iy, iplane, iz);
306 esPedestals->insert(std::make_pair(esId.
rawId(), ESitem));
317 float r12Low, r23Low, r12High, r23High;
318 ESRecHitRatioCutsFile >> r12Low;
319 ESRecHitRatioCutsFile >> r23Low;
320 ESRecHitRatioCutsFile >> r12High;
321 ESRecHitRatioCutsFile >> r23High;
322 auto esRecHitRatioCuts = std::make_shared<ESRecHitRatioCuts>(r12Low, r23Low, r12High, r23High);
324 return esRecHitRatioCuts;
334 auto esGain = std::make_shared<ESGain>(
gain);
342 for (
int k = 0;
k < 3; ++
k) {
346 edm::LogInfo(
"StoreESCondition") <<
"weight : " <<
k <<
" " <<
w[
k] <<
"\n";
349 auto esWeights = std::make_shared<ESTimeSampleWeights>(
w[0],
w[1],
w[2]);
354 auto ical = std::make_shared<ESIntercalibConstants>();
358 for (
int i = 0;
i < 137216; ++
i) {
359 int iz, ip, ix, iy, is;
361 mipFile >> iz >> ip >> ix >> iy >> is >> mip;
368 if (mip < 20 || mip > 70)
369 edm::LogInfo(
"StoreESCondition") << iz <<
" " << ip <<
" " << ix <<
" " << iy <<
" " << is <<
" " << mip
373 ESDetId esId(is, ix, iy, ip, iz);
374 ical->setValue(esId.
rawId(), mip);
382 int z[1000],
p[1000],
x[1000],
y[1000], nsensors;
384 statusFile >> nsensors;
385 edm::LogInfo(
"StoreESCondition") <<
" nsensors " << nsensors <<
"\n";
386 if (nsensors >= 1000) {
387 edm::LogInfo(
"StoreESCondition") <<
" *** value too high, modify the method!***" 391 for (
int i = 0;
i < nsensors; ++
i) {
392 statusFile >>
z[
i] >>
p[
i] >>
x[
i] >>
y[
i];
394 auto ecalStatus = std::make_shared<ESChannelStatus>();
395 int Nbstatus = 0, Nbstrip = 0;
399 for (
int iplane = 1; iplane <= 2; iplane++) {
400 for (
int izeta = -1; izeta <= 1; izeta = izeta + 2) {
408 ESDetId anESId(istrip, ix, iy, iplane, izeta);
412 for (
int i = 0;
i < nsensors; ++
i) {
413 if (izeta ==
z[
i] && iplane ==
p[
i] && ix ==
x[
i] && iy ==
y[
i])
419 edm::LogInfo(
"StoreESCondition") <<
" Bad channel ix " << ix <<
" iy " << iy <<
" iplane " << iplane
420 <<
" iz " << izeta <<
"\n";
422 ecalStatus->setValue(anESId,
status);
431 edm::LogInfo(
"StoreESCondition") <<
" Nb of strips " << Nbstrip <<
" Number of bad channels " << Nbstatus <<
"\n";
std::shared_ptr< ESTimeSampleWeights > readESTimeSampleWeightsFromFile(const char *)
std::shared_ptr< ESGain > readESGainFromFile(const char *)
T getParameter(std::string const &) const
std::shared_ptr< ESThresholds > readESThresholdsFromFile(const char *)
cond::Time_t beginOfTime() const
std::vector< unsigned long long > since_
static const int ISTRIP_MAX
Log< level::Error, false > LogError
std::shared_ptr< ESMissingEnergyCalibration > readESMissingEnergyFromFile(const char *)
void createOneIOV(const T &payload, cond::Time_t firstSinceTime, const std::string &recordName)
static const int PLANE_MIN
void appendOneIOV(const T &payload, cond::Time_t sinceTime, const std::string &recordName)
std::vector< std::string > inpFileName_
unsigned long long Time_t
static const int PLANE_MAX
bool isNewTagRequest(const std::string &recordName)
std::shared_ptr< ESRecHitRatioCuts > readESRecHitRatioCutsFromFile(const char *)
std::shared_ptr< ESPedestals > readESPedestalsFromFile(const char *)
std::shared_ptr< ESIntercalibConstants > readESIntercalibConstantsFromFile(const char *)
void writeToLogFileResults(char *)
void writeToLogFile(std::string, std::string, unsigned long long)
std::shared_ptr< ESEEIntercalibConstants > readESEEIntercalibConstantsFromFile(const char *)
Log< level::Info, false > LogInfo
std::vector< std::string > objectName_
constexpr uint32_t rawId() const
get the raw id
~StoreESCondition() override
static bool validDetId(int istrip, int ixs, int iys, int iplane, int iz)
check if a valid index combination
std::vector< AlignmentParameters * > Parameters
std::shared_ptr< ESChannelStatus > readESChannelStatusFromFile(const char *)
void analyze(const edm::Event &evt, const edm::EventSetup &evtSetup) override
StoreESCondition(const edm::ParameterSet &iConfig)
static const int ISTRIP_MIN