CMS 3D CMS Logo

hcalInitDb.cc File Reference

#include <stdlib.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <map>
#include <algorithm>
#include <string>
#include "DataFormats/Common/interface/Timestamp.h"
#include "CondCore/IOVService/interface/IOV.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.

Typedefs

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

Functions

void initDb (const std::string &inputdb, bool verbose)
int main (int argn, char *argv[])
void printHelp (const Args &args)


Typedef Documentation

typedef std::pair<IOVRun,IOVRun> IntervalOV [static]

Definition at line 27 of file hcalInitDb.cc.

typedef std::map<IOVRun,std::string> IOVCollection [static]

Definition at line 26 of file hcalInitDb.cc.

typedef HcalDbTool::IOVRun IOVRun [static]

Definition at line 25 of file hcalInitDb.cc.


Function Documentation

void @3071::initDb ( const std::string &  inputdb,
bool  verbose 
) [static]

Definition at line 60 of file hcalInitDb.cc.

References GenMuonPlsPt100GeV_cfg::cout, archive::db, lat::endl(), file, EgammaValidation_cff::filename, and python::multivaluedict::map().

Referenced by main().

00060                                                      {
00061   HcalDbTool db (inputdb, verbose);
00062   if (inputdb.find ("sqlite") != std::string::npos) {
00063     unsigned pos = inputdb.find (':');
00064     if (pos != std::string::npos) {
00065       std::string filename (inputdb, pos+1);
00066       std::cout << "initDb-> creating file " << filename << std::endl;
00067       std::ifstream file (filename.c_str()); // touch file
00068       file.close ();
00069     }
00070   }
00071   // make dummy metadata entry
00072   std::cout << "initDb-> initializing metadata" << std::endl;
00073   db.metadataSetTag ("dummy_tag", "dummy_token");
00074   // make dummy objects
00075   std::cout << "initDb-> initializing pedestals" << std::endl;
00076   HcalPedestals* peds = new HcalPedestals;
00077   db.putObject (peds, "dummy_pedestals", 1);
00078   std::cout << "initDb-> initializing pedestal widths" << std::endl;
00079   HcalPedestalWidths* pedws = new HcalPedestalWidths;
00080   db.putObject (pedws, "dummy_pedestalwidths", 1);
00081   std::cout << "initDb-> initializing gains" << std::endl;
00082   HcalGains* gains = new HcalGains;
00083   db.putObject (gains, "dummy_gains", 1);
00084   std::cout << "initDb-> initializing gain widths" << std::endl;
00085   HcalGainWidths* gainws = new HcalGainWidths;
00086   db.putObject (gainws, "dummy_gainwidths", 1);
00087   std::cout << "initDb-> initializing qie" << std::endl;
00088   HcalQIEData* qie = new HcalQIEData;
00089   db.putObject (qie, "dummy_qie", 1);
00090   std::cout << "initDb-> initializing electronics map" << std::endl;
00091   HcalElectronicsMap* map = new HcalElectronicsMap;
00092   db.putObject (map, "dummy_map", 1);
00093   std::cout << "initDb-> initializing channel quality" << std::endl;
00094   HcalChannelQuality* quality = new HcalChannelQuality;
00095   db.putObject (quality, "dummy_quality", 1);
00096 }

int main ( int  argn,
char *  argv[] 
)

Definition at line 100 of file hcalInitDb.cc.

References Args::arguments(), Args::defineOption(), Args::defineParameter(), Args::getParameter(), initDb(), Args::optionIsSet(), Args::parse(), and printHelp().

00100                                    {
00101 
00102   Args args;
00103   args.defineParameter ("-db", "DB connection string, POOL format, i.e. oracle://devdb10/CMS_COND_HCAL");
00104   args.defineOption ("-help", "this help");
00105   args.defineOption ("-verbose", "verbose");
00106   
00107   args.parse (argn, argv);
00108   
00109   std::vector<std::string> arguments = args.arguments ();
00110 
00111   if (args.getParameter ("-db").empty() || args.optionIsSet ("-help")) {
00112     printHelp (args);
00113     return -1;
00114   }
00115 
00116   std::string inputdb = args.getParameter ("-db");
00117   bool verbose = args.optionIsSet ("-verbose");
00118 
00119   initDb (inputdb, verbose);
00120   return 0;
00121 }

void @3071::printHelp ( const Args args  )  [static]

Definition at line 50 of file hcalInitDb.cc.

References Args::command(), GenMuonPlsPt100GeV_cfg::cout, lat::endl(), and Args::printOptionsHelp().

00050                                   {
00051   char buffer [1024];
00052   std::cout << "Initialize POOL DB with dummy HCAL data" << std::endl;
00053   std::cout << "    feedback -> ratnikov@fnal.gov" << std::endl;
00054   std::cout << "Use:" << std::endl;
00055   sprintf (buffer, " %s <parameters>\n", args.command ().c_str());
00056   std::cout << buffer;
00057   args.printOptionsHelp ();
00058 }


Variable Documentation

std::vector<std::string> mArgs

Definition at line 45 of file hcalInitDb.cc.

std::map<std::string, std::string> mComments

Definition at line 47 of file hcalInitDb.cc.

std::vector<std::string> mOptions

Definition at line 43 of file hcalInitDb.cc.

std::vector<std::string> mParameters

Definition at line 44 of file hcalInitDb.cc.

std::map<std::string, std::string> mParsed

Definition at line 46 of file hcalInitDb.cc.

std::string mProgramName

Definition at line 42 of file hcalInitDb.cc.


Generated on Tue Jun 9 17:51:44 2009 for CMSSW by  doxygen 1.5.4