예제 #1
0
int main( int argc, char* argv[] ) {


  if( argc<2 ) {
    std::cout << " USAGE: ./drawLimitPlotQgamma [cfg] [fitName=\"fit_v0\"] [width=\"0p014\"]" << std::endl;
    exit(1);
  }
  
  
  std::string configFileName(argv[1]);
  ZGConfig cfg(configFileName);

  std::string fitName = "fit_v0";
  if( argc>2 ) {
    fitName = std::string((argv[2]));
  }

  std::string width = "0p014";
  if( argc>3 ) {
    width = std::string((argv[3]));
  }



  ZGDrawTools::setStyle();


  std::string limitsFile( Form( "%s/limits_w%s_%s.txt", cfg.getEventYieldDir().c_str(), width.c_str(), fitName.c_str() ) );

  drawSingleLimitPlot( cfg, limitsFile, 0.4, fitName, width, true );

  return 0;

}
예제 #2
0
파일: main.cpp 프로젝트: echmet/CEval
void saveUserSettings(DataAccumulator *dac, SoftwareUpdater *updater)
{
  QSettings s(configFileName(), QSettings::IniFormat);

  QMap<QString, QVariant> map;

  map.insert(DAC_SETTINGS_TAG, dac->saveUserSettings());
  map.insert(NUM_FORMAT_SETTINGS_TAG, DoubleToStringConvertor::saveUserSettings());
  map.insert(SOFTWARE_UPDATER_SETTINGS_TAG, updater->saveUserSettings());

  s.setValue(ROOT_SETTINGS_TAG, map);
}
예제 #3
0
int main(int argc, char **argv)
{
    std::string configFileName("config.ini");
    if (argc > 1)
    {
        configFileName = argv[1];
    }
    BluetoothSensor sensor;
    if (!sensor.initAll(configFileName)) return 1;
    sensor.run();
    return 0;
}
예제 #4
0
void Settings::save()
{
	QSettings settings;
	settings.setValue("settings/configFileName", m_configFileName);
	settings.setValue("settings/multipleconfig", m_multipleConfigs);

	if ( multipleConfigs() && !configFileName().isEmpty() )
	{
		QByteArray hash = QCryptographicHash::hash( configFileName().toLocal8Bit(), QCryptographicHash::Md5 );
		settings.beginGroup( hash.toHex() );
	}

	settings.setValue("buildPath", m_buildPath);
	settings.setValue("includePath", m_includePath);
	settings.setValue("installPath", m_installPath);
	settings.setValue("sourceDirectory", m_sourceDir);
	settings.setValue("applicationDirectory", m_appDir);
	settings.setValue("targetPlatform", m_targetPlatform);
	settings.setValue("toolPath", m_toolPath);
	settings.setValue("programmer", m_programmer);
	settings.setValue("absolutePathInSamples", m_absolutePathInSamples);
	settings.setValue("clearLogBeforeBuild", m_clearLogBeforeBuild);
	settings.setValue("verboseBuild", m_verboseBuild);
}
예제 #5
0
// Support camera calibration requests
// http://www.ros.org/wiki/camera_calibration/Tutorials/MonocularCalibration
bool StereoNode::setCameraInfo(sensor_msgs::SetCameraInfo::Request& req, sensor_msgs::SetCameraInfo::Response& rsp,
                               Camera& cam, sensor_msgs::CameraInfo &msg_info)
{
  ROS_INFO("New camera info received");
  sensor_msgs::CameraInfo &info = req.camera_info;
  info.header.frame_id = msg_info.header.frame_id;

  // Sanity check: the image dimensions should match the resolution of the sensor.
  unsigned int height = cam.getHeight();
  unsigned int width = cam.getWidth();

  if (info.width != width || info.height != height) {
    rsp.success = false;
    rsp.status_message = (boost::format("Camera_info resolution %ix%i does not match current video "
                                        "setting, camera running at resolution %ix%i.") % info.width % info.height
        % width % height).str();
    ROS_ERROR("%s", rsp.status_message.c_str());
    return true;
  }

  std::string camname = cam.getCameraName();
  std::stringstream ini_stream;
  if (!camera_calibration_parsers::writeCalibrationIni(ini_stream, camname, info)) {
    rsp.status_message = "Error formatting camera_info for storage.";
    rsp.success = false;
  } else {
    std::string ini = ini_stream.str();
    std::fstream param_file;
    std::string filename = config_path_ + "/" + configFileName(cam);
    param_file.open(filename.c_str(), std::ios::in | std::ios::out | std::ios::trunc);

    if (param_file.is_open()) {
      param_file << ini.c_str();
      param_file.close();

      msg_info = info;
      rsp.success = true;
    } else {
      rsp.success = false;
      rsp.status_message = "file write failed";
    }
  }
  if (!rsp.success) {
    ROS_ERROR("%s", rsp.status_message.c_str());
  }
  return true;
}
예제 #6
0
파일: main.cpp 프로젝트: echmet/CEval
void loadUserSettings(DataAccumulator *dac, SoftwareUpdater *updater)
{
  QSettings s(configFileName(), QSettings::IniFormat);

  QVariant root = s.value(ROOT_SETTINGS_TAG);
  if (!root.canConvert<QMap<QString, QVariant>>())
    return;

  QMap<QString, QVariant> rootMap = root.value<EMT::StringVariantMap>();

  if (rootMap.contains(DAC_SETTINGS_TAG))
    dac->loadUserSettings(rootMap[DAC_SETTINGS_TAG]);

  if (rootMap.contains(NUM_FORMAT_SETTINGS_TAG))
    DoubleToStringConvertor::loadUserSettings(rootMap[NUM_FORMAT_SETTINGS_TAG]);

  if (rootMap.contains(SOFTWARE_UPDATER_SETTINGS_TAG))
    updater->loadUserSettings(rootMap[SOFTWARE_UPDATER_SETTINGS_TAG]);
}
예제 #7
0
int main(int argc, char *argv[])
{
    int major, minor, patch;
    bidder_show_help    = 0;
    bidder_show_version = 0;
    bidder_conf_file    = NULL;

    if (cmd_get_options(argc, argv) == -1) 
        exit(-1);
    
    if (bidder_show_help == 1) {
        print_help();
        exit(0);
    }
    if (bidder_show_version == 1) {
        printf("bidder version: bidder_mobile/%s\n", BIDDER_VERSION);
        exit(0);
    }
    
    //g_file_logger = spdlog::rotating_logger_mt("debug", "logs/debugfile", 1048576*500, 3, true); 
    //g_manager_logger = spdlog::rotating_logger_mt("manager", "logs/managerfile", 1048576*500, 3, true); 
    g_file_logger = spdlog::daily_logger_mt("debug", "logs/debugfile", true); 
    g_manager_logger = spdlog::daily_logger_mt("manager", "logs/managerfile", true); 
#ifdef DEBUG
    g_manager_logger->info("-------------------------------------DEBUG   MODE-------------------------------------");
#else
    g_manager_logger->info("-------------------------------------RELEASE MODE-------------------------------------");
#endif
    
    zmq_version (&major, &minor, &patch);
    g_manager_logger->info("Current 0MQ version is {0:d}.{1:d}.{2:d}", major, minor, patch);

    string configFileName(bidder_conf_file == NULL ? "../adManagerConfig.txt" : bidder_conf_file);
    configureObject configure(configFileName);
    configure.display();

    bidderServ bidder(configure);
    bidder.run();

    return 0;
}
예제 #8
0
void InitPreferences()
{
   wxString appName = wxTheApp->GetAppName();

   wxFileName configFileName(FileNames::DataDir(), wxT("audacity.cfg"));

   gPrefs = new wxFileConfig(appName, wxEmptyString,
                             configFileName.GetFullPath(),
                             wxEmptyString, wxCONFIG_USE_LOCAL_FILE);
      
   wxConfigBase::Set(gPrefs);

   // We introduced new file-based preferences in version 1.3.1; the
   // first time this version of Audacity is run we try to migrate
   // old preferences.
   bool newPrefsInitialized = false;
   gPrefs->Read(wxT("/NewPrefsInitialized"), &newPrefsInitialized, false);
   if (!newPrefsInitialized) {
      wxConfigBase *legacyConfig = new wxConfig(appName);
      CopyEntriesRecursive(wxT("/"), legacyConfig, gPrefs);
      delete legacyConfig;
      gPrefs->Write(wxT("/NewPrefsInitialized"), true);
   }
   
   gPrefs->Write(wxT("/Version"), wxString(AUDACITY_VERSION_STRING));

   // BG: Make sure the users prefs are up to date
   // BG: Otherwise reset some of them to their defaults
   wxString prefsversion;
   prefsversion = gPrefs->Read(wxT("/PrefsVersion"), wxT(""));

   if(prefsversion.CmpNoCase(wxString(wxT(AUDACITY_PREFS_VERSION_STRING))))
   {
      // BG: Reset the prefs by removing them
      if(gPrefs->Exists(wxT("/Keyboard")))
         gPrefs->DeleteGroup(wxT("/Keyboard"));
      if(gPrefs->Exists(wxT("/Locale")))
         gPrefs->DeleteGroup(wxT("/Locale"));
      gPrefs->Write(wxT("/PrefsVersion"), wxString(wxT(AUDACITY_PREFS_VERSION_STRING)));
   }
}
예제 #9
0
// Try to load previously saved camera calibration from a file.
void StereoNode::loadIntrinsics(Camera &cam, sensor_msgs::CameraInfo &msg_info)
{
  char buffer[12800];

  std::string MyPath = config_path_ + "/" + configFileName(cam);
  std::fstream param_file;
  param_file.open(MyPath.c_str(), std::ios::in);

  if (param_file.is_open()) {
    param_file.read(buffer, 12800);
    param_file.close();
  }

  // Parse calibration file
  std::string camera_name;
  if (camera_calibration_parsers::parseCalibrationIni(buffer, camera_name, msg_info)) {
    ROS_INFO("Calibration : %s %u", camera_name.c_str(), cam.getCameraSerialNo());
  } else {
    ROS_WARN("Failed to load intrinsics for camera from file");
  }
}
예제 #10
0
std::vector<std::string> getConfigFileName()
{
  std::vector<std::string> configFileName(3);

  configFileName[0] = KIM_USER_CONFIGURATION_FILE;

  if (configFileName[0][0] != '/')
  {
    // probably need a better way to get HOME
    configFileName[0]
        = std::string(getenv("HOME")).append("/").append(configFileName[0]);
  }

  configFileName[1] = KIM_ENVIRONMENT_CONFIGURATION_FILE;
  char const * const varVal = getenv(KIM_ENVIRONMENT_CONFIGURATION_FILE);
  if (NULL != varVal)
  {
    // ensure we have an absolute path
    if (varVal[0] != '/')
    {
      // probably need a better way to get PWD
      configFileName[2] = std::string(getenv("PWD"));
      configFileName[2].append("/");
      configFileName[2].append(varVal);
    }
    else
    {
      configFileName[2] = std::string(varVal);
    }
    configFileName[0] = varVal;
  }
  else
  {
    configFileName[2] = std::string("");
  }

  return configFileName;
}
예제 #11
0
int main( int argc, char* argv[] ) {


  if( argc<2 ) {
    std::cout << "USAGE: ./fitSignalShapes [configFileName]" << std::endl;
    std::cout << "Exiting." << std::endl;
    exit(11);
  }


  std::string configFileName(argv[1]);
  ZGConfig cfg(configFileName);


  ZGDrawTools::setStyle();
  
  std::vector<float> masses;
  //masses.push_back( 350. );
  masses.push_back( 400. );
  masses.push_back( 450. );
  masses.push_back( 500. );
  masses.push_back( 750. );
  masses.push_back( 1000. );
  masses.push_back( 1250. );
  masses.push_back( 1500. );
  masses.push_back( 1750. );
  masses.push_back( 2000. );
  //masses.push_back( 300. );
  //masses.push_back( 400. );
  //masses.push_back( 500. );
  //masses.push_back( 750. );
  //masses.push_back( 1000. );
  //masses.push_back( 1500. );
  //masses.push_back( 2000. );
  //masses.push_back( 2500. );
  //masses.push_back( 3000. );
  //masses.push_back( 5000. );

  std::vector<std::string> widths;
  widths.push_back( "5p6" );
  widths.push_back( "0p014" );

  for( unsigned iw =0; iw<widths.size(); ++iw ) {

    std::string outdir(Form("%s/signalShapes_w%s", cfg.getEventYieldDir().c_str(), widths[iw].c_str()));
    system( Form("mkdir -p %s", outdir.c_str() ) );

    TFile* outfile = TFile::Open(Form("%s/signalShapeParameters_w%s.root", outdir.c_str(), widths[iw].c_str()), "recreate");
    outfile->cd();

    //fitGraphs( cfg, masses, widths[iw], outdir, outfile, "all" );
    fitGraphs( cfg, masses, widths[iw], outdir, outfile, "ee", "leptType==11" );
    fitGraphs( cfg, masses, widths[iw], outdir, outfile, "mm", "leptType==13" );

    drawCompare( cfg, outdir, outfile, widths[iw], "mean"  , "Gaussian Mean [GeV]"   , "ee", "ee#gamma", "mm", "#mu#mu#gamma" );
    drawCompare( cfg, outdir, outfile, widths[iw], "sigma" , "Gaussian #sigma [GeV]" , "ee", "ee#gamma", "mm", "#mu#mu#gamma" );
    drawCompare( cfg, outdir, outfile, widths[iw], "width" , "Gaussian #sigma/#mu"   , "ee", "ee#gamma", "mm", "#mu#mu#gamma" );
    drawCompare( cfg, outdir, outfile, widths[iw], "alpha1", "CB left #alpha"        , "ee", "ee#gamma", "mm", "#mu#mu#gamma" );
    drawCompare( cfg, outdir, outfile, widths[iw], "alpha2", "CB right #alpha"       , "ee", "ee#gamma", "mm", "#mu#mu#gamma" );
    drawCompare( cfg, outdir, outfile, widths[iw], "n1"    , "CB left N"             , "ee", "ee#gamma", "mm", "#mu#mu#gamma" );
    drawCompare( cfg, outdir, outfile, widths[iw], "n2"    , "CB right N"            , "ee", "ee#gamma", "mm", "#mu#mu#gamma" );

    outfile->Close();

  } // for widths

  return 0;

}
예제 #12
0
void InitPreferences()
{
   wxString appName = wxTheApp->GetAppName();

   wxFileName configFileName(FileNames::DataDir(), wxT("audacity.cfg"));

   gPrefs = new wxFileConfig(appName, wxEmptyString,
                             configFileName.GetFullPath(),
                             wxEmptyString, wxCONFIG_USE_LOCAL_FILE);
      
   wxConfigBase::Set(gPrefs);

   // We introduced new file-based preferences in version 1.3.1; the
   // first time this version of Audacity is run we try to migrate
   // old preferences.
   bool newPrefsInitialized = false;
   gPrefs->Read(wxT("/NewPrefsInitialized"), &newPrefsInitialized, false);
   if (!newPrefsInitialized) {
      wxConfigBase *legacyConfig = new wxConfig(appName);
      CopyEntriesRecursive(wxT("/"), legacyConfig, gPrefs);
      delete legacyConfig;
      gPrefs->Write(wxT("/NewPrefsInitialized"), true);
   }
   
   gPrefs->Write(wxT("/Version"), wxString(AUDACITY_VERSION_STRING));

   // BG: Make sure the users prefs are up to date
   // BG: Otherwise reset some of them to their defaults
   wxString prefsversion;
   prefsversion = gPrefs->Read(wxT("/PrefsVersion"), wxT(""));

   if(prefsversion.CmpNoCase(wxString(wxT(AUDACITY_PREFS_VERSION_STRING))))
   {
      // BG: Reset the prefs by removing them
      if(gPrefs->Exists(wxT("/Keyboard")))
         gPrefs->DeleteGroup(wxT("/Keyboard"));
      if(gPrefs->Exists(wxT("/Locale")))
         gPrefs->DeleteGroup(wxT("/Locale"));
      gPrefs->Write(wxT("/PrefsVersion"), wxString(wxT(AUDACITY_PREFS_VERSION_STRING)));
   }
   
   // Check if some prefs updates need to happen based on audacity version.
   // Unfortunately we can't use the PrefsVersion prefs key because that resets things.
   // In the future we may want to integrate that better.
   // these are done on a case-by-case basis for now so they must be backwards compatible
   // (meaning the changes won't mess audacity up if the user goes back to an earlier version)
   int vMajor = gPrefs->Read(wxT("/Version/Major"), (long) 0);
   int vMinor = gPrefs->Read(wxT("/Version/Minor"), (long) 0);
   int vMicro = gPrefs->Read(wxT("/Version/Micro"), (long) 0);
   
   // These integer version keys were introduced april 4 2011 for 1.3.13
   // The device toolbar needs to be enabled due to removal of source selection features in
   // the mixer toolbar.
   if ((vMajor < 1) || 
       (vMajor == 1 && vMinor < 3) ||
       (vMajor == 1 && vMinor == 3 && vMicro < 13)) {
       
       
      // Do a full reset of the Device Toolbar to get it on the screen.
      if (gPrefs->Exists(wxT("/GUI/ToolBars/Device")))
         gPrefs->DeleteGroup(wxT("/GUI/ToolBars/Device"));
      
      // We keep the mixer toolbar prefs (shown/not shown)
      // the width of the mixer toolbar may have shrunk, the prefs will keep the larger value
      // if the user had a device that had more than one source.
      if (gPrefs->Exists(wxT("/GUI/ToolBars/Mixer"))) {
         // Use the default width
         gPrefs->Write(wxT("/GUI/ToolBars/Mixer/W"), -1);
      }
   }
  
   gPrefs->Write(wxT("/Version/Major"), AUDACITY_VERSION);
   gPrefs->Write(wxT("/Version/Minor"), AUDACITY_RELEASE); 
   gPrefs->Write(wxT("/Version/Micro"), AUDACITY_REVISION);   
}
예제 #13
0
int main( int argc, char* argv[] ) {


    std::cout << std::endl << std::endl;
    std::cout << "------------------------------------------------------" << std::endl;
    std::cout << "|                                                    |" << std::endl;
    std::cout << "|                                                    |" << std::endl;
    std::cout << "|               Running runZGAnalysis                |" << std::endl;
    std::cout << "|                                                    |" << std::endl;
    std::cout << "|                                                    |" << std::endl;
    std::cout << "------------------------------------------------------" << std::endl;
    std::cout << std::endl << std::endl;




    if( argc<2 ) {
        std::cout << "USAGE: ./runZGAnalysis [configFileName] [data/MC]" << std::endl;
        std::cout << "Exiting." << std::endl;
        exit(11);
    }


    std::string configFileName(argv[1]);
    ZGConfig cfg(configFileName);



    bool onlyData = false;
    bool onlyMC   = false;
    bool onlySignal = false;
    bool noSignals = false;
    if( argc > 2 ) {

        std::string dataMC(argv[2]);
        if( dataMC=="data" ) onlyData = true;
        else if( dataMC=="MC" || dataMC=="mc" ) onlyMC = true;
        else if( dataMC=="mcbg" || dataMC=="mcBG" || dataMC=="MCBG" || dataMC=="mc_bg" || dataMC=="MC_BG" ) {
            onlyMC = true;
            noSignals = true;
        } else if( dataMC=="signal" ) onlySignal = true;
        else {
            std::cout << "-> You passed a second argument that isn't 'data', nor 'MC', nor 'signal', so I don't know what to do about it." << std::endl;
        }

    } else {

        std::cout << "-> Will run on both data and MC." << std::endl;

    }


    if( onlyMC ) {
        std::cout << "-> Will run only on MC." << std::endl;
        if( noSignals ) {
            std::cout << "-> Will skip signal." << std::endl;
        }
    }

    if( onlyData ) {
        std::cout << "-> Will run only on data." << std::endl;
    }


    std::string outputdir = cfg.getEventYieldDir();
    system(Form("mkdir -p %s", outputdir.c_str()));


    std::string outfileName(Form("%s/trees_tmp.root", outputdir.c_str()));

    TFile* outfile = TFile::Open(outfileName.c_str(), "update");
    outfile->cd();





    if( !onlyData && !onlySignal ) { // run on MC


        std::string samplesFileName = "../samples/samples_" + cfg.mcSamples() + ".dat";
        std::cout << std::endl << std::endl;
        std::cout << "-> Loading samples from file: " << samplesFileName << std::endl;


        std::vector<ZGSample> fSamples = ZGSample::loadSamples(samplesFileName);
        //std::vector<ZGSample> fSamples = ZGSample::loadSamples(samplesFileName, 100, 999);
        if( fSamples.size()==0 ) {
            std::cout << "There must be an error: samples is empty!" << std::endl;
            exit(120);
        }


        //addTreeToFile( outfile, "zg", fSamples, cfg);
        addTreeToFile( outfile, "zg", fSamples, cfg, 851, 852 );
        addTreeToFile( outfile, "dy", fSamples, cfg, 700, 710 );
        //addTreeToFile( outfile, "top", fSamples, cfg, 300, 499 ); // irrelevant


        std::cout << "-> Done looping on MC samples." << std::endl;


    } // if MC samples



    // load signal samples, if any
    if( cfg.mcSamples()!="" && cfg.additionalStuff()!="noSignals" && !noSignals && !onlyData ) {

        std::string samplesFileName = "../samples/samples_" + cfg.mcSamples() + ".dat";
        std::cout << std::endl << std::endl;
        std::cout << "-> Loading signal samples from file: " << samplesFileName << std::endl;

        std::vector<ZGSample> fSamples = ZGSample::loadSamples(samplesFileName, 1000); // only signal (id>=1000)


        if( fSamples.size()==0 ) {

            std::cout << "No signal samples found, skipping." << std::endl;

        } else {

            for( unsigned i=0; i<fSamples.size(); ++i )
                addTreeToFile( outfile, fSamples[i], cfg );

        } // if samples != 0

    } // if mc samples



    if( !(cfg.dummyAnalysis()) && cfg.dataSamples()!="" && !onlyMC  && !onlySignal ) {


        std::string samplesFile_data = "../samples/samples_" + cfg.dataSamples() + ".dat";

        std::cout << std::endl << std::endl;
        std::cout << "-> Loading data from file: " << samplesFile_data << std::endl;

        std::vector<ZGSample> samples_data = ZGSample::loadSamples(samplesFile_data);
        if( samples_data.size()==0 ) {
            std::cout << "There must be an error: samples_data is empty!" << std::endl;
            exit(1209);
        }


        addTreeToFile( outfile, "data" , samples_data, cfg );

        std::cout << "-> Done looping on data." << std::endl;

    }


    outfile->Close();

    std::string finalFileName = outputdir + "/trees.root";
    system( Form("cp %s %s", outfileName.c_str(), finalFileName.c_str()) );

    std::cout << "-> Wrote trees to file: " << finalFileName << std::endl;



    return 0;

}
예제 #14
0
void ConfigStorage::checkFile()
{
	if (m_cfg_file >= 0)
		return;

	char* cfg_file_name = m_sharedMemory->getHeader()->cfg_file_name;

	if (!(*cfg_file_name))
	{
		fb_assert(m_sharedMemory->getHeader()->cnt_uses == 0);

		char dir[MAXPATHLEN];
		iscPrefixLock(dir, "", true);

		PathName filename = TempFile::create("fb_trace_", dir);
		filename.copyTo(cfg_file_name, sizeof(m_sharedMemory->getHeader()->cfg_file_name));
		m_cfg_file = os_utils::openCreateSharedFile(cfg_file_name, O_BINARY);
	}
	else
	{
		m_cfg_file = ::open(cfg_file_name, O_RDWR | O_BINARY);

		if (m_cfg_file < 0)
			checkFileError(cfg_file_name, "open", isc_io_open_err);
	}

	// put default (audit) trace file contents into storage
	if (m_sharedMemory->getHeader()->change_number == 0)
	{
		FILE* cfgFile = NULL;

		try
		{
			PathName configFileName(Config::getAuditTraceConfigFile());

			// remove quotes around path if present
			{ // scope
				const FB_SIZE_T pathLen = configFileName.length();
				if (pathLen > 1 && configFileName[0] == '"' &&
					configFileName[pathLen - 1] == '"')
				{
					configFileName.erase(0, 1);
					configFileName.erase(pathLen - 2, 1);
				}
			}

			if (configFileName.empty())
				return;

			if (PathUtils::isRelative(configFileName))
			{
				PathName root(Config::getRootDirectory());
				PathUtils::ensureSeparator(root);
				configFileName.insert(0, root);
			}

			cfgFile = fopen(configFileName.c_str(), "rb");
			if (!cfgFile) {
				checkFileError(configFileName.c_str(), "fopen", isc_io_open_err);
			}

			TraceSession session(*getDefaultMemoryPool());

			fseek(cfgFile, 0, SEEK_END);
			const long len = ftell(cfgFile);
			if (len)
			{
				fseek(cfgFile, 0, SEEK_SET);
				char* p = session.ses_config.getBuffer(len + 1);

				if (fread(p, 1, len, cfgFile) != size_t(len)) {
					checkFileError(configFileName.c_str(), "fread", isc_io_read_err);
				}
				p[len] = 0;
			}
			else {
				gds__log("Audit configuration file \"%s\" is empty", configFileName.c_str());
			}

			session.ses_user = SYSDBA_USER_NAME;
			session.ses_name = "Firebird Audit";
			session.ses_flags = trs_admin | trs_system;

			addSession(session);
		}
		catch(const Exception& ex)
		{
			ISC_STATUS_ARRAY temp;
			ex.stuff_exception(temp);
			iscLogStatus("Cannot open audit configuration file", temp);
		}

		if (cfgFile) {
			fclose(cfgFile);
		}
	}
}
예제 #15
0
int main( int argc, char* argv[] ) {

  if( argc<2 ) {
    std::cout << "USAGE: ./drawMuonScaleSyst [configFileName]" << std::endl;
    std::cout << "Exiting." << std::endl;
    exit(11);
  }


  ZGDrawTools::setStyle();

  std::string configFileName(argv[1]);
  ZGConfig cfg(configFileName);

  std::string dir = cfg.getEventYieldDir() + "/muonScaleSyst";
  

  TFile* file = TFile::Open( Form("%s/muonScaleSyst.root", dir.c_str()) );

  TGraph* gr_muScale  = (TGraph*)file->Get("gr_muScaleSyst" );
  TGraph* gr_egmScale = (TGraph*)file->Get("gr_egmScaleSyst");

  TCanvas* c1 = new TCanvas( "c1", "", 600, 600 );
  c1->cd();

  TH2D* h2_axes = new TH2D("axes", "", 10, 200., 2100., 10, 0., 0.07);
  h2_axes->SetXTitle( "Generated Signal Mass [GeV]" );
  h2_axes->SetYTitle( "Muon Scale Systematic Uncertainty" );
  h2_axes->Draw();

  gr_muScale->SetMarkerStyle(20); 
  gr_muScale->SetMarkerSize(1.5);
  gr_muScale->SetMarkerColor(kBlack);

  gr_muScale->Draw("psame");

  ZGDrawTools::addLabels(c1, -1., "CMS Simulation");

  gPad->RedrawAxis();

  c1->SaveAs( Form("%s/muonScaleSyst.eps", dir.c_str()) );
  c1->SaveAs( Form("%s/muonScaleSyst.pdf", dir.c_str()) );

  c1->Clear();


  h2_axes->SetYTitle("Photon Scale Systematic Uncertainty");
  h2_axes->Draw();

  gr_egmScale->SetMarkerStyle(20); 
  gr_egmScale->SetMarkerSize(1.5);
  gr_egmScale->SetMarkerColor(kBlack);

  TF1* f1 = new TF1("line", "[0]", 200, 2100);
  f1->SetLineColor(kRed);
  gr_egmScale->Fit( f1, "QR" );

  gr_egmScale->Draw("Psame");

  ZGDrawTools::addLabels(c1, -1., "CMS Simulation");

  gPad->RedrawAxis();

  c1->SaveAs( Form("%s/muEgmScaleSyst.eps", dir.c_str()));
  c1->SaveAs( Form("%s/muEgmScaleSyst.pdf", dir.c_str()));

  return 0;

}