예제 #1
0
파일: bookmarks.cpp 프로젝트: porphyr/arora
void BookmarksMenu::postPopulated()
{
    if (isEmpty())
        return;

    QModelIndex parent = rootIndex();

    bool hasBookmarks = false;

    for (int i = 0; i < parent.model()->rowCount(parent); ++i) {
        QModelIndex child = parent.model()->index(i, 0, parent);

        if (child.data(BookmarksModel::TypeRole) == BookmarkNode::Bookmark) {
            hasBookmarks = true;
            break;
        }
    }

    if (!hasBookmarks)
        return;

    addSeparator();
    QAction *action = addAction(tr("Open in Tabs"));
    connect(action, SIGNAL(triggered()),
            this, SLOT(openAll()));
}
예제 #2
0
void HistoryPanel::contextMenuGroup(const QPoint &pos)
{
    KMenu menu;
    KAction* action;

    action = new KAction(KIcon("tab-new"), i18n("Open Folder in Tabs"), this);
    connect(action, SIGNAL(triggered()), this, SLOT(openAll()));
    menu.addAction(action);

    menu.exec(panelTreeView()->mapToGlobal(pos));
}
예제 #3
0
//======================================
fitPrePost() {
    gStyle->SetStatW(0.22);
    gStyle->SetStatH(0.22);

    //  f=new TFile("iter4-pp/sect05/sum-sect5.hist.root");

    TH1F *h1=new TH1F("mpv","MPV  MIP gated; MPV of ADC-ped",35,-5,65);
    TH1F *h2=new TH1F("mpvE","relative error of MPV , MIP gated; err(MPV)/MPV ",50,0,0.5);
    TH1F *h3=new TH1F("mpvS","relative width of L-peak,  MIP gated; sigma/MPV",25,0.,1.);
    TH2F *h4=new TH2F("mpv2","MPV from ; gated w/ MIP ; inclusive spectrum;",25,0,50,25,0,25);

//===sww===Set layer to analyze in next line
    char cT='R';
    openAll(cT);

    const float feta[]=
    {1.95,1.855,1.765,1.675,1.59,1.51,1.435,1.365,1.3,1.235,1.17,1.115};

    int sec=5;
    char core[100];

    int eta;
    char sub='C';

//===sww===Set eta range and sector range in next two "for" statements
    for(eta=1; eta<=12; eta++) {
        int nErr=0, nOK=0;
        float mpvL=999, mpvH=0;
        h1->Reset();
        h2->Reset();
        h3->Reset();
        h4->Reset();
        fprintf(wfd," <tr> <th> %d <td> \n",eta);
        gStyle->SetOptStat(1001111);

        for(sec=1; sec<=12; sec++) {
            TFile *f=fdA[sec-1];
            for(sub='A'; sub<='E'; sub++)     {
                sprintf(core,"%02d%c%c%02d",sec,cT,sub,eta);
                TString coreT=core;
                ha=(TH1F*)f->Get("a"+coreT);
                hd=(TH1F*)f->Get("d"+coreT);
                c=new TCanvas("aa","aa",400,400);
                plotOne(ha,hd);
                //return;
                c->Print(coreT+".ps");
                TString errS=QaOne(ha,hd,cT);
                printf("errS=%s=%d\n",errS.Data(),errS.Sizeof());
                bool isBad=errS.Sizeof()>1;
                if(isBad) { // report error channel
                    fprintf(wfd,"     %s ,\n",(coreT+"-"+errS).Data());
                    nErr++;
                    //	continue;
                }
                if(errS.Contains("mask")) continue;
                nOK++;
                //    return;
                //
                //  c->Print(coreT+".gif");
                float mpv=par[4];
                float mpvEr=epar[4];
                if(mpvL>mpv) mpvL=mpv;
                if(mpvH<mpv) mpvH=mpv;

                int ieta=eta-1;

                float fac=TMath::TanH(feta[ieta])/0.0009; // assumed 0.9 MeV per plastic
                float err=sqrt(mpvEr*mpvEr+1);
                float gain=mpv*fac;
                float sig=err*fac;
                fprintf(gfd,"%s %.0f %.0f %.1f %.1f \n",core,gain,sig,mpv,mpvEr);

                h1->Fill(mpv);
                if(mpv>0) {
                    h2->Fill(mpvEr/mpv);
                    h3->Fill(par[5]/mpv);
                }
                //  h4->Fill(mpv,mpvInc);

            } // end of eta bin

        }// end of sector loop
        fprintf(wfd," <td> %d <td> %d\n",nOK,nErr);

        char txt[100],sumN[100], pdfN[100];
        sprintf(pdfN,"%cfitEta%02d.pdf",cT,eta);
        sprintf(txt,"cat *%02d.ps | ps2pdf - %s",eta,pdfN);
        printf("%s\n",txt);
        system(txt);
        sprintf(txt,"mv %s /star/u/wissink/cal2006/tmp/",pdfN);
        printf("%s\n",txt);
        system(txt);
        fprintf(wfd,"     <td> <a href=\"%s\"> PDF </a>\n",pdfN);
        fprintf(wfd,"     <td> %.1f to %.1f \n",mpvL,mpvH);

        gStyle->SetOptStat(1111111);

        sprintf(sumN,"mpv%c-eta%02d",cT,eta);
        c=new TCanvas(sumN,sumN,600,600);
        c->Divide(1,3);
        c->cd(1);
        h1->Draw();
        c->cd(2);
        h2->Draw();
        c->cd(3);
        h3->Draw();
        // c->cd(4); h4->Draw("box");
        c->Print();

        sprintf(txt,"ps2pdf %s.ps %s.pdf",sumN,sumN);
        printf("%s\n",txt);
        system(txt);
        sprintf(txt,"mv %s.pdf /star/u/wissink/cal2006/tmp/",sumN);
        printf("%s\n",txt);
        system(txt);
        fprintf(wfd,"     <td> <a href=\"%s.pdf\"> PDF </a>\n",sumN);


    }// end of loop over eta bins

    if(wfd!=stdout)fclose(wfd);
    fclose(gfd);
}
예제 #4
0
//======================================
fitTower() {
  gStyle->SetStatW(0.22);
  gStyle->SetStatH(0.22);
  
  // f=new TFile("/star/data05/scratch/balewski/2005-eemcCal/day49-hist/iter2-out/sum-sect5.hist.root");

  TH1F *h1=new TH1F("mpv","MPV gated w/ MIP ; MPV of ADC-ped",40,-5,35); 
  TH1F *h2=new TH1F("mpvE","relative error of MPV , MIP gated; err(MPV)/MPV ",50,0,0.3); 


 // stupid root tricks:
 hDum=new TH1F("aa","bb",10,1,9);
 hDum->Fill(5);

 
  char cT='T';
  openAll(cT);
  
  int sec=5;
  char core[100];
  
  int eta;
  char sub='C';
  
  for(eta=1;eta<=12;eta++) {
    int nErr=0, nOK=0;
    float mpvL=999, mpvH=0; 
    h1->Reset(); h2->Reset(); 
    fprintf(wfd," <tr> <th> %d <td> \n",eta); 
    gStyle->SetOptStat(1001111);

    for(sec=1; sec<=12;sec++) {
      TFile *f=fdA[sec-1];
      for(sub='A';sub<='E';sub++)     {
	sprintf(core,"%02d%c%c%02d",sec,cT,sub,eta);
	TString coreT=core;
	ha=(TH1F*)f->Get("a"+coreT);
	hd=(TH1F*)f->Get("d"+coreT);

	// special case of stuck low bits - sww - modified to include 06TA07
	if( (eta==7 && sub=='B' && (sec==4 || sec==8)) || (eta==7 && sub=='A' && sec==6)) {
	  ha->Rebin(4);
	  hd->Rebin(4);
	  printf("tower=%s rebinned\n",core);
	}

	c=new TCanvas("aa","aa",400,400);
	c->Divide(1,2);  c->cd(1);
	hDum->Draw();  gPad->SetLogy();
	float mpv, mpvEr;
	TString errS=plotOne(ha,hd, mpv, mpvEr);
	printf("errS=%s=\n",errS.Data());

	bool isBad=errS.Sizeof()>1;
	if(isBad) { // report error channel
	  fprintf(wfd,"     %s ,\n",(coreT+"-"+errS).Data());
	  nErr++;
	}
	if(errS.Contains("mask")) continue;
	nOK++;
       	//return;
  	
	if(mpvL>mpv) mpvL=mpv;
	if(mpvH<mpv) mpvH=mpv;

	h1->Fill(mpv);
	if(mpv>0) {
	  h2->Fill(mpvEr/mpv);
	}
	
      } // end of eta bin
      
    }// end of sector loop
    fprintf(wfd," <td> %d <td> %d\n",nOK,nErr);

    char txt[100],sumN[100], pdfN[100];
    sprintf(pdfN,"%cfitEta%02d.pdf",cT,eta);
    sprintf(txt,"cat *%02d.ps | ps2pdf - %s",eta,pdfN);
    printf("%s\n",txt);
    system(txt);
    sprintf(txt,"mv %s /star/u/wissink/cal2006/tmp/",pdfN);
    printf("%s\n",txt);
    system(txt);
    fprintf(wfd,"     <td> <a href=\"%s\"> PDF </a>\n",pdfN);    
    fprintf(wfd,"     <td> %.1f  to %.1f \n",mpvL,mpvH);
    
    gStyle->SetOptStat(1111111);

    sprintf(sumN,"mpv%c-eta%02d",cT,eta);
    c=new TCanvas(sumN,sumN,600,600);
    c->Divide(1,3);
    c->cd(1); h1->Draw();
    c->cd(2); h2->Draw();
    c->Print();
    
    sprintf(txt,"ps2pdf %s.ps %s.pdf",sumN,sumN);
    printf("%s\n",txt);
    system(txt);
    sprintf(txt,"mv %s.pdf /star/u/wissink/cal2006/tmp/",sumN);
    printf("%s\n",txt);
    system(txt);
    fprintf(wfd,"     <td> <a href=\"%s.pdf\"> PDF </a>\n",sumN);
      
    fflush(wfd);
  }// end of loop over eta bins
  
  if(wfd!=stdout)fclose(wfd);
  fclose(gfd);
  return;
}
예제 #5
0
파일: zpp.cpp 프로젝트: jlefley/libzpp
int zppZipArchive::openAll(char *_path)
{
	return openAll(std::string(_path));
}