26 typedef std::vector< edm::ParameterSet >
Parameters;
28 for (Parameters::iterator itToPut = toPut.begin(); itToPut != toPut.end(); ++itToPut) {
31 since_.push_back(itToPut->getUntrackedParameter<
unsigned int>(
"since"));
40 edm::LogError(
"StoreESCondition")<<
"PoolDBOutputService is unavailable"<<
"\n";
44 bool toAppend =
false;
47 size_t messageSize = message.size() + 1;
48 char * messChar =
new char [messageSize];
49 strncpy(messChar, message.c_str(), messageSize);
67 <<
" from file and writing to DB with newTime " << newTime <<
"\n";
71 edm::LogInfo(
"StoreESCondition") <<
" ESChannelStatus file read " <<
"\n";
73 edm::LogInfo(
"StoreESCondition") <<
" before create " <<
"\n";
75 edm::LogInfo(
"StoreESCondition") <<
" after create " <<
"\n";
77 edm::LogInfo(
"StoreESCondition") <<
" before append " <<
"\n";
79 edm::LogInfo(
"StoreESCondition") <<
" after append " <<
"\n";
102 }
else if (
objectName_[
i] ==
"ESMissingEnergyCalibration") {
130 }
else if (
objectName_[
i] ==
"ESEEIntercalibConstants") {
144 edm::LogInfo(
"StoreESCondition") <<
"Finished endJob" <<
"\n";
160 outFile = fopen(
logfile_.c_str(),
"a");
169 strcpy(appendMode,
"append");
171 strcpy(appendMode,
"create");
183 outFile = fopen(
logfile_.c_str(),
"a");
190 fprintf(outFile,
"%s %s\n", header,arg);
196 struct tm * timeinfo;
198 timeinfo = localtime ( &rawtime );
200 strcpy(user,getlogin());
201 strcpy(header,asctime(timeinfo));
209 ESThresholdsFile >> ts2;
210 ESThresholdsFile >> zs;
219 float gammaLow0, alphaLow0, gammaHigh0, alphaHigh0, gammaLow1, alphaLow1, gammaHigh1, alphaHigh1,
220 gammaLow2, alphaLow2, gammaHigh2, alphaHigh2, gammaLow3, alphaLow3, gammaHigh3, alphaHigh3;
226 ESEEIntercalibFile >> gammaLow0;
227 ESEEIntercalibFile >> alphaLow0;
228 ESEEIntercalibFile >> gammaHigh0;
229 ESEEIntercalibFile >> alphaHigh0;
230 ESEEIntercalibFile >> gammaLow1;
231 ESEEIntercalibFile >> alphaLow1;
232 ESEEIntercalibFile >> gammaHigh1;
233 ESEEIntercalibFile >> alphaHigh1;
234 ESEEIntercalibFile >> gammaLow2;
235 ESEEIntercalibFile >> alphaLow2;
236 ESEEIntercalibFile >> gammaHigh2;
237 ESEEIntercalibFile >> alphaHigh2;
238 ESEEIntercalibFile >> gammaLow3;
239 ESEEIntercalibFile >> alphaLow3;
240 ESEEIntercalibFile >> gammaHigh3;
241 ESEEIntercalibFile >> alphaHigh3;
243 gammaLow1, alphaLow1, gammaHigh1, alphaHigh1,
244 gammaLow2, alphaLow2, gammaHigh2, alphaHigh2,
245 gammaLow3, alphaLow3, gammaHigh3, alphaHigh3);
247 return eseeIntercalibConstants;
254 float ConstAEta0, ConstBEta0, ConstAEta1, ConstBEta1, ConstAEta2, ConstBEta2, ConstAEta3, ConstBEta3;
255 ESMissingEnergyFile >> ConstAEta0;
256 ESMissingEnergyFile >> ConstBEta0;
257 ESMissingEnergyFile >> ConstAEta1;
258 ESMissingEnergyFile >> ConstBEta1;
259 ESMissingEnergyFile >> ConstAEta2;
260 ESMissingEnergyFile >> ConstBEta2;
261 ESMissingEnergyFile >> ConstAEta3;
262 ESMissingEnergyFile >> ConstBEta3;
264 ConstAEta2, ConstBEta2, ConstAEta3, ConstBEta3);
266 return esMissingEnergy;
283 int iz, ip, ix, iy, is, ped_,
zside;
286 for (
int i=0;
i<137216; ++
i) {
287 pedestalFile >> iz >> ip >> ix >> iy >> is >> ped_;
289 zside = (iz==-1) ? 1 : 0;
290 ped[
zside][ip-1][ix-1][iy-1][is-1] = ped_;
293 for (
int iz=-1; iz<=1; ++iz) {
296 zside = (iz==-1) ? 1 : 0;
304 ESitem.
mean = ped[
zside][iplane-1][ix-1][iy-1][istrip-1];
308 ESDetId esId(istrip, ix, iy, iplane, iz);
309 esPedestals->
insert(std::make_pair(esId.
rawId(), ESitem));
321 float r12Low, r23Low, r12High, r23High;
322 ESRecHitRatioCutsFile >> r12Low;
323 ESRecHitRatioCutsFile >> r23Low;
324 ESRecHitRatioCutsFile >> r12High;
325 ESRecHitRatioCutsFile >> r23High;
338 return esRecHitRatioCuts;
347 edm::LogInfo(
"StoreESCondition") <<
"gain : "<< gain <<
"\n";
358 for (
int k = 0;
k < 3; ++
k) {
362 edm::LogInfo(
"StoreESCondition") <<
"weight : "<<
k<<
" "<<w[
k]<<
"\n";
376 for (
int i=0;
i<137216; ++
i) {
377 int iz, ip, ix, iy, is;
379 mipFile >> iz >> ip >> ix >> iy >> is >> mip;
384 if (
esgain_ == 1) mip = mip/6.;
385 if (mip <20 || mip> 70)
edm::LogInfo(
"StoreESCondition") <<iz<<
" "<<ip<<
" "<<ix<<
" "<<iy<<
" "<<is<<
" "<<mip<<
"\n";
388 ESDetId esId(is, ix, iy, ip, iz);
399 int z[1000],
p[1000],
x[1000],
y[1000], nsensors;
401 statusFile >> nsensors;
402 edm::LogInfo(
"StoreESCondition") <<
" nsensors " << nsensors <<
"\n";
403 if(nsensors >= 1000) {
404 edm::LogInfo(
"StoreESCondition") <<
" *** value too high, modify the method!***" <<
"\n";
407 for (
int i = 0;
i < nsensors; ++
i) {
408 statusFile >> z[
i] >> p[
i] >> x[
i] >> y[
i];
411 int Nbstatus = 0, Nbstrip = 0;
415 for (
int iplane = 1; iplane <= 2; iplane++) {
416 for (
int izeta = -1; izeta <= 1; izeta = izeta + 2) {
424 ESDetId anESId(istrip,ix,iy,iplane,izeta);
428 for (
int i=0;
i<nsensors; ++
i) {
429 if (izeta == z[
i] && iplane == p[
i] && ix == x[
i] && iy == y[
i]) status = 1;
433 if(istrip == 1)
edm::LogInfo(
"StoreESCondition") <<
" Bad channel ix " << ix <<
" iy " << iy <<
" iplane " << iplane <<
" iz " << izeta <<
"\n";
435 ecalStatus->
setValue(anESId, status);
444 edm::LogInfo(
"StoreESCondition") <<
" Nb of strips " << Nbstrip <<
" Number of bad channels " << Nbstatus <<
"\n";
T getParameter(std::string const &) const
ESPedestals * readESPedestalsFromFile(const char *)
std::vector< unsigned long long > since_
static const int ISTRIP_MAX
ESGain * readESGainFromFile(const char *)
std::vector< std::string > inpFileName_
ESPedestalsMap ESPedestals
static const int PLANE_MIN
ESChannelStatusMap ESChannelStatus
uint32_t rawId() const
get the raw id
void appendSinceTime(T *payloadObj, cond::Time_t sinceTime, const std::string &recordName, bool withlogging=false)
unsigned long long Time_t
vector< ParameterSet > Parameters
static const int PLANE_MAX
bool isNewTagRequest(const std::string &recordName)
void insert(std::pair< uint32_t, Item > const &a)
void setValue(const uint32_t id, const Item &item)
cond::Time_t beginOfTime() const
ESTimeSampleWeights * readESTimeSampleWeightsFromFile(const char *)
ESRecHitRatioCuts * readESRecHitRatioCutsFromFile(const char *)
void writeToLogFileResults(char *)
void createNewIOV(T *firstPayloadObj, cond::Time_t firstSinceTime, cond::Time_t firstTillTime, const std::string &recordName, bool withlogging=false)
void writeToLogFile(std::string, std::string, unsigned long long)
ESEEIntercalibConstants * readESEEIntercalibConstantsFromFile(const char *)
ESIntercalibConstantMap ESIntercalibConstants
static bool validDetId(int istrip, int ixs, int iys, int iplane, int iz)
check if a valid index combination
cond::Time_t endOfTime() const
ESMissingEnergyCalibration * readESMissingEnergyFromFile(const char *)
std::vector< std::string > objectName_
ESThresholds * readESThresholdsFromFile(const char *)
ESIntercalibConstants * readESIntercalibConstantsFromFile(const char *)
virtual void analyze(const edm::Event &evt, const edm::EventSetup &evtSetup)
ESChannelStatus * readESChannelStatusFromFile(const char *)
StoreESCondition(const edm::ParameterSet &iConfig)
static const int ISTRIP_MIN