CMS 3D CMS Logo

Classes | Typedefs | Functions

/data/refman/pasoursint/CMSSW_5_3_9_patch3/src/CondTools/Hcal/bin/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.

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

                                                                                                                                      {
  HcalDbTool poolDb (fInput, fVerbose);
  return poolDb.deleteObject (fObject, fInputTag, fInputRun);
}
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(), LaserDQM_cfg::input, Args::optionIsSet(), Args::parse(), and printHelp().

                                   {

  Args args;
  args.defineParameter ("-db", "DB connection string, POOL format");
  args.defineParameter ("-run", "run # for which constands should be deleted");
  args.defineParameter ("-tag", "tag for the input constants set");
  args.defineOption ("-verbose", "makes program verbose");
  
  args.parse (argn, argv);
  
  std::vector<std::string> arguments = args.arguments ();

  if (arguments.size () < 1 || args.optionIsSet ("-help")) {
    printHelp (args);
    return -1;
  }

  std::string input = args.getParameter ("-db");
  
  unsigned inputRun = args.getParameter ("-run").empty () ? 0 : strtoull (args.getParameter ("-run").c_str (), 0, 0);
  std::string inputTag = args.getParameter ("-tag");

  bool verbose = args.optionIsSet ("-verbose");


  std::string what = arguments [0];

  if (what == "pedestals") {
    HcalPedestals* object = 0;
    deleteObject (object, input, inputTag, inputRun, verbose);
  }
  else if (what == "gains") {
    HcalGains* object = 0;
  }
  else if (what == "pwidths") {
    HcalPedestalWidths* object = 0;
  }
  else if (what == "gwidths") {
    HcalGainWidths* object = 0;
  }
  else if (what == "emap") {
    HcalElectronicsMap* object = 0;
  }
  else if (what == "qie") {
    HcalQIEData* object = 0;
  }
  else if (what == "calibqie") {
    HcalCalibrationQIEData* object = 0;
  }
}
void printHelp ( const Args args)

Definition at line 62 of file hcalDeleteObject.cc.

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

                                  {
  char buffer [1024];
  std::cout << "Tool to delete object from Hcal Calibrations" << std::endl;
  std::cout << "CAUTION: Could cause inconsistency for running jobs using DB" << std::endl;
  std::cout << "    feedback -> ratnikov@fnal.gov" << std::endl;
  std::cout << "Use:" << std::endl;
  sprintf (buffer, " %s <what> <options> <parameters>\n", args.command ().c_str());
  std::cout << buffer;
  std::cout << "  where <what> is: \n    pedestals\n    gains\n    pwidths\n    gwidths\n    emap\n    qie\n    calibqie" << std::endl;
  args.printOptionsHelp ();
}