本文整理汇总了C++中TString::IsFloat方法的典型用法代码示例。如果您正苦于以下问题:C++ TString::IsFloat方法的具体用法?C++ TString::IsFloat怎么用?C++ TString::IsFloat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TString
的用法示例。
在下文中一共展示了TString::IsFloat方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnCharacters
void TBDataParser::OnCharacters(const char *characters)
{
if(_currentElement != NULL && !strcmp(_currentElement->Data(),"vector")) {
TString *string = new TString(characters);
TObjArray *values = string->Tokenize(", ");
for(Int_t i = 0; i < values->GetEntries(); i++) {
TObjString *object = (TObjString *) values->At(i);
TString value = object->GetString().ReplaceAll("\n", "").ReplaceAll("\t", "").ReplaceAll(" ", "").ReplaceAll("\0", "");
if(value.IsFloat()) {
_vector->Fill(value.Atof());
}
}
if(_vectorsStack->GetEntries() == 1) {
_motherVecEntries = _vector->GetEntries();
} else if(_currentMethod != NULL && !strcmp(_currentMethod->Data(),"all")) {
for(Int_t i = 1; i < _motherVecEntries; i++) {
TObjString *object = (TObjString *) values->First();
TString value = object->GetString().ReplaceAll("\n", "").ReplaceAll("\t", "").ReplaceAll(" ", "").ReplaceAll("\0", "");
if(value.IsFloat())
_vector->Fill(value.Atof());
}
}
values->Delete();
}
}
示例2: CalcLednicR
Double_t CalcLednicR(Double_t zr, Double_t zt, Double_t v)
{
TString cmd = Form("echo '%0.5f,%0.5f,%0.5f'", zr, zt, v);
cmd+= " | ./lednic_input.exe";
Printf("%s", cmd.Data());
cmd = gSystem->GetFromPipe(cmd.Data());
if (!cmd.IsFloat()) {
Printf("Problem with program 'lednic_input.exe'");
return 0;
}
return cmd.Atof();
}
示例3: main
//void main_makePlots()
int main(int argc, char* argv[])
{
// Output filenames options - for creation of a log file and a histogram file in the given directory
TString dir = "control_plots/";
TString tst = fileTimeStamp();
TString pfx = "_plots_";
TString sfx = "_NO_MET_CUT";
// Process input
if(argc<3)
{
cout << "\n ERROR: Please enter a decay chain, dataset, and (optional) a max number of events.\n" << endl;
return 1;
}
TString decayChain = argv[1];
TString dataset = argv[2];
TString maxEventsStr = "" ;
if(argc>=4)
{
maxEventsStr = argv[3];
if(!maxEventsStr.IsFloat())
{
cout << "\n ERROR: Please enter the number of events you want to process for your third option"
"\n (or nothing if you want to process them all).\n"
<< endl;
return 1;
}
}
if(decayChain!="Zuu" && decayChain!="Zee" && decayChain!="Zttuu" && decayChain!="Zttee")
{
cout << "\n ERROR: Please specify one of the following decay chains for your first option: Zuu, Zee, Zttuu, Zttee\n" << endl;
return 1;
}
// Open files and map trees
TFile* f_input;
if (dataset == "muon" ) f_input = TFile::Open(fn_muon );
else if(dataset == "elec" ) f_input = TFile::Open(fn_elec );
else if(dataset == "dy" ) f_input = TFile::Open(fn_dy );
else if(dataset == "dy1j" ) f_input = TFile::Open(fn_dy1j );
else if(dataset == "ww" ) f_input = TFile::Open(fn_ww );
else if(dataset == "wz" ) f_input = TFile::Open(fn_wz );
else if(dataset == "zz" ) f_input = TFile::Open(fn_zz );
else if(dataset == "tthad" ) f_input = TFile::Open(fn_tthad );
else if(dataset == "ttlep" ) f_input = TFile::Open(fn_ttlep );
else if(dataset == "ttsemi" ) f_input = TFile::Open(fn_ttsemi );
else if(dataset == "t_s" ) f_input = TFile::Open(fn_t_s );
else if(dataset == "t_t" ) f_input = TFile::Open(fn_t_t );
else if(dataset == "t_tw" ) f_input = TFile::Open(fn_t_tw );
else if(dataset == "tbar_s" ) f_input = TFile::Open(fn_tbar_s );
else if(dataset == "tbar_t" ) f_input = TFile::Open(fn_tbar_t );
else if(dataset == "tbar_tw" ) f_input = TFile::Open(fn_tbar_tw);
else
{
cout << "\n ERROR: Please specify one of the following datasets for your second option:"
"\n muon, elec, dy, dy1j, ww, wz, zz, tthad, ttlep, ttsemi, t(bar)_(s/t/tw)\n" << endl;
return 1;
}
// If tau tau decays specified on a non-dy set.
if( (decayChain=="Zttuu" || decayChain=="Zttee") && (dataset!="dy" && dataset!="dy1j"))
{
cout << "\n ERROR: Tau decay split only valid for DY datasets\n" << endl;
return 1;
}
TTree* t_input = (TTree*)f_input->Get("tree");
// Create an instance of the ZCControlPlotMaker and input options
ZCControlPlotMaker *plotMaker = new ZCControlPlotMaker();
TString outputFileName = dir+tst+pfx+decayChain+"_"+dataset+sfx;
TString options = decayChain;
if(dataset!="muon" && dataset!="elec") options+=",sim";
if(dataset=="dy") options+=",dy";
// Process tree and save output
if(maxEventsStr!="")
t_input->Process(plotMaker, options, maxEventsStr.Atoi() );
else t_input->Process(plotMaker, options );
cout << plotMaker->saveOutputToFile(outputFileName) << endl;
return 0;
}
示例4: main
//.........这里部分代码省略.........
cerr<<usage<<endl;
return 0;
}
} else if (option == "-ngc") {
useGCcorr = false;
} else if (option == "-at") {
useATcorr = true;
} else if (option == "-genome") {
if (index < argc) genome = Genome::get(argv[index++]);
} else if (option == "-d") {
if (index < argc && argv[index][0] != '-')
dir = argv[index++];
else cerr<<"No directory is given."<<endl;
} else if (option == "-qual") {
if (index >= argc || argv[index][0] == '-') {
cerr<<"No quality value is provided."<<endl;
cerr<<usage<<endl;
return 0;
}
TString tmp = argv[index++];
if (!tmp.IsDigit()) {
cerr<<"Quality value must be integer."<<endl;
cerr<<usage<<endl;
return 0;
}
qual = tmp.Atoi();
} else if (option == "-over") {
if (index >= argc || argv[index][0] == '-') {
cerr<<"No fraction of overlap is provided."<<endl;
cerr<<usage<<endl;
return 0;
}
TString tmp = argv[index++];
if (!tmp.IsFloat()) {
cerr<<"Fraction of overlap must be number."<<endl;
cerr<<usage<<endl;
return 0;
}
over = tmp.Atof();
} else if (option == "-f") {
if (index >= argc || argv[index][0] == '-') {
cerr<<"No file name is provided."<<endl;
cerr<<usage<<endl;
return 0;
}
call_file = argv[index++];
} else if (option == "-unique") {
forUnique = true;
} else if (option == "-range") {
range = atoi(argv[index++]);
} else if (option == "-relax") {
relaxCalling = true;
} else if (option[0] == '-') {
cerr<<"Unknown option '"<<option<<"'.\n"<<endl;
}
}
if (out_root_file.length() <= 0) out_root_file = root_files[0];
if (out_root_file.length() <= 0)
cerr<<"WARNING: no name of root-file provided."<<endl;
for (int o = 0;o < n_opts;o++) {
int option = opts[o];
int bin = bins[o]; if (bin <= 0) bin = gbin;
if (option == OPT_TREE) { // tree
HisMaker maker(out_root_file,genome);
示例5: DrawMLPoutputMovie
//.........这里部分代码省略.........
countCanvas++;
TString ctitle = Form("TMVA response %s",methodTitle.Data());
c = new TCanvas( Form("canvas%d", countCanvas), ctitle, 0, 0, width, (Int_t)width*0.78 );
TH1F* sig = (TH1F*)titkeyTit->ReadObj();
sig->SetTitle( Form("TMVA response for classifier: %s", methodTitle.Data()) );
TString dataType = (name.Contains("_train_") ? "(training sample)" : "(test sample)");
// find background
TString nbn = sig->GetName(); nbn[nbn.Length()-1] = 'B';
TH1F* bgd = dynamic_cast<TH1F*>(epochDir->Get( nbn ));
if (bgd == 0) {
cout << "Big troubles with histogram: " << bgd << " -> cannot find!" << endl;
exit(1);
}
cout << "sig = " << sig->GetName() << endl;
cout << "bgd = " << bgd->GetName() << endl;
// set the histogram style
TMVAGlob::SetSignalAndBackgroundStyle( sig, bgd );
// normalise both signal and background
TMVAGlob::NormalizeHists( sig, bgd );
// set only first time, then same for all plots
if (first) {
if (xmin == 0 && xmax == 0) {
xmin = TMath::Max( TMath::Min(sig->GetMean() - nrms*sig->GetRMS(),
bgd->GetMean() - nrms*bgd->GetRMS() ),
sig->GetXaxis()->GetXmin() );
xmax = TMath::Min( TMath::Max(sig->GetMean() + nrms*sig->GetRMS(),
bgd->GetMean() + nrms*bgd->GetRMS() ),
sig->GetXaxis()->GetXmax() );
}
ymin = 0;
ymax = TMath::Max( sig->GetMaximum(), bgd->GetMaximum() )*maxMult;
first = kFALSE;
}
// build a frame
Int_t nb = 100;
TString hFrameName(TString("frame") + methodTitle);
TObject *o = gROOT->FindObject(hFrameName);
if(o) delete o;
TH2F* frame = new TH2F( hFrameName, sig->GetTitle(),
nb, xmin, xmax, nb, ymin, ymax );
frame->GetXaxis()->SetTitle( methodTitle + " response" );
frame->GetYaxis()->SetTitle("(1/N) dN^{ }/^{ }dx");
TMVAGlob::SetFrameStyle( frame );
// find epoch number (4th token)
TObjArray* tokens = name.Tokenize("_");
TString es = ((TObjString*)tokens->At(4))->GetString();
if (!es.IsFloat()) {
cout << "Big troubles in epoch parsing: \"" << es << "\" is not float" << endl;
exit(1);
}
Int_t epoch = es.Atoi();
// eventually: draw the frame
frame->Draw();
c->GetPad(0)->SetLeftMargin( 0.105 );
frame->GetYaxis()->SetTitleOffset( 1.2 );
// Draw legend
TLegend *legend= new TLegend( c->GetLeftMargin(), 1 - c->GetTopMargin() - 0.12,
c->GetLeftMargin() + 0.5, 1 - c->GetTopMargin() );
legend->SetFillStyle( 1 );
legend->AddEntry(sig,TString("Signal ") + dataType, "F");
legend->AddEntry(bgd,TString("Background ") + dataType, "F");
legend->SetBorderSize(1);
legend->SetMargin( 0.15 );
legend->Draw("same");
TText* t = new TText();
t->SetTextSize( 0.04 );
t->SetTextColor( 1 );
t->SetTextAlign( 31 );
t->DrawTextNDC( 1 - c->GetRightMargin(), 1 - c->GetTopMargin() + 0.015, Form( "Epoch: %i", epoch) );
// overlay signal and background histograms
sig->Draw("samehist");
bgd->Draw("samehist");
// save to file
TString dirname = "movieplots";
TString foutname = dirname + "/" + name;
foutname.Resize( foutname.Length()-2 );
foutname.ReplaceAll("convergencetest___","");
foutname += ".gif";
cout << "storing file: " << foutname << endl;
c->Update();
c->Print(foutname);
}
}