CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
StoreESCondition Class Reference

#include <StoreESCondition.h>

Inheritance diagram for StoreESCondition:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &evt, const edm::EventSetup &evtSetup) override
 
void endJob () override
 
ESChannelStatusreadESChannelStatusFromFile (const char *)
 
ESEEIntercalibConstantsreadESEEIntercalibConstantsFromFile (const char *)
 
ESGainreadESGainFromFile (const char *)
 
ESIntercalibConstantsreadESIntercalibConstantsFromFile (const char *)
 
ESMissingEnergyCalibrationreadESMissingEnergyFromFile (const char *)
 
ESPedestalsreadESPedestalsFromFile (const char *)
 
ESRecHitRatioCutsreadESRecHitRatioCutsFromFile (const char *)
 
ESThresholdsreadESThresholdsFromFile (const char *)
 
ESTimeSampleWeightsreadESTimeSampleWeightsFromFile (const char *)
 
 StoreESCondition (const edm::ParameterSet &iConfig)
 
void writeToLogFile (std::string, std::string, unsigned long long)
 
void writeToLogFileResults (char *)
 
 ~StoreESCondition () override
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void fillHeader (char *)
 
std::string to_string (char value[])
 

Private Attributes

unsigned int esgain_
 
std::vector< std::string > inpFileName_
 
std::vector< std::string > inpFileNameEE_
 
std::string logfile_
 
std::vector< std::string > objectName_
 
std::string prog_name_
 
std::vector< unsigned long long > since_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 31 of file StoreESCondition.h.

Constructor & Destructor Documentation

◆ StoreESCondition()

StoreESCondition::StoreESCondition ( const edm::ParameterSet iConfig)
explicit

Definition at line 18 of file StoreESCondition.cc.

18  {
19  prog_name_ = "StoreESCondition";
20 
21  logfile_ = iConfig.getParameter<std::string>("logfile");
22 
23  esgain_ = iConfig.getParameter<unsigned int>("gain");
24 
25  typedef std::vector<edm::ParameterSet> Parameters;
26  Parameters toPut = iConfig.getParameter<Parameters>("toPut");
27  for (Parameters::iterator itToPut = toPut.begin(); itToPut != toPut.end(); ++itToPut) {
28  inpFileName_.push_back(itToPut->getUntrackedParameter<std::string>("inputFile"));
29  objectName_.push_back(itToPut->getUntrackedParameter<std::string>("conditionType"));
30  since_.push_back(itToPut->getUntrackedParameter<unsigned int>("since"));
31  }
32 }

References esgain_, edm::ParameterSet::getParameter(), inpFileName_, logfile_, objectName_, prog_name_, since_, AlCaHLTBitMon_QueryRunRegistry::string, and convertXMLtoSQLite_cfg::toPut.

◆ ~StoreESCondition()

StoreESCondition::~StoreESCondition ( )
override

Definition at line 161 of file StoreESCondition.cc.

161 {}

Member Function Documentation

◆ analyze()

void StoreESCondition::analyze ( const edm::Event evt,
const edm::EventSetup evtSetup 
)
overridevirtual

Implements edm::EDAnalyzer.

Definition at line 163 of file StoreESCondition.cc.

163 {}

◆ endJob()

void StoreESCondition::endJob ( void  )
overridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 34 of file StoreESCondition.cc.

34  {
36  if (!mydbservice.isAvailable()) {
37  edm::LogError("StoreESCondition") << "PoolDBOutputService is unavailable"
38  << "\n";
39  return;
40  }
41 
42  bool toAppend = false;
43  // copy a string to the char *
44  std::string message = "finished OK\n";
45  size_t messageSize = message.size() + 1;
46  char* messChar = new char[messageSize];
47  strncpy(messChar, message.c_str(), messageSize);
48 
49  for (unsigned int i = 0; i < objectName_.size(); i++) {
50  cond::Time_t newTime;
51 
52  if (mydbservice->isNewTagRequest(objectName_[i] + std::string("Rcd"))) {
53  // This is the first object for this tag.
54  // Append mode should be off.
55  // newTime is the end of this new objects IOV.
56  newTime = mydbservice->beginOfTime();
57  } else {
58  // There should already be an object in the DB for this tag.
59  // Append IOV mode should be on.
60  // newTime is the beginning of this new objects IOV.
61  toAppend = true;
62  newTime = (cond::Time_t)since_[i];
63  }
64  edm::LogInfo("StoreESCondition") << "Reading " << objectName_[i] << " from file and writing to DB with newTime "
65  << newTime << "\n";
66  if (objectName_[i] == "ESChannelStatus") {
67  edm::LogInfo("StoreESCondition") << " ESChannelStatus file " << inpFileName_[i] << "\n";
69  edm::LogInfo("StoreESCondition") << " ESChannelStatus file read "
70  << "\n";
71  if (!toAppend) {
72  edm::LogInfo("StoreESCondition") << " before create "
73  << "\n";
74  mydbservice->createNewIOV<ESChannelStatus>(mycali, newTime, mydbservice->endOfTime(), "ESChannelStatusRcd");
75  edm::LogInfo("StoreESCondition") << " after create "
76  << "\n";
77  } else {
78  edm::LogInfo("StoreESCondition") << " before append "
79  << "\n";
80  mydbservice->appendSinceTime<ESChannelStatus>(mycali, newTime, "ESChannelStatusRcd");
81  edm::LogInfo("StoreESCondition") << " after append "
82  << "\n";
83  }
84  } else if (objectName_[i] == "ESIntercalibConstants") {
86  if (!toAppend) {
87  mydbservice->createNewIOV<ESIntercalibConstants>(
88  myintercalib, newTime, mydbservice->endOfTime(), "ESIntercalibConstantsRcd");
89  } else {
90  mydbservice->appendSinceTime<ESIntercalibConstants>(myintercalib, newTime, "ESIntercalibConstantsRcd");
91  }
92  } else if (objectName_[i] == "ESTimeSampleWeights") {
94  if (!toAppend) {
95  mydbservice->createNewIOV<ESTimeSampleWeights>(
96  myintercalib, newTime, mydbservice->endOfTime(), "ESTimeSampleWeightsRcd");
97  } else {
98  mydbservice->appendSinceTime<ESTimeSampleWeights>(myintercalib, newTime, "ESTimeSampleWeightsRcd");
99  }
100  } else if (objectName_[i] == "ESGain") {
101  ESGain* myintercalib = readESGainFromFile(inpFileName_[i].c_str());
102  if (!toAppend) {
103  mydbservice->createNewIOV<ESGain>(myintercalib, newTime, mydbservice->endOfTime(), "ESGainRcd");
104  } else {
105  mydbservice->appendSinceTime<ESGain>(myintercalib, newTime, "ESGainRcd");
106  }
107  } else if (objectName_[i] == "ESMissingEnergyCalibration") {
109  if (!toAppend) {
111  myintercalib, newTime, mydbservice->endOfTime(), "ESMissingEnergyCalibrationRcd");
112  } else {
114  myintercalib, newTime, "ESMissingEnergyCalibrationRcd");
115  }
116  } else if (objectName_[i] == "ESRecHitRatioCuts") {
118  if (!toAppend) {
119  mydbservice->createNewIOV<ESRecHitRatioCuts>(
120  myintercalib, newTime, mydbservice->endOfTime(), "ESRecHitRatioCutsRcd");
121  } else {
122  mydbservice->appendSinceTime<ESRecHitRatioCuts>(myintercalib, newTime, "ESRecHitRatioCutsRcd");
123  }
124  } else if (objectName_[i] == "ESThresholds") {
125  ESThresholds* myintercalib = readESThresholdsFromFile(inpFileName_[i].c_str());
126  if (!toAppend) {
127  mydbservice->createNewIOV<ESThresholds>(myintercalib, newTime, mydbservice->endOfTime(), "ESThresholdsRcd");
128  } else {
129  mydbservice->appendSinceTime<ESThresholds>(myintercalib, newTime, "ESThresholdsRcd");
130  }
131  } else if (objectName_[i] == "ESPedestals") {
132  ESPedestals* myintercalib = readESPedestalsFromFile(inpFileName_[i].c_str());
133  if (!toAppend) {
134  mydbservice->createNewIOV<ESPedestals>(myintercalib, newTime, mydbservice->endOfTime(), "ESPedestalsRcd");
135  } else {
136  mydbservice->appendSinceTime<ESPedestals>(myintercalib, newTime, "ESPedestalsRcd");
137  }
138  } else if (objectName_[i] == "ESEEIntercalibConstants") {
140  if (!toAppend) {
142  myintercalib, newTime, mydbservice->endOfTime(), "ESEEIntercalibConstantsRcd");
143  } else {
144  mydbservice->appendSinceTime<ESEEIntercalibConstants>(myintercalib, newTime, "ESEEIntercalibConstantsRcd");
145  }
146  } else {
147  edm::LogError("StoreESCondition") << "Object " << objectName_[i] << " is not supported by this program."
148  << "\n";
149  }
150  // if more records write here else if ....
151 
152  writeToLogFileResults(messChar);
153 
154  edm::LogInfo("StoreESCondition") << "Finished endJob"
155  << "\n";
156  }
157 
158  delete[] messChar;
159 }

References cond::service::PoolDBOutputService::appendSinceTime(), cond::service::PoolDBOutputService::beginOfTime(), cond::service::PoolDBOutputService::createNewIOV(), cond::service::PoolDBOutputService::endOfTime(), mps_fire::i, inpFileName_, edm::Service< T >::isAvailable(), cond::service::PoolDBOutputService::isNewTagRequest(), objectName_, readESChannelStatusFromFile(), readESEEIntercalibConstantsFromFile(), readESGainFromFile(), readESIntercalibConstantsFromFile(), readESMissingEnergyFromFile(), readESPedestalsFromFile(), readESRecHitRatioCutsFromFile(), readESThresholdsFromFile(), readESTimeSampleWeightsFromFile(), since_, AlCaHLTBitMon_QueryRunRegistry::string, and writeToLogFileResults().

◆ fillHeader()

void StoreESCondition::fillHeader ( char *  header)
private

Definition at line 199 of file StoreESCondition.cc.

199  {
200  time_t rawtime;
201  struct tm* timeinfo;
202  time(&rawtime);
203  timeinfo = localtime(&rawtime);
204  char user[50];
205  strcpy(user, getlogin());
206  strcpy(header, asctime(timeinfo));
207  strcpy(header, user);
208 }

References RecoTauValidation_cfi::header, protons_cff::time, and EnviromentSettings::user.

Referenced by writeToLogFile(), and writeToLogFileResults().

◆ readESChannelStatusFromFile()

ESChannelStatus * StoreESCondition::readESChannelStatusFromFile ( const char *  inputFile)

Definition at line 405 of file StoreESCondition.cc.

405  {
406  int z[1000], p[1000], x[1000], y[1000], nsensors;
407  std::ifstream statusFile(edm::FileInPath(inputFile).fullPath().c_str());
408  statusFile >> nsensors;
409  edm::LogInfo("StoreESCondition") << " nsensors " << nsensors << "\n";
410  if (nsensors >= 1000) {
411  edm::LogInfo("StoreESCondition") << " *** value too high, modify the method!***"
412  << "\n";
413  exit(-1);
414  }
415  for (int i = 0; i < nsensors; ++i) {
416  statusFile >> z[i] >> p[i] >> x[i] >> y[i];
417  }
418  ESChannelStatus* ecalStatus = new ESChannelStatus();
419  int Nbstatus = 0, Nbstrip = 0;
420  for (int istrip = ESDetId::ISTRIP_MIN; istrip <= ESDetId::ISTRIP_MAX; istrip++) {
421  for (int ix = ESDetId::IX_MIN; ix <= ESDetId::IX_MAX; ix++) {
422  for (int iy = ESDetId::IY_MIN; iy <= ESDetId::IY_MAX; iy++) {
423  for (int iplane = 1; iplane <= 2; iplane++) {
424  for (int izeta = -1; izeta <= 1; izeta = izeta + 2) {
425  // if (izeta==0) continue;
426  // try {
427 
428  //ESDetId Plane iplane Zside izeta
429  // if(!ESDetId::validDetId(istrip,ix,iy,iplane,izeta)) cout << " Unvalid DetId" << endl;
430  // else {
431  if (ESDetId::validDetId(istrip, ix, iy, iplane, izeta)) {
432  ESDetId anESId(istrip, ix, iy, iplane, izeta);
433  int status = 0;
434  // std::ifstream statusFile(edm::FileInPath(inputFile).fullPath().c_str());
435  Nbstrip++;
436  for (int i = 0; i < nsensors; ++i) {
437  if (izeta == z[i] && iplane == p[i] && ix == x[i] && iy == y[i])
438  status = 1;
439  }
440  if (status == 1) {
441  Nbstatus++;
442  if (istrip == 1)
443  edm::LogInfo("StoreESCondition") << " Bad channel ix " << ix << " iy " << iy << " iplane " << iplane
444  << " iz " << izeta << "\n"; // print only once
445  }
446  ecalStatus->setValue(anESId, status);
447  // statusFile.close();
448  } // valid DetId
449  // catch ( cms::Exception &e ) { }
450  } // loop over z
451  } // loop over plane
452  } // loop over y
453  } // loop over x
454  } // loop over strips
455  edm::LogInfo("StoreESCondition") << " Nb of strips " << Nbstrip << " Number of bad channels " << Nbstatus << "\n";
456  statusFile.close();
457 
458  // overwrite the statuses which are in the file
459  return ecalStatus;
460 }

References beamvalidation::exit(), contentValuesFiles::fullPath, mps_fire::i, dtResolutionTest_cfi::inputFile, ESDetId::ISTRIP_MAX, ESDetId::ISTRIP_MIN, ESDetId::IX_MAX, ESDetId::IX_MIN, ESDetId::IY_MAX, ESDetId::IY_MIN, AlCaHLTBitMon_ParallelJobs::p, ESCondObjectContainer< T >::setValue(), mps_update::status, ESDetId::validDetId(), x, y, and z.

Referenced by endJob().

◆ readESEEIntercalibConstantsFromFile()

ESEEIntercalibConstants * StoreESCondition::readESEEIntercalibConstantsFromFile ( const char *  inputFile)

Definition at line 220 of file StoreESCondition.cc.

220  {
221  std::ifstream ESEEIntercalibFile(edm::FileInPath(inputFile).fullPath().c_str());
222  float gammaLow0, alphaLow0, gammaHigh0, alphaHigh0, gammaLow1, alphaLow1, gammaHigh1, alphaHigh1, gammaLow2,
223  alphaLow2, gammaHigh2, alphaHigh2, gammaLow3, alphaLow3, gammaHigh3, alphaHigh3;
224  // const float ESEEIntercalibValue[16];
225  // for (int i = 0; i < 16; ++i) {
226  // ESEEIntercalibFile >> ESEEIntercalibValue[i];
227  // }
228  // ESEEIntercalibConstants* eseeIntercalibConstants = new ESEEIntercalibConstants(ESEEIntercalibValue);
229  ESEEIntercalibFile >> gammaLow0;
230  ESEEIntercalibFile >> alphaLow0;
231  ESEEIntercalibFile >> gammaHigh0;
232  ESEEIntercalibFile >> alphaHigh0;
233  ESEEIntercalibFile >> gammaLow1;
234  ESEEIntercalibFile >> alphaLow1;
235  ESEEIntercalibFile >> gammaHigh1;
236  ESEEIntercalibFile >> alphaHigh1;
237  ESEEIntercalibFile >> gammaLow2;
238  ESEEIntercalibFile >> alphaLow2;
239  ESEEIntercalibFile >> gammaHigh2;
240  ESEEIntercalibFile >> alphaHigh2;
241  ESEEIntercalibFile >> gammaLow3;
242  ESEEIntercalibFile >> alphaLow3;
243  ESEEIntercalibFile >> gammaHigh3;
244  ESEEIntercalibFile >> alphaHigh3;
245  ESEEIntercalibConstants* eseeIntercalibConstants = new ESEEIntercalibConstants(gammaLow0,
246  alphaLow0,
247  gammaHigh0,
248  alphaHigh0,
249  gammaLow1,
250  alphaLow1,
251  gammaHigh1,
252  alphaHigh1,
253  gammaLow2,
254  alphaLow2,
255  gammaHigh2,
256  alphaHigh2,
257  gammaLow3,
258  alphaLow3,
259  gammaHigh3,
260  alphaHigh3);
261 
262  return eseeIntercalibConstants;
263 }

References contentValuesFiles::fullPath, and dtResolutionTest_cfi::inputFile.

Referenced by endJob().

◆ readESGainFromFile()

ESGain * StoreESCondition::readESGainFromFile ( const char *  inputFile)

Definition at line 351 of file StoreESCondition.cc.

351  {
352  std::ifstream amplFile(edm::FileInPath(inputFile).fullPath().c_str());
353 
354  int gain;
355  amplFile >> gain;
356  edm::LogInfo("StoreESCondition") << "gain : " << gain << "\n";
357 
358  ESGain* esGain = new ESGain(gain); // 1: LG, 2: HG
359  return esGain;
360 }

References contentValuesFiles::fullPath, PedestalClient_cfi::gain, and dtResolutionTest_cfi::inputFile.

Referenced by endJob().

◆ readESIntercalibConstantsFromFile()

ESIntercalibConstants * StoreESCondition::readESIntercalibConstantsFromFile ( const char *  inputFile)

Definition at line 377 of file StoreESCondition.cc.

377  {
379 
380  std::ifstream mipFile(edm::FileInPath(inputFile).fullPath().c_str());
381 
382  for (int i = 0; i < 137216; ++i) {
383  int iz, ip, ix, iy, is;
384  double mip;
385  mipFile >> iz >> ip >> ix >> iy >> is >> mip;
386  //if (mip <20 || mip> 70) cout<<iz<<" "<<ip<<" "<<ix<<" "<<iy<<" "<<is<<" "<<mip<<endl; // HG
387  // LG : HG MIP/6/1.14
388  //mip = mip/6/1.14;
389  // LG : HG MIP/6
390  if (esgain_ == 1)
391  mip = mip / 6.; // LG
392  if (mip < 20 || mip > 70)
393  edm::LogInfo("StoreESCondition") << iz << " " << ip << " " << ix << " " << iy << " " << is << " " << mip
394  << "\n"; // LG
395 
396  if (ESDetId::validDetId(is, ix, iy, ip, iz)) {
397  ESDetId esId(is, ix, iy, ip, iz);
398  ical->setValue(esId.rawId(), mip);
399  }
400  }
401 
402  return ical;
403 }

References esgain_, contentValuesFiles::fullPath, mps_fire::i, dtResolutionTest_cfi::inputFile, DetId::rawId(), ESCondObjectContainer< T >::setValue(), and ESDetId::validDetId().

Referenced by endJob().

◆ readESMissingEnergyFromFile()

ESMissingEnergyCalibration * StoreESCondition::readESMissingEnergyFromFile ( const char *  inputFile)

Definition at line 265 of file StoreESCondition.cc.

265  {
266  std::ifstream ESMissingEnergyFile(edm::FileInPath(inputFile).fullPath().c_str());
267  float ConstAEta0, ConstBEta0, ConstAEta1, ConstBEta1, ConstAEta2, ConstBEta2, ConstAEta3, ConstBEta3;
268  ESMissingEnergyFile >> ConstAEta0;
269  ESMissingEnergyFile >> ConstBEta0;
270  ESMissingEnergyFile >> ConstAEta1;
271  ESMissingEnergyFile >> ConstBEta1;
272  ESMissingEnergyFile >> ConstAEta2;
273  ESMissingEnergyFile >> ConstBEta2;
274  ESMissingEnergyFile >> ConstAEta3;
275  ESMissingEnergyFile >> ConstBEta3;
277  ConstAEta0, ConstBEta0, ConstAEta1, ConstBEta1, ConstAEta2, ConstBEta2, ConstAEta3, ConstBEta3);
278 
279  return esMissingEnergy;
280 }

References contentValuesFiles::fullPath, and dtResolutionTest_cfi::inputFile.

Referenced by endJob().

◆ readESPedestalsFromFile()

ESPedestals * StoreESCondition::readESPedestalsFromFile ( const char *  inputFile)

Definition at line 282 of file StoreESCondition.cc.

282  {
283  ESPedestals* esPedestals = new ESPedestals();
284 
285  // int ped[2][2][40][40][32];
286  // for (int i=0; i<2; ++i)
287  // for (int j=0; j<2; ++j)
288  // for (int k=0; k<40; ++k)
289  // for (int m=0; m<40; ++m)
290  // for (int n=0; n<32; ++n)
291  // ped[i][j][k][m][n] = 0;
292 
294 
295  int iz, ip, ix, iy, is, ped_, zside;
296  std::ifstream pedestalFile(edm::FileInPath(inputFile).fullPath().c_str());
297 
298  for (int i = 0; i < 137216; ++i) {
299  pedestalFile >> iz >> ip >> ix >> iy >> is >> ped_;
300 
301  zside = (iz == -1) ? 1 : 0;
302  ped[zside][ip - 1][ix - 1][iy - 1][is - 1] = ped_;
303  }
304 
305  for (int iz = -1; iz <= 1; ++iz) {
306  if (iz == 0)
307  continue;
308  zside = (iz == -1) ? 1 : 0;
309 
310  for (int iplane = ESDetId::PLANE_MIN; iplane <= ESDetId::PLANE_MAX; ++iplane)
311  for (int ix = ESDetId::IX_MIN; ix <= ESDetId::IX_MAX; ++ix)
312  for (int iy = ESDetId::IY_MIN; iy <= ESDetId::IY_MAX; ++iy)
313  for (int istrip = ESDetId::ISTRIP_MIN; istrip <= ESDetId::ISTRIP_MAX; ++istrip) {
314  ESPedestals::Item ESitem;
315  ESitem.mean = ped[zside][iplane - 1][ix - 1][iy - 1][istrip - 1];
316  ESitem.rms = 3; // LG : 3, HG : 6
317 
318  if (ESDetId::validDetId(istrip, ix, iy, iplane, iz)) {
319  ESDetId esId(istrip, ix, iy, iplane, iz);
320  esPedestals->insert(std::make_pair(esId.rawId(), ESitem));
321  }
322  }
323  }
324 
325  return esPedestals;
326 }

References contentValuesFiles::fullPath, mps_fire::i, dtResolutionTest_cfi::inputFile, ESCondObjectContainer< T >::insert(), ESDetId::ISTRIP_MAX, ESDetId::ISTRIP_MIN, ESDetId::IX_MAX, ESDetId::IX_MIN, ESDetId::IY_MAX, ESDetId::IY_MIN, ESDetId::IZ_NUM, ESPedestal::mean, ESDetId::PLANE_MAX, ESDetId::PLANE_MIN, DetId::rawId(), ESPedestal::rms, ESDetId::validDetId(), and ecaldqm::zside().

Referenced by endJob().

◆ readESRecHitRatioCutsFromFile()

ESRecHitRatioCuts * StoreESCondition::readESRecHitRatioCutsFromFile ( const char *  inputFile)

Definition at line 328 of file StoreESCondition.cc.

328  {
329  std::ifstream ESRecHitRatioCutsFile(edm::FileInPath(inputFile).fullPath().c_str());
330 
331  float r12Low, r23Low, r12High, r23High;
332  ESRecHitRatioCutsFile >> r12Low;
333  ESRecHitRatioCutsFile >> r23Low;
334  ESRecHitRatioCutsFile >> r12High;
335  ESRecHitRatioCutsFile >> r23High;
336  ESRecHitRatioCuts* esRecHitRatioCuts = new ESRecHitRatioCuts(r12Low, r23Low, r12High, r23High);
337  // cout<<"We are in RH ratio cut : gain : " << esgain_<<endl;
338 
339  // HG (R12Low, R23Low, R12High, R23High)
340  // ESRecHitRatioCuts* esRecHitRatioCuts;
341  //if (esgain_ == 2) esRecHitRatioCuts = new ESRecHitRatioCuts(-99999., 0.24, 0.61, 2.23);
342  // if (esgain_ == 2) esRecHitRatioCuts = new ESRecHitRatioCuts(-99999., 0.61, 0.24, 2.23); // HG
343  // else esRecHitRatioCuts = new ESRecHitRatioCuts(-99999., 0.2, 0.39, 2.8);
344  // LG (R12Low, R23Low, R12High, R23High)
345  //ESRecHitRatioCuts* esRecHitRatioCuts = new ESRecHitRatioCuts(-99999., 99999., -99999., 99999.); // first running
346  //ESRecHitRatioCuts* esRecHitRatioCuts = new ESRecHitRatioCuts(-99999., 0.2, 0.39, 2.8);
347 
348  return esRecHitRatioCuts;
349 }

References contentValuesFiles::fullPath, and dtResolutionTest_cfi::inputFile.

Referenced by endJob().

◆ readESThresholdsFromFile()

ESThresholds * StoreESCondition::readESThresholdsFromFile ( const char *  inputFile)

Definition at line 210 of file StoreESCondition.cc.

210  {
211  std::ifstream ESThresholdsFile(edm::FileInPath(inputFile).fullPath().c_str());
212  float ts2, zs; //2nd time sample, ZS threshold
213  ESThresholdsFile >> ts2;
214  ESThresholdsFile >> zs;
215  ESThresholds* esThresholds = new ESThresholds(ts2, zs);
216 
217  return esThresholds;
218 }

References contentValuesFiles::fullPath, and dtResolutionTest_cfi::inputFile.

Referenced by endJob().

◆ readESTimeSampleWeightsFromFile()

ESTimeSampleWeights * StoreESCondition::readESTimeSampleWeightsFromFile ( const char *  inputFile)

Definition at line 362 of file StoreESCondition.cc.

362  {
363  std::ifstream amplFile(edm::FileInPath(inputFile).fullPath().c_str());
364 
365  float w[3];
366  for (int k = 0; k < 3; ++k) {
367  float ww;
368  amplFile >> ww;
369  w[k] = ww;
370  edm::LogInfo("StoreESCondition") << "weight : " << k << " " << w[k] << "\n";
371  }
372 
373  ESTimeSampleWeights* esWeights = new ESTimeSampleWeights(w[0], w[1], w[2]);
374  return esWeights;
375 }

References contentValuesFiles::fullPath, dtResolutionTest_cfi::inputFile, dqmdumpme::k, and w.

Referenced by endJob().

◆ to_string()

std::string StoreESCondition::to_string ( char  value[])
inlineprivate

Definition at line 63 of file StoreESCondition.h.

63  {
64  std::ostringstream streamOut;
65  streamOut << value;
66  return streamOut.str();
67  }

References relativeConstraints::value.

◆ writeToLogFile()

void StoreESCondition::writeToLogFile ( std::string  ,
std::string  ,
unsigned long long   
)

Definition at line 165 of file StoreESCondition.cc.

165  {
166  FILE* outFile; // output log file for appending
167  outFile = fopen(logfile_.c_str(), "a");
168  if (!outFile) {
169  edm::LogError("StoreESCondition") << "*** Can not open file: " << logfile_;
170  return;
171  }
172  char header[256];
174  char appendMode[10];
175  if (since != 0)
176  strcpy(appendMode, "append");
177  else
178  strcpy(appendMode, "create");
179 
180  //fprintf(outFile, "%s %s condition from file %s written into DB for SM %d (mapped to SM %d) in %s mode (since run %u)\n",
181  //header, a.c_str(), b.c_str(), appendMode, (unsigned int)since);
182 
183  fclose(outFile); // close out file
184 }

References fillHeader(), RecoTauValidation_cfi::header, logfile_, L1TdeCSCTF_cfi::outFile, and writeEcalDQMStatus::since.

◆ writeToLogFileResults()

void StoreESCondition::writeToLogFileResults ( char *  arg)

Definition at line 186 of file StoreESCondition.cc.

186  {
187  FILE* outFile; // output log file for appending
188  outFile = fopen(logfile_.c_str(), "a");
189  if (!outFile) {
190  edm::LogError("StoreESCondition") << "*** Can not open file: " << logfile_;
191  return;
192  }
193  char header[256];
195  fprintf(outFile, "%s %s\n", header, arg);
196  fclose(outFile); // close out file
197 }

References fillHeader(), RecoTauValidation_cfi::header, logfile_, and L1TdeCSCTF_cfi::outFile.

Referenced by endJob().

Member Data Documentation

◆ esgain_

unsigned int StoreESCondition::esgain_
private

Definition at line 61 of file StoreESCondition.h.

Referenced by readESIntercalibConstantsFromFile(), and StoreESCondition().

◆ inpFileName_

std::vector<std::string> StoreESCondition::inpFileName_
private

Definition at line 55 of file StoreESCondition.h.

Referenced by endJob(), and StoreESCondition().

◆ inpFileNameEE_

std::vector<std::string> StoreESCondition::inpFileNameEE_
private

Definition at line 56 of file StoreESCondition.h.

◆ logfile_

std::string StoreESCondition::logfile_
private

Definition at line 59 of file StoreESCondition.h.

Referenced by StoreESCondition(), writeToLogFile(), and writeToLogFileResults().

◆ objectName_

std::vector<std::string> StoreESCondition::objectName_
private

Definition at line 54 of file StoreESCondition.h.

Referenced by endJob(), and StoreESCondition().

◆ prog_name_

std::string StoreESCondition::prog_name_
private

Definition at line 57 of file StoreESCondition.h.

Referenced by StoreESCondition().

◆ since_

std::vector<unsigned long long> StoreESCondition::since_
private

Definition at line 58 of file StoreESCondition.h.

Referenced by endJob(), and StoreESCondition().

ESGain
Definition: ESGain.h:7
StoreESCondition::fillHeader
void fillHeader(char *)
Definition: StoreESCondition.cc:199
StoreESCondition::readESIntercalibConstantsFromFile
ESIntercalibConstants * readESIntercalibConstantsFromFile(const char *)
Definition: StoreESCondition.cc:377
DDAxes::y
StoreESCondition::inpFileName_
std::vector< std::string > inpFileName_
Definition: StoreESCondition.h:55
ESMissingEnergyCalibration
Definition: ESMissingEnergyCalibration.h:7
mps_fire.i
i
Definition: mps_fire.py:428
ESDetId::ISTRIP_MIN
static const int ISTRIP_MIN
Definition: ESDetId.h:68
StoreESCondition::logfile_
std::string logfile_
Definition: StoreESCondition.h:59
cond::service::PoolDBOutputService::beginOfTime
cond::Time_t beginOfTime() const
Definition: PoolDBOutputService.cc:215
mps_update.status
status
Definition: mps_update.py:68
ecaldqm::zside
int zside(DetId const &)
Definition: EcalDQMCommonUtils.cc:189
contentValuesFiles.fullPath
fullPath
Definition: contentValuesFiles.py:64
ESThresholds
Definition: ESThresholds.h:7
cond::service::PoolDBOutputService::appendSinceTime
void appendSinceTime(const T *payloadObj, cond::Time_t sinceTime, const std::string &recordName)
Definition: PoolDBOutputService.h:141
protons_cff.time
time
Definition: protons_cff.py:35
ESChannelStatus
ESChannelStatusMap ESChannelStatus
Definition: ESChannelStatus.h:7
ESDetId
Definition: ESDetId.h:15
DDAxes::x
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
edm::Service::isAvailable
bool isAvailable() const
Definition: Service.h:40
StoreESCondition::readESThresholdsFromFile
ESThresholds * readESThresholdsFromFile(const char *)
Definition: StoreESCondition.cc:210
ESDetId::IY_MIN
static const int IY_MIN
Definition: ESDetId.h:65
edm::FileInPath
Definition: FileInPath.h:61
StoreESCondition::readESRecHitRatioCutsFromFile
ESRecHitRatioCuts * readESRecHitRatioCutsFromFile(const char *)
Definition: StoreESCondition.cc:328
cond::service::PoolDBOutputService::createNewIOV
void createNewIOV(const T *firstPayloadObj, cond::Time_t firstSinceTime, cond::Time_t, const std::string &recordName)
Definition: PoolDBOutputService.h:116
ESCondObjectContainer::insert
void insert(std::pair< uint32_t, Item > const &a)
Definition: ESCondObjectContainer.h:27
w
const double w
Definition: UKUtility.cc:23
ESPedestal
Definition: ESPedestals.h:8
StoreESCondition::prog_name_
std::string prog_name_
Definition: StoreESCondition.h:57
DDAxes::z
StoreESCondition::writeToLogFileResults
void writeToLogFileResults(char *)
Definition: StoreESCondition.cc:186
StoreESCondition::readESGainFromFile
ESGain * readESGainFromFile(const char *)
Definition: StoreESCondition.cc:351
StoreESCondition::readESMissingEnergyFromFile
ESMissingEnergyCalibration * readESMissingEnergyFromFile(const char *)
Definition: StoreESCondition.cc:265
writeEcalDQMStatus.since
since
Definition: writeEcalDQMStatus.py:53
ESRecHitRatioCuts
Definition: ESRecHitRatioCuts.h:7
dqmdumpme.k
k
Definition: dqmdumpme.py:60
StoreESCondition::readESEEIntercalibConstantsFromFile
ESEEIntercalibConstants * readESEEIntercalibConstantsFromFile(const char *)
Definition: StoreESCondition.cc:220
ESDetId::PLANE_MIN
static const int PLANE_MIN
Definition: ESDetId.h:70
StoreESCondition::objectName_
std::vector< std::string > objectName_
Definition: StoreESCondition.h:54
StoreESCondition::esgain_
unsigned int esgain_
Definition: StoreESCondition.h:61
L1TdeCSCTF_cfi.outFile
outFile
Definition: L1TdeCSCTF_cfi.py:5
ESDetId::PLANE_MAX
static const int PLANE_MAX
Definition: ESDetId.h:71
AlCaHLTBitMon_ParallelJobs.p
def p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
ESDetId::ISTRIP_MAX
static const int ISTRIP_MAX
Definition: ESDetId.h:69
StoreESCondition::readESChannelStatusFromFile
ESChannelStatus * readESChannelStatusFromFile(const char *)
Definition: StoreESCondition.cc:405
cond::Time_t
unsigned long long Time_t
Definition: Time.h:14
ESTimeSampleWeights
Definition: ESTimeSampleWeights.h:7
edm::Service< cond::service::PoolDBOutputService >
dtResolutionTest_cfi.inputFile
inputFile
Definition: dtResolutionTest_cfi.py:14
ESPedestal::rms
float rms
Definition: ESPedestals.h:17
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
ESCondObjectContainer
Definition: ESCondObjectContainer.h:11
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
ESDetId::IY_MAX
static const int IY_MAX
Definition: ESDetId.h:67
EnviromentSettings.user
user
Definition: EnviromentSettings.py:30
PedestalClient_cfi.gain
gain
Definition: PedestalClient_cfi.py:37
cond::service::PoolDBOutputService::endOfTime
cond::Time_t endOfTime() const
Definition: PoolDBOutputService.cc:213
ESPedestal::mean
float mean
Definition: ESPedestals.h:16
ESDetId::IZ_NUM
static const int IZ_NUM
Definition: ESDetId.h:72
StoreESCondition::readESTimeSampleWeightsFromFile
ESTimeSampleWeights * readESTimeSampleWeightsFromFile(const char *)
Definition: StoreESCondition.cc:362
relativeConstraints.value
value
Definition: relativeConstraints.py:53
ESDetId::validDetId
static bool validDetId(int istrip, int ixs, int iys, int iplane, int iz)
check if a valid index combination
Definition: ESDetId.cc:15
ESPedestals
ESPedestalsMap ESPedestals
Definition: ESPedestals.h:29
StoreESCondition::readESPedestalsFromFile
ESPedestals * readESPedestalsFromFile(const char *)
Definition: StoreESCondition.cc:282
cond::service::PoolDBOutputService::isNewTagRequest
bool isNewTagRequest(const std::string &recordName)
Definition: PoolDBOutputService.cc:128
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
convertXMLtoSQLite_cfg.toPut
toPut
Definition: convertXMLtoSQLite_cfg.py:41
ESDetId::IX_MIN
static const int IX_MIN
Definition: ESDetId.h:64
RecoTauValidation_cfi.header
header
Definition: RecoTauValidation_cfi.py:291
funct::arg
A arg
Definition: Factorize.h:31
ESDetId::IX_MAX
static const int IX_MAX
Definition: ESDetId.h:66
ESEEIntercalibConstants
Definition: ESEEIntercalibConstants.h:7
beamvalidation.exit
def exit(msg="")
Definition: beamvalidation.py:52
ESIntercalibConstants
ESIntercalibConstantMap ESIntercalibConstants
Definition: ESIntercalibConstants.h:7
Parameters
vector< ParameterSet > Parameters
Definition: HLTMuonPlotter.cc:25
StoreESCondition::since_
std::vector< unsigned long long > since_
Definition: StoreESCondition.h:58
ESCondObjectContainer::setValue
void setValue(const uint32_t id, const Item &item)
Definition: ESCondObjectContainer.h:39