| 1867 |
TList* PamLevel2::GetListOfLevel2Files(TString ddir, TString flisttxt = ""){ |
TList* PamLevel2::GetListOfLevel2Files(TString ddir, TString flisttxt = ""){ |
| 1868 |
|
|
| 1869 |
TString wdir = gSystem->WorkingDirectory(); |
TString wdir = gSystem->WorkingDirectory(); |
|
// cout << "Working directory: "<<wdir<<endl; |
|
| 1870 |
|
|
|
// if(ddir=="")ddir = wdir; |
|
|
// TSystemDirectory *datadir = new TSystemDirectory(gSystem->BaseName(ddir),ddir); |
|
| 1871 |
if ( ddir != ""){ |
if ( ddir != ""){ |
| 1872 |
cout << "Level2 data directory : "<< ddir << endl; |
cout << "Level2 data directory : "<< ddir << endl; |
| 1873 |
} else { |
} else { |
| 1876 |
TList *contents = new TList; // create output list |
TList *contents = new TList; // create output list |
| 1877 |
contents->SetOwner(); |
contents->SetOwner(); |
| 1878 |
|
|
| 1879 |
// char *fullpath; |
// -------------------------------------- |
| 1880 |
// const char *fullpath; |
// case 1 : input file/file-list provided |
| 1881 |
|
// -------------------------------------- |
|
// if no input file list is given: |
|
| 1882 |
if ( flisttxt != "" ){ |
if ( flisttxt != "" ){ |
| 1883 |
|
|
| 1884 |
// if( !gSystem->IsFileInIncludePath(flisttxt,&fullpath) ){ |
// -------------------------------------- |
| 1885 |
// if( !(fullpath = gSystem->FindFile("./",flisttxt)) ){ |
// a list of files given as input |
| 1886 |
// cout <<"File "<<flisttxt<<" not found"<<endl; |
// -------------------------------------- |
|
// return 0; |
|
|
// } |
|
|
// flisttxt = fullpath; |
|
| 1887 |
if ( !flisttxt.EndsWith(".root") ){ |
if ( !flisttxt.EndsWith(".root") ){ |
| 1888 |
|
|
| 1889 |
TString dir = gSystem->DirName(flisttxt); |
TString dir = gSystem->DirName(flisttxt); |
| 1906 |
return 0; |
return 0; |
| 1907 |
} |
} |
| 1908 |
int line=0; |
int line=0; |
| 1909 |
|
// ........................... |
| 1910 |
|
// loop over file-list records |
| 1911 |
|
// ........................... |
| 1912 |
while (1) { |
while (1) { |
| 1913 |
TString file; |
TString file; |
| 1914 |
in >> file; |
in >> file; |
| 1915 |
if (!in.good()) break; |
if (!in.good()) break; |
| 1916 |
line++; |
line++; |
| 1917 |
// cout <<"(1) " << file << endl; |
cout <<"(*) " << file << endl; |
| 1918 |
if(file.IsNull()){ |
if(file.IsNull()){ |
| 1919 |
cout << "-- list interrupted at line "<<line <<endl; |
cout << "-- list interrupted at line "<<line <<endl; |
| 1920 |
break; |
break; |
| 1921 |
} |
} |
| 1922 |
if(file.Contains("#"))file = file(0,file.First("#")); |
if(file.Contains("#"))file = file(0,file.First("#")); |
| 1923 |
// cout <<"(2) " << file << endl; |
// |
| 1924 |
// if( gSystem->IsFileInIncludePath(file,&fullpath) ){ |
// take only root files |
| 1925 |
// if( (fullpath = gSystem->FindFile(ddir,file)) ){ |
// |
| 1926 |
if( file.EndsWith(".root") ){ |
if( file.EndsWith(".root") ){ |
| 1927 |
TString filedir; |
TString filedir; |
| 1928 |
|
cout << ddir << endl; |
| 1929 |
if (ddir != ""){ |
if (ddir != ""){ |
| 1930 |
filedir = ddir; // take the input dir |
filedir = ddir; // take the input dir |
| 1931 |
} else { |
} else { |
| 1932 |
gSystem->ChangeDirectory(wdir); // back to the working directory |
gSystem->ChangeDirectory(wdir); // back to the working directory |
| 1933 |
filedir = gSystem->DirName(file); // this will take the path if exist in the list otherwise it will return automatically the working dir |
filedir = gSystem->DirName(file); // this will take the path if exist in the list otherwise it will return automatically the working dir |
| 1934 |
}; |
}; |
| 1935 |
|
filedir.Append("/"); |
| 1936 |
char *fullpath = gSystem->ConcatFileName(gSystem->DirName(filedir),gSystem->BaseName(file)); |
char *fullpath = gSystem->ConcatFileName(gSystem->DirName(filedir),gSystem->BaseName(file)); |
| 1937 |
contents->Add(new TSystemFile(fullpath,gSystem->DirName(fullpath)));// add file to the list |
contents->Add(new TSystemFile(fullpath,gSystem->DirName(fullpath)));// add file to the list |
| 1938 |
|
cout << fullpath << endl; |
| 1939 |
delete fullpath; |
delete fullpath; |
| 1940 |
} |
} |
| 1941 |
// }else{ |
// }else{ |
| 1943 |
// }; |
// }; |
| 1944 |
}; |
}; |
| 1945 |
in.close(); |
in.close(); |
| 1946 |
|
// -------------------------------------- |
| 1947 |
|
// a single root file given as input |
| 1948 |
|
// -------------------------------------- |
| 1949 |
} else { |
} else { |
| 1950 |
if(flisttxt.Contains("#"))flisttxt = flisttxt(0,flisttxt.First("#")); |
if(flisttxt.Contains("#"))flisttxt = flisttxt(0,flisttxt.First("#")); |
| 1951 |
char *fullpath = gSystem->ConcatFileName(gSystem->DirName(flisttxt),gSystem->BaseName(flisttxt)); |
char *fullpath = gSystem->ConcatFileName(gSystem->DirName(flisttxt),gSystem->BaseName(flisttxt)); |
| 1952 |
contents->Add(new TSystemFile(fullpath,gSystem->DirName(fullpath)));// add file to the list |
contents->Add(new TSystemFile(fullpath,gSystem->DirName(fullpath)));// add file to the list |
| 1953 |
delete fullpath; |
delete fullpath; |
| 1954 |
}; |
}; |
| 1955 |
|
// --------------------------------------------------------------------------------- |
| 1956 |
|
// case 2 : no input file/file-list provided --> read all files insede the directory |
| 1957 |
|
// --------------------------------------------------------------------------------- |
| 1958 |
}else{ |
}else{ |
| 1959 |
|
|
| 1960 |
cout << "No input file list given."<<endl; |
cout << "No input file list given."<<endl; |
| 2735 |
totdltime[1]-=GetTrigLevel2()->dltime[1];//dead-time |
totdltime[1]-=GetTrigLevel2()->dltime[1];//dead-time |
| 2736 |
} |
} |
| 2737 |
totdltime[2]--; //event counter |
totdltime[2]--; //event counter |
| 2738 |
cout << endl; |
if(DBG){ |
| 2739 |
cout << "n.events : "<<totdltime[2]<<endl; |
cout << endl; |
| 2740 |
cout << "RUN LIVE-TIME: "<<totdltime[0]*0.16<<" ms"<<endl; |
cout << "n.events : "<<totdltime[2]<<endl; |
| 2741 |
cout << "RUN DEAD-TIME: "<<totdltime[1]*0.01<<" ms"<<endl; |
cout << "RUN LIVE-TIME: "<<totdltime[0]*0.16<<" ms"<<endl; |
| 2742 |
|
cout << "RUN DEAD-TIME: "<<totdltime[1]*0.01<<" ms"<<endl; |
| 2743 |
|
} |
| 2744 |
}else{ |
}else{ |
| 2745 |
totdltime[0]=0;//live-time |
totdltime[0]=0;//live-time |
| 2746 |
totdltime[1]=0;//dead-time |
totdltime[1]=0;//dead-time |
| 2747 |
totdltime[2]=0; //event counter |
totdltime[2]=0; //event counter |
| 2748 |
cout << " *** JUMP RUN *** irun "<<irun<<endl; |
if(DBG)cout << " *** JUMP RUN *** irun "<<irun<<endl; |
| 2749 |
} |
} |
| 2750 |
/// add an entry |
/// add an entry |
| 2751 |
if(run_tree_clone) |
if(run_tree_clone) |