本文整理汇总了C++中TNtuple::Clone方法的典型用法代码示例。如果您正苦于以下问题:C++ TNtuple::Clone方法的具体用法?C++ TNtuple::Clone怎么用?C++ TNtuple::Clone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TNtuple
的用法示例。
在下文中一共展示了TNtuple::Clone方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: newData
DataFile::GetData(){
stringstream convert;
int nameVal = 0;
convert.str(filename);
convert >> nameVal;
bool success = false;
//Find file type
string type = "";
size_t pos = filename.find_last_of('.');
if(gType.compare("XS")==0){
TNtuple newData ("newData","", cols.c_str() );
newData.ReadFile(name.c_str());
cout<<"TNtuple created"<<endl;
dataTuple = (TNtuple*) newData.Clone();
cout<<name.c_str()<<endl;
cout<<dataTuple<<endl;
success = true;
}
else{
if(pos != string::npos){
if(filename[pos+1] == 'r'){
if(filename[pos-1] == 'e'){
type.assign("ginuke");
}
else{
type.assign("gst");
}
}
else{
type.assign("txt");
}
}
else{
type.assign("chain");
}
if(type[0]!='t'){
if(type[0]=='g'){
//Normal .ginuke file, Easy
file = new TFile(name.c_str());
if(file->IsOpen()){
TTree* dummy = file->Get(type.c_str());
dataTree = (TTree*)dummy->Clone();
delete dummy;
success=true;
}
else{
cout<<name.c_str()<<" was not found. Skipping [GENIE] tag."<<endl;
success=false;
}
}
//Chaining together some files
else{
TChain chain("ginuke");
TChain* dummy = &chain;
//Need to have name separate from directory in order to properly construct this filename.
string n = dir+"/gntp.*"+filename+"*.ginuke.root";
cout<<"Making a chain called "<<n<<endl;
chain.Add(n.c_str());
cout<<"Chain created."<<endl;
dataTree = (TTree*)dummy->Clone();
cout<<"dummy cloned"<<endl;
success=true;
}
}
else{
//Grabbing simple data from the text file
dataTree = new TTree("textData",title.c_str());
int nCol = this->analyzeTextFile();
success = true;
if(gType.compare("Energy")==0){
if(nCol==3){dataTree->ReadFile(name.c_str(),"E/D:xsec:err1");}
else if(nCol==2){dataTree->ReadFile(name.c_str(),"E/D:xsec");}
else{cout<<"Published data file has an unrecognized format."<<endl;
success=false;}
}
if(gType.compare("Momentum")==0){
if(nCol==3){dataTree->ReadFile(name.c_str(),"ph/D:xsec:err1");}
else if(nCol==2){dataTree->ReadFile(name.c_str(),"ph/D:xsec");}
else{cout<<"Published data file has an unrecognized format."<<endl;
success=false;}
}
if(gType.compare("Angle")==0){
if(nCol==3){dataTree->ReadFile(name.c_str(),"cth/D:xsec:err1");}
else if(nCol==2){dataTree->ReadFile(name.c_str(),"cth/D:xsec");}
else{cout<<"Published data file has an unrecognized format."<<endl;
success=false;}
}
}
}
return success;
}