CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Attributes
EcalTestDevDB Class Reference

#include <EcalTestDevDB.h>

Inheritance diagram for EcalTestDevDB:
edm::one::EDAnalyzer<> edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &evt, const edm::EventSetup &evtSetup) override
 
 EcalTestDevDB (const edm::ParameterSet &iConfig)
 
std::shared_ptr
< EcalADCToGeVConstant
generateEcalADCToGeVConstant ()
 
std::shared_ptr< EcalGainRatiosgenerateEcalGainRatios ()
 
std::shared_ptr
< EcalIntercalibConstants
generateEcalIntercalibConstants ()
 
std::shared_ptr< EcalLaserAlphasgenerateEcalLaserAlphas ()
 
std::shared_ptr
< EcalLaserAPDPNRatios
generateEcalLaserAPDPNRatios (uint32_t i_run)
 
std::shared_ptr
< EcalLaserAPDPNRatiosRef
generateEcalLaserAPDPNRatiosRef ()
 
std::shared_ptr
< EcalLinearCorrections
generateEcalLinearCorrections ()
 
std::shared_ptr< EcalPedestalsgenerateEcalPedestals ()
 
std::shared_ptr< EcalTBWeightsgenerateEcalTBWeights ()
 
std::shared_ptr
< EcalWeightXtalGroups
generateEcalWeightXtalGroups ()
 
 ~EcalTestDevDB () override
 
- Public Member Functions inherited from edm::one::EDAnalyzer<>
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDAnalyzerBase () 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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
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 Attributes

std::map< std::string,
unsigned long long > 
m_cacheIDs
 
unsigned long m_firstRun
 
unsigned int m_interval
 
unsigned long m_lastRun
 
std::map< std::string,
std::string > 
m_records
 
std::string m_timetype
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
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<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 41 of file EcalTestDevDB.h.

Constructor & Destructor Documentation

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

Definition at line 24 of file EcalTestDevDB.cc.

References edm::ParameterSet::getParameter(), mps_fire::i, m_cacheIDs, m_firstRun, m_interval, m_lastRun, m_records, GlobalPosition_Frontier_DevDB_cff::record, AlCaHLTBitMon_QueryRunRegistry::string, GlobalPosition_Frontier_DevDB_cff::tag, and copyEcalPFRecHitThresholds_cfg::toCopy.

25  : m_timetype(iConfig.getParameter<std::string>("timetype")), m_cacheIDs(), m_records() {
26  std::string container;
29 
30  m_firstRun = static_cast<unsigned long>(atoi(iConfig.getParameter<std::string>("firstRun").c_str()));
31  m_lastRun = static_cast<unsigned long>(atoi(iConfig.getParameter<std::string>("lastRun").c_str()));
32  m_interval = static_cast<unsigned long>(atoi(iConfig.getParameter<std::string>("interval").c_str()));
33 
34  typedef std::vector<edm::ParameterSet> Parameters;
35  Parameters toCopy = iConfig.getParameter<Parameters>("toCopy");
36  for (Parameters::iterator i = toCopy.begin(); i != toCopy.end(); ++i) {
37  container = i->getParameter<std::string>("container");
38  record = i->getParameter<std::string>("record");
39  m_cacheIDs.insert(std::make_pair(container, 0));
40  m_records.insert(std::make_pair(container, record));
41  }
42 }
std::map< std::string, std::string > m_records
Definition: EcalTestDevDB.h:62
unsigned long m_lastRun
Definition: EcalTestDevDB.h:64
vector< ParameterSet > Parameters
std::string m_timetype
Definition: EcalTestDevDB.h:60
unsigned int m_interval
Definition: EcalTestDevDB.h:65
unsigned long m_firstRun
Definition: EcalTestDevDB.h:63
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
std::map< std::string, unsigned long long > m_cacheIDs
Definition: EcalTestDevDB.h:61
EcalTestDevDB::~EcalTestDevDB ( )
override

Definition at line 44 of file EcalTestDevDB.cc.

44 {}

Member Function Documentation

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

Implements edm::one::EDAnalyzerBase.

Definition at line 46 of file EcalTestDevDB.cc.

References cond::service::PoolDBOutputService::appendOneIOV(), cond::service::PoolDBOutputService::beginOfTime(), cond::service::PoolDBOutputService::createOneIOV(), edm::IOVSyncValue::endOfTime(), edm::IOVSyncValue::eventID(), Exception, generateEcalADCToGeVConstant(), generateEcalGainRatios(), generateEcalIntercalibConstants(), generateEcalLaserAlphas(), generateEcalLaserAPDPNRatios(), generateEcalLaserAPDPNRatiosRef(), generateEcalLinearCorrections(), generateEcalPedestals(), generateEcalTBWeights(), generateEcalWeightXtalGroups(), mps_fire::i, edm::Service< T >::isAvailable(), cond::service::PoolDBOutputService::isNewTagRequest(), m_firstRun, m_interval, m_lastRun, m_records, GlobalPosition_Frontier_DevDB_cff::record, align_cfg::recordName, edm::EventID::run(), and AlCaHLTBitMon_QueryRunRegistry::string.

46  {
48  if (!dbOutput.isAvailable()) {
49  throw cms::Exception("PoolDBOutputService is not available");
50  }
51 
52  std::string container;
54  typedef std::map<std::string, std::string>::const_iterator recordIter;
55  for (recordIter i = m_records.begin(); i != m_records.end(); ++i) {
56  container = (*i).first;
57  record = (*i).second;
58 
59  std::string recordName = m_records[container];
60 
61  // Loop through each of the runs
62 
63  unsigned long nrec = (m_lastRun - m_firstRun) / m_interval + 1;
64  unsigned long nstart = 0;
65  if (m_firstRun == 0 && m_lastRun == 0) {
66  // it should do at least once the loop
67  nstart = 0;
68  nrec = 1;
69  }
70 
71  for (unsigned long i = nstart; i < nrec; i++) {
72  unsigned long irun = m_firstRun + i * m_interval;
73 
74  // Arguments 0 0 mean infinite IOV
75  if (m_firstRun == 0 && m_lastRun == 0) {
76  edm::LogInfo("EcalTestDevDB") << "Infinite IOV mode";
78  }
79 
80  edm::LogInfo("EcalTestDevDB") << "Starting Transaction for run " << irun << "...";
81 
82  if (container == "EcalPedestals") {
83  const auto condObject = generateEcalPedestals();
84  if (irun == m_firstRun && dbOutput->isNewTagRequest(recordName)) {
85  // create new
86  edm::LogInfo("EcalTestDevDB") << "First One ";
87  dbOutput->createOneIOV<const EcalPedestals>(*condObject, dbOutput->beginOfTime(), recordName);
88  } else {
89  // append
90  edm::LogInfo("EcalTestDevDB") << "Old One ";
91  dbOutput->appendOneIOV<const EcalPedestals>(*condObject, irun, recordName);
92  }
93 
94  } else if (container == "EcalADCToGeVConstant") {
95  const auto condObject = generateEcalADCToGeVConstant();
96  if (irun == m_firstRun && dbOutput->isNewTagRequest(recordName)) {
97  // create new
98  edm::LogInfo("EcalTestDevDB") << "First One ";
99  dbOutput->createOneIOV<const EcalADCToGeVConstant>(*condObject, dbOutput->beginOfTime(), recordName);
100  } else {
101  // append
102  edm::LogInfo("EcalTestDevDB") << "Old One ";
103  dbOutput->appendOneIOV<const EcalADCToGeVConstant>(*condObject, irun, recordName);
104  }
105 
106  } else if (container == "EcalIntercalibConstants") {
107  const auto condObject = generateEcalIntercalibConstants();
108  if (irun == m_firstRun && dbOutput->isNewTagRequest(recordName)) {
109  // create new
110  edm::LogInfo("EcalTestDevDB") << "First One ";
111  dbOutput->createOneIOV<const EcalIntercalibConstants>(*condObject, dbOutput->beginOfTime(), recordName);
112  } else {
113  // append
114  edm::LogInfo("EcalTestDevDB") << "Old One ";
115  dbOutput->appendOneIOV<const EcalIntercalibConstants>(*condObject, irun, recordName);
116  }
117  } else if (container == "EcalLinearCorrections") {
118  const auto condObject = generateEcalLinearCorrections();
119  if (irun == m_firstRun && dbOutput->isNewTagRequest(recordName)) {
120  // create new
121  edm::LogInfo("EcalTestDevDB") << "First One ";
122  dbOutput->createOneIOV<const EcalLinearCorrections>(*condObject, dbOutput->beginOfTime(), recordName);
123  } else {
124  // append
125  edm::LogInfo("EcalTestDevDB") << "Old One ";
126  dbOutput->appendOneIOV<const EcalLinearCorrections>(*condObject, irun, recordName);
127  }
128 
129  } else if (container == "EcalGainRatios") {
130  const auto condObject = generateEcalGainRatios();
131  if (irun == m_firstRun && dbOutput->isNewTagRequest(recordName)) {
132  // create new
133  edm::LogInfo("EcalTestDevDB") << "First One ";
134  dbOutput->createOneIOV<const EcalGainRatios>(*condObject, dbOutput->beginOfTime(), recordName);
135  } else {
136  // append
137  edm::LogInfo("EcalTestDevDB") << "Old One ";
138  dbOutput->appendOneIOV<const EcalGainRatios>(*condObject, irun, recordName);
139  }
140 
141  } else if (container == "EcalWeightXtalGroups") {
142  const auto condObject = generateEcalWeightXtalGroups();
143  if (irun == m_firstRun && dbOutput->isNewTagRequest(recordName)) {
144  // create new
145  edm::LogInfo("EcalTestDevDB") << "First One ";
146  dbOutput->createOneIOV<const EcalWeightXtalGroups>(*condObject, dbOutput->beginOfTime(), recordName);
147  } else {
148  // append
149  edm::LogInfo("EcalTestDevDB") << "Old One ";
150  dbOutput->appendOneIOV<const EcalWeightXtalGroups>(*condObject, irun, recordName);
151  }
152 
153  } else if (container == "EcalTBWeights") {
154  const auto condObject = generateEcalTBWeights();
155  if (irun == m_firstRun && dbOutput->isNewTagRequest(recordName)) {
156  // create new
157  edm::LogInfo("EcalTestDevDB") << "First One ";
158  dbOutput->createOneIOV<const EcalTBWeights>(*condObject, dbOutput->beginOfTime(), recordName);
159  } else {
160  // append
161  edm::LogInfo("EcalTestDevDB") << "Old One ";
162  dbOutput->appendOneIOV<const EcalTBWeights>(*condObject, irun, recordName);
163  }
164 
165  } else if (container == "EcalLaserAPDPNRatios") {
166  const auto condObject = generateEcalLaserAPDPNRatios(irun);
167  if (irun == m_firstRun && dbOutput->isNewTagRequest(recordName)) {
168  // create new
169  edm::LogInfo("EcalTestDevDB") << "First One ";
170  dbOutput->createOneIOV<const EcalLaserAPDPNRatios>(*condObject, dbOutput->beginOfTime(), recordName);
171  } else {
172  // append
173  edm::LogInfo("EcalTestDevDB") << "Old One ";
174  dbOutput->appendOneIOV<const EcalLaserAPDPNRatios>(*condObject, irun, recordName);
175  }
176  } else if (container == "EcalLaserAPDPNRatiosRef") {
177  const auto condObject = generateEcalLaserAPDPNRatiosRef();
178  if (irun == m_firstRun && dbOutput->isNewTagRequest(recordName)) {
179  // create new
180  edm::LogInfo("EcalTestDevDB") << "First One ";
181  dbOutput->createOneIOV<const EcalLaserAPDPNRatiosRef>(*condObject, dbOutput->beginOfTime(), recordName);
182  } else {
183  // append
184  edm::LogInfo("EcalTestDevDB") << "Old One ";
185  dbOutput->appendOneIOV<const EcalLaserAPDPNRatiosRef>(*condObject, irun, recordName);
186  }
187  } else if (container == "EcalLaserAlphas") {
188  const auto condObject = generateEcalLaserAlphas();
189  if (irun == m_firstRun && dbOutput->isNewTagRequest(recordName)) {
190  // create new
191  edm::LogInfo("EcalTestDevDB") << "First One ";
192  dbOutput->createOneIOV<const EcalLaserAlphas>(*condObject, dbOutput->beginOfTime(), recordName);
193  } else {
194  // append
195  edm::LogInfo("EcalTestDevDB") << "Old One ";
196  dbOutput->appendOneIOV<const EcalLaserAlphas>(*condObject, irun, recordName);
197  }
198  } else {
199  edm::LogWarning("EcalTestDevDB") << "it does not work yet for " << container << "...";
200  }
201  }
202  }
203 }
RunNumber_t run() const
Definition: EventID.h:38
std::shared_ptr< EcalLaserAPDPNRatiosRef > generateEcalLaserAPDPNRatiosRef()
std::shared_ptr< EcalLinearCorrections > generateEcalLinearCorrections()
const EventID & eventID() const
Definition: IOVSyncValue.h:40
static const IOVSyncValue & endOfTime()
Definition: IOVSyncValue.cc:82
std::shared_ptr< EcalLaserAlphas > generateEcalLaserAlphas()
std::map< std::string, std::string > m_records
Definition: EcalTestDevDB.h:62
tuple recordName
Definition: align_cfg.py:66
std::shared_ptr< EcalLaserAPDPNRatios > generateEcalLaserAPDPNRatios(uint32_t i_run)
std::shared_ptr< EcalTBWeights > generateEcalTBWeights()
unsigned long m_lastRun
Definition: EcalTestDevDB.h:64
void createOneIOV(const T &payload, cond::Time_t firstSinceTime, const std::string &recordName)
void appendOneIOV(const T &payload, cond::Time_t sinceTime, const std::string &recordName)
std::shared_ptr< EcalGainRatios > generateEcalGainRatios()
bool isNewTagRequest(const std::string &recordName)
std::shared_ptr< EcalPedestals > generateEcalPedestals()
bool isAvailable() const
Definition: Service.h:40
unsigned int m_interval
Definition: EcalTestDevDB.h:65
std::shared_ptr< EcalIntercalibConstants > generateEcalIntercalibConstants()
Log< level::Info, false > LogInfo
unsigned long m_firstRun
Definition: EcalTestDevDB.h:63
std::shared_ptr< EcalADCToGeVConstant > generateEcalADCToGeVConstant()
std::shared_ptr< EcalWeightXtalGroups > generateEcalWeightXtalGroups()
Log< level::Warning, false > LogWarning
std::shared_ptr< EcalADCToGeVConstant > EcalTestDevDB::generateEcalADCToGeVConstant ( )

Definition at line 230 of file EcalTestDevDB.cc.

References alignCSCRings::r.

Referenced by analyze().

230  {
231  //-------------------------------------------------------------
232 
233  double r = (double)std::rand() / (double(RAND_MAX) + double(1));
234  auto agc = std::make_shared<EcalADCToGeVConstant>(36. + r * 4., 60. + r * 4);
235  return agc;
236 }
std::shared_ptr< EcalGainRatios > EcalTestDevDB::generateEcalGainRatios ( )

Definition at line 319 of file EcalTestDevDB.cc.

References EBDetId::MAX_IETA, EBDetId::MAX_IPHI, EBDetId::MIN_IPHI, alignCSCRings::r, DetId::rawId(), EcalMGPAGainRatio::setGain12Over6(), and EcalMGPAGainRatio::setGain6Over1().

Referenced by analyze().

319  {
320  //-------------------------------------------------------------
321 
322  // create gain ratios
323  auto gratio = std::make_shared<EcalGainRatios>();
324 
325  for (int ieta = -EBDetId::MAX_IETA; ieta <= EBDetId::MAX_IETA; ++ieta) {
326  if (ieta == 0)
327  continue;
328  for (int iphi = EBDetId::MIN_IPHI; iphi <= EBDetId::MAX_IPHI; ++iphi) {
329  EBDetId ebid(ieta, iphi);
330 
331  double r = (double)std::rand() / (double(RAND_MAX) + double(1));
332 
334  gr.setGain12Over6(1.9 + r * 0.2);
335  gr.setGain6Over1(5.9 + r * 0.2);
336 
337  gratio->setValue(ebid.rawId(), gr);
338 
339  } // loop over phi
340  } // loop over eta
341  return gratio;
342 }
static const int MIN_IPHI
Definition: EBDetId.h:135
void setGain12Over6(const float &g)
static const int MAX_IPHI
Definition: EBDetId.h:137
static const int MAX_IETA
Definition: EBDetId.h:136
void setGain6Over1(const float &g)
std::shared_ptr< EcalIntercalibConstants > EcalTestDevDB::generateEcalIntercalibConstants ( )

Definition at line 239 of file EcalTestDevDB.cc.

References EBDetId::MAX_IETA, EBDetId::MAX_IPHI, EBDetId::MIN_IPHI, alignCSCRings::r, and DetId::rawId().

Referenced by analyze().

239  {
240  //-------------------------------------------------------------
241 
242  auto ical = std::make_shared<EcalIntercalibConstants>();
243 
244  for (int ieta = -EBDetId::MAX_IETA; ieta <= EBDetId::MAX_IETA; ++ieta) {
245  if (ieta == 0)
246  continue;
247  for (int iphi = EBDetId::MIN_IPHI; iphi <= EBDetId::MAX_IPHI; ++iphi) {
248  EBDetId ebid(ieta, iphi);
249 
250  double r = (double)std::rand() / (double(RAND_MAX) + double(1));
251  ical->setValue(ebid.rawId(), 0.85 + r * 0.3);
252  } // loop over phi
253  } // loop over eta
254  return ical;
255 }
static const int MIN_IPHI
Definition: EBDetId.h:135
static const int MAX_IPHI
Definition: EBDetId.h:137
static const int MAX_IETA
Definition: EBDetId.h:136
std::shared_ptr< EcalLaserAlphas > EcalTestDevDB::generateEcalLaserAlphas ( )

Definition at line 613 of file EcalTestDevDB.cc.

References EBDetId::hashedIndex(), EEDetId::hashedIndex(), EEDetId::IX_MAX, EEDetId::IX_MIN, EEDetId::IY_MAX, EEDetId::IY_MIN, EcalCondDBWriter_cfi::laser, EBDetId::MAX_HASH, EBDetId::MAX_IETA, EBDetId::MAX_IPHI, EBDetId::MIN_IPHI, and EEDetId::validDetId().

Referenced by analyze().

613  {
614  //--------------------------------------------------------------
615 
616  auto laser = std::make_shared<EcalLaserAlphas>();
617 
618  EcalLaserAlpha Alpha;
619 
620  for (int iEta = -EBDetId::MAX_IETA; iEta <= EBDetId::MAX_IETA; ++iEta) {
621  if (iEta == 0)
622  continue;
623  for (int iPhi = EBDetId::MIN_IPHI; iPhi <= EBDetId::MAX_IPHI; ++iPhi) {
624  Alpha = double(1.55);
625  EBDetId ebid(iEta, iPhi);
626 
627  int hi = ebid.hashedIndex();
628  if (hi < static_cast<int>(laser->getMap().size())) {
629  laser->setValue(hi, Alpha);
630  } else {
631  edm::LogError("EcalTestDevDB") << "error with laser Map (alpha)!";
632  }
633  }
634  }
635 
636  for (int iX = EEDetId::IX_MIN; iX <= EEDetId::IX_MAX; ++iX) {
637  for (int iY = EEDetId::IY_MIN; iY <= EEDetId::IY_MAX; ++iY) {
638  if (!EEDetId::validDetId(iX, iY, 1))
639  continue;
640 
641  EEDetId eedetidpos(iX, iY, 1);
642  Alpha = double(1.55);
643 
644  int hi = eedetidpos.hashedIndex() + EBDetId::MAX_HASH + 1;
645  if (hi < static_cast<int>(laser->getMap().size())) {
646  laser->setValue(hi, Alpha);
647  } else {
648  edm::LogError("EcalTestDevDB") << "error with laser Map (alpha)!";
649  }
650 
651  if (!EEDetId::validDetId(iX, iY, -1))
652  continue;
653  EEDetId eedetidneg(iX, iY, -1);
654  Alpha = double(1.55);
655 
656  hi = eedetidneg.hashedIndex() + EBDetId::MAX_HASH + 1;
657  if (hi < static_cast<int>(laser->getMap().size())) {
658  laser->setValue(hi, Alpha);
659  } else {
660  edm::LogError("EcalTestDevDB") << "error with laser Map (alpha)!";
661  }
662  }
663  }
664 
665  return laser;
666 }
float EcalLaserAlpha
static const int MIN_IPHI
Definition: EBDetId.h:135
static const int MAX_HASH
Definition: EBDetId.h:150
Log< level::Error, false > LogError
static const int IX_MIN
Definition: EEDetId.h:290
static const int IY_MIN
Definition: EEDetId.h:294
static const int IX_MAX
Definition: EEDetId.h:298
static const int MAX_IPHI
Definition: EBDetId.h:137
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
Definition: EEDetId.h:248
static const int MAX_IETA
Definition: EBDetId.h:136
static const int IY_MAX
Definition: EEDetId.h:302
std::shared_ptr< EcalLaserAPDPNRatios > EcalTestDevDB::generateEcalLaserAPDPNRatios ( uint32_t  i_run)

Definition at line 408 of file EcalTestDevDB.cc.

References funct::exp(), EBDetId::hashedIndex(), EEDetId::hashedIndex(), mps_fire::i, EEDetId::IX_MAX, EEDetId::IX_MIN, EEDetId::IY_MAX, EEDetId::IY_MIN, EcalCondDBWriter_cfi::laser, log, m_firstRun, m_lastRun, EBDetId::MAX_HASH, EBDetId::MAX_IETA, EBDetId::MAX_IPHI, EBDetId::MIN_IPHI, EcalLaserAPDPNRatios::EcalLaserTimeStamp::t1, EcalLaserAPDPNRatios::EcalLaserTimeStamp::t2, and EEDetId::validDetId().

Referenced by analyze().

408  {
409  //--------------------------------------------------------------
410 
411  auto laser = std::make_shared<EcalLaserAPDPNRatios>();
412 
415 
416  // if((m_firstRun == 0 && i_run == 0) || (m_firstRun == 1 && i_run == 1)){
417 
418  edm::LogInfo("EcalTestDevDB") << "First & last run: " << i_run << " " << m_firstRun << " " << m_lastRun;
419  if (m_firstRun == i_run && (i_run == 0 || i_run == 1)) {
420  APDPNpair.p1 = (double(1) + 1 / double(log(exp(1) + double((i_run - m_firstRun) * 10)))) / double(2);
421  APDPNpair.p2 = (double(1) + 1 / double(log(exp(1) + double((i_run - m_firstRun) * 10) + double(10)))) / double(2);
422  APDPNpair.p3 = double(0);
423  edm::LogInfo("EcalTestDevDB") << i_run << " " << m_firstRun << " " << APDPNpair.p1 << " " << APDPNpair.p2;
424 
425  for (int iEta = -EBDetId::MAX_IETA; iEta <= EBDetId::MAX_IETA; ++iEta) {
426  if (iEta == 0)
427  continue;
428  for (int iPhi = EBDetId::MIN_IPHI; iPhi <= EBDetId::MAX_IPHI; ++iPhi) {
429  //APDPNpair.p1= double(1);
430  //APDPNpair.p2= double(1);
431 
432  EBDetId ebid(iEta, iPhi);
433  int hi = ebid.hashedIndex();
434 
435  if (hi < static_cast<int>(laser->getLaserMap().size())) {
436  laser->setValue(hi, APDPNpair);
437  } else {
438  edm::LogError("EcalTestDevDB") << "error with laser Map (ratio)!";
439  continue;
440  }
441  }
442  }
443 
444  for (int iX = EEDetId::IX_MIN; iX <= EEDetId::IX_MAX; ++iX) {
445  for (int iY = EEDetId::IY_MIN; iY <= EEDetId::IY_MAX; ++iY) {
446  // make an EEDetId since we need EEDetId::rawId() to be used as the key for the pedestals
447 
448  if (!EEDetId::validDetId(iX, iY, 1))
449  continue;
450 
451  EEDetId eedetidpos(iX, iY, 1);
452  //APDPNpair.p1 = double(1);
453  //APDPNpair.p2 = double(1);
454 
455  int hi = eedetidpos.hashedIndex() + EBDetId::MAX_HASH + 1;
456  if (hi < static_cast<int>(laser->getLaserMap().size())) {
457  laser->setValue(hi, APDPNpair);
458  } else {
459  edm::LogError("EcalTestDevDB") << "error with laser Map (ratio)!";
460  continue;
461  }
462 
463  if (!EEDetId::validDetId(iX, iY, -1))
464  continue;
465 
466  EEDetId eedetidneg(iX, iY, -1);
467  //APDPNpair.p1 = double(1);
468  //APDPNpair.p2 = double(1);
469  hi = eedetidneg.hashedIndex() + EBDetId::MAX_HASH + 1;
470  if (hi < static_cast<int>(laser->getLaserMap().size())) {
471  laser->setValue(hi, APDPNpair);
472  } else {
473  edm::LogError("EcalTestDevDB") << "error with laser Map (ratio)!";
474  continue;
475  }
476  }
477  }
478 
479  for (int i = 0; i < 92; i++) {
480  if (i < static_cast<int>(laser->getTimeMap().size())) {
481  TimeStamp.t1 = edm::Timestamp(1380 * (i_run - m_firstRun) + 15 * i);
482  TimeStamp.t2 = edm::Timestamp(1380 * (i_run - m_firstRun + 1) + 15 * i);
483  laser->setTime(i, TimeStamp);
484  } else {
485  edm::LogError("EcalTestDevDB") << "error with laser Map (time)!";
486  continue;
487  }
488  }
489 
490  } else {
491  APDPNpair.p1 = (double(1) + 1 / double(log(exp(1) + double((i_run - m_firstRun) * 10)))) / double(2);
492  APDPNpair.p2 = (double(1) + 1 / double(log(exp(1) + double((i_run - m_firstRun) * 10) + double(10)))) / double(2);
493  APDPNpair.p3 = double(0);
494  edm::LogInfo("EcalTestDevDB") << i_run << " " << m_firstRun << " " << APDPNpair.p1 << " " << APDPNpair.p2;
495 
496  for (int iEta = -EBDetId::MAX_IETA; iEta <= EBDetId::MAX_IETA; ++iEta) {
497  if (iEta == 0)
498  continue;
499  for (int iPhi = EBDetId::MIN_IPHI; iPhi <= EBDetId::MAX_IPHI; ++iPhi) {
500  EBDetId ebid(iEta, iPhi);
501  int hi = ebid.hashedIndex();
502 
503  if (hi < static_cast<int>(laser->getLaserMap().size())) {
504  laser->setValue(hi, APDPNpair);
505  } else {
506  edm::LogError("EcalTestDevDB") << "error with laser Map (ratio)!";
507  }
508  }
509  }
510  for (int iX = EEDetId::IX_MIN; iX <= EEDetId::IX_MAX; ++iX) {
511  for (int iY = EEDetId::IY_MIN; iY <= EEDetId::IY_MAX; ++iY) {
512  // make an EEDetId since we need EEDetId::rawId() to be used as the key for the pedestals
513 
514  if (!EEDetId::validDetId(iX, iY, 1))
515  continue;
516 
517  EEDetId eedetidpos(iX, iY, 1);
518  int hi = eedetidpos.hashedIndex() + EBDetId::MAX_HASH + 1;
519  if (hi < static_cast<int>(laser->getLaserMap().size())) {
520  laser->setValue(hi, APDPNpair);
521  } else {
522  edm::LogError("EcalTestDevDB") << "error with laser Map (ratio)!";
523  continue;
524  }
525 
526  if (!EEDetId::validDetId(iX, iY, -1))
527  continue;
528 
529  EEDetId eedetidneg(iX, iY, -1);
530  hi = eedetidneg.hashedIndex() + EBDetId::MAX_HASH + 1;
531  if (hi < static_cast<int>(laser->getLaserMap().size())) {
532  laser->setValue(hi, APDPNpair);
533  } else {
534  edm::LogError("EcalTestDevDB") << "error with laser Map (ratio)!";
535  continue;
536  }
537  }
538  }
539 
540  for (int i = 0; i < 92; i++) {
541  if (i < static_cast<int>(laser->getTimeMap().size())) {
542  TimeStamp.t1 = edm::Timestamp(1380 * (i_run - m_firstRun) + 15 * i);
543  TimeStamp.t2 = edm::Timestamp(1380 * (i_run - m_firstRun + 1) + 15 * i);
544  laser->setTime(i, TimeStamp);
545  } else {
546  edm::LogError("EcalTestDevDB") << "error with laser Map (time)!";
547  continue;
548  }
549  }
550  }
551 
552  return laser;
553 }
static const int MIN_IPHI
Definition: EBDetId.h:135
static std::vector< std::string > checklist log
static const int MAX_HASH
Definition: EBDetId.h:150
Exp< T >::type exp(const T &t)
Definition: Exp.h:22
Log< level::Error, false > LogError
static const int IX_MIN
Definition: EEDetId.h:290
unsigned long m_lastRun
Definition: EcalTestDevDB.h:64
static const int IY_MIN
Definition: EEDetId.h:294
static const int IX_MAX
Definition: EEDetId.h:298
Log< level::Info, false > LogInfo
unsigned long m_firstRun
Definition: EcalTestDevDB.h:63
static const int MAX_IPHI
Definition: EBDetId.h:137
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
Definition: EEDetId.h:248
static const int MAX_IETA
Definition: EBDetId.h:136
static const int IY_MAX
Definition: EEDetId.h:302
std::shared_ptr< EcalLaserAPDPNRatiosRef > EcalTestDevDB::generateEcalLaserAPDPNRatiosRef ( )

Definition at line 556 of file EcalTestDevDB.cc.

References EBDetId::hashedIndex(), EEDetId::hashedIndex(), EEDetId::IX_MAX, EEDetId::IX_MIN, EEDetId::IY_MAX, EEDetId::IY_MIN, EcalCondDBWriter_cfi::laser, EBDetId::MAX_HASH, EBDetId::MAX_IETA, EBDetId::MAX_IPHI, EBDetId::MIN_IPHI, and EEDetId::validDetId().

Referenced by analyze().

556  {
557  //--------------------------------------------------------------
558 
559  auto laser = std::make_shared<EcalLaserAPDPNRatiosRef>();
560 
561  EcalLaserAPDPNref APDPNref;
562 
563  for (int iEta = -EBDetId::MAX_IETA; iEta <= EBDetId::MAX_IETA; ++iEta) {
564  if (iEta == 0)
565  continue;
566  for (int iPhi = EBDetId::MIN_IPHI; iPhi <= EBDetId::MAX_IPHI; ++iPhi) {
567  APDPNref = double(1.5);
568  EBDetId ebid(iEta, iPhi);
569 
570  int hi = ebid.hashedIndex();
571  if (hi < static_cast<int>(laser->getMap().size())) {
572  laser->setValue(hi, APDPNref);
573  } else {
574  edm::LogError("EcalTestDevDB") << "error with laser Map (ref)!";
575  }
576  }
577  }
578 
579  for (int iX = EEDetId::IX_MIN; iX <= EEDetId::IX_MAX; ++iX) {
580  for (int iY = EEDetId::IY_MIN; iY <= EEDetId::IY_MAX; ++iY) {
581  if (!EEDetId::validDetId(iX, iY, 1))
582  continue;
583 
584  EEDetId eedetidpos(iX, iY, 1);
585  APDPNref = double(1.5);
586 
587  int hi = eedetidpos.hashedIndex() + EBDetId::MAX_HASH + 1;
588  if (hi < static_cast<int>(laser->getMap().size())) {
589  laser->setValue(hi, APDPNref);
590  } else {
591  edm::LogError("EcalTestDevDB") << "error with laser Map (ref)!";
592  }
593 
594  if (!EEDetId::validDetId(iX, iY, -1))
595  continue;
596 
597  EEDetId eedetidneg(iX, iY, -1);
598  APDPNref = double(1.5);
599 
600  hi = eedetidneg.hashedIndex() + EBDetId::MAX_HASH + 1;
601  if (hi < static_cast<int>(laser->getMap().size())) {
602  laser->setValue(hi, APDPNref);
603  } else {
604  edm::LogError("EcalTestDevDB") << "error with laser Map (ref)!";
605  }
606  }
607  }
608 
609  return laser;
610 }
static const int MIN_IPHI
Definition: EBDetId.h:135
static const int MAX_HASH
Definition: EBDetId.h:150
Log< level::Error, false > LogError
static const int IX_MIN
Definition: EEDetId.h:290
float EcalLaserAPDPNref
static const int IY_MIN
Definition: EEDetId.h:294
static const int IX_MAX
Definition: EEDetId.h:298
static const int MAX_IPHI
Definition: EBDetId.h:137
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
Definition: EEDetId.h:248
static const int MAX_IETA
Definition: EBDetId.h:136
static const int IY_MAX
Definition: EEDetId.h:302
std::shared_ptr< EcalLinearCorrections > EcalTestDevDB::generateEcalLinearCorrections ( )

Definition at line 258 of file EcalTestDevDB.cc.

References edm::Timestamp::endOfTime(), mps_fire::i, EEDetId::IX_MAX, EEDetId::IX_MIN, EEDetId::IY_MAX, EEDetId::IY_MIN, EBDetId::MAX_IETA, EBDetId::MAX_IPHI, EBDetId::MIN_IPHI, EcalTimeDependentCorrections::Values::p1, EcalTimeDependentCorrections::Values::p2, EcalTimeDependentCorrections::Values::p3, EcalTimeDependentCorrections::Times::t1, EcalTimeDependentCorrections::Times::t2, EcalTimeDependentCorrections::Times::t3, EBDetId::validDetId(), EEDetId::validDetId(), and relativeConstraints::value.

Referenced by analyze().

258  {
259  //-------------------------------------------------------------
260 
261  auto ical = std::make_shared<EcalLinearCorrections>();
262 
263  for (int ieta = -EBDetId::MAX_IETA; ieta <= EBDetId::MAX_IETA; ++ieta) {
264  if (ieta == 0)
265  continue;
266  for (int iphi = EBDetId::MIN_IPHI; iphi <= EBDetId::MAX_IPHI; ++iphi) {
267  if (EBDetId::validDetId(ieta, iphi)) {
268  EBDetId ebid(ieta, iphi);
269 
271  pairAPDPN.p1 = 1.0;
272  pairAPDPN.p2 = 1.0;
273  pairAPDPN.p3 = 1.0;
274  ical->setValue(ebid, pairAPDPN);
275  }
276  }
277  }
278 
279  for (int iX = EEDetId::IX_MIN; iX <= EEDetId::IX_MAX; ++iX) {
280  for (int iY = EEDetId::IY_MIN; iY <= EEDetId::IY_MAX; ++iY) {
281  // make an EEDetId since we need EEDetId::rawId() to be used as the key for the pedestals
282  if (EEDetId::validDetId(iX, iY, 1)) {
283  EEDetId eedetidpos(iX, iY, 1);
284 
286  pairAPDPN.p1 = 1.0;
287  pairAPDPN.p2 = 1.0;
288  pairAPDPN.p3 = 1.0;
289 
290  ical->setValue(eedetidpos, pairAPDPN);
291  }
292 
293  if (EEDetId::validDetId(iX, iY, -1)) {
294  EEDetId eedetidneg(iX, iY, -1);
295 
297  pairAPDPN.p1 = 1.0;
298  pairAPDPN.p2 = 1.0;
299  pairAPDPN.p3 = 1.0;
300 
301  ical->setValue(eedetidneg, pairAPDPN);
302  }
303  }
304  }
305 
307  for (int i = 0; i < 92; i++) {
308  TimeStamp.t1 = edm::Timestamp(0);
311 
312  ical->setTime(i, TimeStamp);
313  }
314 
315  return ical;
316 }
static const int MIN_IPHI
Definition: EBDetId.h:135
static Timestamp endOfTime()
Definition: Timestamp.h:83
static const int IX_MIN
Definition: EEDetId.h:290
static const int IY_MIN
Definition: EEDetId.h:294
static bool validDetId(int i, int j)
check if a valid index combination
Definition: EBDetId.h:118
static const int IX_MAX
Definition: EEDetId.h:298
static const int MAX_IPHI
Definition: EBDetId.h:137
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
Definition: EEDetId.h:248
static const int MAX_IETA
Definition: EBDetId.h:136
static const int IY_MAX
Definition: EEDetId.h:302
std::shared_ptr< EcalPedestals > EcalTestDevDB::generateEcalPedestals ( )

Definition at line 206 of file EcalTestDevDB.cc.

References B2GTnPMonitor_cfi::item, EBDetId::MAX_IETA, EBDetId::MAX_IPHI, EBDetId::MIN_IPHI, and DetId::rawId().

Referenced by analyze().

206  {
207  //-------------------------------------------------------------
208 
209  auto peds = std::make_shared<EcalPedestals>();
211  for (int iEta = -EBDetId::MAX_IETA; iEta <= EBDetId::MAX_IETA; ++iEta) {
212  if (iEta == 0)
213  continue;
214  for (int iPhi = EBDetId::MIN_IPHI; iPhi <= EBDetId::MAX_IPHI; ++iPhi) {
215  item.mean_x1 = 200. * ((double)std::rand() / (double(RAND_MAX) + double(1)));
216  item.rms_x1 = (double)std::rand() / (double(RAND_MAX) + double(1));
217  item.mean_x6 = 1200. * ((double)std::rand() / (double(RAND_MAX) + double(1)));
218  item.rms_x6 = 6. * ((double)std::rand() / (double(RAND_MAX) + double(1)));
219  item.mean_x12 = 2400. * ((double)std::rand() / (double(RAND_MAX) + double(1)));
220  item.rms_x12 = 12. * ((double)std::rand() / (double(RAND_MAX) + double(1)));
221 
222  EBDetId ebdetid(iEta, iPhi);
223  peds->insert(std::make_pair(ebdetid.rawId(), item));
224  }
225  }
226  return peds;
227 }
static const int MIN_IPHI
Definition: EBDetId.h:135
static const int MAX_IPHI
Definition: EBDetId.h:137
static const int MAX_IETA
Definition: EBDetId.h:136
std::shared_ptr< EcalTBWeights > EcalTestDevDB::generateEcalTBWeights ( )

Definition at line 361 of file EcalTestDevDB.cc.

References EcalWeightSet::getChi2WeightsAfterGainSwitch(), EcalWeightSet::getChi2WeightsBeforeGainSwitch(), EcalWeightSet::getWeightsAfterGainSwitch(), EcalWeightSet::getWeightsBeforeGainSwitch(), mps_fire::i, dqmiolumiharvest::j, EBDetId::MAX_IETA, and alignCSCRings::r.

Referenced by analyze().

361  {
362  //-------------------------------------------------------------
363 
364  auto tbwgt = std::make_shared<EcalTBWeights>();
365 
366  // create weights for each distinct group ID
367  int nMaxTDC = 10;
368  for (int igrp = -EBDetId::MAX_IETA; igrp <= EBDetId::MAX_IETA; ++igrp) {
369  if (igrp == 0)
370  continue;
371  for (int itdc = 1; itdc <= nMaxTDC; ++itdc) {
372  // generate random number
373  double r = (double)std::rand() / (double(RAND_MAX) + double(1));
374 
375  // make a new set of weights
376  EcalWeightSet wgt;
379 
380  for (size_t i = 0; i < 3; ++i) {
381  for (size_t j = 0; j < 10; ++j) {
382  double ww = igrp * itdc * r + i * 10. + j;
383  mat1(i, j) = ww;
384  mat2(i, j) = 100 + ww;
385  }
386  }
387 
388  // fill the chi2 matrcies
389  r = (double)std::rand() / (double(RAND_MAX) + double(1));
392  for (size_t i = 0; i < 10; ++i) {
393  for (size_t j = 0; j < 10; ++j) {
394  double ww = igrp * itdc * r + i * 10. + j;
395  mat3(i, j) = 1000 + ww;
396  mat4(i, j) = 1000 + 100 + ww;
397  }
398  }
399 
400  // put the weight in the container
401  tbwgt->setValue(std::make_pair(igrp, itdc), wgt);
402  }
403  }
404  return tbwgt;
405 }
Definition: mat4.h:9
EcalChi2WeightMatrix & getChi2WeightsBeforeGainSwitch()
Definition: EcalWeightSet.h:28
math::Matrix< 10, 10 >::type EcalChi2WeightMatrix
Definition: EcalWeightSet.h:20
math::Matrix< 3, 10 >::type EcalWeightMatrix
Definition: EcalWeightSet.h:19
EcalChi2WeightMatrix & getChi2WeightsAfterGainSwitch()
Definition: EcalWeightSet.h:29
EcalWeightMatrix & getWeightsAfterGainSwitch()
Definition: EcalWeightSet.h:27
EcalWeightMatrix & getWeightsBeforeGainSwitch()
Definition: EcalWeightSet.h:26
static const int MAX_IETA
Definition: EBDetId.h:136
std::shared_ptr< EcalWeightXtalGroups > EcalTestDevDB::generateEcalWeightXtalGroups ( )

Definition at line 345 of file EcalTestDevDB.cc.

References EBDetId::MAX_IETA, EBDetId::MAX_IPHI, EBDetId::MIN_IPHI, and DetId::rawId().

Referenced by analyze().

345  {
346  //-------------------------------------------------------------
347 
348  auto xtalGroups = std::make_shared<EcalWeightXtalGroups>();
349  for (int ieta = -EBDetId::MAX_IETA; ieta <= EBDetId::MAX_IETA; ++ieta) {
350  if (ieta == 0)
351  continue;
352  for (int iphi = EBDetId::MIN_IPHI; iphi <= EBDetId::MAX_IPHI; ++iphi) {
353  EBDetId ebid(ieta, iphi);
354  xtalGroups->setValue(ebid.rawId(), EcalXtalGroupId(ieta)); // define rings in eta
355  }
356  }
357  return xtalGroups;
358 }
static const int MIN_IPHI
Definition: EBDetId.h:135
static const int MAX_IPHI
Definition: EBDetId.h:137
static const int MAX_IETA
Definition: EBDetId.h:136

Member Data Documentation

std::map<std::string, unsigned long long> EcalTestDevDB::m_cacheIDs
private

Definition at line 61 of file EcalTestDevDB.h.

Referenced by EcalTestDevDB().

unsigned long EcalTestDevDB::m_firstRun
private

Definition at line 63 of file EcalTestDevDB.h.

Referenced by analyze(), EcalTestDevDB(), and generateEcalLaserAPDPNRatios().

unsigned int EcalTestDevDB::m_interval
private

Definition at line 65 of file EcalTestDevDB.h.

Referenced by analyze(), and EcalTestDevDB().

unsigned long EcalTestDevDB::m_lastRun
private

Definition at line 64 of file EcalTestDevDB.h.

Referenced by analyze(), EcalTestDevDB(), and generateEcalLaserAPDPNRatios().

std::map<std::string, std::string> EcalTestDevDB::m_records
private

Definition at line 62 of file EcalTestDevDB.h.

Referenced by analyze(), and EcalTestDevDB().

std::string EcalTestDevDB::m_timetype
private

Definition at line 60 of file EcalTestDevDB.h.