예제 #1
0
// recursively walk through the state tree and build the tree view
// NOT CURRENTLY IN USE
// deprecated function, replaced by loadTreeState
void StateSelectionWindow::loadTree ( CustomTreeWidgetItem * parentItem , QList<SCState*> & states)
{
    int c = states.count();
    for(int i = 0; i < c; i++)
    {
        SCState * st = states.at(i);

        if ( !  st ) continue;

        CustomTreeWidgetItem * item=0;

        if (parentItem == 0)
        {
            item = new CustomTreeWidgetItem();
            _targetStateSelectionTree->addTopLevelItem((QTreeWidgetItem*)item);
        }
        else
        {
            item = new CustomTreeWidgetItem(parentItem);
        }


        item->setData(st);
        item->setText(0, st->attributes.value("name")->asString());
        item->setIcon(0, QIcon(":/SCFormView/cardboardbox.png"));
        item->setExpanded(true);

        // get all substates of this state
        QList<SCState*> subStates;
        st->getStates(subStates);
        loadTree (item, subStates);
    }
}
예제 #2
0
파일: main.c 프로젝트: Vaiz/PrefixTree
int main(int argc, char *argv[])
{
    if(1 >= argc)
        return 1;

    struct PrefixTree *tree = loadTree(argv[1]);

    char str[BUF_SIZE];
    while(1)
    {
        printf("Input string: ");
        scanf("%s", str);

        if(strcmp(str, "exit") == 0)
            break;

        if(1 == containsString(tree, str, strlen(str)))
            printf("YES\r\n");
        else
            printf("NO\r\n");

    }

    deletePrefixTree(tree);

    return 0;
}
예제 #3
0
void PhylogenyViewer::call_RAY_SLAVE_MODE_PHYLOGENY_MAIN(){
	if(!m_extractedColorsForPhylogeny){

		extractColorsForPhylogeny();

	}else if(!m_loadedTaxonsForPhylogeny){
	
		loadTaxons();

	}else if(!m_sentTaxonsToMaster){

		sendTaxonsToMaster();

	}else if(!m_sentTaxonControlMessage){
		
		#ifdef DEBUG_PHYLOGENY
		cout<<"Sending control message"<<endl;
		#endif

		m_switchMan->sendEmptyMessage(m_outbox,m_rank,
			MASTER_RANK,RAY_MPI_TAG_LOADED_TAXONS);

		m_sentTaxonControlMessage=true;

		m_synced=false;
	
	}else if(m_inbox->hasMessage(RAY_MPI_TAG_SYNCED_TAXONS)){
	
		copyTaxonsFromSecondaryTable();

		cout<<"Rank "<<m_rank<<" has "<<m_taxonsForPhylogeny.size()<<" taxons after syncing with master"<<endl;

		m_synced=true;
		m_loadedTree=false;

	}else if(!m_synced){

	}else if(!m_loadedTree){

		loadTree();
	
	}else if(!m_gatheredObservations){
	
		gatherKmerObservations();

	}else if(!m_syncedTree){
		
		sendTreeCounts();

	}else if(m_outbox->size()==0){

		#ifdef DEBUG_PHYLOGENY
		cout<<"Rank "<<m_rank<<" is closing call_RAY_SLAVE_MODE_PHYLOGENY_MAIN"<<endl;
		#endif

		cout<<endl;
		m_switchMan->closeSlaveModeLocally(m_outbox,m_rank);
	}
}
예제 #4
0
void FoldersPanel::showEvent(QShowEvent* event)
{
    if (event->spontaneous()) {
        Panel::showEvent(event);
        return;
    }

    if (!m_controller) {
        // Postpone the creating of the controller to the first show event.
        // This assures that no performance and memory overhead is given when the folders panel is not
        // used at all and stays invisible.
        KFileItemListView* view  = new KFileItemListView();
        view->setWidgetCreator(new KItemListWidgetCreator<FoldersItemListWidget>());
        view->setSupportsItemExpanding(true);
        // Set the opacity to 0 initially. The opacity will be increased after the loading of the initial tree
        // has been finished in slotLoadingCompleted(). This prevents an unnecessary animation-mess when
        // opening the folders panel.
        view->setOpacity(0);

        connect(view, &KFileItemListView::roleEditingFinished,
                this, &FoldersPanel::slotRoleEditingFinished);

        m_model = new KFileItemModel(this);
        m_model->setShowDirectoriesOnly(true);
        m_model->setShowHiddenFiles(FoldersPanelSettings::hiddenFilesShown());
        // Use a QueuedConnection to give the view the possibility to react first on the
        // finished loading.
        connect(m_model, &KFileItemModel::directoryLoadingCompleted, this, &FoldersPanel::slotLoadingCompleted, Qt::QueuedConnection);

        m_controller = new KItemListController(m_model, view, this);
        m_controller->setSelectionBehavior(KItemListController::SingleSelection);
        m_controller->setAutoActivationBehavior(KItemListController::ExpansionOnly);
        m_controller->setMouseDoubleClickAction(KItemListController::ActivateAndExpandItem);
        m_controller->setAutoActivationDelay(750);
        m_controller->setSingleClickActivationEnforced(true);

        connect(m_controller, &KItemListController::itemActivated, this, &FoldersPanel::slotItemActivated);
        connect(m_controller, &KItemListController::itemMiddleClicked, this, &FoldersPanel::slotItemMiddleClicked);
        connect(m_controller, &KItemListController::itemContextMenuRequested, this, &FoldersPanel::slotItemContextMenuRequested);
        connect(m_controller, &KItemListController::viewContextMenuRequested, this, &FoldersPanel::slotViewContextMenuRequested);
        connect(m_controller, &KItemListController::itemDropEvent, this, &FoldersPanel::slotItemDropEvent);

        KItemListContainer* container = new KItemListContainer(m_controller, this);
        container->setEnabledFrame(false);

        QVBoxLayout* layout = new QVBoxLayout(this);
        layout->setMargin(0);
        layout->addWidget(container);
    }

    loadTree(url());
    Panel::showEvent(event);
}
예제 #5
0
StateSelectionWindow::StateSelectionWindow(QWidget *parent, SCDataModel * dm) :
        QMainWindow(parent, Qt::WindowStaysOnTopHint),
        _dm(dm),
        _currentlySelected(NULL)
{

    // setup the GUI base
    _baseLayout = new QVBoxLayout;
    _centralWidget = new QWidget;
    _centralWidget->setLayout(_baseLayout);
    setCentralWidget(_centralWidget);

    // add the done button in the top row
    _doneButton = new QPushButton();
    _doneButton->setText("Done");
    connect (_doneButton,SIGNAL(clicked()), this, SLOT(handleDoneButtonPushed()));
    _row0 = new QHBoxLayout();
    _row0->addWidget(_doneButton);
    _baseLayout->addLayout(_row0);

    // add the selected State labels:
    _TargetLabel = new QLabel();
    _TargetLabelLabel = new QLabel();
    _TargetLabelLabel->setText("Target State: ");
    _TargetLabel->setFrameStyle(QFrame::Panel | QFrame::Plain);
    _TargetLabel->setLineWidth(1);
    _row1 = new QHBoxLayout();
    _row1->addWidget(_TargetLabelLabel);
    _row1->addWidget(_TargetLabel);
    _baseLayout->addLayout(_row1);

    // add the State Tree

    _targetStateSelectionTree = new QTreeWidget();
    //_targetStateSelectionTree->setExpanded(0,1);
    connect ( _targetStateSelectionTree, SIGNAL(itemClicked(QTreeWidgetItem*,int)), this, SLOT(handleTreeViewItemClicked(QTreeWidgetItem*,int)));
    _row2 = new QHBoxLayout();
    _row2->addWidget(_targetStateSelectionTree);
    _baseLayout->addLayout(_row2);

    QList<SCState*> states;
    states.append( _dm->getTopState());


    loadTree (NULL, states);
    this->setWindowTitle("Select A Target State");
    this->resize(402,650);
    QPoint parentPos = this->parentWidget()->pos();
    QPoint offset(POP_UP_X, POP_UP_Y);
    this->move(parentPos+offset);

}
예제 #6
0
void CDialogTextures::OnLoad() {
    CWaitCursor cursor;
    CWaitDlg dlg;
    dlg.AllowCancel( true );
    dlg.SetWindowText( "Loading textures..." );
    Texture_HideAll();
    HTREEITEM item = m_treeTextures.GetSelectedItem();
    idStr name = buildItemName( item, TypeNames[TEXTURES] );
    if ( !name.Cmpn( TypeNames[MATERIALS], strlen( TypeNames[MATERIALS] ) ) ) {
        name = buildItemName( item, TypeNames[MATERIALS] );
    }
    loadTree( item, name, &dlg );
}
예제 #7
0
bool FoldersPanel::urlChanged()
{
    if (!url().isValid() || url().scheme().contains("search")) {
        // Skip results shown by a search, as possible identical
        // directory names are useless without parent-path information.
        return false;
    }

    if (m_controller) {
        loadTree(url());
    }

    return true;
}
예제 #8
0
파일: main.c 프로젝트: moikop/ab
int main(int argc, char** argv) {
    FILE* logf;
    tdns dns;
    char cmd[100];
    char file_dns[100] = "dns.txt";
    char logfile[] = "log.txt";
    int loaded;
    int error;
    int crear;

    /*validacion parámetros de entrada*/
    if(validateInput(argc, argv, cmd)!=RES_OK) {
        showHelp(argv[0]);
        return RES_ERROR;
    }
    logf = fopen(logfile,"a");
    if(!logf) {
        printf("No se pudo abrir el archivo de log.\n");
        return RES_ERROR;
    }

    crear = createDNS(&dns,sizeof(tdomain));
    if(crear!=RES_OK) {
        printf("Ocurrió un error: %i.\n",crear);
        return RES_ERROR;
    }

    /*procesamos el archivo con las direcciones y dominios; en el proceso */
    loaded = loadTree(&dns,file_dns);
    if(loaded!=RES_OK) {
        printf("Ocurrió un error: %i.\n",loaded);
        return loaded;
    }

    /*Decidimos que accion es la que nos pide el usuario*/
    error = processData(&dns,argv,cmd,logf);
    if(error!=RES_OK) {
        printf("Ocurrió un error: %i.\n",error);
        fclose(logf);
        return RES_ERROR;
    }

    fclose(logf);

    return RES_OK;
}
  GlobalLocalFeatureDistance(::std::string fn="tree.kdt", uint ka=10, double eps=0.1): k(ka), epsilon(eps), filename(fn) {
#ifdef HAVE_KDTREE_LIBRARY
    kdt=(t_knn_kdtree *)malloc(1*sizeof(t_knn_kdtree));

    DBG(10) << "tree=" << fn << " k=" << k << " epsilon=" << epsilon << ::std::endl;

    DBG(10) << "Loading Tree from " << filename;
    loadTree(filename);
    BLINK(10) << "... done" << ::std::endl;

    neighbors=new t_knn[k];
    uint dim=kdt->dim;
    for (uint i=0; i<k; ++i) {
      neighbors[i].featvec=(float *)malloc(dim*sizeof(float));
      neighbors[i].labelvec=(char *)calloc(LIBKNN_LABEL_SIZE,sizeof(char));
    }
#endif
  }
예제 #10
0
/*
 =======================================================================================================================
 =======================================================================================================================
 */
bool CDialogTextures::loadTree( HTREEITEM item, const idStr &name, CWaitDlg *dlg ) {

    if ( item == NULL ) {
        return true;
    }

    if ( m_treeTextures.ItemHasChildren( item ) ) {

        idStr childName;
        HTREEITEM nextItem;
        HTREEITEM childItem = m_treeTextures.GetChildItem(item);

        while ( childItem != NULL ) {

            nextItem = m_treeTextures.GetNextItem( childItem, TVGN_NEXT );
            childName = name + "/" + (const char *)m_treeTextures.GetItemText( childItem );

            if ( m_treeTextures.ItemHasChildren( childItem ) ) {
                if ( !loadTree( childItem, childName, dlg ) ) {
                    return false;
                }
            } else {
                DWORD dw = m_treeTextures.GetItemData( childItem );
                if ( dw == TEXTURES || dw == MATERIALS ) {
                    if ( dw == TEXTURES ) {
                        childName = "textures/" + childName;
                    }
                    dlg->SetText( childName.c_str() );
                    Texture_ForName( childName );
                }
            }
            if ( dlg->CancelPressed() ) {
                return false;
            }

            childItem = nextItem;
        }
    }

    return true;
}
예제 #11
0
/*
    Funcao: reindex()
    Reindexa arvore e arquivo, removendo funcionarios que foram excluidos, do arquivo, e remontando arvore de indexacao
    Parametros:
        arq: ponteiro para ponteiro para func.bin
        tree: ponteiro para ponteiro para raiz da arvore
*/
void reindex(FILE** arq, tArvoreBB **tree)
{   
    tfunc func;
    FILE* temp;
    temp = fopen("temp.bin","w+b");
    fseek(*arq, 0, SEEK_SET);
    while(fread(&func, sizeof(tfunc), 1, (*arq)) != 0)
    {
        if(searchIndex(*tree, func.mat) != NULL)
            fwrite(&func, sizeof(tfunc), 1, temp);
    }
    
    if(fclose((*arq)) == 0)
    {
        if(fclose(temp) == 0)
        {
            if(remove("func.bin") == 0)
            {
                if(rename("temp.bin", "func.bin") == 0)
                {
                    *arq = fopen("func.bin", "a+b");
                    if(*arq != NULL){
                        deleteTree(tree);
                        loadTree(*arq, tree);
                        printf("Reindexado com sucesso!\n");
                    }
                    else
                        printf("Erro ao reabrir arquivo!\n");
                }
                else
                    printf("Erro ao renomear arquivo!\n");
            }
            else
                printf("Erro ao remover arquivo!\n");
        }
        else
            printf("Erro ao fechar arquivo temporario!\n");
    }
    else
        printf("Erro ao fechar arquivo principal!\n");
}
예제 #12
0
	void PretzelGlobal::loadSettings(fs::path settingsPath){
		fs::path loadPath = settingsPath;
		if (loadPath.string() == ""){
			loadPath = getAppPath() / "guiSettings" / "settings.json";
		}

		if (!fs::exists(loadPath)){
			console() << loadPath << " does not exist" << endl;
		}
		else{
			JsonTree loadTree(loadFile(loadPath));
			JsonTree appSettings = loadTree.getChild(0);

			for (int i = 0; i < mParamList.size(); i++){
				string pName = mParamList[i].name;
				switch (mParamList[i].type){
				case _FLOAT:
					if (appSettings.hasChild(pName)){
						float fVal = appSettings.getChild(pName).getValue<float>();
						*((float*)mParamList[i].value) = fVal;
					}
					break;
				case _INT:
					if (appSettings.hasChild(pName)){
						int fVal = appSettings.getChild(pName).getValue<int>();
						*((int*)mParamList[i].value) = fVal;
					}
					break;
				case _BOOL:
					if (appSettings.hasChild(pName)){
						bool bVal = appSettings.getChild(pName).getValue<float>();
						*((bool*)mParamList[i].value) = bVal;
					}
					break;
				default:
					console() << "Pretzel :: Can't load settings type " << endl;
					break;
				}
			}
		}
	}
예제 #13
0
void compareSyncNtuples(const std::string & ref_str,
                        const std::string & test_str,
                        const std::string & sample_str)
{
  gROOT->SetBatch(true);
  gErrorIgnoreLevel = kWarning;

  const NtupleMetaData & ref = ntupleMetadataMap.at(sample_str).at(ref_str);
  const NtupleMetaData & test = ntupleMetadataMap.at(sample_str).at(test_str);

  TFile* inputFile_ref = openFile(ref.inputFilePath, ref.inputFileName);
  TTree* tree_ref = loadTree(inputFile_ref, ref.treeName, ref.dirName);
  TFile* inputFile_test = openFile(test.inputFilePath, test.inputFileName);
  TTree* tree_test = loadTree(inputFile_test, test.treeName, test.dirName);

  const std::string outputFilePath = base_dir + "plots/" +
                                     sample_str + "/" + ref.legendEntry + "_vs_" + test.legendEntry;
  struct stat st = {0};
  if(stat(outputFilePath.c_str(), &st) == -1)
    _mkdir(outputFilePath.c_str());

  std::vector<branchEntryType*> branchesToCompare;
  branchesToCompare.push_back(new branchEntryType("n_presel_mu", "I", "", 20, -0.5, 19.5));
  branchesToCompare.push_back(new branchEntryType("n_fakeablesel_mu", "I", "", 20, -0.5, 19.5));
//  branchesToCompare.push_back(new branchEntryType("n_cutsel_mu", "I", "", 20, -0.5, 19.5));
  branchesToCompare.push_back(new branchEntryType("n_mvasel_mu", "I", "", 20, -0.5, 19.5));
  branchesToCompare.push_back(new branchEntryType("n_presel_ele", "I", "", 20, -0.5, 19.5));
  branchesToCompare.push_back(new branchEntryType("n_fakeablesel_ele", "I", "", 20, -0.5, 19.5));
//  branchesToCompare.push_back(new branchEntryType("n_cutsel_ele", "I", "", 20, -0.5, 19.5));
  branchesToCompare.push_back(new branchEntryType("n_mvasel_ele", "I", "", 20, -0.5, 19.5));
  branchesToCompare.push_back(new branchEntryType("n_presel_tau", "I", "", 20, -0.5, 19.5));
  branchesToCompare.push_back(new branchEntryType("n_presel_jet", "I", "", 20, -0.5, 19.5));
  branchesToCompare.push_back(new branchEntryType("mu0_charge", "I", "n_presel_mu >= 1", 3, -1.5, +1.5));
  branchesToCompare.push_back(new branchEntryType("mu0_jetNDauChargedMVASel", "F", "n_presel_mu >= 1", 20, -0.5, 19.5));
  branchesToCompare.push_back(new branchEntryType("mu0_jetPtRel", "F", "n_presel_mu >= 1", 100., -0.01, 10.));
  branchesToCompare.push_back(new branchEntryType("mu0_miniIsoNeutral", "F", "n_presel_mu >= 1", 100, -0.01, 100.));
  branchesToCompare.push_back(new branchEntryType("mu0_miniIsoCharged", "F", "n_presel_mu >= 1", 100, -0.01, 100.));
  branchesToCompare.push_back(new branchEntryType("mu0_E", "F", "n_presel_mu >= 1", 100, 0., 250.));
  branchesToCompare.push_back(new branchEntryType("mu0_conept", "F", "", 100, 0., 1000.));
  branchesToCompare.push_back(new branchEntryType("mu0_jetPtRatio", "F", "n_presel_mu >= 1", 100, -0.01, 3.));
  branchesToCompare.push_back(new branchEntryType("mu0_leptonMVA", "F", "n_presel_mu >= 1", 100, -1., +1.));
  branchesToCompare.push_back(new branchEntryType("mu0_jetCSV", "F", "n_presel_mu >= 1", 100, 0., +1.));
  branchesToCompare.push_back(new branchEntryType("mu0_dpt_div_pt", "F", "n_presel_mu >= 1", 100, 0., +0.25));
  branchesToCompare.push_back(new branchEntryType("mu0_segmentCompatibility", "F", "n_presel_mu >= 1", 100, -0.5, +1.5));
  branchesToCompare.push_back(new branchEntryType("mu0_phi", "F", "n_presel_mu >= 1", 36, -TMath::Pi(), +TMath::Pi()));
  branchesToCompare.push_back(new branchEntryType("mu0_sip3D", "F", "n_presel_mu >= 1", 100, 0., +10.));
  branchesToCompare.push_back(new branchEntryType("mu0_pt", "F", "n_presel_mu >= 1", 100, 0., 250.));
  branchesToCompare.push_back(new branchEntryType("mu0_miniRelIso", "F", "n_presel_mu >= 1", 100, -0.01, 1.));
  branchesToCompare.push_back(new branchEntryType("mu0_dxy", "F", "n_presel_mu >= 1", 100, -0.1, +0.1));
  branchesToCompare.push_back(new branchEntryType("mu0_eta", "F", "n_presel_mu >= 1", 100, -3., +3.));
  branchesToCompare.push_back(new branchEntryType("mu0_dz", "F", "n_presel_mu >= 1", 100, -0.2, +0.2));
  branchesToCompare.push_back(new branchEntryType("mu0_isfakeablesel", "I", "n_presel_mu >= 1", 2, -0.5, +1.5));
//  branchesToCompare.push_back(new branchEntryType("mu0_iscutsel", "I", "n_presel_mu >= 1", 2, -0.5, +1.5));
  branchesToCompare.push_back(new branchEntryType("mu0_ismvasel", "I", "n_presel_mu >= 1", 2, -0.5, +1.5));
  branchesToCompare.push_back(new branchEntryType("mu1_charge", "I", "n_presel_mu >= 2", 3, -1.5, +1.5));
  branchesToCompare.push_back(new branchEntryType("mu1_jetNDauChargedMVASel", "F", "n_presel_mu >= 2", 20, -0.5, 19.5));
  branchesToCompare.push_back(new branchEntryType("mu1_jetPtRel", "F", "n_presel_mu >= 2", 100., -0.01, 10.));
  branchesToCompare.push_back(new branchEntryType("mu1_miniIsoNeutral", "F", "n_presel_mu >= 2", 100, -0.01, 100.));
  branchesToCompare.push_back(new branchEntryType("mu1_miniIsoCharged", "F", "n_presel_mu >= 2", 100, -0.01, 100.));
  branchesToCompare.push_back(new branchEntryType("mu1_E", "F", "n_presel_mu >= 2", 100, 0., 250.));
  branchesToCompare.push_back(new branchEntryType("mu1_conept", "F", "", 100, 0., 500.));
  branchesToCompare.push_back(new branchEntryType("mu1_jetPtRatio", "F", "n_presel_mu >= 2", 100, -0.01, 3.));
  branchesToCompare.push_back(new branchEntryType("mu1_leptonMVA", "F", "n_presel_mu >= 2", 100, -1., +1.));
  branchesToCompare.push_back(new branchEntryType("mu1_jetCSV", "F", "n_presel_mu >= 2", 100, 0., +1.));
  branchesToCompare.push_back(new branchEntryType("mu1_dpt_div_pt", "F", "n_presel_mu >= 2", 100, 0., +0.25));
  branchesToCompare.push_back(new branchEntryType("mu1_segmentCompatibility", "F", "n_presel_mu >= 2", 100, -0.5, +1.5));
  branchesToCompare.push_back(new branchEntryType("mu1_phi", "F", "n_presel_mu >= 2", 36, -TMath::Pi(), +TMath::Pi()));
  branchesToCompare.push_back(new branchEntryType("mu1_sip3D", "F", "n_presel_mu >= 2", 100, 0., +10.));
  branchesToCompare.push_back(new branchEntryType("mu1_pt", "F", "n_presel_mu >= 2", 100, 0., 250.));
  branchesToCompare.push_back(new branchEntryType("mu1_miniRelIso", "F", "n_presel_mu >= 2", 100, -0.01, 1.));
  branchesToCompare.push_back(new branchEntryType("mu1_dxy", "F", "n_presel_mu >= 2", 100, -0.1, +0.1));
  branchesToCompare.push_back(new branchEntryType("mu1_eta", "F", "n_presel_mu >= 2", 100, -3., +3.));
  branchesToCompare.push_back(new branchEntryType("mu1_dz", "F", "n_presel_mu >= 2", 100, -0.2, +0.2));
  branchesToCompare.push_back(new branchEntryType("mu1_isfakeablesel", "I", "n_presel_mu >= 1", 2, -0.5, +1.5));
//  branchesToCompare.push_back(new branchEntryType("mu1_iscutsel", "I", "n_presel_mu >= 2", 2, -0.5, +1.5));
  branchesToCompare.push_back(new branchEntryType("mu1_ismvasel", "I", "n_presel_mu >= 2", 2, -0.5, +1.5));
  branchesToCompare.push_back(new branchEntryType("ele0_ntMVAeleID", "F", "n_presel_ele >= 1", 100, -1., +1.));
  branchesToCompare.push_back(new branchEntryType("ele0_charge", "I", "n_presel_ele >= 1", 3, -1.5, +1.5));
  branchesToCompare.push_back(new branchEntryType("ele0_jetNDauChargedMVASel", "F", "n_presel_ele >= 1", 20, -0.5, +19.5));
  branchesToCompare.push_back(new branchEntryType("ele0_jetPtRel", "F", "n_presel_ele >= 1", 100, -0.01, 10.));
  branchesToCompare.push_back(new branchEntryType("ele0_miniIsoNeutral", "F", "n_presel_ele >= 1", 100, -0.01, 100.));
  branchesToCompare.push_back(new branchEntryType("ele0_miniIsoCharged", "F", "n_presel_ele >= 1", 100, -0.01, 100.));
  branchesToCompare.push_back(new branchEntryType("ele0_E", "F", "n_presel_ele >= 1", 100, 0., 250.));
  branchesToCompare.push_back(new branchEntryType("ele0_conept", "F", "", 100, 0., 1000.));
  branchesToCompare.push_back(new branchEntryType("ele0_jetPtRatio", "F", "n_presel_ele >= 1", 100, -0.01, 3.));
  branchesToCompare.push_back(new branchEntryType("ele0_leptonMVA", "F", "n_presel_ele >= 1", 100, -1., +1.));
  branchesToCompare.push_back(new branchEntryType("ele0_jetCSV", "F", "n_presel_ele >= 1", 100, 0., +1.));
  branchesToCompare.push_back(new branchEntryType("ele0_phi", "F", "n_presel_ele >= 1", 36, -TMath::Pi(), +TMath::Pi()));
  branchesToCompare.push_back(new branchEntryType("ele0_sip3D", "F", "n_presel_ele >= 1", 100, 0., +10.));
  branchesToCompare.push_back(new branchEntryType("ele0_pt", "F", "n_presel_ele >= 1", 100, 0., 250.));
  branchesToCompare.push_back(new branchEntryType("ele0_miniRelIso", "F", "n_presel_ele >= 1", 100, -0.01, 1.));
  branchesToCompare.push_back(new branchEntryType("ele0_dxy", "F", "n_presel_ele >= 1", 100, -0.1, +0.1));
  branchesToCompare.push_back(new branchEntryType("ele0_eta", "F", "n_presel_ele >= 1", 100, -3.0, +3.0));
  branchesToCompare.push_back(new branchEntryType("ele0_dz", "F", "n_presel_ele >= 1", 100, -0.2, +0.2));
  branchesToCompare.push_back(new branchEntryType("ele0_nMissingHits", "I", "n_presel_ele >= 1", 2, -0.5, +1.5));
  branchesToCompare.push_back(new branchEntryType("ele0_isChargeConsistent", "I", "n_presel_ele >= 1", 2, -0.5, +1.5));
  branchesToCompare.push_back(new branchEntryType("ele0_isfakeablesel", "I", "n_presel_ele >= 1", 2, -0.5, +1.5));
//  branchesToCompare.push_back(new branchEntryType("ele0_iscutsel", "I", "n_presel_ele >= 1", 2, -0.5, +1.5));
  branchesToCompare.push_back(new branchEntryType("ele0_ismvasel", "I", "n_presel_ele >= 1", 2, -0.5, +1.5));
  branchesToCompare.push_back(new branchEntryType("ele1_ntMVAeleID", "F", "n_presel_ele >= 2", 100, -1., +1.));
  branchesToCompare.push_back(new branchEntryType("ele1_charge", "I", "n_presel_ele >= 2", 3, -1.5, +1.5));
  branchesToCompare.push_back(new branchEntryType("ele1_jetNDauChargedMVASel", "F", "n_presel_ele >= 2", 20, -0.5, +19.5));
  branchesToCompare.push_back(new branchEntryType("ele1_jetPtRel", "F", "n_presel_ele >= 2", 100, -0.01, 10.));
  branchesToCompare.push_back(new branchEntryType("ele1_miniIsoNeutral", "F", "n_presel_ele >= 2", 100, -0.01, 100.));
  branchesToCompare.push_back(new branchEntryType("ele1_miniIsoCharged", "F", "n_presel_ele >= 2", 100, -0.01, 100.));
  branchesToCompare.push_back(new branchEntryType("ele1_E", "F", "n_presel_ele >= 2", 100, 0., 250.));
  branchesToCompare.push_back(new branchEntryType("ele1_conept", "F", "", 100, 0., 500.));
  branchesToCompare.push_back(new branchEntryType("ele1_jetPtRatio", "F", "n_presel_ele >= 2", 100, -0.01, 3.));
  branchesToCompare.push_back(new branchEntryType("ele1_leptonMVA", "F", "n_presel_ele >= 2", 100, -1., +1.));
  branchesToCompare.push_back(new branchEntryType("ele1_jetCSV", "F", "n_presel_ele >= 2", 100, 0., +1.));
  branchesToCompare.push_back(new branchEntryType("ele1_phi", "F", "n_presel_ele >= 2", 36, -TMath::Pi(), +TMath::Pi()));
  branchesToCompare.push_back(new branchEntryType("ele1_sip3D", "F", "n_presel_ele >= 2", 100, 0., +10.));
  branchesToCompare.push_back(new branchEntryType("ele1_pt", "F", "n_presel_ele >= 2", 100, 0., 250.));
  branchesToCompare.push_back(new branchEntryType("ele1_miniRelIso", "F", "n_presel_ele >= 2", 100, -0.01, 1.));
  branchesToCompare.push_back(new branchEntryType("ele1_dxy", "F", "n_presel_ele >= 2", 100, -0.1, +0.1));
  branchesToCompare.push_back(new branchEntryType("ele1_eta", "F", "n_presel_ele >= 2", 100, -3.0, +3.0));
  branchesToCompare.push_back(new branchEntryType("ele1_dz", "F", "n_presel_ele >= 2", 100, -0.2, +0.2));
  branchesToCompare.push_back(new branchEntryType("ele1_nMissingHits", "I", "n_presel_ele >= 2", 2, -0.5, +1.5));
  branchesToCompare.push_back(new branchEntryType("ele1_isChargeConsistent", "I", "n_presel_ele >= 2", 2, -0.5, +1.5));
  branchesToCompare.push_back(new branchEntryType("ele1_isfakeablesel", "I", "n_presel_ele >= 2", 2, -0.5, +1.5));
//  branchesToCompare.push_back(new branchEntryType("ele1_iscutsel", "I", "n_presel_ele >= 2", 2, -0.5, +1.5));
  branchesToCompare.push_back(new branchEntryType("ele1_ismvasel", "I", "n_presel_ele >= 2", 2, -0.5, +1.5));
  branchesToCompare.push_back(new branchEntryType("tau0_againstElectronVTightMVA6", "I", "n_presel_tau >= 1", 2, -0.5, +1.5));
  branchesToCompare.push_back(new branchEntryType("tau0_againstElectronTightMVA6", "I", "n_presel_tau >= 1", 2, -0.5, +1.5));
  branchesToCompare.push_back(new branchEntryType("tau0_againstElectronMediumMVA6", "I", "n_presel_tau >= 1", 2, -0.5, +1.5));
  branchesToCompare.push_back(new branchEntryType("tau0_againstElectronLooseMVA6", "I", "n_presel_tau >= 1", 2, -0.5, +1.5));
  branchesToCompare.push_back(new branchEntryType("tau0_againstElectronVLooseMVA6", "I", "n_presel_tau >= 1", 2, -0.5, +1.5));
  branchesToCompare.push_back(new branchEntryType("tau0_againstMuonLoose3", "I", "n_presel_tau >= 1", 2, -0.5, +1.5));
  branchesToCompare.push_back(new branchEntryType("tau0_byVTightIsolationMVArun2v1DBdR03oldDMwLT", "I", "n_presel_tau >= 1", 2, -0.5, +1.5));
  branchesToCompare.push_back(new branchEntryType("tau0_byTightIsolationMVArun2v1DBdR03oldDMwLT", "I", "n_presel_tau >= 1", 2, -0.5, +1.5));
  branchesToCompare.push_back(new branchEntryType("tau0_byMediumIsolationMVArun2v1DBdR03oldDMwLT", "I", "n_presel_tau >= 1", 2, -0.5, +1.5));
  branchesToCompare.push_back(new branchEntryType("tau0_byLooseCombinedIsolationDeltaBetaCorr3Hits", "I", "n_presel_tau >= 1", 2, -0.5, +1.5));
  branchesToCompare.push_back(new branchEntryType("tau0_decayModeFindingOldDMs", "I", "n_presel_tau >= 1", 2, -0.5, +1.5));
  branchesToCompare.push_back(new branchEntryType("tau0_againstMuonTight3", "I", "n_presel_tau >= 1", 2, -0.5, +1.5));
  branchesToCompare.push_back(new branchEntryType("tau0_byLooseCombinedIsolationDeltaBetaCorr3HitsdR03", "I", "n_presel_tau >= 1", 2, -0.5, +1.5));
  branchesToCompare.push_back(new branchEntryType("tau0_decayModeFindingNewDMs", "I", "n_presel_tau >= 1", 2, -0.5, +1.5));
  branchesToCompare.push_back(new branchEntryType("tau0_charge", "I", "n_presel_tau >= 1", 3, -1.5, +1.5));
  branchesToCompare.push_back(new branchEntryType("tau0_byTightCombinedIsolationDeltaBetaCorr3Hits", "I", "n_presel_tau >= 1", 2, -0.5, +1.5));
  branchesToCompare.push_back(new branchEntryType("tau0_byMediumCombinedIsolationDeltaBetaCorr3Hits", "I", "n_presel_tau >= 1", 2, -0.5, +1.5));
  branchesToCompare.push_back(new branchEntryType("tau0_byMediumCombinedIsolationDeltaBetaCorr3HitsdR03", "I", "n_presel_tau >= 1", 2, -0.5, +1.5));
  branchesToCompare.push_back(new branchEntryType("tau0_byTightCombinedIsolationDeltaBetaCorr3HitsdR03", "I", "n_presel_tau >= 1", 2, -0.5, +1.5));
  branchesToCompare.push_back(new branchEntryType("tau0_byLooseIsolationMVArun2v1DBdR03oldDMwLT", "F", "n_presel_tau >= 1", 2, -0.5, +1.5));
  branchesToCompare.push_back(new branchEntryType("tau0_byCombinedIsolationDeltaBetaCorr3Hits", "F", "n_presel_tau >= 1", 100, -0.01, 5.));
  branchesToCompare.push_back(new branchEntryType("tau0_dz", "F", "n_presel_tau >= 1", 100, -0.3, +0.3));
  branchesToCompare.push_back(new branchEntryType("tau0_dxy", "F", "n_presel_tau >= 1", 100, -0.2, +0.2));
  branchesToCompare.push_back(new branchEntryType("tau0_pt", "F", "n_presel_tau >= 1", 100, 0., 250.));
  branchesToCompare.push_back(new branchEntryType("tau0_eta", "F", "n_presel_tau >= 1", 100, -3., +3.));
  branchesToCompare.push_back(new branchEntryType("tau0_phi", "F", "n_presel_tau >= 1", 36, -TMath::Pi(), +TMath::Pi()));
  branchesToCompare.push_back(new branchEntryType("tau0_E", "F", "n_presel_tau >= 1", 100, 0., 250.));
  branchesToCompare.push_back(new branchEntryType("tau1_againstElectronVTightMVA6", "I", "n_presel_tau >= 2", 2, -0.5, +1.5));
  branchesToCompare.push_back(new branchEntryType("tau1_againstElectronTightMVA6", "I", "n_presel_tau >= 2", 2, -0.5, +1.5));
  branchesToCompare.push_back(new branchEntryType("tau1_againstElectronMediumMVA6", "I", "n_presel_tau >= 2", 2, -0.5, +1.5));
  branchesToCompare.push_back(new branchEntryType("tau1_againstElectronLooseMVA6", "I", "n_presel_tau >= 2", 2, -0.5, +1.5));
  branchesToCompare.push_back(new branchEntryType("tau1_againstElectronVLooseMVA6", "I", "n_presel_tau >= 2", 2, -0.5, +1.5));
  branchesToCompare.push_back(new branchEntryType("tau1_againstMuonLoose3", "I", "n_presel_tau >= 2", 2, -0.5, +1.5));
  branchesToCompare.push_back(new branchEntryType("tau1_byVTightIsolationMVArun2v1DBdR03oldDMwLT", "I", "n_presel_tau >= 2", 2, -0.5, +1.5));
  branchesToCompare.push_back(new branchEntryType("tau1_byTightIsolationMVArun2v1DBdR03oldDMwLT", "I", "n_presel_tau >= 2", 2, -0.5, +1.5));
  branchesToCompare.push_back(new branchEntryType("tau1_byMediumIsolationMVArun2v1DBdR03oldDMwLT", "I", "n_presel_tau >= 2", 2, -0.5, +1.5));
  branchesToCompare.push_back(new branchEntryType("tau1_byLooseCombinedIsolationDeltaBetaCorr3Hits", "I", "n_presel_tau >= 2", 2, -0.5, +1.5));
  branchesToCompare.push_back(new branchEntryType("tau1_decayModeFindingOldDMs", "I", "n_presel_tau >= 2", 2, -0.5, +1.5));
  branchesToCompare.push_back(new branchEntryType("tau1_againstMuonTight3", "I", "n_presel_tau >= 2", 2, -0.5, +1.5));
  branchesToCompare.push_back(new branchEntryType("tau1_byLooseCombinedIsolationDeltaBetaCorr3HitsdR03", "I", "n_presel_tau >= 2", 2, -0.5, +1.5));
  branchesToCompare.push_back(new branchEntryType("tau1_decayModeFindingNewDMs", "I", "n_presel_tau >= 2", 2, -0.5, +1.5));
  branchesToCompare.push_back(new branchEntryType("tau1_charge", "I", "n_presel_tau >= 2", 3, -1.5, +1.5));
  branchesToCompare.push_back(new branchEntryType("tau1_byTightCombinedIsolationDeltaBetaCorr3Hits", "I", "n_presel_tau >= 2", 2, -0.5, +1.5));
  branchesToCompare.push_back(new branchEntryType("tau1_byMediumCombinedIsolationDeltaBetaCorr3Hits", "I", "n_presel_tau >= 2", 2, -0.5, +1.5));
  branchesToCompare.push_back(new branchEntryType("tau1_byMediumCombinedIsolationDeltaBetaCorr3HitsdR03", "I", "n_presel_tau >= 2", 2, -0.5, +1.5));
  branchesToCompare.push_back(new branchEntryType("tau1_byTightCombinedIsolationDeltaBetaCorr3HitsdR03", "I", "n_presel_tau >= 2", 2, -0.5, +1.5));
  branchesToCompare.push_back(new branchEntryType("tau1_byLooseIsolationMVArun2v1DBdR03oldDMwLT", "F", "n_presel_tau >= 2", 2, -0.5, +1.5));
  branchesToCompare.push_back(new branchEntryType("tau1_byCombinedIsolationDeltaBetaCorr3Hits", "F", "n_presel_tau >= 2", 100, -0.01, 5.));
  branchesToCompare.push_back(new branchEntryType("tau1_dz", "F", "n_presel_tau >= 2", 100, -0.3, +0.3));
  branchesToCompare.push_back(new branchEntryType("tau1_dxy", "F", "n_presel_tau >= 2", 100, -0.2, +0.2));
  branchesToCompare.push_back(new branchEntryType("tau1_pt", "F", "n_presel_tau >= 2", 100, 0., 250.));
  branchesToCompare.push_back(new branchEntryType("tau1_eta", "F", "n_presel_tau >= 2", 100, -3., +3.));
  branchesToCompare.push_back(new branchEntryType("tau1_phi", "F", "n_presel_tau >= 2", 36, -TMath::Pi(), +TMath::Pi()));
  branchesToCompare.push_back(new branchEntryType("tau1_E", "F", "n_presel_tau >= 2", 100, 0., 250.));
  branchesToCompare.push_back(new branchEntryType("jet0_CSV", "F", "n_presel_jet >= 1", 100, 0., +1.));
  branchesToCompare.push_back(new branchEntryType("jet0_pt", "F", "n_presel_jet >= 1", 100, 0., 250.));
  branchesToCompare.push_back(new branchEntryType("jet0_eta", "F", "n_presel_jet >= 1", 100, -3., +3.));
  branchesToCompare.push_back(new branchEntryType("jet0_phi", "F", "n_presel_jet >= 1", 36, -TMath::Pi(), +TMath::Pi()));
  branchesToCompare.push_back(new branchEntryType("jet0_E", "F", "n_presel_jet >= 1", 100, 0., 250.));
  branchesToCompare.push_back(new branchEntryType("jet1_CSV", "F", "n_presel_jet >= 2", 100, 0., +1.));
  branchesToCompare.push_back(new branchEntryType("jet1_pt", "F", "n_presel_jet >= 2", 100, 0., 250.));
  branchesToCompare.push_back(new branchEntryType("jet1_eta", "F", "n_presel_jet >= 2", 100, -3., +3.));
  branchesToCompare.push_back(new branchEntryType("jet1_phi", "F", "n_presel_jet >= 2", 36, -TMath::Pi(), +TMath::Pi()));
  branchesToCompare.push_back(new branchEntryType("jet1_E", "F", "n_presel_jet >= 2", 100, 0., 250.));
  branchesToCompare.push_back(new branchEntryType("jet2_CSV", "F", "n_presel_jet >= 3", 100, 0., +1.));
  branchesToCompare.push_back(new branchEntryType("jet2_pt", "F", "n_presel_jet >= 3", 100, 0., 250.));
  branchesToCompare.push_back(new branchEntryType("jet2_eta", "F", "n_presel_jet >= 3", 100, -3., +3.));
  branchesToCompare.push_back(new branchEntryType("jet2_phi", "F", "n_presel_jet >= 3", 36, -TMath::Pi(), +TMath::Pi()));
  branchesToCompare.push_back(new branchEntryType("jet2_E", "F", "n_presel_jet >= 3", 100, 0., 250.));
  branchesToCompare.push_back(new branchEntryType("jet3_CSV", "F", "n_presel_jet >= 4", 100, 0., +1.));
  branchesToCompare.push_back(new branchEntryType("jet3_pt", "F", "n_presel_jet >= 4", 100, 0., 250.));
  branchesToCompare.push_back(new branchEntryType("jet3_eta", "F", "n_presel_jet >= 4", 100, -3., +3.));
  branchesToCompare.push_back(new branchEntryType("jet3_phi", "F", "n_presel_jet >= 4", 36, -TMath::Pi(), +TMath::Pi()));
  branchesToCompare.push_back(new branchEntryType("jet3_E", "F", "n_presel_jet >= 4", 100, 0., 250.));
  branchesToCompare.push_back(new branchEntryType("PFMET", "F", "", 100, 0., 250.));
  branchesToCompare.push_back(new branchEntryType("PFMETphi", "F", "", 36, -TMath::Pi(), +TMath::Pi()));
  branchesToCompare.push_back(new branchEntryType("MHT", "F", "", 100, 0., 600.));
  branchesToCompare.push_back(new branchEntryType("metLD", "F", "", 100, 0., 2.));
  branchesToCompare.push_back(new branchEntryType("lep0_conept", "F", "", 100, 0., 1000.));
  branchesToCompare.push_back(new branchEntryType("lep1_conept", "F", "", 100, 0., 500.));
  branchesToCompare.push_back(new branchEntryType("mindr_lep0_jet", "F", "", 100, 0., 5.));
  branchesToCompare.push_back(new branchEntryType("mindr_lep1_jet", "F", "", 100, 0., 5.));
//  branchesToCompare.push_back(new branchEntryType("n_jet25_recl", "F", "", 100, 0., 50.));
  branchesToCompare.push_back(new branchEntryType("MT_met_lep0", "F", "", 100, 0., 500.));
  branchesToCompare.push_back(new branchEntryType("avg_dr_jet", "F", "", 100, 0., 6.));
  branchesToCompare.push_back(new branchEntryType("MVA_2lss_ttV", "F", "(n_fakeablesel_mu + n_fakeablesel_ele) >= 2", 100, -1., 1.));
  branchesToCompare.push_back(new branchEntryType("MVA_2lss_ttbar", "F", "(n_fakeablesel_mu + n_fakeablesel_ele) >= 2", 100, -1., 1.));

  for ( std::vector<branchEntryType*>::const_iterator branch = branchesToCompare.begin();
        branch != branchesToCompare.end(); ++branch ) {
    std::cout << "plotting " << (*branch)->branchName_ << "..." << std::endl;

    branchEntryType* branch_ref = (*branch)->Clone("ref");
    if(branch_ref->fillHistogram(tree_ref, ref.selection) < 0)
      branch_ref->histogram_ = nullptr;
    else
      normalizeHistogram(branch_ref->histogram_);
    
    branchEntryType* branch_test = (*branch)->Clone("test");
    if(branch_test->fillHistogram(tree_test, test.selection) < 0)
      branch_test->histogram_ = nullptr;
    else
      normalizeHistogram(branch_test->histogram_);

    std::string outputFileName = Form("compareSyncNtuples_%s.png", (*branch)->branchName_.data());
    showHistograms(800, 900, 
                   branch_ref->histogram_, ref.legendEntry,
                   branch_test->histogram_, test.legendEntry,
                   NULL, "",
                   NULL, "",
                   NULL, "",
                   NULL, "",
                   (*branch)->branchName_, 1.10,
                   true, 1.e-4, 1.e+1, "N", 1.30,
                   0.16, 0.80,
                   outputFilePath, outputFileName);

    delete branch_ref;
    delete branch_test;
  }
  
  for ( std::vector<branchEntryType*>::const_iterator it = branchesToCompare.end();
        it != branchesToCompare.end(); ++it ) {
    delete (*it);
  }

  delete inputFile_ref;
  delete inputFile_test;
}
예제 #14
0
bool Loader::load()
{
    QString fn = m_fileName.path();

    if ( fn.endsWith( ".nii.gz" ) || fn.endsWith( ".nii" ) || fn.endsWith( ".hdr" ) || fn.endsWith( ".ima" ) || fn.endsWith( ".img" ) )
    {

        return loadNifti();
    }

    if ( m_fileName.path().endsWith( ".fib" ) )
    {
        return loadVTK();
    }

    if ( m_fileName.path().endsWith( ".tck" ) )
    {
        return loadMRtrix();
    }

    if ( m_fileName.path().endsWith( ".vtk" ) )
    {
        return loadVTK();
    }

    if ( m_fileName.path().endsWith( ".json" ) )
    {
        return loadJSON();
    }

    if ( m_fileName.path().endsWith( ".asc" ) )
    {
        //TODO: Deal with offsets: Check if orig is always the same size?
        return loadASC( QVector3D( 128, 128, 128 ) );
    }

    if ( m_fileName.path().endsWith( ".set" ) )
    {
        return loadSet();
    }

    if ( m_fileName.path().endsWith( ".glyphset" ) )
    {
        return loadGlyphset();
    }

    if ( m_fileName.path().endsWith( ".cons" ) || m_fileName.path().endsWith( ".cxls" ) )
    {
        return loadCons();
    }

    if ( m_fileName.path().endsWith( ".meg" ) )
    {
        return loadMEG();
    }

    if ( m_fileName.path().endsWith( ".htree" ) )
    {
        return loadTree();
    }

    if ( m_fileName.path().endsWith( ".rgb" ) )
    {
        return loadRGB();
    }

    if ( m_fileName.path().endsWith( ".1D" ) )
    {
        return load1D();
    }

    if ( m_fileName.path().endsWith( ".png" ) || m_fileName.path().endsWith( ".jpg" ) )
    {
        return loadPNG();
    }

    return false;
}
예제 #15
0
BOOL DlgSectorSelect::OnInitDialog()
{
	CDialog::OnInitDialog() ;
	loadTree() ;
	return true ;
}