CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Classes | Typedefs | Functions
hcalCalibrationsCopy.cc File Reference
#include <stdlib.h>
#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <map>
#include <algorithm>
#include <string>
#include "DataFormats/HcalDetId/interface/HcalDetId.h"
#include "DataFormats/HcalDetId/interface/HcalTrigTowerDetId.h"
#include "DataFormats/HcalDetId/interface/HcalElectronicsId.h"
#include "Geometry/CaloTopology/interface/HcalTopology.h"
#include "CondCore/IOVService/interface/IOV.h"
#include "CalibCalorimetry/HcalAlgos/interface/HcalDbHardcode.h"
#include "CalibCalorimetry/HcalAlgos/interface/HcalDbASCIIIO.h"
#include "CondTools/Hcal/interface/HcalDbXml.h"
#include "CondTools/Hcal/interface/HcalDbOnline.h"
#include "CondTools/Hcal/interface/HcalDbTool.h"
#include "CondFormats/HcalObjects/interface/HcalPedestals.h"
#include "CondFormats/HcalObjects/interface/HcalPedestalWidths.h"
#include "CondFormats/HcalObjects/interface/HcalGains.h"
#include "CondFormats/HcalObjects/interface/HcalGainWidths.h"
#include "CondFormats/HcalObjects/interface/HcalElectronicsMap.h"
#include "CondFormats/HcalObjects/interface/HcalChannelQuality.h"
#include "CondFormats/HcalObjects/interface/HcalQIEData.h"
#include "CondFormats/HcalObjects/interface/HcalCalibrationQIEData.h"
#include "FWCore/MessageService/interface/MessageServicePresence.h"

Go to the source code of this file.

Classes

class  Args
 

Typedefs

typedef std::map< IOVRun,
std::string > 
IOVCollection
 
typedef HcalDbTool::IOVRun IOVRun
 

Functions

bool asciiFile (const std::string fParam)
 
template<class T >
bool copyObject (T *fObject, const std::string &fInput, const std::string &fInputTag, HcalDbTool::IOVRun fInputRun, const std::string &fOutput, const std::string &fOutputTag, HcalDbTool::IOVRun fOutputRun, bool fAppend, unsigned long long fIovgmtbegin, unsigned long long fIovgmtend, unsigned fNread, unsigned fNwrite, unsigned fNtrace, bool fVerbose, const char *fInputCatalog, const char *fOutputCatalog, bool fXmlAuth)
 
bool dbFile (const std::string fParam)
 
bool defaultsFile (const std::string fParam)
 
void fillDefaults (HcalPedestals *&fPedestals)
 
void fillDefaults (HcalPedestalWidths *&fPedestals)
 
void fillDefaults (HcalGains *&fGains)
 
void fillDefaults (HcalGainWidths *&fGains)
 
void fillDefaults (HcalElectronicsMap *&fMap)
 
void fillDefaults (HcalQIEData *&fObject)
 
void fillDefaults (HcalCalibrationQIEData *&fObject)
 
int main (int argn, char *argv[])
 
bool occiFile (const std::string fParam)
 
bool onlineFile (const std::string fParam)
 
void printHelp (const Args &args)
 
template<class T >
std::vector< HcalDetIdundefinedCells (const T &fData)
 
bool xmlFile (const std::string fParam)
 

Typedef Documentation

typedef std::map<IOVRun,std::string> IOVCollection

Definition at line 43 of file hcalCalibrationsCopy.cc.

typedef HcalDbTool::IOVRun IOVRun

Definition at line 42 of file hcalCalibrationsCopy.cc.

Function Documentation

bool asciiFile ( const std::string  fParam)

Definition at line 210 of file hcalCalibrationsCopy.cc.

Referenced by copyObject().

210  {
211  return fParam.find (':') == std::string::npos && std::string (fParam, fParam.length () - 4) == ".txt";
212 }
template<class T >
bool copyObject ( T fObject,
const std::string &  fInput,
const std::string &  fInputTag,
HcalDbTool::IOVRun  fInputRun,
const std::string &  fOutput,
const std::string &  fOutputTag,
HcalDbTool::IOVRun  fOutputRun,
bool  fAppend,
unsigned long long  fIovgmtbegin,
unsigned long long  fIovgmtend,
unsigned  fNread,
unsigned  fNwrite,
unsigned  fNtrace,
bool  fVerbose,
const char *  fInputCatalog,
const char *  fOutputCatalog,
bool  fXmlAuth 
)

Definition at line 232 of file hcalCalibrationsCopy.cc.

References asciiFile(), dtNoiseDBValidation_cfg::cerr, gather_cfg::cout, dbFile(), defaultsFile(), HcalDbXml::dumpObject(), HcalDbASCIIIO::dumpObject(), fillDefaults(), first, HcalDbOnline::getIOVs(), HcalDbASCIIIO::getObject(), HcalDbOnline::getObject(), i, o2o::iov, dbtoconf::object, onlineFile(), query::result, edm::second(), lumiQTWidget::t, cond::rpcobgas::time, and xmlFile().

Referenced by main().

240  {
241  typedef std::vector <std::pair<HcalDbTool::IOVRun, T*> > Objects;
242 
243  bool result = false;
244  time_t t0 = time (0);
245  time_t t1 = t0;
246  unsigned traceCounter = 0;
247  HcalDbTool* poolDb = 0;
248  HcalDbOnline* onlineDb = 0;
249  // HcalDbToolOCCI* occiDb = 0;
250  Objects allInstances;
251  while (traceCounter < fNread) {
252  delete fObject;
253  // get input
254  if (defaultsFile (fInput)) {
255  if (!traceCounter) std::cout << "USE INPUT: defaults" << std::endl;
256  fillDefaults (fObject);
257  result = true;
258  }
259  else if (asciiFile (fInput)) {
260  if (!traceCounter) std::cout << "USE INPUT: ASCII: " << fInput << std::endl;
261  std::ifstream inStream (fInput.c_str ());
262  fObject = new T;
263  HcalDbASCIIIO::getObject (inStream, fObject);
264  result = true;
265  }
266  else if (dbFile (fInput)) {
267  if (!traceCounter) std::cout << "USE INPUT: Pool: " << fInput << "/" << fInputRun << std::endl;
268  if (!poolDb) poolDb = new HcalDbTool (fInput, fVerbose, fXmlAuth, fInputCatalog);
269  if (fInputRun > 0) {
270  fObject = new T;
271  result = poolDb->getObject (fObject, fInputTag, fInputRun);
272  }
273  else { // copy all instances
274  std::cout << "Copy all instances... " << std::endl;
275  cond::IOV iov;
276  if (poolDb->getObject (&iov, fInputTag)) {
277  IOVCollection::const_iterator iovi = iov.iov.begin ();
278  for (; iovi != iov.iov.end (); iovi++) {
279  IOVRun iovMax = iovi->first;
280  if (fVerbose) {
281  std::cout << "fetching object for run " << iovMax << std::endl;
282  }
283  T* object = new T;
284  if (!poolDb->getObject (object, fInputTag, iovMax)) {
285  std::cerr << "Failed to fetch object..." << std::endl;
286  result = false;
287  delete object;
288  break;
289  }
290  allInstances.push_back (std::make_pair (iovMax, object));
291  std::cerr << '.';
292  }
293  if (iovi == iov.iov.end ()) result = true;
294  }
295  else {
296  std::cerr << "can not find IOV for tag " << fInputTag << std::endl;
297  result = false;
298  }
299  }
300  }
301  else if (onlineFile (fInput)) {
302  if (!traceCounter) std::cout << "USE INPUT: Online: " << fInput << std::endl;
303  if (!onlineDb) onlineDb = new HcalDbOnline (fInput, fVerbose);
304  if (fInputRun > 0) {
305  fObject = new T;
306  result = onlineDb->getObject (fObject, fInputTag, fInputRun);
307  }
308  else { // copy all instances
309  std::cout << "Copy all instances... " << std::endl;
310  std::vector<HcalDbOnline::IntervalOV> iovs = onlineDb->getIOVs (fInputTag);
311  for (unsigned i = 0; i < iovs.size ();i++) {
312  IOVRun iovMin = iovs[i].first;
313  if (fVerbose) {
314  std::cout << "fetching object for run " << iovMin << std::endl;
315  }
316  T* object = new T;
317  if (!onlineDb->getObject (object, fInputTag, iovMin)) {
318  std::cerr << "Failed to fetch object..." << std::endl;
319  result = false;
320  delete object;
321  break;
322  }
323  allInstances.push_back (std::make_pair (iovMin, object));
324  std::cerr << '.';
325  }
326  result = true;
327  }
328  }
329  // else if (occiFile (fInput)) {
330 // if (!traceCounter) std::cout << "USE INPUT: OCCI" << std::endl;
331 // if (!occiDb) occiDb = new HcalDbPoolOCCI (fInput);
332 // fObject = new T;
333 // result = occiDb->getObject (fObject, fInputTag, fInputRun);
334 // }
335  traceCounter++;
336  fInputRun++;
337  if (fNtrace && !(traceCounter % fNtrace)) {
338  time_t t = time (0);
339  std::cout << "read transaction: " << traceCounter << " time: " << t - t0 << " dtime: " << t - t1 << std::endl;
340  t1 = t;
341  }
342  }
343  delete poolDb;
344  delete onlineDb;
345  poolDb = 0;
346  onlineDb = 0;
347  if (result) {
348  t0 = time (0);
349  t1 = t0;
350  traceCounter = 0;
351  T* object = 0;
352  while (traceCounter < fNwrite) {
353  delete object;
354  object = fObject ? new T (*fObject) : 0; // copy original object
355  if (asciiFile (fOutput)) {
356  if (!traceCounter) std::cout << "USE OUTPUT: ASCII: " << fOutput << std::endl;
357  if (fObject && allInstances.empty ()) {
358  std::ofstream outStream (fOutput.c_str ());
359  HcalDbASCIIIO::dumpObject (outStream, *object);
360  }
361  else {
362  for (unsigned i = 0; i < allInstances.size (); i++) {
363  if (fVerbose) {
364  std::cout << "Storing object for run " << allInstances[i].first << std::endl;
365  }
366  std::ostringstream outName;
367  unsigned ipos = fOutput.find (".txt");
368  if (ipos == std::string::npos) {
369  outName << fOutput << "_" << allInstances[i].first;
370  }
371  else {
372  outName << std::string (fOutput, 0, ipos) << "_" << allInstances[i].first << ".txt";
373  }
374  std::ofstream outStream (outName.str().c_str ());
375  object = allInstances[i].second;
376  HcalDbASCIIIO::dumpObject (outStream, *object);
377  delete object;
378  allInstances[i].second = 0;
379  std::cerr << '.';
380  }
381  }
382  }
383  else if (xmlFile (fOutput)) {
384  if (!traceCounter) std::cout << "USE OUTPUT: XML: " << fOutput << std::endl;
385  std::ofstream outStream (fOutput.c_str ());
386  HcalDbXml::dumpObject (outStream, fOutputRun, fIovgmtbegin, fIovgmtend, fOutputTag, *object);
387  outStream.close ();
388  std::cout << "close file\n";
389  }
390  else if (dbFile (fOutput)) { //POOL
391  if (!traceCounter) std::cout << "USE OUTPUT: Pool: " << fOutput << '/' << fOutputRun << std::endl;
392  if (!poolDb) poolDb = new HcalDbTool (fOutput, fVerbose, fXmlAuth, fOutputCatalog);
393  if (fOutputRun > 0) {
394  poolDb->putObject (object, fOutputTag, fOutputRun, fAppend);
395  object = 0; // owned by POOL
396  }
397  else {
398  for (unsigned i = 0; i < allInstances.size (); i++) {
399  if (fVerbose) {
400  std::cout << "Storing object for run " << allInstances[i].first << std::endl;
401  }
402  poolDb->putObject (allInstances[i].second, fOutputTag, allInstances[i].first, fAppend);
403  allInstances[i].second = 0;
404  std::cerr << '.';
405  }
406  }
407  }
408  traceCounter++;
409  fOutputRun++;
410  if (fNtrace && !(traceCounter % fNtrace)) {
411  time_t t = time (0);
412  std::cout << "write transaction: " << traceCounter << " time: " << t - t0 << " dtime: " << t - t1 << std::endl;
413  t1 = t;
414  }
415  }
416  delete poolDb;
417  poolDb = 0;
418  }
419  return result;
420 }
int i
Definition: DBlmapReader.cc:9
void fillDefaults(HcalPedestals *&fPedestals)
bool defaultsFile(const std::string fParam)
bool dumpObject(std::ostream &fOutput, unsigned fRun, unsigned long fGMTIOVBegin, unsigned long fGMTIOVEnd, const std::string &fTag, unsigned fVersion, const HcalPedestals &fObject, const HcalPedestalWidths &fError)
Definition: HcalDbXml.cc:169
U second(std::pair< T, U > const &p)
tuple iov
Definition: o2o.py:307
std::vector< IntervalOV > getIOVs(const std::string &fTag)
tuple result
Definition: query.py:137
Gather conditions data from online DB.
Definition: HcalDbOnline.h:34
HcalDbTool::IOVRun IOVRun
bool first
Definition: L1TdeRCT.cc:94
bool dbFile(const std::string fParam)
bool getObject(HcalPedestals *fObject, HcalPedestalWidths *fWidths, const std::string &fTag, IOVTime fTime)
bool xmlFile(const std::string fParam)
list object
Definition: dbtoconf.py:77
bool getObject(std::istream &fInput, HcalPedestals *fObject)
bool dumpObject(std::ostream &fOutput, const HcalPedestals &fObject)
bool asciiFile(const std::string fParam)
tuple cout
Definition: gather_cfg.py:121
long double T
bool onlineFile(const std::string fParam)
bool dbFile ( const std::string  fParam)

Definition at line 218 of file hcalCalibrationsCopy.cc.

Referenced by copyObject(), printRuns(), and printTags().

218  {
219  return fParam.find (':') != std::string::npos;
220 }
bool defaultsFile ( const std::string  fParam)

Definition at line 206 of file hcalCalibrationsCopy.cc.

Referenced by copyObject().

206  {
207  return fParam == "defaults";
208 }
void fillDefaults ( HcalPedestals *&  fPedestals)

Definition at line 91 of file hcalCalibrationsCopy.cc.

References HcalPedestal::getValues(), HcalDbHardcode::makePedestal(), and undefinedCells().

Referenced by copyObject().

91  {
92  if (!fPedestals) {
93  fPedestals = new HcalPedestals;
94  fPedestals->sort ();
95  }
96  std::vector<HcalDetId> cells = undefinedCells (*fPedestals);
97  for (std::vector <HcalDetId>::const_iterator cell = cells.begin (); cell != cells.end (); cell++) {
98  HcalPedestal item = HcalDbHardcode::makePedestal (*cell, false); // do not smear
99  fPedestals->addValue (*cell, item.getValues ());
100  }
101  fPedestals->sort ();
102 }
std::vector< HcalDetId > undefinedCells(const T &fData)
const float * getValues() const
get value for all capId = 0..3
Definition: HcalPedestal.h:17
HcalPedestal makePedestal(HcalGenericDetId fId, bool fSmear=false)
void fillDefaults ( HcalPedestalWidths *&  fPedestals)

Definition at line 104 of file hcalCalibrationsCopy.cc.

References HcalDbHardcode::makePedestalWidth(), and undefinedCells().

104  {
105  if (!fPedestals) {
106  fPedestals = new HcalPedestalWidths;
107  fPedestals->sort ();
108  }
109  std::vector<HcalDetId> cells = undefinedCells (*fPedestals);
110  for (std::vector <HcalDetId>::const_iterator cell = cells.begin (); cell != cells.end (); cell++) {
112  fPedestals->setWidth (item);
113  }
114  fPedestals->sort ();
115 }
HcalPedestalWidth makePedestalWidth(HcalGenericDetId fId)
std::vector< HcalDetId > undefinedCells(const T &fData)
void fillDefaults ( HcalGains *&  fGains)

Definition at line 117 of file hcalCalibrationsCopy.cc.

References HcalGain::getValues(), HcalDbHardcode::makeGain(), and undefinedCells().

117  {
118  if (!fGains) {
119  fGains = new HcalGains;
120  fGains->sort ();
121  }
122  std::vector<HcalDetId> cells = undefinedCells (*fGains);
123  for (std::vector <HcalDetId>::const_iterator cell = cells.begin (); cell != cells.end (); cell++) {
124  HcalGain item = HcalDbHardcode::makeGain (*cell, false); // do not smear
125  fGains->addValue (*cell, item.getValues ());
126  }
127  fGains->sort ();
128 }
HcalGain makeGain(HcalGenericDetId fId, bool fSmear=false)
const float * getValues() const
get value for all capId = 0..3
Definition: HcalGain.h:18
std::vector< HcalDetId > undefinedCells(const T &fData)
void fillDefaults ( HcalGainWidths *&  fGains)

Definition at line 130 of file hcalCalibrationsCopy.cc.

References HcalGainWidth::getValues(), HcalDbHardcode::makeGainWidth(), and undefinedCells().

130  {
131  if (!fGains) {
132  fGains = new HcalGainWidths;
133  fGains->sort ();
134  }
135  std::vector<HcalDetId> cells = undefinedCells (*fGains);
136  for (std::vector <HcalDetId>::const_iterator cell = cells.begin (); cell != cells.end (); cell++) {
138  fGains->addValue (*cell, item.getValues ());
139  }
140  fGains->sort ();
141 }
const float * getValues() const
get value for all capId = 0..3
Definition: HcalGainWidth.h:17
HcalGainWidth makeGainWidth(HcalGenericDetId fId)
std::vector< HcalDetId > undefinedCells(const T &fData)
void fillDefaults ( HcalElectronicsMap *&  fMap)

Definition at line 143 of file hcalCalibrationsCopy.cc.

References dtNoiseDBValidation_cfg::cerr, and HcalElectronicsMap::sort().

143  {
144  if (!fMap) {
145  fMap = new HcalElectronicsMap;
146  fMap->sort ();
147  }
148  std::cerr << "Warning: fillDefaults (HcalElectronicsMap* fMap) is not implemented. Ignore." << std::endl;
149 }
void fillDefaults ( HcalQIEData *&  fObject)

Definition at line 151 of file hcalCalibrationsCopy.cc.

References HcalQIEData::addCoder(), eta(), HcalDbHardcode::makeQIECoder(), phi, HcalQIEData::sort(), and HcalTopology::valid().

151  {
152  if (!fObject) {
153  fObject = new HcalQIEData;
154  fObject->sort ();
155  }
156  HcalTopology topology;
157  for (int eta = -63; eta < 64; eta++) {
158  for (int phi = 0; phi < 128; phi++) {
159  for (int depth = 1; depth < 5; depth++) {
160  for (int det = 1; det < 5; det++) {
161  HcalDetId cell ((HcalSubdetector) det, eta, phi, depth);
162  if (topology.valid(cell)) {
164  fObject->addCoder (item);
165  }
166  }
167  }
168  }
169  }
170  fObject->sort ();
171 }
virtual bool valid(const HcalDetId &id) const
Definition: HcalTopology.cc:32
T eta() const
HcalQIECoder makeQIECoder(HcalGenericDetId fId)
bool addCoder(const HcalQIECoder &fCoder, bool h2mode_=false)
Definition: HcalQIEData.h:42
HcalSubdetector
Definition: HcalAssistant.h:32
void sort()
Definition: HcalQIEData.h:44
Definition: DDAxes.h:10
void fillDefaults ( HcalCalibrationQIEData *&  fObject)

Definition at line 173 of file hcalCalibrationsCopy.cc.

References HcalCalibrationQIEData::addCoder(), eta(), HcalDbHardcode::makeCalibrationQIECoder(), phi, HcalCalibrationQIEData::sort(), and HcalTopology::valid().

173  {
174  if (!fObject) {
175  fObject = new HcalCalibrationQIEData;
176  fObject->sort ();
177  }
178  HcalTopology topology;
179  for (int eta = -63; eta < 64; eta++) {
180  for (int phi = 0; phi < 128; phi++) {
181  for (int depth = 1; depth < 5; depth++) {
182  for (int det = 1; det < 5; det++) {
183  HcalDetId cell ((HcalSubdetector) det, eta, phi, depth);
184  if (topology.valid(cell)) {
186  fObject->addCoder (item);
187  }
188  }
189  }
190  }
191  }
192  fObject->sort ();
193 }
virtual bool valid(const HcalDetId &id) const
Definition: HcalTopology.cc:32
T eta() const
HcalCalibrationQIECoder makeCalibrationQIECoder(HcalGenericDetId fId)
HcalSubdetector
Definition: HcalAssistant.h:32
bool addCoder(const HcalCalibrationQIECoder &fCoder)
Definition: DDAxes.h:10
int main ( int  argn,
char *  argv[] 
)

Definition at line 422 of file hcalCalibrationsCopy.cc.

References python.multivaluedict::append(), harvestRelVal::args, Args::arguments(), copyObject(), Args::defineOption(), Args::defineParameter(), Args::getParameter(), LaserDQM_cfg::input, Args::optionIsSet(), convertSQLitetoXML_cfg::output, Args::parse(), printHelp(), and GsfMatrixTools::trace().

422  {
423  // start message service
424  edm::service::MessageServicePresence my_message_service;
425 
426  Args args;
427  args.defineParameter ("-input", "DB connection string, POOL format, or .txt file, or defaults");
428  args.defineParameter ("-output", "DB connection string, POOL format, or .txt, or .xml file");
429  args.defineParameter ("-inputrun", "run # for which constands should be made");
430  args.defineParameter ("-inputtag", "tag for the input constants set");
431  args.defineParameter ("-inputcatalog", "catalog for POOL DB <$POOL_CATALOG>");
432  args.defineParameter ("-outputrun", "run # for which constands should be dumped");
433  args.defineParameter ("-outputtag", "tag for the output constants set");
434  args.defineParameter ("-outputcatalog", "catalog for POOL DB <$POOL_CATALOG>");
435  args.defineParameter ("-iovgmtbegin", "start time for online IOV <outputrun>");
436  args.defineParameter ("-iovgmtend", "end time for online IOV <0>");
437  args.defineParameter ("-nread", "repeat input that many times with increasing run# <1>");
438  args.defineParameter ("-nwrite", "repeat output that many times with increasing run# <1>");
439  args.defineParameter ("-trace", "trace time every that many operations <false>");
440  args.defineOption ("-help", "this help");
441  args.defineOption ("-online", "interpret input DB as an online DB");
442  args.defineOption ("-xmlauth", "use XML authorization <false>");
443  args.defineOption ("-append", "Strip previous IOV, make this IOV open (POOL DB) <false>");
444  args.defineOption ("-verbose", "makes program verbose <false>");
445 
446  args.parse (argn, argv);
447 
448  std::vector<std::string> arguments = args.arguments ();
449 
450  if (arguments.size () < 1 || args.optionIsSet ("-help")) {
451  printHelp (args);
452  return -1;
453  }
454 
455  std::string input = args.getParameter ("-input");
456  std::string output = args.getParameter ("-output");
457 
458  HcalDbTool::IOVRun inputRun = args.getParameter ("-inputrun").empty () ? 0 : strtoull (args.getParameter ("-inputrun").c_str (), 0, 0);
459  HcalDbTool::IOVRun outputRun = args.getParameter ("-outputrun").empty () ? 0 : strtoll (args.getParameter ("-outputrun").c_str (), 0, 0);
460  std::string inputTag = args.getParameter ("-inputtag");
461  std::string outputTag = args.getParameter ("-outputtag");
462 
463  unsigned long long iovgmtbegin = args.getParameter ("-iovgmtbegin").empty () ? outputRun : strtoull (args.getParameter ("-iovgmtbegin").c_str (), 0, 0);
464  unsigned long long iovgmtend = args.getParameter ("-iovgmtend").empty () ? 0 : strtoull (args.getParameter ("-iovgmtend").c_str (), 0, 0);
465 
466  unsigned nread = args.getParameter ("-nread").empty () ? 1 : atoi (args.getParameter ("-nread").c_str ());
467  unsigned nwrite = args.getParameter ("-nwrite").empty () ? 1 : atoi (args.getParameter ("-nwrite").c_str ());
468  unsigned trace = args.getParameter ("-trace").empty () ? 0 : atoi (args.getParameter ("-trace").c_str ());
469 
470  const char* inputCatalog = args.getParameter ("-inputcatalog").empty () ? 0 : args.getParameter ("-inputcatalog").c_str();
471  const char* outputCatalog = args.getParameter ("-outputcatalog").empty () ? 0 : args.getParameter ("-outputcatalog").c_str();
472 
473  bool xmlAuth = args.optionIsSet ("-xmlauth");
474  bool append = args.optionIsSet ("-append");
475 
476  bool verbose = args.optionIsSet ("-verbose");
477 
478 
479  std::string what = arguments [0];
480 
481  if (what == "pedestals") {
482  HcalPedestals* object = 0;
483  copyObject (object, input, inputTag, inputRun, output, outputTag, outputRun, append, iovgmtbegin, iovgmtend, nread, nwrite, trace, verbose, inputCatalog, outputCatalog, xmlAuth);
484  }
485  else if (what == "gains") {
486  HcalGains* object = 0;
487  copyObject (object, input, inputTag, inputRun, output, outputTag, outputRun, append, iovgmtbegin, iovgmtend, nread, nwrite, trace, verbose, inputCatalog, outputCatalog, xmlAuth);
488  }
489  else if (what == "pwidths") {
490  HcalPedestalWidths* object = 0;
491  copyObject (object, input, inputTag, inputRun, output, outputTag, outputRun, append, iovgmtbegin, iovgmtend, nread, nwrite, trace, verbose, inputCatalog, outputCatalog, xmlAuth);
492  }
493  else if (what == "gwidths") {
494  HcalGainWidths* object = 0;
495  copyObject (object, input, inputTag, inputRun, output, outputTag, outputRun, append, iovgmtbegin, iovgmtend, nread, nwrite, trace, verbose, inputCatalog, outputCatalog, xmlAuth);
496  }
497  else if (what == "emap") {
498  HcalElectronicsMap* object = 0;
499  copyObject (object, input, inputTag, inputRun, output, outputTag, outputRun, append, iovgmtbegin, iovgmtend, nread, nwrite, trace, verbose, inputCatalog, outputCatalog, xmlAuth);
500  }
501  else if (what == "qie") {
502  HcalQIEData* object = 0;
503  copyObject (object, input, inputTag, inputRun, output, outputTag, outputRun, append, iovgmtbegin, iovgmtend, nread, nwrite, trace, verbose, inputCatalog, outputCatalog, xmlAuth);
504  }
505  else if (what == "calibqie") {
506  HcalCalibrationQIEData* object = 0;
507  copyObject (object, input, inputTag, inputRun, output, outputTag, outputRun, append, iovgmtbegin, iovgmtend, nread, nwrite, trace, verbose, inputCatalog, outputCatalog, xmlAuth);
508  }
509 }
void defineOption(const std::string &fOption, const std::string &fComment="")
std::vector< std::string > arguments() const
bool copyObject(T *fObject, const std::string &fInput, const std::string &fInputTag, HcalDbTool::IOVRun fInputRun, const std::string &fOutput, const std::string &fOutputTag, HcalDbTool::IOVRun fOutputRun, bool fAppend, unsigned long long fIovgmtbegin, unsigned long long fIovgmtend, unsigned fNread, unsigned fNwrite, unsigned fNtrace, bool fVerbose, const char *fInputCatalog, const char *fOutputCatalog, bool fXmlAuth)
void parse(int nArgs, char *fArgs[])
HcalDbTool::IOVRun IOVRun
double trace(const ROOT::Math::SMatrix< double, N, N > &matrix)
dictionary args
void printHelp(const Args &args)
void defineParameter(const std::string &fParameter, const std::string &fComment="")
bool optionIsSet(const std::string &fOption) const
std::string getParameter(const std::string &fKey)
bool occiFile ( const std::string  fParam)

Definition at line 222 of file hcalCalibrationsCopy.cc.

222  {
223  return fParam.find ("cms_val_lb.cern.ch") != std::string::npos &&
224  fParam.find (':') == std::string::npos;
225 }
bool onlineFile ( const std::string  fParam)

Definition at line 227 of file hcalCalibrationsCopy.cc.

Referenced by copyObject(), printRuns(), and printTags().

227  {
228  return fParam.find ('@') != std::string::npos &&
229  fParam.find ("cms_val_lb") == std::string::npos;
230 }
void printHelp ( const Args args)

Definition at line 195 of file hcalCalibrationsCopy.cc.

References Args::command(), gather_cfg::cout, and Args::printOptionsHelp().

Referenced by main().

195  {
196  char buffer [1024];
197  std::cout << "Tool to manipulate by Hcal Calibrations" << std::endl;
198  std::cout << " feedback -> ratnikov@fnal.gov" << std::endl;
199  std::cout << "Use:" << std::endl;
200  sprintf (buffer, " %s <what> <options> <parameters>\n", args.command ().c_str());
201  std::cout << buffer;
202  std::cout << " where <what> is: \n pedestals\n gains\n pwidths\n gwidths\n emap\n qie\n calibqie" << std::endl;
203  args.printOptionsHelp ();
204 }
void printOptionsHelp() const
std::string command() const
tuple cout
Definition: gather_cfg.py:121
template<class T >
std::vector<HcalDetId> undefinedCells ( const T fData)

Definition at line 68 of file hcalCalibrationsCopy.cc.

References eta(), phi, query::result, and HcalTopology::valid().

Referenced by fillDefaults().

68  {
69  static std::vector<HcalDetId> result;
70  if (result.size () <= 0) {
71  HcalTopology topology;
72  for (int eta = -63; eta < 64; eta++) {
73  for (int phi = 0; phi < 128; phi++) {
74  for (int depth = 1; depth < 5; depth++) {
75  for (int det = 1; det < 5; det++) {
76  HcalDetId cell ((HcalSubdetector) det, eta, phi, depth);
77  try {
78  fData.getValues (cell);
79  }
80  catch (...) {
81  if (topology.valid(cell)) result.push_back (cell);
82  }
83  }
84  }
85  }
86  }
87  }
88  return result;
89 }
virtual bool valid(const HcalDetId &id) const
Definition: HcalTopology.cc:32
T eta() const
tuple result
Definition: query.py:137
HcalSubdetector
Definition: HcalAssistant.h:32
Definition: DDAxes.h:10
bool xmlFile ( const std::string  fParam)

Definition at line 214 of file hcalCalibrationsCopy.cc.

Referenced by copyObject(), HcalPedestalAnalyzer::endJob(), MonitorElementsDb::MonitorElementsDb(), HcalDetDiagLaserMonitor::SaveRaddamData(), HcalDetDiagLEDMonitor::SaveReference(), HcalDetDiagPedestalMonitor::SaveReference(), and HcalDetDiagLaserMonitor::SaveReference().

214  {
215  return fParam.find (':') == std::string::npos && std::string (fParam, fParam.length () - 4) == ".xml";
216 }