本文整理汇总了C++中TObjString::String方法的典型用法代码示例。如果您正苦于以下问题:C++ TObjString::String方法的具体用法?C++ TObjString::String怎么用?C++ TObjString::String使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TObjString
的用法示例。
在下文中一共展示了TObjString::String方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Normalize
//_________________________________________________________________________________________________
void Normalize(AliMergeableCollection& hc)
{
TObjArray* a = hc.SortAllIdentifiers();
TIter nextId(a);
TObjString* sid;
while ( ( sid = static_cast<TObjString*>(nextId()) ) )
{
std::cout << sid->String() << std::endl;
if ( !sid->String().Contains("HITS") ) continue;
TObjArray* parts = sid->String().Tokenize("/");
TString npadsId("/");
npadsId += static_cast<TObjString*>(parts->At(0))->String();
npadsId += "/NPADS";
delete parts;
std::cout << npadsId << std::endl;
TList* list = hc.CreateListOfObjectNames(sid->String().Data());
TIter nextObject(list);
TObjString* sobject;
while ( ( sobject = static_cast<TObjString*>(nextObject())) )
{
std::cout << " " << sobject->String() << std::endl;
}
delete list;
}
delete a;
}
示例2: MergeFlowd
void MergeFlowd()
{
TGrid *alien = TGrid::Connect("alien");
if (alien->IsZombie())
{
delete alien;
cout << "Fatal: Alien is a zombie!" << endl;
return;
}
Int_t runlist[] = { // Counter
/*170309, 170308, 170306, 170270, 170269, 170268, 170230, 170228,*/ 170204, 170203, // 10
170193, 170163, 170159, 170155, 170081, 170027, 169859, 169858, 169855, 169846, // 20
169838, 169837, 169835, 169417, 169415, 169411, 169238, 169167, 169160, 169156, // 30
169148, 169145, 169144, 169138, 169094, 169091, 169035, 168992, 168988, 168826, // 40
168777, 168514, 168512, 168511, 168467, 168464, 168460, 168458, 168362, 168361, // 50
168342, 168341, 168325, 168322, 168311, 168310, 167988, 167987 // 58
};
TFileMerger merger;
TString dataBaseDir = "/alice/cern.ch/user/m/mpuccio/Flowd_PbPb2011/output/000";
merger.OutputFile("FileMerger.root");
for (int iRun = 0; iRun < 1; ++iRun)
{
TString runDir = Form("%s%i",dataBaseDir.Data(),runlist[iRun]);
TGridResult *res = alien->Command(Form("find %s */mpuccio_Flowd.root",runDir.Data()));
TIter iter(res);
TMap *map;
while ((map = (TMap*)iter()))
{
TObjString *obj = dynamic_cast<TObjString*>(map->GetValue("turl"));
if (!obj || !obj->String().Length())
{
delete res;
break;
}
TFile *f = TFile::Open(obj->String().Data());
if (!f->IsOpen())
{
cout << "File " << obj->String().Data() << " has some problems..." << endl;
continue;
}
merger.AddFile(f);
merger.PartialMerge();
f->Close();
}
}
merger.Merge();
merger.Write();
}
示例3: FitMacro
//_____________________________________________________________________________
void FitMacro( char* what ="pt",const char* printWhat = "", int debug =0 )
{
AliLog::SetGlobalDebugLevel(debug);
Bool_t rawcount = kFALSE;
Bool_t clean = kFALSE;
Bool_t print = kFALSE;
TObjArray* sprint = TString(printWhat).Tokenize(",");
//Set bool
if(sprint->FindObject("rawcount")) rawcount =kTRUE;
if(sprint->FindObject("clean")) clean =kTRUE;
if(sprint->FindObject("print")) print =kTRUE;
//General conf.
TObjArray* whatArray= TString(what).Tokenize(",");
TIter nextWhat(whatArray);
TObjString* swhat;
// main object
AliAnalysisMuMu analysis(sfile,sasso,sasso2,beamYear);
// Clean
if(clean) analysis.CleanAllSpectra();
//_____ Fit
while ( ( swhat = static_cast<TObjString*>(nextWhat()) ) )
{
if(swhat->String().Contains("integrated")) analysis.Jpsi(swhat->String().Data(),"",kFALSE,kFALSE);
else analysis.Jpsi(swhat->String().Data(),"BENJ",kFALSE,kFALSE);
}
// analysis.PrintNofParticle("PSI","NofJPsi","YVSPT",kFALSE);
// analysis.PrintNofParticle("PSI","NofJPsi","Y",kFALSE);
if(print && what == "pt") analysis.PrintNofParticle("PSI","NofJPsi","PT",kFALSE);
if(print && what == "y") analysis.PrintNofParticle("PSI","NofJPsi","Y",kFALSE);
if(print && what == "integrated") analysis.PrintNofParticle("PSI","NofJPsi","INTEGRATED",kFALSE);
if(print && what == "yvspt") analysis.PrintNofParticle("PSI","NofJPsi","YVSPT",kFALSE);
if(rawcount){
analysis.ComputeDimuonRawCount(2.8,3.4);
analysis.ComputeDimuonRawCount(2.1,2.8);
}
}
示例4: FindDependentPackages
//___________________________________________________________
Bool_t FindDependentPackages(){
// Find packages where aliroot depends on
// Method is the following: the dependencies are on a webpage on alimonitor
// we download file and try to find the aliroot expression in the file. The line
// we read into a string. The we tokenize the string and look for the expression [email protected]::
// Then we have all information we need
const char *wd = gSystem->pwd();
gSystem->cd("/tmp");
gSystem->Exec("wget http://alimonitor.cern.ch/packages");
TString setting = gSystem->GetFromPipe(Form("cat index.html | grep [email protected]::%s", aliroot_version.Data()));
gSystem->Exec("rm index.html");
gSystem->cd(wd);
if(!setting.Length()) return kFALSE;
TObjArray *tokens = setting.Tokenize(";");
TIter tokiter(tokens);
TObjString *os = NULL;
while((os = dynamic_cast<TObjString *>(tokiter()))){
TString &mys = os->String();
if(!mys.Contains("[email protected]")) continue;
mys.ReplaceAll("[email protected]::", "");
mys.ReplaceAll(""","");
root_version = mys;
break;
}
// print results:
printf("Found Packages for Analysis:\n");
printf("=====================================\n");
printf("ALIROOT: %s\n", aliroot_version.Data());
printf("ROOT: %s\n", root_version.Data());
printf("\n");
return kTRUE;
}
示例5: OccupancyAscii2OCDB
void OccupancyAscii2OCDB(Int_t runNumber,
TObjArray& filenames,
const char* ocdbpath,
const char* comment)
{
AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
AliCDBManager::Instance()->SetRun(runNumber);
AliCDBManager::Instance()->SetSpecificStorage("MUON/Calib/OccupancyMap",ocdbpath);
AliMpCDB::LoadAll();
AliMUON2DMap occupancy(kTRUE);
TObjString* str;
TIter next(&filenames);
while ( ( str = static_cast<TObjString*>(next()) ) )
{
TString data;
ReadOccupancyFile(str->String().Data(),data);
AliMUONTrackerIO::DecodeOccupancy(data.Data(),occupancy);
}
if (occupancy.GetSize())
{
AliCDBId id("MUON/Calib/OccupancyMap",runNumber,runNumber);
AliCDBMetaData metaData;
metaData.SetBeamPeriod(0);
metaData.SetResponsible("MUON TRK");
metaData.SetComment(comment);
AliCDBManager::Instance()->Put(&occupancy,id,&metaData);
}
}
示例6: ReadIntegers
//______________________________________________________________________________
void ReadIntegers(const char* filename, std::vector<int>& integers)
{
/// Read integers from filename, where integers are either
/// separated by "," or by return carriage
ifstream in(gSystem->ExpandPathName(filename));
int i;
char line[10000];
in.getline(line,10000,'\n');
TString sline(line);
if (sline.Contains(","))
{
TObjArray* a = sline.Tokenize(",");
TIter next(a);
TObjString* s;
while ( ( s = static_cast<TObjString*>(next()) ) )
{
integers.push_back(s->String().Atoi());
}
}
else
{
integers.push_back(sline.Atoi());
while ( in >> i )
{
integers.push_back(i);
}
}
std::sort(integers.begin(),integers.end());
}
示例7: WritePreProc
//___________________________________________________
void KVClassFactory::WritePreProc(ofstream & file)
{
//Write pre-processor directives in file
//i.e. '#ifndef __TOTO_H' etc.
//If this class has inheritance, we add '#include "base_class.h"' for each of the base classes.
//and any other include files added using AddHeaderIncludeFile
TString tmp = fClassName;
tmp.ToUpper();
tmp.Prepend("__");
tmp.Append("_H");
file << "#ifndef " << tmp.Data() << endl;
file << "#define " << tmp.Data() << "\n" << endl;
//base class(es) ?
if (fHasBaseClass) {
if(WithMultipleBaseClasses()){
fBaseClassName.Begin(",");
while( !fBaseClassName.End() )
file << "#include \"" << fBaseClassName.Next(kTRUE) << ".h\"" << endl;
file << endl;
}
else
file << "#include \"" << fBaseClassName.Data() << ".h\"\n" << endl;
}
if( fHeadInc.GetSize() ){
TIter next(&fHeadInc); TObjString* str;
while( (str = (TObjString*)next()) ){
file << "#include \"" << str->String().Data() << "\"\n" << endl;
}
}
}
示例8: Get
TString RunDBInterface::Get(TString key){
TObjString* val = (TObjString*)(GetMap()->GetValue(key.Data()));
if (!val) {
cout << "key not found: " << key.Data() << endl;
return TString();
}
return val->String();
}
示例9: GetData
bool GetData(TObjArray &in, TString &out, int pos){
//
// Helper function reading data string
//
TObjString *entry = dynamic_cast<TObjString *>(in.At(pos));
if(!entry){
printf("Entry at pos %d not a string\n", pos);
return false;
}
out = entry->String();
return true;
}
示例10: cacheGeometry
void cacheGeometry( const Char_t *tag, const Char_t *addons )
{
TFile *file = new TFile(Form("%s.root",tag));
if ( file->IsZombie() || nocache )
{
delete file;
const Char_t *path = ".:./StarVMC/Geometry/macros/:$STAR/StarVMC/Geometry/macros/";
Char_t *file = gSystem->Which(path,"loadStarGeometry.C",kReadPermission);
cout << "Loading macro: " << file << endl;
gROOT -> ProcessLine(Form(".L %s",file));
// Load development geometry
// loadDevStarGeometry(tag);
loadStarGeometry(tag);
TString addOns = addons;
TObjArray *array = addOns.Tokenize(" ,;");
for ( Int_t i = 0; i<array->GetEntries(); i++ )
{
TObjString *str = (TObjString *)array->At(i);
cout << "Adding module " << str->String().Data() << endl;
addModule ( str->String() );
}
// Close the geometry
gGeoManager->CloseGeometry();
ColorScheme();
gGeoManager->Export(Form("%s.root",tag));
}
delete file;
// gROOT -> Reset();
}
示例11: DecodeRunlist
void DecodeRunlist(const TString &val){
//
// Tokenize run list
//
TObjArray *runstrings = val.Tokenize(",");
TObjString *os;
TString runstr;
TIter runIter(runstrings);
g_runlist.Set(runstrings->GetEntries());
int nruns(0);
while((os = dynamic_cast<TObjString *>(runIter()))){
runstr = os->String();
g_runlist[nruns++] = runstr.Atoi();
}
delete runstrings;
}
示例12: CheckConfigureParams
//_____________________________________________________________________________
Int_t BdataLoc::CheckConfigureParams( const TObjArray* params, Int_t start )
{
// Check given parameters of call to Configure for obvious errors.
// Internal helper function.
// Invalid call parameter?
if( !params || start < 0 || start + GetNparams() > params->GetLast()+1 )
return 1;
// Invalid parameter array data?
for( Int_t ip = start; ip < start + GetNparams(); ++ip ) {
if( params->At(ip)->IsA() != TObjString::Class() )
return 2;
TObjString* os = static_cast<TObjString*>(params->At(ip));
if( !os )
return 3;
if( os->String().IsNull() )
return 4;
}
return 0;
}
示例13: FnormMacro
//_____________________________________________________________________________
void FnormMacro(
const char* filename="../LHC15g.MuMu.1.root",
const char* associatedSimFileName="",
const char* associatedSimFileName2="",
const char* beamYear="PbPb2011",const int DebugLevel =0)
{
// //_____ FNorm
// analysis.ComputeIntFnormFromCounters("",kFALSE);
// //_____
AliAnalysisMuMu ana(filename,associatedSimFileName,associatedSimFileName2,beamYear);
AliLog::SetGlobalDebugLevel(DebugLevel);
if (!ana.OC() || !ana.CC())
{
AliError("No mergeable/counter collection. Consider Upgrade()");
return ;
}
else
{
cout << " ================================================================ " << endl;
cout << " Compute Mean Fnorm From Counters " << endl;
cout << " ================================================================ " << endl;
}
// Get configuration settings
TObjArray* eventTypeArray = ana.Config()->GetListElements(AliAnalysisMuMuConfig::kEventSelectionList,IsSimulation());
TObjArray* triggerMuonArray = ana.Config()->GetListElements(AliAnalysisMuMuConfig::kDimuonTriggerList,IsSimulation());
TObjArray* triggerMBArray = ana.Config()->GetListElements(AliAnalysisMuMuConfig::kMinbiasTriggerList,IsSimulation());
TObjArray* centralityArray = ana.Config()->GetListElements(AliAnalysisMuMuConfig::kCentralitySelectionList, IsSimulation());
// Iterator for loops
TIter nextTriggerMuon(triggerMuonArray);
TIter nextTriggerMB(triggerMBArray);
TIter nextEventType(eventTypeArray);
TIter nextCentrality(centralityArray);
// Strings
TObjString* striggerMuon;
TObjString* striggerMB;
TObjString* seventType;
TObjString* scentrality;
//Pointers on histo
TH1*h(0x0);
TH1*h1(0x0);
TH1*h2(0x0);
Double_t FNormOverStat(0.);
Double_t FNormTotError(0.);
Double_t FNormTotErrorInverse(0.);
Double_t FNormTotErrorSys(0.);
Double_t Norm(1.);
Int_t n =0; //counter
nextEventType.Reset();
// Loop on each envenType (see MuMuConfig)
//==============================================================================
while ( ( seventType = static_cast<TObjString*>(nextEventType())) )
{
AliDebug(1,Form("EVENTTYPE %s",seventType->String().Data()));
nextTriggerMuon.Reset();
// Loop on each Muon trigger (see MuMuConfig)
//==============================================================================
while ( ( striggerMuon = static_cast<TObjString*>(nextTriggerMuon())) )
{
AliDebug(1,Form("-MUON TRIGGER %s",striggerMuon->String().Data()));
nextTriggerMB.Reset();
// Loop on each MB trigger (not the ones in MuMuConfig but the ones set)
//==============================================================================
while ( ( striggerMB = static_cast<TObjString*>(nextTriggerMB())) )
{
AliDebug(1,Form("-- MB PAIRCUT %s",striggerMB->String().Data()));
nextCentrality.Reset();
// Loop on each centrality
//==============================================================================
while ( ( scentrality = static_cast<TObjString*>(nextCentrality()) ) )
{
TString id(Form("/FNORM-%s/%s/%s/PbPb",striggerMuon->String().Data(),seventType->String().Data(),scentrality->String().Data())); // Path where are saved histos in the mergeable collection
h = OC()->Histo(id.Data(),Form("hFNormIntVSrun_%s",striggerMB->String().Data()));
if (!h)
{
AliDebug(1,Form("Can't get histo %s/hFNormIntVSrun_%s",id.Data(),striggerMB->String().Data()));
continue;
}
h1 = OC()->Histo(id.Data(),Form("hFNormInt_%s",striggerMB->String().Data()));
if (!h1)
{
AliDebug(1,Form("Can't get histo %s/hFNormInt_%s",id.Data(),striggerMB->String().Data()));
continue;
}
//.........这里部分代码省略.........
示例14: MultiHistoOverlap
void MultiHistoOverlap(TString namesandlabels, Int_t nOfFiles, const TString& outDir="./"){
gROOT->Reset();
gROOT->ProcessLine(".L tdrstyle.C");
gROOT->ProcessLine("setTDRStyle()");
// gSystem->Load("libRooFit");
// using namespace RooFit;
// preamble
TPaveText *cmsprel = new TPaveText(0.19, 0.95, 0.95, 0.99, "NDC");
cmsprel->SetTextSize(0.03);
cmsprel->SetTextFont(42);
cmsprel->SetFillColor(0);
cmsprel->SetBorderSize(0);
cmsprel->SetMargin(0.01);
cmsprel->SetTextAlign(12); // align left
TString text = "CMS Preliminary 2011";
cmsprel->AddText(0.0, 0.5,text);
TString text2 = "#sqrt{s} = 7 TeV |#eta_{#mu}|<2.4";
cmsprel->AddText(0.8, 0.5, text2);
TList* FileList = new TList();
TList* LabelList = new TList();
TObjArray *nameandlabelpairs = namesandlabels.Tokenize(",");
for (Int_t i = 0; i < nameandlabelpairs->GetEntries(); ++i) {
TObjArray *aFileLegPair = TString(nameandlabelpairs->At(i)->GetName()).Tokenize("=");
if(aFileLegPair->GetEntries() == 2) {
FileList->Add( TFile::Open(aFileLegPair->At(0)->GetName()) );
LabelList->Add( aFileLegPair->At(1) );
} else {
std::cout << "Please give file name and legend entry in the following form:\n" << " filename1=legendentry1,filename2=legendentry2\n";
}
}
Int_t NOfFiles = FileList->GetSize();
if ( NOfFiles!=nOfFiles ){
std::cout<<"&MSG-e: NOfFiles = "<<nOfFiles<<std::endl;
return;
}
std::vector<TString> LegLabels;
LegLabels.reserve(nOfFiles);
for(Int_t j=0; j < nOfFiles; j++) {
TObjString* legend = (TObjString*)LabelList->At(j);
LegLabels.push_back(legend->String());
std::cout<<"LegLabels["<<j<<"]"<<LegLabels[j]<<std::endl;
}
TLegend *leg=0;
TCanvas* c0 = new TCanvas("c0", "c0",50, 20, 800,600);
TCanvas* c1 = new TCanvas("c1", "c1",50, 20, 800,600);
TCanvas* c2 = new TCanvas("c2", "c2",50, 20, 800,600);
TCanvas* c3 = new TCanvas("c3", "c3",50, 20, 800,600);
TCanvas* c4 = new TCanvas("c4", "c4",50, 20, 800,600);
TCanvas* c5 = new TCanvas("c5", "c5",50, 20, 1200,800);
TCanvas* c6 = new TCanvas("c6", "c6",50, 20, 1200,800);
TCanvas* c0s = new TCanvas("c0s", "c0s",50, 20, 800,600);
TCanvas* c1s = new TCanvas("c1s", "c1s",50, 20, 800,600);
TCanvas* c2s = new TCanvas("c2s", "c2s",50, 20, 800,600);
TCanvas* c3s = new TCanvas("c3s", "c3s",50, 20, 800,600);
TCanvas* cFit = new TCanvas("cFit", "cFit",50, 20, 1600, 800);
//----------------- CANVAS C0 --------------//
c0->SetFillColor(0);
c0->cd();
leg = new TLegend(0.50,0.25,0.90,0.40);
leg->SetBorderSize(1);
leg->SetFillColor(0);
leg->SetTextFont(42);
// Mass VS muon phi plus -------------------------------
TH1D *histoMassVsPhiPlus[nOfFiles];
for(Int_t j=0; j < nOfFiles; j++) {
TFile *fin = (TFile*)FileList->At(j);
if (( histoMassVsPhiPlus[j] = (TH1D*)fin->Get("MassVsPhiPlus/allHistos/meanHisto"))){
histoMassVsPhiPlus[j]->SetLineStyle(linestylelist[j]);
histoMassVsPhiPlus[j]->SetMarkerColor(colorlist[j]);
histoMassVsPhiPlus[j]->SetLineColor(colorlist[j]);
histoMassVsPhiPlus[j]->SetMarkerStyle(markerstylelist[j]);
// histoMassVsPhiPlus[j]->SetMarkerSize(0.75);
if ( j == 0 ) {
histoMassVsPhiPlus[j]->GetXaxis()->SetTitle("positive muon #phi (rad)");
histoMassVsPhiPlus[j]->GetYaxis()->SetTitle("M_{#mu#mu} (GeV)");
// histoMassVsPhiPlus[j]->GetYaxis()->SetRangeUser(88.5,93.5);
histoMassVsPhiPlus[j]->GetYaxis()->SetRangeUser(90.0,91.5);
histoMassVsPhiPlus[j]->GetXaxis()->SetRangeUser(-3.14,3.14);
histoMassVsPhiPlus[j]->Draw();
} else {
histoMassVsPhiPlus[j]->Draw("SAME");
}
leg->AddEntry(histoMassVsPhiPlus[j],LegLabels[j],"PL");
//.........这里部分代码省略.........
示例15: WriteClassWithTemplateImp
//___________________________________________________
void KVClassFactory::WriteClassWithTemplateImp()
{
// Writes the implementation file for the class
ofstream file_cpp;
file_cpp.open( GetImpFileName() );
WriteWhoWhen(file_cpp);
file_cpp << "#include \"" << fClassName.Data() << ".h\"" << endl;
if( fImpInc.GetSize() ){
TIter next(&fImpInc); TObjString* str;
while( (str = (TObjString*)next()) ){
file_cpp << "#include \"" << str->String().Data() << "\"" << endl;
}
}
file_cpp << endl << "ClassImp(" << fClassName.Data() << ")\n" << endl;
file_cpp <<
"////////////////////////////////////////////////////////////////////////////////"
<< endl;
file_cpp << "// BEGIN_HTML <!--" << endl;
file_cpp << "/* -->" << endl;
file_cpp << "<h2>" << fClassName.Data() << "</h2>" << endl;
file_cpp << "<h4>" << fClassDesc.Data() << "</h4>" << endl;
file_cpp << "<!-- */" << endl;
file_cpp << "// --> END_HTML" << endl;
file_cpp <<
"////////////////////////////////////////////////////////////////////////////////\n"
<< endl;
TString cppFile;
ifstream file_cpp_template;
//open file whose full path was stored in fTemplateCPP
if (!KVBase::
SearchAndOpenKVFile(fTemplateCPP.Data(), file_cpp_template)) {
//this should never happen!
cout << "<KVClassFactory::WriteClassWithTemplateImp>: cannot open "
<< fTemplateCPP.Data() << endl;
return;
}
cppFile.ReadFile(file_cpp_template);
file_cpp_template.close();
file_cpp << cppFile.ReplaceAll(fTemplateClassName.Data(),
fClassName.Data());
//write implementations of added methods
if( fMethods.GetSize() ){
KVString line;
TIter next( &fMethods ); KVClassMethod* meth;
while( (meth = (KVClassMethod*)next()) ){
meth->WriteImplementation(line);
line.Prepend("\n//________________________________________________________________\n");
file_cpp << line.Data();
}
}
file_cpp.close();
cout << "<KVClassFactory::WriteClassWithTemplateImp> : File " << GetImpFileName() << " generated." << endl;
}