CMS 3D CMS Logo

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

#include <EcalTPGDBCopy.h>

Inheritance diagram for EcalTPGDBCopy:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &evt, const edm::EventSetup &evtSetup) override
 
 EcalTPGDBCopy (const edm::ParameterSet &iConfig)
 
 ~EcalTPGDBCopy () 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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (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::vector< ModuleDescription const * > &modules, 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
 
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 copyToDB (const edm::EventSetup &evtSetup, std::string container)
 
bool shouldCopy (const edm::EventSetup &evtSetup, std::string container)
 

Private Attributes

std::map< std::string, unsigned long long > m_cacheIDs
 
std::map< std::string, std::string > m_records
 
std::string m_timetype
 

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 wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
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<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)
 

Detailed Description

Definition at line 18 of file EcalTPGDBCopy.h.

Constructor & Destructor Documentation

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

Definition at line 47 of file EcalTPGDBCopy.cc.

References edm::ParameterSet::getParameter(), mps_fire::i, m_cacheIDs, m_records, record, AlCaHLTBitMon_QueryRunRegistry::string, and GlobalPosition_Frontier_DevDB_cff::tag.

48  : m_timetype(iConfig.getParameter<std::string>("timetype")), m_cacheIDs(), m_records() {
49  std::string container;
52  typedef std::vector<edm::ParameterSet> Parameters;
53  Parameters toCopy = iConfig.getParameter<Parameters>("toCopy");
54  for (Parameters::iterator i = toCopy.begin(); i != toCopy.end(); ++i) {
55  container = i->getParameter<std::string>("container");
56  record = i->getParameter<std::string>("record");
57  m_cacheIDs.insert(std::make_pair(container, 0));
58  m_records.insert(std::make_pair(container, record));
59  }
60 }
T getParameter(std::string const &) const
std::string m_timetype
Definition: EcalTPGDBCopy.h:29
std::map< std::string, unsigned long long > m_cacheIDs
Definition: EcalTPGDBCopy.h:30
JetCorrectorParameters::Record record
Definition: classes.h:7
std::map< std::string, std::string > m_records
Definition: EcalTPGDBCopy.h:31
vector< ParameterSet > Parameters
EcalTPGDBCopy::~EcalTPGDBCopy ( )
override

Definition at line 62 of file EcalTPGDBCopy.cc.

62 {}

Member Function Documentation

void EcalTPGDBCopy::analyze ( const edm::Event evt,
const edm::EventSetup evtSetup 
)
override

Definition at line 64 of file EcalTPGDBCopy.cc.

References copyToDB(), mps_fire::i, m_records, record, shouldCopy(), and AlCaHLTBitMon_QueryRunRegistry::string.

64  {
65  std::string container;
67  typedef std::map<std::string, std::string>::const_iterator recordIter;
68  for (recordIter i = m_records.begin(); i != m_records.end(); ++i) {
69  container = (*i).first;
70  record = (*i).second;
71  if (shouldCopy(evtSetup, container)) {
72  copyToDB(evtSetup, container);
73  }
74  }
75 }
JetCorrectorParameters::Record record
Definition: classes.h:7
std::map< std::string, std::string > m_records
Definition: EcalTPGDBCopy.h:31
void copyToDB(const edm::EventSetup &evtSetup, std::string container)
bool shouldCopy(const edm::EventSetup &evtSetup, std::string container)
void EcalTPGDBCopy::copyToDB ( const edm::EventSetup evtSetup,
std::string  container 
)
private

Definition at line 124 of file EcalTPGDBCopy.cc.

References cond::service::PoolDBOutputService::beginOfTime(), gather_cfg::cout, cond::service::PoolDBOutputService::createNewIOV(), cond::service::PoolDBOutputService::endOfTime(), Exception, edm::EventSetup::get(), patZpeak::handle, edm::Service< T >::isAvailable(), m_records, getGTfromDQMFile::obj, edm::ESHandle< T >::product(), align_cfg::recordName, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by analyze().

124  {
126  if (!dbOutput.isAvailable()) {
127  throw cms::Exception("PoolDBOutputService is not available");
128  }
129 
130  std::string recordName = m_records[container];
131 
132  if (container == "EcalTPGPedestals") {
134  evtSetup.get<EcalTPGPedestalsRcd>().get(handle);
135  const EcalTPGPedestals* obj = handle.product();
136  dbOutput->createNewIOV<const EcalTPGPedestals>(
137  new EcalTPGPedestals(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName);
138 
139  } else if (container == "EcalTPGLinearizationConst") {
141  evtSetup.get<EcalTPGLinearizationConstRcd>().get(handle);
142  const EcalTPGLinearizationConst* obj = handle.product();
143 
144  dbOutput->createNewIOV<const EcalTPGLinearizationConst>(
145  new EcalTPGLinearizationConst(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName);
146 
147  } else if (container == "EcalTPGSlidingWindow") {
149  evtSetup.get<EcalTPGSlidingWindowRcd>().get(handle);
150  const EcalTPGSlidingWindow* obj = handle.product();
151 
152  dbOutput->createNewIOV<const EcalTPGSlidingWindow>(
153  new EcalTPGSlidingWindow(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName);
154 
155  } else if (container == "EcalTPGFineGrainEBIdMap") {
157  evtSetup.get<EcalTPGFineGrainEBIdMapRcd>().get(handle);
158  const EcalTPGFineGrainEBIdMap* obj = handle.product();
159  dbOutput->createNewIOV<const EcalTPGFineGrainEBIdMap>(
160  new EcalTPGFineGrainEBIdMap(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName);
161 
162  } else if (container == "EcalTPGFineGrainStripEE") {
164  evtSetup.get<EcalTPGFineGrainStripEERcd>().get(handle);
165  const EcalTPGFineGrainStripEE* obj = handle.product();
166  dbOutput->createNewIOV<const EcalTPGFineGrainStripEE>(
167  new EcalTPGFineGrainStripEE(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName);
168 
169  } else if (container == "EcalTPGFineGrainTowerEE") {
171  evtSetup.get<EcalTPGFineGrainTowerEERcd>().get(handle);
172  const EcalTPGFineGrainTowerEE* obj = handle.product();
173  dbOutput->createNewIOV<const EcalTPGFineGrainTowerEE>(
174  new EcalTPGFineGrainTowerEE(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName);
175 
176  } else if (container == "EcalTPGLutIdMap") {
178  evtSetup.get<EcalTPGLutIdMapRcd>().get(handle);
179  const EcalTPGLutIdMap* obj = handle.product();
180  dbOutput->createNewIOV<const EcalTPGLutIdMap>(
181  new EcalTPGLutIdMap(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName);
182 
183  } else if (container == "EcalTPGWeightIdMap") {
185  evtSetup.get<EcalTPGWeightIdMapRcd>().get(handle);
186  const EcalTPGWeightIdMap* obj = handle.product();
187  dbOutput->createNewIOV<const EcalTPGWeightIdMap>(
188  new EcalTPGWeightIdMap(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName);
189 
190  } else if (container == "EcalTPGWeightGroup") {
192  evtSetup.get<EcalTPGWeightGroupRcd>().get(handle);
193  const EcalTPGWeightGroup* obj = handle.product();
194  dbOutput->createNewIOV<const EcalTPGWeightGroup>(
195  new EcalTPGWeightGroup(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName);
196 
197  } else if (container == "EcalTPGLutGroup") {
199  evtSetup.get<EcalTPGLutGroupRcd>().get(handle);
200  const EcalTPGLutGroup* obj = handle.product();
201  dbOutput->createNewIOV<const EcalTPGLutGroup>(
202  new EcalTPGLutGroup(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName);
203 
204  } else if (container == "EcalTPGFineGrainEBGroup") {
206  evtSetup.get<EcalTPGFineGrainEBGroupRcd>().get(handle);
207 
208  const EcalTPGFineGrainEBGroup* obj = handle.product();
209 
210  dbOutput->createNewIOV<const EcalTPGFineGrainEBGroup>(
211  new EcalTPGFineGrainEBGroup(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName);
212 
213  } else if (container == "EcalTPGPhysicsConst") {
215  evtSetup.get<EcalTPGPhysicsConstRcd>().get(handle);
216  const EcalTPGPhysicsConst* obj = handle.product();
217  dbOutput->createNewIOV<const EcalTPGPhysicsConst>(
218  new EcalTPGPhysicsConst(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName);
219 
220  } else if (container == "EcalTPGCrystalStatus") {
222  evtSetup.get<EcalTPGCrystalStatusRcd>().get(handle);
223  const EcalTPGCrystalStatus* obj = handle.product();
224  dbOutput->createNewIOV<const EcalTPGCrystalStatus>(
225  new EcalTPGCrystalStatus(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName);
226 
227  } else if (container == "EcalTPGTowerStatus") {
229  evtSetup.get<EcalTPGTowerStatusRcd>().get(handle);
230  const EcalTPGTowerStatus* obj = handle.product();
231  dbOutput->createNewIOV<const EcalTPGTowerStatus>(
232  new EcalTPGTowerStatus(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName);
233 
234  } else if (container == "EcalTPGSpike") {
236  evtSetup.get<EcalTPGSpikeRcd>().get(handle);
237  const EcalTPGSpike* obj = handle.product();
238 
239  dbOutput->createNewIOV<const EcalTPGSpike>(
240  new EcalTPGSpike(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName);
241 
242  } else if (container == "EcalTPGStripStatus") {
244  evtSetup.get<EcalTPGStripStatusRcd>().get(handle);
245  const EcalTPGStripStatus* obj = handle.product();
246  dbOutput->createNewIOV<const EcalTPGStripStatus>(
247  new EcalTPGStripStatus(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName);
248 
249  }
250 
251  else {
252  throw cms::Exception("Unknown container");
253  }
254 
255  std::cout << "EcalTPGDBCopy wrote " << recordName << std::endl;
256 }
std::map< std::string, std::string > m_records
Definition: EcalTPGDBCopy.h:31
bool isAvailable() const
Definition: Service.h:40
EcalTPGCrystalStatusMap EcalTPGCrystalStatus
void createNewIOV(T *firstPayloadObj, cond::Time_t firstSinceTime, cond::Time_t firstTillTime, const std::string &recordName, bool withlogging=false)
T get() const
Definition: EventSetup.h:73
EcalTPGPedestalsMap EcalTPGPedestals
T const * product() const
Definition: ESHandle.h:86
EcalTPGLinearizationConstMap EcalTPGLinearizationConst
bool EcalTPGDBCopy::shouldCopy ( const edm::EventSetup evtSetup,
std::string  container 
)
private

Definition at line 77 of file EcalTPGDBCopy.cc.

References Exception, edm::EventSetup::get(), and m_cacheIDs.

Referenced by analyze().

77  {
78  unsigned long long cacheID = 0;
79 
80  if (container == "EcalTPGPedestals") {
81  cacheID = evtSetup.get<EcalTPGPedestalsRcd>().cacheIdentifier();
82  } else if (container == "EcalTPGLinearizationConst") {
83  cacheID = evtSetup.get<EcalTPGLinearizationConstRcd>().cacheIdentifier();
84  } else if (container == "EcalTPGSlidingWindow") {
85  cacheID = evtSetup.get<EcalTPGSlidingWindowRcd>().cacheIdentifier();
86  } else if (container == "EcalTPGFineGrainEBIdMap") {
87  cacheID = evtSetup.get<EcalTPGFineGrainEBIdMapRcd>().cacheIdentifier();
88  } else if (container == "EcalTPGFineGrainStripEE") {
89  cacheID = evtSetup.get<EcalTPGFineGrainStripEERcd>().cacheIdentifier();
90  } else if (container == "EcalTPGFineGrainTowerEE") {
91  cacheID = evtSetup.get<EcalTPGFineGrainTowerEERcd>().cacheIdentifier();
92  } else if (container == "EcalTPGLutIdMap") {
93  cacheID = evtSetup.get<EcalTPGLutIdMapRcd>().cacheIdentifier();
94  } else if (container == "EcalTPGWeightIdMap") {
95  cacheID = evtSetup.get<EcalTPGWeightIdMapRcd>().cacheIdentifier();
96  } else if (container == "EcalTPGWeightGroup") {
97  cacheID = evtSetup.get<EcalTPGWeightGroupRcd>().cacheIdentifier();
98  } else if (container == "EcalTPGLutGroup") {
99  cacheID = evtSetup.get<EcalTPGLutGroupRcd>().cacheIdentifier();
100  } else if (container == "EcalTPGFineGrainEBGroup") {
101  cacheID = evtSetup.get<EcalTPGFineGrainEBGroupRcd>().cacheIdentifier();
102  } else if (container == "EcalTPGPhysicsConst") {
103  cacheID = evtSetup.get<EcalTPGPhysicsConstRcd>().cacheIdentifier();
104  } else if (container == "EcalTPGCrystalStatus") {
105  cacheID = evtSetup.get<EcalTPGCrystalStatusRcd>().cacheIdentifier();
106  } else if (container == "EcalTPGTowerStatus") {
107  cacheID = evtSetup.get<EcalTPGTowerStatusRcd>().cacheIdentifier();
108  } else if (container == "EcalTPGSpike") {
109  cacheID = evtSetup.get<EcalTPGSpikeRcd>().cacheIdentifier();
110  } else if (container == "EcalTPGStripStatus") {
111  cacheID = evtSetup.get<EcalTPGStripStatusRcd>().cacheIdentifier();
112  } else {
113  throw cms::Exception("Unknown container");
114  }
115 
116  if (m_cacheIDs[container] == cacheID) {
117  return false;
118  } else {
119  m_cacheIDs[container] = cacheID;
120  return true;
121  }
122 }
std::map< std::string, unsigned long long > m_cacheIDs
Definition: EcalTPGDBCopy.h:30
T get() const
Definition: EventSetup.h:73

Member Data Documentation

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

Definition at line 30 of file EcalTPGDBCopy.h.

Referenced by EcalTPGDBCopy(), and shouldCopy().

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

Definition at line 31 of file EcalTPGDBCopy.h.

Referenced by analyze(), copyToDB(), and EcalTPGDBCopy().

std::string EcalTPGDBCopy::m_timetype
private

Definition at line 29 of file EcalTPGDBCopy.h.