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
 
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)
 
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 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 51 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.

51  :
52  m_timetype(iConfig.getParameter<std::string>("timetype")),
53  m_cacheIDs(),
54  m_records()
55 {
56 
57  std::string container;
60  typedef std::vector< edm::ParameterSet > Parameters;
61  Parameters toCopy = iConfig.getParameter<Parameters>("toCopy");
62  for(Parameters::iterator i = toCopy.begin(); i != toCopy.end(); ++i) {
63  container = i->getParameter<std::string>("container");
64  record = i->getParameter<std::string>("record");
65  m_cacheIDs.insert( std::make_pair(container, 0) );
66  m_records.insert( std::make_pair(container, record) );
67  }
68 
69 }
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 72 of file EcalTPGDBCopy.cc.

73 {
74 
75 }

Member Function Documentation

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

Definition at line 77 of file EcalTPGDBCopy.cc.

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

78 {
79  std::string container;
81  typedef std::map<std::string, std::string>::const_iterator recordIter;
82  for (recordIter i = m_records.begin(); i != m_records.end(); ++i) {
83  container = (*i).first;
84  record = (*i).second;
85  if ( shouldCopy(evtSetup, container) ) {
86  copyToDB(evtSetup, container);
87  }
88  }
89 
90 }
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 147 of file EcalTPGDBCopy.cc.

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

Referenced by analyze().

148 {
149 
151  if ( !dbOutput.isAvailable() ) {
152  throw cms::Exception("PoolDBOutputService is not available");
153  }
154 
155 
156  std::string recordName = m_records[container];
157 
158 
159  if (container == "EcalTPGPedestals") {
161  evtSetup.get<EcalTPGPedestalsRcd>().get(handle);
162  const EcalTPGPedestals* obj = handle.product();
163  dbOutput->createNewIOV<const EcalTPGPedestals>( new EcalTPGPedestals(*obj), dbOutput->beginOfTime(),dbOutput->endOfTime(),recordName);
164 
165  } else if (container == "EcalTPGLinearizationConst") {
167  evtSetup.get<EcalTPGLinearizationConstRcd>().get(handle);
168  const EcalTPGLinearizationConst* obj = handle.product();
169 
170  dbOutput->createNewIOV<const EcalTPGLinearizationConst>( new EcalTPGLinearizationConst(*obj),dbOutput->beginOfTime(), dbOutput->endOfTime(),recordName);
171 
172  } else if (container == "EcalTPGSlidingWindow") {
174  evtSetup.get<EcalTPGSlidingWindowRcd>().get(handle);
175  const EcalTPGSlidingWindow* obj = handle.product();
176 
177  dbOutput->createNewIOV<const EcalTPGSlidingWindow>( new EcalTPGSlidingWindow(*obj),dbOutput->beginOfTime(), dbOutput->endOfTime(),recordName);
178 
179  } else if (container == "EcalTPGFineGrainEBIdMap") {
181  evtSetup.get<EcalTPGFineGrainEBIdMapRcd>().get(handle);
182  const EcalTPGFineGrainEBIdMap* obj = handle.product();
183  dbOutput->createNewIOV<const EcalTPGFineGrainEBIdMap>( new EcalTPGFineGrainEBIdMap(*obj),dbOutput->beginOfTime(), dbOutput->endOfTime(),recordName);
184 
185  } else if (container == "EcalTPGFineGrainStripEE") {
187  evtSetup.get<EcalTPGFineGrainStripEERcd>().get(handle);
188  const EcalTPGFineGrainStripEE* obj = handle.product();
189  dbOutput->createNewIOV<const EcalTPGFineGrainStripEE>( new EcalTPGFineGrainStripEE(*obj),dbOutput->beginOfTime(), dbOutput->endOfTime(),recordName);
190 
191  } else if (container == "EcalTPGFineGrainTowerEE") {
193  evtSetup.get<EcalTPGFineGrainTowerEERcd>().get(handle);
194  const EcalTPGFineGrainTowerEE* obj = handle.product();
195  dbOutput->createNewIOV<const EcalTPGFineGrainTowerEE>( new EcalTPGFineGrainTowerEE(*obj),dbOutput->beginOfTime(), dbOutput->endOfTime(),recordName);
196 
197  } else if (container == "EcalTPGLutIdMap") {
199  evtSetup.get<EcalTPGLutIdMapRcd>().get(handle);
200  const EcalTPGLutIdMap* obj = handle.product();
201  dbOutput->createNewIOV<const EcalTPGLutIdMap>( new EcalTPGLutIdMap(*obj),dbOutput->beginOfTime(), dbOutput->endOfTime(),recordName);
202 
203  } else if (container == "EcalTPGWeightIdMap") {
205  evtSetup.get<EcalTPGWeightIdMapRcd>().get(handle);
206  const EcalTPGWeightIdMap* obj = handle.product();
207  dbOutput->createNewIOV<const EcalTPGWeightIdMap>( new EcalTPGWeightIdMap(*obj), dbOutput->beginOfTime(),dbOutput->endOfTime(),recordName);
208 
209  } else if (container == "EcalTPGWeightGroup") {
211  evtSetup.get<EcalTPGWeightGroupRcd>().get(handle);
212  const EcalTPGWeightGroup* obj = handle.product();
213  dbOutput->createNewIOV<const EcalTPGWeightGroup>( new EcalTPGWeightGroup(*obj),dbOutput->beginOfTime(), dbOutput->endOfTime(),recordName);
214 
215  } else if (container == "EcalTPGLutGroup") {
217  evtSetup.get<EcalTPGLutGroupRcd>().get(handle);
218  const EcalTPGLutGroup* obj = handle.product();
219  dbOutput->createNewIOV<const EcalTPGLutGroup>( new EcalTPGLutGroup(*obj),dbOutput->beginOfTime(), dbOutput->endOfTime(),recordName);
220 
221  } else if (container == "EcalTPGFineGrainEBGroup") {
222 
224  evtSetup.get<EcalTPGFineGrainEBGroupRcd>().get(handle);
225 
226  const EcalTPGFineGrainEBGroup* obj = handle.product();
227 
228  dbOutput->createNewIOV<const EcalTPGFineGrainEBGroup>( new EcalTPGFineGrainEBGroup(*obj),dbOutput->beginOfTime(), dbOutput->endOfTime(),recordName);
229 
230  } else if (container == "EcalTPGPhysicsConst") {
232  evtSetup.get<EcalTPGPhysicsConstRcd>().get(handle);
233  const EcalTPGPhysicsConst* obj = handle.product();
234  dbOutput->createNewIOV<const EcalTPGPhysicsConst>( new EcalTPGPhysicsConst(*obj),dbOutput->beginOfTime(), dbOutput->endOfTime(),recordName);
235 
236  } else if (container == "EcalTPGCrystalStatus") {
238  evtSetup.get<EcalTPGCrystalStatusRcd>().get(handle);
239  const EcalTPGCrystalStatus* obj = handle.product();
240  dbOutput->createNewIOV<const EcalTPGCrystalStatus>( new EcalTPGCrystalStatus(*obj),dbOutput->beginOfTime(), dbOutput->endOfTime(),recordName);
241 
242  } else if (container == "EcalTPGTowerStatus") {
244  evtSetup.get<EcalTPGTowerStatusRcd>().get(handle);
245  const EcalTPGTowerStatus* obj = handle.product();
246  dbOutput->createNewIOV<const EcalTPGTowerStatus>( new EcalTPGTowerStatus(*obj),dbOutput->beginOfTime(), dbOutput->endOfTime(),recordName);
247 
248  } else if (container == "EcalTPGSpike") {
249 
251  evtSetup.get<EcalTPGSpikeRcd>().get(handle);
252  const EcalTPGSpike* obj = handle.product();
253 
254  dbOutput->createNewIOV<const EcalTPGSpike>( new EcalTPGSpike(*obj),dbOutput->beginOfTime(), dbOutput->endOfTime(),recordName);
255 
256  } else if (container == "EcalTPGStripStatus") {
257 
259  evtSetup.get<EcalTPGStripStatusRcd>().get(handle);
260  const EcalTPGStripStatus* obj = handle.product();
261  dbOutput->createNewIOV<const EcalTPGStripStatus>( new EcalTPGStripStatus(*obj),dbOutput->beginOfTime(), dbOutput->endOfTime(),recordName);
262 
263  }
264 
265  else {
266  throw cms::Exception("Unknown container");
267  }
268 
269  std::cout<< "EcalTPGDBCopy wrote " << recordName << std::endl;
270 }
std::map< std::string, std::string > m_records
Definition: EcalTPGDBCopy.h:31
bool isAvailable() const
Definition: Service.h:46
EcalTPGCrystalStatusMap EcalTPGCrystalStatus
void createNewIOV(T *firstPayloadObj, cond::Time_t firstSinceTime, cond::Time_t firstTillTime, const std::string &recordName, bool withlogging=false)
const T & get() const
Definition: EventSetup.h:59
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 94 of file EcalTPGDBCopy.cc.

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

Referenced by analyze().

95 {
96 
97  unsigned long long cacheID = 0;
98 
99  if (container == "EcalTPGPedestals") {
100  cacheID = evtSetup.get<EcalTPGPedestalsRcd>().cacheIdentifier();
101  } else if (container == "EcalTPGLinearizationConst") {
102  cacheID = evtSetup.get<EcalTPGLinearizationConstRcd>().cacheIdentifier();
103  } else if (container == "EcalTPGSlidingWindow") {
104  cacheID = evtSetup.get<EcalTPGSlidingWindowRcd>().cacheIdentifier();
105  } else if (container == "EcalTPGFineGrainEBIdMap") {
106  cacheID = evtSetup.get<EcalTPGFineGrainEBIdMapRcd>().cacheIdentifier();
107  } else if (container == "EcalTPGFineGrainStripEE") {
108  cacheID = evtSetup.get<EcalTPGFineGrainStripEERcd>().cacheIdentifier();
109  } else if (container == "EcalTPGFineGrainTowerEE") {
110  cacheID = evtSetup.get<EcalTPGFineGrainTowerEERcd>().cacheIdentifier();
111  } else if (container == "EcalTPGLutIdMap") {
112  cacheID = evtSetup.get<EcalTPGLutIdMapRcd>().cacheIdentifier();
113  } else if (container == "EcalTPGWeightIdMap") {
114  cacheID = evtSetup.get<EcalTPGWeightIdMapRcd>().cacheIdentifier();
115  } else if (container == "EcalTPGWeightGroup") {
116  cacheID = evtSetup.get<EcalTPGWeightGroupRcd>().cacheIdentifier();
117  } else if (container == "EcalTPGLutGroup") {
118  cacheID = evtSetup.get<EcalTPGLutGroupRcd>().cacheIdentifier();
119  } else if (container == "EcalTPGFineGrainEBGroup") {
120  cacheID = evtSetup.get<EcalTPGFineGrainEBGroupRcd>().cacheIdentifier();
121  } else if (container == "EcalTPGPhysicsConst") {
122  cacheID = evtSetup.get<EcalTPGPhysicsConstRcd>().cacheIdentifier();
123  } else if (container == "EcalTPGCrystalStatus") {
124  cacheID = evtSetup.get<EcalTPGCrystalStatusRcd>().cacheIdentifier();
125  } else if (container == "EcalTPGTowerStatus") {
126  cacheID = evtSetup.get<EcalTPGTowerStatusRcd>().cacheIdentifier();
127  } else if (container == "EcalTPGSpike") {
128  cacheID = evtSetup.get<EcalTPGSpikeRcd>().cacheIdentifier();
129  } else if (container == "EcalTPGStripStatus") {
130  cacheID = evtSetup.get<EcalTPGStripStatusRcd>().cacheIdentifier();
131  }
132  else {
133  throw cms::Exception("Unknown container");
134  }
135 
136  if (m_cacheIDs[container] == cacheID) {
137  return false;
138  } else {
139  m_cacheIDs[container] = cacheID;
140  return true;
141  }
142 
143 }
std::map< std::string, unsigned long long > m_cacheIDs
Definition: EcalTPGDBCopy.h:30
const T & get() const
Definition: EventSetup.h:59

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.