Esempio n. 1
0
// ============================================================================
// update the content of Data-On-Demand actions
// ============================================================================
StatusCode DataOnDemandSvc::update ()
{
  if ( !m_updateRequired ) { return StatusCode::SUCCESS  ; }

  /// convert obsolete "Nodes"      into new "NodeMap"
  StatusCode sc = setupNodeHandlers() ; // convert "Nodes"      new "NodeMap"
  if ( sc.isFailure() )
  {
    stream() << MSG::ERROR << "Failed to setup old \"Nodes\""      << endmsg ;
    return sc ;
  }
  /// convert obsolete "Algorithms" into new "AlgMap"
  sc = setupAlgHandlers()   ; // convert "Algorithms" into "AlgMap"
  if ( sc.isFailure() )
  {
    stream() << MSG::ERROR << "Failed to setup old \"Algorithms\"" << endmsg ;
    return sc ;
  }
  /// add the default prefix
  add_prefix ( m_algMap  , m_prefix ) ;
  /// add the default prefix
  add_prefix ( m_nodeMap , m_prefix ) ;
  /// get all directories
  typedef std::set<std::string> Set ;
  Set dirs ;
  if ( m_partialPath ){ get_dirs ( m_algMap  , dirs ) ; }
  if ( m_partialPath ){ get_dirs ( m_nodeMap , dirs ) ; }
  //
  Set::iterator _e = dirs.find("/Event") ;
  if ( dirs.end() != _e ) { dirs.erase( _e ) ; }
  // add all directories as nodes
  for ( Set::const_iterator dir = dirs.begin() ; dirs.end() != dir ; ++dir )
  {
    if ( m_algMap  .end () != m_algMap  .find ( *dir ) ) { continue ; }
    if ( m_nodeMap .end () != m_nodeMap .find ( *dir ) ) { continue ; }
    m_nodeMap [*dir] = "DataObject" ;
  }
  //
  m_algs  .clear  () ;
  m_nodes .clear  () ;
  //
  /// setup algorithms
  for ( Map::const_iterator ialg = m_algMap.begin() ;
        m_algMap.end() != ialg ; ++ialg )
  {
    if (i_setAlgHandler(ialg->first, ialg->second).isFailure())
      return StatusCode::FAILURE;
  }
  /// setup nodes
  for ( Map::const_iterator inode = m_nodeMap.begin() ;
        m_nodeMap.end() != inode ; ++inode )
  {
    i_setNodeHandler(inode->first, inode->second);
  }
  ///
  m_updateRequired = false ;
  //
  return StatusCode::SUCCESS ;
}
Esempio n. 2
0
void finalize_oneDataset( const std::string& redntpProdVersion, const std::string& dataset, const std::string& selectionType, const std::string& bTaggerType, std::vector<std::string> *datasets ) {

  TString dataset_tstr(dataset);

  std::cout << std::endl << std::endl << std::endl << "####     Finalizing " << dataset << std::endl;
  std::cout << "####     Selection: " << selectionType << std::endl;
  std::cout << "####     b-Tagger: " << bTaggerType << std::endl << std::endl;

  RedntpDirStruct dirs = get_dirs( redntpProdVersion );

  RedNtpFinalizer_VHgg* rf = new RedNtpFinalizer_VHgg( dataset, selectionType, bTaggerType );
  //rf->set_redNtpDir("/xrootdfs/cms/local/pandolf/HiggsGammaGamma/reduced/redntp.52xv5_VH_feasibility_signalOnly.cicpfloose.regrPho_eCorr_20062012.VH_feasibility_v0/merged");

  bool isData = ( dataset_tstr.Contains("Run2011") || dataset_tstr.Contains("Run2012") );

  std::string redNtpDir = dirs.maindir;
  if( isData ) redNtpDir = redNtpDir + "/" + dirs.datadir;
  else         redNtpDir = redNtpDir + "/" + dirs.mcdir;

  rf->set_redNtpDir(redNtpDir);
  rf->set_outputDir("finalizedTrees_"+redntpProdVersion);
  rf->addFile(dataset);
  rf->finalize();
  delete rf;

  datasets->push_back(dataset);

}
Esempio n. 3
0
void finalize_oneDataset( const std::string& redntpProdVersion, const std::string& dataset, const std::string& selectionType, const std::string& bTaggerType, std::vector<std::string> *datasets ) {

  TString dataset_tstr(dataset);

  std::cout << std::endl << std::endl << std::endl << "####     Finalizing " << dataset << std::endl;
  std::cout << "####     Selection: " << selectionType << std::endl;
  std::cout << "####     Ntuple version: " << redntpProdVersion << std::endl;
  std::cout << "####     b-Tagger: " << bTaggerType << std::endl << std::endl;

  RedntpDirStruct dirs = get_dirs( redntpProdVersion );

  // lousy patch
  bool use_mcdir2=false;
  if( dataset=="tHqLeptonic_mH125_8TeV_testtest" || dataset=="tHqHadronic_mH125_8TeV_testtest" || dataset_tstr.BeginsWith("TT_CT10") || dataset_tstr.BeginsWith("T_") || dataset_tstr.BeginsWith("Tbar_") )
    if( dirs.mcdir2!="" )
      use_mcdir2 = true;

  RedNtpFinalizer_THq* rf = new RedNtpFinalizer_THq( dataset, selectionType, bTaggerType );
  //rf->set_redNtpDir("/xrootdfs/cms/local/pandolf/HiggsGammaGamma/reduced/redntp.52xv5_VH_feasibility_signalOnly.cicpfloose.regrPho_eCorr_20062012.VH_feasibility_v0/merged");

  bool isData = ( dataset_tstr.Contains("Run2011") || dataset_tstr.Contains("Run2012") );

  std::string redNtpDir = dirs.maindir;
  if( isData ) redNtpDir = redNtpDir + "/" + dirs.datadir;
  else {
    if( use_mcdir2 )       redNtpDir = redNtpDir + "/" + dirs.mcdir2;
    else                   redNtpDir = redNtpDir + "/" + dirs.mcdir;
  }


  rf->set_redNtpDir(redNtpDir);
  rf->set_outputDir("finalizedTrees_"+redntpProdVersion);
  rf->addFile(dataset);
  if( use_inverted_photID ) 
    rf->invertPhotID();
  rf->finalize();
  delete rf;

  datasets->push_back(dataset);

}
Esempio n. 4
0
/*!
  \brief personality_choice() is called from a one shot timeout from main
  in order to open the window to ask the user what ECU family to deal with
  running.
  */
G_MODULE_EXPORT gboolean personality_choice(void)
{
	GtkWidget *dialog = NULL;
	GtkWidget *vbox = NULL;
	GtkWidget *hbox = NULL;
	GtkWidget *ebox = NULL;
	GtkWidget *sep = NULL;
	GtkWidget *button = NULL;
	GtkWidget *label = NULL;
	gchar ** dirs = NULL;
	gchar * filename = NULL;
	PersonaElement *element = NULL;
	gchar *tmpbuf = NULL;
	gboolean shouldjump = FALSE;
	gchar *name = NULL;
	GArray *classes = NULL;
	GSList *group = NULL;
	GList *p_list = NULL;
	GList *s_list = NULL;
	ConfigFile *cfgfile = NULL;
	guint i = 0;
	gint result = 0;
	gchar * pathstub = NULL;
	extern gconstpointer *global_data;

	pathstub = g_build_filename(INTERROGATOR_DATA_DIR,"Profiles",NULL);
	dirs = get_dirs((const gchar *)DATA_GET(global_data,"project_name"),pathstub,&classes);
	if (!dirs)
	{
		MTXDBG(CRITICAL,_("NO Interrogation profiles found, was MegaTunix installed properly?\n"));
		return FALSE;
	}
	i = 0;
	while (dirs[i])
	{
		tmpbuf = g_build_filename(dirs[i],"details.cfg",NULL);
		cfgfile = cfg_open_file(tmpbuf);
		if (!cfgfile)
		{
			/*MTXDBG(CRITICAL,_("\"%s\" file missing!, was MegaTunix installed properly?\n"),tmpbuf);*/
			i++;
			g_free(tmpbuf);
			continue;

		}
		g_free(tmpbuf);
		element = g_new0(PersonaElement, 1);
		cfg_read_string(cfgfile,"Family","sequence",&element->sequence);
		cfg_read_string(cfgfile,"Family","friendly_name",&element->name);
		cfg_read_string(cfgfile,"Family","persona",&element->persona);
		cfg_read_string(cfgfile,"Family","ecu_lib",&element->ecu_lib);
		cfg_read_string(cfgfile,"Family","common_lib",&element->common_lib);
		if (!cfg_read_string(cfgfile,"Family","baud",&element->baud_str))
			MTXDBG(CRITICAL,_("\"details.cfg\" baud string undefined!, was MegaTunix installed properly?\n"));
		element->dirname = g_strdup(dirs[i]);
		element->filename = g_path_get_basename(dirs[i]);
		if (g_strcasecmp(element->filename,(gchar *)DATA_GET(global_data,"last_ecu_family")) == 0)
			element->def = TRUE;
		if ((DATA_GET(global_data,"cli_persona")) && (element->persona))
		{
			if (g_strcasecmp(element->persona, (gchar *)DATA_GET(global_data,"cli_persona")) == 0)
			{
				button = gtk_toggle_button_new();
				gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(button),TRUE);
				persona_selection(button,(gpointer)element);
				g_object_ref_sink(button);
				g_object_unref(button);
				shouldjump = TRUE;
			}
		}

		if (g_array_index(classes,FileClass,i) == PERSONAL)
			p_list = g_list_prepend(p_list,(gpointer)element);
		if (g_array_index(classes,FileClass,i) == SYSTEM)
			s_list = g_list_prepend(s_list,(gpointer)element);
		g_free(name);
		i++;
		cfg_free(cfgfile);	
	}
	p_list = g_list_sort(p_list,persona_seq_sort);
	s_list = g_list_sort(s_list,persona_seq_sort);
	g_strfreev(dirs);
	g_array_free(classes,TRUE);
	if (shouldjump)
	{
		g_list_foreach(p_list,free_persona_element,NULL);
		g_list_foreach(s_list,free_persona_element,NULL);
		g_list_free(p_list);
		g_list_free(s_list);
		DATA_SET(global_data,"cli_persona",NULL);
		if (DATA_GET(global_data,"offline"))
			goto jumpahead_offline;
		else
			goto jumpahead;
	}

	set_title(g_strdup(_("Choose an ECU family?")));
	update_logbar("interr_view","warning",_("Prompting user for ECU family to interrogate...\n"),FALSE,FALSE,FALSE);

	dialog = gtk_dialog_new_with_buttons("Select ECU Personality",
			GTK_WINDOW(lookup_widget("main_window")),
			GTK_DIALOG_DESTROY_WITH_PARENT,
			"Exit MegaTunix",
			GTK_RESPONSE_CLOSE,
			"Go Offline",
			GTK_RESPONSE_CANCEL,
			"Find my ECU",
			GTK_RESPONSE_OK,
			NULL);
	vbox = gtk_vbox_new(TRUE,2);
	gtk_container_set_border_width(GTK_CONTAINER(vbox),5);
	//gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox),vbox,TRUE,TRUE,0);
	gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))),vbox,TRUE,TRUE,0);
	if (g_list_length(p_list) > 0)
	{
		label = gtk_label_new("Custom (personal) Profiles");
		gtk_box_pack_start(GTK_BOX(vbox),label,TRUE,TRUE,0);

		group = NULL;
		/* Cycle list for PERSONAL profile files */
		for (i=0;i<g_list_length(p_list);i++)
		{
			element = (PersonaElement *)g_list_nth_data(p_list,i);

			ebox = gtk_event_box_new();
			gtk_box_pack_start(GTK_BOX(vbox),ebox,TRUE,TRUE,0);
			hbox = gtk_hbox_new(FALSE,10);
			gtk_container_add(GTK_CONTAINER(ebox),hbox);
			label = gtk_label_new(element->name);
			gtk_box_pack_start(GTK_BOX(hbox),label,FALSE,TRUE,0);
			if (!check_for_files (element->dirname,"prof"))
			{
				gtk_widget_set_sensitive(ebox,FALSE);
				button = gtk_radio_button_new(NULL);
			}
			else
			{
				button = gtk_radio_button_new(group);
				group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(button));
			}
			g_signal_connect(button,
					"toggled",
					G_CALLBACK(persona_selection),
					element);
			gtk_box_pack_end(GTK_BOX(hbox),button,FALSE,TRUE,0);
			if (element->def)
			{
				gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(button),TRUE);
				gtk_toggle_button_toggled(GTK_TOGGLE_BUTTON(button));
			}
		}

		sep = gtk_hseparator_new();
		gtk_box_pack_start(GTK_BOX(vbox),sep,TRUE,TRUE,0);
	}
	label = gtk_label_new("System Wide ECU Profiles");
	gtk_box_pack_start(GTK_BOX(vbox),label,TRUE,TRUE,0);
	/* Cycle list for System interogation files */
	for (i=0;i<g_list_length(s_list);i++)
	{
		element = (PersonaElement *)g_list_nth_data(s_list,i);
		ebox = gtk_event_box_new();
		gtk_box_pack_start(GTK_BOX(vbox),ebox,TRUE,TRUE,0);
		hbox = gtk_hbox_new(FALSE,10);
		gtk_container_add(GTK_CONTAINER(ebox),hbox);
		label = gtk_label_new(element->name);
		gtk_box_pack_start(GTK_BOX(hbox),label,FALSE,TRUE,0);
		if (!check_for_files (element->dirname,"prof"))
		{
			gtk_widget_set_sensitive(ebox,FALSE);
			button = gtk_radio_button_new(NULL);
		}
		else
		{
			button = gtk_radio_button_new(group);
			group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(button));
		}
		g_signal_connect(button,
				"toggled",
				G_CALLBACK(persona_selection),
				element);
		gtk_box_pack_end(GTK_BOX(hbox),button,FALSE,TRUE,0);
		if (element->def)
		{
			gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(button),TRUE);
			gtk_toggle_button_toggled(GTK_TOGGLE_BUTTON(button));
		}
	}

	gtk_widget_show_all(dialog);
	result = gtk_dialog_run(GTK_DIALOG(dialog));
	gtk_widget_destroy(dialog);
	g_list_foreach(p_list,free_persona_element,NULL);
	g_list_foreach(s_list,free_persona_element,NULL);
	g_list_free(p_list);
	g_list_free(s_list);
	switch (result)
	{
		case GTK_RESPONSE_CLOSE:
			leave(NULL,NULL);
			break;
		case GTK_RESPONSE_ACCEPT:
		case GTK_RESPONSE_OK: /* Normal mode */
jumpahead:
			plugins_init();
			pathstub = g_build_filename(INTERROGATOR_DATA_DIR,"Profiles",DATA_GET(global_data,"ecu_family"),"comm.xml",NULL);
			filename = get_file((const gchar *)DATA_GET(global_data,"project_name"),pathstub,NULL);
			g_free(pathstub);
			load_comm_xml(filename);
			g_free(filename);
			io_cmd("interrogation",NULL);
			break;
		default: /* Offline */
jumpahead_offline:
			plugins_init();
			pathstub = g_build_filename(INTERROGATOR_DATA_DIR,"Profiles",DATA_GET(global_data,"ecu_family"),"comm.xml",NULL);
			filename = get_file((const gchar *)DATA_GET(global_data,"project_name"),pathstub,NULL);
			g_free(pathstub);
			load_comm_xml(filename);
			g_free(filename);
			g_timeout_add(100,(GSourceFunc)set_offline_mode,NULL);
			return FALSE;
	}
	return FALSE;
}
Esempio n. 5
0
void GaugeField::smearing_hyp(const ssize_t t,
                              const double alpha_1,
                              const double alpha_2,
                              const ssize_t iter) {
  // temporal timeslice twice the size for decorated links
  array_3cd_d2_eigen dec_timeslice(boost::extents[V3][6]);

  // temporal timeslice from decorated links
  array_3cd_d2_eigen eigen_timeslice_ts(boost::extents[V3][3]);
  // temporal integers holding directions for decorated smearing
  int mu, nu, eta;
  for (ssize_t run = 0; run < iter; ++run) {
    // calculate inner staple from original timeslice, store in dec_timeslice each link
    // can get smeared in two planes
    for (int vol = 0; vol < V3; ++vol) {
      for (int dir = 0; dir < 3; ++dir) {
        // inner staple
        Eigen::Matrix3cd inner_staple = Eigen::Matrix3cd::Zero();
        std::array<Eigen::Matrix3cd, 2> tmp_staples;
        std::array<int, 2> perpendics = get_dirs(dir);
        for (auto it_perp_dir = perpendics.begin(); it_perp_dir != perpendics.end();
             ++it_perp_dir) {
          int perp_dir = *it_perp_dir;
          // up-type smearing_indices
          mu = iup[vol][perp_dir];
          nu = iup[mu][dir];
          eta = iup[vol][dir];
          // product of up matrices
          inner_staple =
              tslices.at(t)[vol][perp_dir] *
              (tslices.at(t)[mu][dir] * (tslices.at(t)[eta][perp_dir].adjoint()));
          // down-type smearing indices
          mu = idown[vol][perp_dir];
          nu = iup[mu][dir];
          // eta is same endpoint no adjoint necessary here
          // product of down matrices
          inner_staple += (tslices.at(t)[mu][perp_dir].adjoint()) *
                          (tslices.at(t)[mu][dir] * tslices.at(t)[nu][perp_dir]);
          // Careful placement of decorated links in dec_timeslices:
          // dir=0 has placement in dec_dir = 0 (smeared in 1 plane)
          //                       dec_dir = 3 (smeared in 2 plane)
          // dir=1 has placement in dec_dir = 1 (smeared in 0 plane)
          //                       dec_dir = 4 (smeared in 2 plane)
          // dir=2 has placement in dec_dir = 2 (smeared in 0 plane)
          //                       dec_dir = 5 (smeared in 1 plane)
          Eigen::Matrix3cd stac =
              (tslices.at(t)[vol][dir] * (1 - alpha_2)) + (inner_staple * alpha_2 / 2.);
          int n_el = it_perp_dir - perpendics.begin();
          tmp_staples.at(n_el) = proj_to_su3_imp(stac);
        }

        // staple link in direction dir in non participating and negative directions
        dec_timeslice[vol][dir] = tmp_staples.at(0);
        dec_timeslice[vol][dir + 3] = tmp_staples.at(1);
      }
    }
    // calculate outer staple from dec_timeslice as modified ape-smearing

    for (int i = 0; i < V3; ++i) {
      for (int dir = 0; dir < 3; ++dir) {
        Eigen::Matrix3cd outer_staple =
            Eigen::Matrix3cd::Zero();  // Holding all smearing matrices for one link

        // filling each element of smearer using 3 links
        // debugging link
        Eigen::Matrix3cd outer_staple_test;
        for (int not_dir = 0; not_dir < 3; ++not_dir) {
          if (dir != not_dir) {
            // calculate plane in which was smeared
            int plane = ((dir + 1) ^ (not_dir + 1)) - 1;
            mu = iup[i][not_dir];
            nu = iup[mu][dir];
            eta = idown[nu][not_dir];

            // Staples in positive direction
            // replace directions by appropriate decor
            int a, b;
            a = decor(not_dir, plane);
            b = decor(dir, plane);
            outer_staple += dec_timeslice[i][a] *
                            (dec_timeslice[mu][b] * (dec_timeslice[eta][a].adjoint()));
            mu = idown[i][not_dir];
            nu = iup[mu][dir];

            // Staples in negative direction
            outer_staple += (dec_timeslice[mu][a].adjoint()) *
                            (dec_timeslice[mu][b] *
                             dec_timeslice[nu][a]);  // structure has to be a_dag, b, a
          }
        }
        eigen_timeslice_ts[i][dir] =
            (tslices.at(t)[i][dir] * (1. - alpha_1)) + (outer_staple * alpha_1 / 4.);
      }
    }
    for (int i = 0; i < V3; ++i) {
      for (int mu = 0; mu < 3; ++mu) {
        tslices.at(t)[i][mu] = proj_to_su3_imp(eigen_timeslice_ts[i][mu]);
      }
    }
  }
  // clean up
}