Exemplo n.º 1
0
imeth char * BufferedTempFile_im_gName(object self)
{ BufferedTempFile_iv_t *iv = GetIVs(BufferedTempFile, self);
	if (iv->iTmpFile) 
		return gName(iv->iTmpFile); 
	else 
	{ 



		createTempFile(self); 
		return gName(self); 
	} 
} 
Exemplo n.º 2
0
void	saveFlashDataFile(object wind, char *name)
{
	char fname[512];
	object	ctllist = gGetControls(wind);
	object	seq, ctl, cls;
	FILE	*fp;

	sprintf(fname,"%s_d.as",name);
	setDialogName(name);

	if (!access(fname,0)) {
		if (IDYES!=gQuery(wind,"WARNING",
				"The data binding file already exists.\nDo you want to overwrite it?",MB_YESNO))
			return;
	}

	fp = fopen(fname, "wt");
	
	if (!fp)
		return;

	if (ctllist)
		for (seq = gSequence(ctllist) ; ctl = gNext(seq) ; ) {
			char *name=gName(ctl);

			if (!strcmp("STATIC",name) || !strcmp("LINE",name) || !strcmp("RECT",name))
				continue;

			cls = ClassOf(ctl);
			if (cls == ComboBox || cls == ListBox )
			{
				char *choicepath=gChoiceXPathBinding(ctl);
				char *mainkeypath=gXPathBinding(ctl);
				char *listkeypath=stripChoicePathOut(choicepath,gListKeyXPathBinding(ctl));
				char *datapath=stripChoicePathOut(choicepath,gDataXPathBinding(ctl));
				char *textpath=stripChoicePathOut(choicepath,gTextXPathBinding(ctl));


				fprintf(fp, "ctl = dlg%s.getControl(\"%s\");\n",dialogName,name);


				fprintf(fp, "ctl.mainkeypath = \"%s\";\n",mainkeypath);
				fprintf(fp, "ctl.choicepath = \"%s\";\n",choicepath);
				fprintf(fp, "ctl.listkeypath = \"%s\";\n",listkeypath);
				fprintf(fp, "ctl.datapath = \"%s\";\n",datapath);
				fprintf(fp, "ctl.textpath = \"%s\";\n",textpath);


				free(listkeypath);
				free(datapath);
				free(textpath);
			}
			else
				fprintf(fp, "dlg%s.bind(\"%s\", \"%s\");\n",dialogName,name,gXPathBinding(ctl));
		}

	fclose(fp);
}
Exemplo n.º 3
0
static	int	setFont(FILE *fp, object ctl, char *name)
{
	object	font;
	int	bold, italic;
	char	fntName[80];

	font = gGetFont(ctl);
	parse_font_name(fntName, gName(font), &bold, &italic);
	fprintf(fp, "%s.setStyle(\"fontFamily\", \"%s\");\n", name, fntName);
	fprintf(fp, "%s.setStyle(\"fontSize\", %f * ScalingFactor);\n", name, gPointSize(font)* 1.0/* *1.3*/);
	if (italic)
		fprintf(fp, "%s.setStyle(\"fontStyle\", \"italic\");\n", name);
	if (bold)
		fprintf(fp, "%s.setStyle(\"fontWeight\", \"bold\");\n", name);
	return gPointSize(font);
}
Exemplo n.º 4
0
void GroupListModule_Impl::_groupCreatTempGroupRespone(CImPdu* pdu)
{
	CImPduClientGroupCreateTmpGroupResponse* pduData = (CImPduClientGroupCreateTmpGroupResponse*)pdu;
	module::GroupInfoEntity groupinfo;
	if (pduData->GetGroupName())
	{
		std::string gName(pduData->GetGroupName(), pduData->GetGroupNameLen());
		groupinfo.csName = util::stringToCString(gName);
	}
	if (pduData->GetGroupId())
	{
		std::string gSid(pduData->GetGroupId(),pduData->GetGroupIdLen());
		groupinfo.gId = gSid;
		groupinfo.gId = _MakeGroupSID(groupinfo.gId);//增加session头
	}
	groupinfo.type = 2;//1.固定群;2.临时群

	user_id_t* pUserInfo = pduData->GetUserList();
	for (UInt32 i = 0; i < pduData->GetUserCnt(); ++i)
	{
		std::string sUserId(pUserInfo[i].id_url, pUserInfo[i].id_len);
		groupinfo.groupMemeberList.push_back(sUserId);
	}
	groupinfo.groupUpdated = module::getSessionModule()->getTime();
	{
		util::TTAutoLock lock(&m_lock);
		module::GroupInfoMap::iterator itMap = m_mapGroups.find(groupinfo.gId);
		if (itMap == m_mapGroups.end())
		{
			m_mapGroups.insert(std::make_pair(groupinfo.gId, groupinfo));//暂时将最近联系群和固定群合并到一起
			logic::GetLogic()->asynNotifyObserver(module::KEY_GROUPLIST_UPDATE_CREATNEWGROUP, groupinfo.gId);//通知UI更新讨论组
		}
		else
		{
			APP_LOG(LOG_ERROR, _T("_groupCreatTempGroupRespone:已经存在这个ID"));
		}
	}
}
Exemplo n.º 5
0
//____________________________________________________________________________________
// Plot overlay mH scan (SM + mSugra)
int plotOverlay( TString fileName = "output/msugra-noMH-cut20-v5.root", int index = 68, TString drawOpt = "C" )
{

  // Styles
  gROOT->SetStyle("Pub");
  gStyle->SetCanvasColor(0);
  gStyle->SetCanvasDefH( 500 );
  gStyle->SetCanvasDefW( 600 );
  

  double chi2min = -0., chi2max = 4;  // Delta-chi2 range
  double mHmin   = 30, mHmax = 200;
  double threshold = 1e-4;

  TCanvas* myCanvas = new TCanvas("myCanvas","Pseudo-exps contour",10,10,600,600);
  myCanvas->SetTopMargin(0.02);
  myCanvas->SetLogx(1);
  
  // Retrieve and correct graph
  TFile* file = new TFile(fileName);
  if ( !file->IsOpen() ) {
    std::cerr << "*** Couldn't open " << fileName << std::endl;
    return -1;
  }
  TString gName("graph1d");
  gName += index;
  TGraph* gChi2 = file->Get( gName );
  if ( !gChi2 ) {
    std::cerr << "*** Couldn't find graph \"" << gName << "\"" << std::endl;
    return -1;
  }
  zeroSuppress( gChi2 );

  // Set plot range
  TH2F* range = new TH2F("range","#chi^{2} fit of lightest Higgs mass",
                         2,mHmin,mHmax,2,chi2min,chi2max);
  if ( !doPub ) {
    range->GetXaxis()->SetTitle("M_{h} [GeV/c^{2}]");
    range->GetYaxis()->SetTitle("#Delta#chi^{2}");
    range->GetYaxis()->SetTitleOffset(1.1);
  }
  range->GetXaxis()->SetNoExponent();
  range->GetXaxis()->SetMoreLogLabels(1);
  range->Draw();

  // Find preferred value
  double mHfavour = findMh( gChi2, 0., 100. );
  double negError = mHfavour-findMh( gChi2, 1., 100. );
  double posError = findMh( gChi2, 1., mHfavour )-mHfavour;
  std::cout << "Favoured value: " << mHfavour << "+" << posError << "-" << negError << std::endl;

  
  // Include LEP limit
  int LepColor = 5;
  TBox* bLepLimit = new TBox( mHmin, chi2min+0.01, LEPLIMIT, chi2max-0.01 );
  bLepLimit->SetFillColor( LepColor );
  bLepLimit->Draw();

  TLatex tt;
  if (doPub) tt.SetTextFont(133);
  tt.SetTextSize(14);

  // Blue band
  blueBand();

  // Plot red band (1.5 GeV)
  if ( doBands ) {
    redBand2( gChi2, 1.5, mHfavour, 0.005 );
    gChi2->SetLineColor(4);
    gChi2->SetLineWidth(3);
  } else {
    gChi2->SetLineColor(kMagenta);
    gChi2->SetLineWidth(5);
  }


  // Plot scan
  gChi2->SetMarkerStyle(2);
  gChi2->Draw(drawOpt);
  TMultiGraph* mg = new TMultiGraph();

  // Forbidden regions
  tt.SetTextSize(18);
  tt.SetTextAlign(12);
  tt.DrawLatex( mHmin+4, chi2min+0.4, "#splitline{LEP}{excluded}" );
  tt.SetTextAngle(0);


  // Printout
  // hep-ph number
  TLatex tt;
  tt.SetTextFont(83);
  tt.SetTextSize(18);
  tt.SetTextAlign(32);
  //  tt.DrawTextNDC( 0.89, 0.88, "arXiv:0707.3447" );

//   TString name = "mh-scan-overlay";
//   if ( !doPub ) name += "_label";
//   myCanvas->Print(name+".eps");

  
  return 0;
  
}
Exemplo n.º 6
0
//____________________________________________________________________________________
// Plot mH scan: main entry point
int plotScan( TString* filenames,int* styles, double* mins, bool* bands, int nfiles=1, int index = 68,
              TString drawOpt = "C", double mHmin = 85, double mHmax = 140 )
{

  // Styles
  gROOT->SetStyle("Pub");
  gStyle->SetCanvasColor(0);
  gStyle->SetCanvasDefH( 500 );
  gStyle->SetCanvasDefW( 600 );
  

  double chi2min = -0., chi2max = 4;  // Delta-chi2 range
  double threshold = 1e-4;

  for(int i = 0; i<nfiles; i++ )
  {
    std::cout << "Opening " << filenames[i]; 
    TFile* file = new TFile(filenames[i]);
      if ( !(file->IsOpen()) ) {
      std::cerr << "*** Couldn't open " << filenames[i] << std::endl;
      return -1;
    }
    // Retrieve and correct graph
    TString gName("graph1d");
    gName += index;
    TGraph *gChi2[4];
    gChi2[i] = (TGraph*)file->Get( gName );
    if ( !gChi2 ) {
      std::cerr << "*** Couldn't find graph \"" << gName << "\"" << std::endl;
      return -1;
    }
    if(i==0) zeroSuppress( gChi2[i] );
  }

  // Set plot range
  TH2F* range = new TH2F("range","#chi^{2} fit of lightest Higgs mass",
                         2,mHmin,mHmax,2,chi2min,chi2max);
  range->GetXaxis()->SetTitle("M_{h} [GeV]");
  range->GetYaxis()->SetTitle("#Delta#chi^{2}");
  range->Draw();


  // Find preferred value
//  double mHfavour = findMh( gChi2, 0., mHmin );
//  double negError = mHfavour-findMh( gChi2, 1., mHmin );
//  double posError = findMh( gChi2, 1., mHfavour )-mHfavour;
//  std::cout << "Favoured value: " << mHfavour << "+" << posError << "-" << negError << std::endl;

  // Include LEP limit
  TBox* bLepLimit = new TBox( mHmin, chi2min+0.01, LEPLIMIT, chi2max-0.01 );
  bLepLimit->SetFillColor( 5 );
  bLepLimit->Draw();

  // Find value at lep limit
//  double chi2limit = gChi2->Eval( LEPLIMIT, 0, "S" );
//  std::cout << "Value at limit (" << LEPLIMIT << "): " << chi2limit << std::endl;

  // Include upper theoretical limit
  double theoLimit = 130;
  TBox* bTheoLimit = new TBox( theoLimit, chi2min+0.01, mHmax, chi2max-0.01 );
  bTheoLimit->SetFillColor( 42 );
  bTheoLimit->Draw();

  TGraph* rB[4];
  for (int i=0; i<nfiles; i++)
  { 
    if ( bands[i] ) {
      rB[i]=redBand2( gChi2[i], 1.5, mins[i],0.05);
    }
    gChi2[i]->SetLineWidth(3);
    gChi2[i]->SetMarkerStyle(2);
    gChi2[i]->SetLineColor(4);
    gChi2[i]->SetLineStyle(styles[i]);
  }

  for( int i = 0; i<nfiles; ++i){
    if(bands[i]) rB[i]->Draw("LF");
  }
  for( int i = 0; i<nfiles; ++i) gChi2[i]->Draw(drawOpt);

  // Forbidden regions
  TLatex tt;
  tt.SetTextSize(0.7*gStyle->GetTextSize());
  tt.SetTextAlign(12);
  tt.DrawLatex( mHmin+4, chi2min+0.4, "#splitline{LEP}{excluded}" );
  tt.SetTextAlign(22);
  tt.DrawLatex( (theoLimit+mHmax)/2.01, chi2min+0.4, "#splitline{Theoretically}{inaccessible}" );


  
  return 0;
  
}