本文整理汇总了C++中TObjString::GetString方法的典型用法代码示例。如果您正苦于以下问题:C++ TObjString::GetString方法的具体用法?C++ TObjString::GetString怎么用?C++ TObjString::GetString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TObjString
的用法示例。
在下文中一共展示了TObjString::GetString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReadDataSetList
Bool_t KVDataSetManager::ReadDataSetList()
{
//Initialise list of all known datasets from informations in $KVROOT/KVFIles/.kvrootrc
//(and user's .kvrootrc)
KVString manip_list = gEnv->GetValue("DataSet", "");
fDataSets.Clear();
TObjArray *manips = manip_list.Tokenize(" ");
TIter next(manips); TObjString* manip;
while ( (manip = (TObjString*)next()) ) {
KVDataSet *ds = NewDataSet();
ds->SetName(manip->GetString().Data());
ds->SetTitle( gEnv->GetValue( Form("%s.DataSet.Title", manip->GetString().Data()), "Experimental dataset" ) );
ds->SetDataPathSubdir( gEnv->GetValue( Form("%s.DataSet.RepositoryDir", manip->GetString().Data()), manip->GetString().Data() ) );
ds->SetUserGroups( gEnv->GetValue( Form("%s.DataSet.UserGroup", manip->GetString().Data()), "") );
ds->SetRepository(fRepository);
fDataSets.Add(ds);
}
delete manips;
return kTRUE;
}
示例2: 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();
}
}
示例3: DrawCurrHistogram
void DrawCurrHistogram() {
TObjString* filename = histograms->At(currPos);
TString f(fFileDir);
f.Append("/");
f.Append(filename->GetString());
TFile* file = new TFile(f, "read");
// check file
if (!file) return;
if (file->IsZombie()) return;
TH2D* hist = (TH2D*) gFile->Get(fHistName);
if (!hist) continue;
if (!hist->GetEntries()) continue;
// copy the histogram to the root memory
//gROOT->cd();
//TH2D* hist_copy = new TH2D(*hist);
TString t(filename->GetString());
t.Append(": ");
t.Append(hist->GetTitle());
hist->SetTitle(t);
//histograms->Add(hist_copy);
//TH1* h = histograms->At(currPos);
c->cd(1);
//gPad->cd();
hist->Draw("colz");
// file can be closed now...
//file->Close();
if(currHist != 0) {
PreserveAxis(currHist->GetXaxis(), hist->GetXaxis());
PreserveAxis(currHist->GetYaxis(), hist->GetYaxis());
}
if(currFile != 0)
currFile->Close();
currFile = file;
currHist = hist;
//gPad->Modified();
//gPad->Update();
//cout << "Added histogram from " << filename << endl;
}
示例4: AODmerge
//______________________________________________________________________________
void AODmerge()
{
// Merging method. No staging and no terminate phase.
TStopwatch timer;
timer.Start();
TString outputDir = "wn.xml";
TString outputFiles = VAR_AOD_MERGE_FILES;
TString mergeExcludes = "";
TObjArray *list = outputFiles.Tokenize(",");
TIter *iter = new TIter(list);
TObjString *str;
TString outputFile;
Bool_t merged = kTRUE;
while((str=(TObjString*)iter->Next())) {
outputFile = str->GetString();
// Skip already merged outputs
if (!gSystem->AccessPathName(outputFile)) {
printf("Output file <%s> found. Not merging again.",outputFile.Data());
continue;
}
if (mergeExcludes.Contains(outputFile.Data())) continue;
merged = AliAnalysisAlien::MergeOutput(outputFile, outputDir, 10, 0);
if (!merged) {
printf("ERROR: Cannot merge %s\n", outputFile.Data());
return;
}
}
// all outputs merged, validate
ofstream out;
out.open("outputs_valid_merge", ios::out);
out.close();
timer.Print();
}
示例5: ReadTaskList
Bool_t KVDataSetManager::ReadTaskList()
{
//Initialise list of all known analysis tasks from informations in $KVROOT/KVFIles/.kvrootrc
//(and user's .kvrootrc)
KVString task_list = gEnv->GetValue("DataAnalysisTask", "");
fTasks.Clear();
TObjArray *tasks = task_list.Tokenize(" ");
TIter next(tasks); TObjString* task;
while ( (task = (TObjString*)next()) ) {
KVDataAnalysisTask *dat = new KVDataAnalysisTask;
TString name = task->GetString();
dat->SetName( name.Data() );
dat->SetTitle( gEnv->GetValue( Form("%s.DataAnalysisTask.Title", name.Data()), "") );
dat->SetPrereq( gEnv->GetValue( Form("%s.DataAnalysisTask.Prereq", name.Data()), "") );
dat->SetDataAnalyser( gEnv->GetValue( Form("%s.DataAnalysisTask.Analyser", name.Data()), "KVDataAnalyser") );
dat->SetWithUserClass( gEnv->GetValue( Form("%s.DataAnalysisTask.UserClass", name.Data()), kFALSE) );
dat->SetUserBaseClass( gEnv->GetValue( Form("%s.DataAnalysisTask.UserClass.Base", name.Data()), "") );
dat->SetStatusUpdateInterval( gEnv->GetValue( Form("%s.DataAnalysisTask.StatusUpdateInterval", name.Data()), 1000) );
fTasks.Add(dat);
}
delete tasks;
return kTRUE;
}
示例6: formatForCmsPublic
void formatForCmsPublic(TPad * c, TLegend *leg, TString title, int nsamp, float legx, float legy, float legw, float legh, TString legopt)
{
if(title.Length()!=0)
{
TPaveText *pave = new TPaveText(0.5,0.96,0.94,0.99,"NDC");
pave->SetBorderSize(0);
pave->SetFillStyle(0);
pave->SetTextAlign(32);
pave->SetTextFont(42);
TObjArray * tokens = title.Tokenize("\\\\");
int nt = tokens->GetEntries();
for(int it=0; it<nt; ++it)
{
TObjString * t = (TObjString *)tokens->At(it);
pave->AddText(t->GetString());
}
pave->Draw("same");
}
float legx1=legx, legx2=legx+legw;
float legy1 = legy, legy2 = legy-legh*(float)(nsamp);
if(leg==0) leg = ((TPad *)c)->BuildLegend(legx1,legy1,legx2,legy2);
leg->SetBorderSize(0);
leg->SetFillColor(0);
leg->SetFillStyle(0);
leg->SetLineWidth(1);
leg->SetTextFont(42);
leg->SetEntryOption(legopt);
leg->SetX1NDC(legx1);
leg->SetY1NDC(legy1);//-nsamp*legh);
leg->SetX2NDC(legx2);
leg->SetY2NDC(legy2);
}
示例7: StartModule
//______________________________________________________________________________
void ButtonWindow::StartModule()
{
// Start the selected module.
// get the selected module
Int_t module = fCBox_Module->GetSelected();
// get the selected runsets
TList set_list;
fLB_RunSet->GetSelectedEntries(&set_list);
// fill sets
Int_t nSet = set_list.GetSize();
Int_t set[999];
for (Int_t i = 0; i < nSet; i++)
{
TGLBEntry* e = (TGLBEntry*) set_list.At(i);
set[i] = e->EntryId();
}
// get the calibration module
gCurrentModule = (TCCalib*) gCaLibModules->At(module);
// get the selected calibration
TObjString* calibration = (TObjString*) gCalibrations->At(fCBox_Calibration->GetSelected());
// start the module
((TCCalib*)gCurrentModule)->Start(calibration->GetString().Data(), nSet, set);
}
示例8:
float *getwq(TH1 *h) {
TString delim = "_";
TString hn = h->GetName();
TObjArray *tokens = hn.Tokenize(delim);
TObjString *wstro = (TObjString*)tokens->At(1);
TObjString *qstro = (TObjString*)tokens->At(2);
TString wstr = wstro->GetString();
TString qstr = qstro->GetString();
double wval = wstr.Atof();
double qval = qstr.Atof();
float *ret = new float[2];
ret[0] = wval;
ret[1] = qval;
delete tokens;
return ret;
}
示例9: PrintSaved
void PrintSaved() {
TIter next(saved);
TObjString* title;
cout << endl << "Saved histograms: " << saved->GetEntries() << endl << endl;
while ((title=(TObjString*)next())) {
cout << title->GetString() << endl;
}
}
示例10: LoadLibsSara
void LoadLibsSara()
{
// Load configuration
gROOT->LoadMacro("ConfigurationVAF.C");
// Set paths
gSystem->SetIncludePath(includepath.Data());
gSystem->AddDynamicPath(local_fastjet_path.Data());
// Load libraries locally
TString loadLibraries="LoadLibraries.C"; loadLibraries.Prepend(loadMacroPath.Data());
gROOT->LoadMacro(loadLibraries.Data());
LoadLibraries(kFALSE);
// for FastJet
TObjArray *arr;
TObjString *objstr;
arr = loaddylibs.Tokenize(" ");
TIter next(arr);
while ((objstr=(TObjString*)next())){
TString str=(objstr->GetString()).Append(".dylib");
Printf("Loading %s", str.Data());
gSystem->Load(str.Data());
}
// standard AliRoot
arr = loadlibs.Tokenize(" ");
TIter next(arr);
while ((objstr=(TObjString*)next())){
TString str=objstr->GetString();
Printf("Loading %s", str.Data());
gSystem->Load(str.Data());
}
// Load analysis sources locally
arr = sources.Tokenize(" ");
TIter next(arr);
while ((objstr=(TObjString*)next())){
//TString str=(objstr->GetString()).Append(".cxx++g");
TString str=(objstr->GetString()).Append(".cxx+");
gROOT->LoadMacro(str.Data());
}
return;
}
示例11: transferxSecFromTextToROOT
void transferxSecFromTextToROOT(std::string inputStr="xSec_T3G.txt"){
ifstream fin(inputStr.c_str());
char line[200];
TFile *xSecProspinoFile =0;
TH1D *xSecProspino =0;
int minMom = 1000000, maxMom = 0;
int nBins = 0;
std::vector<int> momVec; std::vector<double> xSecVec, xSecErrVec;
while( fin.getline(line, 200) ){
TString lineT(line);
if( lineT.Contains("Interactions") ) continue;
TObjArray *vlist = lineT.Tokenize(" ");
int nEntries = vlist->GetEntries();
int mMom;
double xSec =0, xSecRelErr =0;
for(int ie=0; ie<nEntries; ie++){
TObjString* perObj = dynamic_cast<TObjString*>(vlist->At(ie));
TString perStr = perObj->GetString();
if( ie==0 ){
mMom = perStr.Atoi();
if( minMom > mMom ) minMom = mMom;
if( maxMom < mMom ) maxMom = mMom;
}
if( ie==1 ) xSec = perStr.Atof();
if( ie==2 ) xSecRelErr = perStr.Atof();
}
nBins ++;
momVec.push_back(mMom); xSecVec.push_back(xSec); xSecErrVec.push_back(xSec*xSecRelErr/100.);
// std::cout<<"mMom : "<<mMom<<" xSec : "<<xSec<<" xSecRelErr : "<<xSecRelErr<<std::endl;
}
double divBin = 1.0*(maxMom - minMom)/(nBins-1);
double lowMom = minMom-divBin/2.0, highMom = maxMom+divBin/2.0;
std::cout<<"nBins : "<<nBins<<" minMom : "<<minMom<<" maxMom : "<<maxMom<<" divBin : "<<divBin<<" lowMom : "<<lowMom<<" highMom : "<<highMom<<std::endl;
TString rootStrT(inputStr);
rootStrT.ReplaceAll("txt", "root");
std::cout<<"root file : "<<rootStrT<<std::endl;
xSecProspinoFile = new TFile(rootStrT, "RECREATE");
if( rootStrT.Contains("T1") ) xSecProspino = new TH1D("gluino_xsection", "gluino_xsection", nBins, lowMom, highMom);
if( rootStrT.Contains("T2") ) xSecProspino = new TH1D("squark_xsection", "squark_xsection", nBins, lowMom, highMom);
if( rootStrT.Contains("T3G") ) xSecProspino = new TH1D("stop_xsection", "stop_xsection", nBins, lowMom, highMom);
for(int iv=0; iv<(int)momVec.size(); iv++){
double mMom = (double)momVec[iv];
int ib = xSecProspino->FindFixBin(mMom);
xSecProspino->SetBinContent(ib, xSecVec[iv]);
xSecProspino->SetBinError(ib, xSecErrVec[iv]);
}
// xSecProspino->Write();
xSecProspinoFile->Write(); xSecProspinoFile->Close();
}
示例12: ReadRunsets
//______________________________________________________________________________
void ButtonWindow::ReadRunsets(Int_t i)
{
// Read the runsets for the calibration data of the 'i'-th module
// in the module selection combo box
// check if calibration was selected
if (!gCalibSelected)
{
TGMsgBox* msg = new TGMsgBox(gClient->GetRoot(), gMainWindow, "Error", "Please select first "
"the calibration you want to work with!",
kMBIconStop, kMBOk, 0, kFitWidth | kFitHeight, kTextLeft);
return;
}
// get the selected calibration
TObjString* calibration = (TObjString*) gCalibrations->At(fCBox_Calibration->GetSelected());
// get the calibration data of the module
TCCalib* c = (TCCalib*) gCaLibModules->At(i);
TString data = c->GetCalibData();
// get the number of runsets
Int_t nsets = TCMySQLManager::GetManager()->GetNsets(data.Data(), calibration->GetString().Data());
// fill the runsets into the list
fLB_RunSet->RemoveAll();
for (Int_t i = 0; i < nsets; i++)
{
// get the first and last runs
Char_t ctime[256];
Int_t first_run = TCMySQLManager::GetManager()->GetFirstRunOfSet(data.Data(), calibration->GetString().Data(), i);
Int_t last_run = TCMySQLManager::GetManager()->GetLastRunOfSet(data.Data(), calibration->GetString().Data(), i);
TCMySQLManager::GetManager()->GetChangeTimeOfSet(data.Data(), calibration->GetString().Data(), i, ctime);
ctime[strlen(ctime)-3] = '\0';
// add list entry
Char_t tmp[256];
sprintf(tmp, "Set %d (Run %d to %d) of %s", i, first_run, last_run, ctime);
fLB_RunSet->AddEntry(tmp, i);
}
// update list box
fLB_RunSet->Layout();
}
示例13: GetOptionFromString
void GetOptionFromString(TString str,TString &outStr1,TString &outStr2,TString d=":") {
// TStringO
TObjArray *tokens = str.Tokenize(d.Data());
TObjString *objStr = (TObjString *)tokens->At(0);
if (!objStr) {
outStr1 = "err";
outStr2 = "";
return;
}
outStr1 = objStr->GetString();
objStr = (TObjString *) tokens->At(1);
if (!objStr) {
outStr2 = "";
return;
}
outStr2 = objStr->GetString();
}
示例14: regexMatchHisto
//======================================================================
// Regex match a histo name in a directory
//
void regexMatchHisto( TObject *obj,
TDirectory *dir,
TObjArray *Args, // list of regexes to match
TObjArray *Matches)
{
for (int i=0; i<Args->GetEntriesFast(); i++) {
TObjString *sre = (TObjString *)(*Args)[i];
TRegexp re(sre->GetString(),kFALSE);
if (re.Status() != TRegexp::kOK) {
cerr << "The regexp " << sre->GetString() << " is invalid, Status() = ";
cerr << re.Status() << endl;
exit(-1);
}
TString path( (char*)strstr( dir->GetPath(), ":" ) );
path.Remove( 0, 2 ); // gets rid of ":/"
TString fullspec = TString(dir->GetPath()) + "/" + obj->GetName();
if ((fullspec.Index(re) != kNPOS) &&
(obj->InheritsFrom("TH1"))) {
// we have a match
// Check to see if it's already in memory
map<string,string>::const_iterator it = glmap_objpath2id.find(dir->GetPath());
if (it != glmap_objpath2id.end()) {
if (gl_verbose)
cout << "Object " << fullspec << " already read in, here it is" << endl;
map<string,wTH1 *>::const_iterator hit = glmap_id2histo.find(it->second);
// Is this okay? It's going to get wrapped again...
TObjString *rpath = new TObjString(fullspec);
Matches->AddLast(rpath);
Matches->AddLast(hit->second->histo());
} else {
// success, record that you read it in.
TObjString *rpath = new TObjString(fullspec);
Matches->AddLast(rpath);
Matches->AddLast(obj);
}
break; // don't let the object match more than one regex
} // if we have a match
} // Arg loop
} // regexMatchHisto
示例15: getHistogram
TH1* getHistogram(TFile* inputFile, const TString& meName, TObjArray& processes, const TString& region)
{
TH1* histogram_sum = 0;
int numProcesses = processes.GetEntries();
for ( int iProcess = 0; iProcess < numProcesses; ++iProcess ) {
TObjString* process = dynamic_cast<TObjString*>(processes.At(iProcess));
assert(process);
TH1* histogram = getHistogram(inputFile, meName, process->GetString(), region);
if ( !histogram_sum ) {
TString histogramName_sum = histogram->GetName();
histogramName_sum = histogramName_sum.ReplaceAll(process->GetString(), "sum");
histogram_sum = (TH1*)histogram->Clone(histogramName_sum.Data());
if ( !histogram_sum->GetSumw2N() ) histogram_sum->Sumw2();
} else {
histogram_sum->Add(histogram);
}
}
return histogram_sum;
}