CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Classes | Typedefs | Functions
hcalDeleteObject.cc File Reference
#include <stdlib.h>
#include <iostream>
#include <fstream>
#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 "CalibCalorimetry/HcalAlgos/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"

Go to the source code of this file.

Classes

class  Args
 

Typedefs

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

Functions

template<class T >
bool deleteObject (T *fObject, const std::string &fInput, const std::string &fInputTag, HcalDbTool::IOVRun fInputRun, bool fVerbose)
 
int main (int argn, char *argv[])
 
void printHelp (const Args &args)
 

Typedef Documentation

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

Definition at line 38 of file hcalDeleteObject.cc.

typedef HcalDbTool::IOVRun IOVRun

Definition at line 37 of file hcalDeleteObject.cc.

Function Documentation

template<class T >
bool deleteObject ( T fObject,
const std::string &  fInput,
const std::string &  fInputTag,
HcalDbTool::IOVRun  fInputRun,
bool  fVerbose 
)

Definition at line 74 of file hcalDeleteObject.cc.

Referenced by main().

75  {
76  HcalDbTool poolDb (fInput, fVerbose);
77  return poolDb.deleteObject (fObject, fInputTag, fInputRun);
78 }
int main ( int  argn,
char *  argv[] 
)

Definition at line 80 of file hcalDeleteObject.cc.

References harvestRelVal::args, Args::arguments(), Args::defineOption(), Args::defineParameter(), deleteObject(), Args::getParameter(), input, Args::optionIsSet(), Args::parse(), printHelp(), and AlCaHLTBitMon_QueryRunRegistry::string.

80  {
81 
82  Args args;
83  args.defineParameter ("-db", "DB connection string, POOL format");
84  args.defineParameter ("-run", "run # for which constands should be deleted");
85  args.defineParameter ("-tag", "tag for the input constants set");
86  args.defineOption ("-verbose", "makes program verbose");
87 
88  args.parse (argn, argv);
89 
90  std::vector<std::string> arguments = args.arguments ();
91 
92  if (arguments.size () < 1 || args.optionIsSet ("-help")) {
93  printHelp (args);
94  return -1;
95  }
96 
97  std::string input = args.getParameter ("-db");
98 
99  unsigned inputRun = args.getParameter ("-run").empty () ? 0 : strtoull (args.getParameter ("-run").c_str (), 0, 0);
100  std::string inputTag = args.getParameter ("-tag");
101 
102  bool verbose = args.optionIsSet ("-verbose");
103 
104 
105  std::string what = arguments [0];
106 
107  if (what == "pedestals") {
108  HcalPedestals* object = 0;
109  deleteObject (object, input, inputTag, inputRun, verbose);
110  }
111  else if (what == "gains") {
112  HcalGains* object = 0;
113  }
114  else if (what == "pwidths") {
115  HcalPedestalWidths* object = 0;
116  }
117  else if (what == "gwidths") {
118  HcalGainWidths* object = 0;
119  }
120  else if (what == "emap") {
121  HcalElectronicsMap* object = 0;
122  }
123  else if (what == "qie") {
124  HcalQIEData* object = 0;
125  }
126  else if (what == "calibqie") {
127  HcalCalibrationQIEData* object = 0;
128  }
129 }
void defineOption(const std::string &fOption, const std::string &fComment="")
std::vector< std::string > arguments() const
static std::string const input
Definition: EdmProvDump.cc:44
void parse(int nArgs, char *fArgs[])
dictionary args
void printHelp(const Args &args)
bool deleteObject(T *fObject, const std::string &fInput, const std::string &fInputTag, HcalDbTool::IOVRun fInputRun, bool fVerbose)
void defineParameter(const std::string &fParameter, const std::string &fComment="")
bool optionIsSet(const std::string &fOption) const
std::string getParameter(const std::string &fKey)
void printHelp ( const Args args)

Definition at line 62 of file hcalDeleteObject.cc.

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

62  {
63  char buffer [1024];
64  std::cout << "Tool to delete object from Hcal Calibrations" << std::endl;
65  std::cout << "CAUTION: Could cause inconsistency for running jobs using DB" << std::endl;
66  std::cout << " feedback -> ratnikov@fnal.gov" << std::endl;
67  std::cout << "Use:" << std::endl;
68  sprintf (buffer, " %s <what> <options> <parameters>\n", args.command ().c_str());
69  std::cout << buffer;
70  std::cout << " where <what> is: \n pedestals\n gains\n pwidths\n gwidths\n emap\n qie\n calibqie" << std::endl;
71  args.printOptionsHelp ();
72 }
void printOptionsHelp() const
std::string command() const
tuple cout
Definition: gather_cfg.py:121